diff --git a/Makefile-switchroot.am b/Makefile-switchroot.am index 4423fdcd..ff44d4bc 100644 --- a/Makefile-switchroot.am +++ b/Makefile-switchroot.am @@ -45,7 +45,7 @@ if BUILDOPT_USE_STATIC_COMPILER ostree_boot_SCRIPTS = ostree-prepare-root ostree-prepare-root : $(ostree_prepare_root_SOURCES) - $(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) + $(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) -DOSTREE_PREPARE_ROOT_STATIC=1 else ostree_boot_PROGRAMS += ostree-prepare-root ostree_prepare_root_CFLAGS = $(AM_CFLAGS) -Isrc/switchroot @@ -57,6 +57,11 @@ ostree_remount_SOURCES = \ $(NULL) ostree_remount_CPPFLAGS = $(AM_CPPFLAGS) -Isrc/switchroot +if BUILDOPT_SYSTEMD +ostree_prepare_root_CPPFLAGS += -DHAVE_SYSTEMD=1 +ostree_prepare_root_LDADD = $(AM_LDFLAGS) $(LIBSYSTEMD_LIBS) +endif + # This is the "new mode" of using a generator for /var; see # https://github.com/ostreedev/ostree/issues/855 if BUILDOPT_SYSTEMD_AND_LIBMOUNT diff --git a/Makefile-tests.am b/Makefile-tests.am index 417a304a..2c0916f6 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -102,6 +102,7 @@ _installed_or_uninstalled_test_scripts = \ tests/test-admin-deploy-etcmerge-cornercases.sh \ tests/test-admin-deploy-uboot.sh \ tests/test-admin-deploy-grub2.sh \ + tests/test-admin-deploy-none.sh \ tests/test-admin-deploy-bootid-gc.sh \ tests/test-admin-instutil-set-kargs.sh \ tests/test-admin-upgrade-not-backwards.sh \ diff --git a/Makefile.in b/Makefile.in index 3f6f081b..c3f4ff27 100644 --- a/Makefile.in +++ b/Makefile.in @@ -505,46 +505,47 @@ check_PROGRAMS = $(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_13) # and if we declare it here, it gets cleaned up properly @BUILDOPT_SYSTEMD_FALSE@am__append_57 = ostree-remount @BUILDOPT_USE_STATIC_COMPILER_FALSE@am__append_58 = ostree-prepare-root +@BUILDOPT_SYSTEMD_TRUE@am__append_59 = -DHAVE_SYSTEMD=1 # This is the "new mode" of using a generator for /var; see # https://github.com/ostreedev/ostree/issues/855 -@BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_59 = -DHAVE_SYSTEMD_AND_LIBMOUNT=1 @BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_60 = -DHAVE_SYSTEMD_AND_LIBMOUNT=1 +@BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_61 = -DHAVE_SYSTEMD_AND_LIBMOUNT=1 @BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@systemdsystemgenerator_PROGRAMS = ostree-system-generator$(EXEEXT) -@BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_61 = $(systemdsystemgenerator_PROGRAMS) +@BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_62 = $(systemdsystemgenerator_PROGRAMS) # Allow the distcheck install under $prefix test to pass -@BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_62 = --with-systemdsystemgeneratordir='$${libdir}/systemd/system-generators' -@BUILDOPT_FUSE_TRUE@am__append_63 = rofiles-fuse -@BUILDOPT_ASAN_TRUE@am__append_64 = OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc -@ENABLE_EXPERIMENTAL_API_TRUE@am__append_65 = $(experimental_test_scripts) -@ENABLE_EXPERIMENTAL_API_FALSE@am__append_66 = $(experimental_test_scripts) -@BUILDOPT_FUSE_TRUE@am__append_67 = tests/test-rofiles-fuse.sh -@BUILDOPT_FUSE_TRUE@am__append_68 = tests/rofiles-fuse-symlink-stamp -@BUILDOPT_FUSE_FALSE@am__append_69 = tests/test-rofiles-fuse.sh -@USE_LIBSOUP_TRUE@am__append_70 = tests/test-remote-cookies.sh -@BUILDOPT_GJS_TRUE@am__append_71 = $(js_tests) $(js_installed_tests) -@BUILDOPT_GJS_FALSE@am__append_72 = $(js_tests) -@BUILDOPT_GJS_FALSE@am__append_73 = $(js_installed_tests) -@ENABLE_INSTALLED_TESTS_FALSE@am__append_74 = -rpath $(abs_builddir) -@USE_AVAHI_TRUE@am__append_75 = tests/test-repo-finder-avahi -@USE_LIBARCHIVE_TRUE@am__append_76 = tests/test-libarchive-import -@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_77 = $(_installed_or_uninstalled_test_scripts) -@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_78 = $(_installed_or_uninstalled_test_programs) -@ENABLE_INSTALLED_TESTS_TRUE@am__append_79 = install-installed-tests-extra +@BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@am__append_63 = --with-systemdsystemgeneratordir='$${libdir}/systemd/system-generators' +@BUILDOPT_FUSE_TRUE@am__append_64 = rofiles-fuse +@BUILDOPT_ASAN_TRUE@am__append_65 = OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc +@ENABLE_EXPERIMENTAL_API_TRUE@am__append_66 = $(experimental_test_scripts) +@ENABLE_EXPERIMENTAL_API_FALSE@am__append_67 = $(experimental_test_scripts) +@BUILDOPT_FUSE_TRUE@am__append_68 = tests/test-rofiles-fuse.sh +@BUILDOPT_FUSE_TRUE@am__append_69 = tests/rofiles-fuse-symlink-stamp +@BUILDOPT_FUSE_FALSE@am__append_70 = tests/test-rofiles-fuse.sh +@USE_LIBSOUP_TRUE@am__append_71 = tests/test-remote-cookies.sh +@BUILDOPT_GJS_TRUE@am__append_72 = $(js_tests) $(js_installed_tests) +@BUILDOPT_GJS_FALSE@am__append_73 = $(js_tests) +@BUILDOPT_GJS_FALSE@am__append_74 = $(js_installed_tests) +@ENABLE_INSTALLED_TESTS_FALSE@am__append_75 = -rpath $(abs_builddir) +@USE_AVAHI_TRUE@am__append_76 = tests/test-repo-finder-avahi +@USE_LIBARCHIVE_TRUE@am__append_77 = tests/test-libarchive-import +@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_78 = $(_installed_or_uninstalled_test_scripts) +@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_79 = $(_installed_or_uninstalled_test_programs) +@ENABLE_INSTALLED_TESTS_TRUE@am__append_80 = install-installed-tests-extra # Allow the distcheck install under $prefix test to pass -@BUILDOPT_SYSTEMD_TRUE@am__append_80 = --with-systemdsystemunitdir='$${libdir}/systemd/system' +@BUILDOPT_SYSTEMD_TRUE@am__append_81 = --with-systemdsystemunitdir='$${libdir}/systemd/system' # We're using the system grub2-mkconfig generator -@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_81 = src/boot/grub2/grub2-15_ostree -@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_82 = install-grub2-config-hook -@BUILDOPT_TRIVIAL_HTTPD_TRUE@@ENABLE_MAN_TRUE@am__append_83 = ostree-trivial-httpd.1 +@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_82 = src/boot/grub2/grub2-15_ostree +@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_83 = install-grub2-config-hook +@BUILDOPT_TRIVIAL_HTTPD_TRUE@@ENABLE_MAN_TRUE@am__append_84 = ostree-trivial-httpd.1 # We still want to distribute the source, even if we are not building it -@BUILDOPT_TRIVIAL_HTTPD_FALSE@@ENABLE_MAN_TRUE@am__append_84 = man/ostree-trivial-httpd.xml -@BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_85 = rofiles-fuse.1 -@ENABLE_MAN_TRUE@am__append_86 = $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml) -@ENABLE_MAN_TRUE@am__append_87 = \ +@BUILDOPT_TRIVIAL_HTTPD_FALSE@@ENABLE_MAN_TRUE@am__append_85 = man/ostree-trivial-httpd.xml +@BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_86 = rofiles-fuse.1 +@ENABLE_MAN_TRUE@am__append_87 = $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml) +@ENABLE_MAN_TRUE@am__append_88 = \ @ENABLE_MAN_TRUE@ $(man1_MANS) \ @ENABLE_MAN_TRUE@ $(man5_MANS) \ @ENABLE_MAN_TRUE@ $(NULL) @@ -1079,7 +1080,8 @@ ostree_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ am_ostree_prepare_root_OBJECTS = src/switchroot/ostree_prepare_root-ostree-prepare-root.$(OBJEXT) \ $(am__objects_1) ostree_prepare_root_OBJECTS = $(am_ostree_prepare_root_OBJECTS) -ostree_prepare_root_LDADD = $(LDADD) +@BUILDOPT_SYSTEMD_TRUE@ostree_prepare_root_DEPENDENCIES = \ +@BUILDOPT_SYSTEMD_TRUE@ $(am__DEPENDENCIES_1) ostree_prepare_root_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(ostree_prepare_root_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1909,6 +1911,7 @@ am__EXEEXT_23 = tests/test-basic.sh tests/test-basic-user.sh \ tests/test-admin-deploy-etcmerge-cornercases.sh \ tests/test-admin-deploy-uboot.sh \ tests/test-admin-deploy-grub2.sh \ + tests/test-admin-deploy-none.sh \ tests/test-admin-deploy-bootid-gc.sh \ tests/test-admin-instutil-set-kargs.sh \ tests/test-admin-upgrade-not-backwards.sh \ @@ -1930,8 +1933,8 @@ am__EXEEXT_23 = tests/test-basic.sh tests/test-basic-user.sh \ tests/test-repo-finder-mount-integration.sh \ tests/test-summary-collections.sh \ tests/test-pull-collections.sh tests/test-config.sh \ - $(am__EXEEXT_2) $(am__EXEEXT_20) $(am__append_67) \ - $(am__append_70) $(am__EXEEXT_22) + $(am__EXEEXT_2) $(am__EXEEXT_20) $(am__append_68) \ + $(am__append_71) $(am__EXEEXT_22) @ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__EXEEXT_24 = \ @ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@ $(am__EXEEXT_23) am__EXEEXT_25 = $(am__EXEEXT_2) $(am__EXEEXT_24) @@ -2230,8 +2233,8 @@ AM_CFLAGS = -std=gnu99 -fno-strict-aliasing $(WARN_CFLAGS) # Allow the distcheck install under $prefix test to pass AM_DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-man \ - --disable-maintainer-mode $(NULL) $(am__append_62) \ - $(am__append_80) \ + --disable-maintainer-mode $(NULL) $(am__append_63) \ + $(am__append_81) \ BASH_COMPLETIONSDIR='$${datadir}/bash-completion/completions' SUBDIRS = . $(am__append_14) NULL = @@ -2244,7 +2247,7 @@ CLEANFILES = $(am__append_13) $(BUILT_SOURCES) $(am__append_47) \ tests/ostree-remount-symlink-stamp \ tests/rofiles-fuse-symlink-stamp tests/ostree \ tests/ostree-prepare-root tests/ostree-remount \ - tests/rofiles-fuse $(am__append_87) + tests/rofiles-fuse $(am__append_88) EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \ COPYING README.md $(am__append_15) libglnx/README.md \ libglnx/COPYING libglnx/libglnx.m4 $(NULL) \ @@ -2260,8 +2263,8 @@ EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \ src/libostree/ostree-repo-deprecated.h \ src/libostree/ostree-version.h src/ostree/parse-datetime.y \ buildutil/tap-driver.sh buildutil/tap-test tests/glib.supp \ - tests/ostree.supp $(NULL) $(am__append_66) $(am__append_69) \ - $(am__append_72) tests/libtest.sh $(am__append_73) \ + tests/ostree.supp $(NULL) $(am__append_67) $(am__append_70) \ + $(am__append_73) tests/libtest.sh $(am__append_74) \ tests/libostreetest.h tests/libtest.sh \ tests/gpg-verify-data/README.md $(NULL) \ src/boot/dracut/module-setup.sh src/boot/dracut/ostree.conf \ @@ -2271,11 +2274,11 @@ EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \ src/boot/ostree-remount.service \ src/boot/ostree-finalize-staged.service \ src/boot/grub2/grub2-15_ostree \ - src/boot/grub2/ostree-grub-generator $(NULL) $(am__append_84) \ - $(am__append_86) + src/boot/grub2/ostree-grub-generator $(NULL) $(am__append_85) \ + $(am__append_87) bin_SCRIPTS = lib_LTLIBRARIES = libostree-1.la -pkglibexec_SCRIPTS = $(am__append_81) +pkglibexec_SCRIPTS = $(am__append_82) noinst_LTLIBRARIES = $(am__append_1) libglnx.la libbsdiff.la \ libotutil.la libostree-kernel-args.la $(am__append_17) \ libostreetest.la @@ -2306,7 +2309,7 @@ AM_TESTS_ENVIRONMENT = G_TEST_SRCDIR="$(abs_srcdir)" \ pwd)$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}} PATH=$$(cd \ $(top_builddir)/tests && pwd):$${PATH} \ OSTREE_FEATURES="$(OSTREE_FEATURES)" PYTHONUNBUFFERED=1 \ - $(NULL) $(am__append_64) + $(NULL) $(am__append_65) LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/buildutil/tap-driver.sh LOG_COMPILER = $(top_srcdir)/buildutil/tap-test installed_test_LTLIBRARIES = $(am__append_12) @@ -2346,14 +2349,14 @@ all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installe # This initializes some more variables # This is a special facility to chain together hooks easily -INSTALL_DATA_HOOKS = install-mkdir-remotes-d-hook $(am__append_79) \ - $(am__append_82) +INSTALL_DATA_HOOKS = install-mkdir-remotes-d-hook $(am__append_80) \ + $(am__append_83) ALL_LOCAL_RULES = tests/libreaddir-rand.so shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||') OSTREE_GITREV = $(shell cd $(srcdir) && if command -v git >/dev/null 2>&1 && test -d .git; then git describe --abbrev=42 --tags --always HEAD; fi) ACLOCAL_AMFLAGS = -I buildutil -I libglnx ${ACLOCAL_FLAGS} GITIGNOREFILES = aclocal.m4 build-aux/ buildutil/*.m4 config.h.in \ - gtk-doc.make $(am__append_61) + gtk-doc.make $(am__append_62) OT_INTERNAL_GIO_UNIX_CFLAGS = $(OT_DEP_GIO_UNIX_CFLAGS) OT_INTERNAL_GIO_UNIX_LIBS = $(OT_DEP_GIO_UNIX_LIBS) OT_INTERNAL_SOUP_CFLAGS = $(OT_DEP_SOUP_CFLAGS) @@ -2694,7 +2697,8 @@ ostree_prepare_root_SOURCES = \ src/switchroot/ostree-prepare-root.c \ $(NULL) -ostree_prepare_root_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_59) +ostree_prepare_root_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_59) \ + $(am__append_60) # We're using our internal generator @BUILDOPT_BUILTIN_GRUB2_MKCONFIG_TRUE@ostree_boot_SCRIPTS = src/boot/grub2/ostree-grub-generator @@ -2716,7 +2720,8 @@ ostree_remount_SOURCES = \ $(NULL) ostree_remount_CPPFLAGS = $(AM_CPPFLAGS) -Isrc/switchroot \ - $(am__append_60) + $(am__append_61) +@BUILDOPT_SYSTEMD_TRUE@ostree_prepare_root_LDADD = $(AM_LDFLAGS) $(LIBSYSTEMD_LIBS) @BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@ostree_system_generator_SOURCES = src/switchroot/ostree-mount-util.h \ @BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE@ src/switchroot/ostree-system-generator.c @@ -2731,7 +2736,7 @@ ostree_remount_CPPFLAGS = $(AM_CPPFLAGS) -Isrc/switchroot \ @BUILDOPT_FUSE_TRUE@rofiles_fuse_LDADD = libglnx.la $(BUILDOPT_FUSE_LIBS) $(OT_INTERNAL_GIO_UNIX_LIBS) libostree-1.la uninstalled_test_data = tests/ostree-symlink-stamp \ tests/ostree-prepare-root-symlink-stamp \ - tests/ostree-remount-symlink-stamp $(am__append_68) + tests/ostree-remount-symlink-stamp $(am__append_69) dist_uninstalled_test_scripts = tests/test-symbols.sh tests/coccinelle.sh # This logic implements ENABLE_INSTALLED_TESTS_EXCLUSIVE; see below. @@ -2739,10 +2744,10 @@ dist_uninstalled_test_scripts = tests/test-symbols.sh tests/coccinelle.sh # tests *only* run installed, to avoid having to run them twice in CI. # This overrides the glib-tap.mk emphasis on doing both, if we'd # used e.g. `dist_test_scripts`. -dist_test_scripts = $(NULL) $(am__append_77) +dist_test_scripts = $(NULL) $(am__append_78) test_programs = tests/test-bloom tests/test-repo-finder-config \ - tests/test-repo-finder-mount $(NULL) $(am__append_75) \ - $(am__append_78) + tests/test-repo-finder-mount $(NULL) $(am__append_76) \ + $(am__append_79) _installed_or_uninstalled_test_scripts = tests/test-basic.sh \ tests/test-basic-user.sh tests/test-basic-user-only.sh \ tests/test-basic-root.sh tests/test-pull-subpath.sh \ @@ -2770,6 +2775,7 @@ _installed_or_uninstalled_test_scripts = tests/test-basic.sh \ tests/test-admin-deploy-etcmerge-cornercases.sh \ tests/test-admin-deploy-uboot.sh \ tests/test-admin-deploy-grub2.sh \ + tests/test-admin-deploy-none.sh \ tests/test-admin-deploy-bootid-gc.sh \ tests/test-admin-instutil-set-kargs.sh \ tests/test-admin-upgrade-not-backwards.sh \ @@ -2791,8 +2797,8 @@ _installed_or_uninstalled_test_scripts = tests/test-basic.sh \ tests/test-repo-finder-mount-integration.sh \ tests/test-summary-collections.sh \ tests/test-pull-collections.sh tests/test-config.sh $(NULL) \ - $(am__append_65) $(am__append_67) $(am__append_70) \ - $(am__append_71) + $(am__append_66) $(am__append_68) $(am__append_71) \ + $(am__append_72) experimental_test_scripts = \ $(NULL) @@ -2862,7 +2868,7 @@ libreaddir_rand_la_LIBADD = \ $(NULL) libreaddir_rand_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version \ - $(am__append_74) + $(am__append_75) _installed_or_uninstalled_test_programs = tests/test-varint \ tests/test-ot-unix-utils tests/test-bsdiff \ tests/test-mutable-tree tests/test-keyfile-utils \ @@ -2870,7 +2876,7 @@ _installed_or_uninstalled_test_programs = tests/test-varint \ tests/test-gpg-verify-result tests/test-checksum \ tests/test-lzma tests/test-rollsum tests/test-basic-c \ tests/test-sysroot-c tests/test-pull-c tests/test-repo \ - tests/test-include-ostree-h $(am__append_76) + tests/test-include-ostree-h $(am__append_77) common_tests_cflags = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx common_tests_ldadd = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS) libostreetest_la_SOURCES = tests/libostreetest.c tests/test-mock-gio.c tests/test-mock-gio.h @@ -2985,7 +2991,7 @@ tests_test_gpg_verify_result_LDADD = $(TESTS_LDADD) $(OT_INTERNAL_GPGME_LIBS) @ENABLE_MAN_TRUE@ ostree-refs.1 ostree-remote.1 ostree-reset.1 \ @ENABLE_MAN_TRUE@ ostree-rev-parse.1 ostree-show.1 \ @ENABLE_MAN_TRUE@ ostree-summary.1 ostree-static-delta.1 \ -@ENABLE_MAN_TRUE@ $(am__append_83) $(am__append_85) +@ENABLE_MAN_TRUE@ $(am__append_84) $(am__append_86) @ENABLE_MAN_TRUE@man5_files = ostree.repo.5 ostree.repo-config.5 @ENABLE_MAN_TRUE@man1_MANS = $(addprefix man/,$(man1_files)) @ENABLE_MAN_TRUE@man5_MANS = $(addprefix man/,$(man5_files)) @@ -7923,6 +7929,13 @@ tests/test-admin-deploy-grub2.sh.log: tests/test-admin-deploy-grub2.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +tests/test-admin-deploy-none.sh.log: tests/test-admin-deploy-none.sh + @p='tests/test-admin-deploy-none.sh'; \ + b='tests/test-admin-deploy-none.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-admin-deploy-bootid-gc.sh.log: tests/test-admin-deploy-bootid-gc.sh @p='tests/test-admin-deploy-bootid-gc.sh'; \ b='tests/test-admin-deploy-bootid-gc.sh'; \ @@ -9172,7 +9185,7 @@ src/ostree/parse-datetime.c: src/ostree/parse-datetime.y Makefile $(AM_V_GEN) $(YACC) $< -o $@ @BUILDOPT_USE_STATIC_COMPILER_TRUE@ostree-prepare-root : $(ostree_prepare_root_SOURCES) -@BUILDOPT_USE_STATIC_COMPILER_TRUE@ $(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) +@BUILDOPT_USE_STATIC_COMPILER_TRUE@ $(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) -DOSTREE_PREPARE_ROOT_STATIC=1 tests/libreaddir-rand.so: Makefile mkdir -p tests/ diff --git a/README.md b/README.md index 6ea343ee..aa7b23e0 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ version of - Support for parallel installing more than just 2 bootable roots - Binary history on the server side (and client) - Introspectable shared library API for build and deployment systems - - Flexible support for multiple branches and repositories, supporting + - Flexible support for multiple branches and repositories, supporting projects like [flatpak](https://github.com/flatpak/flatpak) which use libostree for applications, rather than hosts. @@ -74,6 +74,9 @@ The [BuildStream](https://gitlab.com/BuildStream/buildstream) build and integration tool uses libostree as a caching system to store and share built artifacts. +[Liri OS](https://liri.io/download/silverblue/) has the option to install +their distribution using ostree. + Language bindings ---- diff --git a/aclocal.m4 b/aclocal.m4 index de649b4c..26567006 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -24,7 +24,7 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # Owen Taylor 1997-2001 # Increment this whenever this file is changed. -#serial 1 +#serial 3 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, @@ -34,10 +34,16 @@ AC_DEFUN([AM_PATH_GLIB_2_0], [dnl dnl Get the cflags and libraries from pkg-config dnl + +dnl We can't use PKG_PREREQ because that needs 0.29. +m4_ifndef([PKG_PROG_PKG_CONFIG], + [pkg.m4 version 0.28 or later is required]) + AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], , enable_glibtest=yes) - pkg_config_args=glib-2.0 + min_glib_version=ifelse([$1], [], [2.0.0], [$1]) + pkg_config_args="glib-2.0 >= $min_glib_version" for module in . $4 do case "$module" in @@ -68,7 +74,15 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run PKG_CONFIG=no fi - min_glib_version=ifelse([$1], ,2.0.0,$1) + dnl For GLIB_CFLAGS and GLIB_LIBS + PKG_CHECK_MODULES([GLIB], [$pkg_config_args], [:], [:]) + + dnl For the tools + PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal]) + PKG_CHECK_VAR([GOBJECT_QUERY], [glib-2.0], [gobject_query]) + PKG_CHECK_VAR([GLIB_MKENUMS], [glib-2.0], [glib_mkenums]) + PKG_CHECK_VAR([GLIB_COMPILE_RESOURCES], [gio-2.0], [glib_compile_resources]) + AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) if test x$PKG_CONFIG != xno ; then @@ -86,13 +100,6 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run fi if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ @@ -226,12 +233,6 @@ main (void) GLIB_COMPILE_RESOURCES="" ifelse([$3], , :, [$3]) fi - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - AC_SUBST(GLIB_GENMARSHAL) - AC_SUBST(GOBJECT_QUERY) - AC_SUBST(GLIB_MKENUMS) - AC_SUBST(GLIB_COMPILE_RESOURCES) rm -f conf.glibtest ]) diff --git a/apidoc/html/index.html b/apidoc/html/index.html index e9946e5a..cc45450d 100644 --- a/apidoc/html/index.html +++ b/apidoc/html/index.html @@ -14,7 +14,7 @@
-

