From 52dd4f282cbf1f0ed363aef507386c6d293a505d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 15 Jan 2018 09:34:45 -0500 Subject: [PATCH 01/30] build-sys: Post-release version bump I'm still doing release, then versionbump as separate PRs to ensure the release commit is tested by itself. Closes: #1417 Approved by: pwithnall --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index a4e1e74f..6c19e041 100644 --- a/configure.ac +++ b/configure.ac @@ -4,10 +4,10 @@ dnl update libostree-released.sym from libostree-devel.sym, and update the check dnl in test-symbols.sh, and also set is_release_build=yes below. Then make dnl another post-release commit to bump the version, and set is_release_build=no. m4_define([year_version], [2018]) -m4_define([release_version], [1]) +m4_define([release_version], [2]) m4_define([package_version], [year_version.release_version]) AC_INIT([libostree], [package_version], [walters@verbum.org]) -is_release_build=yes +is_release_build=no AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([buildutil]) AC_CONFIG_AUX_DIR([build-aux]) From 792b32eb9669d47c6b318fb6dcec41870f998880 Mon Sep 17 00:00:00 2001 From: Matthew Leeds Date: Fri, 12 Jan 2018 22:22:50 -0800 Subject: [PATCH 02/30] man: Update ostree-summary.xml Update the man page for the summary command to add the undocumented options, make the syntax clear, and add examples. Closes: #1416 Approved by: pwithnall --- man/ostree-summary.xml | 71 +++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/man/ostree-summary.xml b/man/ostree-summary.xml index 815d2b5a..b4629c3d 100644 --- a/man/ostree-summary.xml +++ b/man/ostree-summary.xml @@ -44,12 +44,16 @@ Boston, MA 02111-1307, USA. ostree-summary - Regenerate the summary metadata file + Regenerate or view the summary metadata file - ostree summary OPTIONS + ostree summary --gpg-sign=KEYID --gpg-homedir=HOMEDIR --update --add-metadata=KEY=VALUE + + + + ostree summary --view--raw @@ -70,20 +74,13 @@ Boston, MA 02111-1307, USA. - + , - Update the summary file. - - Any additional arguments to the command - are treated as additional key–value pairs to be added to the - summary file as additional metadata. They must be in the format - KEY=VALUE - or as two separate arguments. The keys must be namespaced for - your organisation or repository using a dot prefix. The values - must be in GVariant text format. For example, - exampleos.end-of-life "@t 1445385600". - + Update the summary file. This option can be combined + with to add metadata + fields to the summary. + + + + + + + + + ostree find-remotes + OSTree + + + + Developer + Matthew + Leeds + matthew.leeds@endlessm.com + + + + + + ostree find-remotes + 1 + + + + ostree-find-remotes + Find remotes to serve the given refs + + + + + ostree find-remotes OPTIONS COLLECTION-ID REF COLLECTION-ID REF + + + + + Description + + + + OSTree has the ability do pulls not just from configured remote + servers but also from peer computers on the LAN and from mounted + filesystems such as USB drives. Currently this requires compiling + OSTree with experimental API enabled, and it requires the use of + collection IDs and GPG verification. + + + The find-remotes command searches for remotes + which claim to provide one or more of the given COLLECTION-ID REF + pairs and prints information about them, with remotes sorted by + latency (Mounts > LAN > Internet). By default, OSTree searches for + remotes in configuration files, on mounted filesystems (in a + well-known location), and on the LAN using Avahi. Searching for LAN + remotes requires OSTree to have been compiled with Avahi support, + and it requires an Avahi daemon to be running. You can override the + default set of finders (sources for remotes) using the + option documented below. + + + + + Options + + + + + + + Do not invoke fsync(). + + + + + + =FINDERS + + + Use the specified comma separated list of finders rather than + the default set. Possible values: config, + lan, and mount (or any + combination thereof). + + + + + + + + Pull the most recent commit found for each ref. + + + + + + + + Example + $ ostree find-remotes --finders=mount,lan com.exampleos.Os exampleos/x86_64/standard + +Result 0: http://10.0.64.202:43381/0 + - Finder: OstreeRepoFinderAvahi + - Keyring: exampleos.trustedkeys.gpg + - Priority: 60 + - Summary last modified: 2018-01-12T19:00:28Z + - Refs: + - (com.exampleos.Os, exampleos/x86_64/standard) = c91acd964b3fda561b87bfb7f7c80e36220d76b567f0ce90c0e60742ef33c360 + +1/1 refs were found. + + + diff --git a/man/ostree.xml b/man/ostree.xml index 940d81d7..05b02c5d 100644 --- a/man/ostree.xml +++ b/man/ostree.xml @@ -290,6 +290,15 @@ Boston, MA 02111-1307, USA. + + ostree-fsck1 diff --git a/src/ostree/ot-builtin-find-remotes.c b/src/ostree/ot-builtin-find-remotes.c index b99f6e6a..3df84a4f 100644 --- a/src/ostree/ot-builtin-find-remotes.c +++ b/src/ostree/ot-builtin-find-remotes.c @@ -164,7 +164,6 @@ validate_finders_list (char **finders, return TRUE; } -/* TODO: Add a man page. */ gboolean ostree_builtin_find_remotes (int argc, char **argv, From ebc104d3c7671b2a84b83b14407359478b4150a4 Mon Sep 17 00:00:00 2001 From: Matthew Leeds Date: Fri, 12 Jan 2018 16:32:09 -0800 Subject: [PATCH 04/30] find-remotes: Minor fixes to --finders code This introduces no functional changes, only cleanups. Closes: #1414 Approved by: jlebon --- src/ostree/ot-builtin-find-remotes.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ostree/ot-builtin-find-remotes.c b/src/ostree/ot-builtin-find-remotes.c index 3df84a4f..67dbdaa6 100644 --- a/src/ostree/ot-builtin-find-remotes.c +++ b/src/ostree/ot-builtin-find-remotes.c @@ -37,8 +37,8 @@ static gboolean opt_pull = FALSE; static GOptionEntry options[] = { { "cache-dir", 0, 0, G_OPTION_ARG_FILENAME, &opt_cache_dir, "Use custom cache dir", NULL }, - { "finders", 0, 0, G_OPTION_ARG_STRING, &opt_finders, "Use the specified comma separated list of finders (e.g. config,lan,mount)", "FINDERS" }, { "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL }, + { "finders", 0, 0, G_OPTION_ARG_STRING, &opt_finders, "Use the specified comma separated list of finders (e.g. config,lan,mount)", "FINDERS" }, { "pull", 0, 0, G_OPTION_ARG_NONE, &opt_pull, "Pull the updates after finding them", NULL }, { NULL } }; @@ -119,7 +119,7 @@ collection_ref_free0 (OstreeCollectionRef *ref) } static gboolean -validate_finders_list (char **finders, +validate_finders_list (const char **finders, GOptionContext *context, GError **error) { @@ -139,10 +139,10 @@ validate_finders_list (char **finders, return FALSE; } - for (char **iter = finders; iter && *iter; iter++) + for (const char **iter = finders; iter && *iter; iter++) { gboolean is_valid_finder = FALSE; - for (int i = 0; i < 3; i++) + for (unsigned int i = 0; i < G_N_ELEMENTS (valid_finders); i++) { if (valid_finders[i].already_used == TRUE) continue; @@ -234,11 +234,11 @@ ostree_builtin_find_remotes (int argc, g_auto(GStrv) finders_strings = NULL; finders_strings = g_strsplit (opt_finders, ",", 0); - if (!validate_finders_list (finders_strings, context, error)) + if (!validate_finders_list ((const char **)finders_strings, context, error)) return FALSE; - finders = g_ptr_array_new (); - for (char **iter =finders_strings; iter && *iter; iter++) + finders = g_ptr_array_new_with_free_func (NULL); + for (const char **iter = (const char **)finders_strings; iter && *iter; iter++) { if (g_strcmp0 (*iter, "config") == 0) { From c5d6725d9141a5583addcca0caf726e24c430595 Mon Sep 17 00:00:00 2001 From: William Manley Date: Sat, 13 Jan 2018 15:30:17 +0000 Subject: [PATCH 05/30] ostree admin deploy: Refactor bringing cleaning into `main` In the next commit I will add --no-prune which will affect cleaning. By doing this refactor we avoid having to add a NO_PRUNE flag. Closes: #1418 Approved by: cgwalters --- src/ostree/ot-admin-builtin-deploy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index 8da9dbc3..68d17e95 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -162,7 +162,7 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat kargs_strv, &new_deployment, cancellable, error)) return FALSE; - OstreeSysrootSimpleWriteDeploymentFlags flags = 0; + OstreeSysrootSimpleWriteDeploymentFlags flags = OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN; if (opt_retain) flags |= OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN; else @@ -180,5 +180,10 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat merge_deployment, flags, cancellable, error)) return FALSE; + /* And finally, cleanup of any leftover data. + */ + if (!ostree_sysroot_cleanup (self, cancellable, error)) + return FALSE; + return TRUE; } From 2098f75c2f0c11620ab1072548f805f02d4c45cb Mon Sep 17 00:00:00 2001 From: William Manley Date: Mon, 15 Jan 2018 20:53:54 +0000 Subject: [PATCH 06/30] ostree admin deploy: Add --no-prune option If you want cleanup, but don't want to prune the repo. Pruning can be quite expensive so ostree admin deploy can be much faster without pruning. Closes: #1418 Approved by: cgwalters --- src/ostree/ot-admin-builtin-deploy.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index 68d17e95..a4aa3c33 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -35,6 +35,7 @@ static gboolean opt_retain; static gboolean opt_retain_pending; static gboolean opt_retain_rollback; static gboolean opt_not_as_default; +static gboolean opt_no_prune; static char **opt_kernel_argv; static char **opt_kernel_argv_append; static gboolean opt_kernel_proc_cmdline; @@ -50,6 +51,7 @@ static gboolean opt_kernel_arg_none; static GOptionEntry options[] = { { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Use a different operating system root than the current one", "OSNAME" }, { "origin-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_origin_path, "Specify origin file", "FILENAME" }, + { "no-prune", 0, 0, G_OPTION_ARG_NONE, &opt_no_prune, "Don't prune the repo when done", NULL}, { "retain", 0, 0, G_OPTION_ARG_NONE, &opt_retain, "Do not delete previous deployments", NULL }, { "retain-pending", 0, 0, G_OPTION_ARG_NONE, &opt_retain_pending, "Do not delete pending deployments", NULL }, { "retain-rollback", 0, 0, G_OPTION_ARG_NONE, &opt_retain_rollback, "Do not delete rollback deployments", NULL }, @@ -182,8 +184,16 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat /* And finally, cleanup of any leftover data. */ - if (!ostree_sysroot_cleanup (self, cancellable, error)) - return FALSE; + if (opt_no_prune) + { + if (!ostree_sysroot_prepare_cleanup (sysroot, cancellable, error)) + return FALSE; + } + else + { + if (!ostree_sysroot_cleanup (sysroot, cancellable, error)) + return FALSE; + } return TRUE; } From c5112c25e4519835c4cd53f4350c1b2f2a477746 Mon Sep 17 00:00:00 2001 From: William Manley Date: Mon, 6 Mar 2017 19:41:46 +0000 Subject: [PATCH 07/30] syslinux: Add support for DEVICETREE from bootloader spec The bootloader spec says: > `devicetree` refers to the binary device tree to use when executing the > kernel. This also shall be a path relative to the `$BOOT` directory. This > key is optional. Example: > `6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.armv7hl/tegra20-paz00.dtb` This is necessary for booting my NVidia Tegra TK1 device. It uses u-boot with syslinux compatibility. In the syslinux files that come with the device this is called `FDT`, but u-boot treats `FDT and `DEVICETREE` as synonyms. See also: [f43c401 in u-boot]. [f43c401 in u-boot]: http://git.denx.de/?p=u-boot.git;a=commit;h=f43c401b72bb0db43ab0b55c4a79e1f4889d3aa2 Closes: #1411 Approved by: cgwalters --- src/libostree/ostree-bootloader-syslinux.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libostree/ostree-bootloader-syslinux.c b/src/libostree/ostree-bootloader-syslinux.c index 85b84e61..8b09a861 100644 --- a/src/libostree/ostree-bootloader-syslinux.c +++ b/src/libostree/ostree-bootloader-syslinux.c @@ -95,6 +95,10 @@ append_config_from_loader_entries (OstreeBootloaderSyslinux *self, if (val) g_ptr_array_add (new_lines, g_strdup_printf ("\tINITRD %s", val)); + val = ostree_bootconfig_parser_get (config, "devicetree"); + if (val) + g_ptr_array_add (new_lines, g_strdup_printf ("\tDEVICETREE %s", val)); + val = ostree_bootconfig_parser_get (config, "options"); if (val) g_ptr_array_add (new_lines, g_strdup_printf ("\tAPPEND %s", val)); From 720e2ec9bc401ec82deb64d5f493d5a2a41dd87d Mon Sep 17 00:00:00 2001 From: William Manley Date: Tue, 9 Jan 2018 19:40:07 +0000 Subject: [PATCH 08/30] Add support for devicetree files alongside the kernel and initramfs Much like the (optional) initramfs at `/usr/lib/ostree-boot/initramfs-` or `/usr/lib/modules/$kver/initramfs` you can now optionally include a flattened devicetree (.dtb) file alongside the kernel at `/usr/lib/ostree-boot/devicetree-` or `/usr/lib/modules/$kver/devicetree`. This is useful for embedded ARM systems which need the devicetree file loaded by the bootloader for the kernel to discover and initialise hardware. See https://en.wikipedia.org/wiki/Device_tree for more information. This patch was mostly produced by copy-pasting code for initramfs handling and renaming `s/initramfs/devicetree/g`. It's not beautiful, but it is fairly straightforward. It may be useful to extend device-tree support in a number ways in the future. Device trees dependant on many details of the hardware they support. This makes them unlike kernels, which may support many different hardware variants as long as the instruction-set matches. This means that a ostree tree created with a device-tree in this manner will only boot on a single model of hardware. This is sufficient for my purposes, but may not be for others'. I've tested this on my NVidia Tegra TK1 device which has u-boot running in syslinux-compatible mode. Closes: #1411 Approved by: cgwalters --- docs/manual/atomic-upgrades.md | 2 +- docs/manual/deployment.md | 9 ++-- src/libostree/ostree-sysroot-deploy.c | 77 +++++++++++++++++++++++++-- tests/test-no-initramfs.sh | 22 ++++++-- 4 files changed, 96 insertions(+), 14 deletions(-) diff --git a/docs/manual/atomic-upgrades.md b/docs/manual/atomic-upgrades.md index 341372d0..890617cf 100644 --- a/docs/manual/atomic-upgrades.md +++ b/docs/manual/atomic-upgrades.md @@ -95,7 +95,7 @@ collected at any point. ## The /ostree/boot directory However, we want to optimize for the case where the set of -kernel/initramfs pairs is the same between both the old and new +kernel/initramfs/devicetree sets is the same between both the old and new deployment lists. This happens when doing an upgrade that does not include the kernel; think of a simple translation update. OSTree optimizes for this case because on some systems `/boot` may be on a diff --git a/docs/manual/deployment.md b/docs/manual/deployment.md index 013a2d0e..957044db 100644 --- a/docs/manual/deployment.md +++ b/docs/manual/deployment.md @@ -53,10 +53,11 @@ paths, which are `vmlinuz(-.*)?-$checksum` in either `/boot` or `/usr/lib/ostree The checksum should be a SHA256 hash of the kernel contents; it must be pre-computed before storing the kernel in the repository. Optionally, the directory can also contain an initramfs, stored as -`initramfs(-.*)?-$checksum`. If this exists, the checksum must include -both the kernel and initramfs contents. OSTree will use this to -determine which kernels are shared. The rationale for this is to avoid -computing checksums on the client by default. +`initramfs(-.*)?-$checksum` and/or a device tree, stored as +`devicetree(-.*)?-$checksum`. If an initramfs or devicetree exist, +the checksum must include all of the kernel, initramfs and devicetree contents. +OSTree will use this to determine which kernels are shared. The rationale for +this is to avoid computing checksums on the client by default. The deployment should not have a traditional UNIX `/etc`; instead, it should include `/usr/etc`. This is the "default configuration". When diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 5dc5bde0..d477d2c4 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -93,7 +93,7 @@ sysroot_flags_to_copy_flags (GLnxFileCopyFlags defaults, } /* Try a hardlink if we can, otherwise fall back to copying. Used - * right now for kernels/initramfs in /boot, where we can just + * right now for kernels/initramfs/device trees in /boot, where we can just * hardlink if we're on the same partition. */ static gboolean @@ -894,6 +894,8 @@ typedef struct { char *kernel_namever; char *initramfs_srcpath; char *initramfs_namever; + char *devicetree_srcpath; + char *devicetree_namever; char *bootcsum; } OstreeKernelLayout; static void @@ -904,6 +906,8 @@ _ostree_kernel_layout_free (OstreeKernelLayout *layout) g_free (layout->kernel_namever); g_free (layout->initramfs_srcpath); g_free (layout->initramfs_namever); + g_free (layout->devicetree_srcpath); + g_free (layout->devicetree_namever); g_free (layout->bootcsum); g_free (layout); } @@ -1025,6 +1029,22 @@ get_kernel_from_tree_usrlib_modules (int deployment_dfd, if (!ot_gio_splice_update_checksum (NULL, in, &checksum, cancellable, error)) return FALSE; } + g_clear_object (&in); + glnx_close_fd (&fd); + + if (!ot_openat_ignore_enoent (ret_layout->boot_dfd, "devicetree", &fd, error)) + return FALSE; + if (fd != -1) + { + ret_layout->devicetree_srcpath = g_strdup ("devicetree"); + ret_layout->devicetree_namever = g_strdup_printf ("devicetree-%s", kver); + in = g_unix_input_stream_new (fd, FALSE); + if (!ot_gio_splice_update_checksum (NULL, in, &checksum, cancellable, error)) + return FALSE; + } + + g_clear_object (&in); + glnx_close_fd (&fd); char hexdigest[OSTREE_SHA256_STRING_LEN+1]; ot_checksum_get_hexdigest (&checksum, hexdigest, sizeof (hexdigest)); @@ -1044,6 +1064,7 @@ get_kernel_from_tree_legacy_layouts (int deployment_dfd, const char *legacy_paths[] = {"usr/lib/ostree-boot", "boot"}; g_autofree char *kernel_checksum = NULL; g_autofree char *initramfs_checksum = NULL; + g_autofree char *devicetree_checksum = NULL; g_autoptr(OstreeKernelLayout) ret_layout = _ostree_kernel_layout_new (); for (guint i = 0; i < G_N_ELEMENTS (legacy_paths); i++) @@ -1110,9 +1131,23 @@ get_kernel_from_tree_legacy_layouts (int deployment_dfd, ret_layout->initramfs_namever = g_strndup (name, dash - name); } } + /* See if this is the devicetree */ + else if (ret_layout->devicetree_srcpath == NULL && g_str_has_prefix (name, "devicetree-")) + { + const char *dash = strrchr (name, '-'); + g_assert (dash); + if (ostree_validate_structureof_checksum_string (dash + 1, NULL)) + { + devicetree_checksum = g_strdup (dash + 1); + ret_layout->devicetree_srcpath = g_strdup (name); + ret_layout->devicetree_namever = g_strndup (name, dash - name); + } + } - /* If we found both a kernel and initramfs, break out of the loop */ - if (ret_layout->kernel_srcpath != NULL && ret_layout->initramfs_srcpath != NULL) + /* If we found a kernel, an initramfs and a devicetree, break out of the loop */ + if (ret_layout->kernel_srcpath != NULL && + ret_layout->initramfs_srcpath != NULL && + ret_layout->devicetree_srcpath != NULL) break; } @@ -1132,6 +1167,19 @@ get_kernel_from_tree_legacy_layouts (int deployment_dfd, return glnx_throw (error, "Mismatched kernel checksum vs initrd"); } + /* The kernel/devicetree checksums must be the same */ + if (ret_layout->devicetree_srcpath != NULL) + { + g_assert (kernel_checksum != NULL); + g_assert (devicetree_checksum != NULL); + if (strcmp (kernel_checksum, devicetree_checksum) != 0) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "Mismatched kernel checksum vs device tree in tree"); + return FALSE; + } + } + ret_layout->bootcsum = g_steal_pointer (&kernel_checksum); *out_layout = g_steal_pointer (&ret_layout); @@ -1567,7 +1615,7 @@ install_deployment_kernel (OstreeSysroot *sysroot, &deployment_dfd, error)) return FALSE; - /* Find the kernel/initramfs in the tree */ + /* Find the kernel/initramfs/devicetree in the tree */ g_autoptr(OstreeKernelLayout) kernel_layout = NULL; if (!get_kernel_from_tree (deployment_dfd, &kernel_layout, cancellable, error)) @@ -1628,6 +1676,21 @@ install_deployment_kernel (OstreeSysroot *sysroot, } } + if (kernel_layout->devicetree_srcpath) + { + g_assert (kernel_layout->devicetree_namever); + if (!glnx_fstatat_allow_noent (bootcsum_dfd, kernel_layout->devicetree_namever, &stbuf, 0, error)) + return FALSE; + if (errno == ENOENT) + { + if (!hardlink_or_copy_at (kernel_layout->boot_dfd, kernel_layout->devicetree_srcpath, + bootcsum_dfd, kernel_layout->devicetree_namever, + sysroot->debug_flags, + cancellable, error)) + return FALSE; + } + } + g_autofree char *contents = NULL; if (!glnx_fstatat_allow_noent (deployment_dfd, "usr/lib/os-release", &stbuf, 0, error)) return FALSE; @@ -1717,6 +1780,12 @@ install_deployment_kernel (OstreeSysroot *sysroot, _ostree_kernel_args_replace_take (kargs, g_steal_pointer (&prepare_root_arg)); } + if (kernel_layout->devicetree_namever) + { + g_autofree char * boot_relpath = g_strconcat ("/", bootcsumdir, "/", kernel_layout->devicetree_namever, NULL); + ostree_bootconfig_parser_set (bootconfig, "devicetree", boot_relpath); + } + /* Note this is parsed in ostree-impl-system-generator.c */ g_autofree char *ostree_kernel_arg = g_strdup_printf ("ostree=/ostree/boot.%d/%s/%s/%d", new_bootversion, osname, bootcsum, diff --git a/tests/test-no-initramfs.sh b/tests/test-no-initramfs.sh index 7c23a3e7..52bb9d98 100755 --- a/tests/test-no-initramfs.sh +++ b/tests/test-no-initramfs.sh @@ -2,7 +2,7 @@ . $(dirname $0)/libtest.sh -echo "1..7" +echo "1..10" setup_os_repository "archive-z2" "uboot" @@ -20,11 +20,12 @@ echo "ok deployment with initramfs" pull_test_tree() { kernel_contents=$1 initramfs_contents=$2 + devicetree_contents=$3 - printf "TEST SETUP:\n kernel: %s\n initramfs: %s\n layout: %s\n" \ - "$kernel_contents" "$initramfs_contents" "$layout" + printf "TEST SETUP:\n kernel: %s\n initramfs: %s\n devicetree: %s\n layout: %s\n" \ + "$kernel_contents" "$initramfs_contents" "$devicetree_contents" "$layout" - rm -rf ${test_tmpdir}/osdata/usr/lib/modules/3.6.0/{initramfs.img,vmlinuz} \ + rm -rf ${test_tmpdir}/osdata/usr/lib/modules/3.6.0/{initramfs.img,vmlinuz,devicetree} \ ${test_tmpdir}/osdata/usr/lib/ostree-boot \ ${test_tmpdir}/osdata/boot if [ "$layout" = "/usr/lib/modules" ]; then @@ -32,14 +33,16 @@ pull_test_tree() { cd ${test_tmpdir}/osdata/usr/lib/modules/3.6.0 echo -n "$kernel_contents" > vmlinuz [ -n "$initramfs_contents" ] && echo -n "$initramfs_contents" > initramfs.img + [ -n "$devicetree_contents" ] && echo -n "$devicetree_contents" > devicetree elif [ "$layout" = "/usr/lib/ostree-boot" ] || [ "$layout" = "/boot" ]; then # "Legacy" layout mkdir -p "${test_tmpdir}/osdata/$layout" cd "${test_tmpdir}/osdata/$layout" - bootcsum=$(echo -n "$kernel_contents$initramfs_contents" \ + bootcsum=$(echo -n "$kernel_contents$initramfs_contents$devicetree_contents" \ | sha256sum | cut -f 1 -d ' ') echo -n "$kernel_contents" > vmlinuz-${bootcsum} [ -n "$initramfs_contents" ] && echo -n "$initramfs_contents" > initramfs-${bootcsum} + [ -n "$devicetree_contents" ] && echo -n "$devicetree_contents" > devicetree-${bootcsum} else exit 1 fi @@ -75,4 +78,13 @@ do assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'init=' echo "ok switching from no initramfs to initramfs enabled sysroot layout=$layout" + + pull_test_tree "the kernel" "" "my .dtb file" + ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime + + assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'init=' + assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-testos-0.conf 'devicetree')" "my .dtb file" + assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'initrd' + + echo "ok switching from initramfs to no initramfs sysroot with devicetree layout=$layout" done From 654a9177d09fa58816286ab6dc72a957b167e8c7 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 17 Jan 2018 09:18:45 -0500 Subject: [PATCH 09/30] lib/pull: Port a few functions to new style Prep for further work here. This diff is a bit noisy for the delta bits because the identation was off originally as well. Closes: #1424 Approved by: jlebon --- src/libostree/ostree-repo-pull.c | 205 ++++++++++++------------------- 1 file changed, 79 insertions(+), 126 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index ab59c33a..41d7ae2c 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -2130,19 +2130,12 @@ process_one_static_delta (OtPullData *pull_data, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - gboolean delta_byteswap; - g_autoptr(GVariant) metadata = NULL; - g_autoptr(GVariant) headers = NULL; - g_autoptr(GVariant) fallback_objects = NULL; - guint i, n; - - delta_byteswap = _ostree_delta_needs_byteswap (delta_superblock); + gboolean delta_byteswap = _ostree_delta_needs_byteswap (delta_superblock); /* Parsing OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT */ - metadata = g_variant_get_child_value (delta_superblock, 0); - headers = g_variant_get_child_value (delta_superblock, 6); - fallback_objects = g_variant_get_child_value (delta_superblock, 7); + g_autoptr(GVariant) metadata = g_variant_get_child_value (delta_superblock, 0); + g_autoptr(GVariant) headers = g_variant_get_child_value (delta_superblock, 6); + g_autoptr(GVariant) fallback_objects = g_variant_get_child_value (delta_superblock, 7); /* Gather free space so we can do a check below */ struct statvfs stvfsbuf; @@ -2150,8 +2143,8 @@ process_one_static_delta (OtPullData *pull_data, return glnx_throw_errno_prefix (error, "fstatvfs"); /* First process the fallbacks */ - n = g_variant_n_children (fallback_objects); - for (i = 0; i < n; i++) + guint n = g_variant_n_children (fallback_objects); + for (guint i = 0; i < n; i++) { g_autoptr(GVariant) fallback_object = g_variant_get_child_value (fallback_objects, i); @@ -2159,99 +2152,84 @@ process_one_static_delta (OtPullData *pull_data, if (!process_one_static_delta_fallback (pull_data, delta_byteswap, fallback_object, cancellable, error)) - goto out; + return FALSE; } /* Write the to-commit object */ if (!pull_data->dry_run) - { - g_autoptr(GVariant) to_csum_v = NULL; - g_autofree char *to_checksum = NULL; - gboolean have_to_commit; + { + g_autoptr(GVariant) to_csum_v = g_variant_get_child_value (delta_superblock, 3); + if (!ostree_validate_structureof_csum_v (to_csum_v, error)) + return FALSE; + g_autofree char *to_checksum = ostree_checksum_from_bytes_v (to_csum_v); - to_csum_v = g_variant_get_child_value (delta_superblock, 3); - if (!ostree_validate_structureof_csum_v (to_csum_v, error)) - goto out; - to_checksum = ostree_checksum_from_bytes_v (to_csum_v); + gboolean have_to_commit; + if (!ostree_repo_has_object (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, to_checksum, + &have_to_commit, cancellable, error)) + return FALSE; - if (!ostree_repo_has_object (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, to_checksum, - &have_to_commit, cancellable, error)) - goto out; - - if (!have_to_commit) - { - FetchObjectData *fetch_data; - g_autoptr(GVariant) to_commit = g_variant_get_child_value (delta_superblock, 4); - g_autofree char *detached_path = _ostree_get_relative_static_delta_path (from_revision, to_revision, "commitmeta"); - g_autoptr(GVariant) detached_data = NULL; + if (!have_to_commit) + { + g_autoptr(GVariant) to_commit = g_variant_get_child_value (delta_superblock, 4); + g_autofree char *detached_path = _ostree_get_relative_static_delta_path (from_revision, to_revision, "commitmeta"); + g_autoptr(GVariant) detached_data = g_variant_lookup_value (metadata, detached_path, G_VARIANT_TYPE("a{sv}")); - detached_data = g_variant_lookup_value (metadata, detached_path, G_VARIANT_TYPE("a{sv}")); + if (!gpg_verify_unwritten_commit (pull_data, to_revision, to_commit, detached_data, + cancellable, error)) + return FALSE; - if (!gpg_verify_unwritten_commit (pull_data, to_revision, to_commit, detached_data, - cancellable, error)) - goto out; + if (detached_data && !ostree_repo_write_commit_detached_metadata (pull_data->repo, + to_revision, + detached_data, + cancellable, + error)) + return FALSE; - if (detached_data && !ostree_repo_write_commit_detached_metadata (pull_data->repo, - to_revision, - detached_data, - cancellable, - error)) - goto out; + FetchObjectData *fetch_data = g_new0 (FetchObjectData, 1); + fetch_data->pull_data = pull_data; + fetch_data->object = ostree_object_name_serialize (to_checksum, OSTREE_OBJECT_TYPE_COMMIT); + fetch_data->is_detached_meta = FALSE; + fetch_data->object_is_stored = FALSE; + fetch_data->requested_ref = (ref != NULL) ? ostree_collection_ref_dup (ref) : NULL; - fetch_data = g_new0 (FetchObjectData, 1); - fetch_data->pull_data = pull_data; - fetch_data->object = ostree_object_name_serialize (to_checksum, OSTREE_OBJECT_TYPE_COMMIT); - fetch_data->is_detached_meta = FALSE; - fetch_data->object_is_stored = FALSE; - fetch_data->requested_ref = (ref != NULL) ? ostree_collection_ref_dup (ref) : NULL; - - ostree_repo_write_metadata_async (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, to_checksum, - to_commit, - pull_data->cancellable, - on_metadata_written, fetch_data); - pull_data->n_outstanding_metadata_write_requests++; - } - } + ostree_repo_write_metadata_async (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, to_checksum, + to_commit, + pull_data->cancellable, + on_metadata_written, fetch_data); + pull_data->n_outstanding_metadata_write_requests++; + } + } n = g_variant_n_children (headers); pull_data->n_total_deltaparts += n; - - for (i = 0; i < n; i++) + + for (guint i = 0; i < n; i++) { - const guchar *csum; - g_autoptr(GVariant) header = NULL; gboolean have_all = FALSE; - g_autofree char *deltapart_path = NULL; - FetchStaticDeltaData *fetch_data; + + g_autoptr(GVariant) header = g_variant_get_child_value (headers, i); g_autoptr(GVariant) csum_v = NULL; g_autoptr(GVariant) objects = NULL; g_autoptr(GBytes) inline_part_bytes = NULL; - guint64 size, usize; guint32 version; - - header = g_variant_get_child_value (headers, i); + guint64 size, usize; g_variant_get (header, "(u@aytt@ay)", &version, &csum_v, &size, &usize, &objects); - version = maybe_swap_endian_u32 (delta_byteswap, version); size = maybe_swap_endian_u64 (delta_byteswap, size); usize = maybe_swap_endian_u64 (delta_byteswap, usize); if (version > OSTREE_DELTAPART_VERSION) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Delta part has too new version %u", version); - goto out; - } + return glnx_throw (error, "Delta part has too new version %u", version); - csum = ostree_checksum_bytes_peek_validate (csum_v, error); + const guchar *csum = ostree_checksum_bytes_peek_validate (csum_v, error); if (!csum) - goto out; + return FALSE; if (!_ostree_repo_static_delta_part_have_all_objects (pull_data->repo, objects, &have_all, cancellable, error)) - goto out; + return FALSE; pull_data->total_deltapart_size += size; pull_data->total_deltapart_usize += usize; @@ -2266,7 +2244,7 @@ process_one_static_delta (OtPullData *pull_data, continue; } - deltapart_path = _ostree_get_relative_static_delta_part_path (from_revision, to_revision, i); + g_autofree char *deltapart_path = _ostree_get_relative_static_delta_part_path (from_revision, to_revision, i); { g_autoptr(GVariant) part_datav = g_variant_lookup_value (metadata, deltapart_path, G_VARIANT_TYPE ("(yay)")); @@ -2277,8 +2255,8 @@ process_one_static_delta (OtPullData *pull_data, if (pull_data->dry_run) continue; - - fetch_data = g_new0 (FetchStaticDeltaData, 1); + + FetchStaticDeltaData *fetch_data = g_new0 (FetchStaticDeltaData, 1); fetch_data->from_revision = g_strdup (from_revision); fetch_data->to_revision = g_strdup (to_revision); fetch_data->pull_data = pull_data; @@ -2297,7 +2275,7 @@ process_one_static_delta (OtPullData *pull_data, OSTREE_STATIC_DELTA_OPEN_FLAGS_SKIP_CHECKSUM, NULL, &inline_delta_part, cancellable, error)) - goto out; + return FALSE; _ostree_static_delta_part_execute_async (pull_data->repo, fetch_data->objects, @@ -2328,14 +2306,11 @@ process_one_static_delta (OtPullData *pull_data, { g_autofree char *formatted_required = g_format_size (pull_data->total_deltapart_usize); g_autofree char *formatted_avail = g_format_size (((guint64)stvfsbuf.f_bsize) * stvfsbuf.f_bfree); - glnx_throw (error, "Delta requires %s free space, but only %s available", - formatted_required, formatted_avail); - goto out; + return glnx_throw (error, "Delta requires %s free space, but only %s available", + formatted_required, formatted_avail); } - ret = TRUE; - out: - return ret; + return TRUE; } /* @@ -2806,18 +2781,16 @@ _ostree_preload_metadata_file (OstreeRepo *self, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - if (is_metalink) { - g_autoptr(OstreeMetalink) metalink = NULL; GError *local_error = NULL; /* the metalink uri is buried in the mirrorlist as the first (and only) * element */ - metalink = _ostree_metalink_new (fetcher, filename, - OSTREE_MAX_METADATA_SIZE, - mirrorlist->pdata[0]); + g_autoptr(OstreeMetalink) metalink = + _ostree_metalink_new (fetcher, filename, + OSTREE_MAX_METADATA_SIZE, + mirrorlist->pdata[0]); _ostree_metalink_request_sync (metalink, NULL, out_bytes, cancellable, &local_error); @@ -2830,25 +2803,18 @@ _ostree_preload_metadata_file (OstreeRepo *self, else if (local_error != NULL) { g_propagate_error (error, local_error); - goto out; + return FALSE; } + + return TRUE; } else { - ret = _ostree_fetcher_mirrored_request_to_membuf (fetcher, mirrorlist, - filename, - OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT, - out_bytes, - OSTREE_MAX_METADATA_SIZE, - cancellable, error); - - if (!ret) - goto out; + return _ostree_fetcher_mirrored_request_to_membuf (fetcher, mirrorlist, filename, + OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT, + out_bytes, OSTREE_MAX_METADATA_SIZE, + cancellable, error); } - - ret = TRUE; -out: - return ret; } static gboolean @@ -2858,29 +2824,23 @@ fetch_mirrorlist (OstreeFetcher *fetcher, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - g_auto(GStrv) lines = NULL; - g_autofree char *contents = NULL; - g_autoptr(OstreeFetcherURI) mirrorlist = NULL; g_autoptr(GPtrArray) ret_mirrorlist = g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free); - mirrorlist = _ostree_fetcher_uri_parse (mirrorlist_url, error); + g_autoptr(OstreeFetcherURI) mirrorlist = _ostree_fetcher_uri_parse (mirrorlist_url, error); if (!mirrorlist) - goto out; + return FALSE; + g_autofree char *contents = NULL; if (!fetch_uri_contents_utf8_sync (fetcher, mirrorlist, &contents, cancellable, error)) - { - g_prefix_error (error, "While fetching mirrorlist '%s': ", - mirrorlist_url); - goto out; - } + return glnx_prefix_error (error, "While fetching mirrorlist '%s'", + mirrorlist_url); /* go through each mirror in mirrorlist and do a quick sanity check that it * works so that we don't waste the fetcher's time when it goes through them * */ - lines = g_strsplit (contents, "\n", -1); + g_auto(GStrv) lines = g_strsplit (contents, "\n", -1); g_debug ("Scanning mirrorlist from '%s'", mirrorlist_url); for (char **iter = lines; iter && *iter; iter++) { @@ -2936,18 +2896,11 @@ fetch_mirrorlist (OstreeFetcher *fetcher, } if (ret_mirrorlist->len == 0) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "No valid mirrors were found in mirrorlist '%s'", - mirrorlist_url); - goto out; - } + return glnx_throw (error, "No valid mirrors were found in mirrorlist '%s'", + mirrorlist_url); *out_mirrorlist = g_steal_pointer (&ret_mirrorlist); - ret = TRUE; - -out: - return ret; + return TRUE; } static gboolean From 6e4306ea107e25ca35c4df172aeccd25ecda3b85 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 18 Jan 2018 09:01:27 -0500 Subject: [PATCH 10/30] ci/papr: Update most contexts to f27 Many of them actually already *were* because they were inherting. An exception is flatpak which is being worked on in https://github.com/ostreedev/ostree/pull/1400 Closes: #1426 Approved by: jlebon --- .papr.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.papr.yml b/.papr.yml index 2016c61b..bc22d63f 100644 --- a/.papr.yml +++ b/.papr.yml @@ -51,10 +51,10 @@ tests: --- -context: f26-rust +context: f27-rust inherit: true container: - image: registry.fedoraproject.org/fedora:26 + image: registry.fedoraproject.org/fedora:27 env: CONFIGOPTS: '--enable-rust' CI_PKGS: cargo @@ -65,10 +65,10 @@ tests: --- -context: f26-gnutls +context: f27-gnutls inherit: true container: - image: registry.fedoraproject.org/fedora:26 + image: registry.fedoraproject.org/fedora:27 env: CONFIGOPTS: '--with-crypto=gnutls' CI_PKGS: pkgconfig(gnutls) @@ -81,7 +81,7 @@ tests: inherit: true -context: f26-experimental-api +context: f27-experimental-api env: CONFIGOPTS: '--enable-experimental-api' @@ -92,7 +92,7 @@ tests: inherit: true -context: f26-minimal +context: f27-minimal env: CONFIGOPTS: '--without-curl --without-soup --disable-gtk-doc --disable-man --disable-rust --without-libarchive --without-selinux --without-smack @@ -107,7 +107,7 @@ tests: inherit: true required: true -context: f26-libsoup +context: f27-libsoup env: CONFIGOPTS: "--without-curl --without-openssl --with-libsoup" @@ -120,7 +120,7 @@ tests: inherit: true required: true -context: f26-introspection-tests +context: f27-introspection-tests env: # ASAN conflicts with introspection testing; @@ -138,15 +138,15 @@ branches: - auto - try -context: f26ah-insttest +context: f27ah-insttest required: false cluster: hosts: - name: vmcheck - distro: fedora/26/atomic + distro: fedora/27/atomic container: - image: registry.fedoraproject.org/fedora:26 + image: registry.fedoraproject.org/fedora:27 # Copy the build from the container to the host; ideally down the line # this is installing an RPM via https://github.com/jlebon/redhat-ci/issues/10 From 661ec2b1a46a913845ab27d95ea86729b2807121 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 9 Jan 2018 13:20:24 -0500 Subject: [PATCH 11/30] =?UTF-8?q?ci:=20Run=20a=20subset=20=E2=8A=82=20of?= =?UTF-8?q?=20rpm-ostree's=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a quick hack to get us more than unit testing, albeit indirectly. See: https://github.com/projectatomic/rpm-ostree/issues/662 Closes: #771 Approved by: jlebon --- .papr.yml | 36 +++++++++++++++++++++++++++++++++++ ci/rpmostree.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100755 ci/rpmostree.sh diff --git a/.papr.yml b/.papr.yml index bc22d63f..d33046ec 100644 --- a/.papr.yml +++ b/.papr.yml @@ -181,3 +181,39 @@ tests: artifacts: - test-suite.log + +--- + +# Run rpm-ostree's vmcheck. This is a temporary hack until +# we share more code. https://github.com/projectatomic/rpm-ostree/issues/662 +inherit: false + +branches: + - master + - auto + - try + +context: f27-rpmostree +required: true + +cluster: + hosts: + - name: vmcheck + distro: fedora/27/atomic + container: + image: registry.fedoraproject.org/fedora:27 + +env: + HOSTS: vmcheck + # This should roughly match the Fedora spec file, although right now we don't + # explicitly enable gtk-doc because we don't really need it + CONFIGOPTS: '--with-selinux --with-dracut=yesbutnoconf --with-curl --with-openssl' + +tests: + - ./ci/rpmostree.sh + +artifacts: + - test-suite.log + - vmcheck + +timeout: 60m diff --git a/ci/rpmostree.sh b/ci/rpmostree.sh new file mode 100755 index 00000000..d40dd6a2 --- /dev/null +++ b/ci/rpmostree.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Build and run rpm-ostree's unit tests using the just-built ostree for this PR. + +set -xeuo pipefail + +# Frozen to a tag for now to help predictability; it's +# also useful to test building *older* versions since +# that must work. +RPMOSTREE_TAG=v2017.11 + +dn=$(dirname $0) +. ${dn}/libbuild.sh + +codedir=$(pwd) + +pkg_upgrade +pkg_install_builddeps ostree +pkg_install_builddeps rpm-ostree +pkg_install rpm-ostree && rpm -e rpm-ostree + +# Duplicate of deps from build.sh in rpm-ostree for tests +pkg_install ostree{,-devel,-grub2} createrepo_c /usr/bin/jq PyYAML \ + libubsan libasan libtsan elfutils fuse sudo python-gobject-base \ + selinux-policy-devel selinux-policy-targeted +# This one is in the papr.yml +pkg_install rsync + +# build+install ostree +cd ${codedir} +build ${CONFIGOPTS:-} +make install + +tmpd=$(mktemp -d) +cd ${tmpd} +git clone --recursive --depth=1 -b ${RPMOSTREE_TAG} https://github.com/projectatomic/rpm-ostree +cd rpm-ostree +build +# We want to capture automake results +cleanup() { + mv test-suite.log ${codedir} || true +} +trap cleanup EXIT +make -j 8 check +# Basic sanity test of rpm-ostree+new ostree by restarting rpm-ostreed +if ! make vmsync; then + ssh -o User=root vmcheck 'journalctl --no-pager | tail -1000' + fatal "vmsync failed" +fi +# Now run tests; just a subset ⊂ for now to avoid CI overload +make vmcheck TESTS="basic layering-basic" From 42eea23864194d7429c974938be529a641e4f2ba Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 18 Jan 2018 09:19:21 -0500 Subject: [PATCH 12/30] bin/delta: Fix compilation with relative subdirs --filename Currently we were parsing `opt_filename` twice...I dug through the history a bit and it looks like it may have been an accident from refactoring. What we're fixing here concretely is that using relative subdirectories like `--filename somesubdir/foo` broke because we were incorrectly passing the `somesubdir/` again. Closes: #1423 Closes: #1427 Approved by: jlebon --- .../ostree-repo-static-delta-compilation.c | 32 ++++--------------- tests/test-delta.sh | 5 +-- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index 2dc61718..be2cbb64 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -1370,7 +1370,6 @@ ostree_repo_static_delta_generate (OstreeRepo *self, g_autoptr(GVariant) detached = NULL; gboolean inline_parts; guint endianness = G_BYTE_ORDER; - glnx_autofd int tmp_dfd = -1; builder.parts = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_static_delta_part_builder_unref); builder.fallback_objects = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref); g_auto(GLnxTmpfile) descriptor_tmpf = { 0, }; @@ -1416,36 +1415,13 @@ ostree_repo_static_delta_generate (OstreeRepo *self, &to_commit, error)) goto out; - if (opt_filename) - { - g_autofree char *dnbuf = g_strdup (opt_filename); - const char *dn = dirname (dnbuf); - if (!glnx_opendirat (AT_FDCWD, dn, TRUE, &tmp_dfd, error)) - goto out; - } - else - { - tmp_dfd = fcntl (self->tmp_dir_fd, F_DUPFD_CLOEXEC, 3); - if (tmp_dfd < 0) - { - glnx_set_error_from_errno (error); - goto out; - } - } - - builder.parts_dfd = tmp_dfd; builder.delta_opts = delta_opts; - /* Ignore optimization flags */ - if (!generate_delta_lowlatency (self, from, to, delta_opts, &builder, - cancellable, error)) - goto out; - if (opt_filename) { g_autofree char *dnbuf = g_strdup (opt_filename); const char *dn = dirname (dnbuf); - descriptor_name = g_strdup (opt_filename); + descriptor_name = g_strdup (glnx_basename (opt_filename)); if (!glnx_opendirat (AT_FDCWD, dn, TRUE, &descriptor_dfd, error)) goto out; @@ -1463,6 +1439,12 @@ ostree_repo_static_delta_generate (OstreeRepo *self, descriptor_name = g_strdup (basename (descriptor_relpath)); } + builder.parts_dfd = descriptor_dfd; + + /* Ignore optimization flags */ + if (!generate_delta_lowlatency (self, from, to, delta_opts, &builder, + cancellable, error)) + goto out; if (!glnx_open_tmpfile_linkable_at (descriptor_dfd, ".", O_WRONLY | O_CLOEXEC, &descriptor_tmpf, error)) diff --git a/tests/test-delta.sh b/tests/test-delta.sh index 97d94391..55f4e93f 100755 --- a/tests/test-delta.sh +++ b/tests/test-delta.sh @@ -123,8 +123,9 @@ fi ostree_repo_init temp-repo --mode=archive ${CMD_PREFIX} ostree --repo=temp-repo pull-local repo -${CMD_PREFIX} ostree --repo=temp-repo static-delta generate --empty --to=${newrev} --filename=some.delta -assert_has_file some.delta +mkdir tmpsubdir +${CMD_PREFIX} ostree --repo=temp-repo static-delta generate --empty --to=${newrev} --filename=tmpsubdir/some.delta +assert_has_file tmpsubdir/some.delta ${CMD_PREFIX} ostree --repo=temp-repo static-delta list > delta-list.txt assert_file_has_content delta-list.txt 'No static deltas' rm temp-repo -rf From 660bc588ee62717dbccaca18b6d2c5e4120c0901 Mon Sep 17 00:00:00 2001 From: Matthew Leeds Date: Thu, 18 Jan 2018 00:32:05 -0800 Subject: [PATCH 13/30] lib/pull: Allow specific commits in P2P updates Currently users of the find_remotes_async()/pull_from_remotes_async() functions have no way to specify a commit hash to use instead of the latest one available. This commit implements an "override-commit-ids" option analogous to the one used by ostree_repo_pull_with_options(). It's accomplished by returning OstreeRepoFinderResult objects pointing to the given commit checksum(s) regardless of which ones were available from the remotes, but in the future this implementation could be improved to take into account the commits advertised by the remotes. One effect of this is that flatpak will have the ability to downgrade apps that use collection IDs (https://github.com/flatpak/flatpak/issues/1309). Closes: #1425 Approved by: pwithnall --- src/libostree/ostree-repo-pull.c | 80 +++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 41d7ae2c..464d7e66 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -4611,7 +4611,11 @@ static void find_remotes_cb (GObject *obj, * Pass the results to ostree_repo_pull_from_remotes_async() to pull the given @refs * from those remotes. * - * No @options are currently supported. + * The following @options are currently defined: + * + * * `override-commit-ids` (`as`): Array of specific commit IDs to fetch. The nth + * commit ID applies to the nth ref, so this must be the same length as @refs, if + * provided. * * @finders must be a non-empty %NULL-terminated array of the #OstreeRepoFinder * instances to use, or %NULL to use the system default set of finders, which @@ -4640,6 +4644,7 @@ ostree_repo_find_remotes_async (OstreeRepo *self, g_autoptr(OstreeRepoFinder) finder_config = NULL; g_autoptr(OstreeRepoFinder) finder_mount = NULL; g_autoptr(OstreeRepoFinder) finder_avahi = NULL; + g_autofree char **override_commit_ids = NULL; g_return_if_fail (OSTREE_IS_REPO (self)); g_return_if_fail (is_valid_collection_ref_array (refs)); @@ -4649,6 +4654,12 @@ ostree_repo_find_remotes_async (OstreeRepo *self, g_return_if_fail (progress == NULL || OSTREE_IS_ASYNC_PROGRESS (progress)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); + if (options) + { + (void) g_variant_lookup (options, "override-commit-ids", "^a&s", &override_commit_ids); + g_return_if_fail (override_commit_ids == NULL || g_strv_length ((gchar **) refs) == g_strv_length (override_commit_ids)); + } + /* Set up a task for the whole operation. */ task = g_task_new (self, cancellable, callback, user_data); g_task_set_source_tag (task, ostree_repo_find_remotes_async); @@ -4856,6 +4867,7 @@ find_remotes_cb (GObject *obj, g_autoptr(OstreeFetcher) fetcher = NULL; g_autofree const gchar **ref_to_latest_commit = NULL; /* indexed as @refs; (element-type commit-checksum) */ gsize n_refs; + g_autofree char **override_commit_ids = NULL; g_autoptr(GPtrArray) remotes_to_remove = NULL; /* (element-type OstreeRemote) */ g_autoptr(GPtrArray) final_results = NULL; /* (element-type OstreeRepoFinderResult) */ @@ -4888,13 +4900,10 @@ find_remotes_cb (GObject *obj, * to be %NULL-safe. */ g_ptr_array_set_free_func (results, (GDestroyNotify) repo_finder_result_free0); - /* FIXME: Add support for options: - * - override-commit-ids (allow downgrades) - * - * Use case: multiple pulls of separate subdirs; want them to use the same - * configuration. - * Use case: downgrading a flatpak app. - */ + if (data->options) + { + (void) g_variant_lookup (data->options, "override-commit-ids", "^a&s", &override_commit_ids); + } /* FIXME: In future, we also want to pull static delta superblocks in this * phase, so that we have all the metadata we need for accurate size @@ -5144,10 +5153,11 @@ find_remotes_cb (GObject *obj, * differences between remotes: two remotes could both contain ref R, but one * remote could be outdated compared to the other, and point to an older * commit. For each ref, we want to find the most recent commit any remote - * points to for it. + * points to for it (unless override-commit-ids was used). * * @ref_to_latest_commit is indexed by @ref_index, and its values are the - * latest checksum for each ref. */ + * latest checksum for each ref. If override-commit-ids was used, + * @ref_to_latest_commit won't be initialized or used.*/ ref_to_latest_commit = g_new0 (const gchar *, n_refs); for (i = 0; i < n_refs; i++) @@ -5157,6 +5167,13 @@ find_remotes_cb (GObject *obj, const CommitMetadata *latest_commit_metadata = NULL; g_autofree gchar *latest_commit_timestamp_str = NULL; + if (override_commit_ids) + { + g_debug ("%s: Using specified commit ‘%s’ for ref (%s, %s).", + G_STRFUNC, override_commit_ids[i], refs[i]->collection_id, refs[i]->ref_name); + continue; + } + for (j = 0; j < results->len; j++) { const CommitMetadata *candidate_commit_metadata; @@ -5217,26 +5234,37 @@ find_remotes_cb (GObject *obj, ostree_collection_ref_equal, (GDestroyNotify) ostree_collection_ref_free, g_free); - n_latest_refs = 0; - for (j = 0; refs[j] != NULL; j++) + if (override_commit_ids) { - const gchar *latest_commit_for_ref = ref_to_latest_commit[j]; - - if (pointer_table_get (refs_and_remotes_table, j, i) != latest_commit_for_ref) - latest_commit_for_ref = NULL; - if (latest_commit_for_ref != NULL) - n_latest_refs++; - - g_hash_table_insert (validated_ref_to_checksum, ostree_collection_ref_dup (refs[j]), g_strdup (latest_commit_for_ref)); + for (j = 0; refs[j] != NULL; j++) + g_hash_table_insert (validated_ref_to_checksum, ostree_collection_ref_dup (refs[j]), + g_strdup (override_commit_ids[j])); } - - if (n_latest_refs == 0) + else { - g_debug ("%s: Omitting remote ‘%s’ from results as none of its refs are new enough.", - G_STRFUNC, result->remote->name); - ostree_repo_finder_result_free (g_steal_pointer (&g_ptr_array_index (results, i))); - continue; + n_latest_refs = 0; + + for (j = 0; refs[j] != NULL; j++) + { + const gchar *latest_commit_for_ref = ref_to_latest_commit[j]; + + if (pointer_table_get (refs_and_remotes_table, j, i) != latest_commit_for_ref) + latest_commit_for_ref = NULL; + if (latest_commit_for_ref != NULL) + n_latest_refs++; + + g_hash_table_insert (validated_ref_to_checksum, ostree_collection_ref_dup (refs[j]), + g_strdup (latest_commit_for_ref)); + } + + if (n_latest_refs == 0) + { + g_debug ("%s: Omitting remote ‘%s’ from results as none of its refs are new enough.", + G_STRFUNC, result->remote->name); + ostree_repo_finder_result_free (g_steal_pointer (&g_ptr_array_index (results, i))); + continue; + } } result->ref_to_checksum = g_steal_pointer (&validated_ref_to_checksum); From 794d1d98d6328c5fad174d6b409f4f1692e338cf Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 9 Jan 2018 13:01:47 -0500 Subject: [PATCH 14/30] ci: Bump flatpak version (and build to f27) Just keeping this updated. Closes: #1400 Approved by: jlebon --- .papr.yml | 6 +-- ...-Fix-race-condition-in-tmp-webserver.patch | 44 ------------------- ci/flatpak.sh | 43 +++++++++--------- 3 files changed, 23 insertions(+), 70 deletions(-) delete mode 100644 ci/0001-tests-Fix-race-condition-in-tmp-webserver.patch diff --git a/.papr.yml b/.papr.yml index d33046ec..6e67d232 100644 --- a/.papr.yml +++ b/.papr.yml @@ -165,19 +165,19 @@ branches: - auto - try -context: f26-flatpak +context: f27-flatpak required: false # This test case wants an "unprivileged container with bubblewrap", # which we don't have right now; so just provision a VM and do a # docker --privileged run. host: - distro: fedora/26/atomic + distro: fedora/27/atomic specs: ram: 4096 # build-bundle is a static delta, which needs RAM right now tests: - - docker run --rm --privileged -v $(pwd):/srv/code registry.fedoraproject.org/fedora:26 /bin/sh -c "cd /srv/code && ./ci/flatpak.sh" + - docker run --rm --privileged -v $(pwd):/srv/code registry.fedoraproject.org/fedora:27 /bin/sh -c "cd /srv/code && ./ci/flatpak.sh" artifacts: - test-suite.log diff --git a/ci/0001-tests-Fix-race-condition-in-tmp-webserver.patch b/ci/0001-tests-Fix-race-condition-in-tmp-webserver.patch deleted file mode 100644 index dc66425f..00000000 --- a/ci/0001-tests-Fix-race-condition-in-tmp-webserver.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6197e6922e3ba3c8881733a6a3253e8ae12eb538 Mon Sep 17 00:00:00 2001 -From: Colin Walters -Date: Fri, 5 May 2017 16:36:04 -0400 -Subject: [PATCH] tests: Fix race condition in tmp webserver - -I was seeing this when trying to run flatpak's tests in ostree's CI: -https://github.com/ostreedev/ostree/pull/824 - -The race here is that the python process can still be writing to the output -while sed is reading it, and hence we'll find a difference on the next line. -Fix this by making a tmp copy of the file, which then both sed and cmp will -read consistently. - -I'm not *entirely* sure this will fix the problem as I couldn't easily reproduce -the race locally, but I believe it at least fixes *a* race. ---- - tests/test-webserver.sh | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/tests/test-webserver.sh b/tests/test-webserver.sh -index 3291b06..2964ce9 100755 ---- a/tests/test-webserver.sh -+++ b/tests/test-webserver.sh -@@ -10,9 +10,15 @@ env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd - child_pid=$! - - for x in $(seq 50); do -- sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port -- if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then -- break -+ # Snapshot the output -+ cp ${test_tmpdir}/httpd-output{,.tmp} -+ # If it's non-empty, see whether it matches our regexp -+ if test -s ${test_tmpdir}/httpd-output.tmp; then -+ sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port -+ if ! cmp ${test_tmpdir}/httpd-output.tmp ${test_tmpdir}/httpd-port 1>/dev/null; then -+ # If so, we've successfully extracted the port -+ break -+ fi - fi - sleep 0.1 - done --- -2.9.3 diff --git a/ci/flatpak.sh b/ci/flatpak.sh index 16812480..cdd03593 100755 --- a/ci/flatpak.sh +++ b/ci/flatpak.sh @@ -3,40 +3,37 @@ set -xeuo pipefail +# Frozen to a tag for now to help predictability; it's +# also useful to test building *older* versions since +# that must work. +FLATPAK_TAG=0.10.2.1 + dn=$(dirname $0) . ${dn}/libbuild.sh -build() { - env NOCONFIGURE=1 ./autogen.sh - ./configure --prefix=/usr --libdir=/usr/lib64 "$@" - make -j 8 -} - codedir=$(pwd) pkg_upgrade -# Core prep -yum -y install dnf-plugins-core @buildsys-build 'dnf-command(builddep)' -# build+install ostree, and build deps for both, so that our -# make install overrides the ostree via rpm -dnf builddep -y ostree flatpak -yum -y install flatpak && rpm -e flatpak -# we use yaml below -yum -y install python3-PyYAML +pkg_install_builddeps ostree +pkg_install_builddeps flatpak +pkg_install gettext-devel # A new dependency +# Copy of builddeps from build.sh in flatpak +pkg_install sudo which attr fuse \ + libubsan libasan libtsan \ + elfutils git gettext-devel libappstream-glib-devel \ + /usr/bin/{update-mime-database,update-desktop-database,gtk-update-icon-cache} \ + hicolor-icon-theme +pkg_install flatpak && rpm -e flatpak -# Now get flatpak's deps from rhci file -tmpd=$(mktemp -d) -cd ${tmpd} -# Frozen to a tag for now on general principle -git clone --recursive --depth=1 -b 0.9.3 https://github.com/flatpak/flatpak -cd flatpak -python3 -c 'import yaml; y = list(yaml.load_all(open(".redhat-ci.yml")))[0]; print("\0".join(y["packages"]))' | xargs -0 yum install -y -# back to ostree and build +# Build and install ostree cd ${codedir} build make install +tmpd=$(mktemp -d) +cd ${tmpd} +# Frozen to a tag for now on general principle +git clone --recursive --depth=1 -b ${FLATPAK_TAG} https://github.com/flatpak/flatpak cd ${tmpd}/flatpak -patch -p1 < ${codedir}/ci/*.patch build # We want to capture automake results from flatpak cleanup() { From 785da8d5a632b12f94c93e78f2751c14e6a777ba Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 29 Jan 2018 14:14:29 +0000 Subject: [PATCH 15/30] lib/core: Expand documentation for ostree_parse_refspec() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old documentation had outdated and incomplete annotations, and didn’t make it very clear that out_remote could legitimately return NULL. Signed-off-by: Philip Withnall Closes: #1437 Approved by: cgwalters --- src/libostree/ostree-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index 2256a2c0..2f633dcb 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -152,15 +152,18 @@ ostree_validate_checksum_string (const char *sha256, /** * ostree_parse_refspec: * @refspec: A "refspec" string - * @out_remote: (out) (allow-none): The remote name, or %NULL if the refspec refs to a local ref - * @out_ref: (out) (allow-none): Name of ref + * @out_remote: (out) (nullable) (optional): Return location for the remote name, + * or %NULL if the refspec refs to a local ref + * @out_ref: (out) (not nullable) (optional): Return location for the ref name * @error: Error * - * Split a refspec like "gnome-ostree:gnome-ostree/buildmaster" into - * two parts; @out_remote will be set to "gnome-ostree", and @out_ref - * will be "gnome-ostree/buildmaster". + * Split a refspec like `gnome-ostree:gnome-ostree/buildmaster` or just + * `gnome-ostree/buildmaster` into two parts. In the first case, @out_remote + * will be set to `gnome-ostree`, and @out_ref to `gnome-ostree/buildmaster`. + * In the second case (a local ref), @out_remote will be %NULL, and @out_ref + * will be `gnome-ostree/buildmaster`. In both cases, %TRUE will be returned. * - * If @refspec refers to a local ref, @out_remote will be %NULL. + * Returns: %TRUE on successful parsing, %FALSE otherwise */ gboolean ostree_parse_refspec (const char *refspec, From 2b8d586c5a10e9574acd1ae49a60cbf11cf22830 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 29 Jan 2018 13:48:02 +0100 Subject: [PATCH 16/30] switchroot: Ensure /sysroot is set to "private" propagation Downstream BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1498281 This came up as a problem with `oci-umount` which was trying to ensure some host mounts like `/var/lib/containers` don't leak into privileged containers. But since our `/sysroot` mount wasn't private we also got a copy there. We should have done this from the very start - it makes `findmnt` way, way less ugly and is just the obviously right thing to do, will possibly create world peace etc. Closes: #1438 Approved by: rhvgoyal --- src/switchroot/ostree-prepare-root.c | 11 +++++++++++ src/switchroot/ostree-remount.c | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index 43e15fcc..671a6a26 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -244,6 +244,17 @@ main(int argc, char *argv[]) err (EXIT_FAILURE, "failed to MS_MOVE %s to %s", deploy_path, root_mountpoint); } + /* The /sysroot mount needs to be private to avoid having a mount for e.g. /var/cache + * also propagate to /sysroot/ostree/deploy/$stateroot/var/cache + * + * Now in reality, today this is overridden by systemd: the *actual* way we fix this up + * is in ostree-remount.c. But let's do it here to express the semantics we want + * at the very start (perhaps down the line systemd will have compile/runtime option + * to say that the initramfs environment did everything right from the start). + */ + if (mount ("none", "sysroot", NULL, MS_PRIVATE, NULL) < 0) + err (EXIT_FAILURE, "remounting 'sysroot' private"); + if (getpid() == 1) { execl ("/sbin/init", "/sbin/init", NULL); diff --git a/src/switchroot/ostree-remount.c b/src/switchroot/ostree-remount.c index fe6b6f44..cc2b81b3 100644 --- a/src/switchroot/ostree-remount.c +++ b/src/switchroot/ostree-remount.c @@ -44,6 +44,15 @@ main(int argc, char *argv[]) struct stat stbuf; int i; + /* The /sysroot mount needs to be private to avoid having a mount for e.g. /var/cache + * also propagate to /sysroot/ostree/deploy/$stateroot/var/cache + * + * Today systemd remounts / (recursively) as shared, so we're undoing that as early + * as possible. See also a copy of this in ostree-prepare-root.c. + */ + if (mount ("none", "/sysroot", NULL, MS_REC | MS_PRIVATE, NULL) < 0) + perror ("warning: While remounting /sysroot MS_PRIVATE"); + if (path_is_on_readonly_fs ("/")) { /* If / isn't writable, don't do any remounts; we don't want From 6bf4b3e1d8ae0173f3f97a26990a6a6341c11049 Mon Sep 17 00:00:00 2001 From: Marcus Folkesson Date: Tue, 30 Jan 2018 20:26:26 +0100 Subject: [PATCH 17/30] Add SPDX-License-Identifier to source files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson Closes: #1439 Approved by: cgwalters --- Makefile-bash.am | 2 ++ Makefile-boot.am | 2 ++ Makefile-decls.am | 2 ++ Makefile-libostree-defines.am | 2 ++ Makefile-libostree.am | 2 ++ Makefile-man.am | 2 ++ Makefile-ostree.am | 2 ++ Makefile-otutil.am | 2 ++ Makefile-switchroot.am | 2 ++ Makefile-tests.am | 2 ++ Makefile.am | 2 ++ apidoc/Makefile.am | 2 ++ buildutil/tap-driver.sh | 2 ++ man/ostree-admin-cleanup.xml | 2 ++ man/ostree-admin-config-diff.xml | 2 ++ man/ostree-admin-deploy.xml | 2 ++ man/ostree-admin-init-fs.xml | 2 ++ man/ostree-admin-instutil.xml | 2 ++ man/ostree-admin-os-init.xml | 2 ++ man/ostree-admin-set-origin.xml | 2 ++ man/ostree-admin-status.xml | 2 ++ man/ostree-admin-switch.xml | 2 ++ man/ostree-admin-undeploy.xml | 2 ++ man/ostree-admin-unlock.xml | 2 ++ man/ostree-admin-upgrade.xml | 2 ++ man/ostree-admin.xml | 2 ++ man/ostree-cat.xml | 2 ++ man/ostree-checkout.xml | 2 ++ man/ostree-checksum.xml | 2 ++ man/ostree-commit.xml | 2 ++ man/ostree-config.xml | 2 ++ man/ostree-diff.xml | 2 ++ man/ostree-export.xml | 2 ++ man/ostree-find-remotes.xml | 2 ++ man/ostree-fsck.xml | 2 ++ man/ostree-gpg-sign.xml | 2 ++ man/ostree-init.xml | 2 ++ man/ostree-log.xml | 2 ++ man/ostree-ls.xml | 2 ++ man/ostree-prune.xml | 2 ++ man/ostree-pull-local.xml | 2 ++ man/ostree-pull.xml | 2 ++ man/ostree-refs.xml | 2 ++ man/ostree-remote.xml | 2 ++ man/ostree-reset.xml | 2 ++ man/ostree-rev-parse.xml | 2 ++ man/ostree-show.xml | 2 ++ man/ostree-static-delta.xml | 2 ++ man/ostree-summary.xml | 2 ++ man/ostree-trivial-httpd.xml | 2 ++ man/ostree.repo-config.xml | 2 ++ man/ostree.repo.xml | 2 ++ man/ostree.xml | 2 ++ man/rofiles-fuse.xml | 2 ++ manual-tests/upgrade-loop.js | 2 ++ src/boot/dracut/module-setup.sh | 2 ++ src/libostree/ostree-async-progress.c | 2 ++ src/libostree/ostree-async-progress.h | 2 ++ src/libostree/ostree-autocleanups.h | 2 ++ src/libostree/ostree-bloom-private.h | 2 ++ src/libostree/ostree-bloom.c | 2 ++ src/libostree/ostree-chain-input-stream.c | 2 ++ src/libostree/ostree-chain-input-stream.h | 2 ++ src/libostree/ostree-checksum-input-stream.c | 2 ++ src/libostree/ostree-checksum-input-stream.h | 2 ++ src/libostree/ostree-cmdprivate.c | 2 ++ src/libostree/ostree-cmdprivate.h | 2 ++ src/libostree/ostree-core-private.h | 2 ++ src/libostree/ostree-core.c | 2 ++ src/libostree/ostree-core.h | 2 ++ src/libostree/ostree-diff.c | 2 ++ src/libostree/ostree-diff.h | 2 ++ src/libostree/ostree-dummy-enumtypes.c | 2 ++ src/libostree/ostree-dummy-enumtypes.h | 2 ++ src/libostree/ostree-fetcher-curl.c | 2 ++ src/libostree/ostree-fetcher-soup.c | 2 ++ src/libostree/ostree-fetcher-uri.c | 2 ++ src/libostree/ostree-fetcher-util.c | 2 ++ src/libostree/ostree-fetcher-util.h | 2 ++ src/libostree/ostree-fetcher.h | 2 ++ src/libostree/ostree-gpg-verifier.c | 2 ++ src/libostree/ostree-gpg-verifier.h | 2 ++ src/libostree/ostree-gpg-verify-result-private.h | 2 ++ src/libostree/ostree-gpg-verify-result.c | 2 ++ src/libostree/ostree-gpg-verify-result.h | 2 ++ src/libostree/ostree-impl-system-generator.c | 2 ++ src/libostree/ostree-libarchive-input-stream.c | 2 ++ src/libostree/ostree-libarchive-input-stream.h | 2 ++ src/libostree/ostree-libarchive-private.h | 2 ++ src/libostree/ostree-linuxfsutil.c | 2 ++ src/libostree/ostree-linuxfsutil.h | 2 ++ src/libostree/ostree-lzma-common.c | 2 ++ src/libostree/ostree-lzma-common.h | 2 ++ src/libostree/ostree-lzma-compressor.c | 2 ++ src/libostree/ostree-lzma-compressor.h | 2 ++ src/libostree/ostree-lzma-decompressor.c | 2 ++ src/libostree/ostree-lzma-decompressor.h | 2 ++ src/libostree/ostree-metalink.c | 2 ++ src/libostree/ostree-metalink.h | 2 ++ src/libostree/ostree-mutable-tree.c | 2 ++ src/libostree/ostree-mutable-tree.h | 2 ++ src/libostree/ostree-ref.c | 2 ++ src/libostree/ostree-ref.h | 2 ++ src/libostree/ostree-remote-private.h | 2 ++ src/libostree/ostree-remote.c | 2 ++ src/libostree/ostree-remote.h | 2 ++ src/libostree/ostree-repo-checkout.c | 2 ++ src/libostree/ostree-repo-commit.c | 2 ++ src/libostree/ostree-repo-deprecated.h | 2 ++ src/libostree/ostree-repo-file-enumerator.c | 2 ++ src/libostree/ostree-repo-file-enumerator.h | 2 ++ src/libostree/ostree-repo-file.c | 2 ++ src/libostree/ostree-repo-file.h | 2 ++ src/libostree/ostree-repo-finder-avahi-parser.c | 2 ++ src/libostree/ostree-repo-finder-avahi-private.h | 2 ++ src/libostree/ostree-repo-finder-avahi.c | 2 ++ src/libostree/ostree-repo-finder-avahi.h | 2 ++ src/libostree/ostree-repo-finder-config.c | 2 ++ src/libostree/ostree-repo-finder-config.h | 2 ++ src/libostree/ostree-repo-finder-mount.c | 2 ++ src/libostree/ostree-repo-finder-mount.h | 2 ++ src/libostree/ostree-repo-finder-override.c | 2 ++ src/libostree/ostree-repo-finder-override.h | 2 ++ src/libostree/ostree-repo-finder.c | 2 ++ src/libostree/ostree-repo-finder.h | 2 ++ src/libostree/ostree-repo-libarchive.c | 2 ++ src/libostree/ostree-repo-private.h | 2 ++ src/libostree/ostree-repo-prune.c | 2 ++ src/libostree/ostree-repo-pull-private.h | 2 ++ src/libostree/ostree-repo-pull.c | 2 ++ src/libostree/ostree-repo-refs.c | 2 ++ src/libostree/ostree-repo-static-delta-compilation-analysis.c | 2 ++ src/libostree/ostree-repo-static-delta-compilation.c | 2 ++ src/libostree/ostree-repo-static-delta-core.c | 2 ++ src/libostree/ostree-repo-static-delta-private.h | 2 ++ src/libostree/ostree-repo-static-delta-processing.c | 2 ++ src/libostree/ostree-repo-traverse.c | 2 ++ src/libostree/ostree-repo.c | 2 ++ src/libostree/ostree-repo.h | 2 ++ src/libostree/ostree-rollsum.c | 2 ++ src/libostree/ostree-rollsum.h | 2 ++ src/libostree/ostree-sepolicy-private.h | 2 ++ src/libostree/ostree-sepolicy.c | 2 ++ src/libostree/ostree-sepolicy.h | 2 ++ src/libostree/ostree-sysroot-cleanup.c | 2 ++ src/libostree/ostree-sysroot-deploy.c | 2 ++ src/libostree/ostree-sysroot-private.h | 2 ++ src/libostree/ostree-sysroot-upgrader.c | 2 ++ src/libostree/ostree-sysroot-upgrader.h | 2 ++ src/libostree/ostree-sysroot.c | 2 ++ src/libostree/ostree-sysroot.h | 2 ++ src/libostree/ostree-tls-cert-interaction.c | 2 ++ src/libostree/ostree-tls-cert-interaction.h | 2 ++ src/libostree/ostree-types.h | 2 ++ src/libostree/ostree-varint.c | 2 ++ src/libostree/ostree-varint.h | 2 ++ src/libostree/ostree.h | 2 ++ src/libotutil/ot-checksum-instream.c | 2 ++ src/libotutil/ot-checksum-instream.h | 2 ++ src/libotutil/ot-checksum-utils.c | 2 ++ src/libotutil/ot-checksum-utils.h | 2 ++ src/libotutil/ot-fs-utils.c | 2 ++ src/libotutil/ot-fs-utils.h | 2 ++ src/libotutil/ot-gio-utils.c | 2 ++ src/libotutil/ot-gio-utils.h | 2 ++ src/libotutil/ot-gpg-utils.c | 2 ++ src/libotutil/ot-gpg-utils.h | 2 ++ src/libotutil/ot-keyfile-utils.c | 2 ++ src/libotutil/ot-keyfile-utils.h | 2 ++ src/libotutil/ot-opt-utils.c | 2 ++ src/libotutil/ot-opt-utils.h | 2 ++ src/libotutil/ot-tool-util.c | 2 ++ src/libotutil/ot-tool-util.h | 2 ++ src/libotutil/ot-unix-utils.c | 2 ++ src/libotutil/ot-unix-utils.h | 2 ++ src/libotutil/ot-variant-builder.c | 4 ++++ src/libotutil/ot-variant-builder.h | 2 ++ src/libotutil/ot-variant-utils.c | 2 ++ src/libotutil/ot-variant-utils.h | 2 ++ src/libotutil/otutil.h | 2 ++ src/ostree/main.c | 2 ++ src/ostree/ostree-trivial-httpd.c | 2 ++ src/ostree/ot-admin-builtin-cleanup.c | 2 ++ src/ostree/ot-admin-builtin-deploy.c | 2 ++ src/ostree/ot-admin-builtin-diff.c | 2 ++ src/ostree/ot-admin-builtin-init-fs.c | 2 ++ src/ostree/ot-admin-builtin-instutil.c | 2 ++ src/ostree/ot-admin-builtin-os-init.c | 2 ++ src/ostree/ot-admin-builtin-set-origin.c | 2 ++ src/ostree/ot-admin-builtin-status.c | 2 ++ src/ostree/ot-admin-builtin-switch.c | 2 ++ src/ostree/ot-admin-builtin-undeploy.c | 2 ++ src/ostree/ot-admin-builtin-unlock.c | 2 ++ src/ostree/ot-admin-builtin-upgrade.c | 2 ++ src/ostree/ot-admin-builtins.h | 2 ++ src/ostree/ot-admin-functions.c | 2 ++ src/ostree/ot-admin-functions.h | 2 ++ src/ostree/ot-admin-instutil-builtins.h | 2 ++ src/ostree/ot-builtin-admin.c | 2 ++ src/ostree/ot-builtin-cat.c | 2 ++ src/ostree/ot-builtin-checkout.c | 2 ++ src/ostree/ot-builtin-checksum.c | 2 ++ src/ostree/ot-builtin-commit.c | 2 ++ src/ostree/ot-builtin-config.c | 2 ++ src/ostree/ot-builtin-create-usb.c | 2 ++ src/ostree/ot-builtin-diff.c | 2 ++ src/ostree/ot-builtin-export.c | 2 ++ src/ostree/ot-builtin-find-remotes.c | 2 ++ src/ostree/ot-builtin-fsck.c | 2 ++ src/ostree/ot-builtin-gpg-sign.c | 2 ++ src/ostree/ot-builtin-init.c | 2 ++ src/ostree/ot-builtin-log.c | 2 ++ src/ostree/ot-builtin-ls.c | 2 ++ src/ostree/ot-builtin-prune.c | 2 ++ src/ostree/ot-builtin-pull-local.c | 2 ++ src/ostree/ot-builtin-pull.c | 2 ++ src/ostree/ot-builtin-refs.c | 2 ++ src/ostree/ot-builtin-remote.c | 2 ++ src/ostree/ot-builtin-reset.c | 2 ++ src/ostree/ot-builtin-rev-parse.c | 2 ++ src/ostree/ot-builtin-show.c | 2 ++ src/ostree/ot-builtin-static-delta.c | 2 ++ src/ostree/ot-builtin-summary.c | 2 ++ src/ostree/ot-builtin-trivial-httpd.c | 2 ++ src/ostree/ot-builtins.h | 2 ++ src/ostree/ot-dump.c | 2 ++ src/ostree/ot-dump.h | 2 ++ src/ostree/ot-editor.c | 2 ++ src/ostree/ot-editor.h | 2 ++ src/ostree/ot-main.c | 2 ++ src/ostree/ot-main.h | 2 ++ src/ostree/ot-remote-builtin-add-cookie.c | 2 ++ src/ostree/ot-remote-builtin-add.c | 2 ++ src/ostree/ot-remote-builtin-delete-cookie.c | 2 ++ src/ostree/ot-remote-builtin-delete.c | 2 ++ src/ostree/ot-remote-builtin-gpg-import.c | 2 ++ src/ostree/ot-remote-builtin-list-cookies.c | 2 ++ src/ostree/ot-remote-builtin-list.c | 2 ++ src/ostree/ot-remote-builtin-refs.c | 2 ++ src/ostree/ot-remote-builtin-show-url.c | 2 ++ src/ostree/ot-remote-builtin-summary.c | 2 ++ src/ostree/ot-remote-builtins.h | 2 ++ src/ostree/ot-remote-cookie-util.c | 2 ++ src/ostree/ot-remote-cookie-util.h | 2 ++ src/rofiles-fuse/Makefile-inc.am | 2 ++ src/rofiles-fuse/main.c | 2 ++ src/switchroot/ostree-mount-util.h | 2 ++ src/switchroot/ostree-prepare-root.c | 2 ++ src/switchroot/ostree-remount.c | 2 ++ src/switchroot/ostree-system-generator.c | 2 ++ tests/admin-test.sh | 2 ++ tests/archive-test.sh | 2 ++ tests/basic-test.sh | 2 ++ tests/corrupt-repo-ref.js | 2 ++ tests/installed/libinsttest.sh | 2 ++ tests/libostreetest.c | 2 ++ tests/libostreetest.h | 2 ++ tests/libtest-core.sh | 2 ++ tests/libtest.sh | 2 ++ tests/pull-test.sh | 2 ++ tests/pull-test2.sh | 2 ++ tests/readdir-rand.c | 2 ++ tests/repo-finder-mount.c | 2 ++ tests/test-admin-deploy-2.sh | 2 ++ tests/test-admin-deploy-bootid-gc.sh | 2 ++ tests/test-admin-deploy-clean.sh | 2 ++ tests/test-admin-deploy-etcmerge-cornercases.sh | 2 ++ tests/test-admin-deploy-grub2.sh | 2 ++ tests/test-admin-deploy-karg.sh | 2 ++ tests/test-admin-deploy-switch.sh | 2 ++ tests/test-admin-deploy-syslinux.sh | 2 ++ tests/test-admin-deploy-uboot.sh | 2 ++ tests/test-admin-instutil-set-kargs.sh | 2 ++ tests/test-admin-locking.sh | 2 ++ tests/test-admin-pull-deploy-commit.sh | 2 ++ tests/test-admin-pull-deploy-split.sh | 2 ++ tests/test-admin-upgrade-endoflife.sh | 2 ++ tests/test-admin-upgrade-not-backwards.sh | 2 ++ tests/test-admin-upgrade-unconfigured.sh | 2 ++ tests/test-archivez.sh | 2 ++ tests/test-auto-summary.sh | 2 ++ tests/test-basic-c.c | 2 ++ tests/test-basic-root.sh | 2 ++ tests/test-basic-user-only.sh | 2 ++ tests/test-basic-user.sh | 2 ++ tests/test-basic.sh | 2 ++ tests/test-bloom.c | 2 ++ tests/test-bsdiff.c | 2 ++ tests/test-checksum.c | 2 ++ tests/test-commit-sign.sh | 2 ++ tests/test-core.js | 2 ++ tests/test-corruption.sh | 2 ++ tests/test-create-usb.sh | 2 ++ tests/test-delta.sh | 2 ++ tests/test-demo-buildsystem.sh | 2 ++ tests/test-export.sh | 2 ++ tests/test-find-remotes.sh | 2 ++ tests/test-fsck-collections.sh | 2 ++ tests/test-gpg-signed-commit.sh | 2 ++ tests/test-gpg-verify-result.c | 2 ++ tests/test-help.sh | 2 ++ tests/test-init-collections.sh | 2 ++ tests/test-keyfile-utils.c | 2 ++ tests/test-libarchive-import.c | 2 ++ tests/test-libarchive.sh | 2 ++ tests/test-local-pull-depth.sh | 2 ++ tests/test-local-pull.sh | 2 ++ tests/test-lzma.c | 2 ++ tests/test-mock-gio.c | 2 ++ tests/test-mock-gio.h | 2 ++ tests/test-mutable-tree.c | 2 ++ tests/test-oldstyle-partial.sh | 2 ++ tests/test-ot-opt-utils.c | 2 ++ tests/test-ot-tool-util.c | 2 ++ tests/test-ot-unix-utils.c | 2 ++ tests/test-parent.sh | 2 ++ tests/test-prune-collections.sh | 2 ++ tests/test-prune.sh | 2 ++ tests/test-pull-bare.sh | 2 ++ tests/test-pull-bareuser.sh | 2 ++ tests/test-pull-bareuseronly.sh | 2 ++ tests/test-pull-c.c | 2 ++ tests/test-pull-collections.sh | 2 ++ tests/test-pull-commit-only.sh | 2 ++ tests/test-pull-contenturl.sh | 2 ++ tests/test-pull-corruption.sh | 2 ++ tests/test-pull-depth.sh | 2 ++ tests/test-pull-large-metadata.sh | 2 ++ tests/test-pull-localcache.sh | 2 ++ tests/test-pull-metalink.sh | 2 ++ tests/test-pull-mirror-summary.sh | 2 ++ tests/test-pull-mirrorlist.sh | 2 ++ tests/test-pull-override-url.sh | 2 ++ tests/test-pull-repeated.sh | 2 ++ tests/test-pull-resume.sh | 2 ++ tests/test-pull-subpath.sh | 2 ++ tests/test-pull-summary-sigs.sh | 2 ++ tests/test-pull-untrusted.sh | 2 ++ tests/test-pull2-bareuseronly.sh | 2 ++ tests/test-refs-collections.sh | 2 ++ tests/test-refs.sh | 2 ++ tests/test-remote-add-collections.sh | 2 ++ tests/test-remote-add.sh | 2 ++ tests/test-remote-cookies.sh | 2 ++ tests/test-remote-gpg-import.sh | 2 ++ tests/test-remote-headers.sh | 2 ++ tests/test-remotes-config-dir.js | 2 ++ tests/test-repo-finder-avahi.c | 2 ++ tests/test-repo-finder-config.c | 2 ++ tests/test-repo-finder-mount-integration.sh | 2 ++ tests/test-repo-finder-mount.c | 2 ++ tests/test-repo.c | 2 ++ tests/test-reset-nonlinear.sh | 2 ++ tests/test-rofiles-fuse.sh | 2 ++ tests/test-rollsum-cli.c | 2 ++ tests/test-rollsum.c | 2 ++ tests/test-sizes.js | 2 ++ tests/test-summary-collections.sh | 2 ++ tests/test-summary-update.sh | 2 ++ tests/test-summary-view.sh | 2 ++ tests/test-symbols.sh | 2 ++ tests/test-sysroot-c.c | 2 ++ tests/test-sysroot.js | 2 ++ tests/test-varint.c | 2 ++ tests/test-xattrs.sh | 2 ++ 365 files changed, 732 insertions(+) diff --git a/Makefile-bash.am b/Makefile-bash.am index 2cb03151..b42f6bfa 100644 --- a/Makefile-bash.am +++ b/Makefile-bash.am @@ -2,6 +2,8 @@ # # Copyright (C) 2017 Red Hat Inc. # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-boot.am b/Makefile-boot.am index 828187ec..d3d2f673 100644 --- a/Makefile-boot.am +++ b/Makefile-boot.am @@ -2,6 +2,8 @@ # # Copyright (C) 2013 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-decls.am b/Makefile-decls.am index 06018594..115c19fb 100644 --- a/Makefile-decls.am +++ b/Makefile-decls.am @@ -1,5 +1,7 @@ # Copyright (C) 2011,2014 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-libostree-defines.am b/Makefile-libostree-defines.am index 3fba576b..58f77a2c 100644 --- a/Makefile-libostree-defines.am +++ b/Makefile-libostree-defines.am @@ -3,6 +3,8 @@ # # Copyright (C) 2013 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-libostree.am b/Makefile-libostree.am index 19f8184e..9dc81b2f 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -2,6 +2,8 @@ # # Copyright (C) 2011,2014 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-man.am b/Makefile-man.am index c37272a6..e2f88a16 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -2,6 +2,8 @@ # # Copyright (C) 2016 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-ostree.am b/Makefile-ostree.am index 04faa436..c366c84f 100644 --- a/Makefile-ostree.am +++ b/Makefile-ostree.am @@ -2,6 +2,8 @@ # # Copyright (C) 2011 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-otutil.am b/Makefile-otutil.am index b4ee1c4b..5bafb2d0 100644 --- a/Makefile-otutil.am +++ b/Makefile-otutil.am @@ -2,6 +2,8 @@ # # Copyright (C) 2011 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-switchroot.am b/Makefile-switchroot.am index 70aa1c87..6735c85a 100644 --- a/Makefile-switchroot.am +++ b/Makefile-switchroot.am @@ -1,5 +1,7 @@ # Copyright (C) 2011 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile-tests.am b/Makefile-tests.am index 284dc76f..48363b9a 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -2,6 +2,8 @@ # # Copyright (C) 2013 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/Makefile.am b/Makefile.am index ea1863d3..85542edb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,7 @@ # Copyright (C) 2011 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/apidoc/Makefile.am b/apidoc/Makefile.am index d46eac78..d64ce451 100644 --- a/apidoc/Makefile.am +++ b/apidoc/Makefile.am @@ -1,5 +1,7 @@ # Copyright (C) 2013 Colin Walters # +# SPDX-License-Identifier: LGPL-2.0+ +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either diff --git a/buildutil/tap-driver.sh b/buildutil/tap-driver.sh index 19aa531d..6a52d170 100755 --- a/buildutil/tap-driver.sh +++ b/buildutil/tap-driver.sh @@ -1,6 +1,8 @@ #! /bin/sh # Copyright (C) 2011-2013 Free Software Foundation, Inc. # +# SPDX-License-Identifier: LGPL-2.0+ +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) diff --git a/man/ostree-admin-cleanup.xml b/man/ostree-admin-cleanup.xml index e91e1c46..b7dfb653 100644 --- a/man/ostree-admin-cleanup.xml +++ b/man/ostree-admin-cleanup.xml @@ -5,6 +5,8 @@