for OSTree 2019.1

+

for OSTree 2019.2


diff --git a/apidoc/html/ostree-OstreeRepo.html b/apidoc/html/ostree-OstreeRepo.html index ffef76a9..b815c6e3 100644 --- a/apidoc/html/ostree-OstreeRepo.html +++ b/apidoc/html/ostree-OstreeRepo.html @@ -136,6 +136,13 @@ +const gchar * + + +ostree_repo_get_bootloader () + + + GFile * @@ -1646,6 +1653,34 @@ this function on a repository initialized via +

ostree_repo_get_bootloader ()

+
const gchar *
+ostree_repo_get_bootloader (OstreeRepo *self);
+

Get the bootloader configured. See the documentation for the +"sysroot.bootloader" config key.

+
+

Parameters

+
+++++ + + + + + +

self

an OstreeRepo

 
+
+
+

Returns

+

bootloader configuration for the sysroot

+
+

Since: 2019.2

+ +
+

ostree_repo_get_path ()

GFile *
 ostree_repo_get_path (OstreeRepo *self);
@@ -3952,6 +3987,8 @@ the parameter out_rev . Differently from ostree_repo_resolve_rev(), this will not fall back to searching through remote repos if a local ref is specified but not found.

+

The flag OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY is implied so +using it has no effect.

Parameters

@@ -7176,7 +7213,14 @@ string to pull the latest commit for that ref

  • append-user-agent (s): Additional string to append to the user agent

  • n-network-retries (u): Number of times to retry each download on receiving a transient network error, such as a socket timeout; default is 5, 0 -means return errors without retrying

  • +means return errors without retrying. Since: 2018.6

    +
  • ref-keyring-map (a(sss)): Array of (collection ID, ref name, keyring +remote name) tuples specifying which remote's keyring should be used when +doing GPG verification of each collection-ref. This is useful to prevent a +remote from serving malicious updates to refs which did not originate from +it. This can be a subset or superset of the refs being pulled; any ref +not being pulled will be ignored and any ref without a keyring remote +will be verified with the keyring of the remote being pulled from.

  • Parameters

    @@ -7220,6 +7264,7 @@ means return errors without retrying

    +

    Since: 2019.2


    @@ -7890,6 +7935,13 @@ possible modes.

      + +

    OSTREE_REPO_REMOTE_CHANGE_REPLACE

    + +

    Add or replace a remote (Since: 2019.2)

    + +  +
    @@ -7992,13 +8044,22 @@ in bytes, counting only content objects.

    - + +

    OSTREE_REPO_RESOLVE_REV_EXT_NONE

    No flags.

      - + + +

    OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY

    + +

    Exclude remote and mirrored refs. Since: 2019.2

    + +  + + @@ -8035,6 +8096,13 @@ in bytes, counting only content objects.

      + +

    OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS

    + +

    Exclude mirrored refs. Since: 2019.2

    + +  + diff --git a/apidoc/html/ostree.devhelp2 b/apidoc/html/ostree.devhelp2 index 502d889d..3e7910ad 100644 --- a/apidoc/html/ostree.devhelp2 +++ b/apidoc/html/ostree.devhelp2 @@ -96,6 +96,7 @@ + @@ -209,7 +210,7 @@ - + @@ -422,10 +423,13 @@ + + + diff --git a/apidoc/html/reference.html b/apidoc/html/reference.html index e28d00a0..bc87ed00 100644 --- a/apidoc/html/reference.html +++ b/apidoc/html/reference.html @@ -1022,6 +1022,10 @@ ostree_repo_find_remotes_finish, function in ostree-repo-experimental
    +ostree_repo_get_bootloader, function in OstreeRepo +
    +
    +
    ostree_repo_get_collection_id, function in ostree-misc-experimental
    diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index 5dbafc5f..1a26e1eb 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -293,6 +293,7 @@ ostree_repo_is_system ostree_repo_is_writable ostree_repo_create_at ostree_repo_create +ostree_repo_get_bootloader ostree_repo_get_path ostree_repo_get_mode ostree_repo_get_min_free_space_bytes diff --git a/apidoc/version.xml b/apidoc/version.xml index f946108e..8684c64d 100644 --- a/apidoc/version.xml +++ b/apidoc/version.xml @@ -1 +1 @@ -2019.1 \ No newline at end of file +2019.2 \ No newline at end of file diff --git a/bash/ostree b/bash/ostree index 52b111ec..5ba3d475 100644 --- a/bash/ostree +++ b/bash/ostree @@ -985,6 +985,7 @@ _ostree_remote_add() { local boolean_options=" $main_boolean_options --if-not-exists + --force --no-gpg-verify " diff --git a/build-aux/compile b/build-aux/compile index 99e50524..b89c278e 100755 --- a/build-aux/compile +++ b/build-aux/compile @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC diff --git a/build-aux/config.guess b/build-aux/config.guess index 256083a7..b5d7a0f3 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -1,8 +1,8 @@ -#! /bin/sh +#!/usr/bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2018-03-08' +timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -84,8 +84,6 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 - # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -96,34 +94,39 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; - for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15 +trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0 + +set_cc_for_build() { + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi @@ -138,7 +141,7 @@ Linux|GNU|GNU/*) # We could probably try harder. LIBC=gnu - eval "$set_cc_for_build" + set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) @@ -199,7 +202,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -237,7 +240,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi}" + echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -389,20 +392,15 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" - SUN_ARCH=i386 - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH=x86_64 - fi - fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + case `isainfo -b` in + 32) + echo i386-pc-solaris2"$UNAME_REL" + ;; + 64) + echo x86_64-pc-solaris2"$UNAME_REL" + ;; + esac exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -482,7 +480,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ @@ -579,7 +577,7 @@ EOF exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include @@ -660,7 +658,7 @@ EOF esac fi if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE @@ -700,7 +698,7 @@ EOF esac if [ "$HP_ARCH" = hppa2.0w ] then - eval "$set_cc_for_build" + set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -726,7 +724,7 @@ EOF echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int @@ -840,6 +838,17 @@ EOF *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + else + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + fi + exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in @@ -894,8 +903,8 @@ EOF # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; - i*86:Minix:*:*) - echo "$UNAME_MACHINE"-pc-minix + *:Minix:*:*) + echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -922,7 +931,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then @@ -971,7 +980,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} @@ -1285,7 +1294,7 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" + set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi @@ -1358,6 +1367,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. + # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else diff --git a/build-aux/config.sub b/build-aux/config.sub index 20f7cf29..be4dc6e5 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -1,8 +1,8 @@ -#! /bin/sh +#!/usr/bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2018-05-05' +timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -110,16 +110,20 @@ case $# in exit 1;; esac -# Spilt fields of configuration type +# Split fields of configuration type IFS="-" read -r field1 field2 field3 field4 <&2 + exit 1 + ;; *-*-*-*) basic_machine=$field1-$field2 - os=-$field3-$field4 + os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two @@ -132,1227 +136,1133 @@ case $1 in | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 - os=-$maybe_os + os=$maybe_os ;; android-linux) basic_machine=$field1-unknown - os=-linux-android + os=linux-android ;; *) basic_machine=$field1-$field2 - os=-$field3 + os=$field3 ;; esac ;; *-*) - basic_machine=$field1 - os=-$field2 + # A lone config we happen to match not fitting any patern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + os= + ;; + *) + basic_machine=$field1 + os=$field2 + ;; + esac + ;; + esac ;; *) - basic_machine=$1 - os= + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + os=bsd + ;; + a29khif) + basic_machine=a29k-amd + os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=scout + ;; + alliant) + basic_machine=fx80-alliant + os= + ;; + altos | altos3068) + basic_machine=m68k-altos + os= + ;; + am29k) + basic_machine=a29k-none + os=bsd + ;; + amdahl) + basic_machine=580-amdahl + os=sysv + ;; + amiga) + basic_machine=m68k-unknown + os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=bsd + ;; + aros) + basic_machine=i386-pc + os=aros + ;; + aux) + basic_machine=m68k-apple + os=aux + ;; + balance) + basic_machine=ns32k-sequent + os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=linux + ;; + cegcc) + basic_machine=arm-unknown + os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=bsd + ;; + convex-c2) + basic_machine=c2-convex + os=bsd + ;; + convex-c32) + basic_machine=c32-convex + os=bsd + ;; + convex-c34) + basic_machine=c34-convex + os=bsd + ;; + convex-c38) + basic_machine=c38-convex + os=bsd + ;; + cray) + basic_machine=j90-cray + os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + os= + ;; + da30) + basic_machine=m68k-da30 + os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + os= + ;; + delta88) + basic_machine=m88k-motorola + os=sysv3 + ;; + dicos) + basic_machine=i686-pc + os=dicos + ;; + djgpp) + basic_machine=i586-pc + os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=ose + ;; + gmicro) + basic_machine=tron-gmicro + os=sysv + ;; + go32) + basic_machine=i386-pc + os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=hms + ;; + harris) + basic_machine=m88k-harris + os=sysv3 + ;; + hp300) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=hpux + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=proelf + ;; + i386mach) + basic_machine=i386-mach + os=mach + ;; + vsta) + basic_machine=i386-pc + os=vsta + ;; + isi68 | isi) + basic_machine=m68k-isi + os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + os=sysv + ;; + merlin) + basic_machine=ns32k-utek + os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + os=coff + ;; + morphos) + basic_machine=powerpc-unknown + os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + os=moxiebox + ;; + msdos) + basic_machine=i386-pc + os=msdos + ;; + msys) + basic_machine=i686-pc + os=msys + ;; + mvs) + basic_machine=i370-ibm + os=mvs + ;; + nacl) + basic_machine=le32-unknown + os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=newsos + ;; + news1000) + basic_machine=m68030-sony + os=newsos + ;; + necv70) + basic_machine=v70-nec + os=sysv + ;; + nh3000) + basic_machine=m68k-harris + os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=cxux + ;; + nindy960) + basic_machine=i960-intel + os=nindy + ;; + mon960) + basic_machine=i960-intel + os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=ose + ;; + os68k) + basic_machine=m68k-none + os=os68k + ;; + paragon) + basic_machine=i860-intel + os=osf + ;; + parisc) + basic_machine=hppa-unknown + os=linux + ;; + pw32) + basic_machine=i586-unknown + os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=rdos + ;; + rdos32) + basic_machine=i386-pc + os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=coff + ;; + sa29200) + basic_machine=a29k-amd + os=udi + ;; + sei) + basic_machine=mips-sei + os=seiux + ;; + sequent) + basic_machine=i386-sequent + os= + ;; + sps7) + basic_machine=m68k-bull + os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + os= + ;; + stratus) + basic_machine=i860-stratus + os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + os= + ;; + sun2os3) + basic_machine=m68000-sun + os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + os= + ;; + sun3os3) + basic_machine=m68k-sun + os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + os= + ;; + sun4os3) + basic_machine=sparc-sun + os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + os= + ;; + sv1) + basic_machine=sv1-cray + os=unicos + ;; + symmetry) + basic_machine=i386-sequent + os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=unicos + ;; + t90) + basic_machine=t90-cray + os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + os=tpf + ;; + udi29k) + basic_machine=a29k-amd + os=udi + ;; + ultra3) + basic_machine=a29k-nyu + os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=none + ;; + vaxv) + basic_machine=vax-dec + os=sysv + ;; + vms) + basic_machine=vax-dec + os=vms + ;; + vxworks960) + basic_machine=i960-wrs + os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=vxworks + ;; + xbox) + basic_machine=i686-pc + os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + os=unicos + ;; + *) + basic_machine=$1 + os= + ;; + esac ;; esac -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper | csky \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nfp \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | wasm32 \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond ;; - c54x) - basic_machine=tic54x-unknown + op50n) + cpu=hppa1.1 + vendor=oki ;; - c55x) - basic_machine=tic55x-unknown + op60c) + cpu=hppa1.1 + vendor=oki ;; - c6x) - basic_machine=tic6x-unknown + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + os=${os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + os=${os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $os in + irix*) + ;; + *) + os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $os in + nextstep* ) + ;; + ns2*) + os=nextstep2 + ;; + *) + os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + os=${os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + os=proelf + ;; + none) + cpu=none + vendor=none ;; leon|leon[3-9]) - basic_machine=sparc-$basic_machine + cpu=sparc + vendor=$basic_machine ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) - ;; - m9s12z | m68hcs12z | hcs12z | s12z) - basic_machine=s12z-unknown - os=-none - ;; - ms1) - basic_machine=mt-unknown + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; - strongarm | thumb | xscale) - basic_machine=arm-unknown + *-*) + IFS="-" read -r cpu vendor <&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | ba-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nfp-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ - | pyramid-* \ - | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | wasm32-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-pc - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - asmjs) - basic_machine=asmjs-unknown - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2*) - basic_machine=m68k-bull - os=-sysv3 - ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 + cpu=$basic_machine + vendor=pc ;; + # These rules are duplicated from below for sake of the special case above; + # i.e. things that normalized to x86 arches should also default to "pc" pc98) - basic_machine=i386-pc + cpu=i386 + vendor=pc ;; - pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + x64 | amd64) + cpu=x86_64 + vendor=pc ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc + # Recognize the basic CPU types without company name. + *) + cpu=$basic_machine + vendor=unknown ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc +esac + +unset -v basic_machine + +# Decode basic machines in the full and proper CPU-Company form. +case $cpu-$vendor in + # Here we handle the default manufacturer of certain CPU types in cannonical form. It is in + # some cases the only manufacturer, in others, it is the most popular. + craynv-unknown) + vendor=cray + os=${os:-unicosmp} ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc + c90-unknown | c90-cray) + vendor=cray + os=${os:-unicos} ;; - pentium4) - basic_machine=i786-pc + fx80-unknown) + vendor=alliant ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + romp-unknown) + vendor=ibm ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + mmix-unknown) + vendor=knuth ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + microblaze-unknown | microblazeel-unknown) + vendor=xilinx ;; - pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + rs6000-unknown) + vendor=ibm ;; - pn) - basic_machine=pn-gould + vax-unknown) + vendor=dec ;; - power) basic_machine=power-ibm + pdp11-unknown) + vendor=dec ;; - ppc | ppcbe) basic_machine=powerpc-unknown + we32k-unknown) + vendor=att ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + cydra-unknown) + vendor=cydrome ;; - ppcle | powerpclittle) - basic_machine=powerpcle-unknown + i370-ibm*) + vendor=ibm ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + orion-unknown) + vendor=highlevel ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - x64) - basic_machine=x86_64-pc - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - none) - basic_machine=none-none - os=-none + xps-unknown | xps100-unknown) + cpu=xps100 + vendor=honeywell ;; -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond + # Here we normalize CPU types with a missing or matching vendor + dpx20-unknown | dpx20-bull) + cpu=rs6000 + vendor=bull + os=${os:-bosx} ;; - op50n) - basic_machine=hppa1.1-oki + + # Here we normalize CPU types irrespective of the vendor + amd64-*) + cpu=x86_64 ;; - op60c) - basic_machine=hppa1.1-oki + blackfin-*) + cpu=bfin + os=linux ;; - romp) - basic_machine=romp-ibm + c54x-*) + cpu=tic54x ;; - mmix) - basic_machine=mmix-knuth + c55x-*) + cpu=tic55x ;; - rs6000) - basic_machine=rs6000-ibm + c6x-*) + cpu=tic6x ;; - vax) - basic_machine=vax-dec + e500v[12]-*) + cpu=powerpc + os=$os"spe" ;; - pdp11) - basic_machine=pdp11-dec + mips3*-*) + cpu=mips64 ;; - we32k) - basic_machine=we32k-att + ms1-*) + cpu=mt ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown + m68knommu-*) + cpu=m68k + os=linux ;; - cydra) - basic_machine=cydra-cydrome + m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) + cpu=s12z ;; - orion) - basic_machine=orion-highlevel + openrisc-*) + cpu=or32 ;; - orion105) - basic_machine=clipper-highlevel + parisc-*) + cpu=hppa + os=linux ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + cpu=i586 ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple + pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) + cpu=i686 ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + cpu=i686 ;; + pentium4-*) + cpu=i786 + ;; + pc98-*) + cpu=i386 + ;; + ppc-* | ppcbe-*) + cpu=powerpc + ;; + ppcle-* | powerpclittle-*) + cpu=powerpcle + ;; + ppc64-*) + cpu=powerpc64 + ;; + ppc64le-* | powerpc64little-*) + cpu=powerpc64le + ;; + sb1-*) + cpu=mipsisa64sb1 + ;; + sb1el-*) + cpu=mipsisa64sb1el + ;; + sh5e[lb]-*) + cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` + ;; + spur-*) + cpu=spur + ;; + strongarm-* | thumb-*) + cpu=arm + ;; + tx39-*) + cpu=mipstx39 + ;; + tx39el-*) + cpu=mipstx39el + ;; + x64-*) + cpu=x86_64 + ;; + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + ;; + + # Recognize the cannonical CPU Types that limit and/or modify the + # company names they are paired with. + cr16-*) + os=${os:-elf} + ;; + crisv32-* | etraxfs*-*) + cpu=crisv32 + vendor=axis + ;; + cris-* | etrax*-*) + cpu=cris + vendor=axis + ;; + crx-*) + os=${os:-elf} + ;; + neo-tandem) + cpu=neo + vendor=tandem + ;; + nse-tandem) + cpu=nse + vendor=tandem + ;; + nsr-tandem) + cpu=nsr + vendor=tandem + ;; + nsv-tandem) + cpu=nsv + vendor=tandem + ;; + nsx-tandem) + cpu=nsx + vendor=tandem + ;; + s390-*) + cpu=s390 + vendor=ibm + ;; + s390x-*) + cpu=s390x + vendor=ibm + ;; + tile*-*) + os=${os:-linux-gnu} + ;; + *) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 + # Recognize the cannonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k | v70 | w65 \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv64 \ + | rl78 | romp | rs6000 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | wasm32 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1365,200 +1275,240 @@ then case $os in # First match some system type aliases that might get confused # with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux + # solaris* is a basic system type, with this one exception. + auroraux) + os=auroraux ;; - -solaris1 | -solaris1.*) + bluegene*) + os=cnk + ;; + solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; - -solaris) - os=-solaris2 + solaris) + os=solaris2 ;; - -unixware*) - os=-sysv4.2uw + unixware*) + os=sysv4.2uw ;; - -gnu/linux*) + gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) - -es1800*) - os=-ose + es1800*) + os=ose + ;; + # Some version numbers need modification + chorusos*) + os=chorusos + ;; + isc) + os=isc2.2 + ;; + sco6) + os=sco5v6 + ;; + sco5) + os=sco3.2v5 + ;; + sco4) + os=sco3.2v4 + ;; + sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + ;; + sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + scout) + # Don't match below + ;; + sco*) + os=sco3.2v2 + ;; + psos*) + os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ - | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ - | -midnightbsd*) + # sysv* is not here because it comes later, after sysvr4. + gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | kopensolaris* | plan9* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | knetbsd* | mirbsd* | netbsd* \ + | bitrig* | openbsd* | solidbsd* | libertybsd* \ + | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ + | linux-newlib* | linux-musl* | linux-uclibc* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* \ + | morphos* | superux* | rtmk* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) + qnx*) + case $cpu in + x86 | i*86) ;; *) - os=-nto$os + os=nto-$os ;; esac ;; - -nto-qnx*) + hiux*) + os=hiuxwe2 ;; - -nto*) + nto-qnx*) + ;; + nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; - -sim | -xray | -os68k* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + sim | xray | os68k* | v88r* \ + | windows* | osx | abug | netware* | os9* \ + | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; - -mac*) - os=`echo "$os" | sed -e 's|mac|macos|'` + linux-dietlibc) + os=linux-dietlibc ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) + linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; - -sunos5*) + lynx*178) + os=lynxos178 + ;; + lynx*5) + os=lynxos5 + ;; + lynx*) + os=lynxos + ;; + mac*) + os=`echo "$os" | sed -e 's|mac|macos|'` + ;; + opened*) + os=openedition + ;; + os400*) + os=os400 + ;; + sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; - -sunos6*) + sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; - -opened*) - os=-openedition + wince*) + os=wince ;; - -os400*) - os=-os400 + utek*) + os=bsd ;; - -wince*) - os=-wince + dynix*) + os=bsd ;; - -utek*) - os=-bsd + acis*) + os=aos ;; - -dynix*) - os=-bsd + atheos*) + os=atheos ;; - -acis*) - os=-aos + syllable*) + os=syllable ;; - -atheos*) - os=-atheos + 386bsd) + os=bsd ;; - -syllable*) - os=-syllable + ctix* | uts*) + os=sysv ;; - -386bsd) - os=-bsd + nova*) + os=rtmk-nova ;; - -ctix* | -uts*) - os=-sysv + ns2) + os=nextstep2 ;; - -nova*) - os=-rtmk-nova - ;; - -ns2) - os=-nextstep2 - ;; - -nsk*) - os=-nsk + nsk*) + os=nsk ;; # Preserve the version number of sinix5. - -sinix5.*) + sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; - -sinix*) - os=-sysv4 + sinix*) + os=sysv4 ;; - -tpf*) - os=-tpf + tpf*) + os=tpf ;; - -triton*) - os=-sysv3 + triton*) + os=sysv3 ;; - -oss*) - os=-sysv3 + oss*) + os=sysv3 ;; - -svr4*) - os=-sysv4 + svr4*) + os=sysv4 ;; - -svr3) - os=-sysv3 + svr3) + os=sysv3 ;; - -sysvr4) - os=-sysv4 + sysvr4) + os=sysv4 ;; - # This must come after -sysvr4. - -sysv*) + # This must come after sysvr4. + sysv*) ;; - -ose*) - os=-ose + ose*) + os=ose ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + os=mint ;; - -zvmoe) - os=-zvmoe + zvmoe) + os=zvmoe ;; - -dicos*) - os=-dicos + dicos*) + os=dicos ;; - -pikeos*) + pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. - case $basic_machine in + case $cpu in arm*) - os=-eabi + os=eabi ;; *) - os=-elf + os=elf ;; esac ;; - -nacl*) + nacl*) ;; - -ios) + ios) ;; - -none) + none) ;; - -*-eabi) - case $basic_machine in - arm*) - ;; - esac + *-eabi) ;; *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; @@ -1575,254 +1525,261 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +case $cpu-$vendor in score-*) - os=-elf + os=elf ;; spu-*) - os=-elf + os=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + os=linux ;; arm*-semi) - os=-aout + os=aout ;; c4x-* | tic4x-*) - os=-coff + os=coff ;; c8051-*) - os=-elf + os=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os=elf ;; tic54x-*) - os=-coff + os=coff ;; tic55x-*) - os=-coff + os=coff ;; tic6x-*) - os=-coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os=aout ;; mep-*) - os=-elf + os=elf ;; mips*-cisco) - os=-elf + os=elf ;; mips*-*) - os=-elf + os=elf ;; or32-*) - os=-coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; pru-*) - os=-elf + os=elf ;; *-be) - os=-beos + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; *-next) - os=-nextstep + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os=coff ;; *-*bug) - os=-coff + os=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) +case $vendor in + unknown) case $os in - -riscix*) + riscix*) vendor=acorn ;; - -sunos*) + sunos*) vendor=sun ;; - -cnk*|-aix*) + cnk*|-aix*) vendor=ibm ;; - -beos*) + beos*) vendor=be ;; - -hpux*) + hpux*) vendor=hp ;; - -mpeix*) + mpeix*) vendor=hp ;; - -hiux*) + hiux*) vendor=hitachi ;; - -unos*) + unos*) vendor=crds ;; - -dgux*) + dgux*) vendor=dg ;; - -luna*) + luna*) vendor=omron ;; - -genix*) + genix*) vendor=ns ;; - -mvs* | -opened*) + clix*) + vendor=intergraph + ;; + mvs* | opened*) vendor=ibm ;; - -os400*) + os400*) vendor=ibm ;; - -ptx*) + ptx*) vendor=sequent ;; - -tpf*) + tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + vxsim* | vxworks* | windiss*) vendor=wrs ;; - -aux*) + aux*) vendor=apple ;; - -hms*) + hms*) vendor=hitachi ;; - -mpw* | -macos*) + mpw* | macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; - -vos*) + vos*) vendor=stratus ;; esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo "$basic_machine$os" +echo "$cpu-$vendor-$os" exit # Local variables: diff --git a/build-aux/depcomp b/build-aux/depcomp index 65cbf709..4e0ae31b 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC diff --git a/build-aux/install-sh b/build-aux/install-sh index 8175c640..defb86ae 100755 --- a/build-aux/install-sh +++ b/build-aux/install-sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC diff --git a/build-aux/missing b/build-aux/missing index 625aeb11..ab658ed5 100755 --- a/build-aux/missing +++ b/build-aux/missing @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC diff --git a/build-aux/test-driver b/build-aux/test-driver index b8521a48..d1ef0647 100755 --- a/build-aux/test-driver +++ b/build-aux/test-driver @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC diff --git a/configure b/configure index 9b02eda1..04914bbb 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libostree 2019.1. +# Generated by GNU Autoconf 2.69 for libostree 2019.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libostree' PACKAGE_TARNAME='libostree' -PACKAGE_VERSION='2019.1' -PACKAGE_STRING='libostree 2019.1' +PACKAGE_VERSION='2019.2' +PACKAGE_STRING='libostree 2019.2' PACKAGE_BUGREPORT='walters@verbum.org' PACKAGE_URL='' @@ -975,6 +975,12 @@ PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR BASH_COMPLETIONSDIR +GLIB_CFLAGS +GLIB_LIBS +GLIB_GENMARSHAL +GOBJECT_QUERY +GLIB_MKENUMS +GLIB_COMPILE_RESOURCES OT_DEP_GIO_UNIX_CFLAGS OT_DEP_GIO_UNIX_LIBS OT_DEP_LZMA_CFLAGS @@ -1547,7 +1553,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libostree 2019.1 to adapt to many kinds of systems. +\`configure' configures libostree 2019.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1617,7 +1623,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libostree 2019.1:";; + short | recursive ) echo "Configuration of libostree 2019.2:";; esac cat <<\_ACEOF @@ -1733,6 +1739,17 @@ Some influential environment variables: BASH_COMPLETIONSDIR value of completionsdir for bash-completion, overriding pkg-config + GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config + GLIB_LIBS linker flags for GLIB, overriding pkg-config + GLIB_GENMARSHAL + value of glib_genmarshal for glib-2.0, overriding pkg-config + GOBJECT_QUERY + value of gobject_query for glib-2.0, overriding pkg-config + GLIB_MKENUMS + value of glib_mkenums for glib-2.0, overriding pkg-config + GLIB_COMPILE_RESOURCES + value of glib_compile_resources for gio-2.0, overriding + pkg-config OT_DEP_GIO_UNIX_CFLAGS C compiler flags for OT_DEP_GIO_UNIX, overriding pkg-config OT_DEP_GIO_UNIX_LIBS @@ -1864,7 +1881,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libostree configure 2019.1 +libostree configure 2019.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2336,7 +2353,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libostree $as_me 2019.1, which was +It was created by libostree $as_me 2019.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3204,7 +3221,7 @@ fi # Define the identity of the package. PACKAGE='libostree' - VERSION='2019.1' + VERSION='2019.2' # Some tools Automake needs. @@ -5938,9 +5955,9 @@ test -n "$YACC" || YACC="yacc" YEAR_VERSION=2019 -RELEASE_VERSION=1 +RELEASE_VERSION=2 -PACKAGE_VERSION=2019.1 +PACKAGE_VERSION=2019.2 if echo "$CFLAGS" | grep -q -E -e '-Werror($| )'; then : @@ -14159,6 +14176,9 @@ if test "x$BASH_COMPLETIONSDIR" = x""; then : fi + + + # Check whether --enable-glibtest was given. if test "${enable_glibtest+set}" = set; then : enableval=$enable_glibtest; @@ -14167,7 +14187,8 @@ else fi - pkg_config_args=glib-2.0 + min_glib_version=2.0.0 + pkg_config_args="glib-2.0 >= $min_glib_version" for module in . do case "$module" in @@ -14317,7 +14338,171 @@ fi PKG_CONFIG=no fi - min_glib_version=2.0.0 + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 +$as_echo_n "checking for GLIB... " >&6; } + +if test -n "$GLIB_CFLAGS"; then + pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$pkg_config_args\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$pkg_config_args") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "$pkg_config_args" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GLIB_LIBS"; then + pkg_cv_GLIB_LIBS="$GLIB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$pkg_config_args\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$pkg_config_args") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "$pkg_config_args" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$pkg_config_args" 2>&1` + else + GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$pkg_config_args" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GLIB_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS + GLIB_LIBS=$pkg_cv_GLIB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + + +if test -n "$GLIB_GENMARSHAL"; then + pkg_cv_GLIB_GENMARSHAL="$GLIB_GENMARSHAL" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_GENMARSHAL=`$PKG_CONFIG --variable="glib_genmarshal" "glib-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +GLIB_GENMARSHAL=$pkg_cv_GLIB_GENMARSHAL + +if test "x$GLIB_GENMARSHAL" = x""; then : + +fi + +if test -n "$GOBJECT_QUERY"; then + pkg_cv_GOBJECT_QUERY="$GOBJECT_QUERY" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GOBJECT_QUERY=`$PKG_CONFIG --variable="gobject_query" "glib-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +GOBJECT_QUERY=$pkg_cv_GOBJECT_QUERY + +if test "x$GOBJECT_QUERY" = x""; then : + +fi + +if test -n "$GLIB_MKENUMS"; then + pkg_cv_GLIB_MKENUMS="$GLIB_MKENUMS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_MKENUMS=`$PKG_CONFIG --variable="glib_mkenums" "glib-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +GLIB_MKENUMS=$pkg_cv_GLIB_MKENUMS + +if test "x$GLIB_MKENUMS" = x""; then : + +fi + +if test -n "$GLIB_COMPILE_RESOURCES"; then + pkg_cv_GLIB_COMPILE_RESOURCES="$GLIB_COMPILE_RESOURCES" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gio-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable="glib_compile_resources" "gio-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +GLIB_COMPILE_RESOURCES=$pkg_cv_GLIB_COMPILE_RESOURCES + +if test "x$GLIB_COMPILE_RESOURCES" = x""; then : + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5 $as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } @@ -14336,13 +14521,6 @@ $as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } fi if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ @@ -14504,12 +14682,6 @@ rm -f core conftest.err conftest.$ac_objext \ GLIB_COMPILE_RESOURCES="" as_fn_error $? "GLib not found" "$LINENO" 5 fi - - - - - - rm -f conf.glibtest @@ -18623,7 +18795,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libostree $as_me 2019.1, which was +This file was extended by libostree $as_me 2019.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18689,7 +18861,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libostree config.status 2019.1 +libostree config.status 2019.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 101a8a17..e6e145db 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ 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], [2019]) -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 diff --git a/man/ostree-config.xml b/man/ostree-config.xml index dc180b83..e5391bbf 100644 --- a/man/ostree-config.xml +++ b/man/ostree-config.xml @@ -51,25 +51,46 @@ Boston, MA 02111-1307, USA. - ostree config get SECTIONNAME.KEYNAME + ostree config get GROUPNAME.KEYNAME ostree config get --group=GROUPNAME KEYNAME - ostree config set SECTIONNAME.KEYNAME VALUE + ostree config set GROUPNAME.KEYNAME VALUE ostree config set --group=GROUPNAME KEYNAME VALUE + + ostree config unset GROUPNAME.KEYNAME + + + ostree config unset --group=GROUPNAME KEYNAME + Description - - Displays or changes a configuration setting. - + + + ostree config get displays the value of + KEYNAME in the group GROUPNAME + + + ostree config set sets the value of + KEYNAME in the group GROUPNAME + to VALUE. + + + ostree config unset removes the key + KEYNAME from the group GROUPNAME + so that OSTree uses the default value for it. It is not an + error for the specified GROUPNAME or + KEYNAME not to exist. + + @@ -77,5 +98,6 @@ Boston, MA 02111-1307, USA. $ ostree config get core.mode bare $ ostree config set --group='remote "myremote"' url http://example.com/repo + $ ostree config unset core.lock-timeout-secs diff --git a/man/ostree-remote.xml b/man/ostree-remote.xml index e908315f..407f7e3d 100644 --- a/man/ostree-remote.xml +++ b/man/ostree-remote.xml @@ -128,6 +128,22 @@ Boston, MA 02111-1307, USA. + + + + + Do nothing if the provided remote exists. + + + + + + + + Replace the provided remote if it exists. + + + diff --git a/man/ostree.repo-config.xml b/man/ostree.repo-config.xml index 618b524b..90ac9083 100644 --- a/man/ostree.repo-config.xml +++ b/man/ostree.repo-config.xml @@ -109,22 +109,22 @@ Boston, MA 02111-1307, USA. ensure files are on stable storage when performing operations such as commits, pulls, and checkouts. Defaults to true. - - If you disable fsync, OSTree will no longer be robust - against kernel crashes or power loss. - - - You might choose to disable this for local development - repositories, under the assumption they can be recreated from - source. Similarly, you could disable for a mirror where you could - re-pull. - - - For the system repository, you might choose to disable fsync - if you have uninterruptable power supplies and a well tested - kernel. - - + + If you disable fsync, OSTree will no longer be robust + against kernel crashes or power loss. + + + You might choose to disable this for local development + repositories, under the assumption they can be recreated from + source. Similarly, you could disable for a mirror where you could + re-pull. + + + For the system repository, you might choose to disable fsync + if you have uninterruptable power supplies and a well tested + kernel. + + @@ -333,6 +333,42 @@ Boston, MA 02111-1307, USA. + + [sysroot] Section Options + + + Options for the sysroot, which contains the OSTree repository, + deployments, and stateroots. The following entries are defined: + + + + + + bootloader + Configure the bootloader that OSTree uses when + deploying the sysroot. This may take the values + bootloader=none or bootloader=auto. + Default is auto. + + + If none, then OSTree will generate only BLS (Boot + Loader Specification) fragments in sysroot/boot/loader/entries/ + for the deployment. + + + If auto, then in addition to generating BLS + fragments, OSTree will dynamically check for the existence of grub2, + uboot, and syslinux bootloaders. If one of the bootloaders is found, + then OSTree will generate a config for the bootloader found. For + example, grub2-mkconfig is run for the grub2 case. + + + + + + + + /etc/ostree/remotes.d diff --git a/man/ostree.xml b/man/ostree.xml index f865982e..8c08bae6 100644 --- a/man/ostree.xml +++ b/man/ostree.xml @@ -129,6 +129,15 @@ Boston, MA 02111-1307, USA. Produce debug level output. + + + + + + Print version information, including the features enabled + at compile time, and exit. + + diff --git a/src/boot/grub2/ostree-grub-generator b/src/boot/grub2/ostree-grub-generator index 10645c74..d1436b65 100644 --- a/src/boot/grub2/ostree-grub-generator +++ b/src/boot/grub2/ostree-grub-generator @@ -65,7 +65,7 @@ read_config() populate_menu() { - # Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device than ostree/repo + # Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device as /ostree/repo if [ -z ${OSTREE_BOOT_PARTITION+x} ] && [ -d /boot/ostree ] && [ -d /ostree/repo ] && [ $(stat -c '%d' /boot/ostree) -eq $(stat -c '%d' /ostree/repo) ]; then boot_prefix="/boot" else diff --git a/src/boot/ostree-finalize-staged.service b/src/boot/ostree-finalize-staged.service index 10e551e4..e112bc0c 100644 --- a/src/boot/ostree-finalize-staged.service +++ b/src/boot/ostree-finalize-staged.service @@ -24,8 +24,8 @@ ConditionPathExists=/run/ostree-booted DefaultDependencies=no RequiresMountsFor=/sysroot -After=basic.target -Before=multi-user.target final.target +After=local-fs.target +Before=basic.target final.target Conflicts=final.target [Service] diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 4ff2b86f..8d9a7bfc 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -18,15 +18,15 @@ ***/ /* Add new symbols here. Release commits should copy this section into -released.sym. */ -LIBOSTREE_2018.10 { +LIBOSTREE_2019.3 { } LIBOSTREE_2018.9; /* Stub section for the stable release *after* this development one; don't - * edit this other than to update the last number. This is just a copy/paste + * edit this other than to update the year. This is just a copy/paste * source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION * with whatever the next version with new symbols will be. -LIBOSTREE_2018.$NEWVERSION { +LIBOSTREE_2019.$NEWVERSION { global: someostree_symbol_deleteme; -} LIBOSTREE_2018.$LASTSTABLE; +} LIBOSTREE_2019.$LASTSTABLE; */ diff --git a/src/libostree/libostree-released.sym b/src/libostree/libostree-released.sym index 90b363ca..a4daaf1c 100644 --- a/src/libostree/libostree-released.sym +++ b/src/libostree/libostree-released.sym @@ -542,6 +542,13 @@ LIBOSTREE_2018.9 { ostree_repo_get_default_repo_finders; } LIBOSTREE_2018.7; +/* No new symbols in 2019.1 */ + +LIBOSTREE_2019.2 { + ostree_repo_get_bootloader; +} LIBOSTREE_2018.9; + + /* NOTE: Only add more content here in release commits! See the * comments at the top of this file. */ diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c index 57673c7d..ceea682e 100644 --- a/src/libostree/ostree-bootloader-grub2.c +++ b/src/libostree/ostree-bootloader-grub2.c @@ -332,6 +332,7 @@ grub2_child_setup (gpointer user_data) static gboolean _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, int bootversion, + GPtrArray *new_deployments, GCancellable *cancellable, GError **error) { @@ -357,15 +358,11 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, if (use_system_grub2_mkconfig && ostree_sysroot_get_booted_deployment (self->sysroot) == NULL && g_file_has_parent (self->sysroot->path, NULL)) { - g_autoptr(GPtrArray) deployments = NULL; OstreeDeployment *tool_deployment; g_autoptr(GFile) tool_deployment_root = NULL; - deployments = ostree_sysroot_get_deployments (self->sysroot); - - g_assert_cmpint (deployments->len, >, 0); - - tool_deployment = deployments->pdata[0]; + g_assert_cmpint (new_deployments->len, >, 0); + tool_deployment = new_deployments->pdata[0]; /* Sadly we have to execute code to generate the bootloader configuration. * If we're in a booted deployment, we just don't chroot. @@ -380,6 +377,8 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, grub2_mkconfig_chroot = g_file_get_path (tool_deployment_root); } + g_debug ("Using grub2-mkconfig chroot: %s\n", grub2_mkconfig_chroot); + g_autoptr(GFile) new_config_path = NULL; g_autoptr(GFile) config_path_efi_dir = NULL; if (self->is_efi) diff --git a/src/libostree/ostree-bootloader-syslinux.c b/src/libostree/ostree-bootloader-syslinux.c index 8b09a861..5fb8a1db 100644 --- a/src/libostree/ostree-bootloader-syslinux.c +++ b/src/libostree/ostree-bootloader-syslinux.c @@ -108,10 +108,11 @@ append_config_from_loader_entries (OstreeBootloaderSyslinux *self, } static gboolean -_ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader, - int bootversion, - GCancellable *cancellable, - GError **error) +_ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader, + int bootversion, + GPtrArray *new_deployments, + GCancellable *cancellable, + GError **error) { OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader); diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c index 531a3756..87a93806 100644 --- a/src/libostree/ostree-bootloader-uboot.c +++ b/src/libostree/ostree-bootloader-uboot.c @@ -158,10 +158,11 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, } static gboolean -_ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader, - int bootversion, - GCancellable *cancellable, - GError **error) +_ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader, + int bootversion, + GPtrArray *new_deployments, + GCancellable *cancellable, + GError **error) { OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader); diff --git a/src/libostree/ostree-bootloader.c b/src/libostree/ostree-bootloader.c index 87823f7e..5b8125dc 100644 --- a/src/libostree/ostree-bootloader.c +++ b/src/libostree/ostree-bootloader.c @@ -54,13 +54,15 @@ _ostree_bootloader_get_name (OstreeBootloader *self) gboolean _ostree_bootloader_write_config (OstreeBootloader *self, int bootversion, + GPtrArray *new_deployments, GCancellable *cancellable, GError **error) { g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE); - return OSTREE_BOOTLOADER_GET_IFACE (self)->write_config (self, bootversion, - cancellable, error); + return OSTREE_BOOTLOADER_GET_IFACE (self)->write_config (self, bootversion, + new_deployments, + cancellable, error); } gboolean diff --git a/src/libostree/ostree-bootloader.h b/src/libostree/ostree-bootloader.h index a4793b08..5af2dcc8 100644 --- a/src/libostree/ostree-bootloader.h +++ b/src/libostree/ostree-bootloader.h @@ -44,6 +44,7 @@ struct _OstreeBootloaderInterface const char * (* get_name) (OstreeBootloader *self); gboolean (* write_config) (OstreeBootloader *self, int bootversion, + GPtrArray *new_deployments, GCancellable *cancellable, GError **error); gboolean (* is_atomic) (OstreeBootloader *self); @@ -61,6 +62,7 @@ const char *_ostree_bootloader_get_name (OstreeBootloader *self); gboolean _ostree_bootloader_write_config (OstreeBootloader *self, int bootversion, + GPtrArray *new_deployments, GCancellable *cancellable, GError **error); diff --git a/src/libostree/ostree-fetcher-soup.c b/src/libostree/ostree-fetcher-soup.c index 3951a927..970ac7a4 100644 --- a/src/libostree/ostree-fetcher-soup.c +++ b/src/libostree/ostree-fetcher-soup.c @@ -645,7 +645,7 @@ _ostree_fetcher_constructed (GObject *object) } http_proxy = g_getenv ("http_proxy"); - if (http_proxy != NULL) + if (http_proxy != NULL && http_proxy[0] != '\0') _ostree_fetcher_set_proxy (self, http_proxy); /* FIXME Maybe implement GInitableIface and use g_thread_try_new() @@ -711,7 +711,7 @@ _ostree_fetcher_set_proxy (OstreeFetcher *self, SoupURI *proxy_uri; g_return_if_fail (OSTREE_IS_FETCHER (self)); - g_return_if_fail (http_proxy != NULL); + g_return_if_fail (http_proxy != NULL && http_proxy[0] != '\0'); proxy_uri = soup_uri_new (http_proxy); diff --git a/src/libostree/ostree-fetcher-util.c b/src/libostree/ostree-fetcher-util.c index 35e8c3c3..ef02ba1e 100644 --- a/src/libostree/ostree-fetcher-util.c +++ b/src/libostree/ostree-fetcher-util.c @@ -163,18 +163,16 @@ _ostree_fetcher_journal_failure (const char *remote_name, const char *url, const char *msg) { -#ifdef HAVE_LIBSYSTEMD /* Sanity - we don't want to log this when doing local/file pulls */ if (!remote_name) return; - sd_journal_send ("MESSAGE=libostree HTTP error from remote %s for <%s>: %s", + ot_journal_send ("MESSAGE=libostree HTTP error from remote %s for <%s>: %s", remote_name, url, msg, "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_HTTP_FAILURE_ID), "OSTREE_REMOTE=%s", remote_name, "OSTREE_URL=%s", url, "PRIORITY=%i", LOG_ERR, NULL); -#endif } /* Check whether a particular operation should be retried. This is entirely diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 533cf03a..f44446ca 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -4269,7 +4269,7 @@ import_one_object_direct (OstreeRepo *dest_repo, G_IN_SET (src_repo->mode, OSTREE_REPO_MODE_BARE, OSTREE_REPO_MODE_BARE_USER); if (src_is_bare_or_bare_user && !OSTREE_OBJECT_TYPE_IS_META(objtype)) { - if (src_repo == OSTREE_REPO_MODE_BARE) + if (src_repo->mode == OSTREE_REPO_MODE_BARE) { g_autoptr(GVariant) xattrs = NULL; if (!glnx_fd_get_all_xattrs (src_fd, &xattrs, @@ -4279,15 +4279,25 @@ import_one_object_direct (OstreeRepo *dest_repo, cancellable, error)) return FALSE; } + else if (dest_repo->mode == OSTREE_REPO_MODE_BARE_USER_ONLY) + { + /* Nothing; this is the "bareuser-only conversion case", + * we don't need to set any xattrs in the dest repo. + */ + } else { + /* And this case must be bare-user → bare-user */ + g_assert (src_repo->mode == OSTREE_REPO_MODE_BARE_USER); + g_assert (src_repo->mode == dest_repo->mode); + /* bare-user; we just want ostree.usermeta */ g_autoptr(GBytes) bytes = glnx_fgetxattr_bytes (src_fd, "user.ostreemeta", error); if (bytes == NULL) return FALSE; - if (TEMP_FAILURE_RETRY (fsetxattr (src_fd, "user.ostreemeta", + if (TEMP_FAILURE_RETRY (fsetxattr (tmp_dest.fd, "user.ostreemeta", (char*)g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), 0)) != 0) return glnx_throw_errno_prefix (error, "fsetxattr"); diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h index 40be7263..6bc74c2d 100644 --- a/src/libostree/ostree-repo-private.h +++ b/src/libostree/ostree-repo-private.h @@ -169,6 +169,7 @@ struct OstreeRepo { guint64 payload_link_threshold; gint fs_support_reflink; /* The underlying filesystem has support for ioctl (FICLONE..) */ gchar **repo_finders; + gchar *bootloader; /* Configure which bootloader to use. */ OstreeRepo *parent_repo; }; diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 4b596da1..48935523 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -115,6 +115,7 @@ typedef struct { GHashTable *summary_deltas_checksums; GHashTable *ref_original_commits; /* Maps checksum to commit, used by timestamp checks */ GHashTable *gpg_verified_commits; /* Set of commits that have been verified */ + GHashTable *ref_keyring_map; /* Maps OstreeCollectionRef to keyring remote name */ GPtrArray *static_delta_superblocks; GHashTable *expected_commit_sizes; /* Maps commit checksum to known size */ GHashTable *commit_to_depth; /* Maps commit checksum maximum depth */ @@ -260,12 +261,13 @@ static gboolean scan_one_metadata_object (OtPullData *pull_data, GError **error); static void scan_object_queue_data_free (ScanObjectQueueData *scan_data); static gboolean -gpg_verify_unwritten_commit (OtPullData *pull_data, - const char *checksum, - GVariant *commit, - GVariant *detached_metadata, - GCancellable *cancellable, - GError **error); +gpg_verify_unwritten_commit (OtPullData *pull_data, + const char *checksum, + GVariant *commit, + GVariant *detached_metadata, + const OstreeCollectionRef *ref, + GCancellable *cancellable, + GError **error); static gboolean @@ -1307,7 +1309,7 @@ meta_fetch_on_complete (GObject *object, */ GVariant *detached_data = g_hash_table_lookup (pull_data->fetched_detached_metadata, checksum); if (!gpg_verify_unwritten_commit (pull_data, checksum, metadata, detached_data, - pull_data->cancellable, error)) + fetch_data->requested_ref, pull_data->cancellable, error)) goto out; if (!ostree_repo_mark_commit_partial (pull_data->repo, checksum, TRUE, error)) @@ -1462,23 +1464,32 @@ process_verify_result (OtPullData *pull_data, } static gboolean -gpg_verify_unwritten_commit (OtPullData *pull_data, - const char *checksum, - GVariant *commit, - GVariant *detached_metadata, - GCancellable *cancellable, - GError **error) +gpg_verify_unwritten_commit (OtPullData *pull_data, + const char *checksum, + GVariant *commit, + GVariant *detached_metadata, + const OstreeCollectionRef *ref, + GCancellable *cancellable, + GError **error) { if (pull_data->gpg_verify) { + const char *keyring_remote = NULL; + /* Shouldn't happen, but see comment in process_verify_result() */ if (g_hash_table_contains (pull_data->gpg_verified_commits, checksum)) return TRUE; + if (ref != NULL) + keyring_remote = g_hash_table_lookup (pull_data->ref_keyring_map, ref); + if (keyring_remote == NULL) + keyring_remote = pull_data->remote_name; + g_autoptr(GBytes) signed_data = g_variant_get_data_as_bytes (commit); g_autoptr(OstreeGpgVerifyResult) result = _ostree_repo_gpg_verify_with_metadata (pull_data->repo, signed_data, - detached_metadata, pull_data->remote_name, + detached_metadata, + keyring_remote, NULL, NULL, cancellable, error); if (!process_verify_result (pull_data, checksum, result, error)) return FALSE; @@ -1788,10 +1799,16 @@ scan_commit_object (OtPullData *pull_data, !g_hash_table_contains (pull_data->gpg_verified_commits, checksum)) { g_autoptr(OstreeGpgVerifyResult) result = NULL; + const char *keyring_remote = NULL; + + if (ref != NULL) + keyring_remote = g_hash_table_lookup (pull_data->ref_keyring_map, ref); + if (keyring_remote == NULL) + keyring_remote = pull_data->remote_name; result = ostree_repo_verify_commit_for_remote (pull_data->repo, checksum, - pull_data->remote_name, + keyring_remote, cancellable, error); if (!process_verify_result (pull_data, checksum, result, error)) @@ -2385,7 +2402,7 @@ process_one_static_delta (OtPullData *pull_data, g_autoptr(GVariant) 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)) + ref, cancellable, error)) return FALSE; if (detached_data && !ostree_repo_write_commit_detached_metadata (pull_data->repo, @@ -3017,7 +3034,7 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self, &http_proxy, error)) goto out; - if (http_proxy != NULL) + if (http_proxy != NULL && http_proxy[0] != '\0') _ostree_fetcher_set_proxy (fetcher, http_proxy); } @@ -3504,7 +3521,15 @@ initiate_request (OtPullData *pull_data, * * append-user-agent (s): Additional string to append to the user agent * * n-network-retries (u): Number of times to retry each download on receiving * a transient network error, such as a socket timeout; default is 5, 0 - * means return errors without retrying + * means return errors without retrying. Since: 2018.6 + * * ref-keyring-map (a(sss)): Array of (collection ID, ref name, keyring + * remote name) tuples specifying which remote's keyring should be used when + * doing GPG verification of each collection-ref. This is useful to prevent a + * remote from serving malicious updates to refs which did not originate from + * it. This can be a subset or superset of the refs being pulled; any ref + * not being pulled will be ignored and any ref without a keyring remote + * will be verified with the keyring of the remote being pulled from. + * Since: 2019.2 */ gboolean ostree_repo_pull_with_options (OstreeRepo *self, @@ -3539,12 +3564,14 @@ ostree_repo_pull_with_options (OstreeRepo *self, gboolean opt_gpg_verify_summary_set = FALSE; gboolean opt_collection_refs_set = FALSE; gboolean opt_n_network_retries_set = FALSE; + gboolean opt_ref_keyring_map_set = FALSE; const char *main_collection_id = NULL; const char *url_override = NULL; gboolean inherit_transaction = FALSE; g_autoptr(GHashTable) updated_requested_refs_to_fetch = NULL; /* (element-type OstreeCollectionRef utf8) */ int i; g_autofree char **opt_localcache_repos = NULL; + g_autoptr(GVariantIter) ref_keyring_map_iter = NULL; /* If refs or collection-refs has exactly one value, this will point to that * value, otherwise NULL. Used for logging. */ @@ -3584,6 +3611,8 @@ ostree_repo_pull_with_options (OstreeRepo *self, (void) g_variant_lookup (options, "append-user-agent", "s", &pull_data->append_user_agent); opt_n_network_retries_set = g_variant_lookup (options, "n-network-retries", "u", &pull_data->n_network_retries); + opt_ref_keyring_map_set = + g_variant_lookup (options, "ref-keyring-map", "a(sss)", &ref_keyring_map_iter); if (pull_data->remote_refspec_name != NULL) pull_data->remote_name = g_strdup (pull_data->remote_refspec_name); @@ -3644,6 +3673,8 @@ ostree_repo_pull_with_options (OstreeRepo *self, (GDestroyNotify)g_free); pull_data->gpg_verified_commits = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, NULL); + pull_data->ref_keyring_map = g_hash_table_new_full (ostree_collection_ref_hash, ostree_collection_ref_equal, + (GDestroyNotify)ostree_collection_ref_free, (GDestroyNotify)g_free); pull_data->scanned_metadata = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal, (GDestroyNotify)g_variant_unref, NULL); pull_data->fetched_detached_metadata = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -4373,6 +4404,30 @@ ostree_repo_pull_with_options (OstreeRepo *self, } } + if (opt_ref_keyring_map_set) + { + const gchar *collection_id, *ref_name, *keyring_remote_name; + + while (g_variant_iter_loop (ref_keyring_map_iter, "(&s&s&s)", &collection_id, &ref_name, &keyring_remote_name)) + { + g_autoptr(OstreeCollectionRef) c_r = NULL; + + if (!ostree_validate_collection_id (collection_id, error)) + goto out; + if (!ostree_validate_rev (ref_name, error)) + goto out; + if (!ostree_validate_remote_name (keyring_remote_name, error)) + goto out; + + c_r = ostree_collection_ref_new (collection_id, ref_name); + if (!g_hash_table_contains (requested_refs_to_fetch, c_r)) + continue; + g_hash_table_insert (pull_data->ref_keyring_map, + g_steal_pointer (&c_r), + g_strdup (keyring_remote_name)); + } + } + /* Create the state directory here - it's new with the commitpartial code, * and may not exist in older repositories. */ @@ -4600,7 +4655,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_autofree char *formatted_xferred = g_format_size (bytes_transferred); g_string_append_printf (msg, "\ntransfer: secs: %u size: %s", n_seconds, formatted_xferred); - sd_journal_send ("MESSAGE=%s", msg->str, + ot_journal_send ("MESSAGE=%s", msg->str, "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_MESSAGE_FETCH_COMPLETE_ID), "OSTREE_REMOTE=%s", pull_data->remote_name, "OSTREE_GPG=%s", gpg_verify_state, @@ -4664,6 +4719,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_clear_pointer (&pull_data->summary_deltas_checksums, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->ref_original_commits, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->gpg_verified_commits, (GDestroyNotify) g_hash_table_unref); + g_clear_pointer (&pull_data->ref_keyring_map, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->requested_content, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->requested_fallback_content, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->requested_metadata, (GDestroyNotify) g_hash_table_unref); @@ -4950,7 +5006,7 @@ static void find_remotes_cb (GObject *obj, * provided. * * `n-network-retries` (`u`): Number of times to retry each download on * receiving a transient network error, such as a socket timeout; default is - * 5, 0 means return errors without retrying. + * 5, 0 means return errors without retrying. Since: 2018.6 * * @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 @@ -5795,6 +5851,17 @@ copy_option (GVariantDict *master_options, * * `update-frequency` (`u`): Frequency to call the async progress callback in * milliseconds, if any; only values higher than 0 are valid * * `append-user-agent` (`s`): Additional string to append to the user agent + * * `n-network-retries` (`u`): Number of times to retry each download on receiving + * a transient network error, such as a socket timeout; default is 5, 0 + * means return errors without retrying. Since: 2018.6 + * * `ref-keyring-map` (`a(sss)`): Array of (collection ID, ref name, keyring + * remote name) tuples specifying which remote's keyring should be used when + * doing GPG verification of each collection-ref. This is useful to prevent a + * remote from serving malicious updates to refs which did not originate from + * it. This can be a subset or superset of the refs being pulled; any ref + * not being pulled will be ignored and any ref without a keyring remote + * will be verified with the keyring of the remote being pulled from. + * Since: 2019.2 * * Since: 2018.6 */ @@ -5915,6 +5982,7 @@ ostree_repo_pull_from_remotes_async (OstreeRepo *self, copy_option (&options_dict, &local_options_dict, "update-frequency", G_VARIANT_TYPE ("u")); copy_option (&options_dict, &local_options_dict, "append-user-agent", G_VARIANT_TYPE ("s")); copy_option (&options_dict, &local_options_dict, "n-network-retries", G_VARIANT_TYPE ("u")); + copy_option (&options_dict, &local_options_dict, "ref-keyring-map", G_VARIANT_TYPE ("a(sss)")); local_options = g_variant_dict_end (&local_options_dict); diff --git a/src/libostree/ostree-repo-refs.c b/src/libostree/ostree-repo-refs.c index 1267b240..c512787a 100644 --- a/src/libostree/ostree-repo-refs.c +++ b/src/libostree/ostree-repo-refs.c @@ -479,6 +479,9 @@ ostree_repo_resolve_rev (OstreeRepo *self, * the parameter @out_rev. Differently from ostree_repo_resolve_rev(), * this will not fall back to searching through remote repos if a * local ref is specified but not found. + * + * The flag %OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY is implied so + * using it has no effect. */ gboolean ostree_repo_resolve_rev_ext (OstreeRepo *self, @@ -511,7 +514,9 @@ ostree_repo_resolve_rev_ext (OstreeRepo *self, * the given @ref cannot be found, a %G_IO_ERROR_NOT_FOUND error will be * returned. * - * There are currently no @flags which affect the behaviour of this function. + * If you want to check only local refs, not remote or mirrored ones, use the + * flag %OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY. This is analogous to using + * ostree_repo_resolve_rev_ext() but for collection-refs. * * Returns: %TRUE on success, %FALSE on failure * Since: 2018.6 @@ -525,19 +530,63 @@ ostree_repo_resolve_collection_ref (OstreeRepo *self, GCancellable *cancellable, GError **error) { + g_autofree char *ret_contents = NULL; + g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE); g_return_val_if_fail (ref != NULL, FALSE); g_return_val_if_fail (ref->collection_id != NULL && ref->ref_name != NULL, FALSE); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - g_autoptr(GHashTable) refs = NULL; /* (element-type OstreeCollectionRef utf8) */ - if (!ostree_repo_list_collection_refs (self, ref->collection_id, &refs, - OSTREE_REPO_LIST_REFS_EXT_NONE, - cancellable, error)) - return FALSE; + /* Check for the ref in the current transaction in case it hasn't been + * written to disk, to match the behavior of ostree_repo_resolve_rev() */ + if (self->in_transaction) + { + g_mutex_lock (&self->txn_lock); + if (self->txn.collection_refs) + { + const char *repo_collection_id = ostree_repo_get_collection_id (self); + /* If the collection ID doesn't match it's a remote ref */ + if (!(flags & OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY) || + repo_collection_id == NULL || + g_strcmp0 (repo_collection_id, ref->collection_id) == 0) + { + ret_contents = g_strdup (g_hash_table_lookup (self->txn.collection_refs, ref)); + } + } + g_mutex_unlock (&self->txn_lock); + } - const char *ret_contents = g_hash_table_lookup (refs, ref); + /* Check for the ref on disk in the repo */ + if (ret_contents == NULL) + { + g_autoptr(GHashTable) refs = NULL; /* (element-type OstreeCollectionRef utf8) */ + OstreeRepoListRefsExtFlags list_refs_flags; + + if (flags & OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY) + list_refs_flags = OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES | OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS; + else + list_refs_flags = OSTREE_REPO_LIST_REFS_EXT_NONE; + + if (!ostree_repo_list_collection_refs (self, ref->collection_id, &refs, + list_refs_flags, cancellable, error)) + return FALSE; + + ret_contents = g_strdup (g_hash_table_lookup (refs, ref)); + } + + /* Check for the ref in the parent repo */ + if (ret_contents == NULL && self->parent_repo != NULL) + { + if (!ostree_repo_resolve_collection_ref (self->parent_repo, + ref, + TRUE, + flags, + &ret_contents, + cancellable, + error)) + return FALSE; + } if (ret_contents == NULL && !allow_noent) { @@ -548,7 +597,7 @@ ostree_repo_resolve_collection_ref (OstreeRepo *self, } if (out_rev != NULL) - *out_rev = g_strdup (ret_contents); + *out_rev = g_steal_pointer (&ret_contents); return TRUE; } @@ -1218,7 +1267,9 @@ _ostree_repo_update_collection_refs (OstreeRepo *self, * (ostree_repo_get_collection_id()). * * If you want to exclude refs from `refs/remotes`, use - * %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags. + * %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags. Similarly use + * %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS to exclude refs from + * `refs/mirrors`. * * Returns: %TRUE on success, %FALSE otherwise * Since: 2018.6 @@ -1240,9 +1291,12 @@ ostree_repo_list_collection_refs (OstreeRepo *self, if (match_collection_id != NULL && !ostree_validate_collection_id (match_collection_id, error)) return FALSE; - const gchar *refs_dirs[] = { "refs/mirrors", "refs/remotes", NULL }; - if (flags & OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES) - refs_dirs[1] = NULL; + g_autoptr(GPtrArray) refs_dirs = g_ptr_array_new (); + if (!(flags & OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS)) + g_ptr_array_add (refs_dirs, "refs/mirrors"); + if (!(flags & OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES)) + g_ptr_array_add (refs_dirs, "refs/remotes"); + g_ptr_array_add (refs_dirs, NULL); g_autoptr(GHashTable) ret_all_refs = NULL; @@ -1272,7 +1326,7 @@ ostree_repo_list_collection_refs (OstreeRepo *self, g_string_truncate (base_path, 0); - for (const char **iter = refs_dirs; iter && *iter; iter++) + for (const char **iter = (const char **)refs_dirs->pdata; iter && *iter; iter++) { const char *refs_dir = *iter; gboolean refs_dir_exists = FALSE; diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index 57c89736..ade4e9df 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -725,16 +725,25 @@ _ostree_repo_static_delta_dump (OstreeRepo *self, GCancellable *cancellable, GError **error) { - g_autofree char *from = NULL; - g_autofree char *to = NULL; - if (!_ostree_parse_delta_name (delta_id, &from, &to, error)) - return FALSE; - - g_autofree char *superblock_path = _ostree_get_relative_static_delta_superblock_path (from, to); - glnx_autofd int superblock_fd = -1; - if (!glnx_openat_rdonly (self->repo_dir_fd, superblock_path, TRUE, &superblock_fd, error)) - return FALSE; + + if (strchr (delta_id, '/')) + { + if (!glnx_openat_rdonly (AT_FDCWD, delta_id, TRUE, &superblock_fd, error)) + return FALSE; + } + else + { + g_autofree char *from = NULL; + g_autofree char *to = NULL; + if (!_ostree_parse_delta_name (delta_id, &from, &to, error)) + return FALSE; + + g_autofree char *superblock_path = _ostree_get_relative_static_delta_superblock_path (from, to); + if (!glnx_openat_rdonly (self->repo_dir_fd, superblock_path, TRUE, &superblock_fd, error)) + return FALSE; + } + g_autoptr(GVariant) delta_superblock = NULL; if (!ot_variant_read_fd (superblock_fd, 0, (GVariantType*)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT, @@ -742,6 +751,26 @@ _ostree_repo_static_delta_dump (OstreeRepo *self, return FALSE; g_print ("Delta: %s\n", delta_id); + g_autoptr(GVariant) from_commit_v = NULL; + g_variant_get_child (delta_superblock, 2, "@ay", &from_commit_v); + g_autofree char *from_commit = NULL; + if (g_variant_n_children (from_commit_v) > 0) + { + if (!ostree_checksum_bytes_peek_validate (from_commit_v, error)) + return FALSE; + from_commit = ostree_checksum_from_bytes_v (from_commit_v); + g_print ("From: %s\n", from_commit); + } + else + { + g_print ("From \n"); + } + g_autoptr(GVariant) to_commit_v = NULL; + g_variant_get_child (delta_superblock, 3, "@ay", &to_commit_v); + if (!ostree_checksum_bytes_peek_validate (to_commit_v, error)) + return FALSE; + g_autofree char *to_commit = ostree_checksum_from_bytes_v (to_commit_v); + g_print ("To: %s\n", to_commit); gboolean swap_endian = FALSE; OstreeDeltaEndianness endianness; @@ -777,6 +806,7 @@ _ostree_repo_static_delta_dump (OstreeRepo *self, g_print ("Endianness: %s\n", endianness_description); } + guint64 ts; g_variant_get_child (delta_superblock, 1, "t", &ts); g_print ("Timestamp: %" G_GUINT64_FORMAT "\n", GUINT64_FROM_BE (ts)); @@ -821,7 +851,7 @@ _ostree_repo_static_delta_dump (OstreeRepo *self, for (guint i = 0; i < n_parts; i++) { - if (!show_one_part (self, swap_endian, from, to, meta_entries, i, + if (!show_one_part (self, swap_endian, from_commit, to_commit, meta_entries, i, &total_size, &total_usize, cancellable, error)) return FALSE; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index fc884481..9ffa103f 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -1036,6 +1036,7 @@ ostree_repo_finalize (GObject *object) g_mutex_clear (&self->txn_lock); g_free (self->collection_id); g_strfreev (self->repo_finders); + g_free (self->bootloader); g_clear_pointer (&self->remotes, g_hash_table_destroy); g_mutex_clear (&self->remotes_lock); @@ -1735,6 +1736,88 @@ ostree_repo_remote_delete (OstreeRepo *self, return impl_repo_remote_delete (self, NULL, FALSE, name, cancellable, error); } + +static gboolean +impl_repo_remote_replace (OstreeRepo *self, + GFile *sysroot, + const char *name, + const char *url, + GVariant *options, + GCancellable *cancellable, + GError **error) +{ + g_return_val_if_fail (name != NULL, FALSE); + g_return_val_if_fail (url != NULL, FALSE); + g_return_val_if_fail (options == NULL || g_variant_is_of_type (options, G_VARIANT_TYPE ("a{sv}")), FALSE); + + if (!ostree_validate_remote_name (name, error)) + return FALSE; + + g_autoptr(GError) local_error = NULL; + g_autoptr(OstreeRemote) remote = _ostree_repo_get_remote (self, name, &local_error); + if (remote == NULL) + { + if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) + { + g_propagate_error (error, g_steal_pointer (&local_error)); + return FALSE; + } + g_clear_error (&local_error); + if (!impl_repo_remote_add (self, sysroot, FALSE, name, url, options, + cancellable, error)) + return FALSE; + } + else + { + /* Replace the entire option group */ + if (!g_key_file_remove_group (remote->options, remote->group, error)) + return FALSE; + + if (g_str_has_prefix (url, "metalink=")) + g_key_file_set_string (remote->options, remote->group, "metalink", + url + strlen ("metalink=")); + else + g_key_file_set_string (remote->options, remote->group, "url", url); + + if (options != NULL) + keyfile_set_from_vardict (remote->options, remote->group, options); + + /* Write out updated settings */ + if (remote->file != NULL) + { + gsize length; + g_autofree char *data = g_key_file_to_data (remote->options, &length, + NULL); + + if (!g_file_replace_contents (remote->file, data, length, + NULL, FALSE, 0, NULL, + cancellable, error)) + return FALSE; + } + else + { + g_autoptr(GKeyFile) config = ostree_repo_copy_config (self); + + /* Remove the existing group if it exists */ + if (!g_key_file_remove_group (config, remote->group, &local_error)) + { + if (!g_error_matches (local_error, G_KEY_FILE_ERROR, + G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) + { + g_propagate_error (error, g_steal_pointer (&local_error)); + return FALSE; + } + } + + ot_keyfile_copy_group (remote->options, config, remote->group); + if (!ostree_repo_write_config (self, config, error)) + return FALSE; + } + } + + return TRUE; +} + /** * ostree_repo_remote_change: * @self: Repo @@ -1776,6 +1859,9 @@ ostree_repo_remote_change (OstreeRepo *self, case OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS: return impl_repo_remote_delete (self, sysroot, TRUE, name, cancellable, error); + case OSTREE_REPO_REMOTE_CHANGE_REPLACE: + return impl_repo_remote_replace (self, sysroot, name, url, options, + cancellable, error); } g_assert_not_reached (); } @@ -3028,6 +3114,33 @@ reload_remote_config (OstreeRepo *self, return TRUE; } +static gboolean +reload_sysroot_config (OstreeRepo *self, + GCancellable *cancellable, + GError **error) +{ + { g_autofree char *bootloader = NULL; + + if (!ot_keyfile_get_value_with_default_group_optional (self->config, "sysroot", + "bootloader", "auto", + &bootloader, error)) + return FALSE; + + /* TODO: possibly later add support for specifying a generic bootloader + * binary "x" in /usr/lib/ostree/bootloaders/x). See: + * https://github.com/ostreedev/ostree/issues/1719 + * https://github.com/ostreedev/ostree/issues/1801 + */ + if (!(g_str_equal (bootloader, "auto") || g_str_equal (bootloader, "none"))) + return glnx_throw (error, "Invalid bootloader configuration: '%s'", bootloader); + + g_free (self->bootloader); + self->bootloader = g_steal_pointer (&bootloader); + } + + return TRUE; +} + /** * ostree_repo_reload_config: * @self: repo @@ -3046,6 +3159,8 @@ ostree_repo_reload_config (OstreeRepo *self, return FALSE; if (!reload_remote_config (self, cancellable, error)) return FALSE; + if (!reload_sysroot_config (self, cancellable, error)) + return FALSE; return TRUE; } @@ -5101,8 +5216,12 @@ _ostree_repo_gpg_verify_data_internal (OstreeRepo *self, g_auto(GStrv) gpgkeypath_list = NULL; - if (!ot_keyfile_get_string_as_list (remote->options, remote->group, "gpgkeypath", - ";,", &gpgkeypath_list, error)) + if (!ot_keyfile_get_string_list_with_separator_choice (remote->options, + remote->group, + "gpgkeypath", + ";,", + &gpgkeypath_list, + error)) return NULL; if (gpgkeypath_list) @@ -5975,3 +6094,21 @@ ostree_repo_get_default_repo_finders (OstreeRepo *self) return (const gchar * const *)self->repo_finders; } + +/** + * ostree_repo_get_bootloader: + * @self: an #OstreeRepo + * + * Get the bootloader configured. See the documentation for the + * "sysroot.bootloader" config key. + * + * Returns: bootloader configuration for the sysroot + * Since: 2019.2 + */ +const gchar * +ostree_repo_get_bootloader (OstreeRepo *self) +{ + g_return_val_if_fail (OSTREE_IS_REPO (self), NULL); + + return self->bootloader; +} diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 007cbedd..afa33155 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -115,6 +115,9 @@ gboolean ostree_repo_set_collection_id (OstreeRepo *self, _OSTREE_PUBLIC const gchar * const * ostree_repo_get_default_repo_finders (OstreeRepo *self); +_OSTREE_PUBLIC +const gchar * ostree_repo_get_bootloader (OstreeRepo *self); + _OSTREE_PUBLIC GFile * ostree_repo_get_path (OstreeRepo *self); @@ -166,12 +169,14 @@ gboolean ostree_repo_remote_delete (OstreeRepo *self, * @OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS: Like above, but do nothing if the remote exists * @OSTREE_REPO_REMOTE_CHANGE_DELETE: Delete a remote * @OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS: Delete a remote, do nothing if the remote does not exist + * @OSTREE_REPO_REMOTE_CHANGE_REPLACE: Add or replace a remote (Since: 2019.2) */ typedef enum { OSTREE_REPO_REMOTE_CHANGE_ADD, OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS, OSTREE_REPO_REMOTE_CHANGE_DELETE, - OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS + OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS, + OSTREE_REPO_REMOTE_CHANGE_REPLACE, } OstreeRepoRemoteChange; _OSTREE_PUBLIC @@ -460,9 +465,11 @@ gboolean ostree_repo_resolve_rev (OstreeRepo *self, /** * OstreeRepoResolveRevExtFlags: * @OSTREE_REPO_RESOLVE_REV_EXT_NONE: No flags. + * @OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY: Exclude remote and mirrored refs. Since: 2019.2 */ typedef enum { OSTREE_REPO_RESOLVE_REV_EXT_NONE = 0, + OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY = (1 << 0), } OstreeRepoResolveRevExtFlags; _OSTREE_PUBLIC @@ -494,11 +501,13 @@ gboolean ostree_repo_list_refs (OstreeRepo *self, * @OSTREE_REPO_LIST_REFS_EXT_NONE: No flags. * @OSTREE_REPO_LIST_REFS_EXT_ALIASES: Only list aliases. Since: 2017.10 * @OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES: Exclude remote refs. Since: 2017.11 + * @OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS: Exclude mirrored refs. Since: 2019.2 */ typedef enum { OSTREE_REPO_LIST_REFS_EXT_NONE = 0, OSTREE_REPO_LIST_REFS_EXT_ALIASES = (1 << 0), OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES = (1 << 1), + OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS = (1 << 2), } OstreeRepoListRefsExtFlags; _OSTREE_PUBLIC diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index b16f65b3..3ca6c148 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -447,14 +447,12 @@ merge_configuration_from (OstreeSysroot *sysroot, { g_autofree char *msg = g_strdup_printf ("Copying /etc changes: %u modified, %u removed, %u added", modified->len, removed->len, added->len); -#ifdef HAVE_LIBSYSTEMD - sd_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_CONFIGMERGE_ID), + ot_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_CONFIGMERGE_ID), "MESSAGE=%s", msg, "ETC_N_MODIFIED=%u", modified->len, "ETC_N_REMOVED=%u", removed->len, "ETC_N_ADDED=%u", added->len, NULL); -#endif _ostree_sysroot_emit_journal_msg (sysroot, msg); } @@ -701,11 +699,9 @@ selinux_relabel_var_if_needed (OstreeSysroot *sysroot, { { g_autofree char *msg = g_strdup_printf ("Relabeling /var (no stamp file '%s' found)", selabeled); -#ifdef HAVE_LIBSYSTEMD - sd_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_VARRELABEL_ID), + ot_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_VARRELABEL_ID), "MESSAGE=%s", msg, NULL); -#endif _ostree_sysroot_emit_journal_msg (sysroot, msg); } @@ -1739,7 +1735,7 @@ install_deployment_kernel (OstreeSysroot *sysroot, * (specifically, it looks for the substring "(ostree"), so further * changes to the title format may require updating that backend. */ g_autoptr(GString) title_key = g_string_new (val); - if (deployment_version && *deployment_version) + if (deployment_version && *deployment_version && !strstr (val, deployment_version)) { g_string_append_c (title_key, ' '); g_string_append (title_key, deployment_version); @@ -2122,7 +2118,8 @@ write_deployments_bootswap (OstreeSysroot *self, if (bootloader) { if (!_ostree_bootloader_write_config (bootloader, new_bootversion, - cancellable, error)) + new_deployments, cancellable, + error)) return glnx_prefix_error (error, "Bootloader write config"); } @@ -2310,6 +2307,7 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self, gboolean bootloader_is_atomic = FALSE; SyncStats syncstats = { 0, }; g_autoptr(OstreeBootloader) bootloader = NULL; + const char *bootloader_config = NULL; if (!requires_new_bootversion) { if (!create_new_bootlinks (self, self->bootversion, @@ -2342,8 +2340,22 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self, return glnx_throw_errno_prefix (error, "Remounting /boot read-write"); } - if (!_ostree_sysroot_query_bootloader (self, &bootloader, cancellable, error)) - return FALSE; + OstreeRepo *repo = ostree_sysroot_repo (self); + + bootloader_config = ostree_repo_get_bootloader (repo); + + g_debug ("Using bootloader configuration: %s", bootloader_config); + + if (g_str_equal (bootloader_config, "auto")) + { + if (!_ostree_sysroot_query_bootloader (self, &bootloader, cancellable, error)) + return FALSE; + } + else if (g_str_equal (bootloader_config, "none")) + { + /* No bootloader specified; do not query bootloaders to run. */ + } + bootloader_is_atomic = bootloader != NULL && _ostree_bootloader_is_atomic (bootloader); /* Note equivalent of try/finally here */ @@ -2371,10 +2383,10 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self, (bootloader_is_atomic ? "Transaction complete" : "Bootloader updated"), requires_new_bootversion ? "yes" : "no", new_deployments->len - self->deployments->len); -#ifdef HAVE_LIBSYSTEMD - sd_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_DEPLOYMENT_COMPLETE_ID), + ot_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_DEPLOYMENT_COMPLETE_ID), "MESSAGE=%s", msg, "OSTREE_BOOTLOADER=%s", bootloader ? _ostree_bootloader_get_name (bootloader) : "none", + "OSTREE_BOOTLOADER_CONFIG=%s", bootloader_config, "OSTREE_BOOTLOADER_ATOMIC=%s", bootloader_is_atomic ? "yes" : "no", "OSTREE_DID_BOOTSWAP=%s", requires_new_bootversion ? "yes" : "no", "OSTREE_N_DEPLOYMENTS=%u", new_deployments->len, @@ -2382,7 +2394,6 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self, "OSTREE_SYNCFS_BOOT_MSEC=%" G_GUINT64_FORMAT, syncstats.boot_syncfs_msec, "OSTREE_SYNCFS_EXTRA_MSEC=%" G_GUINT64_FORMAT, syncstats.extra_syncfs_msec, NULL); -#endif _ostree_sysroot_emit_journal_msg (self, msg); } @@ -2870,12 +2881,25 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self, * service when a staged deployment is created. */ if (!self->staged_deployment) - return TRUE; + { + ot_journal_print (LOG_INFO, "No deployment staged for finalization"); + return TRUE; + } + + /* Check if finalization is locked. */ + if (!glnx_fstatat_allow_noent (AT_FDCWD, _OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED, + NULL, 0, error)) + return FALSE; + if (errno == 0) + { + ot_journal_print (LOG_INFO, "Not finalizing; found " + _OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED); + return TRUE; + } /* Notice we send this *after* the trivial `return TRUE` above; this msg implies we've * committed to finalizing the deployment. */ -#ifdef HAVE_LIBSYSTEMD - sd_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, + ot_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_DEPLOYMENT_FINALIZING_ID), "MESSAGE=Finalizing staged deployment", "OSTREE_OSNAME=%s", @@ -2885,7 +2909,6 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self, "OSTREE_DEPLOYSERIAL=%u", ostree_deployment_get_deployserial (self->staged_deployment), NULL); -#endif g_assert (self->staged_deployment_data); diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index 9da6d4c9..e4b2039e 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -76,6 +76,7 @@ struct OstreeSysroot { #define OSTREE_SYSROOT_LOCKFILE "ostree/lock" /* We keep some transient state in /run */ #define _OSTREE_SYSROOT_RUNSTATE_STAGED "/run/ostree/staged-deployment" +#define _OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED "/run/ostree/staged-deployment-locked" #define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_DIR "/run/ostree/deployment-state/" #define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT "unlocked-development" diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 84c12301..21ea1734 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1699,6 +1699,22 @@ clone_deployment (OstreeSysroot *sysroot, return TRUE; } +/* Do `mkdir()` followed by `chmod()` immediately afterwards to ensure `umask()` isn't + * masking permissions where we don't want it to. Thus we avoid calling `umask()`, which + * would affect the whole process. */ +static gboolean mkdir_unmasked (int dfd, + const char *path, + int mode, + GCancellable *cancellable, + GError **error) +{ + if (!glnx_shutil_mkdir_p_at (dfd, path, mode, cancellable, error)) + return FALSE; + if (fchmodat (dfd, path, mode, 0) < 0) + return glnx_throw_errno_prefix (error, "chmod(%s)", path); + return TRUE; +} + /** * ostree_sysroot_deployment_unlock: * @self: Sysroot @@ -1755,6 +1771,14 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self, if (!sepolicy) return FALSE; + /* we want our /usr overlay to have the same permission bits as the one we'll shadow */ + mode_t usr_mode; + { struct stat stbuf; + if (!glnx_fstatat (deployment_dfd, "usr", &stbuf, 0, error)) + return FALSE; + usr_mode = stbuf.st_mode; + } + const char *ovl_options = NULL; static const char hotfix_ovl_options[] = "lowerdir=usr,upperdir=.usr-ovl-upper,workdir=.usr-ovl-work"; switch (unlocked_state) @@ -1768,9 +1792,9 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self, * directly for hotfixes. The ostree-prepare-root.c helper * is also set up to detect and mount these. */ - if (!glnx_shutil_mkdir_p_at (deployment_dfd, ".usr-ovl-upper", 0755, cancellable, error)) + if (!mkdir_unmasked (deployment_dfd, ".usr-ovl-upper", usr_mode, cancellable, error)) return FALSE; - if (!glnx_shutil_mkdir_p_at (deployment_dfd, ".usr-ovl-work", 0755, cancellable, error)) + if (!mkdir_unmasked (deployment_dfd, ".usr-ovl-work", usr_mode, cancellable, error)) return FALSE; ovl_options = hotfix_ovl_options; } @@ -1788,7 +1812,7 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self, { g_auto(OstreeSepolicyFsCreatecon) con = { 0, }; if (!_ostree_sepolicy_preparefscreatecon (&con, sepolicy, - "/usr", 0755, error)) + "/usr", usr_mode, error)) return FALSE; if (g_mkdtemp_full (development_ovldir, 0755) == NULL) @@ -1796,10 +1820,10 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self, } development_ovl_upper = glnx_strjoina (development_ovldir, "/upper"); - if (!glnx_shutil_mkdir_p_at (AT_FDCWD, development_ovl_upper, 0755, cancellable, error)) + if (!mkdir_unmasked (AT_FDCWD, development_ovl_upper, usr_mode, cancellable, error)) return FALSE; development_ovl_work = glnx_strjoina (development_ovldir, "/work"); - if (!glnx_shutil_mkdir_p_at (AT_FDCWD, development_ovl_work, 0755, cancellable, error)) + if (!mkdir_unmasked (AT_FDCWD, development_ovl_work, usr_mode, cancellable, error)) return FALSE; ovl_options = glnx_strjoina ("lowerdir=usr,upperdir=", development_ovl_upper, ",workdir=", development_ovl_work); diff --git a/src/libostree/ostree-version.h b/src/libostree/ostree-version.h index 76c2593b..852a3245 100644 --- a/src/libostree/ostree-version.h +++ b/src/libostree/ostree-version.h @@ -43,7 +43,7 @@ * * Since: 2017.4 */ -#define OSTREE_RELEASE_VERSION (1) +#define OSTREE_RELEASE_VERSION (2) /** * OSTREE_VERSION @@ -52,7 +52,7 @@ * * Since: 2017.4 */ -#define OSTREE_VERSION (2019.1) +#define OSTREE_VERSION (2019.2) /** * OSTREE_VERSION_S: @@ -62,7 +62,7 @@ * * Since: 2017.4 */ -#define OSTREE_VERSION_S "2019.1" +#define OSTREE_VERSION_S "2019.2" #define OSTREE_ENCODE_VERSION(year,release) \ ((year) << 16 | (release)) diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c index a0ab75cc..9d5903ce 100644 --- a/src/libotutil/ot-keyfile-utils.c +++ b/src/libotutil/ot-keyfile-utils.c @@ -101,20 +101,55 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile, return ret; } -/* Read the value of key as a string. If the value string contains - * one of the separators and none of the others, read the - * string as a NULL-terminated array out_value. If the value string contains - * none of the separators, read the string as a single entry into a - * NULL-terminated array out_value. If the value string contains multiple of - * the separators, an error is given. +gboolean +ot_keyfile_get_value_with_default_group_optional (GKeyFile *keyfile, + const char *section, + const char *value, + const char *default_value, + char **out_value, + GError **error) +{ + gboolean ret = FALSE; + GError *local_error = NULL; + g_autofree char *ret_value = NULL; + + g_return_val_if_fail (keyfile != NULL, ret); + g_return_val_if_fail (section != NULL, ret); + g_return_val_if_fail (value != NULL, ret); + + if (!ot_keyfile_get_value_with_default (keyfile, section, value, default_value, &ret_value, &local_error)) + { + if (g_error_matches (local_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) + { + g_clear_error (&local_error); + ret_value = g_strdup (default_value); + } + else + { + g_propagate_error (error, local_error); + goto out; + } + } + + ret = TRUE; + ot_transfer_out_value(out_value, &ret_value); + out: + return ret; +} + +/* Read the value of key as a string. If the value string contains + * zero or one of the separators and none of the others, read the + * string as a NULL-terminated array out_value. If the value string + * contains multiple of the separators, give an error. + * * Returns TRUE on success, FALSE on error. */ gboolean -ot_keyfile_get_string_as_list (GKeyFile *keyfile, - const char *section, - const char *key, - const char *separators, - char ***out_value, - GError **error) +ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile, + const char *section, + const char *key, + const char *separators, + char ***out_value, + GError **error) { guint sep_count = 0; gchar sep = '\0'; diff --git a/src/libotutil/ot-keyfile-utils.h b/src/libotutil/ot-keyfile-utils.h index 2dcb899c..b16571df 100644 --- a/src/libotutil/ot-keyfile-utils.h +++ b/src/libotutil/ot-keyfile-utils.h @@ -45,12 +45,20 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile, GError **error); gboolean -ot_keyfile_get_string_as_list (GKeyFile *keyfile, - const char *section, - const char *key, - const char *separators, - char ***out_value_list, - GError **error); +ot_keyfile_get_value_with_default_group_optional (GKeyFile *keyfile, + const char *section, + const char *value, + const char *default_value, + char **out_value, + GError **error); + +gboolean +ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile, + const char *section, + const char *key, + const char *separators, + char ***out_value_list, + GError **error); gboolean ot_keyfile_get_string_list_with_default (GKeyFile *keyfile, diff --git a/src/libotutil/otutil.h b/src/libotutil/otutil.h index d648932e..eced95f9 100644 --- a/src/libotutil/otutil.h +++ b/src/libotutil/otutil.h @@ -44,6 +44,14 @@ } \ } G_STMT_END; +#ifdef HAVE_LIBSYSTEMD +#define ot_journal_send(...) sd_journal_send(__VA_ARGS__) +#define ot_journal_print(...) sd_journal_print(__VA_ARGS__) +#else +#define ot_journal_send(...) {} +#define ot_journal_print(...) {} +#endif + #include #include #include diff --git a/src/ostree/ot-builtin-config.c b/src/ostree/ot-builtin-config.c index 4368f50c..811a8381 100644 --- a/src/ostree/ot-builtin-config.c +++ b/src/ostree/ot-builtin-config.c @@ -65,27 +65,38 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio { g_autoptr(GOptionContext) context = NULL; g_autoptr(OstreeRepo) repo = NULL; - gboolean ret = FALSE; const char *op; const char *section_key; const char *value; g_autofree char *section = NULL; g_autofree char *key = NULL; - GKeyFile *config = NULL; + g_autoptr(GKeyFile) config = NULL; + int correct_argc; - context = g_option_context_new ("(get KEY|set KEY VALUE)"); + context = g_option_context_new ("(get KEY|set KEY VALUE|unset KEY)"); if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error)) - goto out; + return FALSE; if (argc < 2) { ot_util_usage_error (context, "OPERATION must be specified", error); - goto out; + return FALSE; } op = argv[1]; + if (!strcmp (op, "set")) + correct_argc = 4; + else + correct_argc = 3; + + if (argc > correct_argc) + { + ot_util_usage_error (context, "Too many arguments given", error); + return FALSE; + } + if (!strcmp (op, "set")) { if (opt_group) @@ -94,7 +105,7 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "GROUP name, KEY and VALUE must be specified"); - goto out; + return FALSE; } section = g_strdup(opt_group); key = g_strdup(argv[2]); @@ -106,19 +117,19 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "KEY and VALUE must be specified"); - goto out; + return FALSE; } section_key = argv[2]; value = argv[3]; if(!split_key_string (section_key, §ion, &key, error)) - goto out; + return FALSE; } config = ostree_repo_copy_config (repo); g_key_file_set_string (config, section, key, value); if (!ostree_repo_write_config (repo, config, error)) - goto out; + return FALSE; } else if (!strcmp (op, "get")) { @@ -130,7 +141,7 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Group name and key must be specified"); - goto out; + return FALSE; } section = g_strdup(opt_group); key = g_strdup(argv[2]); @@ -141,30 +152,67 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "KEY must be specified"); - goto out; + return FALSE; } section_key = argv[2]; if (!split_key_string (section_key, §ion, &key, error)) - goto out; + return FALSE; } readonly_config = ostree_repo_get_config (repo); value = g_key_file_get_string (readonly_config, section, key, error); if (value == NULL) - goto out; + return FALSE; g_print ("%s\n", value); } + else if (!strcmp (op, "unset")) + { + g_autoptr(GError) local_error = NULL; + if (opt_group) + { + if (argc < 3) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Group name and key must be specified"); + return FALSE; + } + section = g_strdup(opt_group); + key = g_strdup(argv[2]); + } + else + { + if (argc < 3) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "KEY must be specified"); + return FALSE; + } + section_key = argv[2]; + if (!split_key_string (section_key, §ion, &key, error)) + return FALSE; + } + + config = ostree_repo_copy_config (repo); + if (!g_key_file_remove_key (config, section, key, &local_error)) + { + if (!g_error_matches (local_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND) && + !g_error_matches (local_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) + { + g_propagate_error (error, g_steal_pointer (&local_error)); + return FALSE; + } + } + + if (local_error == NULL && !ostree_repo_write_config (repo, config, error)) + return FALSE; + } else { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Unknown operation %s", op); - goto out; + return FALSE; } - ret = TRUE; - out: - if (config) - g_key_file_free (config); - return ret; + return TRUE; } diff --git a/src/ostree/ot-remote-builtin-add.c b/src/ostree/ot-remote-builtin-add.c index 8b339dbd..f81f7580 100644 --- a/src/ostree/ot-remote-builtin-add.c +++ b/src/ostree/ot-remote-builtin-add.c @@ -30,6 +30,7 @@ static char **opt_set; static gboolean opt_no_gpg_verify; static gboolean opt_if_not_exists; +static gboolean opt_force; static char *opt_gpg_import; static char *opt_contenturl; static char *opt_collection_id; @@ -45,6 +46,7 @@ static GOptionEntry option_entries[] = { { "set", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_set, "Set config option KEY=VALUE for remote", "KEY=VALUE" }, { "no-gpg-verify", 0, 0, G_OPTION_ARG_NONE, &opt_no_gpg_verify, "Disable GPG verification", NULL }, { "if-not-exists", 0, 0, G_OPTION_ARG_NONE, &opt_if_not_exists, "Do nothing if the provided remote exists", NULL }, + { "force", 0, 0, G_OPTION_ARG_NONE, &opt_force, "Replace the provided remote if it exists", NULL }, { "gpg-import", 0, 0, G_OPTION_ARG_FILENAME, &opt_gpg_import, "Import GPG key from FILE", "FILE" }, { "contenturl", 0, 0, G_OPTION_ARG_STRING, &opt_contenturl, "Use URL when fetching content", "URL" }, { "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, @@ -84,6 +86,14 @@ ot_remote_builtin_add (int argc, char **argv, OstreeCommandInvocation *invocatio goto out; } + if (opt_if_not_exists && opt_force) + { + ot_util_usage_error (context, + "Can only specify one of --if-not-exists and --force", + error); + goto out; + } + remote_name = argv[1]; remote_url = argv[2]; @@ -135,9 +145,14 @@ ot_remote_builtin_add (int argc, char **argv, OstreeCommandInvocation *invocatio options = g_variant_ref_sink (g_variant_builder_end (optbuilder)); - if (!ostree_repo_remote_change (repo, NULL, - opt_if_not_exists ? OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS : - OSTREE_REPO_REMOTE_CHANGE_ADD, + OstreeRepoRemoteChange changeop; + if (opt_if_not_exists) + changeop = OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS; + else if (opt_force) + changeop = OSTREE_REPO_REMOTE_CHANGE_REPLACE; + else + changeop = OSTREE_REPO_REMOTE_CHANGE_ADD; + if (!ostree_repo_remote_change (repo, NULL, changeop, remote_name, remote_url, options, cancellable, error)) diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index 01a85569..15d49963 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -47,6 +47,15 @@ #include #include +#if defined(HAVE_LIBSYSTEMD) && !defined(OSTREE_PREPARE_ROOT_STATIC) +#define USE_LIBSYSTEMD +#endif + +#ifdef USE_LIBSYSTEMD +#include +#define OSTREE_PREPARE_ROOT_DEPLOYMENT_MSG SD_ID128_MAKE(71,70,33,6a,73,ba,46,01,ba,d3,1a,f8,88,aa,0d,f7) +#endif + #include "ostree-mount-util.h" /* Initialized early in main */ @@ -71,9 +80,19 @@ resolve_deploy_path (const char * root_mountpoint) deploy_path = realpath (destpath, NULL); if (deploy_path == NULL) err (EXIT_FAILURE, "realpath(%s) failed", destpath); + if (stat (deploy_path, &stbuf) < 0) + err (EXIT_FAILURE, "stat(%s) failed", deploy_path); /* Quiet logs if there's no journal */ - if (!running_as_pid1) - printf ("Resolved OSTree target to: %s\n", deploy_path); +#ifdef USE_LIBSYSTEMD + const char *resolved_path = deploy_path + strlen (root_mountpoint); + sd_journal_send ("MESSAGE=Resolved OSTree target to: %s", deploy_path, + "MESSAGE_ID=" SD_ID128_FORMAT_STR, + SD_ID128_FORMAT_VAL(OSTREE_PREPARE_ROOT_DEPLOYMENT_MSG), + "DEPLOYMENT_PATH=%s", resolved_path, + "DEPLOYMENT_DEVICE=%u", stbuf.st_dev, + "DEPLOYMENT_INODE=%u", stbuf.st_ino, + NULL); +#endif return deploy_path; } diff --git a/tests/admin-test.sh b/tests/admin-test.sh index 4f0b9e93..31e969c2 100644 --- a/tests/admin-test.sh +++ b/tests/admin-test.sh @@ -21,7 +21,7 @@ set -euo pipefail -echo "1..$((25 + ${extra_admin_tests:-0}))" +echo "1..$((26 + ${extra_admin_tests:-0}))" function validate_bootloader() { cd ${test_tmpdir}; @@ -60,7 +60,7 @@ validate_bootloader echo "ok deploy command" ${CMD_PREFIX} ostree admin --print-current-dir > curdir -assert_file_has_content curdir ^`pwd`/sysroot/ostree/deploy/testos/deploy/${rev}.0$ +assert_file_has_content curdir ^`pwd`/sysroot/ostree/deploy/testos/deploy/${rev}\.0$ echo "ok --print-current-dir" @@ -239,7 +239,7 @@ cp ${originfile} saved-origin ${CMD_PREFIX} ostree admin set-origin --index=0 bacon --set=gpg-verify=false http://tasty.com assert_file_has_content "${originfile}" "bacon:testos/buildmaster/x86_64-runtime" ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote list -u > remotes.txt -assert_file_has_content remotes.txt 'bacon.*http://tasty.com' +assert_file_has_content remotes.txt 'bacon.*http://tasty\.com' cp saved-origin ${originfile} validate_bootloader @@ -280,6 +280,16 @@ validate_bootloader echo "ok upgrade with multiple kernel args" +os_repository_new_commit +${CMD_PREFIX} ostree admin upgrade --os=testos +assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 ${version} (ostree:testos)$" +os_repository_new_commit 0 0 testos/buildmaster/x86_64-runtime 42 +${CMD_PREFIX} ostree admin upgrade --os=testos +assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 (ostree:testos)$" + +echo "ok no duplicate version strings in title" + + # Test upgrade with and without --override-commit # See https://github.com/GNOME/ostree/pull/147 ${CMD_PREFIX} ostree pull --repo=sysroot/ostree/repo --commit-metadata-only --depth=-1 testos:testos/buildmaster/x86_64-runtime diff --git a/tests/basic-test.sh b/tests/basic-test.sh index 0c80a5f5..ba88cc73 100644 --- a/tests/basic-test.sh +++ b/tests/basic-test.sh @@ -245,7 +245,7 @@ EOF $OSTREE commit ${COMMIT_ARGS} -b branch-with-commitmsg -F commitmsg.txt -s 'a message' $test_tmpdir/checkout-test2-4 $OSTREE log branch-with-commitmsg > log.txt assert_file_has_content log.txt '^ *This is a long$' -assert_file_has_content log.txt '^ *Build-Host:.*example.com$' +assert_file_has_content log.txt '^ *Build-Host:.*example\.com$' assert_file_has_content log.txt '^ *Crunchy-With.*true$' $OSTREE refs --delete branch-with-commitmsg echo "ok commit body file" diff --git a/tests/libostreetest.c b/tests/libostreetest.c index 1991ffd0..9a2fae09 100644 --- a/tests/libostreetest.c +++ b/tests/libostreetest.c @@ -22,8 +22,6 @@ #include "config.h" #include #include -#include -#include #include "libglnx.h" #include "libostreetest.h" diff --git a/tests/libtest.sh b/tests/libtest.sh index f09f4a2c..e0022512 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -355,6 +355,11 @@ setup_os_boot_grub2() { esac } +setup_os_boot_configured_bootloader() { + bootloader_keyval=$1 + ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set ${bootloader_keyval} +} + setup_os_repository () { mode=$1 shift @@ -448,6 +453,9 @@ EOF *grub2*) setup_os_boot_grub2 "${bootmode}" ;; + sysroot\.bootloader*) + setup_os_boot_configured_bootloader "${bootmode}" + ;; esac cd ${test_tmpdir} @@ -465,6 +473,7 @@ os_repository_new_commit () boot_checksum_iteration=${1:-0} content_iteration=${2:-0} branch=${3:-testos/buildmaster/x86_64-runtime} + export version=${4:-$(date "+%Y%m%d.${content_iteration}")} echo "BOOT ITERATION: $boot_checksum_iteration" cd ${test_tmpdir}/osdata kver=3.6.0 @@ -499,8 +508,6 @@ os_repository_new_commit () echo "content iteration ${content_iteration}" > usr/bin/content-iteration - export version=$(date "+%Y%m%d.${content_iteration}") - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string "version=${version}" -b $branch -s "Build" cd ${test_tmpdir} } diff --git a/tests/ostree-grub-generator b/tests/ostree-grub-generator index 10645c74..d1436b65 100644 --- a/tests/ostree-grub-generator +++ b/tests/ostree-grub-generator @@ -65,7 +65,7 @@ read_config() populate_menu() { - # Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device than ostree/repo + # Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device as /ostree/repo if [ -z ${OSTREE_BOOT_PARTITION+x} ] && [ -d /boot/ostree ] && [ -d /ostree/repo ] && [ $(stat -c '%d' /boot/ostree) -eq $(stat -c '%d' /ostree/repo) ]; then boot_prefix="/boot" else diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 0b3fa0c9..9d51b151 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -368,7 +368,7 @@ repo_init --no-gpg-verify ${CMD_PREFIX} ostree --repo=repo pull origin main@${prev_rev} ${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${delta_target} >dry-run-pull.txt # Compression can vary, so we support 400-699 -delta_dry_run_regexp='Delta update: 0/1 parts, 0 bytes/[456][0-9][0-9] bytes, 455 bytes total uncompressed' +delta_dry_run_regexp='Delta update: 0/1 parts, 0[  ]bytes/[456][0-9][0-9][  ]bytes, 455[  ]bytes total uncompressed' assert_file_has_content dry-run-pull.txt "${delta_dry_run_regexp}" rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main) assert_streq "${prev_rev}" "${rev}" diff --git a/tests/pull-test2.sh b/tests/pull-test2.sh index 2b9889c2..064bbfe6 100644 --- a/tests/pull-test2.sh +++ b/tests/pull-test2.sh @@ -55,7 +55,7 @@ ${CMD_PREFIX} ostree --repo=ostree-srv/repo static-delta generate ${remote_ref} ${CMD_PREFIX} ostree --repo=ostree-srv/repo summary -u ${CMD_PREFIX} ostree --repo=repo pull origin ${remote_ref}@${prev_rev} ${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${remote_ref} >dry-run-pull.txt -assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts, 0 bytes/[45][0-9].[0-9] kB, 1.[678] MB total uncompressed' +assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts, 0 bytes/[45][0-9]\.[0-9][  ]kB, 1\.[678][  ]MB total uncompressed' ${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin ${remote_ref} final_rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:${remote_ref}) assert_streq "${rev}" "${final_rev}" diff --git a/tests/test-admin-deploy-none.sh b/tests/test-admin-deploy-none.sh new file mode 100755 index 00000000..66a1491f --- /dev/null +++ b/tests/test-admin-deploy-none.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Copyright (C) 2019 Robert Fairley +# +# 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 +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +set -euo pipefail + +. $(dirname $0)/libtest.sh + +# Exports OSTREE_SYSROOT so --sysroot not needed. +setup_os_repository "archive" "sysroot.bootloader none" + +extra_admin_tests=1 + +. $(dirname $0)/admin-test.sh + +# Test that the bootloader configuration "none" generates BLS config snippets. +cd ${test_tmpdir} +rm httpd osdata testos-repo sysroot -rf +setup_os_repository "archive" "sysroot.bootloader none" +${CMD_PREFIX} ostree pull-local --repo=sysroot/ostree/repo --remote testos testos-repo testos/buildmaster/x86_64-runtime +# Test that configuring sysroot.bootloader="none" is a workaround for previous +# grub2 bootloader issue (see https://github.com/ostreedev/ostree/issues/1774) +mkdir -p sysroot/boot/grub2 +touch sysroot/boot/grub2/grub.cfg +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos testos/buildmaster/x86_64-runtime > out.txt +assert_file_has_content out.txt "Bootloader updated.*" +assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' +assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' +assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs' +echo "ok generate bls config on first deployment" + +# TODO: add tests to try setting with an unsupported bootloader config, +# once https://github.com/ostreedev/ostree/issues/1827 is solved. +# The tests should check that the following commands fail: +# ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader unsupported_bootloader +# ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader "" diff --git a/tests/test-admin-pull-deploy-split.sh b/tests/test-admin-pull-deploy-split.sh index 5e38d6fa..1196368d 100755 --- a/tests/test-admin-pull-deploy-split.sh +++ b/tests/test-admin-pull-deploy-split.sh @@ -46,13 +46,13 @@ ${CMD_PREFIX} ostree admin upgrade --os=testos --pull-only --os=testos > out.txt assert_not_file_has_content out.txt 'No update available' assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0 assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0 -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'TestOS 42 1.0.9' +assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'TestOS 42 1\.0\.9' assert_streq "${rev}" $(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) # Now, generate new content upstream; we shouldn't pull it os_repository_new_commit ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only --os=testos > out.txt assert_not_file_has_content out.txt 'No update available' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'TestOS 42 1.0.10' +assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'TestOS 42 1\.0\.10' assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0 assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0 ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only --os=testos > out.txt diff --git a/tests/test-config.sh b/tests/test-config.sh index b1ea3e5e..7e913d32 100755 --- a/tests/test-config.sh +++ b/tests/test-config.sh @@ -23,7 +23,7 @@ set -euo pipefail . $(dirname $0)/libtest.sh -echo '1..2' +echo '1..3' ostree_repo_init repo ${CMD_PREFIX} ostree remote add --repo=repo --set=xa.title=Flathub --set=xa.title-is-set=true flathub https://dl.flathub.org/repo/ @@ -34,13 +34,19 @@ ${CMD_PREFIX} ostree config --repo=repo get --group=core repo_version >> list.tx ${CMD_PREFIX} ostree config --repo=repo get --group='remote "flathub"' 'xa.title' >> list.txt ${CMD_PREFIX} ostree config --repo=repo get --group='remote "flathub"' 'xa.title-is-set' >> list.txt ${CMD_PREFIX} ostree config --repo=repo get --group='remote "org.mozilla.FirefoxRepo"' url >> list.txt -${CMD_PREFIX} cat list.txt +${CMD_PREFIX} cat list.txt assert_file_has_content list.txt "bare" assert_file_has_content list.txt "1" assert_file_has_content list.txt "Flathub" assert_file_has_content list.txt "true" -assert_file_has_content list.txt "http://example.com/ostree/repo/" +assert_file_has_content list.txt "http://example\.com/ostree/repo/" + +# Check that it errors out if too many arguments are given +if ${CMD_PREFIX} ostree config --repo=repo get --group=core lock-timeout-secs extra 2>err.txt; then + assert_not_reached "ostree config get should error out if too many arguments are given" +fi +assert_file_has_content err.txt "error: Too many arguments given" echo "ok config get" ${CMD_PREFIX} ostree config --repo=repo set core.mode bare-user-only @@ -51,5 +57,43 @@ ${CMD_PREFIX} ostree config --repo=repo set --group='remote "org.mozilla.Firefox assert_file_has_content repo/config "bare-user-only" assert_file_has_content repo/config "Nightly Flathub" assert_file_has_content repo/config "false" -assert_file_has_content repo/config "http://example.com/ostree/" +assert_file_has_content repo/config "http://example\.com/ostree/" + +# Check that it errors out if too many arguments are given +if ${CMD_PREFIX} ostree config --repo=repo set --group=core lock-timeout-secs 120 extra 2>err.txt; then + assert_not_reached "ostree config set should error out if too many arguments are given" +fi +assert_file_has_content err.txt "error: Too many arguments given" echo "ok config set" + +# Check that "ostree config unset" works +${CMD_PREFIX} ostree config --repo=repo set core.lock-timeout-secs 60 +assert_file_has_content repo/config "lock-timeout-secs=60" +${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs +assert_not_file_has_content repo/config "lock-timeout-secs=" + +# Check that "ostree config get" errors out on the key +if ${CMD_PREFIX} ostree config --repo=repo get core.lock-timeout-secs 2>err.txt; then + assert_not_reached "ostree config get should not work after unsetting a key" +fi +# Check for any character where quotation marks would be as they appear differently in the Fedora and Debian +# test suites (“” and '' respectively). See: https://github.com/ostreedev/ostree/pull/1839 +assert_file_has_content err.txt "error: Key file does not have key .lock-timeout-secs. in group .core." + +# Check that it's idempotent +${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs +assert_not_file_has_content repo/config "lock-timeout-secs=" + +# Check that the group doesn't need to exist +${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.title' + +# Check that the key doesn't need to exist +${CMD_PREFIX} ostree config --repo=repo set --group='remote "aoeuhtns"' 'xa.title-is-set' 'false' +${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.title' + +# Check that it errors out if too many arguments are given +if ${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs extra 2>err.txt; then + assert_not_reached "ostree config unset should error out if too many arguments are given" +fi +assert_file_has_content err.txt "error: Too many arguments given" +echo "ok config unset" diff --git a/tests/test-create-usb.sh b/tests/test-create-usb.sh index 392352fd..8040ed9c 100755 --- a/tests/test-create-usb.sh +++ b/tests/test-create-usb.sh @@ -56,9 +56,9 @@ ${CMD_PREFIX} ostree --repo=local-repo create-usb dest-mount1 org.example.Collec assert_has_dir dest-mount1/.ostree/repo ${CMD_PREFIX} ostree --repo=dest-mount1/.ostree/repo refs --collections > dest-refs -assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$" -assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$" -assert_not_file_has_content dest-refs "^(org.example.Collection1, test-3)$" +assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$" +assert_file_has_content dest-refs "^(org\.example\.Collection1, test-2)$" +assert_not_file_has_content dest-refs "^(org\.example\.Collection1, test-3)$" assert_has_file dest-mount1/.ostree/repo/summary echo "ok 1 simple usb" @@ -83,7 +83,7 @@ ${CMD_PREFIX} ostree --repo=local-repo create-usb --destination-repo some-dest d assert_has_dir "dest-mount3/some-dest" assert_symlink_has_content "dest-mount3/.ostree/repos.d/00-generated" "/some-dest$" ${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated refs --collections > dest-refs -assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$" +assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$" assert_has_file dest-mount3/.ostree/repos.d/00-generated/summary echo "ok 3 usb in non-standard location" @@ -93,13 +93,13 @@ ${CMD_PREFIX} ostree --repo=local-repo create-usb --destination-repo some-dest d assert_has_dir "dest-mount3/some-dest" assert_symlink_has_content "dest-mount3/.ostree/repos.d/00-generated" "/some-dest$" ${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated refs --collections > dest-refs -assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$" -assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$" -assert_file_has_content dest-refs "^(org.example.Collection1, test-3)$" +assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$" +assert_file_has_content dest-refs "^(org\.example\.Collection1, test-2)$" +assert_file_has_content dest-refs "^(org\.example\.Collection1, test-3)$" ${CMD_PREFIX} ostree --repo=dest-mount3/.ostree/repos.d/00-generated summary -v > dest-summary -assert_file_has_content dest-summary "(org.example.Collection1, test-1)$" -assert_file_has_content dest-summary "(org.example.Collection1, test-2)$" -assert_file_has_content dest-summary "(org.example.Collection1, test-3)$" +assert_file_has_content dest-summary "(org\.example\.Collection1, test-1)$" +assert_file_has_content dest-summary "(org\.example\.Collection1, test-2)$" +assert_file_has_content dest-summary "(org\.example\.Collection1, test-3)$" echo "ok 4 adding ref to an existing usb" @@ -109,7 +109,7 @@ ostree_repo_init finder-repo ${CMD_PREFIX} ostree --repo=finder-repo remote add remote1 file://$(pwd)/just-needed-for-the-keyring --collection-id org.example.Collection1 --gpg-import="${test_tmpdir}/gpghome/key1.asc" ${test_builddir}/repo-finder-mount finder-repo dest-mount1 org.example.Collection1 test-1 org.example.Collection1 test-2 &> out -assert_file_has_content out "^0 .*_2Fdest-mount1_2F.ostree_2Frepo_remote1.trustedkeys.gpg org.example.Collection1 test-1 $(ostree --repo=repo show test-1)$" -assert_file_has_content out "^0 .*_2Fdest-mount1_2F.ostree_2Frepo_remote1.trustedkeys.gpg org.example.Collection1 test-2 $(ostree --repo=repo show test-2)$" +assert_file_has_content out "^0 .*_2Fdest-mount1_2F\.ostree_2Frepo_remote1\.trustedkeys\.gpg org\.example\.Collection1 test-1 $(ostree --repo=repo show test-1)$" +assert_file_has_content out "^0 .*_2Fdest-mount1_2F\.ostree_2Frepo_remote1\.trustedkeys\.gpg org\.example\.Collection1 test-2 $(ostree --repo=repo show test-2)$" echo "ok 5 find from usb repo" diff --git a/tests/test-delta.sh b/tests/test-delta.sh index 39e066ea..557447bc 100755 --- a/tests/test-delta.sh +++ b/tests/test-delta.sh @@ -135,6 +135,8 @@ rm temp-repo -rf echo 'ok generate' ${CMD_PREFIX} ostree --repo=repo static-delta show ${origrev}-${newrev} > show.txt +assert_file_has_content show.txt "From: ${origrev}" +assert_file_has_content show.txt "To: ${newrev}" assert_file_has_content show.txt 'Endianness: \(little\|big\)' echo 'ok show' diff --git a/tests/test-find-remotes.sh b/tests/test-find-remotes.sh index b9ddc604..226053ce 100755 --- a/tests/test-find-remotes.sh +++ b/tests/test-find-remotes.sh @@ -60,8 +60,8 @@ assert_file_has_content refs "^os-remote:os/amd64/master$" ${CMD_PREFIX} ostree --repo=local refs --collections > refs cat refs | wc -l > refscount -assert_file_has_content refs "^(org.example.AppsCollection, app1)$" -assert_file_has_content refs "^(org.example.OsCollection, os/amd64/master)$" +assert_file_has_content refs "^(org\.example\.AppsCollection, app1)$" +assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$" assert_file_has_content refscount "^2$" # Create a local mirror repository where we pull the branches *in mirror mode* from the two remotes. @@ -80,8 +80,8 @@ ls -1 local-mirror/refs/remotes | wc -l > remotescount assert_file_has_content remotescount "^0$" ${CMD_PREFIX} ostree --repo=local-mirror refs --collections > refs -assert_file_has_content refs "^(org.example.AppsCollection, app1)$" -assert_file_has_content refs "^(org.example.OsCollection, os/amd64/master)$" +assert_file_has_content refs "^(org\.example\.AppsCollection, app1)$" +assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$" assert_file_has_content local-mirror/refs/mirrors/org.example.AppsCollection/app1 "^$(cat app1-checksum)$" assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/amd64/master "^$(cat os-checksum)$" @@ -90,69 +90,69 @@ for repo in local local-mirror; do # Try finding an update for an existing branch. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$" - assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$" - assert_file_has_content find "^1/1 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$" + assert_file_has_content find "^1/1 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Find several updates for several existing branches. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$" - assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$" + assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$" assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" - assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum)$" - assert_file_has_content find "^2/2 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum)$" + assert_file_has_content find "^2/2 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Find some updates and a new branch. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$" - assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$" - assert_file_has_content find "^ - (org.example.AppsCollection, app2) = $(cat app2-checksum)$" + assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, app2) = $(cat app2-checksum)$" assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" - assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum)$" - assert_file_has_content find "^3/3 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum)$" + assert_file_has_content find "^3/3 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Find an update and a non-existent branch. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection not-an-app > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$" - assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.AppsCollection, not-an-app) = (not found)$" - assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$" + assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, not-an-app) = (not found)$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$" assert_file_has_content find "^Refs not found in any remote:$" - assert_file_has_content find "^ - (org.example.AppsCollection, not-an-app)$" - assert_file_has_content find "^1/2 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - (org\.example\.AppsCollection, not-an-app)$" + assert_file_has_content find "^1/2 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Do all the above, but pull this time. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 > pull || true - assert_file_has_content pull "^1/1 refs were found.$" - assert_file_has_content pull "^Pulled 1/1 refs successfully.$" + assert_file_has_content pull "^1/1 refs were found\.$" + assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > pull - assert_file_has_content pull "^2/2 refs were found.$" - assert_file_has_content pull "^Pulled 2/2 refs successfully.$" + assert_file_has_content pull "^2/2 refs were found\.$" + assert_file_has_content pull "^Pulled 2/2 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) assert_ref $repo os/amd64/master $(cat os-checksum) ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > pull - assert_file_has_content pull "^3/3 refs were found.$" - assert_file_has_content pull "^Pulled 3/3 refs successfully.$" + assert_file_has_content pull "^3/3 refs were found\.$" + assert_file_has_content pull "^Pulled 3/3 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) assert_ref $repo app2 $(cat app2-checksum) assert_ref $repo os/amd64/master $(cat os-checksum) ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection not-an-app > pull - assert_file_has_content pull "^1/2 refs were found.$" + assert_file_has_content pull "^1/2 refs were found\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) assert_not_ref $repo not-an-app @@ -168,15 +168,15 @@ for repo in local-mirror; do # Try finding an update for that branch. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" - assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" - assert_file_has_content find "^1/1 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" + assert_file_has_content find "^1/1 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Pull it. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true - assert_file_has_content pull "^1/1 refs were found.$" - assert_file_has_content pull "^Pulled 1/1 refs successfully.$" + assert_file_has_content pull "^1/1 refs were found\.$" + assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo os/amd64/master $(cat os-checksum-2) @@ -195,18 +195,18 @@ for repo in local; do # Try finding an update for that branch. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" - assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" + assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/local-mirror$" - assert_file_has_content find "^ - Keyring: os-remote-local-mirror.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" - assert_file_has_content find "^1/1 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - Keyring: os-remote-local-mirror\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" + assert_file_has_content find "^1/1 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Pull it. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true - assert_file_has_content pull "^1/1 refs were found.$" - assert_file_has_content pull "^Pulled 1/1 refs successfully.$" + assert_file_has_content pull "^1/1 refs were found\.$" + assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo os/amd64/master $(cat os-checksum-2) done @@ -222,15 +222,15 @@ for repo in local; do # Try finding an update for that branch. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" - assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$" - assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-3)$" - assert_file_has_content find "^1/1 refs were found.$" - assert_not_file_has_content find "^No results.$" + assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-3)$" + assert_file_has_content find "^1/1 refs were found\.$" + assert_not_file_has_content find "^No results\.$" # Pull it. ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true - assert_file_has_content pull "^1/1 refs were found.$" - assert_file_has_content pull "^Pulled 1/1 refs successfully.$" + assert_file_has_content pull "^1/1 refs were found\.$" + assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo os/amd64/master $(cat os-checksum-3) done diff --git a/tests/test-fsck-collections.sh b/tests/test-fsck-collections.sh index 79d5d8c9..dc6bcfeb 100755 --- a/tests/test-fsck-collections.sh +++ b/tests/test-fsck-collections.sh @@ -61,7 +61,7 @@ set_up_repo_with_collection_id # fsck at this point should succeed ${CMD_PREFIX} ostree fsck --repo=repo > fsck -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" # Drop the commit the ref points to, and drop the original ref so that fsck doesn’t prematurely fail on that. find repo/objects -name '*.commit' -delete -print | wc -l > commitcount @@ -73,8 +73,8 @@ rm repo/refs/heads/ref1 if ${CMD_PREFIX} ostree fsck --repo=repo > fsck; then assert_not_reached "fsck unexpectedly succeeded after deleting commit!" fi -assert_file_has_content fsck "^Validating refs...$" -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" echo "ok 1 fsck-collections" @@ -84,8 +84,8 @@ set_up_repo_with_collection_id rm -rf repo/refs/mirrors ${CMD_PREFIX} ostree fsck --repo=repo > fsck -assert_file_has_content fsck "^Validating refs...$" -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" echo "ok 2 fsck-collections in old repository" @@ -101,7 +101,7 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" fi assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)" -assert_file_has_content fsck "^Validating refs...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" echo "ok 3 fsck detects missing ref bindings" @@ -114,8 +114,8 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" fi assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)" -assert_file_has_content fsck "^Validating refs...$" -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" echo "ok 4 fsck detects missing collection–ref bindings" @@ -127,9 +127,9 @@ ${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collect if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" fi -assert_file_has_content fsck-error "Commit has collection ID ‘org.example.Collection’ in collection binding metadata, while the remote it came from has collection ID ‘org.example.Collection2’" -assert_file_has_content fsck "^Validating refs...$" -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck-error "Commit has collection ID ‘org\.example\.Collection’ in collection binding metadata, while the remote it came from has collection ID ‘org\.example\.Collection2’" +assert_file_has_content fsck "^Validating refs\.\.\.$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" echo "ok 5 fsck detects missing collection–ref bindings" @@ -139,7 +139,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --delete ref1 # fsck at this point should succeed ${CMD_PREFIX} ostree fsck --repo=repo > fsck -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" echo "ok 6 fsck ignores unreferenced ref bindings" @@ -147,9 +147,9 @@ echo "ok 6 fsck ignores unreferenced ref bindings" if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error; then assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" fi -assert_file_has_content fsck-error "Collection–ref (org.example.Collection, ref1) in bindings for commit .* does not exist" -assert_file_has_content fsck "^Validating refs...$" -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck-error "Collection–ref (org\.example\.Collection, ref1) in bindings for commit .* does not exist" +assert_file_has_content fsck "^Validating refs\.\.\.$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" echo "ok 7 fsck ignores unreferenced ref bindings" @@ -161,7 +161,7 @@ set_up_repo_without_collection_id # fsck at this point should succeed ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck -assert_file_has_content fsck "^Validating refs in collections...$" +assert_file_has_content fsck "^Validating refs in collections\.\.\.$" # Drop the commit the ref points to, and drop the original ref so that fsck doesn’t prematurely fail on that. find repo/objects -name '*.commit' -delete -print | wc -l > commitcount @@ -173,7 +173,7 @@ rm repo/refs/heads/ref3 if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck; then assert_not_reached "fsck unexpectedly succeeded after deleting commit!" fi -assert_file_has_content fsck "^Validating refs...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" echo "ok 8 fsck-collections" @@ -187,7 +187,7 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" fi assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref3’, ‘ref4’)" -assert_file_has_content fsck "^Validating refs...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" echo "ok 9 fsck detects missing ref bindings" @@ -197,7 +197,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --delete ref3 # fsck at this point should succeed ${CMD_PREFIX} ostree fsck --repo=repo > fsck -assert_file_has_content fsck "^Validating refs...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" echo "ok 10 fsck ignores unreferenced ref bindings" @@ -206,6 +206,6 @@ if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" fi assert_file_has_content fsck-error "Ref ‘ref3’ in bindings for commit .* does not exist" -assert_file_has_content fsck "^Validating refs...$" +assert_file_has_content fsck "^Validating refs\.\.\.$" echo "ok 11 fsck ignores unreferenced ref bindings" diff --git a/tests/test-init-collections.sh b/tests/test-init-collections.sh index 5c3dd4e2..1954f1ae 100755 --- a/tests/test-init-collections.sh +++ b/tests/test-init-collections.sh @@ -30,6 +30,6 @@ cd ${test_tmpdir} # Check that initialising a repository with a collection ID results in the ID being in the config. mkdir repo ostree_repo_init repo --collection-id org.example.Collection -assert_file_has_content repo/config "^collection-id=org.example.Collection$" +assert_file_has_content repo/config "^collection-id=org\.example\.Collection$" echo "ok init-collections" diff --git a/tests/test-keyfile-utils.c b/tests/test-keyfile-utils.c index 8acd0a1c..258e7dd8 100644 --- a/tests/test-keyfile-utils.c +++ b/tests/test-keyfile-utils.c @@ -79,7 +79,6 @@ test_get_value_with_default (void) /* Avoid that g_return_val_if_fail causes the test to fail. */ always_fatal_mask = g_log_set_always_fatal (0); - g_assert_false (ot_keyfile_get_value_with_default (g_keyfile, NULL, "value_foo", @@ -124,11 +123,75 @@ test_get_value_with_default (void) g_clear_pointer (&out, g_free); g_assert_false (ot_keyfile_get_value_with_default (g_keyfile, - "a_fake_section", - "a_value_true", - "no value", - &out, - &error)); + "a_fake_section", + "a_value_true", + "no value", + &out, + &error)); + g_clear_error (&error); + g_clear_pointer (&out, g_free); +} + +static void +test_get_value_with_default_group_optional (void) +{ + g_autoptr(GError) error = NULL; + g_autofree char *out = NULL; + GLogLevelFlags always_fatal_mask; + const char *section = "section"; + +/* Avoid that g_return_val_if_fail causes the test to fail. */ + always_fatal_mask = g_log_set_always_fatal (0); + + g_assert_false (ot_keyfile_get_value_with_default_group_optional (g_keyfile, + NULL, + "value_foo", + "none", + &out, + &error)); + g_clear_pointer (&out, g_free); + g_assert_false (ot_keyfile_get_value_with_default_group_optional (g_keyfile, + section, + NULL, + "none", + &out, + &error)); + g_clear_pointer (&out, g_free); + g_assert_false (ot_keyfile_get_value_with_default_group_optional (g_keyfile, + section, + NULL, + "something", + &out, + &error)); + g_clear_pointer (&out, g_free); + + /* Restore the old mask. */ + g_log_set_always_fatal (always_fatal_mask); + + g_assert (ot_keyfile_get_value_with_default_group_optional (g_keyfile, + section, + "value_foo", + "none", + &out, + &error)); + g_assert_cmpstr (out, ==, "foo"); + g_clear_pointer (&out, g_free); + + g_assert (ot_keyfile_get_value_with_default_group_optional (g_keyfile, + section, + "a_not_existing_value", + "correct", + &out, + &error)); + g_assert_cmpstr (out, ==, "correct"); + g_clear_pointer (&out, g_free); + + g_assert (ot_keyfile_get_value_with_default_group_optional (g_keyfile, + "an_optional_section", + "a_value_true", + "no value", + &out, + &error)); g_clear_error (&error); g_clear_pointer (&out, g_free); } @@ -191,6 +254,7 @@ int main (int argc, char **argv) g_test_add_func ("/keyfile-utils/get-boolean-with-default", test_get_boolean_with_default); g_test_add_func ("/keyfile-utils/get-value-with-default", test_get_value_with_default); + g_test_add_func ("/keyfile-utils/get-value-with-default-group-optional", test_get_value_with_default_group_optional); g_test_add_func ("/keyfile-utils/copy-group", test_copy_group); ret = g_test_run(); diff --git a/tests/test-no-initramfs.sh b/tests/test-no-initramfs.sh index 60e1f9a7..22846c8f 100755 --- a/tests/test-no-initramfs.sh +++ b/tests/test-no-initramfs.sh @@ -83,7 +83,7 @@ do ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init=' - assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf 'devicetree')" "my .dtb file" + assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf 'devicetree')" "my \.dtb file" assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd' echo "ok switching from initramfs to no initramfs sysroot with devicetree layout=$layout" diff --git a/tests/test-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh index dee186b5..e2864beb 100755 --- a/tests/test-pull-summary-sigs.sh +++ b/tests/test-pull-summary-sigs.sh @@ -146,7 +146,7 @@ assert_file_has_content summary.txt "* main" assert_file_has_content summary.txt "* other" assert_file_has_content summary.txt "* yet-another" assert_file_has_content summary.txt "found 1 signature" -assert_file_has_content summary.txt "Good signature from \"Ostree Tester \"" +assert_file_has_content summary.txt "Good signature from \"Ostree Tester \"" grep static-deltas summary.txt > static-deltas.txt assert_file_has_content static-deltas.txt \ $(${OSTREE} --repo=repo rev-parse origin:main) diff --git a/tests/test-refs-collections.sh b/tests/test-refs-collections.sh index 9a123dd9..bf233970 100755 --- a/tests/test-refs-collections.sh +++ b/tests/test-refs-collections.sh @@ -46,11 +46,11 @@ assert_file_has_content refscount "^5$" ${CMD_PREFIX} ostree --repo=repo refs > refs assert_file_has_content refs "^test\-1$" assert_file_has_content refs "^test\-5$" -assert_not_file_has_content refs "org.example.Collection" +assert_not_file_has_content refs "org\.example\.Collection" ${CMD_PREFIX} ostree --repo=repo refs --collections > refs -assert_file_has_content refs "^(org.example.Collection, test-1)$" -assert_file_has_content refs "^(org.example.Collection, test-5)$" +assert_file_has_content refs "^(org\.example\.Collection, test-1)$" +assert_file_has_content refs "^(org\.example\.Collection, test-5)$" # Similarly, the collection IDs should only be listed when filtering if --collections is passed. ${CMD_PREFIX} ostree --repo=repo refs --list org.example.Collection | wc -l > refscount @@ -102,8 +102,8 @@ assert_file_has_content refs "^ctest$" assert_not_file_has_content refs "^ctest-mirror$" ${CMD_PREFIX} ostree --repo=repo refs --collections > refs -assert_file_has_content refs "^(org.example.Collection, ctest)$" -assert_file_has_content refs "^(org.example.NewCollection, ctest-mirror)$" +assert_file_has_content refs "^(org\.example\.Collection, ctest)$" +assert_file_has_content refs "^(org\.example\.NewCollection, ctest-mirror)$" # Remote refs should be listed if they have collection IDs @@ -116,13 +116,13 @@ ${CMD_PREFIX} ostree --repo=repo remote add --no-gpg-verify --collection-id org. ${CMD_PREFIX} ostree --repo=repo pull collection-repo-remote rcommit ${CMD_PREFIX} ostree --repo=repo refs --collections > refs -assert_file_has_content refs "^(org.example.RemoteCollection, rcommit)$" +assert_file_has_content refs "^(org\.example\.RemoteCollection, rcommit)$" ${CMD_PREFIX} ostree --repo=repo refs --collections org.example.RemoteCollection > refs -assert_file_has_content refs "^(org.example.RemoteCollection, rcommit)$" +assert_file_has_content refs "^(org\.example\.RemoteCollection, rcommit)$" ${CMD_PREFIX} ostree --repo=repo refs --collections org.example.NonexistentID > refs -assert_not_file_has_content refs "^(org.example.RemoteCollection, rcommit)$" +assert_not_file_has_content refs "^(org\.example\.RemoteCollection, rcommit)$" cd ${test_tmpdir} mkdir no-collection-repo @@ -147,8 +147,8 @@ ${CMD_PREFIX} ostree --repo=repo refs --collections rm -rf repo/refs/mirrors ${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.NewCollection:ctest-mirror ctest ${CMD_PREFIX} ostree --repo=repo refs --collections > refs -assert_file_has_content refs "^(org.example.Collection, ctest)$" -assert_file_has_content refs "^(org.example.NewCollection, ctest-mirror)$" +assert_file_has_content refs "^(org\.example\.Collection, ctest)$" +assert_file_has_content refs "^(org\.example\.NewCollection, ctest-mirror)$" rm -rf repo/refs/mirrors ${CMD_PREFIX} ostree refs --repo=repo --collections --delete org.example.NonexistentCollection diff --git a/tests/test-remote-add.sh b/tests/test-remote-add.sh index 9aa5c6a2..bb7eae89 100755 --- a/tests/test-remote-add.sh +++ b/tests/test-remote-add.sh @@ -23,7 +23,7 @@ set -euo pipefail . $(dirname $0)/libtest.sh -echo '1..14' +echo '1..16' setup_test_repository "bare" $OSTREE remote add origin http://example.com/ostree/gnome @@ -51,18 +51,18 @@ $OSTREE remote list > list.txt assert_file_has_content list.txt "origin" assert_file_has_content list.txt "another" assert_file_has_content list.txt "another-noexist" -assert_not_file_has_content list.txt "http://example.com/ostree/gnome" -assert_not_file_has_content list.txt "http://another.com/repo" -assert_not_file_has_content list.txt "http://another-noexist.example.com/anotherrepo" +assert_not_file_has_content list.txt "http://example\.com/ostree/gnome" +assert_not_file_has_content list.txt "http://another\.com/repo" +assert_not_file_has_content list.txt "http://another-noexist\.example\.com/anotherrepo" echo "ok remote list" $OSTREE remote list --show-urls > list.txt assert_file_has_content list.txt "origin" assert_file_has_content list.txt "another" assert_file_has_content list.txt "another-noexist" -assert_file_has_content list.txt "http://example.com/ostree/gnome" -assert_file_has_content list.txt "http://another.com/repo" -assert_file_has_content list.txt "http://another-noexist.example.com/anotherrepo" +assert_file_has_content list.txt "http://example\.com/ostree/gnome" +assert_file_has_content list.txt "http://another\.com/repo" +assert_file_has_content list.txt "http://another-noexist\.example\.com/anotherrepo" echo "ok remote list with urls" cd ${test_tmpdir} @@ -106,3 +106,15 @@ assert_not_file_has_content list.txt "origin" # Can't grep for 'another' because of 'another-noexist' assert_file_has_content list.txt "another-noexist" echo "ok remote list remaining" + +# Both --if-not-exists and --force cannot be used +if $OSTREE remote add --if-not-exists --force yetanother http://yetanother.com/repo 2>/dev/null; then + assert_not_reached "Adding remote with --if-not-exists and --force unexpectedly succeeded" +fi +echo "ok remote add fail --if-not-exists and --force" + +# Overwrite with --force +$OSTREE remote add --force another http://another.example.com/anotherrepo +$OSTREE remote list --show-urls > list.txt +assert_file_has_content list.txt "^another \+http://another\.example\.com/anotherrepo$" +echo "ok remote add --force" diff --git a/tests/test-remotes-config-dir.js b/tests/test-remotes-config-dir.js index 8cd61844..5588116b 100755 --- a/tests/test-remotes-config-dir.js +++ b/tests/test-remotes-config-dir.js @@ -34,7 +34,7 @@ function assertNotEquals(a, b) { throw new Error("assertion failed " + JSON.stringify(a) + " != " + JSON.stringify(b)); } -print('1..6') +print('1..9') let remotesDir = Gio.File.new_for_path('remotes.d'); remotesDir.make_directory(null); @@ -45,6 +45,10 @@ remoteConfig.set_value('remote "foo"', 'url', 'http://foo') let remoteConfigFile = remotesDir.get_child('foo.conf') remoteConfig.save_to_file(remoteConfigFile.get_path()) +let remoteOptions = GLib.Variant.new('a{sv}', { + 'branches': GLib.Variant.new('as', ['test']), +}); + // Use the full Repo constructor to set remotes-config-dir let repoFile = Gio.File.new_for_path('repo'); let repo = new OSTree.Repo({path: repoFile, @@ -60,7 +64,7 @@ print("ok read-remotes-config-dir"); // Adding a remote should not go in the remotes.d dir unless this is a // system repo or add-remotes-config-dir is set to true -repo.remote_add('bar', 'http://bar', null, null); +repo.remote_add('bar', 'http://bar', remoteOptions, null); remotes = repo.remote_list() assertNotEquals(remotes.indexOf('bar'), -1); assertEquals(remotesDir.get_child('bar.conf').query_exists(null), false); @@ -81,7 +85,7 @@ let repoConfig = repo.copy_config(); repoConfig.set_boolean('core', 'add-remotes-config-dir', true); repo.write_config(repoConfig); repo.reload_config(null); -repo.remote_add('baz', 'http://baz', null, null); +repo.remote_add('baz', 'http://baz', remoteOptions, null); remotes = repo.remote_list() assertNotEquals(remotes.indexOf('baz'), -1); assertEquals(remotesDir.get_child('baz.conf').query_exists(null), true); @@ -114,3 +118,49 @@ try { } print("ok config-remote-in-config-dir-fails"); + +// Replacing a non-existent remote should succeed. This should go in the +// config dir since add-remote-config-dir is set to true above +repo.remote_change(null, OSTree.RepoRemoteChange.REPLACE, + 'nonexistent', 'http://nonexistent', + null, null); +remotes = repo.remote_list(); +assertNotEquals(remotes.indexOf('nonexistent'), -1); +assertEquals(remotesDir.get_child('nonexistent.conf').query_exists(null), true); + +print("ok replace-missing-remote-succeeds"); + +// Test replacing remote options in config dir. This should remove the +// branches setting above +repo.remote_change(null, OSTree.RepoRemoteChange.REPLACE, 'baz', + 'http://baz2', null, null); +remoteConfigFile = remotesDir.get_child('baz.conf'); +remoteConfig = GLib.KeyFile.new(); +remoteConfig.load_from_file(remoteConfigFile.get_path(), + GLib.KeyFileFlags.NONE); +assertEquals(remoteConfig.get_value('remote "baz"', 'url'), 'http://baz2'); +try { + remoteConfig.get_string_list('remote "baz"', 'branches'); + throw new Error('baz remote should not have branches option'); +} catch (e) { + if (!(e.matches(GLib.KeyFileError, GLib.KeyFileError.KEY_NOT_FOUND))) + throw e; +} + +print("ok replace-remote-in-config-dir"); + +// Test replacing remote options in config file. This should remove the +// branches setting above +repo.remote_change(null, OSTree.RepoRemoteChange.REPLACE, 'bar', + 'http://bar2', null, null); +repoConfig = repo.get_config(); +assertEquals(repoConfig.get_value('remote "bar"', 'url'), 'http://bar2'); +try { + repoConfig.get_string_list('remote "bar"', 'branches'); + throw new Error('bar remote should not have branches option'); +} catch (e) { + if (!(e.matches(GLib.KeyFileError, GLib.KeyFileError.KEY_NOT_FOUND))) + throw e; +} + +print("ok replace-remote-in-config-file"); diff --git a/tests/test-repo-finder-mount-integration.sh b/tests/test-repo-finder-mount-integration.sh index 283e4b0b..243df591 100755 --- a/tests/test-repo-finder-mount-integration.sh +++ b/tests/test-repo-finder-mount-integration.sh @@ -101,9 +101,9 @@ for fs_type in ext4 vfat; do assert_has_dir "${usb_mount}"/.ostree/repo ${CMD_PREFIX} ostree --repo="${usb_mount}"/.ostree/repo refs --collections > dest-refs - assert_file_has_content dest-refs "^(org.example.Collection1, test-1)$" - assert_file_has_content dest-refs "^(org.example.Collection1, test-2)$" - assert_not_file_has_content dest-refs "^(org.example.Collection1, test-3)$" + assert_file_has_content dest-refs "^(org\.example\.Collection1, test-1)$" + assert_file_has_content dest-refs "^(org\.example\.Collection1, test-2)$" + assert_not_file_has_content dest-refs "^(org\.example\.Collection1, test-3)$" assert_has_file "${usb_mount}"/.ostree/repo/summary # Pull into a second local repository (theoretically, a separate computer). @@ -112,15 +112,15 @@ for fs_type in ext4 vfat; do ${CMD_PREFIX} ostree --repo=peer-repo_$fs_type remote add remote1 file://just-here-for-the-keyring --collection-id org.example.Collection1 --gpg-import="${test_tmpdir}/gpghome/key1.asc" ${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --finders=mount org.example.Collection1 test-1 > find-results - assert_not_file_has_content find-results "^No results.$" + assert_not_file_has_content find-results "^No results\.$" assert_file_has_content find-results "^Result 0: file://${usb_mount}" - assert_file_has_content find-results "(org.example.Collection1, test-1) = $(cat ref1-checksum)$" + assert_file_has_content find-results "(org\.example\.Collection1, test-1) = $(cat ref1-checksum)$" ${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --finders=mount --pull org.example.Collection1 test-1 > pull-results - assert_file_has_content pull-results "^Pulled 1/1 refs successfully.$" + assert_file_has_content pull-results "^Pulled 1/1 refs successfully\.$" ${CMD_PREFIX} ostree --repo=peer-repo_$fs_type refs --collections > refs - assert_file_has_content refs "^(org.example.Collection1, test-1)$" + assert_file_has_content refs "^(org\.example\.Collection1, test-1)$" ${SUDO} umount "${MOUNT_INTEGRATION_DEV}" diff --git a/tests/test-summary-collections.sh b/tests/test-summary-collections.sh index 22921f53..777d3d0c 100755 --- a/tests/test-summary-collections.sh +++ b/tests/test-summary-collections.sh @@ -43,19 +43,19 @@ done ${CMD_PREFIX} ostree --repo=repo summary --update ${CMD_PREFIX} ostree --repo=repo summary --view > summary -assert_file_has_content summary "(org.example.Collection, test-1)$" -assert_file_has_content summary "(org.example.Collection, test-2)$" -assert_file_has_content summary "(org.example.Collection, test-3)$" -assert_file_has_content summary "(org.example.Collection, test-4)$" -assert_file_has_content summary "(org.example.Collection, test-5)$" -assert_file_has_content summary "^Collection ID (ostree\.summary\.collection-id): org.example.Collection$" +assert_file_has_content summary "(org\.example\.Collection, test-1)$" +assert_file_has_content summary "(org\.example\.Collection, test-2)$" +assert_file_has_content summary "(org\.example\.Collection, test-3)$" +assert_file_has_content summary "(org\.example\.Collection, test-4)$" +assert_file_has_content summary "(org\.example\.Collection, test-5)$" +assert_file_has_content summary "^Collection ID (ostree\.summary\.collection-id): org\.example\.Collection$" # Test that mirrored branches are listed too. ${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.OtherCollection:test-1-mirror test-1 ${CMD_PREFIX} ostree --repo=repo summary --update ${CMD_PREFIX} ostree --repo=repo summary --view > summary -assert_file_has_content summary "(org.example.OtherCollection, test-1-mirror)$" +assert_file_has_content summary "(org\.example\.OtherCollection, test-1-mirror)$" # Test that remote refs are listed, but only if they have collection IDs cd ${test_tmpdir} @@ -68,7 +68,7 @@ ${CMD_PREFIX} ostree --repo=repo pull collection-repo-remote rcommit ${CMD_PREFIX} ostree --repo=repo summary --update ${CMD_PREFIX} ostree --repo=repo summary --view > summary -assert_file_has_content summary "(org.example.RemoteCollection, rcommit)$" +assert_file_has_content summary "(org\.example\.RemoteCollection, rcommit)$" cd ${test_tmpdir} mkdir no-collection-repo diff --git a/tests/test-summary-update.sh b/tests/test-summary-update.sh index faa54e38..062d5bd4 100755 --- a/tests/test-summary-update.sh +++ b/tests/test-summary-update.sh @@ -58,12 +58,7 @@ assert_file_has_content summary "^map: {}$" echo "ok 1 update summary" -# Test again, but with collections enabled in the repository (if supported). -if ! ostree --version | grep -q -e '- experimental'; then - echo "ok 2 # skip No experimental API is compiled in" - exit 0 -fi - +# Test again, but with collections enabled in the repository. cd ${test_tmpdir} rm -rf repo ostree_repo_init repo --collection-id org.example.Collection1 @@ -95,12 +90,12 @@ assert_file_has_content summary "^map: {}$" # Check the ostree-metadata ref has also been created with the same content and appropriate bindings. ${CMD_PREFIX} ostree --repo=repo refs --collections > refs -assert_file_has_content refs "^(org.example.Collection1, ostree-metadata)$" +assert_file_has_content refs "^(org\.example\.Collection1, ostree-metadata)$" ${CMD_PREFIX} ostree --repo=repo show ostree-metadata --raw > metadata assert_file_has_content metadata "'map': <@a{sv} {}>" -assert_file_has_content metadata "'ostree.ref-binding': <\['ostree-metadata'\]>" -assert_file_has_content metadata "'ostree.collection-binding': <'org.example.Collection1'>" +assert_file_has_content metadata "'ostree\.ref-binding': <\['ostree-metadata'\]>" +assert_file_has_content metadata "'ostree\.collection-binding': <'org\.example\.Collection1'>" # There should be 5 commits in the ostree-metadata branch, since we’ve updated the summary 5 times. ${CMD_PREFIX} ostree --repo=repo log ostree-metadata | grep 'commit ' | wc -l > commit-count diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh index 47f3ad73..ac058fad 100755 --- a/tests/test-symbols.sh +++ b/tests/test-symbols.sh @@ -54,7 +54,7 @@ echo 'ok documented symbols' # ONLY update this checksum in release commits! cat > released-sha256.txt < attrs -assert_file_has_content attrs '^user.ostree-test' -assert_file_has_content attrs '^user.test0' +assert_file_has_content attrs '^user\.ostree-test' +assert_file_has_content attrs '^user\.test0' getfattr -n user.ostree-test --only-values test2-checkout2/firstfile > v0 assert_file_has_content v0 '^testvalue$' getfattr -n user.test0 --only-values test2-checkout2/firstfile > v1