diff --git a/Makefile-libostree.am b/Makefile-libostree.am index 88210c75..70452f1a 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -19,7 +19,20 @@ include Makefile-libostree-defines.am -noinst_LTLIBRARIES += libostree-kernel-args.la libbupsplit.la +noinst_LTLIBRARIES += libostree-kernel-args.la + + +if ENABLE_RUST +bupsplitpath = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/libbupsplit_rs.a +BUPSPLIT_RUST_SOURCES = rust/src/bupsplit.rs +EXTRA_DIST += $(BUPSPLIT_RUST_SOURCES) +$(bupsplitpath): Makefile $(BUPSPLIT_RUST_SOURCES) + cd $(top_srcdir)/rust && CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build --verbose $(CARGO_RELEASE_ARGS) +else +bupsplitpath = libbupsplit.la +noinst_LTLIBRARIES += libbupsplit.la +libbupsplit_la_SOURCES = src/libostree/bupsplit.h src/libostree/bupsplit.c +endif # ENABLE_RUST libostree_kernel_args_la_SOURCES = \ src/libostree/ostree-kernel-args.h \ @@ -47,21 +60,16 @@ src/libostree/ostree-enumtypes.c: src/libostree/ostree-enumtypes.c.template $(EN --fhead "#include \"ostree-enumtypes.h\"" \ $(ENUM_TYPES) > $@.tmp && mv $@.tmp $@ -ENUM_GENERATED = \ +nodist_libostree_1_la_SOURCES = \ src/libostree/ostree-enumtypes.h \ src/libostree/ostree-enumtypes.c \ $(NULL) -BUILT_SOURCES += $(ENUM_GENERATED) + +BUILT_SOURCES += $(nodist_libostree_1_la_SOURCES) CLEANFILES += $(BUILT_SOURCES) -libbupsplit_la_SOURCES = \ - src/libostree/bupsplit.h \ - src/libostree/bupsplit.c \ - $(NULL) - libostree_1_la_SOURCES = \ - $(ENUM_GENERATED) \ src/libostree/ostree-async-progress.c \ src/libostree/ostree-cmdprivate.h \ src/libostree/ostree-cmdprivate.c \ @@ -142,7 +150,8 @@ libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$( $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) \ -fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern' libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions -Wl,--version-script=$(top_srcdir)/src/libostree/libostree.sym -libostree_1_la_LIBADD = libotutil.la libbupsplit.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_INTERNAL_GPGME_LIBS) $(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) +libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_INTERNAL_GPGME_LIBS) $(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) +libostree_1_la_LIBADD += $(bupsplitpath) EXTRA_libostree_1_la_DEPENDENCIES = $(top_srcdir)/src/libostree/libostree.sym EXTRA_DIST += src/libostree/libostree.sym @@ -157,18 +166,31 @@ libostree_1_la_CFLAGS += $(LIBSYSTEMD_CFLAGS) libostree_1_la_LIBADD += $(LIBSYSTEMD_LIBS) endif -if USE_LIBSOUP +if USE_CURL_OR_SOUP libostree_1_la_SOURCES += \ src/libostree/ostree-fetcher.h \ - src/libostree/ostree-fetcher.c \ src/libostree/ostree-fetcher-util.h \ src/libostree/ostree-fetcher-util.c \ + src/libostree/ostree-fetcher-uri.c \ src/libostree/ostree-metalink.h \ src/libostree/ostree-metalink.c \ $(NULL) +endif + +if USE_CURL +libostree_1_la_SOURCES += src/libostree/ostree-fetcher-curl.c \ + src/libostree/ostree-soup-uri.h src/libostree/ostree-soup-uri.c \ + src/libostree/ostree-soup-form.c \ + $(NULL) +libostree_1_la_CFLAGS += $(OT_DEP_CURL_CFLAGS) +libostree_1_la_LIBADD += $(OT_DEP_CURL_LIBS) +else +if USE_LIBSOUP +libostree_1_la_SOURCES += src/libostree/ostree-fetcher-soup.c libostree_1_la_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS) libostree_1_la_LIBADD += $(OT_INTERNAL_SOUP_LIBS) endif +endif if USE_LIBMOUNT libostree_1_la_CFLAGS += $(OT_DEP_LIBMOUNT_CFLAGS) @@ -198,7 +220,7 @@ endif pkgconfig_DATA += src/libostree/ostree-1.pc gpgreadme_DATA = src/libostree/README-gpg -gpgreadmedir = $(pkgdatadir)/trusted.gpg.d +gpgreadmedir = $(datadir)/ostree/trusted.gpg.d EXTRA_DIST += src/libostree/README-gpg src/libostree/bupsplit.h \ src/libostree/ostree-enumtypes.h.template \ src/libostree/ostree-enumtypes.c.template \ diff --git a/Makefile-ostree.am b/Makefile-ostree.am index 05fec155..0b520c68 100644 --- a/Makefile-ostree.am +++ b/Makefile-ostree.am @@ -88,12 +88,14 @@ ostree_SOURCES += \ src/ostree/ot-remote-builtin-summary.c \ $(NULL) -if USE_LIBSOUP -ostree_SOURCES += \ - src/ostree/ot-remote-builtin-add-cookie.c \ - src/ostree/ot-remote-builtin-delete-cookie.c \ - src/ostree/ot-remote-builtin-list-cookies.c \ - $(NULL) + +if USE_CURL_OR_SOUP +ostree_SOURCES += src/ostree/ot-remote-builtin-add-cookie.c \ + src/ostree/ot-remote-builtin-delete-cookie.c \ + src/ostree/ot-remote-builtin-list-cookies.c \ + src/ostree/ot-remote-cookie-util.h \ + src/ostree/ot-remote-cookie-util.c \ + $(NULL) endif src/ostree/parse-datetime.c: src/ostree/parse-datetime.y Makefile @@ -112,15 +114,23 @@ ostree_CFLAGS = $(ostree_bin_shared_cflags) ostree_LDADD = $(ostree_bin_shared_ldadd) libbsdiff.la libostree-kernel-args.la $(LIBSYSTEMD_LIBS) -if USE_LIBSOUP -ostree_SOURCES += src/ostree/ot-builtin-pull.c src/ostree/ot-builtin-trivial-httpd.c -ostree_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS) -ostree_LDADD += $(OT_INTERNAL_SOUP_LIBS) +if USE_CURL_OR_SOUP +ostree_SOURCES += src/ostree/ot-builtin-pull.c +endif +if USE_LIBSOUP +# Eventually once we stop things from using this, we should support disabling this +ostree_SOURCES += src/ostree/ot-builtin-trivial-httpd.c pkglibexec_PROGRAMS += ostree-trivial-httpd ostree_trivial_httpd_SOURCES = src/ostree/ostree-trivial-httpd.c ostree_trivial_httpd_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_SOUP_CFLAGS) ostree_trivial_httpd_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_SOUP_LIBS) + +if !USE_CURL +# This is necessary for the cookie jar bits +ostree_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS) +ostree_LDADD += $(OT_INTERNAL_SOUP_LIBS) +endif endif if USE_LIBARCHIVE diff --git a/Makefile-tests.am b/Makefile-tests.am index a0c05488..fd755ee1 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -83,6 +83,7 @@ dist_test_scripts = \ tests/test-admin-instutil-set-kargs.sh \ tests/test-admin-upgrade-not-backwards.sh \ tests/test-admin-pull-deploy-commit.sh \ + tests/test-admin-pull-deploy-split.sh \ tests/test-admin-locking.sh \ tests/test-admin-deploy-clean.sh \ tests/test-repo-checkout-subpath.sh \ @@ -200,11 +201,11 @@ TESTS_LDADD = $(common_tests_ldadd) libostreetest.la tests_test_rollsum_cli_SOURCES = src/libostree/ostree-rollsum.c tests/test-rollsum-cli.c tests_test_rollsum_cli_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) -tests_test_rollsum_cli_LDADD = libbupsplit.la $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) +tests_test_rollsum_cli_LDADD = $(bupsplitpath) $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) tests_test_rollsum_SOURCES = src/libostree/ostree-rollsum.c tests/test-rollsum.c tests_test_rollsum_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) -tests_test_rollsum_LDADD = libbupsplit.la $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) +tests_test_rollsum_LDADD = $(bupsplitpath) $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) tests_test_mutable_tree_CFLAGS = $(TESTS_CFLAGS) tests_test_mutable_tree_LDADD = $(TESTS_LDADD) diff --git a/Makefile.am b/Makefile.am index 2911a0cf..cc0e76f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,8 @@ include Makefile-decls.am shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||') +OSTREE_GITREV=$(shell if command -v git >/dev/null 2>&1 && test -d $(srcdir)/.git; then git describe --abbrev=42 --tags --always HEAD; fi) + ACLOCAL_AMFLAGS = -I buildutil -I libglnx ${ACLOCAL_FLAGS} AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \ -DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \ @@ -26,6 +28,7 @@ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \ -DOSTREE_FEATURES='"$(OSTREE_FEATURES)"' \ -DOSTREE_COMPILATION \ -DG_LOG_DOMAIN=\"OSTree\" \ + -DOSTREE_GITREV='"$(OSTREE_GITREV)"' \ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 \ -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_48 AM_CFLAGS += -std=gnu99 $(WARN_CFLAGS) @@ -60,6 +63,30 @@ GIRS = TYPELIBS = $(GIRS:.gir=.typelib) endif +# These bits based on gnome:librsvg/Makefile.am +if ENABLE_RUST +if RUST_DEBUG +CARGO_RELEASE_ARGS= +else +CARGO_RELEASE_ARGS=--release +endif + +check-local: + cd $(srcdir)/rust && CARGO_TARGET_DIR=$(abs_top_builddir)/target cargo test + +clean-local: + cd $(srcdir)/rust && CARGO_TARGET_DIR=$(abs_top_builddir)/target cargo clean + +dist-hook: + (cd $(distdir)/rust && \ + cp $(abs_top_srcdir)/rust/Cargo.lock . && \ + cargo vendor -q && \ + mkdir .cargo && \ + cp cargo-vendor-config .cargo/config) + +EXTRA_DIST += $(srcdir)/rust/Cargo.toml $(srcdir)/rust/cargo-vendor-config +endif # end ENABLE_RUST + libglnx_srcpath := $(srcdir)/libglnx libglnx_cflags := $(OT_DEP_GIO_UNIX_CFLAGS) "-I$(libglnx_srcpath)" libglnx_libs := $(OT_DEP_GIO_UNIX_LIBS) diff --git a/Makefile.in b/Makefile.in index 20cc20a6..978121ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -344,9 +344,10 @@ pkglibexec_PROGRAMS = $(am__EXEEXT_11) noinst_PROGRAMS = $(am__EXEEXT_8) tests/test-rollsum-cli$(EXEEXT) ostree_boot_PROGRAMS = $(am__EXEEXT_9) $(am__EXEEXT_10) TESTS = $(am__EXEEXT_3) $(am__EXEEXT_13) \ - $(dist_uninstalled_test_scripts) + $(dist_uninstalled_test_scripts) test-libglnx-xattrs$(EXEEXT) installed_test_PROGRAMS = $(am__EXEEXT_7) -check_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) +check_PROGRAMS = $(am__EXEEXT_5) test-libglnx-xattrs$(EXEEXT) \ + $(am__EXEEXT_6) @ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_1 = $(all_test_ltlibs) @ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_2 = $(all_test_programs) @ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_3 = $(all_test_scripts) @@ -373,76 +374,92 @@ check_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) @ENABLE_INSTALLED_TESTS_TRUE@am__append_12 = $(test_ltlibraries) $(installed_test_ltlibraries) @ENABLE_INSTALLED_TESTS_TRUE@am__append_13 = $(installed_test_meta_DATA) @ENABLE_GTK_DOC_TRUE@am__append_14 = apidoc -@USE_LIBARCHIVE_TRUE@am__append_15 = src/libostree/ostree-libarchive-input-stream.h \ +@ENABLE_RUST_TRUE@am__append_15 = $(srcdir)/rust/Cargo.toml $(srcdir)/rust/cargo-vendor-config +@ENABLE_RUST_TRUE@am__append_16 = $(BUPSPLIT_RUST_SOURCES) +@ENABLE_RUST_FALSE@am__append_17 = libbupsplit.la +@USE_LIBARCHIVE_TRUE@am__append_18 = src/libostree/ostree-libarchive-input-stream.h \ @USE_LIBARCHIVE_TRUE@ src/libostree/ostree-libarchive-input-stream.c \ @USE_LIBARCHIVE_TRUE@ src/libostree/ostree-libarchive-private.h \ @USE_LIBARCHIVE_TRUE@ $(NULL) -@HAVE_LIBSOUP_CLIENT_CERTS_TRUE@am__append_16 = \ +@HAVE_LIBSOUP_CLIENT_CERTS_TRUE@am__append_19 = \ @HAVE_LIBSOUP_CLIENT_CERTS_TRUE@ src/libostree/ostree-tls-cert-interaction.c \ @HAVE_LIBSOUP_CLIENT_CERTS_TRUE@ src/libostree/ostree-tls-cert-interaction.h \ @HAVE_LIBSOUP_CLIENT_CERTS_TRUE@ $(NULL) -@USE_LIBARCHIVE_TRUE@am__append_17 = $(OT_DEP_LIBARCHIVE_CFLAGS) -@USE_LIBARCHIVE_TRUE@am__append_18 = $(OT_DEP_LIBARCHIVE_LIBS) -@BUILDOPT_LIBSYSTEMD_TRUE@am__append_19 = $(LIBSYSTEMD_CFLAGS) -@BUILDOPT_LIBSYSTEMD_TRUE@am__append_20 = $(LIBSYSTEMD_LIBS) -@USE_LIBSOUP_TRUE@am__append_21 = \ -@USE_LIBSOUP_TRUE@ src/libostree/ostree-fetcher.h \ -@USE_LIBSOUP_TRUE@ src/libostree/ostree-fetcher.c \ -@USE_LIBSOUP_TRUE@ src/libostree/ostree-fetcher-util.h \ -@USE_LIBSOUP_TRUE@ src/libostree/ostree-fetcher-util.c \ -@USE_LIBSOUP_TRUE@ src/libostree/ostree-metalink.h \ -@USE_LIBSOUP_TRUE@ src/libostree/ostree-metalink.c \ -@USE_LIBSOUP_TRUE@ $(NULL) +@USE_LIBARCHIVE_TRUE@am__append_20 = $(OT_DEP_LIBARCHIVE_CFLAGS) +@USE_LIBARCHIVE_TRUE@am__append_21 = $(OT_DEP_LIBARCHIVE_LIBS) +@BUILDOPT_LIBSYSTEMD_TRUE@am__append_22 = $(LIBSYSTEMD_CFLAGS) +@BUILDOPT_LIBSYSTEMD_TRUE@am__append_23 = $(LIBSYSTEMD_LIBS) +@USE_CURL_OR_SOUP_TRUE@am__append_24 = \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/ostree-fetcher.h \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/ostree-fetcher-util.h \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/ostree-fetcher-util.c \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/ostree-fetcher-uri.c \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/ostree-metalink.h \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/ostree-metalink.c \ +@USE_CURL_OR_SOUP_TRUE@ $(NULL) -@USE_LIBSOUP_TRUE@am__append_22 = $(OT_INTERNAL_SOUP_CFLAGS) -@USE_LIBSOUP_TRUE@am__append_23 = $(OT_INTERNAL_SOUP_LIBS) -@USE_LIBMOUNT_TRUE@am__append_24 = $(OT_DEP_LIBMOUNT_CFLAGS) -@USE_LIBMOUNT_TRUE@am__append_25 = $(OT_DEP_LIBMOUNT_LIBS) -@USE_SELINUX_TRUE@am__append_26 = $(OT_DEP_SELINUX_CFLAGS) -@USE_SELINUX_TRUE@am__append_27 = $(OT_DEP_SELINUX_LIBS) -@BUILDOPT_INTROSPECTION_TRUE@am__append_28 = OSTree-1.0.gir -@BUILDOPT_INTROSPECTION_TRUE@am__append_29 = OSTree-1.0.gir -@BUILDOPT_INTROSPECTION_TRUE@am__append_30 = OSTree-1.0.typelib -@BUILDOPT_INTROSPECTION_TRUE@am__append_31 = $(gir_DATA) $(typelib_DATA) -@USE_LIBSOUP_TRUE@am__append_32 = \ -@USE_LIBSOUP_TRUE@ src/ostree/ot-remote-builtin-add-cookie.c \ -@USE_LIBSOUP_TRUE@ src/ostree/ot-remote-builtin-delete-cookie.c \ -@USE_LIBSOUP_TRUE@ src/ostree/ot-remote-builtin-list-cookies.c \ -@USE_LIBSOUP_TRUE@ $(NULL) src/ostree/ot-builtin-pull.c \ -@USE_LIBSOUP_TRUE@ src/ostree/ot-builtin-trivial-httpd.c -@USE_LIBSOUP_TRUE@am__append_33 = $(OT_INTERNAL_SOUP_CFLAGS) -@USE_LIBSOUP_TRUE@am__append_34 = $(OT_INTERNAL_SOUP_LIBS) -@USE_LIBSOUP_TRUE@am__append_35 = ostree-trivial-httpd -@USE_LIBARCHIVE_TRUE@am__append_36 = $(OT_DEP_LIBARCHIVE_CFLAGS) -@USE_LIBARCHIVE_TRUE@am__append_37 = $(OT_DEP_LIBARCHIVE_LIBS) -@BUILDOPT_SYSTEMD_TRUE@am__append_38 = ostree-remount +@USE_CURL_TRUE@am__append_25 = src/libostree/ostree-fetcher-curl.c \ +@USE_CURL_TRUE@ src/libostree/ostree-soup-uri.h src/libostree/ostree-soup-uri.c \ +@USE_CURL_TRUE@ src/libostree/ostree-soup-form.c \ +@USE_CURL_TRUE@ $(NULL) + +@USE_CURL_TRUE@am__append_26 = $(OT_DEP_CURL_CFLAGS) +@USE_CURL_TRUE@am__append_27 = $(OT_DEP_CURL_LIBS) +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__append_28 = src/libostree/ostree-fetcher-soup.c +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__append_29 = $(OT_INTERNAL_SOUP_CFLAGS) +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__append_30 = $(OT_INTERNAL_SOUP_LIBS) +@USE_LIBMOUNT_TRUE@am__append_31 = $(OT_DEP_LIBMOUNT_CFLAGS) +@USE_LIBMOUNT_TRUE@am__append_32 = $(OT_DEP_LIBMOUNT_LIBS) +@USE_SELINUX_TRUE@am__append_33 = $(OT_DEP_SELINUX_CFLAGS) +@USE_SELINUX_TRUE@am__append_34 = $(OT_DEP_SELINUX_LIBS) +@BUILDOPT_INTROSPECTION_TRUE@am__append_35 = OSTree-1.0.gir +@BUILDOPT_INTROSPECTION_TRUE@am__append_36 = OSTree-1.0.gir +@BUILDOPT_INTROSPECTION_TRUE@am__append_37 = OSTree-1.0.typelib +@BUILDOPT_INTROSPECTION_TRUE@am__append_38 = $(gir_DATA) $(typelib_DATA) +@USE_CURL_OR_SOUP_TRUE@am__append_39 = src/ostree/ot-remote-builtin-add-cookie.c \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ot-remote-builtin-delete-cookie.c \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ot-remote-builtin-list-cookies.c \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ot-remote-cookie-util.h \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ot-remote-cookie-util.c \ +@USE_CURL_OR_SOUP_TRUE@ $(NULL) src/ostree/ot-builtin-pull.c + +# Eventually once we stop things from using this, we should support disabling this +@USE_LIBSOUP_TRUE@am__append_40 = src/ostree/ot-builtin-trivial-httpd.c +@USE_LIBSOUP_TRUE@am__append_41 = ostree-trivial-httpd + +# This is necessary for the cookie jar bits +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__append_42 = $(OT_INTERNAL_SOUP_CFLAGS) +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__append_43 = $(OT_INTERNAL_SOUP_LIBS) +@USE_LIBARCHIVE_TRUE@am__append_44 = $(OT_DEP_LIBARCHIVE_CFLAGS) +@USE_LIBARCHIVE_TRUE@am__append_45 = $(OT_DEP_LIBARCHIVE_LIBS) +@BUILDOPT_SYSTEMD_TRUE@am__append_46 = ostree-remount # It is built anyway as a side-effect of having the symlink in tests/, # and if we declare it here, it gets cleaned up properly -@BUILDOPT_SYSTEMD_FALSE@am__append_39 = ostree-remount -@BUILDOPT_USE_STATIC_COMPILER_FALSE@am__append_40 = ostree-prepare-root -@BUILDOPT_FUSE_TRUE@am__append_41 = rofiles-fuse -@BUILDOPT_ASAN_TRUE@am__append_42 = OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc -@BUILDOPT_FUSE_TRUE@am__append_43 = tests/test-rofiles-fuse.sh -@BUILDOPT_FUSE_FALSE@am__append_44 = tests/test-rofiles-fuse.sh -@USE_LIBSOUP_TRUE@am__append_45 = tests/test-remote-cookies.sh -@BUILDOPT_GJS_TRUE@am__append_46 = $(js_tests) -@BUILDOPT_GJS_FALSE@am__append_47 = $(js_tests) -@BUILDOPT_GJS_FALSE@am__append_48 = $(js_installed_tests) -@ENABLE_INSTALLED_TESTS_FALSE@am__append_49 = -rpath $(abs_builddir) -@USE_LIBARCHIVE_TRUE@am__append_50 = tests/test-libarchive-import -@ENABLE_INSTALLED_TESTS_TRUE@am__append_51 = install-installed-tests-extra +@BUILDOPT_SYSTEMD_FALSE@am__append_47 = ostree-remount +@BUILDOPT_USE_STATIC_COMPILER_FALSE@am__append_48 = ostree-prepare-root +@BUILDOPT_FUSE_TRUE@am__append_49 = rofiles-fuse +@BUILDOPT_ASAN_TRUE@am__append_50 = OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc +@BUILDOPT_FUSE_TRUE@am__append_51 = tests/test-rofiles-fuse.sh +@BUILDOPT_FUSE_FALSE@am__append_52 = tests/test-rofiles-fuse.sh +@USE_LIBSOUP_TRUE@am__append_53 = tests/test-remote-cookies.sh +@BUILDOPT_GJS_TRUE@am__append_54 = $(js_tests) +@BUILDOPT_GJS_FALSE@am__append_55 = $(js_tests) +@BUILDOPT_GJS_FALSE@am__append_56 = $(js_installed_tests) +@ENABLE_INSTALLED_TESTS_FALSE@am__append_57 = -rpath $(abs_builddir) +@USE_LIBARCHIVE_TRUE@am__append_58 = tests/test-libarchive-import +@ENABLE_INSTALLED_TESTS_TRUE@am__append_59 = install-installed-tests-extra # Allow the distcheck install under $prefix test to pass -@BUILDOPT_SYSTEMD_TRUE@am__append_52 = --with-systemdsystemunitdir='$${libdir}/systemd/system' +@BUILDOPT_SYSTEMD_TRUE@am__append_60 = --with-systemdsystemunitdir='$${libdir}/systemd/system' # We're using the system grub2-mkconfig generator -@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_53 = src/boot/grub2/grub2-15_ostree -@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_54 = install-grub2-config-hook -@BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_55 = rofiles-fuse.1 -@ENABLE_MAN_TRUE@am__append_56 = $(man1_MANS) $(man5_MANS) $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml) -@ENABLE_MAN_TRUE@am__append_57 = \ +@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_61 = src/boot/grub2/grub2-15_ostree +@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_62 = install-grub2-config-hook +@BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_63 = rofiles-fuse.1 +@ENABLE_MAN_TRUE@am__append_64 = $(man1_MANS) $(man5_MANS) $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml) +@ENABLE_MAN_TRUE@am__append_65 = \ @ENABLE_MAN_TRUE@ $(man1_MANS) \ @ENABLE_MAN_TRUE@ $(man5_MANS) \ @ENABLE_MAN_TRUE@ $(NULL) @@ -535,8 +552,12 @@ libbsdiff_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libbsdiff_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libbupsplit_la_LIBADD = -am_libbupsplit_la_OBJECTS = src/libostree/bupsplit.lo $(am__objects_1) +am__libbupsplit_la_SOURCES_DIST = src/libostree/bupsplit.h \ + src/libostree/bupsplit.c +@ENABLE_RUST_FALSE@am_libbupsplit_la_OBJECTS = \ +@ENABLE_RUST_FALSE@ src/libostree/bupsplit.lo libbupsplit_la_OBJECTS = $(am_libbupsplit_la_OBJECTS) +@ENABLE_RUST_FALSE@am_libbupsplit_la_rpath = am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) libglnx_la_DEPENDENCIES = $(am__DEPENDENCIES_2) @@ -556,17 +577,19 @@ libglnx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @USE_LIBARCHIVE_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) @BUILDOPT_LIBSYSTEMD_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1) -@USE_LIBSOUP_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_2) -@USE_LIBMOUNT_TRUE@am__DEPENDENCIES_7 = $(am__DEPENDENCIES_1) -@USE_SELINUX_TRUE@am__DEPENDENCIES_8 = $(am__DEPENDENCIES_1) -libostree_1_la_DEPENDENCIES = libotutil.la libbupsplit.la libglnx.la \ - libbsdiff.la libostree-kernel-args.la $(am__DEPENDENCIES_2) \ +@USE_CURL_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_1) +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__DEPENDENCIES_7 = \ +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@ $(am__DEPENDENCIES_2) +@USE_LIBMOUNT_TRUE@am__DEPENDENCIES_8 = $(am__DEPENDENCIES_1) +@USE_SELINUX_TRUE@am__DEPENDENCIES_9 = $(am__DEPENDENCIES_1) +libostree_1_la_DEPENDENCIES = libotutil.la libglnx.la libbsdiff.la \ + libostree-kernel-args.la $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_1) $(bupsplitpath) $(am__DEPENDENCIES_4) \ $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_6) \ - $(am__DEPENDENCIES_7) $(am__DEPENDENCIES_8) -am__libostree_1_la_SOURCES_DIST = src/libostree/ostree-enumtypes.h \ - src/libostree/ostree-enumtypes.c \ + $(am__DEPENDENCIES_7) $(am__DEPENDENCIES_8) \ + $(am__DEPENDENCIES_9) +am__libostree_1_la_SOURCES_DIST = \ src/libostree/ostree-async-progress.c \ src/libostree/ostree-cmdprivate.h \ src/libostree/ostree-cmdprivate.c \ @@ -631,22 +654,31 @@ am__libostree_1_la_SOURCES_DIST = src/libostree/ostree-enumtypes.h \ src/libostree/ostree-libarchive-private.h \ src/libostree/ostree-tls-cert-interaction.c \ src/libostree/ostree-tls-cert-interaction.h \ - src/libostree/ostree-fetcher.h src/libostree/ostree-fetcher.c \ + src/libostree/ostree-fetcher.h \ src/libostree/ostree-fetcher-util.h \ src/libostree/ostree-fetcher-util.c \ + src/libostree/ostree-fetcher-uri.c \ src/libostree/ostree-metalink.h \ - src/libostree/ostree-metalink.c -am__objects_2 = src/libostree/libostree_1_la-ostree-enumtypes.lo \ - $(am__objects_1) -@USE_LIBARCHIVE_TRUE@am__objects_3 = src/libostree/libostree_1_la-ostree-libarchive-input-stream.lo \ + src/libostree/ostree-metalink.c \ + src/libostree/ostree-fetcher-curl.c \ + src/libostree/ostree-soup-uri.h \ + src/libostree/ostree-soup-uri.c \ + src/libostree/ostree-soup-form.c \ + src/libostree/ostree-fetcher-soup.c +@USE_LIBARCHIVE_TRUE@am__objects_2 = src/libostree/libostree_1_la-ostree-libarchive-input-stream.lo \ @USE_LIBARCHIVE_TRUE@ $(am__objects_1) -@HAVE_LIBSOUP_CLIENT_CERTS_TRUE@am__objects_4 = src/libostree/libostree_1_la-ostree-tls-cert-interaction.lo \ +@HAVE_LIBSOUP_CLIENT_CERTS_TRUE@am__objects_3 = src/libostree/libostree_1_la-ostree-tls-cert-interaction.lo \ @HAVE_LIBSOUP_CLIENT_CERTS_TRUE@ $(am__objects_1) -@USE_LIBSOUP_TRUE@am__objects_5 = src/libostree/libostree_1_la-ostree-fetcher.lo \ -@USE_LIBSOUP_TRUE@ src/libostree/libostree_1_la-ostree-fetcher-util.lo \ -@USE_LIBSOUP_TRUE@ src/libostree/libostree_1_la-ostree-metalink.lo \ -@USE_LIBSOUP_TRUE@ $(am__objects_1) -am_libostree_1_la_OBJECTS = $(am__objects_2) \ +@USE_CURL_OR_SOUP_TRUE@am__objects_4 = src/libostree/libostree_1_la-ostree-fetcher-util.lo \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/libostree_1_la-ostree-fetcher-uri.lo \ +@USE_CURL_OR_SOUP_TRUE@ src/libostree/libostree_1_la-ostree-metalink.lo \ +@USE_CURL_OR_SOUP_TRUE@ $(am__objects_1) +@USE_CURL_TRUE@am__objects_5 = src/libostree/libostree_1_la-ostree-fetcher-curl.lo \ +@USE_CURL_TRUE@ src/libostree/libostree_1_la-ostree-soup-uri.lo \ +@USE_CURL_TRUE@ src/libostree/libostree_1_la-ostree-soup-form.lo \ +@USE_CURL_TRUE@ $(am__objects_1) +@USE_CURL_FALSE@@USE_LIBSOUP_TRUE@am__objects_6 = src/libostree/libostree_1_la-ostree-fetcher-soup.lo +am_libostree_1_la_OBJECTS = \ src/libostree/libostree_1_la-ostree-async-progress.lo \ src/libostree/libostree_1_la-ostree-cmdprivate.lo \ src/libostree/libostree_1_la-ostree-core.lo \ @@ -688,9 +720,13 @@ am_libostree_1_la_OBJECTS = $(am__objects_2) \ src/libostree/libostree_1_la-ostree-repo-static-delta-compilation-analysis.lo \ src/libostree/libostree_1_la-ostree-gpg-verifier.lo \ src/libostree/libostree_1_la-ostree-gpg-verify-result.lo \ - $(am__objects_1) $(am__objects_3) $(am__objects_4) \ - $(am__objects_5) -libostree_1_la_OBJECTS = $(am_libostree_1_la_OBJECTS) + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) $(am__objects_6) +nodist_libostree_1_la_OBJECTS = \ + src/libostree/libostree_1_la-ostree-enumtypes.lo \ + $(am__objects_1) +libostree_1_la_OBJECTS = $(am_libostree_1_la_OBJECTS) \ + $(nodist_libostree_1_la_OBJECTS) libostree_1_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libostree_1_la_CFLAGS) $(CFLAGS) $(libostree_1_la_LDFLAGS) \ @@ -705,10 +741,10 @@ libostree_kernel_args_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libostree_kernel_args_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -am__DEPENDENCIES_9 = libglnx.la libotutil.la libostree-1.la \ +am__DEPENDENCIES_10 = libglnx.la libotutil.la libostree-1.la \ $(am__DEPENDENCIES_2) -am__DEPENDENCIES_10 = $(am__DEPENDENCIES_9) $(am__DEPENDENCIES_2) -libostreetest_la_DEPENDENCIES = $(am__DEPENDENCIES_10) +am__DEPENDENCIES_11 = $(am__DEPENDENCIES_10) $(am__DEPENDENCIES_2) +libostreetest_la_DEPENDENCIES = $(am__DEPENDENCIES_11) am_libostreetest_la_OBJECTS = tests/libostreetest_la-libostreetest.lo libostreetest_la_OBJECTS = $(am_libostreetest_la_OBJECTS) libostreetest_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @@ -820,14 +856,17 @@ am__ostree_SOURCES_DIST = src/ostree/main.c \ src/ostree/ot-remote-builtin-add-cookie.c \ src/ostree/ot-remote-builtin-delete-cookie.c \ src/ostree/ot-remote-builtin-list-cookies.c \ + src/ostree/ot-remote-cookie-util.h \ + src/ostree/ot-remote-cookie-util.c \ src/ostree/ot-builtin-pull.c \ src/ostree/ot-builtin-trivial-httpd.c -@USE_LIBSOUP_TRUE@am__objects_6 = src/ostree/ostree-ot-remote-builtin-add-cookie.$(OBJEXT) \ -@USE_LIBSOUP_TRUE@ src/ostree/ostree-ot-remote-builtin-delete-cookie.$(OBJEXT) \ -@USE_LIBSOUP_TRUE@ src/ostree/ostree-ot-remote-builtin-list-cookies.$(OBJEXT) \ -@USE_LIBSOUP_TRUE@ $(am__objects_1) \ -@USE_LIBSOUP_TRUE@ src/ostree/ostree-ot-builtin-pull.$(OBJEXT) \ -@USE_LIBSOUP_TRUE@ src/ostree/ostree-ot-builtin-trivial-httpd.$(OBJEXT) +@USE_CURL_OR_SOUP_TRUE@am__objects_7 = src/ostree/ostree-ot-remote-builtin-add-cookie.$(OBJEXT) \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ostree-ot-remote-builtin-delete-cookie.$(OBJEXT) \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ostree-ot-remote-builtin-list-cookies.$(OBJEXT) \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ostree-ot-remote-cookie-util.$(OBJEXT) \ +@USE_CURL_OR_SOUP_TRUE@ $(am__objects_1) \ +@USE_CURL_OR_SOUP_TRUE@ src/ostree/ostree-ot-builtin-pull.$(OBJEXT) +@USE_LIBSOUP_TRUE@am__objects_8 = src/ostree/ostree-ot-builtin-trivial-httpd.$(OBJEXT) am_ostree_OBJECTS = src/ostree/ostree-main.$(OBJEXT) \ src/ostree/ostree-ot-builtin-admin.$(OBJEXT) \ src/ostree/ostree-ot-builtin-cat.$(OBJEXT) \ @@ -879,11 +918,11 @@ am_ostree_OBJECTS = src/ostree/ostree-main.$(OBJEXT) \ src/ostree/ostree-ot-remote-builtin-show-url.$(OBJEXT) \ src/ostree/ostree-ot-remote-builtin-refs.$(OBJEXT) \ src/ostree/ostree-ot-remote-builtin-summary.$(OBJEXT) \ - $(am__objects_1) $(am__objects_6) + $(am__objects_1) $(am__objects_7) $(am__objects_8) ostree_OBJECTS = $(am_ostree_OBJECTS) -ostree_DEPENDENCIES = $(am__DEPENDENCIES_9) libbsdiff.la \ +ostree_DEPENDENCIES = $(am__DEPENDENCIES_10) libbsdiff.la \ libostree-kernel-args.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_4) + $(am__DEPENDENCIES_7) $(am__DEPENDENCIES_4) ostree_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ostree_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ @@ -909,7 +948,7 @@ am__ostree_trivial_httpd_SOURCES_DIST = \ @USE_LIBSOUP_TRUE@am_ostree_trivial_httpd_OBJECTS = src/ostree/ostree_trivial_httpd-ostree-trivial-httpd.$(OBJEXT) ostree_trivial_httpd_OBJECTS = $(am_ostree_trivial_httpd_OBJECTS) @USE_LIBSOUP_TRUE@ostree_trivial_httpd_DEPENDENCIES = \ -@USE_LIBSOUP_TRUE@ $(am__DEPENDENCIES_9) $(am__DEPENDENCIES_2) +@USE_LIBSOUP_TRUE@ $(am__DEPENDENCIES_10) $(am__DEPENDENCIES_2) ostree_trivial_httpd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(ostree_trivial_httpd_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -923,11 +962,18 @@ rofiles_fuse_OBJECTS = $(am_rofiles_fuse_OBJECTS) rofiles_fuse_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(rofiles_fuse_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_libglnx_xattrs_OBJECTS = libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.$(OBJEXT) +test_libglnx_xattrs_OBJECTS = $(am_test_libglnx_xattrs_OBJECTS) +test_libglnx_xattrs_DEPENDENCIES = $(am__DEPENDENCIES_2) libglnx.la +test_libglnx_xattrs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ tests_test_basic_c_SOURCES = tests/test-basic-c.c tests_test_basic_c_OBJECTS = \ tests/tests_test_basic_c-test-basic-c.$(OBJEXT) -am__DEPENDENCIES_11 = $(am__DEPENDENCIES_10) libostreetest.la -tests_test_basic_c_DEPENDENCIES = $(am__DEPENDENCIES_11) +am__DEPENDENCIES_12 = $(am__DEPENDENCIES_11) libostreetest.la +tests_test_basic_c_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_basic_c_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_basic_c_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -935,7 +981,7 @@ tests_test_basic_c_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_bsdiff_SOURCES = tests/test-bsdiff.c tests_test_bsdiff_OBJECTS = \ tests/tests_test_bsdiff-test-bsdiff.$(OBJEXT) -tests_test_bsdiff_DEPENDENCIES = libbsdiff.la $(am__DEPENDENCIES_11) +tests_test_bsdiff_DEPENDENCIES = libbsdiff.la $(am__DEPENDENCIES_12) tests_test_bsdiff_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_bsdiff_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ @@ -944,7 +990,7 @@ am_tests_test_checksum_OBJECTS = \ src/libostree/tests_test_checksum-ostree-core.$(OBJEXT) \ tests/tests_test_checksum-test-checksum.$(OBJEXT) tests_test_checksum_OBJECTS = $(am_tests_test_checksum_OBJECTS) -tests_test_checksum_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_checksum_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_checksum_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_checksum_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -952,7 +998,7 @@ tests_test_checksum_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ am_tests_test_gpg_verify_result_OBJECTS = tests/tests_test_gpg_verify_result-test-gpg-verify-result.$(OBJEXT) tests_test_gpg_verify_result_OBJECTS = \ $(am_tests_test_gpg_verify_result_OBJECTS) -tests_test_gpg_verify_result_DEPENDENCIES = $(am__DEPENDENCIES_11) \ +tests_test_gpg_verify_result_DEPENDENCIES = $(am__DEPENDENCIES_12) \ $(am__DEPENDENCIES_3) tests_test_gpg_verify_result_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ @@ -961,7 +1007,7 @@ tests_test_gpg_verify_result_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_keyfile_utils_SOURCES = tests/test-keyfile-utils.c tests_test_keyfile_utils_OBJECTS = \ tests/tests_test_keyfile_utils-test-keyfile-utils.$(OBJEXT) -tests_test_keyfile_utils_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_keyfile_utils_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_keyfile_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_keyfile_utils_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -969,7 +1015,7 @@ tests_test_keyfile_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ am_tests_test_libarchive_import_OBJECTS = tests/tests_test_libarchive_import-test-libarchive-import.$(OBJEXT) tests_test_libarchive_import_OBJECTS = \ $(am_tests_test_libarchive_import_OBJECTS) -tests_test_libarchive_import_DEPENDENCIES = $(am__DEPENDENCIES_11) \ +tests_test_libarchive_import_DEPENDENCIES = $(am__DEPENDENCIES_12) \ $(am__DEPENDENCIES_1) tests_test_libarchive_import_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ @@ -981,7 +1027,7 @@ am_tests_test_lzma_OBJECTS = \ src/libostree/tests_test_lzma-ostree-lzma-decompressor.$(OBJEXT) \ tests/tests_test_lzma-test-lzma.$(OBJEXT) tests_test_lzma_OBJECTS = $(am_tests_test_lzma_OBJECTS) -tests_test_lzma_DEPENDENCIES = $(am__DEPENDENCIES_11) \ +tests_test_lzma_DEPENDENCIES = $(am__DEPENDENCIES_12) \ $(am__DEPENDENCIES_1) tests_test_lzma_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ @@ -990,7 +1036,7 @@ tests_test_lzma_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_mutable_tree_SOURCES = tests/test-mutable-tree.c tests_test_mutable_tree_OBJECTS = \ tests/tests_test_mutable_tree-test-mutable-tree.$(OBJEXT) -tests_test_mutable_tree_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_mutable_tree_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_mutable_tree_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_mutable_tree_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -998,7 +1044,7 @@ tests_test_mutable_tree_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_ot_opt_utils_SOURCES = tests/test-ot-opt-utils.c tests_test_ot_opt_utils_OBJECTS = \ tests/tests_test_ot_opt_utils-test-ot-opt-utils.$(OBJEXT) -tests_test_ot_opt_utils_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_ot_opt_utils_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_ot_opt_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_ot_opt_utils_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1006,7 +1052,7 @@ tests_test_ot_opt_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_ot_tool_util_SOURCES = tests/test-ot-tool-util.c tests_test_ot_tool_util_OBJECTS = \ tests/tests_test_ot_tool_util-test-ot-tool-util.$(OBJEXT) -tests_test_ot_tool_util_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_ot_tool_util_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_ot_tool_util_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_ot_tool_util_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1014,7 +1060,7 @@ tests_test_ot_tool_util_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_ot_unix_utils_SOURCES = tests/test-ot-unix-utils.c tests_test_ot_unix_utils_OBJECTS = \ tests/tests_test_ot_unix_utils-test-ot-unix-utils.$(OBJEXT) -tests_test_ot_unix_utils_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_ot_unix_utils_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_ot_unix_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_ot_unix_utils_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1022,7 +1068,7 @@ tests_test_ot_unix_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_pull_c_SOURCES = tests/test-pull-c.c tests_test_pull_c_OBJECTS = \ tests/tests_test_pull_c-test-pull-c.$(OBJEXT) -tests_test_pull_c_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_pull_c_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_pull_c_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_pull_c_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ @@ -1031,8 +1077,8 @@ am_tests_test_rollsum_OBJECTS = \ src/libostree/tests_test_rollsum-ostree-rollsum.$(OBJEXT) \ tests/tests_test_rollsum-test-rollsum.$(OBJEXT) tests_test_rollsum_OBJECTS = $(am_tests_test_rollsum_OBJECTS) -tests_test_rollsum_DEPENDENCIES = libbupsplit.la \ - $(am__DEPENDENCIES_11) $(am__DEPENDENCIES_1) +tests_test_rollsum_DEPENDENCIES = $(bupsplitpath) \ + $(am__DEPENDENCIES_12) $(am__DEPENDENCIES_1) tests_test_rollsum_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_rollsum_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1041,8 +1087,8 @@ am_tests_test_rollsum_cli_OBJECTS = \ src/libostree/tests_test_rollsum_cli-ostree-rollsum.$(OBJEXT) \ tests/tests_test_rollsum_cli-test-rollsum-cli.$(OBJEXT) tests_test_rollsum_cli_OBJECTS = $(am_tests_test_rollsum_cli_OBJECTS) -tests_test_rollsum_cli_DEPENDENCIES = libbupsplit.la \ - $(am__DEPENDENCIES_11) $(am__DEPENDENCIES_1) +tests_test_rollsum_cli_DEPENDENCIES = $(bupsplitpath) \ + $(am__DEPENDENCIES_12) $(am__DEPENDENCIES_1) tests_test_rollsum_cli_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_rollsum_cli_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1050,7 +1096,7 @@ tests_test_rollsum_cli_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ tests_test_sysroot_c_SOURCES = tests/test-sysroot-c.c tests_test_sysroot_c_OBJECTS = \ tests/tests_test_sysroot_c-test-sysroot-c.$(OBJEXT) -tests_test_sysroot_c_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_sysroot_c_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_sysroot_c_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_sysroot_c_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -1059,7 +1105,7 @@ am_tests_test_varint_OBJECTS = \ src/libostree/tests_test_varint-ostree-varint.$(OBJEXT) \ tests/tests_test_varint-test-varint.$(OBJEXT) tests_test_varint_OBJECTS = $(am_tests_test_varint_OBJECTS) -tests_test_varint_DEPENDENCIES = $(am__DEPENDENCIES_11) +tests_test_varint_DEPENDENCIES = $(am__DEPENDENCIES_12) tests_test_varint_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_test_varint_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ @@ -1103,13 +1149,14 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libbsdiff_la_SOURCES) $(libbupsplit_la_SOURCES) \ $(libglnx_la_SOURCES) $(libostree_1_la_SOURCES) \ + $(nodist_libostree_1_la_SOURCES) \ $(libostree_kernel_args_la_SOURCES) \ $(libostreetest_la_SOURCES) $(libotutil_la_SOURCES) \ $(libreaddir_rand_la_SOURCES) $(ostree_SOURCES) \ $(ostree_prepare_root_SOURCES) $(ostree_remount_SOURCES) \ $(ostree_trivial_httpd_SOURCES) $(rofiles_fuse_SOURCES) \ - tests/test-basic-c.c tests/test-bsdiff.c \ - $(tests_test_checksum_SOURCES) \ + $(test_libglnx_xattrs_SOURCES) tests/test-basic-c.c \ + tests/test-bsdiff.c $(tests_test_checksum_SOURCES) \ $(tests_test_gpg_verify_result_SOURCES) \ tests/test-keyfile-utils.c \ $(tests_test_libarchive_import_SOURCES) \ @@ -1119,14 +1166,16 @@ SOURCES = $(libbsdiff_la_SOURCES) $(libbupsplit_la_SOURCES) \ $(tests_test_rollsum_SOURCES) \ $(tests_test_rollsum_cli_SOURCES) tests/test-sysroot-c.c \ $(tests_test_varint_SOURCES) -DIST_SOURCES = $(libbsdiff_la_SOURCES) $(libbupsplit_la_SOURCES) \ - $(libglnx_la_SOURCES) $(am__libostree_1_la_SOURCES_DIST) \ +DIST_SOURCES = $(libbsdiff_la_SOURCES) \ + $(am__libbupsplit_la_SOURCES_DIST) $(libglnx_la_SOURCES) \ + $(am__libostree_1_la_SOURCES_DIST) \ $(libostree_kernel_args_la_SOURCES) \ $(libostreetest_la_SOURCES) $(libotutil_la_SOURCES) \ $(libreaddir_rand_la_SOURCES) $(am__ostree_SOURCES_DIST) \ $(ostree_prepare_root_SOURCES) $(ostree_remount_SOURCES) \ $(am__ostree_trivial_httpd_SOURCES_DIST) \ - $(am__rofiles_fuse_SOURCES_DIST) tests/test-basic-c.c \ + $(am__rofiles_fuse_SOURCES_DIST) \ + $(test_libglnx_xattrs_SOURCES) tests/test-basic-c.c \ tests/test-bsdiff.c $(tests_test_checksum_SOURCES) \ $(tests_test_gpg_verify_result_SOURCES) \ tests/test-keyfile-utils.c \ @@ -1380,6 +1429,7 @@ am__EXEEXT_13 = tests/test-basic.sh tests/test-basic-user.sh \ tests/test-admin-instutil-set-kargs.sh \ tests/test-admin-upgrade-not-backwards.sh \ tests/test-admin-pull-deploy-commit.sh \ + tests/test-admin-pull-deploy-split.sh \ tests/test-admin-locking.sh tests/test-admin-deploy-clean.sh \ tests/test-repo-checkout-subpath.sh \ tests/test-reset-nonlinear.sh tests/test-oldstyle-partial.sh \ @@ -1388,7 +1438,7 @@ am__EXEEXT_13 = tests/test-basic.sh tests/test-basic-user.sh \ tests/test-refs.sh tests/test-demo-buildsystem.sh \ tests/test-switchroot.sh tests/test-pull-contenturl.sh \ tests/test-pull-mirrorlist.sh $(am__EXEEXT_12) \ - $(am__append_43) $(am__append_45) $(am__append_46) + $(am__append_51) $(am__append_53) $(am__append_54) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) @@ -1555,6 +1605,8 @@ OBJEXT = @OBJEXT@ OSTREE_FEATURES = @OSTREE_FEATURES@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +OT_DEP_CURL_CFLAGS = @OT_DEP_CURL_CFLAGS@ +OT_DEP_CURL_LIBS = @OT_DEP_CURL_LIBS@ OT_DEP_E2P_CFLAGS = @OT_DEP_E2P_CFLAGS@ OT_DEP_E2P_LIBS = @OT_DEP_E2P_LIBS@ OT_DEP_GIO_UNIX_CFLAGS = @OT_DEP_GIO_UNIX_CFLAGS@ @@ -1585,6 +1637,7 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ +RUST_TARGET_SUBDIR = @RUST_TARGET_SUBDIR@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -1614,6 +1667,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ +cargo = @cargo@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -1641,6 +1695,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +rustc = @rustc@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -1657,62 +1712,62 @@ AM_CPPFLAGS = -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSHORTENED_SYSCONFDIR=\"$(shortened_sysconfdir)\" \ -DOSTREE_FEATURES='"$(OSTREE_FEATURES)"' -DOSTREE_COMPILATION \ - -DG_LOG_DOMAIN=\"OSTree\" \ + -DG_LOG_DOMAIN=\"OSTree\" -DOSTREE_GITREV='"$(OSTREE_GITREV)"' \ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 \ -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 \ -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 \ -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_48 AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS) AM_DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-man \ - --disable-maintainer-mode $(NULL) $(am__append_52) + --disable-maintainer-mode $(NULL) $(am__append_60) SUBDIRS = . $(am__append_14) NULL = -BUILT_SOURCES = $(ENUM_GENERATED) +BUILT_SOURCES = $(nodist_libostree_1_la_SOURCES) MANPAGES = -CLEANFILES = $(am__append_13) $(BUILT_SOURCES) $(am__append_31) \ +CLEANFILES = $(am__append_13) $(BUILT_SOURCES) $(am__append_38) \ src/ostree/parse-datetime.c tests/libreaddir-rand.so \ tests/ostree-symlink-stamp \ tests/ostree-prepare-root-symlink-stamp \ tests/ostree-remount-symlink-stamp \ tests/rofiles-fuse-symlink-stamp tests/ostree \ tests/ostree-prepare-root tests/ostree-remount \ - tests/rofiles-fuse $(am__append_57) + tests/rofiles-fuse $(am__append_65) EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \ - COPYING README.md libglnx/README.md libglnx/COPYING \ - libglnx/libglnx.m4 $(NULL) libglnx/Makefile-libglnx.am \ - bsdiff/bsdiff.h bsdiff/bspatch.h bsdiff/LICENSE \ - bsdiff/README.md bsdiff/Makefile-bsdiff.am \ - src/libostree/libostree.sym src/libostree/README-gpg \ - src/libostree/bupsplit.h \ + COPYING README.md $(am__append_15) libglnx/README.md \ + libglnx/COPYING libglnx/libglnx.m4 $(NULL) \ + libglnx/Makefile-libglnx.am bsdiff/bsdiff.h bsdiff/bspatch.h \ + bsdiff/LICENSE bsdiff/README.md bsdiff/Makefile-bsdiff.am \ + $(am__append_16) src/libostree/libostree.sym \ + src/libostree/README-gpg src/libostree/bupsplit.h \ src/libostree/ostree-enumtypes.h.template \ src/libostree/ostree-enumtypes.c.template \ src/libostree/ostree-deployment-private.h \ src/libostree/ostree-repo-deprecated.h \ src/ostree/parse-datetime.y buildutil/tap-driver.sh \ buildutil/tap-test tests/glib.supp tests/ostree.supp $(NULL) \ - $(am__append_44) $(am__append_47) tests/libtest.sh \ - $(am__append_48) tests/libostreetest.h tests/libtest.sh \ + $(am__append_52) $(am__append_55) tests/libtest.sh \ + $(am__append_56) tests/libostreetest.h tests/libtest.sh \ tests/gpg-verify-data/README.md $(NULL) \ src/boot/dracut/module-setup.sh src/boot/dracut/ostree.conf \ src/boot/mkinitcpio/ostree \ src/boot/ostree-prepare-root.service \ src/boot/ostree-remount.service src/boot/grub2/grub2-15_ostree \ - src/boot/grub2/ostree-grub-generator $(NULL) $(am__append_56) + src/boot/grub2/ostree-grub-generator $(NULL) $(am__append_64) bin_SCRIPTS = lib_LTLIBRARIES = libostree-1.la -pkglibexec_SCRIPTS = $(am__append_53) +pkglibexec_SCRIPTS = $(am__append_61) noinst_LTLIBRARIES = $(am__append_1) libglnx.la libbsdiff.la \ - libotutil.la libostree-kernel-args.la libbupsplit.la \ + libotutil.la libostree-kernel-args.la $(am__append_17) \ libostreetest.la privlibdir = $(pkglibdir) privlib_LTLIBRARIES = pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = src/libostree/ostree-1.pc -INTROSPECTION_GIRS = $(am__append_28) +INTROSPECTION_GIRS = $(am__append_35) girdir = $(datadir)/gir-1.0 -gir_DATA = $(am__append_29) +gir_DATA = $(am__append_36) typelibdir = $(libdir)/girepository-1.0 -typelib_DATA = $(am__append_30) +typelib_DATA = $(am__append_37) gsettings_SCHEMAS = ostree_bootdir = $(prefix)/lib/ostree @@ -1729,7 +1784,7 @@ TESTS_ENVIRONMENT = G_TEST_SRCDIR="$(abs_srcdir)" \ LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && \ pwd)$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}} PATH=$$(cd \ $(top_builddir)/tests && pwd):$${PATH} $(NULL) \ - $(am__append_42) + $(am__append_50) 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) @@ -1769,10 +1824,11 @@ 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_51) \ - $(am__append_54) +INSTALL_DATA_HOOKS = install-mkdir-remotes-d-hook $(am__append_59) \ + $(am__append_62) ALL_LOCAL_RULES = tests/libreaddir-rand.so shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||') +OSTREE_GITREV = $(shell if command -v git >/dev/null 2>&1 && test -d $(srcdir)/.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 OT_INTERNAL_GIO_UNIX_CFLAGS = $(OT_DEP_GIO_UNIX_CFLAGS) @@ -1785,6 +1841,10 @@ OT_INTERNAL_GPGME_CFLAGS = $(OT_DEP_GPGME_CFLAGS) $(GPGME_PTHREAD_CFLAGS) OT_INTERNAL_GPGME_LIBS = $(OT_DEP_GPGME_LIBS) $(GPGME_PTHREAD_LIBS) @BUILDOPT_INTROSPECTION_TRUE@GIRS = @BUILDOPT_INTROSPECTION_TRUE@TYPELIBS = $(GIRS:.gir=.typelib) +@ENABLE_RUST_TRUE@@RUST_DEBUG_FALSE@CARGO_RELEASE_ARGS = --release + +# These bits based on gnome:librsvg/Makefile.am +@ENABLE_RUST_TRUE@@RUST_DEBUG_TRUE@CARGO_RELEASE_ARGS = libglnx_srcpath := $(srcdir)/libglnx libglnx_cflags := $(OT_DEP_GIO_UNIX_CFLAGS) "-I$(libglnx_srcpath)" libglnx_libs := $(OT_DEP_GIO_UNIX_LIBS) @@ -1818,6 +1878,9 @@ libglnx_la_SOURCES = \ libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic libglnx_la_LIBADD = $(libglnx_libs) +test_libglnx_xattrs_SOURCES = libglnx/tests/test-libglnx-xattrs.c +test_libglnx_xattrs_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) +test_libglnx_xattrs_LDADD = $(libglnx_libs) libglnx.la libbsdiff_srcpath := $(srcdir)/bsdiff libbsdiff_cflags := $(OT_DEP_GIO_UNIX_CFLAGS) "-I$(bsdiff_srcpath)" libbsdiff_libs := $(OT_DEP_GIO_UNIX_LIBS) @@ -1876,6 +1939,10 @@ libostree_public_headers = \ src/libostree/ostree-repo-deprecated.h \ $(NULL) +@ENABLE_RUST_FALSE@bupsplitpath = libbupsplit.la +@ENABLE_RUST_TRUE@bupsplitpath = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/libbupsplit_rs.a +@ENABLE_RUST_TRUE@BUPSPLIT_RUST_SOURCES = rust/src/bupsplit.rs +@ENABLE_RUST_FALSE@libbupsplit_la_SOURCES = src/libostree/bupsplit.h src/libostree/bupsplit.c libostree_kernel_args_la_SOURCES = \ src/libostree/ostree-kernel-args.h \ src/libostree/ostree-kernel-args.c \ @@ -1886,18 +1953,12 @@ libostree_kernel_args_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS) libostreeincludedir = $(includedir)/ostree-1 libostreeinclude_HEADERS = $(libostree_public_headers) ENUM_TYPES = $(NULL) $(srcdir)/src/libostree/ostree-fetcher.h -ENUM_GENERATED = \ +nodist_libostree_1_la_SOURCES = \ src/libostree/ostree-enumtypes.h \ src/libostree/ostree-enumtypes.c \ $(NULL) -libbupsplit_la_SOURCES = \ - src/libostree/bupsplit.h \ - src/libostree/bupsplit.c \ - $(NULL) - -libostree_1_la_SOURCES = $(ENUM_GENERATED) \ - src/libostree/ostree-async-progress.c \ +libostree_1_la_SOURCES = src/libostree/ostree-async-progress.c \ src/libostree/ostree-cmdprivate.h \ src/libostree/ostree-cmdprivate.c \ src/libostree/ostree-core-private.h \ @@ -1955,8 +2016,9 @@ libostree_1_la_SOURCES = $(ENUM_GENERATED) \ src/libostree/ostree-gpg-verifier.h \ src/libostree/ostree-gpg-verify-result.c \ src/libostree/ostree-gpg-verify-result-private.h \ - src/libostree/ostree-autocleanups.h $(NULL) $(am__append_15) \ - $(am__append_16) $(am__append_21) + src/libostree/ostree-autocleanups.h $(NULL) $(am__append_18) \ + $(am__append_19) $(am__append_24) $(am__append_25) \ + $(am__append_28) libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff \ -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil \ -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \ @@ -1964,15 +2026,15 @@ libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff \ $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) \ -fvisibility=hidden \ '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) \ - extern' $(am__append_17) $(am__append_19) $(am__append_22) \ - $(am__append_24) $(am__append_26) + extern' $(am__append_20) $(am__append_22) $(am__append_26) \ + $(am__append_29) $(am__append_31) $(am__append_33) libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions -Wl,--version-script=$(top_srcdir)/src/libostree/libostree.sym -libostree_1_la_LIBADD = libotutil.la libbupsplit.la libglnx.la \ - libbsdiff.la libostree-kernel-args.la \ - $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_INTERNAL_GPGME_LIBS) \ - $(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) $(am__append_18) \ - $(am__append_20) $(am__append_23) $(am__append_25) \ - $(am__append_27) +libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la \ + libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) \ + $(OT_INTERNAL_GPGME_LIBS) $(OT_DEP_LZMA_LIBS) \ + $(OT_DEP_ZLIB_LIBS) $(bupsplitpath) $(am__append_21) \ + $(am__append_23) $(am__append_27) $(am__append_30) \ + $(am__append_32) $(am__append_34) EXTRA_libostree_1_la_DEPENDENCIES = $(top_srcdir)/src/libostree/libostree.sym @BUILDOPT_INTROSPECTION_TRUE@OSTree_1_0_gir_EXPORT_PACKAGES = ostree-1 @BUILDOPT_INTROSPECTION_TRUE@OSTree_1_0_gir_INCLUDES = Gio-2.0 @@ -1981,7 +2043,7 @@ EXTRA_libostree_1_la_DEPENDENCIES = $(top_srcdir)/src/libostree/libostree.sym @BUILDOPT_INTROSPECTION_TRUE@OSTree_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=Ostree --symbol-prefix=ostree @BUILDOPT_INTROSPECTION_TRUE@OSTree_1_0_gir_FILES = $(libostreeinclude_HEADERS) $(filter-out %-private.h,$(libostree_1_la_SOURCES)) gpgreadme_DATA = src/libostree/README-gpg -gpgreadmedir = $(pkgdatadir)/trusted.gpg.d +gpgreadmedir = $(datadir)/ostree/trusted.gpg.d # Admin subcommand @@ -2031,7 +2093,7 @@ ostree_SOURCES = src/ostree/main.c src/ostree/ot-builtin-admin.c \ src/ostree/ot-remote-builtin-show-url.c \ src/ostree/ot-remote-builtin-refs.c \ src/ostree/ot-remote-builtin-summary.c $(NULL) \ - $(am__append_32) + $(am__append_39) $(am__append_40) ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree \ -I$(srcdir)/src/ostree -I$(srcdir)/libglnx $(OT_INTERNAL_GIO_UNIX_CFLAGS) \ -DPKGLIBEXECDIR=\"$(pkglibexecdir)\" @@ -2039,11 +2101,11 @@ ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/sr ostree_bin_shared_ldadd = $(AM_LDFLAGS) libglnx.la libotutil.la libostree-1.la \ $(OT_INTERNAL_GIO_UNIX_LIBS) -ostree_CFLAGS = $(ostree_bin_shared_cflags) $(am__append_33) \ - $(am__append_36) +ostree_CFLAGS = $(ostree_bin_shared_cflags) $(am__append_42) \ + $(am__append_44) ostree_LDADD = $(ostree_bin_shared_ldadd) libbsdiff.la \ - libostree-kernel-args.la $(LIBSYSTEMD_LIBS) $(am__append_34) \ - $(am__append_37) + libostree-kernel-args.la $(LIBSYSTEMD_LIBS) $(am__append_43) \ + $(am__append_45) @USE_LIBSOUP_TRUE@ostree_trivial_httpd_SOURCES = src/ostree/ostree-trivial-httpd.c @USE_LIBSOUP_TRUE@ostree_trivial_httpd_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_SOUP_CFLAGS) @USE_LIBSOUP_TRUE@ostree_trivial_httpd_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_SOUP_LIBS) @@ -2105,6 +2167,7 @@ dist_test_scripts = tests/test-basic.sh tests/test-basic-user.sh \ tests/test-admin-instutil-set-kargs.sh \ tests/test-admin-upgrade-not-backwards.sh \ tests/test-admin-pull-deploy-commit.sh \ + tests/test-admin-pull-deploy-split.sh \ tests/test-admin-locking.sh tests/test-admin-deploy-clean.sh \ tests/test-repo-checkout-subpath.sh \ tests/test-reset-nonlinear.sh tests/test-oldstyle-partial.sh \ @@ -2112,8 +2175,8 @@ dist_test_scripts = tests/test-basic.sh tests/test-basic-user.sh \ tests/test-auto-summary.sh tests/test-prune.sh \ tests/test-refs.sh tests/test-demo-buildsystem.sh \ tests/test-switchroot.sh tests/test-pull-contenturl.sh \ - tests/test-pull-mirrorlist.sh $(NULL) $(am__append_43) \ - $(am__append_45) $(am__append_46) + tests/test-pull-mirrorlist.sh $(NULL) $(am__append_51) \ + $(am__append_53) $(am__append_54) # These call into gjs scripts js_tests = tests/test-corruption.sh tests/test-pull-corruption.sh @@ -2164,14 +2227,14 @@ libreaddir_rand_la_LIBADD = \ $(NULL) libreaddir_rand_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version \ - $(am__append_49) + $(am__append_57) test_programs = tests/test-varint tests/test-ot-unix-utils \ tests/test-bsdiff tests/test-mutable-tree \ tests/test-keyfile-utils tests/test-ot-opt-utils \ tests/test-ot-tool-util 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 \ - $(am__append_50) + $(am__append_58) 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 @@ -2181,10 +2244,10 @@ TESTS_CFLAGS = $(common_tests_cflags) TESTS_LDADD = $(common_tests_ldadd) libostreetest.la tests_test_rollsum_cli_SOURCES = src/libostree/ostree-rollsum.c tests/test-rollsum-cli.c tests_test_rollsum_cli_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) -tests_test_rollsum_cli_LDADD = libbupsplit.la $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) +tests_test_rollsum_cli_LDADD = $(bupsplitpath) $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) tests_test_rollsum_SOURCES = src/libostree/ostree-rollsum.c tests/test-rollsum.c tests_test_rollsum_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) -tests_test_rollsum_LDADD = libbupsplit.la $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) +tests_test_rollsum_LDADD = $(bupsplitpath) $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS) tests_test_mutable_tree_CFLAGS = $(TESTS_CFLAGS) tests_test_mutable_tree_LDADD = $(TESTS_LDADD) tests_test_basic_c_CFLAGS = $(TESTS_CFLAGS) @@ -2255,7 +2318,7 @@ tests_test_gpg_verify_result_LDADD = $(TESTS_LDADD) $(OT_INTERNAL_GPGME_LIBS) @ENABLE_MAN_TRUE@ ostree-reset.1 ostree-rev-parse.1 \ @ENABLE_MAN_TRUE@ ostree-show.1 ostree-summary.1 \ @ENABLE_MAN_TRUE@ ostree-static-delta.1 ostree-trivial-httpd.1 \ -@ENABLE_MAN_TRUE@ $(am__append_55) +@ENABLE_MAN_TRUE@ $(am__append_63) @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)) @@ -2477,7 +2540,7 @@ src/libostree/bupsplit.lo: src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) libbupsplit.la: $(libbupsplit_la_OBJECTS) $(libbupsplit_la_DEPENDENCIES) $(EXTRA_libbupsplit_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libbupsplit_la_OBJECTS) $(libbupsplit_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(am_libbupsplit_la_rpath) $(libbupsplit_la_OBJECTS) $(libbupsplit_la_LIBADD) $(LIBS) libglnx/$(am__dirstamp): @$(MKDIR_P) libglnx @: > libglnx/$(am__dirstamp) @@ -2505,9 +2568,6 @@ libglnx/libglnx_la-glnx-shutil.lo: libglnx/$(am__dirstamp) \ libglnx.la: $(libglnx_la_OBJECTS) $(libglnx_la_DEPENDENCIES) $(EXTRA_libglnx_la_DEPENDENCIES) $(AM_V_CCLD)$(libglnx_la_LINK) $(libglnx_la_OBJECTS) $(libglnx_la_LIBADD) $(LIBS) -src/libostree/libostree_1_la-ostree-enumtypes.lo: \ - src/libostree/$(am__dirstamp) \ - src/libostree/$(DEPDIR)/$(am__dirstamp) src/libostree/libostree_1_la-ostree-async-progress.lo: \ src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) @@ -2637,15 +2697,30 @@ src/libostree/libostree_1_la-ostree-libarchive-input-stream.lo: \ src/libostree/libostree_1_la-ostree-tls-cert-interaction.lo: \ src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) -src/libostree/libostree_1_la-ostree-fetcher.lo: \ - src/libostree/$(am__dirstamp) \ - src/libostree/$(DEPDIR)/$(am__dirstamp) src/libostree/libostree_1_la-ostree-fetcher-util.lo: \ src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-fetcher-uri.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) src/libostree/libostree_1_la-ostree-metalink.lo: \ src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-fetcher-curl.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-soup-uri.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-soup-form.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-fetcher-soup.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-enumtypes.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) libostree-1.la: $(libostree_1_la_OBJECTS) $(libostree_1_la_DEPENDENCIES) $(EXTRA_libostree_1_la_DEPENDENCIES) $(AM_V_CCLD)$(libostree_1_la_LINK) -rpath $(libdir) $(libostree_1_la_OBJECTS) $(libostree_1_la_LIBADD) $(LIBS) @@ -3187,6 +3262,9 @@ src/ostree/ostree-ot-remote-builtin-delete-cookie.$(OBJEXT): \ src/ostree/ostree-ot-remote-builtin-list-cookies.$(OBJEXT): \ src/ostree/$(am__dirstamp) \ src/ostree/$(DEPDIR)/$(am__dirstamp) +src/ostree/ostree-ot-remote-cookie-util.$(OBJEXT): \ + src/ostree/$(am__dirstamp) \ + src/ostree/$(DEPDIR)/$(am__dirstamp) src/ostree/ostree-ot-builtin-pull.$(OBJEXT): \ src/ostree/$(am__dirstamp) \ src/ostree/$(DEPDIR)/$(am__dirstamp) @@ -3237,6 +3315,19 @@ src/rofiles-fuse/rofiles_fuse-main.$(OBJEXT): \ rofiles-fuse$(EXEEXT): $(rofiles_fuse_OBJECTS) $(rofiles_fuse_DEPENDENCIES) $(EXTRA_rofiles_fuse_DEPENDENCIES) @rm -f rofiles-fuse$(EXEEXT) $(AM_V_CCLD)$(rofiles_fuse_LINK) $(rofiles_fuse_OBJECTS) $(rofiles_fuse_LDADD) $(LIBS) +libglnx/tests/$(am__dirstamp): + @$(MKDIR_P) libglnx/tests + @: > libglnx/tests/$(am__dirstamp) +libglnx/tests/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libglnx/tests/$(DEPDIR) + @: > libglnx/tests/$(DEPDIR)/$(am__dirstamp) +libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.$(OBJEXT): \ + libglnx/tests/$(am__dirstamp) \ + libglnx/tests/$(DEPDIR)/$(am__dirstamp) + +test-libglnx-xattrs$(EXEEXT): $(test_libglnx_xattrs_OBJECTS) $(test_libglnx_xattrs_DEPENDENCIES) $(EXTRA_test_libglnx_xattrs_DEPENDENCIES) + @rm -f test-libglnx-xattrs$(EXEEXT) + $(AM_V_CCLD)$(test_libglnx_xattrs_LINK) $(test_libglnx_xattrs_OBJECTS) $(test_libglnx_xattrs_LDADD) $(LIBS) tests/tests_test_basic_c-test-basic-c.$(OBJEXT): \ tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp) @@ -3571,6 +3662,7 @@ mostlyclean-compile: -rm -f bsdiff/*.lo -rm -f libglnx/*.$(OBJEXT) -rm -f libglnx/*.lo + -rm -f libglnx/tests/*.$(OBJEXT) -rm -f src/libostree/*.$(OBJEXT) -rm -f src/libostree/*.lo -rm -f src/libotutil/*.$(OBJEXT) @@ -3595,6 +3687,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-lockfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-shutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-xattrs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/bupsplit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-async-progress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootconfig-parser.Plo@am__quote@ @@ -3610,8 +3703,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-diff.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-dummy-enumtypes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-curl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-soup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-uri.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-gpg-verifier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-gpg-verify-result.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-libarchive-input-stream.Plo@am__quote@ @@ -3637,6 +3732,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-repo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-rollsum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-sepolicy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-form.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-uri.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-sysroot-cleanup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-sysroot-deploy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-sysroot-upgrader.Plo@am__quote@ @@ -3717,6 +3814,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-remote-builtin-refs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-remote-builtin-show-url.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-remote-builtin-summary.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-parse-datetime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree_trivial_httpd-ostree-trivial-httpd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/rofiles-fuse/$(DEPDIR)/rofiles_fuse-main.Po@am__quote@ @@ -3842,13 +3940,6 @@ libglnx/libglnx_la-glnx-shutil.lo: libglnx/glnx-shutil.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-shutil.lo `test -f 'libglnx/glnx-shutil.c' || echo '$(srcdir)/'`libglnx/glnx-shutil.c -src/libostree/libostree_1_la-ostree-enumtypes.lo: src/libostree/ostree-enumtypes.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-enumtypes.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Tpo -c -o src/libostree/libostree_1_la-ostree-enumtypes.lo `test -f 'src/libostree/ostree-enumtypes.c' || echo '$(srcdir)/'`src/libostree/ostree-enumtypes.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-enumtypes.c' object='src/libostree/libostree_1_la-ostree-enumtypes.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-enumtypes.lo `test -f 'src/libostree/ostree-enumtypes.c' || echo '$(srcdir)/'`src/libostree/ostree-enumtypes.c - src/libostree/libostree_1_la-ostree-async-progress.lo: src/libostree/ostree-async-progress.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-async-progress.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-async-progress.Tpo -c -o src/libostree/libostree_1_la-ostree-async-progress.lo `test -f 'src/libostree/ostree-async-progress.c' || echo '$(srcdir)/'`src/libostree/ostree-async-progress.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-async-progress.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-async-progress.Plo @@ -4150,13 +4241,6 @@ src/libostree/libostree_1_la-ostree-tls-cert-interaction.lo: src/libostree/ostre @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-tls-cert-interaction.lo `test -f 'src/libostree/ostree-tls-cert-interaction.c' || echo '$(srcdir)/'`src/libostree/ostree-tls-cert-interaction.c -src/libostree/libostree_1_la-ostree-fetcher.lo: src/libostree/ostree-fetcher.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-fetcher.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher.Tpo -c -o src/libostree/libostree_1_la-ostree-fetcher.lo `test -f 'src/libostree/ostree-fetcher.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-fetcher.c' object='src/libostree/libostree_1_la-ostree-fetcher.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-fetcher.lo `test -f 'src/libostree/ostree-fetcher.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher.c - src/libostree/libostree_1_la-ostree-fetcher-util.lo: src/libostree/ostree-fetcher-util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-fetcher-util.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-util.Tpo -c -o src/libostree/libostree_1_la-ostree-fetcher-util.lo `test -f 'src/libostree/ostree-fetcher-util.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-util.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-util.Plo @@ -4164,6 +4248,13 @@ src/libostree/libostree_1_la-ostree-fetcher-util.lo: src/libostree/ostree-fetche @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-fetcher-util.lo `test -f 'src/libostree/ostree-fetcher-util.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-util.c +src/libostree/libostree_1_la-ostree-fetcher-uri.lo: src/libostree/ostree-fetcher-uri.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-fetcher-uri.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-uri.Tpo -c -o src/libostree/libostree_1_la-ostree-fetcher-uri.lo `test -f 'src/libostree/ostree-fetcher-uri.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-uri.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-uri.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-uri.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-fetcher-uri.c' object='src/libostree/libostree_1_la-ostree-fetcher-uri.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-fetcher-uri.lo `test -f 'src/libostree/ostree-fetcher-uri.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-uri.c + src/libostree/libostree_1_la-ostree-metalink.lo: src/libostree/ostree-metalink.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-metalink.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-metalink.Tpo -c -o src/libostree/libostree_1_la-ostree-metalink.lo `test -f 'src/libostree/ostree-metalink.c' || echo '$(srcdir)/'`src/libostree/ostree-metalink.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-metalink.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-metalink.Plo @@ -4171,6 +4262,41 @@ src/libostree/libostree_1_la-ostree-metalink.lo: src/libostree/ostree-metalink.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-metalink.lo `test -f 'src/libostree/ostree-metalink.c' || echo '$(srcdir)/'`src/libostree/ostree-metalink.c +src/libostree/libostree_1_la-ostree-fetcher-curl.lo: src/libostree/ostree-fetcher-curl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-fetcher-curl.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-curl.Tpo -c -o src/libostree/libostree_1_la-ostree-fetcher-curl.lo `test -f 'src/libostree/ostree-fetcher-curl.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-curl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-curl.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-curl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-fetcher-curl.c' object='src/libostree/libostree_1_la-ostree-fetcher-curl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-fetcher-curl.lo `test -f 'src/libostree/ostree-fetcher-curl.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-curl.c + +src/libostree/libostree_1_la-ostree-soup-uri.lo: src/libostree/ostree-soup-uri.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-soup-uri.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-uri.Tpo -c -o src/libostree/libostree_1_la-ostree-soup-uri.lo `test -f 'src/libostree/ostree-soup-uri.c' || echo '$(srcdir)/'`src/libostree/ostree-soup-uri.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-uri.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-uri.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-soup-uri.c' object='src/libostree/libostree_1_la-ostree-soup-uri.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-soup-uri.lo `test -f 'src/libostree/ostree-soup-uri.c' || echo '$(srcdir)/'`src/libostree/ostree-soup-uri.c + +src/libostree/libostree_1_la-ostree-soup-form.lo: src/libostree/ostree-soup-form.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-soup-form.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-form.Tpo -c -o src/libostree/libostree_1_la-ostree-soup-form.lo `test -f 'src/libostree/ostree-soup-form.c' || echo '$(srcdir)/'`src/libostree/ostree-soup-form.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-form.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-soup-form.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-soup-form.c' object='src/libostree/libostree_1_la-ostree-soup-form.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-soup-form.lo `test -f 'src/libostree/ostree-soup-form.c' || echo '$(srcdir)/'`src/libostree/ostree-soup-form.c + +src/libostree/libostree_1_la-ostree-fetcher-soup.lo: src/libostree/ostree-fetcher-soup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-fetcher-soup.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-soup.Tpo -c -o src/libostree/libostree_1_la-ostree-fetcher-soup.lo `test -f 'src/libostree/ostree-fetcher-soup.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-soup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-soup.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-fetcher-soup.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-fetcher-soup.c' object='src/libostree/libostree_1_la-ostree-fetcher-soup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-fetcher-soup.lo `test -f 'src/libostree/ostree-fetcher-soup.c' || echo '$(srcdir)/'`src/libostree/ostree-fetcher-soup.c + +src/libostree/libostree_1_la-ostree-enumtypes.lo: src/libostree/ostree-enumtypes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-enumtypes.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Tpo -c -o src/libostree/libostree_1_la-ostree-enumtypes.lo `test -f 'src/libostree/ostree-enumtypes.c' || echo '$(srcdir)/'`src/libostree/ostree-enumtypes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-enumtypes.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-enumtypes.c' object='src/libostree/libostree_1_la-ostree-enumtypes.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-enumtypes.lo `test -f 'src/libostree/ostree-enumtypes.c' || echo '$(srcdir)/'`src/libostree/ostree-enumtypes.c + src/libostree/libostree_kernel_args_la-ostree-kernel-args.lo: src/libostree/ostree-kernel-args.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_kernel_args_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_kernel_args_la-ostree-kernel-args.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_kernel_args_la-ostree-kernel-args.Tpo -c -o src/libostree/libostree_kernel_args_la-ostree-kernel-args.lo `test -f 'src/libostree/ostree-kernel-args.c' || echo '$(srcdir)/'`src/libostree/ostree-kernel-args.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_kernel_args_la-ostree-kernel-args.Tpo src/libostree/$(DEPDIR)/libostree_kernel_args_la-ostree-kernel-args.Plo @@ -5018,6 +5144,20 @@ src/ostree/ostree-ot-remote-builtin-list-cookies.obj: src/ostree/ot-remote-built @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -c -o src/ostree/ostree-ot-remote-builtin-list-cookies.obj `if test -f 'src/ostree/ot-remote-builtin-list-cookies.c'; then $(CYGPATH_W) 'src/ostree/ot-remote-builtin-list-cookies.c'; else $(CYGPATH_W) '$(srcdir)/src/ostree/ot-remote-builtin-list-cookies.c'; fi` +src/ostree/ostree-ot-remote-cookie-util.o: src/ostree/ot-remote-cookie-util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -MT src/ostree/ostree-ot-remote-cookie-util.o -MD -MP -MF src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Tpo -c -o src/ostree/ostree-ot-remote-cookie-util.o `test -f 'src/ostree/ot-remote-cookie-util.c' || echo '$(srcdir)/'`src/ostree/ot-remote-cookie-util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Tpo src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ostree/ot-remote-cookie-util.c' object='src/ostree/ostree-ot-remote-cookie-util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -c -o src/ostree/ostree-ot-remote-cookie-util.o `test -f 'src/ostree/ot-remote-cookie-util.c' || echo '$(srcdir)/'`src/ostree/ot-remote-cookie-util.c + +src/ostree/ostree-ot-remote-cookie-util.obj: src/ostree/ot-remote-cookie-util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -MT src/ostree/ostree-ot-remote-cookie-util.obj -MD -MP -MF src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Tpo -c -o src/ostree/ostree-ot-remote-cookie-util.obj `if test -f 'src/ostree/ot-remote-cookie-util.c'; then $(CYGPATH_W) 'src/ostree/ot-remote-cookie-util.c'; else $(CYGPATH_W) '$(srcdir)/src/ostree/ot-remote-cookie-util.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Tpo src/ostree/$(DEPDIR)/ostree-ot-remote-cookie-util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ostree/ot-remote-cookie-util.c' object='src/ostree/ostree-ot-remote-cookie-util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -c -o src/ostree/ostree-ot-remote-cookie-util.obj `if test -f 'src/ostree/ot-remote-cookie-util.c'; then $(CYGPATH_W) 'src/ostree/ot-remote-cookie-util.c'; else $(CYGPATH_W) '$(srcdir)/src/ostree/ot-remote-cookie-util.c'; fi` + src/ostree/ostree-ot-builtin-pull.o: src/ostree/ot-builtin-pull.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -MT src/ostree/ostree-ot-builtin-pull.o -MD -MP -MF src/ostree/$(DEPDIR)/ostree-ot-builtin-pull.Tpo -c -o src/ostree/ostree-ot-builtin-pull.o `test -f 'src/ostree/ot-builtin-pull.c' || echo '$(srcdir)/'`src/ostree/ot-builtin-pull.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/ostree/$(DEPDIR)/ostree-ot-builtin-pull.Tpo src/ostree/$(DEPDIR)/ostree-ot-builtin-pull.Po @@ -5102,6 +5242,20 @@ src/rofiles-fuse/rofiles_fuse-main.obj: src/rofiles-fuse/main.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rofiles_fuse_CFLAGS) $(CFLAGS) -c -o src/rofiles-fuse/rofiles_fuse-main.obj `if test -f 'src/rofiles-fuse/main.c'; then $(CYGPATH_W) 'src/rofiles-fuse/main.c'; else $(CYGPATH_W) '$(srcdir)/src/rofiles-fuse/main.c'; fi` +libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o: libglnx/tests/test-libglnx-xattrs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o `test -f 'libglnx/tests/test-libglnx-xattrs.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-xattrs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libglnx/tests/test-libglnx-xattrs.c' object='libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o `test -f 'libglnx/tests/test-libglnx-xattrs.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-xattrs.c + +libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj: libglnx/tests/test-libglnx-xattrs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj `if test -f 'libglnx/tests/test-libglnx-xattrs.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-xattrs.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-xattrs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libglnx/tests/test-libglnx-xattrs.c' object='libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj `if test -f 'libglnx/tests/test-libglnx-xattrs.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-xattrs.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-xattrs.c'; fi` + tests/tests_test_basic_c-test-basic-c.o: tests/test-basic-c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_basic_c_CFLAGS) $(CFLAGS) -MT tests/tests_test_basic_c-test-basic-c.o -MD -MP -MF tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Tpo -c -o tests/tests_test_basic_c-test-basic-c.o `test -f 'tests/test-basic-c.c' || echo '$(srcdir)/'`tests/test-basic-c.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Tpo tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Po @@ -6442,6 +6596,13 @@ tests/test-admin-pull-deploy-commit.sh.log: tests/test-admin-pull-deploy-commit. --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-pull-deploy-split.sh.log: tests/test-admin-pull-deploy-split.sh + @p='tests/test-admin-pull-deploy-split.sh'; \ + b='tests/test-admin-pull-deploy-split.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-locking.sh.log: tests/test-admin-locking.sh @p='tests/test-admin-locking.sh'; \ b='tests/test-admin-locking.sh'; \ @@ -6575,6 +6736,13 @@ tests/test-symbols.sh.log: tests/test-symbols.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) +test-libglnx-xattrs.log: test-libglnx-xattrs$(EXEEXT) + @p='test-libglnx-xattrs$(EXEEXT)'; \ + b='test-libglnx-xattrs'; \ + $(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) .test.log: @p='$<'; \ $(am__set_b); \ @@ -6589,6 +6757,7 @@ tests/test-symbols.sh.log: tests/test-symbols.sh @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +@ENABLE_RUST_FALSE@dist-hook: distdir: $(DISTFILES) $(am__remove_distdir) @@ -6647,6 +6816,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ @@ -6777,10 +6949,11 @@ distcleancheck: distclean || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 +@ENABLE_RUST_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) \ $(check_SCRIPTS) $(check_DATA) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \ @@ -6827,6 +7000,8 @@ distclean-generic: -rm -f bsdiff/$(am__dirstamp) -rm -f libglnx/$(DEPDIR)/$(am__dirstamp) -rm -f libglnx/$(am__dirstamp) + -rm -f libglnx/tests/$(DEPDIR)/$(am__dirstamp) + -rm -f libglnx/tests/$(am__dirstamp) -rm -f src/libostree/$(DEPDIR)/$(am__dirstamp) -rm -f src/libostree/$(am__dirstamp) -rm -f src/libotutil/$(DEPDIR)/$(am__dirstamp) @@ -6844,19 +7019,20 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +@ENABLE_RUST_FALSE@clean-local: clean: clean-recursive clean-am: clean-binPROGRAMS clean-checkLTLIBRARIES clean-checkPROGRAMS \ clean-generic clean-installed_testLTLIBRARIES \ clean-installed_testPROGRAMS clean-libLTLIBRARIES \ - clean-libexecPROGRAMS clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS clean-ostree_bootPROGRAMS \ - clean-pkglibexecPROGRAMS clean-privlibLTLIBRARIES \ - clean-sbinPROGRAMS mostlyclean-am + clean-libexecPROGRAMS clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ + clean-ostree_bootPROGRAMS clean-pkglibexecPROGRAMS \ + clean-privlibLTLIBRARIES clean-sbinPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf bsdiff/$(DEPDIR) libglnx/$(DEPDIR) src/libostree/$(DEPDIR) src/libotutil/$(DEPDIR) src/ostree/$(DEPDIR) src/rofiles-fuse/$(DEPDIR) src/switchroot/$(DEPDIR) tests/$(DEPDIR) + -rm -rf bsdiff/$(DEPDIR) libglnx/$(DEPDIR) libglnx/tests/$(DEPDIR) src/libostree/$(DEPDIR) src/libotutil/$(DEPDIR) src/ostree/$(DEPDIR) src/rofiles-fuse/$(DEPDIR) src/switchroot/$(DEPDIR) tests/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -6920,7 +7096,7 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf bsdiff/$(DEPDIR) libglnx/$(DEPDIR) src/libostree/$(DEPDIR) src/libotutil/$(DEPDIR) src/ostree/$(DEPDIR) src/rofiles-fuse/$(DEPDIR) src/switchroot/$(DEPDIR) tests/$(DEPDIR) + -rm -rf bsdiff/$(DEPDIR) libglnx/$(DEPDIR) libglnx/tests/$(DEPDIR) src/libostree/$(DEPDIR) src/libotutil/$(DEPDIR) src/ostree/$(DEPDIR) src/rofiles-fuse/$(DEPDIR) src/switchroot/$(DEPDIR) tests/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -6963,16 +7139,17 @@ uninstall-man: uninstall-man1 uninstall-man5 install-data-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ - am--refresh check check-TESTS check-am clean clean-binPROGRAMS \ - clean-checkLTLIBRARIES clean-checkPROGRAMS clean-cscope \ - clean-generic clean-installed_testLTLIBRARIES \ + am--refresh check check-TESTS check-am check-local clean \ + clean-binPROGRAMS clean-checkLTLIBRARIES clean-checkPROGRAMS \ + clean-cscope clean-generic clean-installed_testLTLIBRARIES \ clean-installed_testPROGRAMS clean-libLTLIBRARIES \ - clean-libexecPROGRAMS clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS clean-ostree_bootPROGRAMS \ - clean-pkglibexecPROGRAMS clean-privlibLTLIBRARIES \ - clean-sbinPROGRAMS cscope cscopelist-am ctags ctags-am dist \ - dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ + clean-libexecPROGRAMS clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ + clean-ostree_bootPROGRAMS clean-pkglibexecPROGRAMS \ + clean-privlibLTLIBRARIES clean-sbinPROGRAMS cscope \ + cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ @@ -7034,6 +7211,21 @@ all-local: $(ALL_LOCAL_RULES) @BUILDOPT_INTROSPECTION_TRUE@include $(INTROSPECTION_MAKEFILE) +@ENABLE_RUST_TRUE@check-local: +@ENABLE_RUST_TRUE@ cd $(srcdir)/rust && CARGO_TARGET_DIR=$(abs_top_builddir)/target cargo test + +@ENABLE_RUST_TRUE@clean-local: +@ENABLE_RUST_TRUE@ cd $(srcdir)/rust && CARGO_TARGET_DIR=$(abs_top_builddir)/target cargo clean + +@ENABLE_RUST_TRUE@dist-hook: +@ENABLE_RUST_TRUE@ (cd $(distdir)/rust && \ +@ENABLE_RUST_TRUE@ cp $(abs_top_srcdir)/rust/Cargo.lock . && \ +@ENABLE_RUST_TRUE@ cargo vendor -q && \ +@ENABLE_RUST_TRUE@ mkdir .cargo && \ +@ENABLE_RUST_TRUE@ cp cargo-vendor-config .cargo/config) +@ENABLE_RUST_TRUE@$(bupsplitpath): Makefile $(BUPSPLIT_RUST_SOURCES) +@ENABLE_RUST_TRUE@ cd $(top_srcdir)/rust && CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build --verbose $(CARGO_RELEASE_ARGS) + src/libostree/ostree-enumtypes.h: src/libostree/ostree-enumtypes.h.template $(ENUM_TYPES) $(AM_V_GEN) $(GLIB_MKENUMS) \ --template $< \ diff --git a/README.md b/README.md index 369a8925..c985cd14 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,25 @@ -OSTree +libOSTree ====== New! See the docs online at [Read The Docs (OSTree)](https://ostree.readthedocs.org/en/latest/ ) ----- -OSTree is a tool that combines a "git-like" model for committing and -downloading bootable filesystem trees, along with a layer for -deploying them and managing the bootloader configuration. +This project is now known as "libOSTree", renamed from "OSTree"; the focus is on +the shared library. However, in most of the rest of the documentation, we will +use the term "OSTree", since it's slightly shorter, and changing all +documentation at once is impractical. We expect to transition to the new name +over time. -OSTree is like git in that it checksums individual files and has a -content-addressed-object store. It's unlike git in that it "checks -out" the files via hardlinks, and they should thus be immutable. -Therefore, another way to think of OSTree is that it's just a more -polished version of +libOSTree is a library and suite of command line tools that combines a +"git-like" model for committing and downloading bootable filesystem trees, along +with a layer for deploying them and managing the bootloader configuration. + +The core OSTree model is like git in that it checksums individual files and has +a content-addressed-object store. It's unlike git in that it "checks out" the +files via hardlinks, and they should thus be immutable. Therefore, another way +to think of OSTree is that it's just a more polished version +of [Linux VServer hardlinks](http://linux-vserver.org/index.php?title=util-vserver:Vhashify&oldid=2285). **Features:** @@ -32,26 +38,36 @@ use OSTree as a "deduplicating hardlink store". Projects using OSTree --------------------- -[rpm-ostree](https://github.com/projectatomic/rpm-ostree) is a tool -that uses OSTree as a shared library, and supports committing RPMs -into an OSTree repository, and deploying them on the client. This is -appropriate for "fixed purpose" systems. There is in progress work -for more sophisticated hybrid models, deeply integrating the RPM -packaging with OSTree. +[meta-updater](https://github.com/advancedtelematic/meta-updater) is +a layer available for [OpenEmbedded](http://www.openembedded.org/wiki/Main_Page) +systems. -[Project Atomic](http://www.projectatomic.io/) uses rpm-ostree to -provide a minimal host for Docker formatted Linux containers. -Replicating a base immutable OS, then using Docker for applications -meshes together two different tools with different tradeoffs. +[QtOTA](http://doc.qt.io/QtOTA/) is Qt's over-the-air update framework +which uses libostree. -[flatpak](https://github.com/alexlarsson/xdg-app) uses OSTree -for desktop application containers. +[rpm-ostree](https://github.com/projectatomic/rpm-ostree) is a next-generation +hybrid package/image system for [Fedora](https://getfedora.org/) and [CentOS](https://www.centos.org/), +used by the [Atomic Host](http://www.projectatomic.io/) project. +By default it uses libostree to atomically replicate a base OS (all dependency +resolution is done on the server), but it supports "package layering", where +additional RPMs can be layered on top of the base. This brings a "best of both worlds"" +model for image and package systems. + +[flatpak](https://github.com/flatpak/flatpak) uses libostree for desktop +application containers. Unlike most of the other systems here, flatpak does not +use the "libostree host system" aspects (e.g. bootloader management), just the +"git-like hardlink dedup". For example, flatpak supports a per-user OSTree +repository. + +[Endless OS](https://endlessos.com/) uses libostree for their host system as +well as flatpak. See +their [eos-updater](https://github.com/endlessm/eos-updater) +and [deb-ostree-builder](https://github.com/dbnicholson/deb-ostree-builder) +projects. [GNOME Continuous](https://wiki.gnome.org/Projects/GnomeContinuous) is -a custom build system designed for OSTree, using -[OpenEmbedded](http://www.openembedded.org/wiki/Main_Page) in concert -with a custom build system to do continuous delivery from hundreds of -git repositories. +where OSTree was born - as a high performance continuous delivery/testing +system for GNOME. Building -------- diff --git a/apidoc/Makefile.in b/apidoc/Makefile.in index d33bacbe..78ddfe5f 100644 --- a/apidoc/Makefile.in +++ b/apidoc/Makefile.in @@ -253,6 +253,8 @@ OBJEXT = @OBJEXT@ OSTREE_FEATURES = @OSTREE_FEATURES@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +OT_DEP_CURL_CFLAGS = @OT_DEP_CURL_CFLAGS@ +OT_DEP_CURL_LIBS = @OT_DEP_CURL_LIBS@ OT_DEP_E2P_CFLAGS = @OT_DEP_E2P_CFLAGS@ OT_DEP_E2P_LIBS = @OT_DEP_E2P_LIBS@ OT_DEP_GIO_UNIX_CFLAGS = @OT_DEP_GIO_UNIX_CFLAGS@ @@ -283,6 +285,7 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ +RUST_TARGET_SUBDIR = @RUST_TARGET_SUBDIR@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -312,6 +315,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ +cargo = @cargo@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -339,6 +343,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +rustc = @rustc@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/apidoc/html/index.html b/apidoc/html/index.html index 0ec9a6bf..ac902f05 100644 --- a/apidoc/html/index.html +++ b/apidoc/html/index.html @@ -14,7 +14,7 @@
-

for OSTree 2016.15

+

for OSTree 2017.3


diff --git a/apidoc/html/ostree-Content-addressed-object-store.html b/apidoc/html/ostree-Content-addressed-object-store.html index 32f2a50a..5a7cea62 100644 --- a/apidoc/html/ostree-Content-addressed-object-store.html +++ b/apidoc/html/ostree-Content-addressed-object-store.html @@ -41,7 +41,7 @@ -gboolean +gboolean ostree_repo_mode_from_string () @@ -73,7 +73,7 @@ -gboolean +gboolean ostree_repo_open () @@ -89,7 +89,7 @@ -gboolean +gboolean ostree_repo_get_disable_fsync () @@ -97,7 +97,7 @@ -gboolean +gboolean ostree_repo_is_system () @@ -105,7 +105,7 @@ -gboolean +gboolean ostree_repo_is_writable () @@ -113,7 +113,7 @@ -gboolean +gboolean ostree_repo_create () @@ -121,7 +121,7 @@ -GFile * +GFile * ostree_repo_get_path () @@ -137,7 +137,7 @@ -GKeyFile * +GKeyFile * ostree_repo_get_config () @@ -153,7 +153,7 @@ -GKeyFile * +GKeyFile * ostree_repo_copy_config () @@ -161,7 +161,7 @@ -gboolean +gboolean ostree_repo_remote_add () @@ -169,7 +169,7 @@ -gboolean +gboolean ostree_repo_remote_delete () @@ -177,7 +177,7 @@ -gboolean +gboolean ostree_repo_remote_change () @@ -193,7 +193,7 @@ -gboolean +gboolean ostree_repo_remote_get_url () @@ -201,7 +201,7 @@ -gboolean +gboolean ostree_repo_remote_get_gpg_verify () @@ -209,7 +209,7 @@ -gboolean +gboolean ostree_repo_remote_get_gpg_verify_summary () @@ -217,7 +217,7 @@ -gboolean +gboolean ostree_repo_remote_gpg_import () @@ -225,7 +225,7 @@ -gboolean +gboolean ostree_repo_remote_fetch_summary () @@ -233,7 +233,7 @@ -gboolean +gboolean ostree_repo_remote_fetch_summary_with_options () @@ -241,7 +241,15 @@ -gboolean +gboolean + + +ostree_repo_reload_config () + + + + +gboolean ostree_repo_get_remote_boolean_option () @@ -249,7 +257,7 @@ -gboolean +gboolean ostree_repo_get_remote_list_option () @@ -257,7 +265,7 @@ -gboolean +gboolean ostree_repo_get_remote_option () @@ -273,7 +281,7 @@ -gboolean +gboolean ostree_repo_write_config () @@ -281,7 +289,7 @@ -gboolean +gboolean ostree_repo_scan_hardlinks () @@ -289,7 +297,7 @@ -gboolean +gboolean ostree_repo_prepare_transaction () @@ -297,7 +305,7 @@ -gboolean +gboolean ostree_repo_commit_transaction () @@ -305,7 +313,7 @@ -gboolean +gboolean ostree_repo_abort_transaction () @@ -329,7 +337,7 @@ -gboolean +gboolean ostree_repo_set_ref_immediate () @@ -337,7 +345,7 @@ -gboolean +gboolean ostree_repo_set_cache_dir () @@ -345,7 +353,7 @@ -gboolean +gboolean ostree_repo_sign_delta () @@ -353,7 +361,7 @@ -gboolean +gboolean ostree_repo_has_object () @@ -361,7 +369,7 @@ -gboolean +gboolean ostree_repo_write_metadata () @@ -377,7 +385,7 @@ -gboolean +gboolean ostree_repo_write_metadata_finish () @@ -385,7 +393,7 @@ -gboolean +gboolean ostree_repo_write_content () @@ -393,7 +401,7 @@ -gboolean +gboolean ostree_repo_write_metadata_trusted () @@ -401,7 +409,7 @@ -gboolean +gboolean ostree_repo_write_metadata_stream_trusted () @@ -409,7 +417,7 @@ -gboolean +gboolean ostree_repo_write_content_trusted () @@ -425,7 +433,7 @@ -gboolean +gboolean ostree_repo_write_content_finish () @@ -433,7 +441,7 @@ -gboolean +gboolean ostree_repo_resolve_rev () @@ -441,7 +449,7 @@ -gboolean +gboolean ostree_repo_resolve_rev_ext () @@ -449,7 +457,7 @@ -gboolean +gboolean ostree_repo_list_refs () @@ -457,7 +465,7 @@ -gboolean +gboolean ostree_repo_list_refs_ext () @@ -465,7 +473,7 @@ -gboolean +gboolean ostree_repo_remote_list_refs () @@ -473,7 +481,7 @@ -gboolean +gboolean ostree_repo_load_variant () @@ -481,7 +489,7 @@ -gboolean +gboolean ostree_repo_load_commit () @@ -489,7 +497,7 @@ -gboolean +gboolean ostree_repo_load_variant_if_exists () @@ -497,7 +505,7 @@ -gboolean +gboolean ostree_repo_load_file () @@ -505,7 +513,7 @@ -gboolean +gboolean ostree_repo_load_object_stream () @@ -513,7 +521,7 @@ -gboolean +gboolean ostree_repo_query_object_storage_size () @@ -521,7 +529,7 @@ -gboolean +gboolean ostree_repo_import_object_from () @@ -529,7 +537,7 @@ -gboolean +gboolean ostree_repo_import_object_from_with_trust () @@ -537,7 +545,7 @@ -gboolean +gboolean ostree_repo_import_archive_to_mtree () @@ -545,7 +553,7 @@ -gboolean +gboolean ostree_repo_export_tree_to_archive () @@ -553,7 +561,7 @@ -gboolean +gboolean ostree_repo_delete_object () @@ -577,7 +585,7 @@ -GVariant * +GVariant * (*OstreeRepoCommitModifierXattrCallback) () @@ -649,7 +657,7 @@ -GType +GType ostree_repo_devino_cache_get_type () @@ -657,7 +665,7 @@ -gboolean +gboolean ostree_repo_write_directory_to_mtree () @@ -665,7 +673,7 @@ -gboolean +gboolean ostree_repo_write_dfd_to_mtree () @@ -673,7 +681,7 @@ -gboolean +gboolean ostree_repo_write_archive_to_mtree () @@ -681,7 +689,7 @@ -gboolean +gboolean ostree_repo_write_mtree () @@ -689,7 +697,7 @@ -gboolean +gboolean ostree_repo_write_commit () @@ -697,7 +705,7 @@ -gboolean +gboolean ostree_repo_write_commit_with_time () @@ -705,7 +713,7 @@ -gboolean +gboolean ostree_repo_read_commit_detached_metadata () @@ -713,7 +721,7 @@ -gboolean +gboolean ostree_repo_write_commit_detached_metadata () @@ -721,7 +729,7 @@ -gboolean +gboolean ostree_repo_checkout_tree () @@ -729,7 +737,7 @@ -gboolean +gboolean ostree_repo_checkout_tree_at () @@ -737,7 +745,7 @@ -gboolean +gboolean ostree_repo_checkout_at () @@ -745,7 +753,7 @@ -gboolean +gboolean ostree_repo_checkout_gc () @@ -753,7 +761,7 @@ -gboolean +gboolean ostree_repo_read_commit () @@ -761,7 +769,7 @@ -gboolean +gboolean ostree_repo_list_objects () @@ -769,7 +777,7 @@ -gboolean +gboolean ostree_repo_list_commit_objects_starting_with () @@ -777,7 +785,7 @@ -gboolean +gboolean ostree_repo_list_static_delta_names () @@ -785,7 +793,7 @@ -gboolean +gboolean ostree_repo_static_delta_generate () @@ -793,7 +801,7 @@ -gboolean +gboolean ostree_repo_static_delta_execute_offline () @@ -801,7 +809,7 @@ -GHashTable * +GHashTable * ostree_repo_traverse_new_reachable () @@ -809,7 +817,7 @@ -gboolean +gboolean ostree_repo_traverse_commit () @@ -817,7 +825,7 @@ -gboolean +gboolean ostree_repo_traverse_commit_union () @@ -857,7 +865,7 @@ -gboolean +gboolean ostree_repo_commit_traverse_iter_init_commit () @@ -865,7 +873,7 @@ -gboolean +gboolean ostree_repo_commit_traverse_iter_init_dirtree () @@ -881,7 +889,7 @@ -gboolean +gboolean ostree_repo_prune () @@ -889,7 +897,7 @@ -gboolean +gboolean ostree_repo_prune_static_deltas () @@ -897,7 +905,7 @@ -gboolean +gboolean ostree_repo_prune_from_reachable () @@ -905,7 +913,7 @@ -gboolean +gboolean ostree_repo_pull () @@ -913,7 +921,7 @@ -gboolean +gboolean ostree_repo_pull_one_dir () @@ -921,7 +929,7 @@ -gboolean +gboolean ostree_repo_pull_with_options () @@ -937,7 +945,7 @@ -gboolean +gboolean ostree_repo_sign_commit () @@ -945,7 +953,7 @@ -gboolean +gboolean ostree_repo_append_gpg_signature () @@ -953,7 +961,7 @@ -gboolean +gboolean ostree_repo_add_gpg_signature_summary () @@ -969,7 +977,7 @@ -gboolean +gboolean ostree_repo_verify_commit () @@ -1001,7 +1009,7 @@ -gboolean +gboolean ostree_repo_regenerate_summary () @@ -1107,16 +1115,16 @@ with

Functions

ostree_repo_mode_from_string ()

-
gboolean
+
gboolean
 ostree_repo_mode_from_string (const char *mode,
                               OstreeRepoMode *out_mode,
-                              GError **error);
+ GError **error);

ostree_repo_new ()

OstreeRepo *
-ostree_repo_new (GFile *path);
+ostree_repo_new (GFile *path);

Parameters

@@ -1143,8 +1151,8 @@ ostree_repo_new (

ostree_repo_new_for_sysroot_path ()

OstreeRepo *
-ostree_repo_new_for_sysroot_path (GFile *repo_path,
-                                  GFile *sysroot_path);
+ostree_repo_new_for_sysroot_path (GFile *repo_path, + GFile *sysroot_path);

Creates a new OstreeRepo instance, taking the system root path explicitly instead of assuming "/".

@@ -1195,17 +1203,17 @@ Otherwise use the path in the OSTREE_REPO environment variable

ostree_repo_open ()

-
gboolean
+
gboolean
 ostree_repo_open (OstreeRepo *self,
-                  GCancellable *cancellable,
-                  GError **error);
+ GCancellable *cancellable, + GError **error);

ostree_repo_set_disable_fsync ()

void
 ostree_repo_set_disable_fsync (OstreeRepo *self,
-                               gboolean disable_fsync);
+ gboolean disable_fsync);

Disable requests to fsync() to stable storage during commits. This option should only be used by build system tools which are creating disposable virtual machines, or have higher level mechanisms for @@ -1226,7 +1234,7 @@ ensuring data consistency.

- + @@ -1236,7 +1244,7 @@ ensuring data consistency.


ostree_repo_get_disable_fsync ()

-
gboolean
+
gboolean
 ostree_repo_get_disable_fsync (OstreeRepo *self);

For more information see ostree_repo_set_disable_fsync().

@@ -1262,7 +1270,7 @@ ostree_repo_get_disable_fsync (

ostree_repo_is_system ()

-
gboolean
+
gboolean
 ostree_repo_is_system (OstreeRepo *repo);

Parameters

@@ -1281,15 +1289,15 @@ ostree_repo_is_system (

Returns

-

TRUE if this repository is the root-owned system global repository

+

TRUE if this repository is the root-owned system global repository


ostree_repo_is_writable ()

-
gboolean
+
gboolean
 ostree_repo_is_writable (OstreeRepo *self,
-                         GError **error);
+ GError **error);

Returns whether the repository is writable by the current user. If the repository is not writable, the error indicates why.

@@ -1309,7 +1317,7 @@ If the repository is not writable, the error<
- + @@ -1317,17 +1325,17 @@ If the repository is not writable, the error<

Returns

-

TRUE if this repository is writable

+

TRUE if this repository is writable


ostree_repo_create ()

-
gboolean
+
gboolean
 ostree_repo_create (OstreeRepo *self,
                     OstreeRepoMode mode,
-                    GCancellable *cancellable,
-                    GError **error);
+ GCancellable *cancellable, + GError **error);

Create the underlying structure on disk for the repository, and call ostree_repo_open() on the result, preparing it for use.

Since version 2016.8, this function will succeed on an existing @@ -1371,7 +1379,7 @@ do so.


ostree_repo_get_path ()

-
GFile *
+
GFile *
 ostree_repo_get_path (OstreeRepo *self);

Returns

@@ -1388,7 +1396,7 @@ ostree_repo_get_mode (

ostree_repo_get_config ()

-
GKeyFile *
+
GKeyFile *
 ostree_repo_get_config (OstreeRepo *self);

Returns

@@ -1429,7 +1437,7 @@ repository (to see whether a ref was written).


ostree_repo_copy_config ()

-
GKeyFile *
+
GKeyFile *
 ostree_repo_copy_config (OstreeRepo *self);

Returns

@@ -1440,24 +1448,24 @@ ostree_repo_copy_config (

ostree_repo_remote_add ()

-
gboolean
+
gboolean
 ostree_repo_remote_add (OstreeRepo *self,
                         const char *name,
                         const char *url,
-                        GVariant *options,
-                        GCancellable *cancellable,
-                        GError **error);
+ GVariant *options, + GCancellable *cancellable, + GError **error);

Create a new remote named name pointing to url . If options is -provided, then it will be mapped to GKeyFile entries, where the +provided, then it will be mapped to GKeyFile entries, where the GVariant dictionary key is an option string, and the value is mapped as follows:

Parameters

@@ -1505,11 +1513,11 @@ mapped as follows:


ostree_repo_remote_delete ()

-
gboolean
+
gboolean
 ostree_repo_remote_delete (OstreeRepo *self,
                            const char *name,
-                           GCancellable *cancellable,
-                           GError **error);
+ GCancellable *cancellable, + GError **error);

Delete the remote named name . It is an error if the provided remote does not exist.

@@ -1549,15 +1557,15 @@ remote does not exist.


ostree_repo_remote_change ()

-
gboolean
+
gboolean
 ostree_repo_remote_change (OstreeRepo *self,
-                           GFile *sysroot,
+                           GFile *sysroot,
                            OstreeRepoRemoteChange changeop,
                            const char *name,
                            const char *url,
-                           GVariant *options,
-                           GCancellable *cancellable,
-                           GError **error);
+ GVariant *options, + GCancellable *cancellable, + GError **error);

A combined function handling the equivalent of ostree_repo_remote_add(), ostree_repo_remote_delete(), with more options.

@@ -1619,9 +1627,9 @@ options.

ostree_repo_remote_list ()

char **
 ostree_repo_remote_list (OstreeRepo *self,
-                         guint *out_n_remotes);
+ guint *out_n_remotes);

List available remote names in an OstreeRepo. Remote names are sorted -alphabetically. If no remotes are available the function returns NULL.

+alphabetically. If no remotes are available the function returns NULL.

Parameters

disable_fsync

If TRUE, do not fsync

If TRUE, do not fsync

 

error

a GError

a GError

 
@@ -1646,7 +1654,7 @@ alphabetically. If no remotes are available the function returns

Returns

-

a NULL-terminated +

a NULL-terminated array of remote names.

[array length=out_n_remotes][transfer full]

@@ -1654,11 +1662,11 @@ array of remote names.


ostree_repo_remote_get_url ()

-
gboolean
+
gboolean
 ostree_repo_remote_get_url (OstreeRepo *self,
                             const char *name,
                             char **out_url,
-                            GError **error);
+ GError **error);

Return the URL of the remote named name through out_url . It is an @@ -1697,17 +1705,17 @@ error if the provided remote does not exist.

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure


ostree_repo_remote_get_gpg_verify ()

-
gboolean
+
gboolean
 ostree_repo_remote_get_gpg_verify (OstreeRepo *self,
                                    const char *name,
-                                   gboolean *out_gpg_verify,
-                                   GError **error);
+ gboolean *out_gpg_verify, + GError **error);

Return whether GPG verification is enabled for the remote named name through out_gpg_verify @@ -1747,18 +1755,18 @@ not exist.

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure


ostree_repo_remote_get_gpg_verify_summary ()

-
gboolean
+
gboolean
 ostree_repo_remote_get_gpg_verify_summary
                                (OstreeRepo *self,
                                 const char *name,
-                                gboolean *out_gpg_verify_summary,
-                                GError **error);
+ gboolean *out_gpg_verify_summary, + GError **error);

Return whether GPG verification of the summary is enabled for the remote named name through out_gpg_verify_summary @@ -1798,27 +1806,27 @@ remote does not exist.

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure


ostree_repo_remote_gpg_import ()

-
gboolean
+
gboolean
 ostree_repo_remote_gpg_import (OstreeRepo *self,
                                const char *name,
-                               GInputStream *source_stream,
+                               GInputStream *source_stream,
                                const char * const *key_ids,
-                               guint *out_imported,
-                               GCancellable *cancellable,
-                               GError **error);
+ guint *out_imported, + GCancellable *cancellable, + GError **error);

Imports one or more GPG keys from the open source_stream , or from the user's personal keyring if source_stream - is NULL. The key_ids + is NULL. The key_ids array can optionally restrict which keys are imported. If key_ids - is NULL, + is NULL, then all keys are imported.

The imported keys will be used to conduct GPG verification when pulling from the remote named name @@ -1844,28 +1852,28 @@ from the remote named name

- + - + +keys, or NULL.

- + - + @@ -1873,19 +1881,19 @@ keys, or

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure


ostree_repo_remote_fetch_summary ()

-
gboolean
+
gboolean
 ostree_repo_remote_fetch_summary (OstreeRepo *self,
                                   const char *name,
-                                  GBytes **out_summary,
-                                  GBytes **out_signatures,
-                                  GCancellable *cancellable,
-                                  GError **error);
+ GBytes **out_summary, + GBytes **out_signatures, + GCancellable *cancellable, + GError **error);

Tries to fetch the summary file and any GPG signatures on the summary file over HTTP, and returns the binary data in out_summary and out_signatures @@ -1897,8 +1905,8 @@ respectively.

. Likewise if the summary file is not signed, out_signatures is set to NULL -. In either case the function still returns TRUE.

-

Parse the summary data into a GVariant using g_variant_new_from_bytes() +. In either case the function still returns TRUE.

+

Parse the summary data into a GVariant using g_variant_new_from_bytes() with OSTREE_SUMMARY_GVARIANT_FORMAT as the format string.

Parameters

@@ -1922,23 +1930,23 @@ with

out_summary

+NULL.

+signature data, or NULL.

- + - + @@ -1946,21 +1954,21 @@ signature data, or

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure


ostree_repo_remote_fetch_summary_with_options ()

-
gboolean
+
gboolean
 ostree_repo_remote_fetch_summary_with_options
                                (OstreeRepo *self,
                                 const char *name,
-                                GVariant *options,
-                                GBytes **out_summary,
-                                GBytes **out_signatures,
-                                GCancellable *cancellable,
-                                GError **error);
+ GVariant *options, + GBytes **out_summary, + GBytes **out_signatures, + GCancellable *cancellable, + GError **error);

Like ostree_repo_remote_fetch_summary(), but supports an extensible set of flags. The following are currently defined:

  • override-url (s): Fetch summary from this URL if remote specifies no metalink in options

@@ -1991,23 +1999,23 @@ The following are currently defined:

+NULL.

+signature data, or NULL.

- + - + @@ -2015,26 +2023,65 @@ signature data, or

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure

+ + +
+
+

ostree_repo_reload_config ()

+
gboolean
+ostree_repo_reload_config (OstreeRepo *self,
+                           GCancellable *cancellable,
+                           GError **error);
+

By default, an OstreeRepo will cache the remote configuration and its +own repo/config data. This API can be used to reload it.

+
+

Parameters

+

source_stream

a GInputStream, or NULL.

a GInputStream, or NULL.

[allow-none]

key_ids

a NULL-terminated array of GPG key IDs, or NULL.

a NULL-terminated array of GPG key IDs, or NULL.

[array zero-terminated=1][element-type utf8][allow-none]

out_imported

return location for the number of imported -keys, or NULL.

[allow-none]

cancellable

a GCancellable

a GCancellable

 

error

a GError

a GError

 

return location for raw summary data, or -NULL.

[out][optional]

out_signatures

return location for raw summary -signature data, or NULL.

[out][optional]

cancellable

a GCancellable

a GCancellable

 

error

a GError

a GError

 

out_summary

return location for raw summary data, or -NULL.

[out][optional]

out_signatures

return location for raw summary -signature data, or NULL.

[out][optional]

cancellable

a GCancellable

a GCancellable

 

error

a GError

a GError

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

self

repo

 

cancellable

cancellable

 

error

error

 

ostree_repo_get_remote_boolean_option ()

-
gboolean
+
gboolean
 ostree_repo_get_remote_boolean_option (OstreeRepo *self,
                                        const char *remote_name,
                                        const char *option_name,
-                                       gboolean default_value,
-                                       gboolean *out_value,
-                                       GError **error);
+ gboolean default_value, + gboolean *out_value, + GError **error);

OSTree remotes are represented by keyfile groups, formatted like: [remote "remotename"]. This function returns a value named option_name underneath that group, and returns it as a boolean. If the option is not set, out_value will be set to default_value -.

+. If an +error is returned, out_value + will be set to FALSE.

Parameters

@@ -2080,25 +2127,26 @@ is not present

Returns

-

TRUE on success, otherwise FALSE with error +

TRUE on success, otherwise FALSE with error set


ostree_repo_get_remote_list_option ()

-
gboolean
+
gboolean
 ostree_repo_get_remote_list_option (OstreeRepo *self,
                                     const char *remote_name,
                                     const char *option_name,
                                     char ***out_value,
-                                    GError **error);
+ GError **error);

OSTree remotes are represented by keyfile groups, formatted like: [remote "remotename"]. This function returns a value named option_name -underneath that group, and returns it as an zero terminated array of strings. -If the option is not set, out_value - will be set to NULL.

+underneath that group, and returns it as a zero terminated array of strings. +If the option is not set, or if an error is returned, out_value + will be set +to NULL.

Parameters

@@ -2127,7 +2175,7 @@ If the option is not set, out_value +g_strfreev().

@@ -2140,26 +2188,27 @@ of strings. The list should be freed with

Returns

-

TRUE on success, otherwise FALSE with error +

TRUE on success, otherwise FALSE with error set


ostree_repo_get_remote_option ()

-
gboolean
+
gboolean
 ostree_repo_get_remote_option (OstreeRepo *self,
                                const char *remote_name,
                                const char *option_name,
                                const char *default_value,
                                char **out_value,
-                               GError **error);
+ GError **error);

OSTree remotes are represented by keyfile groups, formatted like: [remote "remotename"]. This function returns a value named option_name underneath that group, or default_value if the remote exists but not the -option name.

+option name. If an error is returned, out_value + will be set to NULL.

Parameters

out_value

location to store the list of strings. The list should be freed with -g_strfreev().

[out][array zero-terminated=1]
@@ -2205,7 +2254,7 @@ is not present.

Returns

-

TRUE on success, otherwise FALSE with error +

TRUE on success, otherwise FALSE with error set

@@ -2233,17 +2282,17 @@ called.

Returns

-

Parent repository, or NULL if none.

+

Parent repository, or NULL if none.

[transfer none]


ostree_repo_write_config ()

-
gboolean
+
gboolean
 ostree_repo_write_config (OstreeRepo *self,
-                          GKeyFile *new_config,
-                          GError **error);
+ GKeyFile *new_config, + GError **error);

Save new_config in place of this repository's config file. Note that new_config @@ -2270,7 +2319,7 @@ simply adds a reference.

- + @@ -2280,10 +2329,10 @@ simply adds a reference.


ostree_repo_scan_hardlinks ()

-
gboolean
+
gboolean
 ostree_repo_scan_hardlinks (OstreeRepo *self,
-                            GCancellable *cancellable,
-                            GError **error);
+ GCancellable *cancellable, + GError **error);

When ostree builds a mutable tree from directory like in ostree_repo_write_directory_to_mtree(), it has to scan all files that you pass in and compute their checksums. If your commit contains hardlinks from @@ -2324,11 +2373,11 @@ before you call ostree_write_directory_to_mtree()


ostree_repo_prepare_transaction ()

-
gboolean
+
gboolean
 ostree_repo_prepare_transaction (OstreeRepo *self,
-                                 gboolean *out_transaction_resume,
-                                 GCancellable *cancellable,
-                                 GError **error);
+ gboolean *out_transaction_resume, + GCancellable *cancellable, + GError **error);

Starts or resumes a transaction. In order to write to a repo, you need to start a transaction. You can complete the transaction with ostree_repo_commit_transaction(), or abort the transaction with @@ -2373,11 +2422,11 @@ pulls use per-commit state/.commitpartial files.

ostree_repo_commit_transaction ()

-
gboolean
+
gboolean
 ostree_repo_commit_transaction (OstreeRepo *self,
                                 OstreeRepoTransactionStats *out_stats,
-                                GCancellable *cancellable,
-                                GError **error);
+ GCancellable *cancellable, + GError **error);

Complete the transaction. Any refs set with ostree_repo_transaction_set_ref() or ostree_repo_transaction_set_refspec() will be written out.

@@ -2418,10 +2467,10 @@ that happened during this transaction.


ostree_repo_abort_transaction ()

-
gboolean
+
gboolean
 ostree_repo_abort_transaction (OstreeRepo *self,
-                               GCancellable *cancellable,
-                               GError **error);
+ GCancellable *cancellable, + GError **error);

@@ -2471,13 +2520,13 @@ ostree_repo_transaction_set_ref (const char *ref, const char *checksum);

If checksum - is not NULL, then record it as the target of ref named + is not NULL, then record it as the target of ref named ref ; if remote is provided, the ref will appear to originate from that remote.

Otherwise, if checksum - is NULL, then record that the ref should + is NULL, then record that the ref should be deleted.

The change will not be written out immediately, but when the transaction is completed with ostree_repo_commit_transaction(). If the transaction @@ -2519,13 +2568,13 @@ be made to the repository.


ostree_repo_set_ref_immediate ()

-
gboolean
+
gboolean
 ostree_repo_set_ref_immediate (OstreeRepo *self,
                                const char *remote,
                                const char *ref,
                                const char *checksum,
-                               GCancellable *cancellable,
-                               GError **error);
+ GCancellable *cancellable, + GError **error);

This is like ostree_repo_transaction_set_ref(), except it may be invoked outside of a transaction. This is presently safe for the case where we're creating or overwriting an existing ref.

@@ -2555,7 +2604,7 @@ case where we're creating or overwriting an existing ref.

- + @@ -2575,12 +2624,12 @@ case where we're creating or overwriting an existing ref.


ostree_repo_set_cache_dir ()

-
gboolean
+
gboolean
 ostree_repo_set_cache_dir (OstreeRepo *self,
                            int dfd,
                            const char *path,
-                           GCancellable *cancellable,
-                           GError **error);
+ GCancellable *cancellable, + GError **error);

Set a custom location for the cache directory used for e.g. per-remote summary caches. Setting this manually is useful when doing operations on a system repo as a user because you don't have @@ -2612,12 +2661,12 @@ write permissions in the repo, where the cache is normally stored.

- + - + @@ -2627,31 +2676,31 @@ write permissions in the repo, where the cache is normally stored.


ostree_repo_sign_delta ()

-
gboolean
+
gboolean
 ostree_repo_sign_delta (OstreeRepo *self,
-                        const gchar *from_commit,
-                        const gchar *to_commit,
-                        const gchar *key_id,
-                        const gchar *homedir,
-                        GCancellable *cancellable,
-                        GError **error);
+ const gchar *from_commit, + const gchar *to_commit, + const gchar *key_id, + const gchar *homedir, + GCancellable *cancellable, + GError **error);

This function is deprecated, sign the summary file instead. Add a GPG signature to a static delta.


ostree_repo_has_object ()

-
gboolean
+
gboolean
 ostree_repo_has_object (OstreeRepo *self,
                         OstreeObjectType objtype,
                         const char *checksum,
-                        gboolean *out_have_object,
-                        GCancellable *cancellable,
-                        GError **error);
+ gboolean *out_have_object, + GCancellable *cancellable, + GError **error);

Set out_have_object - to TRUE if self + to TRUE if self contains the given object; -FALSE otherwise.

+FALSE otherwise.

Parameters

error

a GError

a GError

 

checksum

The checksum to point it to, or NULL to unset.

The checksum to point it to, or NULL to unset.

[allow-none]

cancellable

a GCancellable

a GCancellable

 

error

a GError

a GError

 
@@ -2678,7 +2727,7 @@ ostree_repo_has_object (

out_have_object

-
+ @@ -2696,26 +2745,26 @@ ostree_repo_has_object (

Returns

-

FALSE if an unexpected error occurred, TRUE otherwise

+

FALSE if an unexpected error occurred, TRUE otherwise


ostree_repo_write_metadata ()

-
gboolean
+
gboolean
 ostree_repo_write_metadata (OstreeRepo *self,
                             OstreeObjectType objtype,
                             const char *expected_checksum,
-                            GVariant *object,
-                            guchar **out_csum,
-                            GCancellable *cancellable,
-                            GError **error);
+ GVariant *object, + guchar **out_csum, + GCancellable *cancellable, + GError **error);

Store the metadata object variant . Return the checksum as out_csum .

If expected_checksum - is not NULL, verify it against the + is not NULL, verify it against the computed checksum.

Parameters

@@ -2772,10 +2821,10 @@ computed checksum.

ostree_repo_write_metadata_async (OstreeRepo *self, OstreeObjectType objtype, const char *expected_checksum, - GVariant *object, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); + GVariant *object, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data);

Asynchronously store the metadata object variant . If provided, the checksum expected_checksum @@ -2832,23 +2881,23 @@ the checksum expected_checksum


ostree_repo_write_metadata_finish ()

-
gboolean
+
gboolean
 ostree_repo_write_metadata_finish (OstreeRepo *self,
-                                   GAsyncResult *result,
-                                   guchar **out_csum,
-                                   GError **error);
+ GAsyncResult *result, + guchar **out_csum, + GError **error);

ostree_repo_write_content ()

-
gboolean
+
gboolean
 ostree_repo_write_content (OstreeRepo *self,
                            const char *expected_checksum,
-                           GInputStream *object_input,
-                           guint64 length,
-                           guchar **out_csum,
-                           GCancellable *cancellable,
-                           GError **error);
+ GInputStream *object_input, + guint64 length, + guchar **out_csum, + GCancellable *cancellable, + GError **error);

Store the content object streamed as object_input , with total length length @@ -2907,13 +2956,13 @@ be returned as out_csum


ostree_repo_write_metadata_trusted ()

-
gboolean
+
gboolean
 ostree_repo_write_metadata_trusted (OstreeRepo *self,
                                     OstreeObjectType objtype,
                                     const char *checksum,
-                                    GVariant *variant,
-                                    GCancellable *cancellable,
-                                    GError **error);
+ GVariant *variant, + GCancellable *cancellable, + GError **error);

Store the metadata object variant ; the provided checksum is @@ -2964,15 +3013,15 @@ trusted.


ostree_repo_write_metadata_stream_trusted ()

-
gboolean
+
gboolean
 ostree_repo_write_metadata_stream_trusted
                                (OstreeRepo *self,
                                 OstreeObjectType objtype,
                                 const char *checksum,
-                                GInputStream *object_input,
-                                guint64 length,
-                                GCancellable *cancellable,
-                                GError **error);
+ GInputStream *object_input, + guint64 length, + GCancellable *cancellable, + GError **error);

Store the metadata object variant ; the provided checksum is @@ -3028,13 +3077,13 @@ trusted.


ostree_repo_write_content_trusted ()

-
gboolean
+
gboolean
 ostree_repo_write_content_trusted (OstreeRepo *self,
                                    const char *checksum,
-                                   GInputStream *object_input,
-                                   guint64 length,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GInputStream *object_input, + guint64 length, + GCancellable *cancellable, + GError **error);

Store the content object streamed as object_input , with total length length @@ -3093,11 +3142,11 @@ disk, for example.

void
 ostree_repo_write_content_async (OstreeRepo *self,
                                  const char *expected_checksum,
-                                 GInputStream *object,
-                                 guint64 length,
-                                 GCancellable *cancellable,
-                                 GAsyncReadyCallback callback,
-                                 gpointer user_data);
+ GInputStream *object, + guint64 length, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data);

Asynchronously store the content object object . If provided, the checksum expected_checksum @@ -3155,11 +3204,11 @@ checksum expected_checksum


ostree_repo_write_content_finish ()

-
gboolean
+
gboolean
 ostree_repo_write_content_finish (OstreeRepo *self,
-                                  GAsyncResult *result,
-                                  guchar **out_csum,
-                                  GError **error);
+ GAsyncResult *result, + guchar **out_csum, + GError **error);

Completes an invocation of ostree_repo_write_content_async().

Parameters

@@ -3177,7 +3226,7 @@ ostree_repo_write_content_finish (
- + @@ -3187,7 +3236,7 @@ ostree_repo_write_content_finish ( - + @@ -3197,12 +3246,12 @@ ostree_repo_write_content_finish (

ostree_repo_resolve_rev ()

-
gboolean
+
gboolean
 ostree_repo_resolve_rev (OstreeRepo *self,
                          const char *refspec,
-                         gboolean allow_noent,
+                         gboolean allow_noent,
                          char **out_rev,
-                         GError **error);
+ GError **error);

Look up the given refspec, returning the checksum it references in the parameter out_rev . Will fall back on remote directory if cannot @@ -3233,7 +3282,7 @@ find the given refspec in local.

- @@ -3249,13 +3298,13 @@ is true and it does not exist.


ostree_repo_resolve_rev_ext ()

-
gboolean
+
gboolean
 ostree_repo_resolve_rev_ext (OstreeRepo *self,
                              const char *refspec,
-                             gboolean allow_noent,
+                             gboolean allow_noent,
                              OstreeRepoResolveRevExtFlags flags,
                              char **out_rev,
-                             GError **error);
+ GError **error);

Look up the given refspec, returning the checksum it references in the parameter out_rev . Differently from ostree_repo_resolve_rev(), @@ -3292,7 +3341,7 @@ local ref is specified but not found.

- @@ -3308,14 +3357,14 @@ is true and it does not exist.


ostree_repo_list_refs ()

-
gboolean
+
gboolean
 ostree_repo_list_refs (OstreeRepo *self,
                        const char *refspec_prefix,
-                       GHashTable **out_all_refs,
-                       GCancellable *cancellable,
-                       GError **error);
+ GHashTable **out_all_refs, + GCancellable *cancellable, + GError **error);

If refspec_prefix - is NULL, list all local and remote refspecs, + is NULL, list all local and remote refspecs, with their current values in out_all_refs . Otherwise, only list refspecs which have refspec_prefix @@ -3361,15 +3410,15 @@ refspecs which have refspec_prefix


ostree_repo_list_refs_ext ()

-
gboolean
+
gboolean
 ostree_repo_list_refs_ext (OstreeRepo *self,
                            const char *refspec_prefix,
-                           GHashTable **out_all_refs,
+                           GHashTable **out_all_refs,
                            OstreeRepoListRefsExtFlags flags,
-                           GCancellable *cancellable,
-                           GError **error);
+ GCancellable *cancellable, + GError **error);

If refspec_prefix - is NULL, list all local and remote refspecs, + is NULL, list all local and remote refspecs, with their current values in out_all_refs . Otherwise, only list refspecs which have refspec_prefix @@ -3422,12 +3471,12 @@ name.


ostree_repo_remote_list_refs ()

-
gboolean
+
gboolean
 ostree_repo_remote_list_refs (OstreeRepo *self,
                               const char *remote_name,
-                              GHashTable **out_all_refs,
-                              GCancellable *cancellable,
-                              GError **error);
+ GHashTable **out_all_refs, + GCancellable *cancellable, + GError **error);

Parameters

TRUE if repository contains object.

TRUE if repository contains object.

[out]

result

a GAsyncResult

a GAsyncResult

 

error

a GError

a GError

 

out_rev

A checksum,or NULL if allow_noent +

A checksum,or NULL if allow_noent is true and it does not exist.

[out][transfer full]

out_rev

A checksum,or NULL if allow_noent +

A checksum,or NULL if allow_noent is true and it does not exist.

[out][transfer full]
@@ -3469,12 +3518,12 @@ ostree_repo_remote_list_refs (

ostree_repo_load_variant ()

-
gboolean
+
gboolean
 ostree_repo_load_variant (OstreeRepo *self,
                           OstreeObjectType objtype,
                           const char *sha256,
-                          GVariant **out_variant,
-                          GError **error);
+ GVariant **out_variant, + GError **error);

Load the metadata object sha256 of type objtype , storing the @@ -3521,12 +3570,12 @@ result in out_variant


ostree_repo_load_commit ()

-
gboolean
+
gboolean
 ostree_repo_load_commit (OstreeRepo *self,
                          const char *checksum,
-                         GVariant **out_commit,
+                         GVariant **out_commit,
                          OstreeRepoCommitState *out_state,
-                         GError **error);
+ GError **error);

A version of ostree_repo_load_variant() specialized to commits, capable of returning extended state information. Currently the only extended state is OSTREE_REPO_COMMIT_STATE_PARTIAL, which @@ -3572,18 +3621,18 @@ means that only a sub-path of the commit is available.


ostree_repo_load_variant_if_exists ()

-
gboolean
+
gboolean
 ostree_repo_load_variant_if_exists (OstreeRepo *self,
                                     OstreeObjectType objtype,
                                     const char *sha256,
-                                    GVariant **out_variant,
-                                    GError **error);
+ GVariant **out_variant, + GError **error);

Attempt to load the metadata object sha256 of type objtype if it exists, storing the result in out_variant . If it doesn't exist, -NULL is returned.

+NULL is returned.

Parameters

@@ -3625,14 +3674,14 @@ exists, storing the result in out_variant

ostree_repo_load_file ()

-
gboolean
+
gboolean
 ostree_repo_load_file (OstreeRepo *self,
                        const char *checksum,
-                       GInputStream **out_input,
-                       GFileInfo **out_file_info,
-                       GVariant **out_xattrs,
-                       GCancellable *cancellable,
-                       GError **error);
+ GInputStream **out_input, + GFileInfo **out_file_info, + GVariant **out_xattrs, + GCancellable *cancellable, + GError **error);

Load content object, decomposing it into three parts: the actual content (for regular files), the metadata, and extended attributes.

@@ -3686,14 +3735,14 @@ content (for regular files), the metadata, and extended attributes.


ostree_repo_load_object_stream ()

-
gboolean
+
gboolean
 ostree_repo_load_object_stream (OstreeRepo *self,
                                 OstreeObjectType objtype,
                                 const char *checksum,
-                                GInputStream **out_input,
-                                guint64 *out_size,
-                                GCancellable *cancellable,
-                                GError **error);
+ GInputStream **out_input, + guint64 *out_size, + GCancellable *cancellable, + GError **error);

Load object as a stream; useful when copying objects between repositories.

@@ -3748,13 +3797,13 @@ repositories.


ostree_repo_query_object_storage_size ()

-
gboolean
+
gboolean
 ostree_repo_query_object_storage_size (OstreeRepo *self,
                                        OstreeObjectType objtype,
                                        const char *sha256,
-                                       guint64 *out_size,
-                                       GCancellable *cancellable,
-                                       GError **error);
+ guint64 *out_size, + GCancellable *cancellable, + GError **error);

Return the size in bytes of object with checksum sha256 , after any compression has been applied.

@@ -3804,13 +3853,13 @@ compression has been applied.


ostree_repo_import_object_from ()

-
gboolean
+
gboolean
 ostree_repo_import_object_from (OstreeRepo *self,
                                 OstreeRepo *source,
                                 OstreeObjectType objtype,
                                 const char *checksum,
-                                GCancellable *cancellable,
-                                GError **error);
+ GCancellable *cancellable, + GError **error);

Copy object named by objtype and checksum into self @@ -3866,15 +3915,15 @@ hard link operation.


ostree_repo_import_object_from_with_trust ()

-
gboolean
+
gboolean
 ostree_repo_import_object_from_with_trust
                                (OstreeRepo *self,
                                 OstreeRepo *source,
                                 OstreeObjectType objtype,
                                 const char *checksum,
-                                gboolean trusted,
-                                GCancellable *cancellable,
-                                GError **error);
+ gboolean trusted, + GCancellable *cancellable, + GError **error);

Copy object named by objtype and checksum into self @@ -3915,7 +3964,7 @@ hard link operation.

- + @@ -3935,14 +3984,14 @@ hard link operation.


ostree_repo_import_archive_to_mtree ()

-
gboolean
+
gboolean
 ostree_repo_import_archive_to_mtree (OstreeRepo *self,
                                      OstreeRepoImportArchiveOptions *opts,
                                      void *archive,
                                      OstreeMutableTree *mtree,
                                      OstreeRepoCommitModifier *modifier,
-                                     GCancellable *cancellable,
-                                     GError **error);
+ GCancellable *cancellable, + GError **error);

Import an archive file archive into the repository, and write its file structure to mtree @@ -3999,13 +4048,13 @@ file structure to mtree


ostree_repo_export_tree_to_archive ()

-
gboolean
+
gboolean
 ostree_repo_export_tree_to_archive (OstreeRepo *self,
                                     OstreeRepoExportArchiveOptions *opts,
                                     OstreeRepoFile *root,
                                     void *archive,
-                                    GCancellable *cancellable,
-                                    GError **error);
+ GCancellable *cancellable, + GError **error);

Import an archive file archive into the repository, and write its file structure to mtree @@ -4057,16 +4106,16 @@ file structure to mtree


ostree_repo_delete_object ()

-
gboolean
+
gboolean
 ostree_repo_delete_object (OstreeRepo *self,
                            OstreeObjectType objtype,
                            const char *sha256,
-                           GCancellable *cancellable,
-                           GError **error);
+ GCancellable *cancellable, + GError **error);

Remove the object of type objtype with checksum sha256 -from the repository. An error of type G_IO_ERROR_NOT_FOUND +from the repository. An error of type G_IO_ERROR_NOT_FOUND is thrown if the object does not exist.

Parameters

@@ -4112,8 +4161,8 @@ is thrown if the object does not exist.

OstreeRepoCommitFilterResult
 (*OstreeRepoCommitFilter) (OstreeRepo *repo,
                            const char *path,
-                           GFileInfo *file_info,
-                           gpointer user_data);
+ GFileInfo *file_info, + gpointer user_data);

Parameters

trusted

If TRUE, assume the source repo is valid and trusted

If TRUE, assume the source repo is valid and trusted

 
@@ -4157,8 +4206,8 @@ is thrown if the object does not exist.

OstreeRepoCommitModifier *
 ostree_repo_commit_modifier_new (OstreeRepoCommitModifierFlags flags,
                                  OstreeRepoCommitFilter commit_filter,
-                                 gpointer user_data,
-                                 GDestroyNotify destroy_notify);
+ gpointer user_data, + GDestroyNotify destroy_notify);

Parameters

@@ -4185,7 +4234,7 @@ ostree_repo_commit_modifier_new ( - + @@ -4200,12 +4249,12 @@ ostree_repo_commit_modifier_new (

OstreeRepoCommitModifierXattrCallback ()

-
GVariant *
+
GVariant *
 (*OstreeRepoCommitModifierXattrCallback)
                                (OstreeRepo *repo,
                                 const char *path,
-                                GFileInfo *file_info,
-                                gpointer user_data);
+ GFileInfo *file_info, + gpointer user_data);

@@ -4214,8 +4263,8 @@ ostree_repo_commit_modifier_new (OstreeRepoCommitModifier *modifier, OstreeRepoCommitModifierXattrCallback callback, - GDestroyNotify destroy, - gpointer user_data); + GDestroyNotify destroy, + gpointer user_data);

If set, this function should return extended attributes to use for the given path. This is useful for things like ACLs and SELinux, where a build system can label the files as it's committing to the @@ -4262,7 +4311,7 @@ ostree_repo_commit_modifier_set_sepolicy (OstreeRepoCommitModifier *modifier, OstreeSePolicy *sepolicy);

If policy - is non-NULL, use it to look up labels to use for + is non-NULL, use it to look up labels to use for "security.selinux" extended attributes.

Note that any policy specified this way operates in addition to any extended attributes provided via @@ -4376,19 +4425,19 @@ ostree_repo_devino_cache_unref (O


ostree_repo_devino_cache_get_type ()

-
GType
+
GType
 ostree_repo_devino_cache_get_type (void);

ostree_repo_write_directory_to_mtree ()

-
gboolean
+
gboolean
 ostree_repo_write_directory_to_mtree (OstreeRepo *self,
-                                      GFile *dir,
+                                      GFile *dir,
                                       OstreeMutableTree *mtree,
                                       OstreeRepoCommitModifier *modifier,
-                                      GCancellable *cancellable,
-                                      GError **error);
+ GCancellable *cancellable, + GError **error);

Store objects for dir and all children into the repository self , @@ -4440,14 +4489,14 @@ overlaying the resulting filesystem hierarchy into m


ostree_repo_write_dfd_to_mtree ()

-
gboolean
+
gboolean
 ostree_repo_write_dfd_to_mtree (OstreeRepo *self,
                                 int dfd,
                                 const char *path,
                                 OstreeMutableTree *mtree,
                                 OstreeRepoCommitModifier *modifier,
-                                GCancellable *cancellable,
-                                GError **error);
+ GCancellable *cancellable, + GError **error);

Store as objects all contents of the directory referred to by dfd and path @@ -4506,14 +4555,14 @@ resulting filesystem hierarchy into mtree

ostree_repo_write_archive_to_mtree ()

-
gboolean
+
gboolean
 ostree_repo_write_archive_to_mtree (OstreeRepo *self,
-                                    GFile *archive,
+                                    GFile *archive,
                                     OstreeMutableTree *mtree,
                                     OstreeRepoCommitModifier *modifier,
-                                    gboolean autocreate_parents,
-                                    GCancellable *cancellable,
-                                    GError **error);
+ gboolean autocreate_parents, + GCancellable *cancellable, + GError **error);

Import an archive file archive into the repository, and write its file structure to mtree @@ -4569,12 +4618,12 @@ file structure to mtree


ostree_repo_write_mtree ()

-
gboolean
+
gboolean
 ostree_repo_write_mtree (OstreeRepo *self,
                          OstreeMutableTree *mtree,
-                         GFile **out_file,
-                         GCancellable *cancellable,
-                         GError **error);
+ GFile **out_file, + GCancellable *cancellable, + GError **error);

Write all metadata objects for mtree to repo; the resulting out_file @@ -4623,16 +4672,16 @@ the mtree


ostree_repo_write_commit ()

-
gboolean
+
gboolean
 ostree_repo_write_commit (OstreeRepo *self,
                           const char *parent,
                           const char *subject,
                           const char *body,
-                          GVariant *metadata,
+                          GVariant *metadata,
                           OstreeRepoFile *root,
                           char **out_commit,
-                          GCancellable *cancellable,
-                          GError **error);
+ GCancellable *cancellable, + GError **error);

Write a commit metadata object, referencing root_contents_checksum and root_metadata_checksum @@ -4653,7 +4702,7 @@ and root_metadata_checksum

- + @@ -4668,7 +4717,7 @@ and root_metadata_checksum - + @@ -4698,17 +4747,17 @@ and root_metadata_checksum

ostree_repo_write_commit_with_time ()

-
gboolean
+
gboolean
 ostree_repo_write_commit_with_time (OstreeRepo *self,
                                     const char *parent,
                                     const char *subject,
                                     const char *body,
-                                    GVariant *metadata,
+                                    GVariant *metadata,
                                     OstreeRepoFile *root,
-                                    guint64 time,
+                                    guint64 time,
                                     char **out_commit,
-                                    GCancellable *cancellable,
-                                    GError **error);
+ GCancellable *cancellable, + GError **error);

Write a commit metadata object, referencing root_contents_checksum and root_metadata_checksum @@ -4729,7 +4778,7 @@ and root_metadata_checksum

- + @@ -4744,7 +4793,7 @@ and root_metadata_checksum - + @@ -4779,17 +4828,17 @@ and root_metadata_checksum

ostree_repo_read_commit_detached_metadata ()

-
gboolean
+
gboolean
 ostree_repo_read_commit_detached_metadata
                                (OstreeRepo *self,
                                 const char *checksum,
-                                GVariant **out_metadata,
-                                GCancellable *cancellable,
-                                GError **error);
+ GVariant **out_metadata, + GCancellable *cancellable, + GError **error);

OSTree commits can have arbitrary metadata associated; this function retrieves them. If none exists, out_metadata will be set -to NULL.

+to NULL.

Parameters

destroy_notify

A GDestroyNotify

A GDestroyNotify

 

parent

ASCII SHA256 checksum for parent, or NULL for none.

ASCII SHA256 checksum for parent, or NULL for none.

[allow-none]

metadata

GVariant of type a{sv}, or NULL for none.

GVariant of type a{sv}, or NULL for none.

[allow-none]

parent

ASCII SHA256 checksum for parent, or NULL for none.

ASCII SHA256 checksum for parent, or NULL for none.

[allow-none]

metadata

GVariant of type a{sv}, or NULL for none.

GVariant of type a{sv}, or NULL for none.

[allow-none]
@@ -4811,7 +4860,7 @@ to

out_metadata

-
+ @@ -4831,18 +4880,18 @@ to

ostree_repo_write_commit_detached_metadata ()

-
gboolean
+
gboolean
 ostree_repo_write_commit_detached_metadata
                                (OstreeRepo *self,
                                 const char *checksum,
-                                GVariant *metadata,
-                                GCancellable *cancellable,
-                                GError **error);
+ GVariant *metadata, + GCancellable *cancellable, + GError **error);

Replace any existing metadata associated with commit referred to by checksum with metadata . If metadata - is NULL, then existing + is NULL, then existing data will be deleted.

Parameters

@@ -4865,7 +4914,7 @@ data will be deleted.

- + @@ -4885,15 +4934,15 @@ data will be deleted.


ostree_repo_checkout_tree ()

-
gboolean
+
gboolean
 ostree_repo_checkout_tree (OstreeRepo *self,
                            OstreeRepoCheckoutMode mode,
                            OstreeRepoCheckoutOverwriteMode overwrite_mode,
-                           GFile *destination,
+                           GFile *destination,
                            OstreeRepoFile *source,
-                           GFileInfo *source_info,
-                           GCancellable *cancellable,
-                           GError **error);
+ GFileInfo *source_info, + GCancellable *cancellable, + GError **error);

Check out source into destination , which must live on the @@ -4959,14 +5008,14 @@ files are checked out.


ostree_repo_checkout_tree_at ()

-
gboolean
+
gboolean
 ostree_repo_checkout_tree_at (OstreeRepo *self,
                               OstreeRepoCheckoutOptions *options,
                               int destination_dfd,
                               const char *destination_path,
                               const char *commit,
-                              GCancellable *cancellable,
-                              GError **error);
+ GCancellable *cancellable, + GError **error);

ostree_repo_checkout_tree_at is deprecated and should not be used in newly-written code.

Similar to ostree_repo_checkout_tree(), but uses directory-relative paths for the destination, uses a new OstreeRepoCheckoutAtOptions, @@ -5028,14 +5077,14 @@ cache.


ostree_repo_checkout_at ()

-
gboolean
+
gboolean
 ostree_repo_checkout_at (OstreeRepo *self,
                          OstreeRepoCheckoutAtOptions *options,
                          int destination_dfd,
                          const char *destination_path,
                          const char *commit,
-                         GCancellable *cancellable,
-                         GError **error);
+ GCancellable *cancellable, + GError **error);

Similar to ostree_repo_checkout_tree(), but uses directory-relative paths for the destination, uses a new OstreeRepoCheckoutAtOptions, and takes a commit checksum and optional subpath pair, rather than @@ -5096,10 +5145,10 @@ cache.


ostree_repo_checkout_gc ()

-
gboolean
+
gboolean
 ostree_repo_checkout_gc (OstreeRepo *self,
-                         GCancellable *cancellable,
-                         GError **error);
+ GCancellable *cancellable, + GError **error);

Call this after finishing a succession of checkout operations; it will delete any currently-unused uncompressed objects from the cache.

@@ -5134,13 +5183,13 @@ cache.


ostree_repo_read_commit ()

-
gboolean
+
gboolean
 ostree_repo_read_commit (OstreeRepo *self,
                          const char *ref,
-                         GFile **out_root,
+                         GFile **out_root,
                          char **out_commit,
-                         GCancellable *cancellable,
-                         GError **error);
+ GCancellable *cancellable, + GError **error);

Load the content for rev into out_root .

@@ -5190,18 +5239,18 @@ ostree_repo_read_commit (

ostree_repo_list_objects ()

-
gboolean
+
gboolean
 ostree_repo_list_objects (OstreeRepo *self,
                           OstreeRepoListObjectsFlags flags,
-                          GHashTable **out_objects,
-                          GCancellable *cancellable,
-                          GError **error);
+ GHashTable **out_objects, + GCancellable *cancellable, + GError **error);

This function synchronously enumerates all objects in the repository, returning data in out_objects . out_objects maps from keys returned by ostree_object_name_serialize() -to GVariant values of type OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE.

+to GVariant values of type OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE.

Parameters

Metadata associated with commit in with format "a{sv}", or NULL if none exists.

Metadata associated with commit in with format "a{sv}", or NULL if none exists.

[out][transfer full]

metadata

Metadata to associate with commit in with format "a{sv}", or NULL to delete.

Metadata to associate with commit in with format "a{sv}", or NULL to delete.

[allow-none]
@@ -5241,20 +5290,20 @@ to

Returns

-

TRUE on success, FALSE on error, and error +

TRUE on success, FALSE on error, and error will be set


ostree_repo_list_commit_objects_starting_with ()

-
gboolean
+
gboolean
 ostree_repo_list_commit_objects_starting_with
                                (OstreeRepo *self,
                                 const char *start,
-                                GHashTable **out_commits,
-                                GCancellable *cancellable,
-                                GError **error);
+ GHashTable **out_commits, + GCancellable *cancellable, + GError **error);

This function synchronously enumerates all commit objects starting with start , returning data in out_commits @@ -5298,18 +5347,18 @@ with start

Returns

-

TRUE on success, FALSE on error, and error +

TRUE on success, FALSE on error, and error will be set


ostree_repo_list_static_delta_names ()

-
gboolean
+
gboolean
 ostree_repo_list_static_delta_names (OstreeRepo *self,
-                                     GPtrArray **out_deltas,
-                                     GCancellable *cancellable,
-                                     GError **error);
+ GPtrArray **out_deltas, + GCancellable *cancellable, + GError **error);

This function synchronously enumerates all static deltas in the repository, returning its result in out_deltas .

@@ -5349,17 +5398,17 @@ repository, returning its result in out_deltas

ostree_repo_static_delta_generate ()

-
gboolean
+
gboolean
 ostree_repo_static_delta_generate (OstreeRepo *self,
                                    OstreeStaticDeltaGenerateOpt opt,
                                    const char *from,
                                    const char *to,
-                                   GVariant *metadata,
-                                   GVariant *params,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GVariant *metadata, + GVariant *params, + GCancellable *cancellable, + GError **error);

Generate a lookaside "static delta" from from - (NULL means + (NULL means from-empty) which can generate the objects in to . This delta is an optimization over fetching individual objects, and can be @@ -5400,7 +5449,7 @@ for input files

- + @@ -5435,13 +5484,13 @@ for input files


ostree_repo_static_delta_execute_offline ()

-
gboolean
+
gboolean
 ostree_repo_static_delta_execute_offline
                                (OstreeRepo *self,
-                                GFile *dir_or_file,
-                                gboolean skip_validation,
-                                GCancellable *cancellable,
-                                GError **error);
+ GFile *dir_or_file, + gboolean skip_validation, + GCancellable *cancellable, + GError **error);

Given a directory representing an already-downloaded static delta on disk, apply it, generating a new commit. The directory must be named with the form "FROM-TO", where both are checksums, and it @@ -5467,7 +5516,7 @@ must contain a file named "superblock", along with at least one part.

- + @@ -5487,9 +5536,9 @@ must contain a file named "superblock", along with at least one part.


ostree_repo_traverse_new_reachable ()

-
GHashTable *
+
GHashTable *
 ostree_repo_traverse_new_reachable (void);
-

This hash table is a set of GVariant which can be accessed via +

This hash table is a set of GVariant which can be accessed via ostree_object_name_deserialize().

Returns

@@ -5500,13 +5549,13 @@ ostree_repo_traverse_new_reachable (

ostree_repo_traverse_commit ()

-
gboolean
+
gboolean
 ostree_repo_traverse_commit (OstreeRepo *repo,
                              const char *commit_checksum,
                              int maxdepth,
-                             GHashTable **out_reachable,
-                             GCancellable *cancellable,
-                             GError **error);
+ GHashTable **out_reachable, + GCancellable *cancellable, + GError **error);

Create a new set out_reachable containing all objects reachable from commit_checksum @@ -5558,13 +5607,13 @@ from commit_checksum


ostree_repo_traverse_commit_union ()

-
gboolean
+
gboolean
 ostree_repo_traverse_commit_union (OstreeRepo *repo,
                                    const char *commit_checksum,
                                    int maxdepth,
-                                   GHashTable *inout_reachable,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GHashTable *inout_reachable, + GCancellable *cancellable, + GError **error);

Update the set inout_reachable containing all objects reachable from commit_checksum @@ -5715,13 +5764,13 @@ called if OSTREE_REPO_COMMIT_ITER_RESULT_FILE was r


ostree_repo_commit_traverse_iter_init_commit ()

-
gboolean
+
gboolean
 ostree_repo_commit_traverse_iter_init_commit
                                (OstreeRepoCommitTraverseIter *iter,
                                 OstreeRepo *repo,
-                                GVariant *commit,
+                                GVariant *commit,
                                 OstreeRepoCommitTraverseFlags flags,
-                                GError **error);
+ GError **error);

Initialize (in place) an iterator over the root of a commit object.

Parameters

@@ -5764,13 +5813,13 @@ ostree_repo_commit_traverse_iter_init_commit

ostree_repo_commit_traverse_iter_init_dirtree ()

-
gboolean
+
gboolean
 ostree_repo_commit_traverse_iter_init_dirtree
                                (OstreeRepoCommitTraverseIter *iter,
                                 OstreeRepo *repo,
-                                GVariant *dirtree,
+                                GVariant *dirtree,
                                 OstreeRepoCommitTraverseFlags flags,
-                                GError **error);
+ GError **error);

Initialize (in place) an iterator over a directory tree.

Parameters

@@ -5815,8 +5864,8 @@ ostree_repo_commit_traverse_iter_init_dirtree

ostree_repo_commit_traverse_iter_next ()

OstreeRepoCommitIterResult
 ostree_repo_commit_traverse_iter_next (OstreeRepoCommitTraverseIter *iter,
-                                       GCancellable *cancellable,
-                                       GError **error);
+ GCancellable *cancellable, + GError **error);

Step the interator to the next item. Files will be returned first, then subdirectories. Call this in a loop; upon encountering OSTREE_REPO_COMMIT_ITER_RESULT_END, there will be no more files or @@ -5860,15 +5909,15 @@ program error to call any further API on iter


ostree_repo_prune ()

-
gboolean
+
gboolean
 ostree_repo_prune (OstreeRepo *self,
                    OstreeRepoPruneFlags flags,
-                   gint depth,
-                   gint *out_objects_total,
-                   gint *out_objects_pruned,
-                   guint64 *out_pruned_object_size_total,
-                   GCancellable *cancellable,
-                   GError **error);
+ gint depth, + gint *out_objects_total, + gint *out_objects_pruned, + guint64 *out_pruned_object_size_total, + GCancellable *cancellable, + GError **error);

Delete content from the repository. By default, this function will only delete "orphaned" objects not referred to by any commit. This can happen during a local commit operation, when we have written @@ -5937,11 +5986,11 @@ deleting them.


ostree_repo_prune_static_deltas ()

-
gboolean
+
gboolean
 ostree_repo_prune_static_deltas (OstreeRepo *self,
                                  const char *commit,
-                                 GCancellable *cancellable,
-                                 GError **error);
+ GCancellable *cancellable, + GError **error);

Prune static deltas, if COMMIT is specified then delete static delta files only targeting that commit; otherwise any static delta of non existing commits are deleted.

@@ -5961,7 +6010,7 @@ deleted.

- @@ -5982,14 +6031,14 @@ non existing commit.


ostree_repo_prune_from_reachable ()

-
gboolean
+
gboolean
 ostree_repo_prune_from_reachable (OstreeRepo *self,
                                   OstreeRepoPruneOptions *options,
-                                  gint *out_objects_total,
-                                  gint *out_objects_pruned,
-                                  guint64 *out_pruned_object_size_total,
-                                  GCancellable *cancellable,
-                                  GError **error);
+ gint *out_objects_total, + gint *out_objects_pruned, + guint64 *out_pruned_object_size_total, + GCancellable *cancellable, + GError **error);

Delete content from the repository. This function is the "backend" half of the higher level ostree_repo_prune(). To use this function, you determine the root set yourself, and this function finds all other @@ -6050,14 +6099,14 @@ statistics on objects that would be deleted, without actually deleting them.


ostree_repo_pull ()

-
gboolean
+
gboolean
 ostree_repo_pull (OstreeRepo *self,
                   const char *remote_name,
                   char **refs_to_fetch,
                   OstreeRepoPullFlags flags,
                   OstreeAsyncProgress *progress,
-                  GCancellable *cancellable,
-                  GError **error);
+ GCancellable *cancellable, + GError **error);

Connect to the remote repository, fetching the specified set of refs refs_to_fetch . For each ref that is changed, download the @@ -6067,7 +6116,7 @@ on disk in self

If flags contains OSTREE_REPO_PULL_FLAGS_MIRROR, and the refs_to_fetch - is NULL, and the remote repository contains a + is NULL, and the remote repository contains a summary file, then all refs will be fetched.

If flags contains OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY, then only the @@ -6075,7 +6124,7 @@ metadata for the commits in refs_to_fetch

Warning: This API will iterate the thread default main context, which is a bug, but kept for compatibility reasons. If you want to -avoid this, use g_main_context_push_thread_default() to push a new +avoid this, use g_main_context_push_thread_default() to push a new one around this call.

Parameters

@@ -6098,7 +6147,7 @@ one around this call.

- + @@ -6128,15 +6177,15 @@ one around this call.


ostree_repo_pull_one_dir ()

-
gboolean
+
gboolean
 ostree_repo_pull_one_dir (OstreeRepo *self,
                           const char *remote_name,
                           const char *dir_to_pull,
                           char **refs_to_fetch,
                           OstreeRepoPullFlags flags,
                           OstreeAsyncProgress *progress,
-                          GCancellable *cancellable,
-                          GError **error);
+ GCancellable *cancellable, + GError **error);

This is similar to ostree_repo_pull(), but only fetches a single subpath.

@@ -6165,7 +6214,7 @@ subpath.

- + @@ -6195,13 +6244,13 @@ subpath.


ostree_repo_pull_with_options ()

-
gboolean
+
gboolean
 ostree_repo_pull_with_options (OstreeRepo *self,
                                const char *remote_name_or_baseurl,
-                               GVariant *options,
+                               GVariant *options,
                                OstreeAsyncProgress *progress,
-                               GCancellable *cancellable,
-                               GError **error);
+ GCancellable *cancellable, + GError **error);

Like ostree_repo_pull(), but supports an extensible set of flags. The following are currently defined:

    @@ -6220,6 +6269,7 @@ The following are currently defined:

  • override-url (s): Fetch objects from this URL if remote specifies no metalink in options

  • inherit-transaction (b): Don't initiate, finish or abort a transaction, usefult to do mutliple pulls in one transaction.

  • http-headers (a(ss)): Additional headers to add to all HTTP requests

  • +
  • update-frequency (u): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are valid

Parameters

@@ -6270,7 +6320,7 @@ The following are currently defined:

void
 ostree_repo_pull_default_console_progress_changed
                                (OstreeAsyncProgress *progress,
-                                gpointer user_data);
+ gpointer user_data);

Convenient "changed" callback for use with ostree_async_progress_new_and_connect() when pulling from a remote repository.

@@ -6309,13 +6359,13 @@ and user_data

ostree_repo_sign_commit ()

-
gboolean
+
gboolean
 ostree_repo_sign_commit (OstreeRepo *self,
-                         const gchar *commit_checksum,
-                         const gchar *key_id,
-                         const gchar *homedir,
-                         GCancellable *cancellable,
-                         GError **error);
+ const gchar *commit_checksum, + const gchar *key_id, + const gchar *homedir, + GCancellable *cancellable, + GError **error);

Add a GPG signature to a commit.

Parameters

@@ -6343,17 +6393,17 @@ ostree_repo_sign_commit (

homedir

-
+ - + - + @@ -6363,12 +6413,12 @@ ostree_repo_sign_commit (

ostree_repo_append_gpg_signature ()

-
gboolean
+
gboolean
 ostree_repo_append_gpg_signature (OstreeRepo *self,
-                                  const gchar *commit_checksum,
-                                  GBytes *signature_bytes,
-                                  GCancellable *cancellable,
-                                  GError **error);
+ const gchar *commit_checksum, + GBytes *signature_bytes, + GCancellable *cancellable, + GError **error);

Append a GPG signature to a commit.

Parameters

@@ -6396,12 +6446,12 @@ ostree_repo_append_gpg_signature (
- + - + @@ -6411,12 +6461,12 @@ ostree_repo_append_gpg_signature (

ostree_repo_add_gpg_signature_summary ()

-
gboolean
+
gboolean
 ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
-                                       const gchar **key_id,
-                                       const gchar *homedir,
-                                       GCancellable *cancellable,
-                                       GError **error);
+ const gchar **key_id, + const gchar *homedir, + GCancellable *cancellable, + GError **error);

Add a GPG signature to a static delta.

Parameters

@@ -6439,17 +6489,17 @@ ostree_repo_add_gpg_signature_summary (

homedir

-
+ - + - + @@ -6461,20 +6511,20 @@ ostree_repo_add_gpg_signature_summary (

ostree_repo_gpg_verify_data ()

OstreeGpgVerifyResult *
 ostree_repo_gpg_verify_data (OstreeRepo *self,
-                             const gchar *remote_name,
-                             GBytes *data,
-                             GBytes *signatures,
-                             GFile *keyringdir,
-                             GFile *extra_keyring,
-                             GCancellable *cancellable,
-                             GError **error);
+ const gchar *remote_name, + GBytes *data, + GBytes *signatures, + GFile *keyringdir, + GFile *extra_keyring, + GCancellable *cancellable, + GError **error);

Verify signatures for data using GPG keys in the keyring for remote_name , and return an OstreeGpgVerifyResult.

The remote_name - parameter can be NULL. In that case it will do + parameter can be NULL. In that case it will do the verifications using GPG keys in the keyrings of all remotes.

Parameters

@@ -6497,12 +6547,12 @@ the verifications using GPG keys in the keyrings of all remotes.

- + - + @@ -6530,20 +6580,20 @@ the verifications using GPG keys in the keyrings of all remotes.

Returns

-

an OstreeGpgVerifyResult, or NULL on error.

+

an OstreeGpgVerifyResult, or NULL on error.

[transfer full]


ostree_repo_verify_commit ()

-
gboolean
+
gboolean
 ostree_repo_verify_commit (OstreeRepo *self,
-                           const gchar *commit_checksum,
-                           GFile *keyringdir,
-                           GFile *extra_keyring,
-                           GCancellable *cancellable,
-                           GError **error);
+ const gchar *commit_checksum, + GFile *keyringdir, + GFile *extra_keyring, + GCancellable *cancellable, + GError **error);

Check for a valid GPG signature on commit named by the ASCII checksum commit_checksum .

@@ -6591,7 +6641,7 @@ checksum commit_checksum

Returns

-

TRUE if there was a GPG signature from a trusted keyring, otherwise FALSE

+

TRUE if there was a GPG signature from a trusted keyring, otherwise FALSE


@@ -6599,11 +6649,11 @@ checksum commit_checksum

ostree_repo_verify_commit_ext ()

OstreeGpgVerifyResult *
 ostree_repo_verify_commit_ext (OstreeRepo *self,
-                               const gchar *commit_checksum,
-                               GFile *keyringdir,
-                               GFile *extra_keyring,
-                               GCancellable *cancellable,
-                               GError **error);
+ const gchar *commit_checksum, + GFile *keyringdir, + GFile *extra_keyring, + GCancellable *cancellable, + GError **error);

Read GPG signature(s) on the commit named by the ASCII checksum commit_checksum and return detailed results.

@@ -6651,7 +6701,7 @@ ostree_repo_verify_commit_ext (

Returns

-

an OstreeGpgVerifyResult, or NULL on error.

+

an OstreeGpgVerifyResult, or NULL on error.

[transfer full]

@@ -6660,10 +6710,10 @@ ostree_repo_verify_commit_ext (

ostree_repo_verify_commit_for_remote ()

OstreeGpgVerifyResult *
 ostree_repo_verify_commit_for_remote (OstreeRepo *self,
-                                      const gchar *commit_checksum,
-                                      const gchar *remote_name,
-                                      GCancellable *cancellable,
-                                      GError **error);
+ const gchar *commit_checksum, + const gchar *remote_name, + GCancellable *cancellable, + GError **error);

Read GPG signature(s) on the commit named by the ASCII checksum commit_checksum and return detailed results, based on the keyring @@ -6708,7 +6758,7 @@ configured for remote

Returns

-

an OstreeGpgVerifyResult, or NULL on error.

+

an OstreeGpgVerifyResult, or NULL on error.

[transfer full]

@@ -6718,10 +6768,10 @@ configured for remote
OstreeGpgVerifyResult *
 ostree_repo_verify_summary (OstreeRepo *self,
                             const char *remote_name,
-                            GBytes *summary,
-                            GBytes *signatures,
-                            GCancellable *cancellable,
-                            GError **error);
+ GBytes *summary, + GBytes *signatures, + GCancellable *cancellable, + GError **error);

Verify signatures for summary data using GPG keys in the keyring for @@ -6748,12 +6798,12 @@ ostree_repo_verify_summary (

summary

-
+ - + @@ -6771,18 +6821,18 @@ ostree_repo_verify_summary (

Returns

-

an OstreeGpgVerifyResult, or NULL on error.

+

an OstreeGpgVerifyResult, or NULL on error.

[transfer full]


ostree_repo_regenerate_summary ()

-
gboolean
+
gboolean
 ostree_repo_regenerate_summary (OstreeRepo *self,
-                                GVariant *additional_metadata,
-                                GCancellable *cancellable,
-                                GError **error);
+ GVariant *additional_metadata, + GCancellable *cancellable, + GError **error);

An OSTree repository can contain a high level "summary" file that describes the available branches and other metadata.

It is regenerated automatically after a commit if @@ -6803,7 +6853,7 @@ describes the available branches and other metadata.

- + @@ -6932,52 +6982,52 @@ interesting for reporting purposes.

- + - + - + - + - + - + - + - + - + @@ -7111,7 +7161,14 @@ in bytes, counting only content objects.

+ + + + + @@ -7168,7 +7225,7 @@ in bytes, counting only content objects.

OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE

#define OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE (G_VARIANT_TYPE ("(bas)")
 
-

b - TRUE if object is available "loose" +

b - TRUE if object is available "loose" as - List of pack file checksums in which this object appears


diff --git a/apidoc/html/ostree-Core-repository-independent-functions.html b/apidoc/html/ostree-Core-repository-independent-functions.html index 97ee7d1c..38af53c2 100644 --- a/apidoc/html/ostree-Core-repository-independent-functions.html +++ b/apidoc/html/ostree-Core-repository-independent-functions.html @@ -46,7 +46,7 @@
- - - + + + + - + @@ -780,7 +788,7 @@ ostree_checksum_bytes_peek_validate (

ostree_checksum_b64_from_bytes ()

char *
-ostree_checksum_b64_from_bytes (const guchar *csum);
+ostree_checksum_b64_from_bytes (const guchar *csum);

Parameters

from

ASCII SHA256 checksum of origin, or NULL

ASCII SHA256 checksum of origin, or NULL

 

skip_validation

If TRUE, assume data integrity

If TRUE, assume data integrity

 

commit

ASCII SHA256 checksum for commit, or NULL for each +

ASCII SHA256 checksum for commit, or NULL for each non existing commit.

[allow-none]

refs_to_fetch

Optional list of refs; if NULL, fetch all configured refs.

Optional list of refs; if NULL, fetch all configured refs.

[array zero-terminated=1][element-type utf8][allow-none]

refs_to_fetch

Optional list of refs; if NULL, fetch all configured refs.

Optional list of refs; if NULL, fetch all configured refs.

[array zero-terminated=1][element-type utf8][allow-none]

GPG home directory, or NULL.

GPG home directory, or NULL.

[allow-none]

cancellable

A GCancellable

A GCancellable

 

error

a GError

a GError

 

cancellable

A GCancellable

A GCancellable

 

error

a GError

a GError

 

GPG home directory, or NULL.

GPG home directory, or NULL.

[allow-none]

cancellable

A GCancellable

A GCancellable

 

error

a GError

a GError

 

data

Data as a GBytes

Data as a GBytes

 

signatures

Signatures as a GBytes

Signatures as a GBytes

 

Summary data as a GBytes

Summary data as a GBytes

 

signatures

Summary signatures as a GBytes

Summary signatures as a GBytes

 

additional_metadata

A GVariant of type a{sv}, or NULL.

A GVariant of type a{sv}, or NULL.

[allow-none]

guint metadata_objects_total;

guint metadata_objects_total;

The total number of metadata objects in the repository after this transaction has completed.

 

guint metadata_objects_written;

guint metadata_objects_written;

The number of metadata objects that were written to the repository in this transaction.

 

guint content_objects_total;

guint content_objects_total;

The total number of content objects in the repository after this transaction has completed.

 

guint content_objects_written;

guint content_objects_written;

The number of content objects that were written to the repository in this transaction.

 

guint64 content_bytes_written;

guint64 content_bytes_written;

The amount of data added to the repository, in bytes, counting only content objects.

 

guint64 padding1;

guint64 padding1;

reserved

 

guint64 padding2;

guint64 padding2;

reserved

 

guint64 padding3;

guint64 padding3;

reserved

 

guint64 padding4;

guint64 padding4;

reserved

 

OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES

-

When layering checkouts, overwrite earlier files, but keep earlier directories

+

When layering checkouts, unlink() and replace existing files, but do not modify existing directories

+
 

OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES

+

Only add new files/directories

 
const GVariantType * +const GVariantType * ostree_metadata_variant_type () @@ -54,7 +54,7 @@
-gboolean +gboolean ostree_validate_checksum_string () @@ -62,7 +62,7 @@
-guchar * +guchar * ostree_checksum_to_bytes () @@ -70,7 +70,7 @@
-GVariant * +GVariant * ostree_checksum_to_bytes_v () @@ -109,14 +109,14 @@
const guchar * +const guchar * ostree_checksum_bytes_peek ()
const guchar * +const guchar * ostree_checksum_bytes_peek_validate () @@ -132,7 +132,7 @@
-guchar * +guchar * ostree_checksum_b64_to_bytes () @@ -164,7 +164,7 @@
-gboolean +gboolean ostree_validate_rev () @@ -172,7 +172,7 @@
-gboolean +gboolean ostree_parse_refspec () @@ -195,7 +195,7 @@
-guint +guint ostree_hash_object_name () @@ -203,7 +203,7 @@
-GVariant * +GVariant * ostree_object_name_serialize () @@ -235,7 +235,7 @@
-gboolean +gboolean ostree_content_stream_parse () @@ -243,7 +243,7 @@
-gboolean +gboolean ostree_content_file_parse () @@ -251,7 +251,7 @@
-gboolean +gboolean ostree_content_file_parse_at () @@ -259,7 +259,7 @@
-gboolean +gboolean ostree_raw_file_to_archive_z2_stream () @@ -267,7 +267,15 @@
-gboolean +gboolean + +ostree_raw_file_to_archive_z2_stream_with_options () +
+gboolean ostree_raw_file_to_content_stream () @@ -275,7 +283,7 @@
-gboolean +gboolean ostree_checksum_file_from_input () @@ -283,7 +291,7 @@
-gboolean +gboolean ostree_checksum_file () @@ -299,7 +307,7 @@
-gboolean +gboolean ostree_checksum_file_async_finish () @@ -307,7 +315,7 @@
-GVariant * +GVariant * ostree_create_directory_metadata () @@ -315,7 +323,7 @@
-gboolean +gboolean ostree_validate_structureof_objtype () @@ -323,7 +331,7 @@
-gboolean +gboolean ostree_validate_structureof_csum_v () @@ -331,7 +339,7 @@
-gboolean +gboolean ostree_validate_structureof_checksum_string () @@ -339,7 +347,7 @@
-gboolean +gboolean ostree_validate_structureof_file_mode () @@ -347,7 +355,7 @@
-gboolean +gboolean ostree_validate_structureof_commit () @@ -355,7 +363,7 @@
-gboolean +gboolean ostree_validate_structureof_dirtree () @@ -363,7 +371,7 @@
-gboolean +gboolean ostree_validate_structureof_dirmeta () @@ -371,7 +379,7 @@
-gchar * +gchar * ostree_commit_get_parent () @@ -379,7 +387,7 @@
-guint64 +guint64 ostree_commit_get_timestamp () @@ -463,11 +471,11 @@

Description

These functions implement repository-independent algorithms for operating on the core OSTree data formats, such as converting -GFileInfo into a GVariant.

+GFileInfo into a GVariant.

There are 4 types of objects; file, dirmeta, tree, and commit. The last 3 are metadata, and the file object is the only content object type.

-

All metadata objects are stored as GVariant (big endian). The +

All metadata objects are stored as GVariant (big endian). The rationale for this is the same as that of the ext{2,3,4} family of filesystems; most developers will be using LE, and so it's better to continually test the BE->LE swap.

@@ -496,21 +504,21 @@ to continually test the BE->LE swap.

Returns

-

TRUE if object type is metadata

+

TRUE if object type is metadata


ostree_metadata_variant_type ()

-
const GVariantType *
+
const GVariantType *
 ostree_metadata_variant_type (OstreeObjectType objtype);

ostree_validate_checksum_string ()

-
gboolean
+
gboolean
 ostree_validate_checksum_string (const char *sha256,
-                                 GError **error);
+ GError **error);

Use this function to see if input strings are checksums.

Parameters

@@ -536,14 +544,14 @@ ostree_validate_checksum_string (const

Returns

-

TRUE if sha256 -is a valid checksum string, FALSE otherwise

+

TRUE if sha256 +is a valid checksum string, FALSE otherwise


ostree_checksum_to_bytes ()

-
guchar *
+
guchar *
 ostree_checksum_to_bytes (const char *checksum);

Parameters

@@ -563,14 +571,14 @@ ostree_checksum_to_bytes (const c

Returns

Binary checksum from checksum -of length 32; free with g_free().

+of length 32; free with g_free().

[transfer full][array fixed-size=32]


ostree_checksum_to_bytes_v ()

-
GVariant *
+
GVariant *
 ostree_checksum_to_bytes_v (const char *checksum);

Parameters

@@ -589,7 +597,7 @@ ostree_checksum_to_bytes_v (const

Returns

-

New GVariant of type ay with length 32.

+

New GVariant of type ay with length 32.

[transfer full]

@@ -597,7 +605,7 @@ ostree_checksum_to_bytes_v (const

ostree_checksum_from_bytes ()

char *
-ostree_checksum_from_bytes (const guchar *csum);
+ostree_checksum_from_bytes (const guchar *csum);

Parameters

@@ -624,7 +632,7 @@ ostree_checksum_from_bytes (const

ostree_checksum_from_bytes_v ()

char *
-ostree_checksum_from_bytes_v (GVariant *csum_v);
+ostree_checksum_from_bytes_v (GVariant *csum_v);

Parameters

@@ -635,7 +643,7 @@ ostree_checksum_from_bytes_v (

csum_v

-
+

GVariant of type ay

GVariant of type ay

 
@@ -651,7 +659,7 @@ ostree_checksum_from_bytes_v (

ostree_checksum_inplace_from_bytes ()

void
-ostree_checksum_inplace_from_bytes (const guchar *csum,
+ostree_checksum_inplace_from_bytes (const guchar *csum,
                                     char *buf);

Overwrite the contents of buf with stringified version of csum @@ -685,7 +693,7 @@ ostree_checksum_inplace_from_bytes (const

ostree_checksum_inplace_to_bytes ()

void
 ostree_checksum_inplace_to_bytes (const char *checksum,
-                                  guchar *buf);
+ guchar *buf);

Convert checksum from a string to binary in-place, without allocating memory. Use this function in hot code paths.

@@ -715,8 +723,8 @@ allocating memory. Use this function in hot code paths.


ostree_checksum_bytes_peek ()

-
const guchar *
-ostree_checksum_bytes_peek (GVariant *bytes);
+
const guchar *
+ostree_checksum_bytes_peek (GVariant *bytes);

Parameters

@@ -727,7 +735,7 @@ ostree_checksum_bytes_peek (

bytes

-
+

GVariant of type ay

GVariant of type ay

 
@@ -736,16 +744,16 @@ ostree_checksum_bytes_peek (

Returns

Binary checksum data in bytes ; do not free. If bytes -does not have the correct length, return NULL.

+does not have the correct length, return NULL.

[transfer none][array fixed-size=32][element-type guint8]


ostree_checksum_bytes_peek_validate ()

-
const guchar *
-ostree_checksum_bytes_peek_validate (GVariant *bytes,
-                                     GError **error);
+
const guchar *
+ostree_checksum_bytes_peek_validate (GVariant *bytes,
+                                     GError **error);

Like ostree_checksum_bytes_peek(), but also throws error .

@@ -759,7 +767,7 @@ ostree_checksum_bytes_peek_validate (

bytes

GVariant of type ay

GVariant of type ay

 
@@ -808,7 +816,7 @@ character is used.


ostree_checksum_b64_to_bytes ()

-
guchar *
+
guchar *
 ostree_checksum_b64_to_bytes (const char *checksum);

Parameters

@@ -837,7 +845,7 @@ ostree_checksum_b64_to_bytes (const

ostree_checksum_b64_inplace_from_bytes ()

void
 ostree_checksum_b64_inplace_from_bytes
-                               (const guchar *csum,
+                               (const guchar *csum,
                                 char *buf);

Overwrite the contents of buf with modified base64 encoding of csum @@ -873,7 +881,7 @@ character is used.

ostree_checksum_b64_inplace_to_bytes ()

void
 ostree_checksum_b64_inplace_to_bytes (const char *checksum,
-                                      guint8 *buf);
+ guint8 *buf);

Overwrite the contents of buf with stringified version of csum .

@@ -905,8 +913,8 @@ ostree_checksum_b64_inplace_to_bytes (const

ostree_cmp_checksum_bytes ()

int
-ostree_cmp_checksum_bytes (const guchar *a,
-                           const guchar *b);
+ostree_cmp_checksum_bytes (const guchar *a, + const guchar *b);

Compare two binary checksums, using memcmp().

Parameters

@@ -934,9 +942,9 @@ ostree_cmp_checksum_bytes (const

ostree_validate_rev ()

-
gboolean
+
gboolean
 ostree_validate_rev (const char *rev,
-                     GError **error);
+ GError **error);

Parameters

@@ -961,18 +969,18 @@ ostree_validate_rev (const char

Returns

-

TRUE if rev +

TRUE if rev is a valid ref string


ostree_parse_refspec ()

-
gboolean
+
gboolean
 ostree_parse_refspec (const char *refspec,
                       char **out_remote,
                       char **out_ref,
-                      GError **error);
+ GError **error);

Split a refspec like "gnome-ostree:gnome-ostree/buildmaster" into two parts; out_remote will be set to "gnome-ostree", and out_ref @@ -980,7 +988,7 @@ two parts; out_remote will be "gnome-ostree/buildmaster".

If refspec refers to a local ref, out_remote - will be NULL.

+ will be NULL.

Parameters

@@ -997,7 +1005,7 @@ will be "gnome-ostree/buildmaster".

- + @@ -1062,9 +1070,9 @@ ostree_object_type_from_string (const

ostree_hash_object_name ()

-
guint
-ostree_hash_object_name (gconstpointer a);
-

Use this function with GHashTable and ostree_object_name_serialize().

+
guint
+ostree_hash_object_name (gconstpointer a);
+

Use this function with GHashTable and ostree_object_name_serialize().

Parameters

out_remote

The remote name, or NULL if the refspec refs to a local ref.

The remote name, or NULL if the refspec refs to a local ref.

[out][allow-none]
@@ -1075,7 +1083,7 @@ ostree_hash_object_name (

a

-
+

A GVariant containing a serialized object

A GVariant containing a serialized object

 
@@ -1084,7 +1092,7 @@ ostree_hash_object_name (

ostree_object_name_serialize ()

-
GVariant *
+
GVariant *
 ostree_object_name_serialize (const char *checksum,
                               OstreeObjectType objtype);
@@ -1111,7 +1119,7 @@ ostree_object_name_serialize (const

Returns

-

A new floating GVariant containing checksum string and objtype.

+

A new floating GVariant containing checksum string and objtype.

[transfer floating]

@@ -1119,7 +1127,7 @@ ostree_object_name_serialize (const

ostree_object_name_deserialize ()

void
-ostree_object_name_deserialize (GVariant *variant,
+ostree_object_name_deserialize (GVariant *variant,
                                 const char **out_checksum,
                                 OstreeObjectType *out_objtype);

Reverse ostree_object_name_serialize(). Note that out_checksum @@ -1137,7 +1145,7 @@ only valid for the lifetime of variant

variant

-

A GVariant of type (su)

+

A GVariant of type (su)

  @@ -1195,7 +1203,7 @@ and a stringifed version of objtype

ostree_object_from_string ()

void
 ostree_object_from_string (const char *str,
-                           gchar **out_checksum,
+                           gchar **out_checksum,
                            OstreeObjectType *out_objtype);

Reverse ostree_object_to_string().

@@ -1229,16 +1237,16 @@ ostree_object_from_string (const

ostree_content_stream_parse ()

-
gboolean
-ostree_content_stream_parse (gboolean compressed,
-                             GInputStream *input,
-                             guint64 input_length,
-                             gboolean trusted,
-                             GInputStream **out_input,
-                             GFileInfo **out_file_info,
-                             GVariant **out_xattrs,
-                             GCancellable *cancellable,
-                             GError **error);
+
gboolean
+ostree_content_stream_parse (gboolean compressed,
+                             GInputStream *input,
+                             guint64 input_length,
+                             gboolean trusted,
+                             GInputStream **out_input,
+                             GFileInfo **out_file_info,
+                             GVariant **out_xattrs,
+                             GCancellable *cancellable,
+                             GError **error);

The reverse of ostree_raw_file_to_content_stream(); this function converts an object content stream back into components.

@@ -1267,7 +1275,7 @@ converts an object content stream back into components.

trusted

-

If TRUE, assume the content has been validated

+

If TRUE, assume the content has been validated

  @@ -1302,15 +1310,15 @@ converts an object content stream back into components.


ostree_content_file_parse ()

-
gboolean
-ostree_content_file_parse (gboolean compressed,
-                           GFile *content_path,
-                           gboolean trusted,
-                           GInputStream **out_input,
-                           GFileInfo **out_file_info,
-                           GVariant **out_xattrs,
-                           GCancellable *cancellable,
-                           GError **error);
+
gboolean
+ostree_content_file_parse (gboolean compressed,
+                           GFile *content_path,
+                           gboolean trusted,
+                           GInputStream **out_input,
+                           GFileInfo **out_file_info,
+                           GVariant **out_xattrs,
+                           GCancellable *cancellable,
+                           GError **error);

A thin wrapper for ostree_content_stream_parse(); this function converts an object content stream back into components.

@@ -1334,7 +1342,7 @@ converts an object content stream back into components.

trusted

-

If TRUE, assume the content has been validated

+

If TRUE, assume the content has been validated

  @@ -1369,16 +1377,16 @@ converts an object content stream back into components.


ostree_content_file_parse_at ()

-
gboolean
-ostree_content_file_parse_at (gboolean compressed,
+
gboolean
+ostree_content_file_parse_at (gboolean compressed,
                               int parent_dfd,
                               const char *path,
-                              gboolean trusted,
-                              GInputStream **out_input,
-                              GFileInfo **out_file_info,
-                              GVariant **out_xattrs,
-                              GCancellable *cancellable,
-                              GError **error);
+ gboolean trusted, + GInputStream **out_input, + GFileInfo **out_file_info, + GVariant **out_xattrs, + GCancellable *cancellable, + GError **error);

A thin wrapper for ostree_content_stream_parse(); this function converts an object content stream back into components.

@@ -1407,7 +1415,7 @@ converts an object content stream back into components.

trusted

-

If TRUE, assume the content has been validated

+

If TRUE, assume the content has been validated

  @@ -1442,13 +1450,13 @@ converts an object content stream back into components.


ostree_raw_file_to_archive_z2_stream ()

-
gboolean
-ostree_raw_file_to_archive_z2_stream (GInputStream *input,
-                                      GFileInfo *file_info,
-                                      GVariant *xattrs,
-                                      GInputStream **out_input,
-                                      GCancellable *cancellable,
-                                      GError **error);
+
gboolean
+ostree_raw_file_to_archive_z2_stream (GInputStream *input,
+                                      GFileInfo *file_info,
+                                      GVariant *xattrs,
+                                      GInputStream **out_input,
+                                      GCancellable *cancellable,
+                                      GError **error);

Convert from a "bare" file representation into an OSTREE_OBJECT_TYPE_FILE stream suitable for ostree pull.

@@ -1496,15 +1504,80 @@ OSTREE_OBJECT_TYPE_FILE stream suitable for ostree pull.


+

ostree_raw_file_to_archive_z2_stream_with_options ()

+
gboolean
+ostree_raw_file_to_archive_z2_stream_with_options
+                               (GInputStream *input,
+                                GFileInfo *file_info,
+                                GVariant *xattrs,
+                                GVariant *options,
+                                GInputStream **out_input,
+                                GCancellable *cancellable,
+                                GError **error);
+

Like ostree_raw_file_to_archive_z2_stream(), but supports an extensible set +of flags. The following flags are currently defined:

+
  • compression-level (i): Level of compression to use, 0–9, with 0 being +the least compression, and <0 giving the default level (currently 6).

+
+

Parameters

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

input

File raw content stream

 

file_info

A file info

 

xattrs

Optional extended attributes.

[allow-none]

options

A GVariant a{sv} with an extensible set of flags.

[nullable]

out_input

Serialized object stream.

[out]

cancellable

Cancellable

 

error

Error

 
+
+

Since: 2017.3

+
+
+

ostree_raw_file_to_content_stream ()

-
gboolean
-ostree_raw_file_to_content_stream (GInputStream *input,
-                                   GFileInfo *file_info,
-                                   GVariant *xattrs,
-                                   GInputStream **out_input,
-                                   guint64 *out_length,
-                                   GCancellable *cancellable,
-                                   GError **error);
+
gboolean
+ostree_raw_file_to_content_stream (GInputStream *input,
+                                   GFileInfo *file_info,
+                                   GVariant *xattrs,
+                                   GInputStream **out_input,
+                                   guint64 *out_length,
+                                   GCancellable *cancellable,
+                                   GError **error);

Convert from a "bare" file representation into an OSTREE_OBJECT_TYPE_FILE stream. This is a fundamental operation for writing data to an OstreeRepo.

@@ -1559,14 +1632,14 @@ for writing data to an

ostree_checksum_file_from_input ()

-
gboolean
-ostree_checksum_file_from_input (GFileInfo *file_info,
-                                 GVariant *xattrs,
-                                 GInputStream *in,
+
gboolean
+ostree_checksum_file_from_input (GFileInfo *file_info,
+                                 GVariant *xattrs,
+                                 GInputStream *in,
                                  OstreeObjectType objtype,
-                                 guchar **out_csum,
-                                 GCancellable *cancellable,
-                                 GError **error);
+ guchar **out_csum, + GCancellable *cancellable, + GError **error);

Compute the OSTree checksum for a given input.

Parameters

@@ -1589,7 +1662,7 @@ ostree_checksum_file_from_input (

in

-

File content, should be NULL for symbolic links.

+

File content, should be NULL for symbolic links.

[allow-none] @@ -1619,12 +1692,12 @@ ostree_checksum_file_from_input (

ostree_checksum_file ()

-
gboolean
-ostree_checksum_file (GFile *f,
+
gboolean
+ostree_checksum_file (GFile *f,
                       OstreeObjectType objtype,
-                      guchar **out_csum,
-                      GCancellable *cancellable,
-                      GError **error);
+ guchar **out_csum, + GCancellable *cancellable, + GError **error);

Compute the OSTree checksum for a given file.

Parameters

@@ -1668,12 +1741,12 @@ ostree_checksum_file (

ostree_checksum_file_async ()

void
-ostree_checksum_file_async (GFile *f,
+ostree_checksum_file_async (GFile *f,
                             OstreeObjectType objtype,
                             int io_priority,
-                            GCancellable *cancellable,
-                            GAsyncReadyCallback callback,
-                            gpointer user_data);
+ GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data);

Asynchronously compute the OSTree checksum for a given file; complete with ostree_checksum_file_async_finish().

@@ -1723,11 +1796,11 @@ complete with

ostree_checksum_file_async_finish ()

-
gboolean
-ostree_checksum_file_async_finish (GFile *f,
-                                   GAsyncResult *result,
-                                   guchar **out_csum,
-                                   GError **error);
+
gboolean
+ostree_checksum_file_async_finish (GFile *f,
+                                   GAsyncResult *result,
+                                   guchar **out_csum,
+                                   GError **error);

Finish computing the OSTree checksum for a given file; see ostree_checksum_file_async().

@@ -1766,9 +1839,9 @@ ostree_checksum_file_async_finish (

ostree_create_directory_metadata ()

-
GVariant *
-ostree_create_directory_metadata (GFileInfo *dir_info,
-                                  GVariant *xattrs);
+
GVariant *
+ostree_create_directory_metadata (GFileInfo *dir_info,
+                                  GVariant *xattrs);

Parameters

@@ -1780,7 +1853,7 @@ ostree_create_directory_metadata (

dir_info

-
+ @@ -1793,16 +1866,16 @@ ostree_create_directory_metadata (

Returns

-

A new GVariant containing OSTREE_OBJECT_TYPE_DIR_META.

+

A new GVariant containing OSTREE_OBJECT_TYPE_DIR_META.

[transfer full]


ostree_validate_structureof_objtype ()

-
gboolean
-ostree_validate_structureof_objtype (guchar objtype,
-                                     GError **error);
+
gboolean
+ostree_validate_structureof_objtype (guchar objtype,
+                                     GError **error);

Parameters

a GFileInfo containing directory information

a GFileInfo containing directory information

 
@@ -1820,16 +1893,16 @@ ostree_validate_structureof_objtype (

Returns

-

TRUE if objtype +

TRUE if objtype represents a valid object type


ostree_validate_structureof_csum_v ()

-
gboolean
-ostree_validate_structureof_csum_v (GVariant *checksum,
-                                    GError **error);
+
gboolean
+ostree_validate_structureof_csum_v (GVariant *checksum,
+                                    GError **error);

Parameters

@@ -1841,7 +1914,7 @@ ostree_validate_structureof_csum_v (

checksum

-
+ @@ -1854,17 +1927,17 @@ ostree_validate_structureof_csum_v (

Returns

-

TRUE if checksum +

TRUE if checksum is a valid binary SHA256 checksum


ostree_validate_structureof_checksum_string ()

-
gboolean
+
gboolean
 ostree_validate_structureof_checksum_string
                                (const char *checksum,
-                                GError **error);
+ GError **error);

Parameters

a GVariant of type "ay"

a GVariant of type "ay"

 
@@ -1889,16 +1962,16 @@ ostree_validate_structureof_checksum_string

Returns

-

TRUE if checksum +

TRUE if checksum is a valid ASCII SHA256 checksum


ostree_validate_structureof_file_mode ()

-
gboolean
-ostree_validate_structureof_file_mode (guint32 mode,
-                                       GError **error);
+
gboolean
+ostree_validate_structureof_file_mode (guint32 mode,
+                                       GError **error);

Parameters

@@ -1923,16 +1996,16 @@ ostree_validate_structureof_file_mode (

Returns

-

TRUE if mode +

TRUE if mode represents a valid file type and permissions


ostree_validate_structureof_commit ()

-
gboolean
-ostree_validate_structureof_commit (GVariant *commit,
-                                    GError **error);
+
gboolean
+ostree_validate_structureof_commit (GVariant *commit,
+                                    GError **error);

Use this to validate the basic structure of commit , independent of any other objects it references.

@@ -1960,16 +2033,16 @@ any other objects it references.

Returns

-

TRUE if commit +

TRUE if commit is structurally valid


ostree_validate_structureof_dirtree ()

-
gboolean
-ostree_validate_structureof_dirtree (GVariant *dirtree,
-                                     GError **error);
+
gboolean
+ostree_validate_structureof_dirtree (GVariant *dirtree,
+                                     GError **error);

Use this to validate the basic structure of dirtree , independent of any other objects it references.

@@ -1997,16 +2070,16 @@ any other objects it references.

Returns

-

TRUE if dirtree +

TRUE if dirtree is structurally valid


ostree_validate_structureof_dirmeta ()

-
gboolean
-ostree_validate_structureof_dirmeta (GVariant *dirmeta,
-                                     GError **error);
+
gboolean
+ostree_validate_structureof_dirmeta (GVariant *dirmeta,
+                                     GError **error);

Use this to validate the basic structure of dirmeta .

@@ -2033,15 +2106,15 @@ ostree_validate_structureof_dirmeta (

Returns

-

TRUE if dirmeta +

TRUE if dirmeta is structurally valid


ostree_commit_get_parent ()

-
gchar *
-ostree_commit_get_parent (GVariant *commit_variant);
+
gchar *
+ostree_commit_get_parent (GVariant *commit_variant);

Parameters

@@ -2060,15 +2133,15 @@ ostree_commit_get_parent (

Returns

Checksum of the parent commit of commit_variant -, or NULL +, or NULL if none


ostree_commit_get_timestamp ()

-
guint64
-ostree_commit_get_timestamp (GVariant *commit_variant);
+
guint64
+ostree_commit_get_timestamp (GVariant *commit_variant);
diff --git a/apidoc/html/ostree-GPG-signature-verification-results.html b/apidoc/html/ostree-GPG-signature-verification-results.html index 6b7eec3b..df248994 100644 --- a/apidoc/html/ostree-GPG-signature-verification-results.html +++ b/apidoc/html/ostree-GPG-signature-verification-results.html @@ -41,7 +41,7 @@
+, or NULL.

@@ -244,22 +244,22 @@ signed by key_id

Returns

-

TRUE on success, FALSE on failure

+

TRUE on success, FALSE on failure


ostree_gpg_verify_result_get ()

-
GVariant *
+
GVariant *
 ostree_gpg_verify_result_get (OstreeGpgVerifyResult *result,
-                              guint signature_index,
+                              guint signature_index,
                               OstreeGpgSignatureAttr *attrs,
-                              guint n_attrs);
-

Builds a GVariant tuple of requested attributes for the GPG signature at + guint n_attrs);

+

Builds a GVariant tuple of requested attributes for the GPG signature at signature_index in result . See the OstreeGpgSignatureAttr description -for the GVariantType of each available attribute.

+for the GVariantType of each available attribute.

It is a programmer error to request an invalid OstreeGpgSignatureAttr or an invalid signature_index . Use ostree_gpg_verify_result_count_all() to @@ -300,29 +300,29 @@ array

Returns

-

a new, floating, GVariant tuple

+

a new, floating, GVariant tuple


ostree_gpg_verify_result_get_all ()

-
GVariant *
+
GVariant *
 ostree_gpg_verify_result_get_all (OstreeGpgVerifyResult *result,
-                                  guint signature_index);
-

Builds a GVariant tuple of all available attributes for the GPG signature + guint signature_index);

+

Builds a GVariant tuple of all available attributes for the GPG signature at signature_index in result .

-

The child values in the returned GVariant tuple are ordered to match the +

The child values in the returned GVariant tuple are ordered to match the OstreeGpgSignatureAttr enumeration, which means the enum values can be -used as index values in functions like g_variant_get_child(). See the -OstreeGpgSignatureAttr description for the GVariantType of each +used as index values in functions like g_variant_get_child(). See the +OstreeGpgSignatureAttr description for the GVariantType of each available attribute.

The OstreeGpgSignatureAttr enumeration may be extended in the future - with new attributes, which would affect the GVariant tuple returned by + with new attributes, which would affect the GVariant tuple returned by this function. While the position and type of current child values in - the GVariant tuple will not change, to avoid backward-compatibility + the GVariant tuple will not change, to avoid backward-compatibility issues please do not depend on the tuple's overall size or type signature.

@@ -355,7 +355,7 @@ available attribute.

Returns

-

a new, floating, GVariant tuple

+

a new, floating, GVariant tuple


@@ -363,9 +363,9 @@ available attribute.

ostree_gpg_verify_result_describe ()

void
 ostree_gpg_verify_result_describe (OstreeGpgVerifyResult *result,
-                                   guint signature_index,
-                                   GString *output_buffer,
-                                   const gchar *line_prefix,
+                                   guint signature_index,
+                                   GString *output_buffer,
+                                   const gchar *line_prefix,
                                    OstreeGpgSignatureFormatFlags flags);

Appends a brief, human-readable description of the GPG signature at signature_index @@ -404,7 +404,7 @@ format. Currently must be 0.

- + @@ -426,11 +426,11 @@ format. Currently must be 0.

ostree_gpg_verify_result_describe_variant ()

void
 ostree_gpg_verify_result_describe_variant
-                               (GVariant *variant,
-                                GString *output_buffer,
-                                const gchar *line_prefix,
+                               (GVariant *variant,
+                                GString *output_buffer,
+                                const gchar *line_prefix,
                                 OstreeGpgSignatureFormatFlags flags);
-

Similar to ostree_gpg_verify_result_describe() but takes a GVariant of +

Similar to ostree_gpg_verify_result_describe() but takes a GVariant of all attributes for a GPG signature instead of an OstreeGpgVerifyResult and signature index.

The variant @@ -447,12 +447,12 @@ and signature index.

- + - + @@ -472,14 +472,14 @@ and signature index.


ostree_gpg_verify_result_require_valid_signature ()

-
gboolean
+
gboolean
 ostree_gpg_verify_result_require_valid_signature
                                (OstreeGpgVerifyResult *result,
-                                GError **error);
+ GError **error);

Checks if the result contains at least one signature from the trusted keyring. You can call this function immediately after ostree_repo_verify_summary() or ostree_repo_verify_commit_ext() - -it will handle the NULL result +it will handle the NULL result and filled error too.

@@ -498,7 +498,7 @@ it will handle the

error

-
+ @@ -506,9 +506,9 @@ it will handle the

Returns

-

TRUE if result -was not NULL and had at least one -signature from trusted keyring, otherwise FALSE

+

TRUE if result +was not NULL and had at least one +signature from trusted keyring, otherwise FALSE

@@ -524,7 +524,7 @@ signature from trusted keyring, otherwise

enum OstreeGpgSignatureAttr

Signature attributes available from an OstreeGpgVerifyResult. -The attribute's GVariantType is shown in brackets.

+The attribute's GVariantType is shown in brackets.

Members

-guint +guint ostree_gpg_verify_result_count_all () @@ -49,7 +49,7 @@
-guint +guint ostree_gpg_verify_result_count_valid () @@ -57,7 +57,7 @@
-gboolean +gboolean ostree_gpg_verify_result_lookup () @@ -65,7 +65,7 @@
-GVariant * +GVariant * ostree_gpg_verify_result_get () @@ -73,7 +73,7 @@
-GVariant * +GVariant * ostree_gpg_verify_result_get_all () @@ -97,7 +97,7 @@
-gboolean +gboolean ostree_gpg_verify_result_require_valid_signature () @@ -146,7 +146,7 @@ or get all signature details with

Functions

ostree_gpg_verify_result_count_all ()

-
guint
+
guint
 ostree_gpg_verify_result_count_all (OstreeGpgVerifyResult *result);

Counts all the signatures in result .

@@ -173,7 +173,7 @@ ostree_gpg_verify_result_count_all (

ostree_gpg_verify_result_count_valid ()

-
guint
+
guint
 ostree_gpg_verify_result_count_valid (OstreeGpgVerifyResult *result);

Counts only the valid signatures in result .

@@ -200,17 +200,17 @@ ostree_gpg_verify_result_count_valid (

ostree_gpg_verify_result_lookup ()

-
gboolean
+
gboolean
 ostree_gpg_verify_result_lookup (OstreeGpgVerifyResult *result,
-                                 const gchar *key_id,
-                                 guint *out_signature_index);
+ const gchar *key_id, + guint *out_signature_index);

Searches result for a signature signed by key_id . If a match is found, -the function returns TRUE and sets out_signature_index +the function returns TRUE and sets out_signature_index so that further signature details can be obtained through ostree_gpg_verify_result_get(). -If no match is found, the function returns FALSE and leaves +If no match is found, the function returns FALSE and leaves out_signature_index unchanged.

@@ -236,7 +236,7 @@ If no match is found, the function returns

out_signature_index

return location for the index of the signature signed by key_id -, or NULL.

[out]

output_buffer

a GString to hold the description

a GString to hold the description

 

variant

a GVariant from ostree_gpg_verify_result_get_all()

a GVariant from ostree_gpg_verify_result_get_all()

 

output_buffer

a GString to hold the description

a GString to hold the description

 

A GError

A GError

 
@@ -537,56 +537,56 @@ The attribute's

OSTREE_GPG_SIGNATURE_ATTR_VALID

@@ -594,7 +594,7 @@ The attribute's

OSTREE_GPG_SIGNATURE_ATTR_PUBKEY_ALGO_NAME

@@ -602,7 +602,7 @@ The attribute's

OSTREE_GPG_SIGNATURE_ATTR_HASH_ALGO_NAME

@@ -610,14 +610,14 @@ The attribute's

OSTREE_GPG_SIGNATURE_ATTR_USER_NAME

diff --git a/apidoc/html/ostree-In-memory-modifiable-filesystem-tree.html b/apidoc/html/ostree-In-memory-modifiable-filesystem-tree.html index 9e58eb2a..6cec6408 100644 --- a/apidoc/html/ostree-In-memory-modifiable-filesystem-tree.html +++ b/apidoc/html/ostree-In-memory-modifiable-filesystem-tree.html @@ -79,7 +79,7 @@ - + @@ -281,12 +281,12 @@ exist.


ostree_mutable_tree_walk ()

-
gboolean
+
gboolean
 ostree_mutable_tree_walk (OstreeMutableTree *self,
-                          GPtrArray *split_path,
-                          guint start,
+                          GPtrArray *split_path,
+                          guint start,
                           OstreeMutableTree **out_subdir,
-                          GError **error);
+ GError **error);

Traverse start number of elements starting from split_path ; the @@ -334,7 +334,7 @@ child will be returned in out_subdir


ostree_mutable_tree_get_subdirs ()

-
GHashTable *
+
GHashTable *
 ostree_mutable_tree_get_subdirs (OstreeMutableTree *self);

Returns

@@ -345,7 +345,7 @@ ostree_mutable_tree_get_subdirs (

ostree_mutable_tree_get_files ()

-
GHashTable *
+
GHashTable *
 ostree_mutable_tree_get_files (OstreeMutableTree *self);

Returns

diff --git a/apidoc/html/ostree-Progress-notification-system-for-asynchronous-operations.html b/apidoc/html/ostree-Progress-notification-system-for-asynchronous-operations.html index ef53bdc7..588132f6 100644 --- a/apidoc/html/ostree-Progress-notification-system-for-asynchronous-operations.html +++ b/apidoc/html/ostree-Progress-notification-system-for-asynchronous-operations.html @@ -65,7 +65,7 @@
-

[G_VARIANT_TYPE_BOOLEAN] Is the signature valid?

+

[G_VARIANT_TYPE_BOOLEAN] Is the signature valid?

 

OSTREE_GPG_SIGNATURE_ATTR_SIG_EXPIRED

-

[G_VARIANT_TYPE_BOOLEAN] Has the signature expired?

+

[G_VARIANT_TYPE_BOOLEAN] Has the signature expired?

 

OSTREE_GPG_SIGNATURE_ATTR_KEY_EXPIRED

-

[G_VARIANT_TYPE_BOOLEAN] Has the signing key expired?

+

[G_VARIANT_TYPE_BOOLEAN] Has the signing key expired?

 

OSTREE_GPG_SIGNATURE_ATTR_KEY_REVOKED

-

[G_VARIANT_TYPE_BOOLEAN] Has the signing key been revoked?

+

[G_VARIANT_TYPE_BOOLEAN] Has the signing key been revoked?

 

OSTREE_GPG_SIGNATURE_ATTR_KEY_MISSING

-

[G_VARIANT_TYPE_BOOLEAN] Is the signing key missing?

+

[G_VARIANT_TYPE_BOOLEAN] Is the signing key missing?

 

OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT

-

[G_VARIANT_TYPE_STRING] Fingerprint of the signing key

+

[G_VARIANT_TYPE_STRING] Fingerprint of the signing key

 

OSTREE_GPG_SIGNATURE_ATTR_TIMESTAMP

-

[G_VARIANT_TYPE_INT64] Signature creation Unix timestamp

+

[G_VARIANT_TYPE_INT64] Signature creation Unix timestamp

 

OSTREE_GPG_SIGNATURE_ATTR_EXP_TIMESTAMP

-

[G_VARIANT_TYPE_INT64] Signature expiration Unix timestamp (0 if no +

[G_VARIANT_TYPE_INT64] Signature expiration Unix timestamp (0 if no expiration)

  -

[G_VARIANT_TYPE_STRING] Name of the public key algorithm used to create +

[G_VARIANT_TYPE_STRING] Name of the public key algorithm used to create the signature

  -

[G_VARIANT_TYPE_STRING] Name of the hash algorithm used to create the +

[G_VARIANT_TYPE_STRING] Name of the hash algorithm used to create the signature

  -

[G_VARIANT_TYPE_STRING] The name of the signing key's primary user

+

[G_VARIANT_TYPE_STRING] The name of the signing key's primary user

 

OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL

-

[G_VARIANT_TYPE_STRING] The email address of the signing key's primary +

[G_VARIANT_TYPE_STRING] The email address of the signing key's primary user

 
-gboolean +gboolean ostree_mutable_tree_replace_file () @@ -87,7 +87,7 @@
-gboolean +gboolean ostree_mutable_tree_ensure_dir () @@ -95,7 +95,7 @@
-gboolean +gboolean ostree_mutable_tree_lookup () @@ -103,7 +103,7 @@
-gboolean +gboolean ostree_mutable_tree_ensure_parent_dirs () @@ -111,7 +111,7 @@
-gboolean +gboolean ostree_mutable_tree_walk () @@ -119,7 +119,7 @@
-GHashTable * +GHashTable * ostree_mutable_tree_get_subdirs () @@ -127,7 +127,7 @@
-GHashTable * +GHashTable * ostree_mutable_tree_get_files () @@ -202,41 +202,41 @@ ostree_mutable_tree_get_contents_checksum

ostree_mutable_tree_replace_file ()

-
gboolean
+
gboolean
 ostree_mutable_tree_replace_file (OstreeMutableTree *self,
                                   const char *name,
                                   const char *checksum,
-                                  GError **error);
+ GError **error);

ostree_mutable_tree_ensure_dir ()

-
gboolean
+
gboolean
 ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
                                 const char *name,
                                 OstreeMutableTree **out_subdir,
-                                GError **error);
+ GError **error);

ostree_mutable_tree_lookup ()

-
gboolean
+
gboolean
 ostree_mutable_tree_lookup (OstreeMutableTree *self,
                             const char *name,
                             char **out_file_checksum,
                             OstreeMutableTree **out_subdir,
-                            GError **error);
+ GError **error);

ostree_mutable_tree_ensure_parent_dirs ()

-
gboolean
+
gboolean
 ostree_mutable_tree_ensure_parent_dirs
                                (OstreeMutableTree *self,
-                                GPtrArray *split_path,
+                                GPtrArray *split_path,
                                 const char *metadata_checksum,
                                 OstreeMutableTree **out_parent,
-                                GError **error);
+ GError **error);

Create all parent trees necessary for the given split_path to exist.

@@ -271,7 +271,7 @@ exist.

error

a GError

a GError

 
-guint +guint ostree_async_progress_get_uint () @@ -73,7 +73,7 @@
-guint64 +guint64 ostree_async_progress_get_uint64 () @@ -156,7 +156,7 @@ ostree_async_progress_new (void

ostree_async_progress_new_and_connect ()

OstreeAsyncProgress *
 ostree_async_progress_new_and_connect (void (*changed) (OstreeAsyncProgress *self, gpointer user_data),
-                                       gpointer user_data);
+ gpointer user_data);
@@ -167,14 +167,14 @@ ostree_async_progress_get_status (

ostree_async_progress_get_uint ()

-
guint
+
guint
 ostree_async_progress_get_uint (OstreeAsyncProgress *self,
                                 const char *key);

ostree_async_progress_get_uint64 ()

-
guint64
+
guint64
 ostree_async_progress_get_uint64 (OstreeAsyncProgress *self,
                                   const char *key);
@@ -191,7 +191,7 @@ ostree_async_progress_set_status (void ostree_async_progress_set_uint (OstreeAsyncProgress *self, const char *key, - guint value); + guint value);

@@ -199,7 +199,7 @@ ostree_async_progress_set_uint (void ostree_async_progress_set_uint64 (OstreeAsyncProgress *self, const char *key, - guint64 value); + guint64 value);

diff --git a/apidoc/html/ostree-Root-partition-mount-point.html b/apidoc/html/ostree-Root-partition-mount-point.html index 51a6d1b6..0e974b9e 100644 --- a/apidoc/html/ostree-Root-partition-mount-point.html +++ b/apidoc/html/ostree-Root-partition-mount-point.html @@ -57,7 +57,7 @@
-GFile * +GFile * ostree_sysroot_get_path () @@ -65,7 +65,7 @@
-gboolean +gboolean ostree_sysroot_load () @@ -73,7 +73,7 @@
-gboolean +gboolean ostree_sysroot_load_if_changed () @@ -81,7 +81,7 @@
-gboolean +gboolean ostree_sysroot_lock () @@ -89,7 +89,7 @@
-gboolean +gboolean ostree_sysroot_try_lock () @@ -105,7 +105,7 @@
-gboolean +gboolean ostree_sysroot_lock_finish () @@ -137,7 +137,7 @@
-gboolean +gboolean ostree_sysroot_ensure_initialized () @@ -161,7 +161,7 @@
-GPtrArray * +GPtrArray * ostree_sysroot_get_deployments () @@ -177,7 +177,7 @@
-GFile * +GFile * ostree_sysroot_get_deployment_directory () @@ -193,7 +193,7 @@
-GFile * +GFile * ostree_sysroot_get_deployment_origin_path () @@ -201,7 +201,7 @@
-gboolean +gboolean ostree_sysroot_cleanup () @@ -209,7 +209,7 @@
-gboolean +gboolean ostree_sysroot_prepare_cleanup () @@ -217,7 +217,7 @@
-gboolean +gboolean ostree_sysroot_get_repo () @@ -225,7 +225,7 @@
-gboolean +gboolean ostree_sysroot_init_osname () @@ -233,7 +233,7 @@
-gboolean +gboolean ostree_sysroot_deployment_set_kargs () @@ -241,7 +241,7 @@
-gboolean +gboolean ostree_sysroot_deployment_set_mutable () @@ -249,7 +249,7 @@
-gboolean +gboolean ostree_sysroot_deployment_unlock () @@ -257,7 +257,7 @@
-gboolean +gboolean ostree_sysroot_write_deployments () @@ -265,7 +265,7 @@
-gboolean +gboolean ostree_sysroot_write_origin_file () @@ -273,7 +273,7 @@
-gboolean +gboolean ostree_sysroot_deploy_tree () @@ -289,7 +289,7 @@
-GKeyFile * +GKeyFile * ostree_sysroot_origin_new_from_refspec () @@ -297,7 +297,7 @@
-gboolean +gboolean ostree_sysroot_simple_write_deployment () @@ -340,7 +340,7 @@ perform locking externally.

ostree_sysroot_new ()

OstreeSysroot *
-ostree_sysroot_new (GFile *path);
+ostree_sysroot_new (GFile *path);

Parameters

@@ -351,7 +351,7 @@ ostree_sysroot_new (

path

-
+

Path to a system root directory, or NULL.

Path to a system root directory, or NULL.

[allow-none]
@@ -377,7 +377,7 @@ ostree_sysroot_new_default (void<

ostree_sysroot_get_path ()

-
GFile *
+
GFile *
 ostree_sysroot_get_path (OstreeSysroot *self);

Returns

@@ -388,10 +388,10 @@ ostree_sysroot_get_path (

ostree_sysroot_load ()

-
gboolean
+
gboolean
 ostree_sysroot_load (OstreeSysroot *self,
-                     GCancellable *cancellable,
-                     GError **error);
+ GCancellable *cancellable, + GError **error);

Load deployment list, bootversion, and subbootversion from the rootfs self .

@@ -426,18 +426,18 @@ rootfs self

ostree_sysroot_load_if_changed ()

-
gboolean
+
gboolean
 ostree_sysroot_load_if_changed (OstreeSysroot *self,
-                                gboolean *out_changed,
-                                GCancellable *cancellable,
-                                GError **error);
+ gboolean *out_changed, + GCancellable *cancellable, + GError **error);

ostree_sysroot_lock ()

-
gboolean
+
gboolean
 ostree_sysroot_lock (OstreeSysroot *self,
-                     GError **error);
+ GError **error);

Acquire an exclusive multi-process write lock for self . This call blocks until the lock has been acquired. The lock is not @@ -471,15 +471,15 @@ be released if self


ostree_sysroot_try_lock ()

-
gboolean
+
gboolean
 ostree_sysroot_try_lock (OstreeSysroot *self,
-                         gboolean *out_acquired,
-                         GError **error);
+ gboolean *out_acquired, + GError **error);

Try to acquire an exclusive multi-process write lock for self . If another process holds the lock, this function will return immediately, setting out_acquired - to FALSE, and returning TRUE + to FALSE, and returning TRUE (and no error).

Release the lock with ostree_sysroot_unlock(). The lock will also be released if self @@ -517,9 +517,9 @@ be released if self

ostree_sysroot_lock_async ()

void
 ostree_sysroot_lock_async (OstreeSysroot *self,
-                           GCancellable *cancellable,
-                           GAsyncReadyCallback callback,
-                           gpointer user_data);
+ GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data);

An asynchronous version of ostree_sysroot_lock().

Parameters

@@ -557,10 +557,10 @@ ostree_sysroot_lock_async (

ostree_sysroot_lock_finish ()

-
gboolean
+
gboolean
 ostree_sysroot_lock_finish (OstreeSysroot *self,
-                            GAsyncResult *result,
-                            GError **error);
+ GAsyncResult *result, + GError **error);

Call when ostree_sysroot_lock_async() is ready.

Parameters

@@ -672,10 +672,10 @@ calling this function.


ostree_sysroot_ensure_initialized ()

-
gboolean
+
gboolean
 ostree_sysroot_ensure_initialized (OstreeSysroot *self,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GCancellable *cancellable, + GError **error);

Ensure that self is set up as a valid rootfs, by creating /ostree/repo, among other things.

@@ -722,7 +722,7 @@ ostree_sysroot_get_subbootversion (

ostree_sysroot_get_deployments ()

-
GPtrArray *
+
GPtrArray *
 ostree_sysroot_get_deployments (OstreeSysroot *self);

Parameters

@@ -767,14 +767,14 @@ ostree_sysroot_get_booted_deployment (

Returns

-

The currently booted deployment, or NULL if none.

+

The currently booted deployment, or NULL if none.

[transfer none]


ostree_sysroot_get_deployment_directory ()

-
GFile *
+
GFile *
 ostree_sysroot_get_deployment_directory
                                (OstreeSysroot *self,
                                 OstreeDeployment *deployment);
@@ -846,9 +846,9 @@ or concatenate it with the full

ostree_sysroot_get_deployment_origin_path ()

-
GFile *
+
GFile *
 ostree_sysroot_get_deployment_origin_path
-                               (GFile *deployment_path);
+ (GFile *deployment_path);

Parameters

@@ -873,10 +873,10 @@ ostree_sysroot_get_deployment_origin_path

ostree_sysroot_cleanup ()

-
gboolean
+
gboolean
 ostree_sysroot_cleanup (OstreeSysroot *self,
-                        GCancellable *cancellable,
-                        GError **error);
+ GCancellable *cancellable, + GError **error);

Delete any state that resulted from a partially completed transaction, such as incomplete deployments.

@@ -910,10 +910,10 @@ transaction, such as incomplete deployments.


ostree_sysroot_prepare_cleanup ()

-
gboolean
+
gboolean
 ostree_sysroot_prepare_cleanup (OstreeSysroot *self,
-                                GCancellable *cancellable,
-                                GError **error);
+ GCancellable *cancellable, + GError **error);

Like ostree_sysroot_cleanup() in that it cleans up incomplete deployments and old boot versions, but does NOT prune the repository.

@@ -947,11 +947,11 @@ and old boot versions, but does NOT prune the repository.


ostree_sysroot_get_repo ()

-
gboolean
+
gboolean
 ostree_sysroot_get_repo (OstreeSysroot *self,
                          OstreeRepo **out_repo,
-                         GCancellable *cancellable,
-                         GError **error);
+ GCancellable *cancellable, + GError **error);

Retrieve the OSTree repository in sysroot self .

@@ -991,11 +991,11 @@ ostree_sysroot_get_repo (

ostree_sysroot_init_osname ()

-
gboolean
+
gboolean
 ostree_sysroot_init_osname (OstreeSysroot *self,
                             const char *osname,
-                            GCancellable *cancellable,
-                            GError **error);
+ GCancellable *cancellable, + GError **error);

Initialize the directory structure for an "osname", which is a group of operating system deployments, with a shared /var. One is required for generating a deployment.

@@ -1035,12 +1035,12 @@ is required for generating a deployment.


ostree_sysroot_deployment_set_kargs ()

-
gboolean
+
gboolean
 ostree_sysroot_deployment_set_kargs (OstreeSysroot *self,
                                      OstreeDeployment *deployment,
                                      char **new_kargs,
-                                     GCancellable *cancellable,
-                                     GError **error);
+ GCancellable *cancellable, + GError **error);

Entirely replace the kernel arguments of deployment with the values in new_kargs @@ -1086,12 +1086,12 @@ values in new_kargs


ostree_sysroot_deployment_set_mutable ()

-
gboolean
+
gboolean
 ostree_sysroot_deployment_set_mutable (OstreeSysroot *self,
                                        OstreeDeployment *deployment,
-                                       gboolean is_mutable,
-                                       GCancellable *cancellable,
-                                       GError **error);
+ gboolean is_mutable, + GCancellable *cancellable, + GError **error);

By default, deployment directories are not mutable. This function will allow making them temporarily mutable, for example to allow layering additional non-OSTree content.

@@ -1131,12 +1131,12 @@ layering additional non-OSTree content.


ostree_sysroot_deployment_unlock ()

-
gboolean
+
gboolean
 ostree_sysroot_deployment_unlock (OstreeSysroot *self,
                                   OstreeDeployment *deployment,
                                   OstreeDeploymentUnlockedState unlocked_state,
-                                  GCancellable *cancellable,
-                                  GError **error);
+ GCancellable *cancellable, + GError **error);

Configure the target deployment deployment such that it is writable. There are multiple modes, essentially differing @@ -1184,11 +1184,11 @@ across reboots.


ostree_sysroot_write_deployments ()

-
gboolean
+
gboolean
 ostree_sysroot_write_deployments (OstreeSysroot *self,
-                                  GPtrArray *new_deployments,
-                                  GCancellable *cancellable,
-                                  GError **error);
+ GPtrArray *new_deployments, + GCancellable *cancellable, + GError **error);

Assuming new_deployments have already been deployed in place on disk, atomically update bootloader configuration.

@@ -1228,17 +1228,17 @@ disk, atomically update bootloader configuration.


ostree_sysroot_write_origin_file ()

-
gboolean
+
gboolean
 ostree_sysroot_write_origin_file (OstreeSysroot *sysroot,
                                   OstreeDeployment *deployment,
-                                  GKeyFile *new_origin,
-                                  GCancellable *cancellable,
-                                  GError **error);
+ GKeyFile *new_origin, + GCancellable *cancellable, + GError **error);

Immediately replace the origin file of the referenced deployment with the contents of new_origin . If new_origin - is NULL, + is NULL, this function will write the current origin of deployment .

@@ -1282,16 +1282,16 @@ this function will write the current origin of deplo

ostree_sysroot_deploy_tree ()

-
gboolean
+
gboolean
 ostree_sysroot_deploy_tree (OstreeSysroot *self,
                             const char *osname,
                             const char *revision,
-                            GKeyFile *origin,
+                            GKeyFile *origin,
                             OstreeDeployment *provided_merge_deployment,
                             char **override_kernel_argv,
                             OstreeDeployment **out_new_deployment,
-                            GCancellable *cancellable,
-                            GError **error);
+ GCancellable *cancellable, + GError **error);

Check out deployment tree with revision revision , performing a 3 way merge with provided_merge_deployment @@ -1332,7 +1332,7 @@ way merge with provided_merge_deployment

- + @@ -1393,7 +1393,7 @@ the first one in the current deployment list which matches osname.


ostree_sysroot_origin_new_from_refspec ()

-
GKeyFile *
+
GKeyFile *
 ostree_sysroot_origin_new_from_refspec
                                (OstreeSysroot *self,
                                 const char *refspec);
@@ -1422,15 +1422,15 @@ as an origin.


ostree_sysroot_simple_write_deployment ()

-
gboolean
+
gboolean
 ostree_sysroot_simple_write_deployment
                                (OstreeSysroot *sysroot,
                                 const char *osname,
                                 OstreeDeployment *new_deployment,
                                 OstreeDeployment *merge_deployment,
                                 OstreeSysrootSimpleWriteDeploymentFlags flags,
-                                GCancellable *cancellable,
-                                GError **error);
+ GCancellable *cancellable, + GError **error);

Prepend new_deployment to the list of deployments, commit, and cleanup. By default, all other deployments for the given osname diff --git a/apidoc/html/ostree-SELinux-policy-management.html b/apidoc/html/ostree-SELinux-policy-management.html index e73f0cc4..47e03010 100644 --- a/apidoc/html/ostree-SELinux-policy-management.html +++ b/apidoc/html/ostree-SELinux-policy-management.html @@ -49,7 +49,7 @@

override_kernel_argv

Use these as kernel arguments; if NULL, inherit options from provided_merge_deployment.

Use these as kernel arguments; if NULL, inherit options from provided_merge_deployment.

[allow-none][array zero-terminated=1][element-type utf8]
-GFile * +GFile * ostree_sepolicy_get_path () @@ -64,7 +64,7 @@
-gboolean +gboolean ostree_sepolicy_get_label () @@ -79,7 +79,7 @@
-gboolean +gboolean ostree_sepolicy_restorecon () @@ -87,7 +87,7 @@
-gboolean +gboolean ostree_sepolicy_setfscreatecon () @@ -133,9 +133,9 @@ root and perform labeling.

ostree_sepolicy_new ()

OstreeSePolicy *
-ostree_sepolicy_new (GFile *path,
-                     GCancellable *cancellable,
-                     GError **error);
+ostree_sepolicy_new (GFile *path, + GCancellable *cancellable, + GError **error);

Parameters

@@ -161,7 +161,7 @@ ostree_sepolicy_new (

ostree_sepolicy_get_path ()

-
GFile *
+
GFile *
 ostree_sepolicy_get_path (OstreeSePolicy *self);

Returns

@@ -183,18 +183,18 @@ ostree_sepolicy_get_name (

ostree_sepolicy_get_label ()

-
gboolean
+
gboolean
 ostree_sepolicy_get_label (OstreeSePolicy *self,
                            const char *relpath,
-                           guint32 unix_mode,
+                           guint32 unix_mode,
                            char **out_label,
-                           GCancellable *cancellable,
-                           GError **error);
+ GCancellable *cancellable, + GError **error);

Store in out_label the security context for the given relpath and mode unix_mode -. If the policy does not specify a label, NULL +. If the policy does not specify a label, NULL will be returned.

Parameters

@@ -253,15 +253,15 @@ ostree_sepolicy_get_csum (

ostree_sepolicy_restorecon ()

-
gboolean
+
gboolean
 ostree_sepolicy_restorecon (OstreeSePolicy *self,
                             const char *path,
-                            GFileInfo *info,
-                            GFile *target,
+                            GFileInfo *info,
+                            GFile *target,
                             OstreeSePolicyRestoreconFlags flags,
                             char **out_new_label,
-                            GCancellable *cancellable,
-                            GError **error);
+ GCancellable *cancellable, + GError **error);

Reset the security context of target based on the SELinux policy.

@@ -300,7 +300,7 @@ ostree_sepolicy_restorecon (

out_new_label

-
+ @@ -320,11 +320,11 @@ ostree_sepolicy_restorecon (

ostree_sepolicy_setfscreatecon ()

-
gboolean
+
gboolean
 ostree_sepolicy_setfscreatecon (OstreeSePolicy *self,
                                 const char *path,
-                                guint32 mode,
-                                GError **error);
+ guint32 mode, + GError **error);

Parameters

New label, or NULL if unchanged.

New label, or NULL if unchanged.

[allow-none][out]
diff --git a/apidoc/html/ostree-Simple-upgrade-class.html b/apidoc/html/ostree-Simple-upgrade-class.html index 29d25638..e02cfa2c 100644 --- a/apidoc/html/ostree-Simple-upgrade-class.html +++ b/apidoc/html/ostree-Simple-upgrade-class.html @@ -65,7 +65,7 @@
-GKeyFile * +GKeyFile * ostree_sysroot_upgrader_get_origin () @@ -73,7 +73,7 @@
-GKeyFile * +GKeyFile * ostree_sysroot_upgrader_dup_origin () @@ -81,7 +81,7 @@
-gboolean +gboolean ostree_sysroot_upgrader_set_origin () @@ -97,7 +97,7 @@
-gboolean +gboolean ostree_sysroot_upgrader_check_timestamps () @@ -105,7 +105,7 @@
-gboolean +gboolean ostree_sysroot_upgrader_pull () @@ -113,7 +113,7 @@
-gboolean +gboolean ostree_sysroot_upgrader_pull_one_dir () @@ -121,7 +121,7 @@
-gboolean +gboolean ostree_sysroot_upgrader_deploy () @@ -164,8 +164,8 @@ operations.

ostree_sysroot_upgrader_new ()

OstreeSysrootUpgrader *
 ostree_sysroot_upgrader_new (OstreeSysroot *sysroot,
-                             GCancellable *cancellable,
-                             GError **error);
+ GCancellable *cancellable, + GError **error);

Parameters

@@ -193,8 +193,8 @@ ostree_sysroot_upgrader_new (OstreeSysrootUpgrader * ostree_sysroot_upgrader_new_for_os (OstreeSysroot *sysroot, const char *osname, - GCancellable *cancellable, - GError **error); + GCancellable *cancellable, + GError **error);

Parameters

@@ -231,8 +231,8 @@ ostree_sysroot_upgrader_new_for_os_with_flags (OstreeSysroot *sysroot, const char *osname, OstreeSysrootUpgraderFlags flags, - GCancellable *cancellable, - GError **error); + GCancellable *cancellable, + GError **error);

Parameters

@@ -269,7 +269,7 @@ ostree_sysroot_upgrader_new_for_os_with_flags

ostree_sysroot_upgrader_get_origin ()

-
GKeyFile *
+
GKeyFile *
 ostree_sysroot_upgrader_get_origin (OstreeSysrootUpgrader *self);

Parameters

@@ -288,14 +288,14 @@ ostree_sysroot_upgrader_get_origin (

Returns

-

The origin file, or NULL if unknown.

+

The origin file, or NULL if unknown.

[transfer none]


ostree_sysroot_upgrader_dup_origin ()

-
GKeyFile *
+
GKeyFile *
 ostree_sysroot_upgrader_dup_origin (OstreeSysrootUpgrader *self);

Parameters

@@ -314,18 +314,18 @@ ostree_sysroot_upgrader_dup_origin (

Returns

-

A copy of the origin file, or NULL if unknown.

+

A copy of the origin file, or NULL if unknown.

[transfer full]


ostree_sysroot_upgrader_set_origin ()

-
gboolean
+
gboolean
 ostree_sysroot_upgrader_set_origin (OstreeSysrootUpgrader *self,
-                                    GKeyFile *origin,
-                                    GCancellable *cancellable,
-                                    GError **error);
+ GKeyFile *origin, + GCancellable *cancellable, + GError **error);

Replace the origin with origin .

@@ -384,18 +384,18 @@ ostree_sysroot_upgrader_get_origin_description

Returns

-

A one-line descriptive summary of the origin, or NULL if unknown

+

A one-line descriptive summary of the origin, or NULL if unknown


ostree_sysroot_upgrader_check_timestamps ()

-
gboolean
+
gboolean
 ostree_sysroot_upgrader_check_timestamps
                                (OstreeRepo *repo,
                                 const char *from_rev,
                                 const char *to_rev,
-                                GError **error);
+ GError **error);

Check that the timestamp on to_rev is equal to or newer than from_rev @@ -437,21 +437,21 @@ attackers which provide a client with an older commit.


ostree_sysroot_upgrader_pull ()

-
gboolean
+
gboolean
 ostree_sysroot_upgrader_pull (OstreeSysrootUpgrader *self,
                               OstreeRepoPullFlags flags,
                               OstreeSysrootUpgraderPullFlags upgrader_flags,
                               OstreeAsyncProgress *progress,
-                              gboolean *out_changed,
-                              GCancellable *cancellable,
-                              GError **error);
+ gboolean *out_changed, + GCancellable *cancellable, + GError **error);

Perform a pull from the origin. First check if the ref has changed, if so download the linked objects, and store the updated ref locally. Then out_changed - will be TRUE.

+ will be TRUE.

If the origin remote is unchanged, out_changed will be set to -FALSE.

+FALSE.

Parameters

@@ -503,15 +503,15 @@ ref locally. Then out_changed

ostree_sysroot_upgrader_pull_one_dir ()

-
gboolean
+
gboolean
 ostree_sysroot_upgrader_pull_one_dir (OstreeSysrootUpgrader *self,
                                       const char *dir_to_pull,
                                       OstreeRepoPullFlags flags,
                                       OstreeSysrootUpgraderPullFlags upgrader_flags,
                                       OstreeAsyncProgress *progress,
-                                      gboolean *out_changed,
-                                      GCancellable *cancellable,
-                                      GError **error);
+ gboolean *out_changed, + GCancellable *cancellable, + GError **error);

Like ostree_sysroot_upgrader_pull(), but allows retrieving just a subpath of the tree. This can be used to download metadata files from inside the tree such as package databases.

@@ -519,10 +519,10 @@ from inside the tree such as package databases.


ostree_sysroot_upgrader_deploy ()

-
gboolean
+
gboolean
 ostree_sysroot_upgrader_deploy (OstreeSysrootUpgrader *self,
-                                GCancellable *cancellable,
-                                GError **error);
+ GCancellable *cancellable, + GError **error);

Write the new deployment to disk, perform a configuration merge with /etc, and update the bootloader configuration.

@@ -614,6 +614,11 @@ with /etc, and update the bootloader configuration.

+ + + + +
   

OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC

  
diff --git a/apidoc/html/ostree-ostree-bootconfig-parser.html b/apidoc/html/ostree-ostree-bootconfig-parser.html index 27cad96e..476e0e45 100644 --- a/apidoc/html/ostree-ostree-bootconfig-parser.html +++ b/apidoc/html/ostree-ostree-bootconfig-parser.html @@ -57,7 +57,7 @@
-gboolean +gboolean ostree_bootconfig_parser_parse () @@ -65,7 +65,7 @@
-gboolean +gboolean ostree_bootconfig_parser_parse_at () @@ -73,7 +73,7 @@
-gboolean +gboolean ostree_bootconfig_parser_write () @@ -81,7 +81,7 @@
-gboolean +gboolean ostree_bootconfig_parser_write_at () @@ -158,21 +158,21 @@ ostree_bootconfig_parser_clone (

ostree_bootconfig_parser_parse ()

-
gboolean
+
gboolean
 ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
-                                GFile *path,
-                                GCancellable *cancellable,
-                                GError **error);
+ GFile *path, + GCancellable *cancellable, + GError **error);

ostree_bootconfig_parser_parse_at ()

-
gboolean
+
gboolean
 ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
                                    int dfd,
                                    const char *path,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GCancellable *cancellable, + GError **error);

Initialize a bootconfig from the given file.

Parameters

@@ -215,21 +215,21 @@ ostree_bootconfig_parser_parse_at (

ostree_bootconfig_parser_write ()

-
gboolean
+
gboolean
 ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
-                                GFile *output,
-                                GCancellable *cancellable,
-                                GError **error);
+ GFile *output, + GCancellable *cancellable, + GError **error);

ostree_bootconfig_parser_write_at ()

-
gboolean
+
gboolean
 ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
                                    int dfd,
                                    const char *path,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GCancellable *cancellable, + GError **error);

diff --git a/apidoc/html/ostree-ostree-chain-input-stream.html b/apidoc/html/ostree-ostree-chain-input-stream.html index 98706ac1..495053c2 100644 --- a/apidoc/html/ostree-ostree-chain-input-stream.html +++ b/apidoc/html/ostree-ostree-chain-input-stream.html @@ -69,7 +69,7 @@

ostree_chain_input_stream_new ()

OstreeChainInputStream *
-ostree_chain_input_stream_new (GPtrArray *streams);
+ostree_chain_input_stream_new (GPtrArray *streams);
diff --git a/apidoc/html/ostree-ostree-checksum-input-stream.html b/apidoc/html/ostree-ostree-checksum-input-stream.html index 90d2b818..89d2ab98 100644 --- a/apidoc/html/ostree-ostree-checksum-input-stream.html +++ b/apidoc/html/ostree-ostree-checksum-input-stream.html @@ -69,8 +69,8 @@

ostree_checksum_input_stream_new ()

OstreeChecksumInputStream *
-ostree_checksum_input_stream_new (GInputStream *stream,
-                                  GChecksum *checksum);
+ostree_checksum_input_stream_new (GInputStream *stream, + GChecksum *checksum);
diff --git a/apidoc/html/ostree-ostree-deployment.html b/apidoc/html/ostree-ostree-deployment.html index fbd7e98e..d276aaef 100644 --- a/apidoc/html/ostree-ostree-deployment.html +++ b/apidoc/html/ostree-ostree-deployment.html @@ -41,7 +41,7 @@
-guint +guint ostree_deployment_hash () @@ -49,7 +49,7 @@
-gboolean +gboolean ostree_deployment_equal () @@ -118,7 +118,7 @@
-GKeyFile * +GKeyFile * ostree_deployment_get_origin () @@ -210,15 +210,15 @@

Functions

ostree_deployment_hash ()

-
guint
-ostree_deployment_hash (gconstpointer v);
+
guint
+ostree_deployment_hash (gconstpointer v);

ostree_deployment_equal ()

-
gboolean
-ostree_deployment_equal (gconstpointer ap,
-                         gconstpointer bp);
+
gboolean
+ostree_deployment_equal (gconstpointer ap,
+                         gconstpointer bp);

Parameters

@@ -243,7 +243,7 @@ ostree_deployment_equal (

Returns

-

TRUE if deployments have the same osname, csum, and deployserial

+

TRUE if deployments have the same osname, csum, and deployserial


@@ -322,7 +322,7 @@ ostree_deployment_get_bootconfig (

ostree_deployment_get_origin ()

-
GKeyFile *
+
GKeyFile *
 ostree_deployment_get_origin (OstreeDeployment *self);

Parameters

@@ -406,7 +406,7 @@ ostree_deployment_set_bootconfig (

ostree_deployment_set_origin ()

void
 ostree_deployment_set_origin (OstreeDeployment *self,
-                              GKeyFile *origin);
+ GKeyFile *origin);

@@ -506,7 +506,7 @@ ostree_deployment_unlocked_state_to_string
- + diff --git a/apidoc/html/ostree-ostree-diff.html b/apidoc/html/ostree-ostree-diff.html index ef6d6bb7..7145d121 100644 --- a/apidoc/html/ostree-ostree-diff.html +++ b/apidoc/html/ostree-ostree-diff.html @@ -57,7 +57,7 @@ - + @@ -185,11 +185,11 @@ sets of

ostree_diff_print ()

void
-ostree_diff_print (GFile *a,
-                   GFile *b,
-                   GPtrArray *modified,
-                   GPtrArray *removed,
-                   GPtrArray *added);
+ostree_diff_print (GFile *a, + GFile *b, + GPtrArray *modified, + GPtrArray *removed, + GPtrArray *added);

Print the contents of a diff to stdout.

Parameters

diff --git a/apidoc/html/ostree-ostree-repo-file.html b/apidoc/html/ostree-ostree-repo-file.html index 95d140c9..392f8bbd 100644 --- a/apidoc/html/ostree-ostree-repo-file.html +++ b/apidoc/html/ostree-ostree-repo-file.html @@ -40,7 +40,7 @@
 

GKeyFile *origin;

GKeyFile *origin;

How to construct an upgraded version of this tree

 
-gboolean +gboolean ostree_diff_dirs () @@ -112,15 +112,15 @@ ostree_diff_item_unref (

ostree_diff_dirs ()

-
gboolean
+
gboolean
 ostree_diff_dirs (OstreeDiffFlags flags,
-                  GFile *a,
-                  GFile *b,
-                  GPtrArray *modified,
-                  GPtrArray *removed,
-                  GPtrArray *added,
-                  GCancellable *cancellable,
-                  GError **error);
+ GFile *a, + GFile *b, + GPtrArray *modified, + GPtrArray *removed, + GPtrArray *added, + GCancellable *cancellable, + GError **error);

Compute the difference between directory a and b as 3 separate @@ -144,7 +144,7 @@ sets of

a

First directory path, or NULL

First directory path, or NULL

 
-gboolean +gboolean ostree_repo_file_ensure_resolved () @@ -48,7 +48,7 @@
-gboolean +gboolean ostree_repo_file_get_xattrs () @@ -94,7 +94,7 @@
-GVariant * +GVariant * ostree_repo_file_tree_get_contents () @@ -102,7 +102,7 @@
-GVariant * +GVariant * ostree_repo_file_tree_get_metadata () @@ -125,7 +125,7 @@
-gboolean +gboolean ostree_repo_file_tree_query_child () @@ -154,18 +154,18 @@

Functions

ostree_repo_file_ensure_resolved ()

-
gboolean
+
gboolean
 ostree_repo_file_ensure_resolved (OstreeRepoFile *self,
-                                  GError **error);
+ GError **error);

ostree_repo_file_get_xattrs ()

-
gboolean
+
gboolean
 ostree_repo_file_get_xattrs (OstreeRepoFile *self,
-                             GVariant **out_xattrs,
-                             GCancellable *cancellable,
-                             GError **error);
+ GVariant **out_xattrs, + GCancellable *cancellable, + GError **error);

@@ -195,7 +195,7 @@ ostree_repo_file_get_root (void ostree_repo_file_tree_set_metadata (OstreeRepoFile *self, const char *checksum, - GVariant *metadata); + GVariant *metadata);

@@ -214,13 +214,13 @@ ostree_repo_file_tree_get_metadata_checksum

ostree_repo_file_tree_get_contents ()

-
GVariant *
+
GVariant *
 ostree_repo_file_tree_get_contents (OstreeRepoFile *self);

ostree_repo_file_tree_get_metadata ()

-
GVariant *
+
GVariant *
 ostree_repo_file_tree_get_metadata (OstreeRepoFile *self);

@@ -235,20 +235,20 @@ ostree_repo_file_get_checksum (int ostree_repo_file_tree_find_child (OstreeRepoFile *self, const char *name, - gboolean *is_dir, - GVariant **out_container); + gboolean *is_dir, + GVariant **out_container);

ostree_repo_file_tree_query_child ()

-
gboolean
+
gboolean
 ostree_repo_file_tree_query_child (OstreeRepoFile *self,
                                    int n,
                                    const char *attributes,
-                                   GFileQueryInfoFlags flags,
-                                   GFileInfo **out_info,
-                                   GCancellable *cancellable,
-                                   GError **error);
+ GFileQueryInfoFlags flags, + GFileInfo **out_info, + GCancellable *cancellable, + GError **error);
diff --git a/apidoc/html/ostree.devhelp2 b/apidoc/html/ostree.devhelp2 index 08fa2960..d1f68ddb 100644 --- a/apidoc/html/ostree.devhelp2 +++ b/apidoc/html/ostree.devhelp2 @@ -49,6 +49,7 @@ + @@ -104,6 +105,7 @@ + @@ -381,6 +383,7 @@ + @@ -405,6 +408,7 @@ + diff --git a/apidoc/html/reference.html b/apidoc/html/reference.html index fa2e25d8..f6d727a3 100644 --- a/apidoc/html/reference.html +++ b/apidoc/html/reference.html @@ -554,6 +554,10 @@
+ostree_raw_file_to_archive_z2_stream_with_options, function in Core repository-independent functions +
+
+
ostree_raw_file_to_content_stream, function in Core repository-independent functions
@@ -958,6 +962,10 @@
+ostree_repo_reload_config, function in Content-addressed object store +
+
+
ostree_repo_remote_add, function in Content-addressed object store
diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index dbd12526..787664b3 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -117,6 +117,7 @@ ostree_content_stream_parse ostree_content_file_parse ostree_content_file_parse_at ostree_raw_file_to_archive_z2_stream +ostree_raw_file_to_archive_z2_stream_with_options ostree_raw_file_to_content_stream ostree_checksum_file_from_input ostree_checksum_file @@ -276,6 +277,7 @@ ostree_repo_remote_get_gpg_verify_summary ostree_repo_remote_gpg_import ostree_repo_remote_fetch_summary ostree_repo_remote_fetch_summary_with_options +ostree_repo_reload_config ostree_repo_get_remote_boolean_option ostree_repo_get_remote_list_option ostree_repo_get_remote_option diff --git a/apidoc/version.xml b/apidoc/version.xml index 43e74f0f..30d5aa75 100644 --- a/apidoc/version.xml +++ b/apidoc/version.xml @@ -1 +1 @@ -2016.15 \ No newline at end of file +2017.3 \ No newline at end of file diff --git a/config.h.in b/config.h.in index 26e86519..0122bd29 100644 --- a/config.h.in +++ b/config.h.in @@ -28,6 +28,12 @@ /* Define if we have libarchive.pc */ #undef HAVE_LIBARCHIVE +/* Define if we have libcurl.pc */ +#undef HAVE_LIBCURL + +/* Define if we have soup or curl */ +#undef HAVE_LIBCURL_OR_LIBSOUP + /* Define if we have libmount.pc */ #undef HAVE_LIBMOUNT @@ -43,6 +49,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `mnt_unref_cache' function. */ +#undef HAVE_MNT_UNREF_CACHE + /* Define if we have libselinux.pc */ #undef HAVE_SELINUX @@ -116,6 +125,9 @@ #endif +/* Define if we have smack.pc */ +#undef WITH_SMACK + /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 diff --git a/configure b/configure index 98101308..90c2f68e 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 ostree 2017.1. +# Generated by GNU Autoconf 2.69 for libostree 2017.3. # # Report bugs to . # @@ -588,10 +588,10 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='ostree' -PACKAGE_TARNAME='ostree' -PACKAGE_VERSION='2017.1' -PACKAGE_STRING='ostree 2017.1' +PACKAGE_NAME='libostree' +PACKAGE_TARNAME='libostree' +PACKAGE_VERSION='2017.3' +PACKAGE_STRING='libostree 2017.3' PACKAGE_BUGREPORT='walters@verbum.org' PACKAGE_URL='' @@ -665,6 +665,8 @@ USE_LIBMOUNT_FALSE USE_LIBMOUNT_TRUE OT_DEP_LIBMOUNT_LIBS OT_DEP_LIBMOUNT_CFLAGS +USE_SMACK_FALSE +USE_SMACK_TRUE USE_SELINUX_FALSE USE_SELINUX_TRUE OT_DEP_SELINUX_LIBS @@ -673,6 +675,13 @@ USE_LIBARCHIVE_FALSE USE_LIBARCHIVE_TRUE OT_DEP_LIBARCHIVE_LIBS OT_DEP_LIBARCHIVE_CFLAGS +ENABLE_RUST_FALSE +ENABLE_RUST_TRUE +RUST_DEBUG_FALSE +RUST_DEBUG_TRUE +RUST_TARGET_SUBDIR +rustc +cargo ENABLE_MAN_FALSE ENABLE_MAN_TRUE XSLTPROC @@ -712,12 +721,18 @@ INTROSPECTION_GIRDIR INTROSPECTION_GENERATE INTROSPECTION_COMPILER INTROSPECTION_SCANNER +USE_CURL_OR_SOUP_FALSE +USE_CURL_OR_SOUP_TRUE HAVE_LIBSOUP_CLIENT_CERTS_FALSE HAVE_LIBSOUP_CLIENT_CERTS_TRUE USE_LIBSOUP_FALSE USE_LIBSOUP_TRUE OT_DEP_SOUP_LIBS OT_DEP_SOUP_CFLAGS +USE_CURL_FALSE +USE_CURL_TRUE +OT_DEP_CURL_LIBS +OT_DEP_CURL_CFLAGS OT_DEP_E2P_LIBS OT_DEP_E2P_CFLAGS OT_DEP_ZLIB_LIBS @@ -883,6 +898,7 @@ enable_always_build_tests enable_otmpfile enable_wrpseudo_compat enable_glibtest +with_curl with_soup enable_libsoup_client_certs enable_introspection @@ -892,8 +908,11 @@ enable_gtk_doc enable_gtk_doc_html enable_gtk_doc_pdf enable_man +enable_rust +enable_rust_debug with_libarchive with_selinux +with_smack with_libmount enable_rofiles_fuse with_dracut @@ -926,6 +945,8 @@ OT_DEP_ZLIB_CFLAGS OT_DEP_ZLIB_LIBS OT_DEP_E2P_CFLAGS OT_DEP_E2P_LIBS +OT_DEP_CURL_CFLAGS +OT_DEP_CURL_LIBS OT_DEP_SOUP_CFLAGS OT_DEP_SOUP_LIBS OT_DEP_GPGME_CFLAGS @@ -1482,7 +1503,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 ostree 2017.1 to adapt to many kinds of systems. +\`configure' configures libostree 2017.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1530,7 +1551,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/ostree] + --docdir=DIR documentation root [DATAROOTDIR/doc/libostree] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1552,7 +1573,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ostree 2017.1:";; + short | recursive ) echo "Configuration of libostree 2017.3:";; esac cat <<\_ACEOF @@ -1593,6 +1614,9 @@ Optional Features: --enable-gtk-doc-html build documentation in html format [[default=yes]] --enable-gtk-doc-pdf build documentation in pdf format [[default=no]] --enable-man generate man pages [default=auto] + --enable-rust Compile Rust code instead of C [default=no] + --enable-rust-debug Build Rust code with debugging information + [default=no] --enable-rofiles-fuse generate rofiles-fuse helper [default=yes] Optional Packages: @@ -1606,11 +1630,13 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). + --with-curl Use libcurl [default=no] --with-soup Use libsoup [default=yes] --with-gpgme-prefix=PFX prefix where GPGME is installed (optional) --with-html-dir=PATH path to installed docs --without-libarchive Do not use libarchive --without-selinux Do not use SELinux + --with-smack Enable smack --without-libmount Do not use libmount --with-dracut Install dracut module (default: no) --with-mkinitcpio Install mkinitcpio module (default: no) @@ -1662,6 +1688,10 @@ Some influential environment variables: C compiler flags for OT_DEP_E2P, overriding pkg-config OT_DEP_E2P_LIBS linker flags for OT_DEP_E2P, overriding pkg-config + OT_DEP_CURL_CFLAGS + C compiler flags for OT_DEP_CURL, overriding pkg-config + OT_DEP_CURL_LIBS + linker flags for OT_DEP_CURL, overriding pkg-config OT_DEP_SOUP_CFLAGS C compiler flags for OT_DEP_SOUP, overriding pkg-config OT_DEP_SOUP_LIBS @@ -1761,7 +1791,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ostree configure 2017.1 +libostree configure 2017.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2176,7 +2206,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 ostree $as_me 2017.1, which was +It was created by libostree $as_me 2017.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3042,8 +3072,8 @@ fi # Define the identity of the package. - PACKAGE='ostree' - VERSION='2017.1' + PACKAGE='libostree' + VERSION='2017.3' # Some tools Automake needs. @@ -5793,7 +5823,6 @@ test -n "$YACC" || YACC="yacc" -Werror=incompatible-pointer-types \ -Werror=misleading-indentation \ -Werror=missing-include-dirs -Werror=aggregate-return \ - -Werror=declaration-after-statement \ ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports flag $flag in envvar CFLAGS" >&5 @@ -13562,9 +13591,9 @@ else fi if test "$ENABLE_INSTALLED_TESTS" == "1"; then - installed_test_metadir=${datadir}/installed-tests/ostree + installed_test_metadir=${datadir}/installed-tests/libostree - installed_testdir=${libexecdir}/installed-tests/ostree + installed_testdir=${libexecdir}/installed-tests/libostree fi @@ -14500,16 +14529,137 @@ $as_echo "yes" >&6; } fi +CURL_DEPENDENCY=7.29.0 + +# Check whether --with-curl was given. +if test "${with_curl+set}" = set; then : + withval=$with_curl; +else + with_curl=no +fi + +if test x$with_curl != xno ; then : + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OT_DEP_CURL" >&5 +$as_echo_n "checking for OT_DEP_CURL... " >&6; } + +if test -n "$OT_DEP_CURL_CFLAGS"; then + pkg_cv_OT_DEP_CURL_CFLAGS="$OT_DEP_CURL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl >= \$CURL_DEPENDENCY\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcurl >= $CURL_DEPENDENCY") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_OT_DEP_CURL_CFLAGS=`$PKG_CONFIG --cflags "libcurl >= $CURL_DEPENDENCY" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$OT_DEP_CURL_LIBS"; then + pkg_cv_OT_DEP_CURL_LIBS="$OT_DEP_CURL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl >= \$CURL_DEPENDENCY\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcurl >= $CURL_DEPENDENCY") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_OT_DEP_CURL_LIBS=`$PKG_CONFIG --libs "libcurl >= $CURL_DEPENDENCY" 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 + OT_DEP_CURL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcurl >= $CURL_DEPENDENCY" 2>&1` + else + OT_DEP_CURL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcurl >= $CURL_DEPENDENCY" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$OT_DEP_CURL_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libcurl >= $CURL_DEPENDENCY) were not met: + +$OT_DEP_CURL_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables OT_DEP_CURL_CFLAGS +and OT_DEP_CURL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables OT_DEP_CURL_CFLAGS +and OT_DEP_CURL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + OT_DEP_CURL_CFLAGS=$pkg_cv_OT_DEP_CURL_CFLAGS + OT_DEP_CURL_LIBS=$pkg_cv_OT_DEP_CURL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + with_curl=yes + +$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h + + with_soup_default=yes + +else + with_soup_default=check +fi + if test x$with_curl != xno; then + USE_CURL_TRUE= + USE_CURL_FALSE='#' +else + USE_CURL_TRUE='#' + USE_CURL_FALSE= +fi + +if test x$with_curl = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES libcurl"; fi + SOUP_DEPENDENCY="libsoup-2.4 >= 2.39.1" # Check whether --with-soup was given. if test "${with_soup+set}" = set; then : withval=$with_soup; else - with_soup=check + with_soup=$with_soup_default fi -if test x$with_soup != xno ; then : +if test x$with_soup != xno; then : # Check whether --enable-libsoup_client_certs was given. if test "${enable_libsoup_client_certs+set}" = set; then : @@ -14664,7 +14814,7 @@ fi else with_soup=no fi -if test x$with_soup != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libsoup"; fi +if test x$with_soup != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libsoup"; fi if test x$with_soup != xno; then USE_LIBSOUP_TRUE= USE_LIBSOUP_FALSE='#' @@ -14682,6 +14832,32 @@ else fi +if test x$with_curl = xyes && test x$with_soup = xno; then : + + as_fn_error $? "Curl enabled, but libsoup is not; libsoup is needed for tests" "$LINENO" 5 + +fi + if test x$with_curl != xno || test x$with_soup != xno; then + USE_CURL_OR_SOUP_TRUE= + USE_CURL_OR_SOUP_FALSE='#' +else + USE_CURL_OR_SOUP_TRUE='#' + USE_CURL_OR_SOUP_FALSE= +fi + +if test x$with_curl != xno || test x$with_soup != xno; then : + +$as_echo "#define HAVE_LIBCURL_OR_LIBSOUP 1" >>confdefs.h + +fi +if test x$with_curl = xyes; then : + fetcher_backend=curl +elif test x$with_soup = xyes; then : + fetcher_backend=libsoup +else + fetcher_backend=none +fi + @@ -14720,7 +14896,7 @@ fi test $ac_status = 0; }; then found_introspection=yes else - as_fn_error $? "You need to have gobject-introspection >= 1.34.0 installed to build ostree" "$LINENO" 5 + as_fn_error $? "You need to have gobject-introspection >= 1.34.0 installed to build libostree" "$LINENO" 5 fi ;; #( auto) : @@ -15129,7 +15305,7 @@ if test x$have_gpgme = xno ; then : as_fn_error $? "Need GPGME_PTHREAD version $LIBGPGME_DEPENDENCY or later" "$LINENO" 5 fi -OSTREE_FEATURES="$OSTREE_FEATURES +gpgme" +OSTREE_FEATURES="$OSTREE_FEATURES gpgme" LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0" # What's in RHEL7.2. @@ -15568,8 +15744,11 @@ fi fi enable_man=no +else + + enable_man=yes + fi - enable_man=yes fi if test "$enable_man" != no; then @@ -15581,6 +15760,143 @@ else fi +# Check whether --enable-rust was given. +if test "${enable_rust+set}" = set; then : + enableval=$enable_rust; +else + enable_rust=no; rust_debug_release=no +fi + + +if test "$enable_rust" = yes; then : + + # Extract the first word of "cargo", so it can be a program name with args. +set dummy cargo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_cargo+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $cargo in + [\\/]* | ?:[\\/]*) + ac_cv_path_cargo="$cargo" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_cargo="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +cargo=$ac_cv_path_cargo +if test -n "$cargo"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cargo" >&5 +$as_echo "$cargo" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$cargo"; then : + as_fn_error $? "cargo is required for --enable-rust" "$LINENO" 5 +fi + # Extract the first word of "rustc", so it can be a program name with args. +set dummy rustc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_rustc+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $rustc in + [\\/]* | ?:[\\/]*) + ac_cv_path_rustc="$rustc" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_rustc="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +rustc=$ac_cv_path_rustc +if test -n "$rustc"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rustc" >&5 +$as_echo "$rustc" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$rustc"; then : + as_fn_error $? "rustc is required for --enable-rust" "$LINENO" 5 +fi + + + # Check whether --enable-rust-debug was given. +if test "${enable_rust_debug+set}" = set; then : + enableval=$enable_rust_debug; rust_debug_release=$enableval +else + rust_debug_release=release +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Rust code with debugging information" >&5 +$as_echo_n "checking whether to build Rust code with debugging information... " >&6; } + if test "x$rust_debug_release" = "xyes" ; then + rust_debug_release=debug + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + RUST_TARGET_SUBDIR=${rust_debug_release} + + +fi + if test "x$rust_debug_release" = "xdebug"; then + RUST_DEBUG_TRUE= + RUST_DEBUG_FALSE='#' +else + RUST_DEBUG_TRUE='#' + RUST_DEBUG_FALSE= +fi + + if test "$enable_rust" != no; then + ENABLE_RUST_TRUE= + ENABLE_RUST_FALSE='#' +else + ENABLE_RUST_TRUE='#' + ENABLE_RUST_FALSE= +fi + + # Check whether --with-libarchive was given. if test "${with_libarchive+set}" = set; then : @@ -15732,7 +16048,7 @@ fi else with_libarchive=no fi -if test x$with_libarchive != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libarchive"; fi +if test x$with_libarchive != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libarchive"; fi if test $with_libarchive != no; then USE_LIBARCHIVE_TRUE= USE_LIBARCHIVE_FALSE='#' @@ -15881,7 +16197,7 @@ fi else with_selinux=no fi -if test x$with_selinux != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +selinux"; fi +if test x$with_selinux != xno; then OSTREE_FEATURES="$OSTREE_FEATURES selinux"; fi if test $with_selinux != no; then USE_SELINUX_TRUE= USE_SELINUX_FALSE='#' @@ -15891,6 +16207,30 @@ else fi + +# Check whether --with-smack was given. +if test "${with_smack+set}" = set; then : + withval=$with_smack; : +else + with_smack=no +fi + +if test x$with_smack = xyes; then : + + +$as_echo "#define WITH_SMACK 1" >>confdefs.h + + +fi + if test $with_smack != no; then + USE_SMACK_TRUE= + USE_SMACK_FALSE='#' +else + USE_SMACK_TRUE='#' + USE_SMACK_FALSE= +fi + + LIBMOUNT_DEPENDENCY="mount >= 2.23.0" @@ -16020,6 +16360,20 @@ $as_echo "yes" >&6; } fi with_libmount=yes + save_LIBS=$LIBS + LIBS=$OT_DEP_LIBMOUNT_LIBS + for ac_func in mnt_unref_cache +do : + ac_fn_c_check_func "$LINENO" "mnt_unref_cache" "ac_cv_func_mnt_unref_cache" +if test "x$ac_cv_func_mnt_unref_cache" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MNT_UNREF_CACHE 1 +_ACEOF + +fi +done + + LIBS=$save_LIBS else @@ -16030,7 +16384,7 @@ fi else with_libmount=no fi -if test x$with_libmount != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libmount"; fi +if test x$with_libmount != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libmount"; fi if test $with_libmount != no; then USE_LIBMOUNT_TRUE= USE_LIBMOUNT_FALSE='#' @@ -16631,6 +16985,10 @@ if test -z "${ENABLE_ALWAYS_BUILD_TESTS_TRUE}" && test -z "${ENABLE_ALWAYS_BUILD as_fn_error $? "conditional \"ENABLE_ALWAYS_BUILD_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${USE_CURL_TRUE}" && test -z "${USE_CURL_FALSE}"; then + as_fn_error $? "conditional \"USE_CURL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${USE_LIBSOUP_TRUE}" && test -z "${USE_LIBSOUP_FALSE}"; then as_fn_error $? "conditional \"USE_LIBSOUP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -16639,6 +16997,10 @@ if test -z "${HAVE_LIBSOUP_CLIENT_CERTS_TRUE}" && test -z "${HAVE_LIBSOUP_CLIENT as_fn_error $? "conditional \"HAVE_LIBSOUP_CLIENT_CERTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${USE_CURL_OR_SOUP_TRUE}" && test -z "${USE_CURL_OR_SOUP_FALSE}"; then + as_fn_error $? "conditional \"USE_CURL_OR_SOUP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -16675,6 +17037,14 @@ if test -z "${ENABLE_MAN_TRUE}" && test -z "${ENABLE_MAN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_MAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${RUST_DEBUG_TRUE}" && test -z "${RUST_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"RUST_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_RUST_TRUE}" && test -z "${ENABLE_RUST_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_RUST\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${USE_LIBARCHIVE_TRUE}" && test -z "${USE_LIBARCHIVE_FALSE}"; then as_fn_error $? "conditional \"USE_LIBARCHIVE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -16683,6 +17053,10 @@ if test -z "${USE_SELINUX_TRUE}" && test -z "${USE_SELINUX_FALSE}"; then as_fn_error $? "conditional \"USE_SELINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${USE_SMACK_TRUE}" && test -z "${USE_SMACK_FALSE}"; then + as_fn_error $? "conditional \"USE_SMACK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${USE_LIBMOUNT_TRUE}" && test -z "${USE_LIBMOUNT_FALSE}"; then as_fn_error $? "conditional \"USE_LIBMOUNT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -17120,7 +17494,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 ostree $as_me 2017.1, which was +This file was extended by libostree $as_me 2017.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17186,7 +17560,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="\\ -ostree config.status 2017.1 +libostree config.status 2017.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -18875,14 +19249,14 @@ fi echo " - OSTree $VERSION + libOSTree $VERSION =============== introspection: $found_introspection + Rust (internal oxidation): $rust_debug_release rofiles-fuse: $enable_rofiles_fuse - libsoup (retrieve remote HTTP repositories): $with_soup - libsoup TLS client certs: $have_libsoup_client_certs + HTTP backend: $fetcher_backend SELinux: $with_selinux systemd: $have_libsystemd libmount: $with_libmount diff --git a/configure.ac b/configure.ac index e3f2d12a..08894480 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.63]) dnl If incrementing the version here, remember to update libostree.sym too -AC_INIT([ostree], [2017.1], [walters@verbum.org]) +AC_INIT([libostree], [2017.3], [walters@verbum.org]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([buildutil]) AC_CONFIG_AUX_DIR([build-aux]) @@ -33,7 +33,6 @@ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\ -Werror=incompatible-pointer-types \ -Werror=misleading-indentation \ -Werror=missing-include-dirs -Werror=aggregate-return \ - -Werror=declaration-after-statement \ ]) AC_SUBST(WARN_CFLAGS) @@ -79,14 +78,29 @@ PKG_CHECK_MODULES(OT_DEP_ZLIB, zlib) dnl We're not actually linking to this, just using the header PKG_CHECK_MODULES(OT_DEP_E2P, e2p) +dnl Arbitrary version that's in CentOS7.2 now +CURL_DEPENDENCY=7.29.0 +AC_ARG_WITH(curl, + AS_HELP_STRING([--with-curl], [Use libcurl @<:@default=no@:>@]), + [], [with_curl=no]) +AS_IF([test x$with_curl != xno ], [ + PKG_CHECK_MODULES(OT_DEP_CURL, libcurl >= $CURL_DEPENDENCY) + with_curl=yes + AC_DEFINE([HAVE_LIBCURL], 1, [Define if we have libcurl.pc]) + dnl Currently using libcurl requires soup for trivial-httpd for tests + with_soup_default=yes +], [with_soup_default=check]) +AM_CONDITIONAL(USE_CURL, test x$with_curl != xno) +if test x$with_curl = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES libcurl"; fi + dnl When bumping the libsoup-2.4 dependency, remember to bump dnl SOUP_VERSION_MIN_REQUIRED and SOUP_VERSION_MAX_ALLOWED in dnl Makefile.am SOUP_DEPENDENCY="libsoup-2.4 >= 2.39.1" AC_ARG_WITH(soup, AS_HELP_STRING([--with-soup], [Use libsoup @<:@default=yes@:>@]), - [], [with_soup=check]) -AS_IF([test x$with_soup != xno ], [ + [], [with_soup=$with_soup_default]) +AS_IF([test x$with_soup != xno], [ AC_ARG_ENABLE(libsoup_client_certs, AS_HELP_STRING([--enable-libsoup-client-certs], [Require availability of new enough libsoup TLS client cert API (default: auto)]),, @@ -116,10 +130,18 @@ AS_IF([test x$with_soup != xno ], [ with_soup=no ]) ], [ with_soup=no ]) -if test x$with_soup != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libsoup"; fi +if test x$with_soup != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libsoup"; fi AM_CONDITIONAL(USE_LIBSOUP, test x$with_soup != xno) AM_CONDITIONAL(HAVE_LIBSOUP_CLIENT_CERTS, test x$have_libsoup_client_certs = xyes) +AS_IF([test x$with_curl = xyes && test x$with_soup = xno], [ + AC_MSG_ERROR([Curl enabled, but libsoup is not; libsoup is needed for tests]) +]) +AM_CONDITIONAL(USE_CURL_OR_SOUP, test x$with_curl != xno || test x$with_soup != xno) +AS_IF([test x$with_curl != xno || test x$with_soup != xno], + [AC_DEFINE([HAVE_LIBCURL_OR_LIBSOUP], 1, [Define if we have soup or curl])]) +AS_IF([test x$with_curl = xyes], [fetcher_backend=curl], [test x$with_soup = xyes], [fetcher_backend=libsoup], [fetcher_backend=none]) + m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [ GOBJECT_INTROSPECTION_CHECK([1.34.0]) ]) @@ -135,7 +157,7 @@ PKG_CHECK_MODULES(OT_DEP_GPGME, gpgme-pthread >= $LIBGPGME_DEPENDENCY, have_gpgm AS_IF([ test x$have_gpgme = xno ], [ AC_MSG_ERROR([Need GPGME_PTHREAD version $LIBGPGME_DEPENDENCY or later]) ]) -OSTREE_FEATURES="$OSTREE_FEATURES +gpgme" +OSTREE_FEATURES="$OSTREE_FEATURES gpgme" LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0" # What's in RHEL7.2. @@ -161,11 +183,45 @@ AS_IF([test "$enable_man" != no], [ AC_MSG_ERROR([xsltproc is required for --enable-man]) ]) enable_man=no + ],[ + enable_man=yes ]) - enable_man=yes ]) AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) +AC_ARG_ENABLE(rust, + [AS_HELP_STRING([--enable-rust], + [Compile Rust code instead of C [default=no]])],, + [enable_rust=no; rust_debug_release=no]) + +AS_IF([test "$enable_rust" = yes], [ + AC_PATH_PROG([cargo], [cargo]) + AS_IF([test -z "$cargo"], [AC_MSG_ERROR([cargo is required for --enable-rust])]) + AC_PATH_PROG([rustc], [rustc]) + AS_IF([test -z "$rustc"], [AC_MSG_ERROR([rustc is required for --enable-rust])]) + + dnl These bits based on gnome:librsvg/configure.ac + + dnl By default, we build in public release mode. + AC_ARG_ENABLE(rust-debug, + AC_HELP_STRING([--enable-rust-debug], + [Build Rust code with debugging information [default=no]]), + [rust_debug_release=$enableval], + [rust_debug_release=release]) + + AC_MSG_CHECKING(whether to build Rust code with debugging information) + if test "x$rust_debug_release" = "xyes" ; then + rust_debug_release=debug + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + RUST_TARGET_SUBDIR=${rust_debug_release} + AC_SUBST([RUST_TARGET_SUBDIR]) +]) +AM_CONDITIONAL(RUST_DEBUG, [test "x$rust_debug_release" = "xdebug"]) +AM_CONDITIONAL(ENABLE_RUST, [test "$enable_rust" != no]) + AC_ARG_WITH(libarchive, AS_HELP_STRING([--without-libarchive], [Do not use libarchive]), :, with_libarchive=maybe) @@ -189,7 +245,7 @@ AS_IF([ test x$with_libarchive != xno ], [ with_libarchive=no ]) ], [ with_libarchive=no ]) -if test x$with_libarchive != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libarchive"; fi +if test x$with_libarchive != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libarchive"; fi AM_CONDITIONAL(USE_LIBARCHIVE, test $with_libarchive != no) dnl This is what is in RHEL7 anyways @@ -214,9 +270,17 @@ AS_IF([ test x$with_selinux != xno ], [ with_selinux=no ]) ], [ with_selinux=no ]) -if test x$with_selinux != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +selinux"; fi +if test x$with_selinux != xno; then OSTREE_FEATURES="$OSTREE_FEATURES selinux"; fi AM_CONDITIONAL(USE_SELINUX, test $with_selinux != no) +AC_ARG_WITH(smack, +AS_HELP_STRING([--with-smack], [Enable smack]), +:, with_smack=no) +AS_IF([ test x$with_smack = xyes], [ + AC_DEFINE([WITH_SMACK], 1, [Define if we have smack.pc]) +]) +AM_CONDITIONAL(USE_SMACK, test $with_smack != no) + dnl This is what is in RHEL7.2 right now, picking it arbitrarily LIBMOUNT_DEPENDENCY="mount >= 2.23.0" @@ -235,11 +299,15 @@ AS_IF([ test x$with_libmount != xno ], [ AC_DEFINE([HAVE_LIBMOUNT], 1, [Define if we have libmount.pc]) PKG_CHECK_MODULES(OT_DEP_LIBMOUNT, $LIBMOUNT_DEPENDENCY) with_libmount=yes + save_LIBS=$LIBS + LIBS=$OT_DEP_LIBMOUNT_LIBS + AC_CHECK_FUNCS(mnt_unref_cache) + LIBS=$save_LIBS ], [ with_libmount=no ]) ], [ with_libmount=no ]) -if test x$with_libmount != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libmount"; fi +if test x$with_libmount != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libmount"; fi AM_CONDITIONAL(USE_LIBMOUNT, test $with_libmount != no) # Enabled by default because I think people should use it. @@ -334,14 +402,14 @@ src/libostree/ostree-1.pc AC_OUTPUT echo " - OSTree $VERSION + libOSTree $VERSION =============== introspection: $found_introspection + Rust (internal oxidation): $rust_debug_release rofiles-fuse: $enable_rofiles_fuse - libsoup (retrieve remote HTTP repositories): $with_soup - libsoup TLS client certs: $have_libsoup_client_certs + HTTP backend: $fetcher_backend SELinux: $with_selinux systemd: $have_libsystemd libmount: $with_libmount diff --git a/libglnx/COPYING b/libglnx/COPYING index 5bc8fb2c..4362b491 100644 --- a/libglnx/COPYING +++ b/libglnx/COPYING @@ -1,13 +1,14 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 - Copyright (C) 1991 Free Software Foundation, Inc. + Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] Preamble @@ -16,97 +17,109 @@ freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. - GNU LIBRARY GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs @@ -133,7 +146,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an @@ -255,7 +268,7 @@ distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - 6. As an exception to the Sections above, you may also compile or + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit @@ -282,23 +295,31 @@ of these things: Library will not necessarily be able to recompile the application to use the modified definitions.) - b) Accompany the work with a written offer, valid for at + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - c) If distribution of the work is made by offering access to copy + d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - d) Verify that the user has already received a copy of these + e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. @@ -347,7 +368,7 @@ Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to +You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent @@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. +versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. @@ -453,16 +474,16 @@ convey the exclusion of warranty; and each file should have at least the Copyright (C) This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + 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. + version 2.1 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/libglnx/Makefile-libglnx.am b/libglnx/Makefile-libglnx.am index 64d6a9ad..d3a46e55 100644 --- a/libglnx/Makefile-libglnx.am +++ b/libglnx/Makefile-libglnx.am @@ -51,3 +51,10 @@ libglnx_la_SOURCES = \ libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic libglnx_la_LIBADD = $(libglnx_libs) + +TESTS += test-libglnx-xattrs + +check_PROGRAMS += test-libglnx-xattrs +test_libglnx_xattrs_SOURCES = $(libglnx_srcpath)/tests/test-libglnx-xattrs.c +test_libglnx_xattrs_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) +test_libglnx_xattrs_LDADD = $(libglnx_libs) libglnx.la diff --git a/libglnx/Makefile-libglnx.am.inc b/libglnx/Makefile-libglnx.am.inc index f41ad5bc..9bd96e20 100644 --- a/libglnx/Makefile-libglnx.am.inc +++ b/libglnx/Makefile-libglnx.am.inc @@ -51,3 +51,10 @@ libglnx_la_SOURCES = \ libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic libglnx_la_LIBADD = $(libglnx_libs) + +TESTS += test-libglnx-xattrs + +check_PROGRAMS += test-libglnx-xattrs +test_libglnx_xattrs_SOURCES = libglnx/tests/test-libglnx-xattrs.c +test_libglnx_xattrs_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) +test_libglnx_xattrs_LDADD = $(libglnx_libs) libglnx.la diff --git a/libglnx/glnx-dirfd.c b/libglnx/glnx-dirfd.c index 3a02bb0a..11388c18 100644 --- a/libglnx/glnx-dirfd.c +++ b/libglnx/glnx-dirfd.c @@ -293,13 +293,10 @@ glnx_gen_temp_name (gchar *tmpl) { size_t len; char *XXXXXX; - int count; + int i; static const char letters[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; static const int NLETTERS = sizeof (letters) - 1; - glong value; - GTimeVal tv; - static int counter = 0; g_return_if_fail (tmpl != NULL); len = strlen (tmpl); @@ -307,27 +304,8 @@ glnx_gen_temp_name (gchar *tmpl) XXXXXX = tmpl + (len - 6); - /* Get some more or less random data. */ - g_get_current_time (&tv); - value = (tv.tv_usec ^ tv.tv_sec) + counter++; - - for (count = 0; count < 100; value += 7777, ++count) - { - glong v = value; - - /* Fill in the random bits. */ - XXXXXX[0] = letters[v % NLETTERS]; - v /= NLETTERS; - XXXXXX[1] = letters[v % NLETTERS]; - v /= NLETTERS; - XXXXXX[2] = letters[v % NLETTERS]; - v /= NLETTERS; - XXXXXX[3] = letters[v % NLETTERS]; - v /= NLETTERS; - XXXXXX[4] = letters[v % NLETTERS]; - v /= NLETTERS; - XXXXXX[5] = letters[v % NLETTERS]; - } + for (i = 0; i < 6; i++) + XXXXXX[i] = letters[g_random_int_range(0, NLETTERS)]; } /** diff --git a/libglnx/glnx-xattrs.c b/libglnx/glnx-xattrs.c index b5a59228..eadb6b15 100644 --- a/libglnx/glnx-xattrs.c +++ b/libglnx/glnx-xattrs.c @@ -83,19 +83,22 @@ read_xattr_name_array (const char *path, funcstr = fd != -1 ? "fgetxattr" : "lgetxattr"; - p = xattrs; - while (p < xattrs+len) + for (p = xattrs; p < xattrs+len; p = p + strlen (p) + 1) { ssize_t bytes_read; - char *buf; - GBytes *bytes = NULL; + g_autofree char *buf = NULL; + g_autoptr(GBytes) bytes = NULL; + again: if (fd != -1) bytes_read = fgetxattr (fd, p, NULL, 0); else bytes_read = lgetxattr (path, p, NULL, 0); if (bytes_read < 0) { + if (errno == ENODATA) + continue; + glnx_set_prefix_error_from_errno (error, "%s", funcstr); goto out; } @@ -103,26 +106,30 @@ read_xattr_name_array (const char *path, continue; buf = g_malloc (bytes_read); - bytes = g_bytes_new_take (buf, bytes_read); if (fd != -1) r = fgetxattr (fd, p, buf, bytes_read); else r = lgetxattr (path, p, buf, bytes_read); if (r < 0) { - g_bytes_unref (bytes); + if (errno == ERANGE) + { + g_free (g_steal_pointer (&buf)); + goto again; + } + else if (errno == ENODATA) + continue; + glnx_set_prefix_error_from_errno (error, "%s", funcstr); goto out; } - + + bytes = g_bytes_new_take (g_steal_pointer (&buf), bytes_read); g_variant_builder_add (builder, "(@ay@ay)", g_variant_new_bytestring (p), variant_new_ay_bytes (bytes)); - - p = p + strlen (p) + 1; - g_bytes_unref (bytes); } - + ret = TRUE; out: return ret; @@ -130,22 +137,29 @@ read_xattr_name_array (const char *path, static gboolean get_xattrs_impl (const char *path, + int fd, GVariant **out_xattrs, - GCancellable *cancellable, - GError **error) + GCancellable *cancellable, + GError **error) { gboolean ret = FALSE; - ssize_t bytes_read; + ssize_t bytes_read, real_size; glnx_free char *xattr_names = NULL; glnx_free char *xattr_names_canonical = NULL; GVariantBuilder builder; gboolean builder_initialized = FALSE; g_autoptr(GVariant) ret_xattrs = NULL; + g_assert (path != NULL || fd != -1); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)")); builder_initialized = TRUE; - bytes_read = llistxattr (path, NULL, 0); + again: + if (path) + bytes_read = llistxattr (path, NULL, 0); + else + bytes_read = flistxattr (fd, NULL, 0); if (bytes_read < 0) { @@ -158,15 +172,27 @@ get_xattrs_impl (const char *path, else if (bytes_read > 0) { xattr_names = g_malloc (bytes_read); - if (llistxattr (path, xattr_names, bytes_read) < 0) + if (path) + real_size = llistxattr (path, xattr_names, bytes_read); + else + real_size = flistxattr (fd, xattr_names, bytes_read); + if (real_size < 0) { + if (errno == ERANGE) + { + g_free (xattr_names); + goto again; + } glnx_set_prefix_error_from_errno (error, "%s", "llistxattr"); goto out; } - xattr_names_canonical = canonicalize_xattrs (xattr_names, bytes_read); - - if (!read_xattr_name_array (path, -1, xattr_names_canonical, bytes_read, &builder, error)) - goto out; + else if (real_size > 0) + { + xattr_names_canonical = canonicalize_xattrs (xattr_names, real_size); + + if (!read_xattr_name_array (path, fd, xattr_names_canonical, real_size, &builder, error)) + goto out; + } } ret_xattrs = g_variant_builder_end (&builder); @@ -201,52 +227,8 @@ glnx_fd_get_all_xattrs (int fd, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - ssize_t bytes_read; - glnx_free char *xattr_names = NULL; - glnx_free char *xattr_names_canonical = NULL; - GVariantBuilder builder; - gboolean builder_initialized = FALSE; - g_autoptr(GVariant) ret_xattrs = NULL; - - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)")); - builder_initialized = TRUE; - - bytes_read = flistxattr (fd, NULL, 0); - - if (bytes_read < 0) - { - if (errno != ENOTSUP) - { - glnx_set_prefix_error_from_errno (error, "%s", "flistxattr"); - goto out; - } - } - else if (bytes_read > 0) - { - xattr_names = g_malloc (bytes_read); - if (flistxattr (fd, xattr_names, bytes_read) < 0) - { - glnx_set_prefix_error_from_errno (error, "%s", "flistxattr"); - goto out; - } - xattr_names_canonical = canonicalize_xattrs (xattr_names, bytes_read); - - if (!read_xattr_name_array (NULL, fd, xattr_names_canonical, bytes_read, &builder, error)) - goto out; - } - - ret_xattrs = g_variant_builder_end (&builder); - builder_initialized = FALSE; - g_variant_ref_sink (ret_xattrs); - - ret = TRUE; - if (out_xattrs) - *out_xattrs = g_steal_pointer (&ret_xattrs); - out: - if (!builder_initialized) - g_variant_builder_clear (&builder); - return ret; + return get_xattrs_impl (NULL, fd, out_xattrs, + cancellable, error); } /** @@ -269,7 +251,7 @@ glnx_dfd_name_get_all_xattrs (int dfd, { if (dfd == AT_FDCWD || dfd == -1) { - return get_xattrs_impl (name, out_xattrs, cancellable, error); + return get_xattrs_impl (name, -1, out_xattrs, cancellable, error); } else { @@ -278,7 +260,7 @@ glnx_dfd_name_get_all_xattrs (int dfd, * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html */ snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", dfd, name); - return get_xattrs_impl (buf, out_xattrs, cancellable, error); + return get_xattrs_impl (buf, -1, out_xattrs, cancellable, error); } } diff --git a/libglnx/tests/test-libglnx-xattrs.c b/libglnx/tests/test-libglnx-xattrs.c new file mode 100644 index 00000000..0b21133a --- /dev/null +++ b/libglnx/tests/test-libglnx-xattrs.c @@ -0,0 +1,282 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2017 Red Hat, Inc. + * + * 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. + */ + +#include "config.h" +#include "libglnx.h" +#include +#include +#include +#include + +#define XATTR_THREAD_RUN_TIME_USECS (5 * G_USEC_PER_SEC) + +struct XattrWorker { + int dfd; + gboolean is_writer; + guint n_attrs_read; +}; + +typedef enum { + WRITE_RUN_MUTATE, + WRITE_RUN_CREATE, +} WriteType; + +static gboolean +set_random_xattr_value (int fd, const char *name, GError **error) +{ + const guint8 randxattrbyte = g_random_int_range (0, 256); + const guint32 randxattrvalue_len = (g_random_int () % 256) + 1; /* Picked to be not too small or large */ + g_autofree char *randxattrvalue = g_malloc (randxattrvalue_len); + + memset (randxattrvalue, randxattrbyte, randxattrvalue_len); + + if (fsetxattr (fd, name, randxattrvalue, randxattrvalue_len, 0) < 0) + { + glnx_set_error_from_errno (error); + return FALSE; + } + + return TRUE; +} + +static gboolean +add_random_xattrs (int fd, GError **error) +{ + const guint nattrs = MIN (2, g_random_int () % 16); + + for (guint i = 0; i < nattrs; i++) + { + guint32 randxattrname_v = g_random_int (); + g_autofree char *randxattrname = g_strdup_printf ("user.test%u", randxattrname_v); + + if (!set_random_xattr_value (fd, randxattrname, error)) + return FALSE; + } + + return TRUE; +} + +static gboolean +do_write_run (GLnxDirFdIterator *dfd_iter, GError **error) +{ + WriteType wtype = g_random_int () % 2; + + if (wtype == WRITE_RUN_CREATE) + { + guint32 randname_v = g_random_int (); + g_autofree char *randname = g_strdup_printf ("file%u", randname_v); + glnx_fd_close int fd = -1; + + again: + fd = openat (dfd_iter->fd, randname, O_CREAT | O_EXCL, 0644); + if (fd < 0) + { + if (errno == EEXIST) + { + g_printerr ("Congratulations! I suggest purchasing a lottery ticket today!\n"); + goto again; + } + else + { + glnx_set_error_from_errno (error); + return FALSE; + } + } + + if (!add_random_xattrs (fd, error)) + return FALSE; + } + else if (wtype == WRITE_RUN_MUTATE) + { + while (TRUE) + { + g_autoptr(GVariant) current_xattrs = NULL; + glnx_fd_close int fd = -1; + + struct dirent *dent; + if (!glnx_dirfd_iterator_next_dent (dfd_iter, &dent, NULL, error)) + return FALSE; + if (!dent) + break; + + fd = openat (dfd_iter->fd, dent->d_name, O_RDONLY | O_CLOEXEC); + if (fd < 0) + { + glnx_set_error_from_errno (error); + return FALSE; + } + + if (!glnx_fd_get_all_xattrs (fd, ¤t_xattrs, NULL, error)) + return FALSE; + + for (int i = 0; i < g_variant_n_children (current_xattrs); i++) + { + const char *name, *value; + g_variant_get_child (current_xattrs, i, "(^&ay^&ay)", &name, &value); + + /* We don't want to potentially test/change xattrs like security.selinux + * that were injected by the system. + */ + if (!g_str_has_prefix (name, "user.test")) + continue; + + if (!set_random_xattr_value (fd, name, error)) + return FALSE; + } + } + } + else + g_assert_not_reached (); + + return TRUE; +} + +static gboolean +do_read_run (GLnxDirFdIterator *dfd_iter, + guint *out_n_read, + GError **error) +{ + guint nattrs = 0; + while (TRUE) + { + g_autoptr(GVariant) current_xattrs = NULL; + glnx_fd_close int fd = -1; + + struct dirent *dent; + if (!glnx_dirfd_iterator_next_dent (dfd_iter, &dent, NULL, error)) + return FALSE; + if (!dent) + break; + + fd = openat (dfd_iter->fd, dent->d_name, O_RDONLY | O_CLOEXEC); + if (fd < 0) + { + glnx_set_error_from_errno (error); + return FALSE; + } + + if (!glnx_fd_get_all_xattrs (fd, ¤t_xattrs, NULL, error)) + return FALSE; + + /* We don't actually care about the values, just use the variable + * to avoid compiler warnings. + */ + nattrs += g_variant_n_children (current_xattrs); + } + + *out_n_read = nattrs; + return TRUE; +} + +static gpointer +xattr_thread (gpointer data) +{ + g_autoptr(GError) local_error = NULL; + GError **error = &local_error; + struct XattrWorker *worker = data; + guint64 end_time = g_get_monotonic_time () + XATTR_THREAD_RUN_TIME_USECS; + guint n_read = 0; + + while (g_get_monotonic_time () < end_time) + { + g_auto(GLnxDirFdIterator) dfd_iter = { 0, }; + + if (!glnx_dirfd_iterator_init_at (worker->dfd, ".", TRUE, &dfd_iter, error)) + goto out; + + if (worker->is_writer) + { + if (!do_write_run (&dfd_iter, error)) + goto out; + } + else + { + if (!do_read_run (&dfd_iter, &n_read, error)) + goto out; + } + } + + out: + g_assert_no_error (local_error); + + return GINT_TO_POINTER (n_read); +} + +static void +test_xattr_races (void) +{ + /* If for some reason we're built in a VM which only has one vcpu, let's still + * at least make the test do something. + */ + /* FIXME - this deadlocks for me on 4.9.4-201.fc25.x86_64, whether + * using overlayfs or xfs as source/dest. + */ + const guint nprocs = MAX (4, g_get_num_processors ()); + struct XattrWorker wdata[nprocs]; + GThread *threads[nprocs]; + g_autoptr(GError) local_error = NULL; + GError **error = &local_error; + glnx_fd_close int dfd = -1; + g_autofree char *tmpdir = g_strdup_printf ("%s/libglnx-xattrs-XXXXXX", + getenv ("TMPDIR") ?: "/var/tmp"); + guint nread = 0; + + if (!glnx_mkdtempat (AT_FDCWD, tmpdir, 0700, error)) + goto out; + + if (!glnx_opendirat (AT_FDCWD, tmpdir, TRUE, &dfd, error)) + goto out; + + for (guint i = 0; i < nprocs; i++) + { + struct XattrWorker *worker = &wdata[i]; + worker->dfd = dfd; + worker->is_writer = i % 2 == 0; + threads[i] = g_thread_new (NULL, xattr_thread, worker); + } + + for (guint i = 0; i < nprocs; i++) + { + if (wdata[i].is_writer) + (void) g_thread_join (threads[i]); + else + nread += GPOINTER_TO_UINT (g_thread_join (threads[i])); + } + + g_print ("Read %u xattrs race free!\n", nread); + + (void) glnx_shutil_rm_rf_at (AT_FDCWD, tmpdir, NULL, NULL); + + out: + g_assert_no_error (local_error); +} + +int main (int argc, char **argv) +{ + int ret; + + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/xattr-races", test_xattr_races); + + ret = g_test_run(); + + return ret; +} diff --git a/man/ostree-admin-cleanup.1 b/man/ostree-admin-cleanup.1 index b28dafbe..e56eb258 100644 --- a/man/ostree-admin-cleanup.1 +++ b/man/ostree-admin-cleanup.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin cleanup .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin cleanup .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-config-diff.1 b/man/ostree-admin-config-diff.1 index 5f962a32..bd90eeda 100644 --- a/man/ostree-admin-config-diff.1 +++ b/man/ostree-admin-config-diff.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin config-diff .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin config-diff .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-deploy.1 b/man/ostree-admin-deploy.1 index 645b94cb..8286872d 100644 --- a/man/ostree-admin-deploy.1 +++ b/man/ostree-admin-deploy.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin deploy .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin deploy .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-init-fs.1 b/man/ostree-admin-init-fs.1 index f3818fab..bdd9e4bf 100644 --- a/man/ostree-admin-init-fs.1 +++ b/man/ostree-admin-init-fs.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin init-fs .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin init-fs .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-instutil.1 b/man/ostree-admin-instutil.1 index b39003ca..106badf8 100644 --- a/man/ostree-admin-instutil.1 +++ b/man/ostree-admin-instutil.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin instutil .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin instutil .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-os-init.1 b/man/ostree-admin-os-init.1 index 55a17713..3eb9ae51 100644 --- a/man/ostree-admin-os-init.1 +++ b/man/ostree-admin-os-init.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin os-init .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin os-init .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-set-origin.1 b/man/ostree-admin-set-origin.1 index b4682360..9ed4a5ad 100644 --- a/man/ostree-admin-set-origin.1 +++ b/man/ostree-admin-set-origin.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin set-origin .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin set-origin .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-status.1 b/man/ostree-admin-status.1 index 085fa4e5..1f7f35cf 100644 --- a/man/ostree-admin-status.1 +++ b/man/ostree-admin-status.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin status .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin status .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-switch.1 b/man/ostree-admin-switch.1 index 6b7455e9..07bc8ecc 100644 --- a/man/ostree-admin-switch.1 +++ b/man/ostree-admin-switch.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin switch .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin switch .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-undeploy.1 b/man/ostree-admin-undeploy.1 index e110c352..62581b7c 100644 --- a/man/ostree-admin-undeploy.1 +++ b/man/ostree-admin-undeploy.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin undeploy .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin undeploy .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-unlock.1 b/man/ostree-admin-unlock.1 index 51c529b5..55692e0e 100644 --- a/man/ostree-admin-unlock.1 +++ b/man/ostree-admin-unlock.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin unlock .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin unlock .\" Source: OSTree .\" Language: English diff --git a/man/ostree-admin-upgrade.1 b/man/ostree-admin-upgrade.1 index e0b8e3d2..c5fb18c5 100644 --- a/man/ostree-admin-upgrade.1 +++ b/man/ostree-admin-upgrade.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin upgrade .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin upgrade .\" Source: OSTree .\" Language: English @@ -34,7 +34,10 @@ ostree-admin-upgrade \- Construct new tree from current origin and deploy it, if \fBostree admin upgrade\fR [OPTIONS...] .SH "DESCRIPTION" .PP -Downloads the latest version of the current ref from the build server and deploys it, if it changed\&. Reboot the machine for the changes to take effect\&. +Downloads the latest version of the current ref from the build server and deploys it, if it changed\&. Reboot the machine for the changes to take effect\&. These phases can be split via +\fB\-\-pull\-only\fR +and +\fB\-\-deploy\-only\fR\&. .SH "OPTIONS" .PP \fB\-\-os\fR="OSNAME" @@ -42,6 +45,17 @@ Downloads the latest version of the current ref from the build server and deploy Use a different operating system root than the current one\&. .RE .PP +\fB\-\-pull\-only\fR +.RS 4 +Only perform a pull into the repository; do not create a deployment\&. This option can hence safely be used in a background scheduled job with the assurance of not changing system state\&. +.RE +.PP +\fB\-\-deploy\-only\fR +.RS 4 +Create a new deployment from the latest commit in the tracked origin refspec\&. This option is intended to be used by a scheduled system that detected changes via +\fB\-\-pull\-only\fR, and is ready to deploy them\&. +.RE +.PP \fB\-\-reboot\fR,\fB\-r\fR .RS 4 Reboot after a successful upgrade\&. diff --git a/man/ostree-admin-upgrade.xml b/man/ostree-admin-upgrade.xml index ddd33dc6..7766c66e 100644 --- a/man/ostree-admin-upgrade.xml +++ b/man/ostree-admin-upgrade.xml @@ -57,7 +57,10 @@ Boston, MA 02111-1307, USA. Description - Downloads the latest version of the current ref from the build server and deploys it, if it changed. Reboot the machine for the changes to take effect. + Downloads the latest version of the current ref from the build + server and deploys it, if it changed. Reboot the machine for the + changes to take effect. These phases can be split via + and . @@ -73,6 +76,24 @@ Boston, MA 02111-1307, USA. + + + + Only perform a pull into the repository; do not + create a deployment. This option can hence safely be used in a + background scheduled job with the assurance of not changing + system state. + + + + + + Create a new deployment from the latest commit + in the tracked origin refspec. This option is intended to be used + by a scheduled system that detected changes via , + and is ready to deploy them. + + , diff --git a/man/ostree-admin.1 b/man/ostree-admin.1 index e2dd8bc0..ad6197c4 100644 --- a/man/ostree-admin.1 +++ b/man/ostree-admin.1 @@ -2,7 +2,7 @@ .\" Title: ostree admin .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree admin .\" Source: OSTree .\" Language: English diff --git a/man/ostree-cat.1 b/man/ostree-cat.1 index c31ca5c5..ac4d68ce 100644 --- a/man/ostree-cat.1 +++ b/man/ostree-cat.1 @@ -2,7 +2,7 @@ .\" Title: ostree cat .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree cat .\" Source: OSTree .\" Language: English diff --git a/man/ostree-checkout.1 b/man/ostree-checkout.1 index bbd6c576..1c0fe556 100644 --- a/man/ostree-checkout.1 +++ b/man/ostree-checkout.1 @@ -2,7 +2,7 @@ .\" Title: ostree checkout .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree checkout .\" Source: OSTree .\" Language: English @@ -54,6 +54,11 @@ Checkout sub\-directory PATH\&. Keep existing directories and unchanged files, overwrite existing files\&. .RE .PP +\fB\-\-union\-add\fR +.RS 4 +Keep existing directories and files\&. +.RE +.PP \fB\-\-allow\-noent\fR .RS 4 Do nothing if specified path does not exist\&. diff --git a/man/ostree-checkout.xml b/man/ostree-checkout.xml index 67d6469e..c8585878 100644 --- a/man/ostree-checkout.xml +++ b/man/ostree-checkout.xml @@ -89,6 +89,14 @@ Boston, MA 02111-1307, USA. + + + + + Keep existing directories and files. + + + diff --git a/man/ostree-checksum.1 b/man/ostree-checksum.1 index 26135ad4..0760c66f 100644 --- a/man/ostree-checksum.1 +++ b/man/ostree-checksum.1 @@ -2,7 +2,7 @@ .\" Title: ostree checksum .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree checksum .\" Source: OSTree .\" Language: English diff --git a/man/ostree-commit.1 b/man/ostree-commit.1 index 27b29f30..4cb81b77 100644 --- a/man/ostree-commit.1 +++ b/man/ostree-commit.1 @@ -2,7 +2,7 @@ .\" Title: ostree commit .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree commit .\" Source: OSTree .\" Language: English diff --git a/man/ostree-config.1 b/man/ostree-config.1 index 264acd25..f712532f 100644 --- a/man/ostree-config.1 +++ b/man/ostree-config.1 @@ -2,7 +2,7 @@ .\" Title: ostree config .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree config .\" Source: OSTree .\" Language: English diff --git a/man/ostree-diff.1 b/man/ostree-diff.1 index 20824f09..10d7f82a 100644 --- a/man/ostree-diff.1 +++ b/man/ostree-diff.1 @@ -2,7 +2,7 @@ .\" Title: ostree diff .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree diff .\" Source: OSTree .\" Language: English diff --git a/man/ostree-export.1 b/man/ostree-export.1 index 2e9d7c07..520a43f3 100644 --- a/man/ostree-export.1 +++ b/man/ostree-export.1 @@ -2,7 +2,7 @@ .\" Title: ostree export .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree export .\" Source: OSTree .\" Language: English diff --git a/man/ostree-fsck.1 b/man/ostree-fsck.1 index 48587d71..fea14ae4 100644 --- a/man/ostree-fsck.1 +++ b/man/ostree-fsck.1 @@ -2,7 +2,7 @@ .\" Title: ostree fsck .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree fsck .\" Source: OSTree .\" Language: English diff --git a/man/ostree-gpg-sign.1 b/man/ostree-gpg-sign.1 index de331604..93b1799f 100644 --- a/man/ostree-gpg-sign.1 +++ b/man/ostree-gpg-sign.1 @@ -2,7 +2,7 @@ .\" Title: ostree gpg-sign .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree gpg-sign .\" Source: OSTree .\" Language: English diff --git a/man/ostree-init.1 b/man/ostree-init.1 index f663f559..18f5de61 100644 --- a/man/ostree-init.1 +++ b/man/ostree-init.1 @@ -2,7 +2,7 @@ .\" Title: ostree init .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree init .\" Source: OSTree .\" Language: English diff --git a/man/ostree-log.1 b/man/ostree-log.1 index 3027cdb3..885abb3c 100644 --- a/man/ostree-log.1 +++ b/man/ostree-log.1 @@ -2,7 +2,7 @@ .\" Title: ostree log .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree log .\" Source: OSTree .\" Language: English diff --git a/man/ostree-ls.1 b/man/ostree-ls.1 index 5f42268c..64827242 100644 --- a/man/ostree-ls.1 +++ b/man/ostree-ls.1 @@ -2,7 +2,7 @@ .\" Title: ostree ls .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree ls .\" Source: OSTree .\" Language: English diff --git a/man/ostree-prune.1 b/man/ostree-prune.1 index 109b58fe..ebcadc48 100644 --- a/man/ostree-prune.1 +++ b/man/ostree-prune.1 @@ -2,7 +2,7 @@ .\" Title: ostree prune .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree prune .\" Source: OSTree .\" Language: English diff --git a/man/ostree-pull-local.1 b/man/ostree-pull-local.1 index 8ca7ca71..6012d143 100644 --- a/man/ostree-pull-local.1 +++ b/man/ostree-pull-local.1 @@ -2,7 +2,7 @@ .\" Title: ostree pull-local .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree pull-local .\" Source: OSTree .\" Language: English diff --git a/man/ostree-pull.1 b/man/ostree-pull.1 index 0965f687..3ff0ce7a 100644 --- a/man/ostree-pull.1 +++ b/man/ostree-pull.1 @@ -2,7 +2,7 @@ .\" Title: ostree pull .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree pull .\" Source: OSTree .\" Language: English diff --git a/man/ostree-refs.1 b/man/ostree-refs.1 index 63e7cfeb..b1fd6d18 100644 --- a/man/ostree-refs.1 +++ b/man/ostree-refs.1 @@ -2,7 +2,7 @@ .\" Title: ostree refs .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree refs .\" Source: OSTree .\" Language: English diff --git a/man/ostree-remote.1 b/man/ostree-remote.1 index c1a4a3e7..7414a2a4 100644 --- a/man/ostree-remote.1 +++ b/man/ostree-remote.1 @@ -2,7 +2,7 @@ .\" Title: ostree remote .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree remote .\" Source: OSTree .\" Language: English diff --git a/man/ostree-reset.1 b/man/ostree-reset.1 index 5e4a22f0..58af17e4 100644 --- a/man/ostree-reset.1 +++ b/man/ostree-reset.1 @@ -2,7 +2,7 @@ .\" Title: ostree reset .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree reset .\" Source: OSTree .\" Language: English diff --git a/man/ostree-rev-parse.1 b/man/ostree-rev-parse.1 index 6d719b82..5612fd54 100644 --- a/man/ostree-rev-parse.1 +++ b/man/ostree-rev-parse.1 @@ -2,7 +2,7 @@ .\" Title: ostree rev-parse .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree rev-parse .\" Source: OSTree .\" Language: English diff --git a/man/ostree-show.1 b/man/ostree-show.1 index 5e7b8487..f7354442 100644 --- a/man/ostree-show.1 +++ b/man/ostree-show.1 @@ -2,7 +2,7 @@ .\" Title: ostree show .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree show .\" Source: OSTree .\" Language: English diff --git a/man/ostree-static-delta.1 b/man/ostree-static-delta.1 index 3c2d1139..20a92b01 100644 --- a/man/ostree-static-delta.1 +++ b/man/ostree-static-delta.1 @@ -2,7 +2,7 @@ .\" Title: ostree static-delta .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree static-delta .\" Source: OSTree .\" Language: English diff --git a/man/ostree-summary.1 b/man/ostree-summary.1 index ae5d1b55..a2d89e6c 100644 --- a/man/ostree-summary.1 +++ b/man/ostree-summary.1 @@ -2,7 +2,7 @@ .\" Title: ostree summary .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree summary .\" Source: OSTree .\" Language: English diff --git a/man/ostree-trivial-httpd.1 b/man/ostree-trivial-httpd.1 index 74d885f4..d3ceb2a9 100644 --- a/man/ostree-trivial-httpd.1 +++ b/man/ostree-trivial-httpd.1 @@ -2,7 +2,7 @@ .\" Title: ostree trivial-httpd .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree trivial-httpd .\" Source: OSTree .\" Language: English diff --git a/man/ostree.1 b/man/ostree.1 index 2f1cbb33..2bf2f880 100644 --- a/man/ostree.1 +++ b/man/ostree.1 @@ -2,7 +2,7 @@ .\" Title: ostree .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree .\" Source: OSTree .\" Language: English diff --git a/man/ostree.repo-config.5 b/man/ostree.repo-config.5 index b4d954c1..56dc33f2 100644 --- a/man/ostree.repo-config.5 +++ b/man/ostree.repo-config.5 @@ -2,7 +2,7 @@ .\" Title: ostree.repo-config .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree.repo-config .\" Source: OSTree .\" Language: English @@ -82,10 +82,15 @@ Describes a remote repository location\&. .PP \fIurl\fR .RS 4 -Must be present; declares URL for accessing this remote\&. The only supported schemes are the moment are -file, -http, and -https\&. +Must be present; declares URL for accessing metadata and content for remote\&. See also +contenturl\&. The supported schemes are documented below\&. +.RE +.PP +\fIcontenturl\fR +.RS 4 +Declares URL for accessing content (filez, static delta parts)\&. When specified, +url +is used just for metadata: summary, static delta "superblocks"\&. .RE .PP \fIproxy\fR @@ -140,6 +145,32 @@ file, remotes may also be specified in \&.conf; files whose name does not end in \&.conf will be ignored\&. +.SH "REPOSITORY URL/CONTENTURL" +.PP +Originally, OSTree had just a +url +option for remotes\&. Since then, the +contenturl +option was introduced\&. Both of these support +file, +http, and +https +schemes\&. +.PP +Additionally, both of these can be prefixed with the string +mirrorlist=, which instructs the client that the target url is a "mirrorlist" format, which is a plain text file of newline\-separated URLs\&. Earlier URLs will be given precedence\&. +.PP +Note that currently, the +tls\-ca\-path +and +tls\-client\-cert\-path +options apply to every HTTP request, even when +contenturl +and/or +mirrorlist +are in use\&. This may change in the future to only apply to metadata (i\&.e\&. +url, not +contenturl) fetches\&. .SH "PER\-REMOTE GPG KEYRINGS AND VERIFICATION" .PP OSTree supports a per\-remote GPG keyring, as well as a diff --git a/man/ostree.repo-config.xml b/man/ostree.repo-config.xml index b4c276df..d187f89f 100644 --- a/man/ostree.repo-config.xml +++ b/man/ostree.repo-config.xml @@ -127,10 +127,16 @@ Boston, MA 02111-1307, USA. url - Must be present; declares URL for accessing - this remote. The only supported schemes are the moment are - file, http, and - https. + Must be present; declares URL for accessing metadata and + content for remote. See also contenturl. The + supported schemes are documented below. + + + + contenturl + Declares URL for accessing content (filez, static delta + parts). When specified, url is used just for + metadata: summary, static delta "superblocks". @@ -201,6 +207,32 @@ Boston, MA 02111-1307, USA. + + Repository url/contenturl + + Originally, OSTree had just a url option + for remotes. Since then, the contenturl + option was introduced. Both of these support + file, http, and + https schemes. + + + Additionally, both of these can be prefixed with the string + mirrorlist=, which instructs the client + that the target url is a "mirrorlist" format, which is + a plain text file of newline-separated URLs. Earlier + URLs will be given precedence. + + + Note that currently, the tls-ca-path and + tls-client-cert-path options apply to every HTTP + request, even when contenturl and/or + mirrorlist are in use. This may change in the future to + only apply to metadata (i.e. url, not + contenturl) fetches. + + + Per-remote GPG keyrings and verification diff --git a/man/ostree.repo.5 b/man/ostree.repo.5 index 0f6ba486..e8693d73 100644 --- a/man/ostree.repo.5 +++ b/man/ostree.repo.5 @@ -2,7 +2,7 @@ .\" Title: ostree.repo .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: ostree.repo .\" Source: OSTree .\" Language: English diff --git a/man/rofiles-fuse.1 b/man/rofiles-fuse.1 index 56437b15..6839844d 100644 --- a/man/rofiles-fuse.1 +++ b/man/rofiles-fuse.1 @@ -2,7 +2,7 @@ .\" Title: rofiles-fuse .\" Author: Colin Walters .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 01/19/2017 +.\" Date: 03/10/2017 .\" Manual: rofiles-fuse .\" Source: rofiles-fuse .\" Language: English diff --git a/src/libostree/bupsplit.c b/src/libostree/bupsplit.c index 067b2e96..79207a65 100644 --- a/src/libostree/bupsplit.c +++ b/src/libostree/bupsplit.c @@ -80,7 +80,8 @@ static uint32_t rollsum_digest(Rollsum *r) } -static uint32_t rollsum_sum(uint8_t *buf, size_t ofs, size_t len) +uint32_t +bupsplit_sum(uint8_t *buf, size_t ofs, size_t len) { size_t count; Rollsum r; @@ -115,38 +116,3 @@ int bupsplit_find_ofs(const unsigned char *buf, int len, int *bits) } return 0; } - - -#ifndef BUP_NO_SELFTEST -#define BUP_SELFTEST_SIZE 100000 - -int bupsplit_selftest() -{ - uint8_t *buf = malloc(BUP_SELFTEST_SIZE); - uint32_t sum1a, sum1b, sum2a, sum2b, sum3a, sum3b; - unsigned count; - - srandom(1); - for (count = 0; count < BUP_SELFTEST_SIZE; count++) - buf[count] = random(); - - sum1a = rollsum_sum(buf, 0, BUP_SELFTEST_SIZE); - sum1b = rollsum_sum(buf, 1, BUP_SELFTEST_SIZE); - sum2a = rollsum_sum(buf, BUP_SELFTEST_SIZE - BUP_WINDOWSIZE*5/2, - BUP_SELFTEST_SIZE - BUP_WINDOWSIZE); - sum2b = rollsum_sum(buf, 0, BUP_SELFTEST_SIZE - BUP_WINDOWSIZE); - sum3a = rollsum_sum(buf, 0, BUP_WINDOWSIZE+3); - sum3b = rollsum_sum(buf, 3, BUP_WINDOWSIZE+3); - - fprintf(stderr, "sum1a = 0x%08x\n", sum1a); - fprintf(stderr, "sum1b = 0x%08x\n", sum1b); - fprintf(stderr, "sum2a = 0x%08x\n", sum2a); - fprintf(stderr, "sum2b = 0x%08x\n", sum2b); - fprintf(stderr, "sum3a = 0x%08x\n", sum3a); - fprintf(stderr, "sum3b = 0x%08x\n", sum3b); - - free(buf); - return sum1a!=sum1b || sum2a!=sum2b || sum3a!=sum3b; -} - -#endif // !BUP_NO_SELFTEST diff --git a/src/libostree/bupsplit.h b/src/libostree/bupsplit.h index e37a56ab..f770ee58 100644 --- a/src/libostree/bupsplit.h +++ b/src/libostree/bupsplit.h @@ -30,6 +30,9 @@ #ifndef __BUPSPLIT_H #define __BUPSPLIT_H +#include +#include + #define BUP_BLOBBITS (13) #define BUP_BLOBSIZE (1< +/* I only did some cursory research here, but it appears + * that we only want to use "linux16" for x86 platforms. + * At least, I got a report that "linux16" is definitely wrong + * for ppc64. See + * http://pkgs.fedoraproject.org/cgit/rpms/grub2.git/tree/0036-Use-linux16-when-appropriate-880840.patch?h=f25 + * https://bugzilla.redhat.com/show_bug.cgi?id=1108296 + * among others. + */ +#if defined(__i386__) || defined(__x86_64__) +#define GRUB2_USES_16 1 +#else +#define GRUB2_USES_16 0 +#endif + struct _OstreeBootloaderGrub2 { GObject parent_instance; @@ -203,7 +217,13 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot if (is_efi) g_string_append (output, "linuxefi "); else - g_string_append (output, "linux16 "); + { +#if GRUB2_USES_16 + g_string_append (output, "linux16 "); +#else + g_string_append (output, "linux "); +#endif + } g_string_append (output, kernel); options = ostree_bootconfig_parser_get (config, "options"); @@ -220,7 +240,13 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot if (is_efi) g_string_append (output, "initrdefi "); else - g_string_append (output, "initrd16 "); + { +#if GRUB2_USES_16 + g_string_append (output, "initrd16 "); +#else + g_string_append (output, "initrd "); +#endif + } g_string_append (output, initrd); g_string_append_c (output, '\n'); } @@ -239,12 +265,26 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot return ret; } +typedef struct { + const char *root; + const char *bootversion_str; + gboolean is_efi; +} Grub2ChildSetupData; + static void grub2_child_setup (gpointer user_data) { - const char *root = user_data; + Grub2ChildSetupData *cdata = user_data; - if (chdir (root) != 0) + setenv ("_OSTREE_GRUB2_BOOTVERSION", cdata->bootversion_str, TRUE); + /* We have to pass our state to the child */ + if (cdata->is_efi) + setenv ("_OSTREE_GRUB2_IS_EFI", "1", TRUE); + + if (!cdata->root) + return; + + if (chdir (cdata->root) != 0) { perror ("chdir"); _exit (1); @@ -268,7 +308,7 @@ grub2_child_setup (gpointer user_data) _exit (1); } - if (mount (root, "/", NULL, MS_MOVE, NULL) < 0) + if (mount (cdata->root, "/", NULL, MS_MOVE, NULL) < 0) { perror ("failed to MS_MOVE to /"); _exit (1); @@ -290,14 +330,15 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader); gboolean ret = FALSE; g_autoptr(GFile) new_config_path = NULL; - GSubprocessFlags subp_flags = 0; - glnx_unref_object GSubprocessLauncher *launcher = NULL; - glnx_unref_object GSubprocess *proc = NULL; g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion); g_autoptr(GFile) config_path_efi_dir = NULL; g_autofree char *grub2_mkconfig_chroot = NULL; gboolean use_system_grub2_mkconfig = TRUE; const gchar *grub_exec = NULL; + const char *grub_argv[4] = { NULL, "-o", NULL, NULL}; + GSpawnFlags grub_spawnflags = G_SPAWN_SEARCH_PATH; + int grub2_estatus; + Grub2ChildSetupData cdata = { NULL, }; #ifdef USE_BUILTIN_GRUB2_MKCONFIG use_system_grub2_mkconfig = FALSE; @@ -354,22 +395,15 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, bootversion); } - if (!g_getenv ("OSTREE_DEBUG_GRUB2")) - subp_flags |= (G_SUBPROCESS_FLAGS_STDOUT_SILENCE | G_SUBPROCESS_FLAGS_STDERR_SILENCE); - - launcher = g_subprocess_launcher_new (subp_flags); - g_subprocess_launcher_setenv (launcher, "_OSTREE_GRUB2_BOOTVERSION", bootversion_str, TRUE); - /* We have to pass our state to the child */ - if (self->is_efi) - g_subprocess_launcher_setenv (launcher, "_OSTREE_GRUB2_IS_EFI", "1", TRUE); - - /* We need to chroot() if we're not in /. This assumes our caller has - * set up the bind mounts outside. - */ - if (grub2_mkconfig_chroot != NULL) - g_subprocess_launcher_set_child_setup (launcher, grub2_child_setup, grub2_mkconfig_chroot, NULL); + grub_argv[0] = grub_exec; + grub_argv[2] = gs_file_get_path_cached (new_config_path); - /* In the current Fedora grub2 package, this script doesn't even try + if (!g_getenv ("OSTREE_DEBUG_GRUB2")) + grub_spawnflags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL; + cdata.root = grub2_mkconfig_chroot; + cdata.bootversion_str = bootversion_str; + cdata.is_efi = self->is_efi; + /* Note in older versions of the grub2 package, this script doesn't even try to be atomic; it just does: cat ${grub_cfg}.new > ${grub_cfg} @@ -377,13 +411,15 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, Upstream is fixed though. */ - proc = g_subprocess_launcher_spawn (launcher, error, - grub_exec, "-o", - gs_file_get_path_cached (new_config_path), - NULL); - - if (!g_subprocess_wait_check (proc, cancellable, error)) + if (!g_spawn_sync (NULL, (char**)grub_argv, NULL, grub_spawnflags, + grub2_child_setup, &cdata, NULL, NULL, + &grub2_estatus, error)) goto out; + if (!g_spawn_check_exit_status (grub2_estatus, error)) + { + g_prefix_error (error, "%s: ", grub_argv[0]); + goto out; + } /* Now let's fdatasync() for the new file */ { glnx_fd_close int new_config_fd = open (gs_file_get_path_cached (new_config_path), O_RDONLY | O_CLOEXEC); diff --git a/src/libostree/ostree-core-private.h b/src/libostree/ostree-core-private.h index 0c5fb0eb..cfd8a998 100644 --- a/src/libostree/ostree-core-private.h +++ b/src/libostree/ostree-core-private.h @@ -24,6 +24,9 @@ G_BEGIN_DECLS +/* It's what gzip does, 9 is too slow */ +#define OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL (6) + /* This file contains private implementation data format definitions * read by multiple implementation .c files. */ @@ -143,4 +146,16 @@ _ostree_detached_metadata_append_gpg_sig (GVariant *existing_metadata, GFile * _ostree_get_default_sysroot_path (void); +_OSTREE_PUBLIC +gboolean +_ostree_raw_file_to_archive_stream (GInputStream *input, + GFileInfo *file_info, + GVariant *xattrs, + guint compression_level, + GInputStream **out_input, + GCancellable *cancellable, + GError **error); + + + G_END_DECLS diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index e3f0a771..cf238b41 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -453,6 +453,34 @@ header_and_input_to_stream (GVariant *file_header, return TRUE; } +gboolean +_ostree_raw_file_to_archive_stream (GInputStream *input, + GFileInfo *file_info, + GVariant *xattrs, + guint compression_level, + GInputStream **out_input, + GCancellable *cancellable, + GError **error) +{ + g_autoptr(GVariant) file_header = NULL; + g_autoptr(GInputStream) zlib_input = NULL; + + file_header = _ostree_zlib_file_header_new (file_info, xattrs); + if (input != NULL) + { + g_autoptr(GConverter) zlib_compressor = NULL; + + zlib_compressor = G_CONVERTER (g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, compression_level)); + zlib_input = g_converter_input_stream_new (input, zlib_compressor); + } + return header_and_input_to_stream (file_header, + zlib_input, + out_input, + NULL, + cancellable, + error); +} + /** * ostree_raw_file_to_archive_z2_stream: * @input: File raw content stream @@ -473,23 +501,49 @@ ostree_raw_file_to_archive_z2_stream (GInputStream *input, GCancellable *cancellable, GError **error) { - g_autoptr(GVariant) file_header = NULL; - g_autoptr(GInputStream) zlib_input = NULL; + return _ostree_raw_file_to_archive_stream (input, file_info, xattrs, + OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL, + out_input, cancellable, error); +} - file_header = _ostree_zlib_file_header_new (file_info, xattrs); - if (input != NULL) - { - g_autoptr(GConverter) zlib_compressor = NULL; +/** + * ostree_raw_file_to_archive_z2_stream_with_options: + * @input: File raw content stream + * @file_info: A file info + * @xattrs: (allow-none): Optional extended attributes + * @options: (nullable): A GVariant `a{sv}` with an extensible set of flags + * @out_input: (out): Serialized object stream + * @cancellable: Cancellable + * @error: Error + * + * Like ostree_raw_file_to_archive_z2_stream(), but supports an extensible set + * of flags. The following flags are currently defined: + * + * - `compression-level` (`i`): Level of compression to use, 0–9, with 0 being + * the least compression, and <0 giving the default level (currently 6). + * + * Since: 2017.3 + */ +gboolean +ostree_raw_file_to_archive_z2_stream_with_options (GInputStream *input, + GFileInfo *file_info, + GVariant *xattrs, + GVariant *options, + GInputStream **out_input, + GCancellable *cancellable, + GError **error) +{ + gint compression_level = -1; - zlib_compressor = G_CONVERTER (g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, 9)); - zlib_input = g_converter_input_stream_new (input, zlib_compressor); - } - return header_and_input_to_stream (file_header, - zlib_input, - out_input, - NULL, - cancellable, - error); + if (options) + (void) g_variant_lookup (options, "compression-level", "i", &compression_level); + + if (compression_level < 0) + compression_level = OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL; + + return _ostree_raw_file_to_archive_stream (input, file_info, xattrs, + compression_level, + out_input, cancellable, error); } /** diff --git a/src/libostree/ostree-core.h b/src/libostree/ostree-core.h index a3419949..bd3d5f2c 100644 --- a/src/libostree/ostree-core.h +++ b/src/libostree/ostree-core.h @@ -311,6 +311,16 @@ ostree_raw_file_to_archive_z2_stream (GInputStream *input, GCancellable *cancellable, GError **error); +_OSTREE_PUBLIC +gboolean +ostree_raw_file_to_archive_z2_stream_with_options (GInputStream *input, + GFileInfo *file_info, + GVariant *xattrs, + GVariant *options, + GInputStream **out_input, + GCancellable *cancellable, + GError **error); + _OSTREE_PUBLIC gboolean ostree_raw_file_to_content_stream (GInputStream *input, GFileInfo *file_info, diff --git a/src/libostree/ostree-enumtypes.c b/src/libostree/ostree-enumtypes.c deleted file mode 100644 index ee232af4..00000000 --- a/src/libostree/ostree-enumtypes.c +++ /dev/null @@ -1,86 +0,0 @@ - -/* Generated data (by glib-mkenums) */ - -/* - * Copyright (C) 2015 Red Hat, Inc. - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include - -#include "ostree-enumtypes.h" - -/* enumerations from "./src/libostree/ostree-fetcher.h" */ -#include "./src/libostree/ostree-fetcher.h" - -GType -_ostree_fetcher_config_flags_get_type (void) -{ - static volatile gsize the_type__volatile = 0; - - if (g_once_init_enter (&the_type__volatile)) - { - static const GFlagsValue values[] = { - { OSTREE_FETCHER_FLAGS_NONE, - "OSTREE_FETCHER_FLAGS_NONE", - "none" }, - { OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE, - "OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE", - "tls-permissive" }, - { 0, NULL, NULL } - }; - - GType the_type = g_flags_register_static ( - g_intern_static_string ("OstreeFetcherConfigFlags"), - values); - - g_once_init_leave (&the_type__volatile, the_type); - } - - return the_type__volatile; -} - -GType -_ostree_fetcher_request_flags_get_type (void) -{ - static volatile gsize the_type__volatile = 0; - - if (g_once_init_enter (&the_type__volatile)) - { - static const GFlagsValue values[] = { - { OSTREE_FETCHER_REQUEST_NUL_TERMINATION, - "OSTREE_FETCHER_REQUEST_NUL_TERMINATION", - "termination" }, - { 0, NULL, NULL } - }; - - GType the_type = g_flags_register_static ( - g_intern_static_string ("OstreeFetcherRequestFlags"), - values); - - g_once_init_leave (&the_type__volatile, the_type); - } - - return the_type__volatile; -} - - -/* Generated data ends here */ - diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c new file mode 100644 index 00000000..be0e4b41 --- /dev/null +++ b/src/libostree/ostree-fetcher-curl.c @@ -0,0 +1,941 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2016 Colin Walters + * + * 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. + */ + +#include "config.h" + +#include +#include +#include +#include + +/* These macros came from 7.43.0, but we want to check + * for versions a bit earlier than that (to work on CentOS 7), + * so define them here if we're using an older version. + */ +#ifndef CURL_VERSION_BITS +#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z) +#endif +#ifndef CURL_AT_LEAST_VERSION +#define CURL_AT_LEAST_VERSION(x,y,z) (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) +#endif + +#include "ostree-fetcher.h" +#include "ostree-fetcher-util.h" +#include "ostree-enumtypes.h" +#include "ostree-repo-private.h" +#include "otutil.h" + +#include "ostree-soup-uri.h" + +typedef struct FetcherRequest FetcherRequest; +typedef struct SockInfo SockInfo; + +static int sock_cb (CURL *e, curl_socket_t s, int what, void *cbp, void *sockp); +static gboolean timer_cb (gpointer data); +static void sock_unref (SockInfo *f); +static int update_timeout_cb (CURLM *multi, long timeout_ms, void *userp); +static void request_unref (FetcherRequest *req); +static void initiate_next_curl_request (FetcherRequest *req, GTask *task); +static void destroy_and_unref_source (GSource *source); + +struct OstreeFetcher +{ + GObject parent_instance; + + OstreeFetcherConfigFlags config_flags; + char *remote_name; + char *tls_ca_db_path; + char *tls_client_cert_path; + char *tls_client_key_path; + char *cookie_jar_path; + char *proxy; + struct curl_slist *extra_headers; + int tmpdir_dfd; + + GMainContext *mainctx; + CURLM *multi; + GSource *timer_event; + int curl_running; + GHashTable *outstanding_requests; /* Set */ + GHashTable *sockets; /* Set */ + + guint64 bytes_transferred; +}; + +/* Information associated with a request */ +struct FetcherRequest { + guint refcount; + GPtrArray *mirrorlist; + guint idx; + + char *filename; + guint64 current_size; + guint64 max_size; + OstreeFetcherRequestFlags flags; + gboolean is_membuf; + GError *caught_write_error; + char *out_tmpfile; + int out_tmpfile_fd; + GString *output_buf; + + CURL *easy; + char error[CURL_ERROR_SIZE]; + + OstreeFetcher *fetcher; +}; + +/* Information associated with a specific socket */ +struct SockInfo { + guint refcount; + curl_socket_t sockfd; + int action; + long timeout; + GSource *ch; + OstreeFetcher *fetcher; +}; + +enum { + PROP_0, + PROP_CONFIG_FLAGS +}; + +G_DEFINE_TYPE (OstreeFetcher, _ostree_fetcher, G_TYPE_OBJECT) + +static void +_ostree_fetcher_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + OstreeFetcher *self = OSTREE_FETCHER (object); + + switch (prop_id) + { + case PROP_CONFIG_FLAGS: + self->config_flags = g_value_get_flags (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +_ostree_fetcher_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + OstreeFetcher *self = OSTREE_FETCHER (object); + + switch (prop_id) + { + case PROP_CONFIG_FLAGS: + g_value_set_flags (value, self->config_flags); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +_ostree_fetcher_finalize (GObject *object) +{ + OstreeFetcher *self = OSTREE_FETCHER (object); + + g_free (self->remote_name); + g_free (self->cookie_jar_path); + g_free (self->proxy); + g_assert_cmpint (g_hash_table_size (self->outstanding_requests), ==, 0); + g_clear_pointer (&self->extra_headers, (GDestroyNotify)curl_slist_free_all); + g_hash_table_unref (self->outstanding_requests); + g_hash_table_unref (self->sockets); + g_clear_pointer (&self->timer_event, (GDestroyNotify)destroy_and_unref_source); + if (self->mainctx) + g_main_context_unref (self->mainctx); + curl_multi_cleanup (self->multi); + + G_OBJECT_CLASS (_ostree_fetcher_parent_class)->finalize (object); +} + +static void +_ostree_fetcher_constructed (GObject *object) +{ + // OstreeFetcher *self = OSTREE_FETCHER (object); + + G_OBJECT_CLASS (_ostree_fetcher_parent_class)->constructed (object); +} + +static void +_ostree_fetcher_class_init (OstreeFetcherClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = _ostree_fetcher_set_property; + gobject_class->get_property = _ostree_fetcher_get_property; + gobject_class->finalize = _ostree_fetcher_finalize; + gobject_class->constructed = _ostree_fetcher_constructed; + + g_object_class_install_property (gobject_class, + PROP_CONFIG_FLAGS, + g_param_spec_flags ("config-flags", + "", + "", + OSTREE_TYPE_FETCHER_CONFIG_FLAGS, + OSTREE_FETCHER_FLAGS_NONE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); +} + +static void +_ostree_fetcher_init (OstreeFetcher *self) +{ + self->multi = curl_multi_init(); + self->outstanding_requests = g_hash_table_new_full (NULL, NULL, (GDestroyNotify)g_object_unref, NULL); + self->sockets = g_hash_table_new_full (NULL, NULL, (GDestroyNotify)sock_unref, NULL); + curl_multi_setopt (self->multi, CURLMOPT_SOCKETFUNCTION, sock_cb); + curl_multi_setopt (self->multi, CURLMOPT_SOCKETDATA, self); + curl_multi_setopt (self->multi, CURLMOPT_TIMERFUNCTION, update_timeout_cb); + curl_multi_setopt (self->multi, CURLMOPT_TIMERDATA, self); +#if CURL_AT_LEAST_VERSION(7, 30, 0) + /* Let's do something reasonable here. */ + curl_multi_setopt (self->multi, CURLMOPT_MAX_TOTAL_CONNECTIONS, 8); +#endif +} + + +OstreeFetcher * +_ostree_fetcher_new (int tmpdir_dfd, + const char *remote_name, + OstreeFetcherConfigFlags flags) +{ + OstreeFetcher *fetcher = g_object_new (OSTREE_TYPE_FETCHER, "config-flags", flags, NULL); + fetcher->remote_name = g_strdup (remote_name); + fetcher->tmpdir_dfd = tmpdir_dfd; + return fetcher; +} + +static void +destroy_and_unref_source (GSource *source) +{ + g_source_destroy (source); + g_source_unref (source); +} + +static char * +request_get_uri (FetcherRequest *req, guint idx) +{ + SoupURI *baseuri = req->mirrorlist->pdata[idx]; + if (!req->filename) + return soup_uri_to_string (baseuri, FALSE); + { g_autofree char *uristr = soup_uri_to_string (baseuri, FALSE); + return g_build_filename (uristr, req->filename, NULL); + } +} + +static gboolean +ensure_tmpfile (FetcherRequest *req, GError **error) +{ + if (req->out_tmpfile_fd == -1) + { + if (!glnx_open_tmpfile_linkable_at (req->fetcher->tmpdir_dfd, ".", + O_WRONLY, &req->out_tmpfile_fd, + &req->out_tmpfile, + error)) + return FALSE; + } + return TRUE; +} +/* Check for completed transfers, and remove their easy handles */ +static void +check_multi_info (OstreeFetcher *fetcher) +{ + CURLMsg *msg; + int msgs_left; + + while ((msg = curl_multi_info_read (fetcher->multi, &msgs_left)) != NULL) + { + long response; + CURL *easy = msg->easy_handle; + CURLcode curlres = msg->data.result; + GTask *task; + FetcherRequest *req; + const char *eff_url; + gboolean is_file; + gboolean continued_request = FALSE; + + if (msg->msg != CURLMSG_DONE) + continue; + + curl_easy_getinfo (easy, CURLINFO_PRIVATE, &task); + curl_easy_getinfo (easy, CURLINFO_EFFECTIVE_URL, &eff_url); + /* We should have limited the protocols; this is what + * curl's tool_operate.c does. + */ + is_file = g_str_has_prefix (eff_url, "file:"); + g_assert (is_file || g_str_has_prefix (eff_url, "http")); + + req = g_task_get_task_data (task); + + if (req->caught_write_error) + g_task_return_error (task, g_steal_pointer (&req->caught_write_error)); + else if (curlres != CURLE_OK) + { + if (is_file && curlres == CURLE_FILE_COULDNT_READ_FILE) + { + /* Handle file not found */ + g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "%s", + curl_easy_strerror (curlres)); + } + else + { + g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "[%u] %s", + curlres, + curl_easy_strerror (curlres)); + if (req->fetcher->remote_name) + _ostree_fetcher_journal_failure (req->fetcher->remote_name, + eff_url, curl_easy_strerror (curlres)); + } + } + else + { + curl_easy_getinfo (easy, CURLINFO_RESPONSE_CODE, &response); + if (!is_file && !(response >= 200 && response < 300)) + { + GIOErrorEnum giocode; + + /* TODO - share with soup */ + switch (response) + { + case 404: + case 403: + case 410: + giocode = G_IO_ERROR_NOT_FOUND; + break; + default: + giocode = G_IO_ERROR_FAILED; + } + + if (req->idx + 1 == req->mirrorlist->len) + { + g_autofree char *msg = g_strdup_printf ("Server returned HTTP %lu", response); + g_task_return_new_error (task, G_IO_ERROR, giocode, + "%s", msg); + if (req->fetcher->remote_name) + _ostree_fetcher_journal_failure (req->fetcher->remote_name, + eff_url, msg); + + } + else + { + continued_request = TRUE; + } + } + else if (req->is_membuf) + { + GBytes *ret; + if ((req->flags & OSTREE_FETCHER_REQUEST_NUL_TERMINATION) > 0) + g_string_append_c (req->output_buf, '\0'); + ret = g_string_free_to_bytes (req->output_buf); + req->output_buf = NULL; + g_task_return_pointer (task, ret, (GDestroyNotify)g_bytes_unref); + } + else + { + g_autoptr(GError) local_error = NULL; + GError **error = &local_error; + + /* TODO - share file naming with soup, and fix it */ + g_autofree char *tmpfile_path = + g_compute_checksum_for_string (G_CHECKSUM_SHA256, + eff_url, strlen (eff_url)); + if (!ensure_tmpfile (req, error)) + { + g_task_return_error (task, g_steal_pointer (&local_error)); + } + else if (fchmod (req->out_tmpfile_fd, 0644) < 0) + { + glnx_set_error_from_errno (error); + g_task_return_error (task, g_steal_pointer (&local_error)); + } + else if (!glnx_link_tmpfile_at (fetcher->tmpdir_dfd, + GLNX_LINK_TMPFILE_REPLACE, + req->out_tmpfile_fd, + req->out_tmpfile, + fetcher->tmpdir_dfd, + tmpfile_path, + error)) + g_task_return_error (task, g_steal_pointer (&local_error)); + else + { + g_task_return_pointer (task, g_steal_pointer (&tmpfile_path), g_free); + } + } + } + + curl_multi_remove_handle (fetcher->multi, easy); + if (continued_request) + { + req->idx++; + initiate_next_curl_request (req, task); + } + else + { + g_hash_table_remove (fetcher->outstanding_requests, task); + if (g_hash_table_size (fetcher->outstanding_requests) == 0) + { + g_clear_pointer (&fetcher->mainctx, g_main_context_unref); + } + } + } +} + +/* Called by glib when our timeout expires */ +static gboolean +timer_cb (gpointer data) +{ + OstreeFetcher *fetcher = data; + CURLMcode rc; + GSource *orig_src = fetcher->timer_event; + + rc = curl_multi_socket_action (fetcher->multi, CURL_SOCKET_TIMEOUT, 0, &fetcher->curl_running); + g_assert (rc == CURLM_OK); + check_multi_info (fetcher); + if (fetcher->timer_event == orig_src) + fetcher->timer_event = NULL; + + return FALSE; +} + +/* Update the event timer after curl_multi library calls */ +static int +update_timeout_cb (CURLM *multi, long timeout_ms, void *userp) +{ + OstreeFetcher *fetcher = userp; + + g_clear_pointer (&fetcher->timer_event, (GDestroyNotify)destroy_and_unref_source); + + if (timeout_ms != -1) + { + fetcher->timer_event = g_timeout_source_new (timeout_ms); + g_source_set_callback (fetcher->timer_event, timer_cb, fetcher, NULL); + g_source_attach (fetcher->timer_event, fetcher->mainctx); + } + + return 0; +} + +/* Called by glib when we get action on a multi socket */ +static gboolean +event_cb (int fd, GIOCondition condition, gpointer data) +{ + OstreeFetcher *fetcher = data; + CURLMcode rc; + + int action = + (condition & G_IO_IN ? CURL_CSELECT_IN : 0) | + (condition & G_IO_OUT ? CURL_CSELECT_OUT : 0); + + rc = curl_multi_socket_action (fetcher->multi, fd, action, &fetcher->curl_running); + g_assert (rc == CURLM_OK); + + check_multi_info (fetcher); + if (fetcher->curl_running > 0) + { + return TRUE; + } + else + { + return FALSE; + } +} + +/* Clean up the SockInfo structure */ +static void +sock_unref (SockInfo *f) +{ + if (!f) + return; + if (--f->refcount != 0) + return; + g_clear_pointer (&f->ch, (GDestroyNotify)destroy_and_unref_source); + g_free (f); +} + +/* Assign information to a SockInfo structure */ +static void +setsock (SockInfo*f, curl_socket_t s, int act, OstreeFetcher *fetcher) +{ + GIOCondition kind = + (act&CURL_POLL_IN?G_IO_IN:0)|(act&CURL_POLL_OUT?G_IO_OUT:0); + + f->sockfd = s; + f->action = act; + g_clear_pointer (&f->ch, (GDestroyNotify)destroy_and_unref_source); + /* TODO - investigate new g_source_modify_unix_fd() so changing the poll + * flags involves less allocation. + */ + f->ch = g_unix_fd_source_new (f->sockfd, kind); + g_source_set_callback (f->ch, (GSourceFunc) event_cb, fetcher, NULL); + g_source_attach (f->ch, fetcher->mainctx); +} + +/* Initialize a new SockInfo structure */ +static void +addsock (curl_socket_t s, CURL *easy, int action, OstreeFetcher *fetcher) +{ + SockInfo *fdp = g_new0 (SockInfo, 1); + + fdp->refcount = 1; + fdp->fetcher = fetcher; + setsock (fdp, s, action, fetcher); + curl_multi_assign (fetcher->multi, s, fdp); + g_hash_table_add (fetcher->sockets, fdp); +} + +/* CURLMOPT_SOCKETFUNCTION */ +static int +sock_cb (CURL *easy, curl_socket_t s, int what, void *cbp, void *sockp) +{ + OstreeFetcher *fetcher = cbp; + SockInfo *fdp = (SockInfo*) sockp; + + if (what == CURL_POLL_REMOVE) + { + if (!g_hash_table_remove (fetcher->sockets, fdp)) + g_assert_not_reached (); + } + else + { + if (!fdp) + { + addsock (s, easy, what, fetcher); + } + else + { + setsock (fdp, s, what, fetcher); + } + } + return 0; +} + +/* CURLOPT_WRITEFUNCTION */ +static size_t +write_cb (void *ptr, size_t size, size_t nmemb, void *data) +{ + const size_t realsize = size * nmemb; + GTask *task = data; + FetcherRequest *req; + + req = g_task_get_task_data (task); + + if (req->caught_write_error) + return -1; + + if (req->max_size > 0) + { + if (realsize > req->max_size || + (realsize + req->current_size) > req->max_size) + { + const char *eff_url; + curl_easy_getinfo (req->easy, CURLINFO_EFFECTIVE_URL, &eff_url); + req->caught_write_error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, + "URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes", + eff_url, req->max_size); + return -1; + } + } + + if (req->is_membuf) + g_string_append_len (req->output_buf, ptr, realsize); + else + { + if (!ensure_tmpfile (req, &req->caught_write_error)) + return -1; + g_assert (req->out_tmpfile_fd >= 0); + if (glnx_loop_write (req->out_tmpfile_fd, ptr, realsize) < 0) + { + glnx_set_error_from_errno (&req->caught_write_error); + return -1; + } + } + + req->current_size += realsize; + req->fetcher->bytes_transferred += realsize; + + return realsize; +} + +/* CURLOPT_PROGRESSFUNCTION */ +static int +prog_cb (void *p, double dltotal, double dlnow, double ult, double uln) +{ + GTask *task = p; + FetcherRequest *req; + char *eff_url; + req = g_task_get_task_data (task); + curl_easy_getinfo (req->easy, CURLINFO_EFFECTIVE_URL, &eff_url); + g_printerr ("Progress: %s (%g/%g)\n", eff_url, dlnow, dltotal); + return 0; +} + +static void +request_unref (FetcherRequest *req) +{ + if (--req->refcount != 0) + return; + + g_ptr_array_unref (req->mirrorlist); + g_free (req->filename); + g_clear_error (&req->caught_write_error); + if (req->out_tmpfile_fd != -1) + (void) close (req->out_tmpfile_fd); + g_free (req->out_tmpfile); + if (req->output_buf) + g_string_free (req->output_buf, TRUE); + curl_easy_cleanup (req->easy); + + g_free (req); +} + +int +_ostree_fetcher_get_dfd (OstreeFetcher *fetcher) +{ + return fetcher->tmpdir_dfd; +} + +void +_ostree_fetcher_set_proxy (OstreeFetcher *self, + const char *http_proxy) +{ + g_free (self->proxy); + self->proxy = g_strdup (http_proxy); +} + +void +_ostree_fetcher_set_cookie_jar (OstreeFetcher *self, + const char *jar_path) +{ + g_free (self->cookie_jar_path); + self->cookie_jar_path = g_strdup (jar_path); +} + +void +_ostree_fetcher_set_client_cert (OstreeFetcher *self, + const char *cert_path, + const char *key_path) +{ + g_assert ((cert_path == NULL && key_path == NULL) + || (cert_path != NULL && key_path != NULL)); + g_free (self->tls_client_cert_path); + self->tls_client_cert_path = g_strdup (cert_path); + g_free (self->tls_client_key_path); + self->tls_client_key_path = g_strdup (key_path); +} + +void +_ostree_fetcher_set_tls_database (OstreeFetcher *self, + const char *dbpath) +{ + g_free (self->tls_ca_db_path); + self->tls_ca_db_path = g_strdup (dbpath); +} + +void +_ostree_fetcher_set_extra_headers (OstreeFetcher *self, + GVariant *extra_headers) +{ + GVariantIter viter; + const char *key; + const char *value; + + g_clear_pointer (&self->extra_headers, (GDestroyNotify)curl_slist_free_all); + + g_variant_iter_init (&viter, extra_headers); + while (g_variant_iter_loop (&viter, "(&s&s)", &key, &value)) + { + g_autofree char *header = g_strdup_printf ("%s: %s", key, value); + self->extra_headers = curl_slist_append (self->extra_headers, header); + } +} + +/* Re-bind all of the outstanding curl items to our new main context */ +static void +adopt_steal_mainctx (OstreeFetcher *self, + GMainContext *mainctx) +{ + GHashTableIter hiter; + gpointer key, value; + + g_assert (self->mainctx == NULL); + self->mainctx = mainctx; /* Transfer */ + + if (self->timer_event != NULL) + { + guint64 readytime = g_source_get_ready_time (self->timer_event); + guint64 curtime = g_source_get_time (self->timer_event); + guint64 timeout_micros = curtime - readytime; + if (timeout_micros < 0) + timeout_micros = 0; + update_timeout_cb (self->multi, timeout_micros / 1000, self); + } + + g_hash_table_iter_init (&hiter, self->sockets); + while (g_hash_table_iter_next (&hiter, &key, &value)) + { + SockInfo *fdp = key; + setsock (fdp, fdp->sockfd, fdp->action, self); + } +} + +static void +initiate_next_curl_request (FetcherRequest *req, + GTask *task) +{ + CURLMcode rc; + OstreeFetcher *self = req->fetcher; + + if (req->easy) + curl_easy_cleanup (req->easy); + req->easy = curl_easy_init (); + g_assert (req->easy); + + g_assert_cmpint (req->idx, <, req->mirrorlist->len); + + { g_autofree char *uri = request_get_uri (req, req->idx); + curl_easy_setopt (req->easy, CURLOPT_URL, uri); + } + + curl_easy_setopt (req->easy, CURLOPT_USERAGENT, "ostree "); + if (self->extra_headers) + curl_easy_setopt (req->easy, CURLOPT_HTTPHEADER, self->extra_headers); + + if (self->cookie_jar_path) + { + rc = curl_easy_setopt (req->easy, CURLOPT_COOKIEFILE, self->cookie_jar_path); + g_assert_cmpint (rc, ==, CURLM_OK); + rc = curl_easy_setopt (req->easy, CURLOPT_COOKIELIST, "RELOAD"); + g_assert_cmpint (rc, ==, CURLM_OK); + } + + if (self->proxy) + { + rc = curl_easy_setopt (req->easy, CURLOPT_PROXY, self->proxy); + g_assert_cmpint (rc, ==, CURLM_OK); + } + + if (self->tls_ca_db_path) + curl_easy_setopt (req->easy, CURLOPT_CAINFO, self->tls_ca_db_path); + + if ((self->config_flags & OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE) > 0) + curl_easy_setopt (req->easy, CURLOPT_SSL_VERIFYPEER, 0L); + + if (self->tls_client_cert_path) + { + curl_easy_setopt (req->easy, CURLOPT_SSLCERT, self->tls_client_cert_path); + curl_easy_setopt (req->easy, CURLOPT_SSLKEY, self->tls_client_key_path); + } + + /* We should only speak HTTP; TODO: only enable file if specified */ + curl_easy_setopt (req->easy, CURLOPT_PROTOCOLS, (long)(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE)); + /* Picked the current version in F25 as of 20170127, since + * there are numerous HTTP/2 fixes since the original version in + * libcurl 7.43.0. + */ +#if CURL_AT_LEAST_VERSION(7, 51, 0) + curl_easy_setopt (req->easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); +#endif + curl_easy_setopt (req->easy, CURLOPT_WRITEFUNCTION, write_cb); + if (g_getenv ("OSTREE_DEBUG_HTTP")) + curl_easy_setopt (req->easy, CURLOPT_VERBOSE, 1L); + curl_easy_setopt (req->easy, CURLOPT_ERRORBUFFER, req->error); + /* Note that the "easy" object's privdata is the task */ + curl_easy_setopt (req->easy, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt (req->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); + curl_easy_setopt (req->easy, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (req->easy, CURLOPT_CONNECTTIMEOUT, 30L); + curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_LIMIT, 1L); + curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_TIME, 30L); + + /* closure bindings -> task */ + curl_easy_setopt (req->easy, CURLOPT_PRIVATE, task); + curl_easy_setopt (req->easy, CURLOPT_WRITEDATA, task); + curl_easy_setopt (req->easy, CURLOPT_PROGRESSDATA, task); + + rc = curl_multi_add_handle (self->multi, req->easy); + g_assert (rc == CURLM_OK); +} + +static void +_ostree_fetcher_request_async (OstreeFetcher *self, + GPtrArray *mirrorlist, + const char *filename, + OstreeFetcherRequestFlags flags, + gboolean is_membuf, + guint64 max_size, + int priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_autoptr(GTask) task = NULL; + FetcherRequest *req; + g_autoptr(GMainContext) mainctx = g_main_context_ref_thread_default (); + + /* We don't support multiple concurrent main contexts; take + * a ref to the first one, and require that later invocations + * share it. + */ + if (g_hash_table_size (self->outstanding_requests) == 0 + && mainctx != self->mainctx) + { + adopt_steal_mainctx (self, g_steal_pointer (&mainctx)); + } + else + { + g_assert (self->mainctx == mainctx); + } + + req = g_new0 (FetcherRequest, 1); + req->refcount = 1; + req->error[0]='\0'; + req->fetcher = self; + req->mirrorlist = g_ptr_array_ref (mirrorlist); + req->filename = g_strdup (filename); + req->max_size = max_size; + req->flags = flags; + req->is_membuf = is_membuf; + /* We'll allocate the tmpfile on demand, so we handle + * file I/O errors just in the write func. + */ + req->out_tmpfile_fd = -1; + if (req->is_membuf) + req->output_buf = g_string_new (""); + + task = g_task_new (self, cancellable, callback, user_data); + /* We'll use the GTask priority for our own priority queue. */ + g_task_set_priority (task, priority); + g_task_set_source_tag (task, _ostree_fetcher_request_async); + g_task_set_task_data (task, req, (GDestroyNotify) request_unref); + + initiate_next_curl_request (req, task); + + g_hash_table_add (self->outstanding_requests, g_steal_pointer (&task)); + + /* Sanity check, I added * 2 just so we don't abort if something odd happens, + * but we do want to abort if we're asked to do obviously too many requests. + */ + g_assert_cmpint (g_hash_table_size (self->outstanding_requests), <, + _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS * 2); +} + +void +_ostree_fetcher_request_to_tmpfile (OstreeFetcher *self, + GPtrArray *mirrorlist, + const char *filename, + guint64 max_size, + int priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + _ostree_fetcher_request_async (self, mirrorlist, filename, 0, FALSE, + max_size, priority, cancellable, + callback, user_data); +} + +gboolean +_ostree_fetcher_request_to_tmpfile_finish (OstreeFetcher *self, + GAsyncResult *result, + char **out_filename, + GError **error) +{ + GTask *task; + FetcherRequest *req; + gpointer ret; + + g_return_val_if_fail (g_task_is_valid (result, self), FALSE); + g_return_val_if_fail (g_async_result_is_tagged (result, _ostree_fetcher_request_async), FALSE); + + task = (GTask*)result; + req = g_task_get_task_data (task); + + ret = g_task_propagate_pointer (task, error); + if (!ret) + return FALSE; + + g_assert (!req->is_membuf); + g_assert (out_filename); + *out_filename = ret; + + return TRUE; +} + +void +_ostree_fetcher_request_to_membuf (OstreeFetcher *self, + GPtrArray *mirrorlist, + const char *filename, + OstreeFetcherRequestFlags flags, + guint64 max_size, + int priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + _ostree_fetcher_request_async (self, mirrorlist, filename, flags, TRUE, + max_size, priority, cancellable, + callback, user_data); +} + +gboolean +_ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self, + GAsyncResult *result, + GBytes **out_buf, + GError **error) +{ + GTask *task; + FetcherRequest *req; + gpointer ret; + + g_return_val_if_fail (g_task_is_valid (result, self), FALSE); + g_return_val_if_fail (g_async_result_is_tagged (result, _ostree_fetcher_request_async), FALSE); + + task = (GTask*)result; + req = g_task_get_task_data (task); + + ret = g_task_propagate_pointer (task, error); + if (!ret) + return FALSE; + + g_assert (req->is_membuf); + g_assert (out_buf); + *out_buf = ret; + + return TRUE; +} + +guint64 +_ostree_fetcher_bytes_transferred (OstreeFetcher *self) +{ + return self->bytes_transferred; +} diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher-soup.c similarity index 90% rename from src/libostree/ostree-fetcher.c rename to src/libostree/ostree-fetcher-soup.c index a178abfe..b130b48c 100644 --- a/src/libostree/ostree-fetcher.c +++ b/src/libostree/ostree-fetcher-soup.c @@ -32,6 +32,7 @@ #include "libglnx.h" #include "ostree-fetcher.h" +#include "ostree-fetcher-util.h" #ifdef HAVE_LIBSOUP_CLIENT_CERTS #include "ostree-tls-cert-interaction.h" #endif @@ -55,6 +56,7 @@ typedef struct { GError *initialization_error; /* Any failure to load the db */ int tmpdir_dfd; + char *remote_name; char *tmpdir_name; GLnxLockFile tmpdir_lock; int base_tmpdir_dfd; @@ -62,8 +64,7 @@ typedef struct { GVariant *extra_headers; int max_outstanding; - /* Queue for libsoup, see bgo#708591 */ - GQueue pending_queue; + /* Our active HTTP requests */ GHashTable *outstanding; /* Shared across threads; be sure to lock. */ @@ -77,9 +78,6 @@ typedef struct { } ThreadClosure; -static void -session_thread_process_pending_queue (ThreadClosure *thread_closure); - typedef struct { volatile int ref_count; @@ -172,6 +170,8 @@ thread_closure_unref (ThreadClosure *thread_closure) g_clear_pointer (&thread_closure->oob_error, g_error_free); + g_free (thread_closure->remote_name); + g_slice_free (ThreadClosure, thread_closure); } } @@ -187,18 +187,6 @@ idle_closure_free (IdleClosure *idle_closure) g_slice_free (IdleClosure, idle_closure); } -static int -pending_task_compare (gconstpointer a, - gconstpointer b, - gpointer unused) -{ - gint priority_a = g_task_get_priority (G_TASK (a)); - gint priority_b = g_task_get_priority (G_TASK (b)); - - return (priority_a == priority_b) ? 0 : - (priority_a < priority_b) ? -1 : 1; -} - static OstreeFetcherPendingURI * pending_uri_ref (OstreeFetcherPendingURI *pending) { @@ -403,30 +391,23 @@ static void on_request_sent (GObject *object, GAsyncResult *result, gpointer user_data); static void -session_thread_process_pending_queue (ThreadClosure *thread_closure) +start_pending_request (ThreadClosure *thread_closure, + GTask *task) { - while (g_queue_peek_head (&thread_closure->pending_queue) != NULL && - g_hash_table_size (thread_closure->outstanding) < thread_closure->max_outstanding) - { - GTask *task; - OstreeFetcherPendingURI *pending; - GCancellable *cancellable; + OstreeFetcherPendingURI *pending; + GCancellable *cancellable; - task = g_queue_pop_head (&thread_closure->pending_queue); + g_assert_cmpint (g_hash_table_size (thread_closure->outstanding), <, thread_closure->max_outstanding); - pending = g_task_get_task_data (task); - cancellable = g_task_get_cancellable (task); + pending = g_task_get_task_data (task); + cancellable = g_task_get_cancellable (task); - g_hash_table_add (thread_closure->outstanding, pending_uri_ref (pending)); - - soup_request_send_async (pending->request, - cancellable, - on_request_sent, - g_object_ref (task)); - - g_object_unref (task); - } + g_hash_table_add (thread_closure->outstanding, pending_uri_ref (pending)); + soup_request_send_async (pending->request, + cancellable, + on_request_sent, + g_object_ref (task)); } static void @@ -547,10 +528,7 @@ session_thread_request_uri (ThreadClosure *thread_closure, pending->out_tmpfile = tmpfile; tmpfile = NULL; /* Transfer ownership */ - g_queue_insert_sorted (&thread_closure->pending_queue, - g_object_ref (task), - pending_task_compare, NULL); - session_thread_process_pending_queue (thread_closure); + start_pending_request (thread_closure, task); } } @@ -578,11 +556,11 @@ ostree_fetcher_session_thread (gpointer data) /* XXX: Now that we have mirrorlist support, we could make this even smarter * by spreading requests across mirrors. */ g_object_get (closure->session, "max-conns-per-host", &max_conns, NULL); - if (max_conns < 8) + if (max_conns < _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS) { /* We download a lot of small objects in ostree, so this * helps a lot. Also matches what most modern browsers do. */ - max_conns = 8; + max_conns = _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS; g_object_set (closure->session, "max-conns-per-host", max_conns, NULL); @@ -600,8 +578,6 @@ ostree_fetcher_session_thread (gpointer data) * unreference all data related to the SoupSession ourself to ensure * it's freed in the same thread where it was created. */ g_clear_pointer (&closure->outstanding, g_hash_table_unref); - while (!g_queue_is_empty (&closure->pending_queue)) - g_object_unref (g_queue_pop_head (&closure->pending_queue)); g_clear_pointer (&closure->session, g_object_unref); thread_closure_unref (closure); @@ -753,12 +729,13 @@ _ostree_fetcher_init (OstreeFetcher *self) OstreeFetcher * _ostree_fetcher_new (int tmpdir_dfd, + const char *remote_name, OstreeFetcherConfigFlags flags) { OstreeFetcher *self; self = g_object_new (OSTREE_TYPE_FETCHER, "config-flags", flags, NULL); - + self->thread_closure->remote_name = g_strdup (remote_name); self->thread_closure->base_tmpdir_dfd = tmpdir_dfd; return self; @@ -903,11 +880,6 @@ finish_stream (OstreeFetcherPendingURI *pending, pending->state = OSTREE_FETCHER_STATE_COMPLETE; - /* Now that we've finished downloading, continue with other queued - * requests. - */ - session_thread_process_pending_queue (pending->thread_closure); - if (!pending->is_membuf) { if (stbuf.st_size < pending->content_length) @@ -935,14 +907,13 @@ on_stream_read (GObject *object, gpointer user_data); static void -remove_pending_rerun_queue (OstreeFetcherPendingURI *pending) +remove_pending (OstreeFetcherPendingURI *pending) { /* Hold a temporary ref to ensure the reference to * pending->thread_closure is valid. */ pending_uri_ref (pending); g_hash_table_remove (pending->thread_closure->outstanding, pending); - session_thread_process_pending_queue (pending->thread_closure); pending_uri_unref (pending); } @@ -976,7 +947,7 @@ on_out_splice_complete (GObject *object, if (local_error) { g_task_return_error (task, local_error); - remove_pending_rerun_queue (pending); + remove_pending (pending); } g_object_unref (task); @@ -1018,7 +989,7 @@ on_stream_read (GObject *object, g_strdup (pending->out_tmpfile), (GDestroyNotify) g_free); } - remove_pending_rerun_queue (pending); + remove_pending (pending); } else { @@ -1057,7 +1028,7 @@ on_stream_read (GObject *object, if (local_error) { g_task_return_error (task, local_error); - remove_pending_rerun_queue (pending); + remove_pending (pending); } g_object_unref (task); @@ -1096,7 +1067,7 @@ on_request_sent (GObject *object, g_task_return_pointer (task, g_strdup (pending->out_tmpfile), (GDestroyNotify) g_free); - remove_pending_rerun_queue (pending); + remove_pending (pending); goto out; } else if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) @@ -1110,13 +1081,14 @@ on_request_sent (GObject *object, goto out; (void) g_input_stream_close (pending->request_body, NULL, NULL); - g_queue_insert_sorted (&pending->thread_closure->pending_queue, - g_object_ref (task), pending_task_compare, - NULL); - remove_pending_rerun_queue (pending); + + start_pending_request (pending->thread_closure, task); } else { + g_autofree char *uristring + = soup_uri_to_string (soup_request_get_uri (pending->request), FALSE); + GIOErrorEnum code; switch (msg->status_code) { @@ -1151,6 +1123,10 @@ on_request_sent (GObject *object, g_prefix_error (&local_error, "All %u mirrors failed. Last error was: ", pending->mirrorlist->len); + if (pending->thread_closure->remote_name) + _ostree_fetcher_journal_failure (pending->thread_closure->remote_name, + uristring, local_error->message); + } goto out; } @@ -1204,7 +1180,7 @@ on_request_sent (GObject *object, if (pending->request_body) (void) g_input_stream_close (pending->request_body, NULL, NULL); g_task_return_error (task, local_error); - remove_pending_rerun_queue (pending); + remove_pending (pending); } g_object_unref (task); @@ -1368,84 +1344,3 @@ _ostree_fetcher_bytes_transferred (OstreeFetcher *self) return ret; } - -void -_ostree_fetcher_uri_free (OstreeFetcherURI *uri) -{ - if (uri) - soup_uri_free ((SoupURI*)uri); -} - -OstreeFetcherURI * -_ostree_fetcher_uri_parse (const char *str, - GError **error) -{ - SoupURI *soupuri = soup_uri_new (str); - if (soupuri == NULL) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Failed to parse uri: %s", str); - return NULL; - } - return (OstreeFetcherURI*)soupuri; -} - -static OstreeFetcherURI * -_ostree_fetcher_uri_new_path_internal (OstreeFetcherURI *uri, - gboolean extend, - const char *path) -{ - SoupURI *newuri = soup_uri_copy ((SoupURI*)uri); - if (path) - { - if (extend) - { - const char *origpath = soup_uri_get_path ((SoupURI*)uri); - g_autofree char *newpath = g_build_filename (origpath, path, NULL); - soup_uri_set_path (newuri, newpath); - } - else - { - soup_uri_set_path (newuri, path); - } - } - return (OstreeFetcherURI*)newuri; -} - -OstreeFetcherURI * -_ostree_fetcher_uri_new_path (OstreeFetcherURI *uri, - const char *path) -{ - return _ostree_fetcher_uri_new_path_internal (uri, FALSE, path); -} - -OstreeFetcherURI * -_ostree_fetcher_uri_new_subpath (OstreeFetcherURI *uri, - const char *subpath) -{ - return _ostree_fetcher_uri_new_path_internal (uri, TRUE, subpath); -} - -OstreeFetcherURI * -_ostree_fetcher_uri_clone (OstreeFetcherURI *uri) -{ - return _ostree_fetcher_uri_new_subpath (uri, NULL); -} - -char * -_ostree_fetcher_uri_get_scheme (OstreeFetcherURI *uri) -{ - return g_strdup (soup_uri_get_scheme ((SoupURI*)uri)); -} - -char * -_ostree_fetcher_uri_get_path (OstreeFetcherURI *uri) -{ - return g_strdup (soup_uri_get_path ((SoupURI*)uri)); -} - -char * -_ostree_fetcher_uri_to_string (OstreeFetcherURI *uri) -{ - return soup_uri_to_string ((SoupURI*)uri, FALSE); -} diff --git a/src/libostree/ostree-fetcher-uri.c b/src/libostree/ostree-fetcher-uri.c new file mode 100644 index 00000000..7ef42eca --- /dev/null +++ b/src/libostree/ostree-fetcher-uri.c @@ -0,0 +1,118 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2011,2017 Colin Walters + * + * 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. + * + * Author: Colin Walters + */ + +#include "config.h" + + +#ifdef HAVE_LIBCURL +#include "ostree-soup-uri.h" +#else +#define LIBSOUP_USE_UNSTABLE_REQUEST_API +#include +#include +#include +#endif + +#include "ostree-fetcher.h" + +#include "libglnx.h" + +void +_ostree_fetcher_uri_free (OstreeFetcherURI *uri) +{ + if (uri) + soup_uri_free ((SoupURI*)uri); +} + +OstreeFetcherURI * +_ostree_fetcher_uri_parse (const char *str, + GError **error) +{ + SoupURI *soupuri = soup_uri_new (str); + if (soupuri == NULL) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Failed to parse uri: %s", str); + return NULL; + } + return (OstreeFetcherURI*)soupuri; +} + +static OstreeFetcherURI * +_ostree_fetcher_uri_new_path_internal (OstreeFetcherURI *uri, + gboolean extend, + const char *path) +{ + SoupURI *newuri = soup_uri_copy ((SoupURI*)uri); + if (path) + { + if (extend) + { + const char *origpath = soup_uri_get_path ((SoupURI*)uri); + g_autofree char *newpath = g_build_filename (origpath, path, NULL); + soup_uri_set_path (newuri, newpath); + } + else + { + soup_uri_set_path (newuri, path); + } + } + return (OstreeFetcherURI*)newuri; +} + +OstreeFetcherURI * +_ostree_fetcher_uri_new_path (OstreeFetcherURI *uri, + const char *path) +{ + return _ostree_fetcher_uri_new_path_internal (uri, FALSE, path); +} + +OstreeFetcherURI * +_ostree_fetcher_uri_new_subpath (OstreeFetcherURI *uri, + const char *subpath) +{ + return _ostree_fetcher_uri_new_path_internal (uri, TRUE, subpath); +} + +OstreeFetcherURI * +_ostree_fetcher_uri_clone (OstreeFetcherURI *uri) +{ + return _ostree_fetcher_uri_new_subpath (uri, NULL); +} + +char * +_ostree_fetcher_uri_get_scheme (OstreeFetcherURI *uri) +{ + return g_strdup (soup_uri_get_scheme ((SoupURI*)uri)); +} + +char * +_ostree_fetcher_uri_get_path (OstreeFetcherURI *uri) +{ + return g_strdup (soup_uri_get_path ((SoupURI*)uri)); +} + +char * +_ostree_fetcher_uri_to_string (OstreeFetcherURI *uri) +{ + return soup_uri_to_string ((SoupURI*)uri, FALSE); +} diff --git a/src/libostree/ostree-fetcher-util.c b/src/libostree/ostree-fetcher-util.c index b8af972a..408b8bcb 100644 --- a/src/libostree/ostree-fetcher-util.c +++ b/src/libostree/ostree-fetcher-util.c @@ -23,6 +23,10 @@ #include #include +#ifdef HAVE_LIBSYSTEMD +#include +#endif + #include "ostree-fetcher-util.h" #include "otutil.h" @@ -122,3 +126,23 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher, out_contents, max_size, cancellable, error); } + +#define OSTREE_HTTP_FAILURE_ID SD_ID128_MAKE(f0,2b,ce,89,a5,4e,4e,fa,b3,a9,4a,79,7d,26,20,4a) + +void +_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", + 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, + NULL); +#endif +} diff --git a/src/libostree/ostree-fetcher-util.h b/src/libostree/ostree-fetcher-util.h index 0f25dc30..fe0921cd 100644 --- a/src/libostree/ostree-fetcher-util.h +++ b/src/libostree/ostree-fetcher-util.h @@ -44,6 +44,12 @@ gboolean _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher, guint64 max_size, GCancellable *cancellable, GError **error); + +void _ostree_fetcher_journal_failure (const char *remote_name, + const char *url, + const char *msg); + + G_END_DECLS #endif diff --git a/src/libostree/ostree-fetcher.h b/src/libostree/ostree-fetcher.h index f19eb73b..78b29fae 100644 --- a/src/libostree/ostree-fetcher.h +++ b/src/libostree/ostree-fetcher.h @@ -82,6 +82,7 @@ _ostree_fetcher_uri_to_string (OstreeFetcherURI *uri); GType _ostree_fetcher_get_type (void) G_GNUC_CONST; OstreeFetcher *_ostree_fetcher_new (int tmpdir_dfd, + const char *remote_name, OstreeFetcherConfigFlags flags); int _ostree_fetcher_get_dfd (OstreeFetcher *fetcher); diff --git a/src/libostree/ostree-libarchive-private.h b/src/libostree/ostree-libarchive-private.h index 177c6568..865a4b8d 100644 --- a/src/libostree/ostree-libarchive-private.h +++ b/src/libostree/ostree-libarchive-private.h @@ -37,6 +37,9 @@ GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_write_archive, archive_ GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_read_archive, archive_read_free) #define ot_cleanup_read_archive __attribute__((cleanup (flatpak_local_free_read_archive))) +#else +#define ot_cleanup_write_archive +#define ot_cleanup_read_archive #endif G_END_DECLS diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c index 9a151646..7ae7cd55 100644 --- a/src/libostree/ostree-repo-checkout.c +++ b/src/libostree/ostree-repo-checkout.c @@ -201,8 +201,16 @@ checkout_file_from_input_at (OstreeRepo *self, while (G_UNLIKELY (res == -1 && errno == EINTR)); if (res == -1) { - glnx_set_error_from_errno (error); - goto out; + if (errno == EEXIST && options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES) + { + ret = TRUE; + goto out; + } + else + { + glnx_set_error_from_errno (error); + goto out; + } } if (options->mode != OSTREE_REPO_CHECKOUT_MODE_USER) @@ -240,6 +248,11 @@ checkout_file_from_input_at (OstreeRepo *self, while (G_UNLIKELY (fd == -1 && errno == EINTR)); if (fd == -1) { + if (errno == EEXIST && options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES) + { + ret = TRUE; + goto out; + } glnx_set_error_from_errno (error); goto out; } @@ -332,6 +345,12 @@ checkout_file_unioning_from_input_at (OstreeRepo *repo, return ret; } +typedef enum { + HARDLINK_RESULT_NOT_SUPPORTED, + HARDLINK_RESULT_SKIP_EXISTED, + HARDLINK_RESULT_LINKED +} HardlinkResult; + static gboolean checkout_file_hardlink (OstreeRepo *self, OstreeRepoCheckoutAtOptions *options, @@ -339,28 +358,32 @@ checkout_file_hardlink (OstreeRepo *self, int destination_dfd, const char *destination_name, gboolean allow_noent, - gboolean *out_was_supported, + HardlinkResult *out_result, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - gboolean ret_was_supported = FALSE; + HardlinkResult ret_result = HARDLINK_RESULT_NOT_SUPPORTED; int srcfd = (self->mode == OSTREE_REPO_MODE_BARE || self->mode == OSTREE_REPO_MODE_BARE_USER) ? self->objects_dir_fd : self->uncompressed_objects_dir_fd; again: - if (linkat (srcfd, loose_path, destination_dfd, destination_name, 0) != -1) - ret_was_supported = TRUE; + if (linkat (srcfd, loose_path, destination_dfd, destination_name, 0) == 0) + ret_result = HARDLINK_RESULT_LINKED; else if (!options->no_copy_fallback && (errno == EMLINK || errno == EXDEV || errno == EPERM)) { /* EMLINK, EXDEV and EPERM shouldn't be fatal; we just can't do the * optimization of hardlinking instead of copying. */ - ret_was_supported = FALSE; } else if (allow_noent && errno == ENOENT) { - ret_was_supported = FALSE; + } + else if (errno == EEXIST && options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES) + { + /* In this mode, we keep existing content. Distinguish this case though to + * avoid inserting into the devino cache. + */ + ret_result = HARDLINK_RESULT_SKIP_EXISTED; } else if (errno == EEXIST && options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES) { @@ -370,7 +393,7 @@ checkout_file_hardlink (OstreeRepo *self, * the same file, then rename() does nothing, and returns a * success status." * - * So we can't make this atomic. + * So we can't make this atomic. */ (void) unlinkat (destination_dfd, destination_name, 0); goto again; @@ -379,14 +402,12 @@ checkout_file_hardlink (OstreeRepo *self, { g_prefix_error (error, "Hardlinking %s to %s: ", loose_path, destination_name); glnx_set_error_from_errno (error); - goto out; + return FALSE; } - ret = TRUE; - if (out_was_supported) - *out_was_supported = ret_was_supported; - out: - return ret; + if (out_result) + *out_result = ret_result; + return TRUE; } static gboolean @@ -439,7 +460,7 @@ checkout_one_file_at (OstreeRepo *repo, } else { - gboolean did_hardlink = FALSE; + HardlinkResult hardlink_res = HARDLINK_RESULT_NOT_SUPPORTED; /* Try to do a hardlink first, if it's a regular file. This also * traverses all parent repos. */ @@ -469,11 +490,11 @@ checkout_one_file_at (OstreeRepo *repo, options, loose_path_buf, destination_dfd, destination_name, - TRUE, &did_hardlink, + TRUE, &hardlink_res, cancellable, error)) goto out; - if (did_hardlink && options->devino_to_csum_cache) + if (hardlink_res == HARDLINK_RESULT_LINKED && options->devino_to_csum_cache) { struct stat stbuf; OstreeDevIno *key; @@ -492,13 +513,13 @@ checkout_one_file_at (OstreeRepo *repo, g_hash_table_add ((GHashTable*)options->devino_to_csum_cache, key); } - if (did_hardlink) + if (hardlink_res != HARDLINK_RESULT_NOT_SUPPORTED) break; } current_repo = current_repo->parent_repo; } - need_copy = !did_hardlink; + need_copy = (hardlink_res == HARDLINK_RESULT_NOT_SUPPORTED); } can_cache = (options->enable_uncompressed_cache @@ -514,7 +535,7 @@ checkout_one_file_at (OstreeRepo *repo, && repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2 && options->mode == OSTREE_REPO_CHECKOUT_MODE_USER) { - gboolean did_hardlink; + HardlinkResult hardlink_res = HARDLINK_RESULT_NOT_SUPPORTED; if (!ostree_repo_load_file (repo, checksum, &input, NULL, NULL, cancellable, error)) @@ -560,19 +581,20 @@ checkout_one_file_at (OstreeRepo *repo, if (!checkout_file_hardlink (repo, options, loose_path_buf, destination_dfd, destination_name, - FALSE, &did_hardlink, + FALSE, &hardlink_res, cancellable, error)) { g_prefix_error (error, "Using new cached uncompressed hardlink of %s to %s: ", checksum, destination_name); goto out; } - need_copy = !did_hardlink; + need_copy = (hardlink_res == HARDLINK_RESULT_NOT_SUPPORTED); } /* Fall back to copy if we couldn't hardlink */ if (need_copy) { + g_assert (!options->no_copy_fallback); if (!ostree_repo_load_file (repo, checksum, &input, NULL, &xattrs, cancellable, error)) goto out; @@ -641,6 +663,8 @@ checkout_tree_at (OstreeRepo *self, gboolean did_exist = FALSE; glnx_fd_close int destination_dfd = -1; int res; + struct stat repo_dfd_stat; + struct stat destination_stat; g_autoptr(GVariant) xattrs = NULL; g_autoptr(GFileEnumerator) dir_enum = NULL; @@ -653,7 +677,9 @@ checkout_tree_at (OstreeRepo *self, while (G_UNLIKELY (res == -1 && errno == EINTR)); if (res == -1) { - if (errno == EEXIST && options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES) + if (errno == EEXIST && + (options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES + || options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES)) did_exist = TRUE; else { @@ -666,6 +692,25 @@ checkout_tree_at (OstreeRepo *self, &destination_dfd, error)) goto out; + if (fstat (self->repo_dir_fd, &repo_dfd_stat) < 0) + { + glnx_set_error_from_errno (error); + goto out; + } + if (fstat (destination_dfd, &destination_stat) < 0) + { + glnx_set_error_from_errno (error); + goto out; + } + + if (options->no_copy_fallback && repo_dfd_stat.st_dev != destination_stat.st_dev) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Unable to do hardlink checkout across devices (src=%"G_GUINT64_FORMAT" destination=%"G_GUINT64_FORMAT")", + (guint64)repo_dfd_stat.st_dev, (guint64)destination_stat.st_dev); + goto out; + } + /* Set the xattrs now, so any derived labeling works */ if (!did_exist && options->mode != OSTREE_REPO_CHECKOUT_MODE_USER) { @@ -902,10 +947,6 @@ ostree_repo_checkout_at (OstreeRepo *self, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - g_autoptr(GFile) commit_root = NULL; - g_autoptr(GFile) target_dir = NULL; - g_autoptr(GFileInfo) target_info = NULL; OstreeRepoCheckoutAtOptions default_options = { 0, }; if (!options) @@ -914,33 +955,33 @@ ostree_repo_checkout_at (OstreeRepo *self, options = &default_options; } - commit_root = (GFile*) _ostree_repo_file_new_for_commit (self, commit, error); + g_autoptr(GFile) commit_root = (GFile*) _ostree_repo_file_new_for_commit (self, commit, error); if (!commit_root) - goto out; + return FALSE; if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)commit_root, error)) - goto out; + return FALSE; + g_autoptr(GFile) target_dir = NULL; if (options->subpath && strcmp (options->subpath, "/") != 0) target_dir = g_file_get_child (commit_root, options->subpath); else target_dir = g_object_ref (commit_root); - target_info = g_file_query_info (target_dir, OSTREE_GIO_FAST_QUERYINFO, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, - cancellable, error); + g_autoptr(GFileInfo) target_info = + g_file_query_info (target_dir, OSTREE_GIO_FAST_QUERYINFO, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + cancellable, error); if (!target_info) - goto out; + return FALSE; if (!checkout_tree_at (self, options, destination_dfd, destination_path, (OstreeRepoFile*)target_dir, target_info, cancellable, error)) - goto out; + return FALSE; - ret = TRUE; - out: - return ret; + return TRUE; } static guint @@ -994,16 +1035,15 @@ ostree_repo_checkout_gc (OstreeRepo *self, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; g_autoptr(GHashTable) to_clean_dirs = NULL; - GHashTableIter iter; - gpointer key, value; g_mutex_lock (&self->cache_lock); to_clean_dirs = self->updated_uncompressed_dirs; self->updated_uncompressed_dirs = g_hash_table_new (NULL, NULL); g_mutex_unlock (&self->cache_lock); + GHashTableIter iter; + gpointer key, value; if (to_clean_dirs) g_hash_table_iter_init (&iter, to_clean_dirs); while (to_clean_dirs && g_hash_table_iter_next (&iter, &key, &value)) @@ -1013,7 +1053,7 @@ ostree_repo_checkout_gc (OstreeRepo *self, if (!glnx_dirfd_iterator_init_at (self->uncompressed_objects_dir_fd, objdir_name, FALSE, &dfd_iter, error)) - goto out; + return FALSE; while (TRUE) { @@ -1021,14 +1061,14 @@ ostree_repo_checkout_gc (OstreeRepo *self, struct stat stbuf; if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) - goto out; + return FALSE; if (dent == NULL) break; if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0) { glnx_set_error_from_errno (error); - goto out; + return FALSE; } if (stbuf.st_nlink == 1) @@ -1036,13 +1076,11 @@ ostree_repo_checkout_gc (OstreeRepo *self, if (unlinkat (dfd_iter.fd, dent->d_name, 0) != 0) { glnx_set_error_from_errno (error); - goto out; + return FALSE; } } } } - ret = TRUE; - out: - return ret; + return TRUE; } diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index eb9733e8..f6129ca6 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -110,6 +110,30 @@ write_file_metadata_to_xattr (int fd, return TRUE; } +/* See https://github.com/ostreedev/ostree/pull/698 */ +#ifdef WITH_SMACK +#define XATTR_NAME_SMACK "security.SMACK64" +#endif + +static void +ot_security_smack_reset_dfd_name (int dfd, const char *name) +{ +#ifdef WITH_SMACK + char buf[PATH_MAX]; + /* See glnx-xattrs.c */ + snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", dfd, name); + (void) lremovexattr (buf, XATTR_NAME_SMACK); +#endif +} + +static void +ot_security_smack_reset_fd (int fd) +{ +#ifdef WITH_SMACK + (void) fremovexattr (fd, XATTR_NAME_SMACK); +#endif +} + gboolean _ostree_repo_commit_loose_final (OstreeRepo *self, const char *checksum, @@ -221,6 +245,7 @@ commit_loose_object_trusted (OstreeRepo *self, if (xattrs != NULL) { + ot_security_smack_reset_dfd_name (self->tmp_dir_fd, temp_filename); if (!glnx_dfd_name_set_all_xattrs (self->tmp_dir_fd, temp_filename, xattrs, cancellable, error)) goto out; @@ -252,6 +277,7 @@ commit_loose_object_trusted (OstreeRepo *self, if (xattrs) { + ot_security_smack_reset_fd (fd); if (!glnx_fd_set_all_xattrs (fd, xattrs, cancellable, error)) goto out; } @@ -719,7 +745,7 @@ write_object (OstreeRepo *self, if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR) { - zlib_compressor = (GConverter*)g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, 9); + zlib_compressor = (GConverter*)g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, self->zlib_compression_level); compressed_out_stream = g_converter_output_stream_new (temp_out, zlib_compressor); /* Don't close the base; we'll do that later */ g_filter_output_stream_set_close_base_stream ((GFilterOutputStream*)compressed_out_stream, FALSE); diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h index a4e59e44..f1e00f27 100644 --- a/src/libostree/ostree-repo-private.h +++ b/src/libostree/ostree-repo-private.h @@ -32,6 +32,17 @@ G_BEGIN_DECLS #define _OSTREE_SUMMARY_CACHE_DIR "summaries" #define _OSTREE_CACHE_DIR "cache" +#define _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS 8 +#define _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS 2 + +/* In most cases, writing to disk should be much faster than + * fetching from the network, so we shouldn't actually hit + * this. But if using pipelining and e.g. pulling over LAN + * (or writing to slow media), we can have a runaway + * situation towards EMFILE. + * */ +#define _OSTREE_MAX_OUTSTANDING_WRITE_REQUESTS 16 + typedef enum { OSTREE_REPO_TEST_ERROR_PRE_COMMIT = (1 << 0) } OstreeRepoTestErrorFlags; @@ -89,6 +100,7 @@ struct OstreeRepo { GError *writable_error; gboolean in_transaction; gboolean disable_fsync; + guint zlib_compression_level; GHashTable *loose_object_devino_hash; GHashTable *updated_uncompressed_dirs; GHashTable *object_sizes; diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 45995a30..5ee43918 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -26,7 +26,7 @@ #include "ostree.h" #include "otutil.h" -#ifdef HAVE_LIBSOUP +#ifdef HAVE_LIBCURL_OR_LIBSOUP #include "ostree-core-private.h" #include "ostree-repo-private.h" @@ -81,6 +81,10 @@ typedef struct { GHashTable *scanned_metadata; /* Maps object name to itself */ GHashTable *requested_metadata; /* Maps object name to itself */ GHashTable *requested_content; /* Maps checksum to itself */ + GHashTable *requested_fallback_content; /* Maps checksum to itself */ + GHashTable *pending_fetch_metadata; /* Map */ + GHashTable *pending_fetch_content; /* Map */ + GHashTable *pending_fetch_deltaparts; /* Set */ guint n_outstanding_metadata_fetches; guint n_outstanding_metadata_write_requests; guint n_outstanding_content_fetches; @@ -88,11 +92,14 @@ typedef struct { guint n_outstanding_deltapart_fetches; guint n_outstanding_deltapart_write_requests; guint n_total_deltaparts; + guint n_total_delta_fallbacks; + guint64 fetched_deltapart_size; /* How much of the delta we have now */ guint64 total_deltapart_size; guint64 total_deltapart_usize; gint n_requested_metadata; gint n_requested_content; guint n_fetched_deltaparts; + guint n_fetched_deltapart_fallbacks; guint n_fetched_metadata; guint n_fetched_content; @@ -133,6 +140,10 @@ typedef struct { OtPullData *pull_data; GVariant *objects; char *expected_checksum; + char *from_revision; + char *to_revision; + guint i; + guint64 size; } FetchStaticDeltaData; typedef struct { @@ -142,6 +153,10 @@ typedef struct { guint recursion_depth; } ScanObjectQueueData; +static void start_fetch (OtPullData *pull_data, FetchObjectData *fetch); +static void start_fetch_deltapart (OtPullData *pull_data, + FetchStaticDeltaData *fetch); +static gboolean fetcher_queue_is_full (OtPullData *pull_data); static void queue_scan_one_metadata_object (OtPullData *pull_data, const char *csum, OstreeObjectType objtype, @@ -199,6 +214,7 @@ update_progress (gpointer user_data) ostree_async_progress_set_uint (pull_data->progress, "outstanding-writes", outstanding_writes); ostree_async_progress_set_uint (pull_data->progress, "fetched", fetched); ostree_async_progress_set_uint (pull_data->progress, "requested", requested); + ostree_async_progress_set_uint (pull_data->progress, "scanning", g_queue_is_empty (&pull_data->scan_object_queue) ? 0 : 1); ostree_async_progress_set_uint (pull_data->progress, "scanned-metadata", n_scanned_metadata); ostree_async_progress_set_uint64 (pull_data->progress, "bytes-transferred", bytes_transferred); ostree_async_progress_set_uint64 (pull_data->progress, "start-time", start_time); @@ -208,6 +224,12 @@ update_progress (gpointer user_data) pull_data->n_fetched_deltaparts); ostree_async_progress_set_uint (pull_data->progress, "total-delta-parts", pull_data->n_total_deltaparts); + ostree_async_progress_set_uint (pull_data->progress, "fetched-delta-fallbacks", + pull_data->n_fetched_deltapart_fallbacks); + ostree_async_progress_set_uint (pull_data->progress, "total-delta-fallbacks", + pull_data->n_total_delta_fallbacks); + ostree_async_progress_set_uint64 (pull_data->progress, "fetched-delta-part-size", + pull_data->fetched_deltapart_size); ostree_async_progress_set_uint64 (pull_data->progress, "total-delta-part-size", pull_data->total_deltapart_size); ostree_async_progress_set_uint64 (pull_data->progress, "total-delta-part-usize", @@ -271,6 +293,88 @@ check_outstanding_requests_handle_error (OtPullData *pull_data, g_error_free (error); } } + else + { + GHashTableIter hiter; + gpointer key, value; + + /* We may have just completed an async fetch operation. Now we look at + * possibly enqueuing more requests. The goal of queuing is to both avoid + * overloading the fetcher backend with HTTP requests, but also to + * prioritize metadata fetches over content, so we have accurate + * reporting. Hence here, we process metadata fetches first. + */ + + /* Try filling the queue with metadata we need to fetch */ + g_hash_table_iter_init (&hiter, pull_data->pending_fetch_metadata); + while (!fetcher_queue_is_full (pull_data) && + g_hash_table_iter_next (&hiter, &key, &value)) + { + GVariant *objname = key; + FetchObjectData *fetch = value; + + /* Steal both key and value */ + g_hash_table_iter_steal (&hiter); + + /* This takes ownership of the value */ + start_fetch (pull_data, fetch); + /* And unref the key */ + g_variant_unref (objname); + } + + /* Now, process deltapart requests */ + g_hash_table_iter_init (&hiter, pull_data->pending_fetch_deltaparts); + while (!fetcher_queue_is_full (pull_data) && + g_hash_table_iter_next (&hiter, &key, &value)) + { + FetchStaticDeltaData *fetch = key; + g_hash_table_iter_steal (&hiter); + /* Takes ownership */ + start_fetch_deltapart (pull_data, fetch); + } + + /* Next, fill the queue with content */ + g_hash_table_iter_init (&hiter, pull_data->pending_fetch_content); + while (!fetcher_queue_is_full (pull_data) && + g_hash_table_iter_next (&hiter, &key, &value)) + { + char *checksum = key; + FetchObjectData *fetch = value; + + /* Steal both key and value */ + g_hash_table_iter_steal (&hiter); + + /* This takes ownership of the value */ + start_fetch (pull_data, fetch); + /* And unref the key */ + g_free (checksum); + } + + } +} + +/* We have a total-request limit, as well has a hardcoded max of 2 for delta + * parts. The logic for the delta one is that processing them is expensive, and + * doing multiple simultaneously could risk space/memory on smaller devices. We + * also throttle on outstanding writes in case fetches are faster. + */ +static gboolean +fetcher_queue_is_full (OtPullData *pull_data) +{ + const gboolean fetch_full = + ((pull_data->n_outstanding_metadata_fetches + + pull_data->n_outstanding_content_fetches + + pull_data->n_outstanding_deltapart_fetches) == + _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS); + const gboolean deltas_full = + (pull_data->n_outstanding_deltapart_fetches == + _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS); + const gboolean writes_full = + ((pull_data->n_outstanding_metadata_write_requests + + pull_data->n_outstanding_content_write_requests + + pull_data->n_outstanding_deltapart_write_requests) >= + _OSTREE_MAX_OUTSTANDING_WRITE_REQUESTS); + return fetch_full || deltas_full || writes_full; } static gboolean @@ -685,6 +789,9 @@ content_fetch_on_write_complete (GObject *object, } pull_data->n_fetched_content++; + /* Was this a delta fallback? */ + if (g_hash_table_remove (pull_data->requested_fallback_content, expected_checksum)) + pull_data->n_fetched_deltapart_fallbacks++; out: pull_data->n_outstanding_content_write_requests--; check_outstanding_requests_handle_error (pull_data, local_error); @@ -942,6 +1049,8 @@ fetch_static_delta_data_free (gpointer data) FetchStaticDeltaData *fetch_data = data; g_free (fetch_data->expected_checksum); g_variant_unref (fetch_data->objects); + g_free (fetch_data->from_revision); + g_free (fetch_data->to_revision); g_free (fetch_data); } @@ -1035,14 +1144,22 @@ process_verify_result (OtPullData *pull_data, GError **error) { if (result == NULL) - return FALSE; + { + g_prefix_error (error, "Commit %s: ", checksum); + return FALSE; + } /* Allow callers to output the results immediately. */ g_signal_emit_by_name (pull_data->repo, "gpg-verify-result", checksum, result); - return ostree_gpg_verify_result_require_valid_signature (result, error); + if (!ostree_gpg_verify_result_require_valid_signature (result, error)) + { + g_prefix_error (error, "Commit %s: ", checksum); + return FALSE; + } + return TRUE; } static gboolean @@ -1060,8 +1177,9 @@ gpg_verify_unwritten_commit (OtPullData *pull_data, if (!detached_metadata) { - g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "No detached metadata found for GPG verification"); + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Commit %s: no detached metadata found for GPG verification", + checksum); return FALSE; } @@ -1334,41 +1452,11 @@ enqueue_one_object_request (OtPullData *pull_data, gboolean is_detached_meta, gboolean object_is_stored) { - g_autofree char *obj_subpath = NULL; gboolean is_meta; FetchObjectData *fetch_data; - guint64 *expected_max_size_p; - guint64 expected_max_size; - GPtrArray *mirrorlist = NULL; - - g_debug ("queuing fetch of %s.%s%s", checksum, - ostree_object_type_to_string (objtype), - is_detached_meta ? " (detached)" : ""); - - if (is_detached_meta) - { - char buf[_OSTREE_LOOSE_PATH_MAX]; - _ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, pull_data->remote_mode); - obj_subpath = g_build_filename ("objects", buf, NULL); - mirrorlist = pull_data->meta_mirrorlist; - } - else - { - obj_subpath = _ostree_get_relative_object_path (checksum, objtype, TRUE); - mirrorlist = pull_data->content_mirrorlist; - } is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype); - if (is_meta) - { - pull_data->n_outstanding_metadata_fetches++; - pull_data->n_requested_metadata++; - } - else - { - pull_data->n_outstanding_content_fetches++; - pull_data->n_requested_content++; - } + fetch_data = g_new0 (FetchObjectData, 1); fetch_data->pull_data = pull_data; fetch_data->object = ostree_object_name_serialize (checksum, objtype); @@ -1376,10 +1464,80 @@ enqueue_one_object_request (OtPullData *pull_data, fetch_data->is_detached_meta = is_detached_meta; fetch_data->object_is_stored = object_is_stored; - expected_max_size_p = is_detached_meta ? NULL : g_hash_table_lookup (pull_data->expected_commit_sizes, checksum); + if (is_meta) + pull_data->n_requested_metadata++; + else + pull_data->n_requested_content++; + + /* Are too many requests are in flight? */ + if (fetcher_queue_is_full (pull_data)) + { + g_debug ("queuing fetch of %s.%s%s", checksum, + ostree_object_type_to_string (objtype), + is_detached_meta ? " (detached)" : ""); + + if (is_meta) + { + GVariant *objname = ostree_object_name_serialize (checksum, objtype); + g_hash_table_insert (pull_data->pending_fetch_metadata, objname, fetch_data); + } + else + { + g_hash_table_insert (pull_data->pending_fetch_content, g_strdup (checksum), fetch_data); + } + } + else + { + start_fetch (pull_data, fetch_data); + } +} + +static void +start_fetch (OtPullData *pull_data, + FetchObjectData *fetch) +{ + gboolean is_meta; + g_autofree char *obj_subpath = NULL; + guint64 *expected_max_size_p; + guint64 expected_max_size; + const char *expected_checksum; + OstreeObjectType objtype; + GPtrArray *mirrorlist = NULL; + + ostree_object_name_deserialize (fetch->object, &expected_checksum, &objtype); + is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype); + + g_debug ("starting fetch of %s.%s%s", expected_checksum, + ostree_object_type_to_string (objtype), + fetch->is_detached_meta ? " (detached)" : ""); + + is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype); + if (is_meta) + pull_data->n_outstanding_metadata_fetches++; + else + pull_data->n_outstanding_content_fetches++; + + /* Override the path if we're trying to fetch the .commitmeta file first */ + if (fetch->is_detached_meta) + { + char buf[_OSTREE_LOOSE_PATH_MAX]; + _ostree_loose_path (buf, expected_checksum, OSTREE_OBJECT_TYPE_COMMIT_META, pull_data->remote_mode); + obj_subpath = g_build_filename ("objects", buf, NULL); + mirrorlist = pull_data->meta_mirrorlist; + } + else + { + obj_subpath = _ostree_get_relative_object_path (expected_checksum, objtype, TRUE); + mirrorlist = pull_data->content_mirrorlist; + } + + /* We may have determined maximum sizes from the summary file content; if so, + * honor it. Otherwise, metadata has a baseline max size. + */ + expected_max_size_p = fetch->is_detached_meta ? NULL : g_hash_table_lookup (pull_data->expected_commit_sizes, expected_checksum); if (expected_max_size_p) expected_max_size = *expected_max_size_p; - else if (is_meta) + else if (OSTREE_OBJECT_TYPE_IS_META (objtype)) expected_max_size = OSTREE_MAX_METADATA_SIZE; else expected_max_size = 0; @@ -1389,7 +1547,7 @@ enqueue_one_object_request (OtPullData *pull_data, is_meta ? OSTREE_REPO_PULL_METADATA_PRIORITY : OSTREE_REPO_PULL_CONTENT_PRIORITY, pull_data->cancellable, - is_meta ? meta_fetch_on_complete : content_fetch_on_complete, fetch_data); + is_meta ? meta_fetch_on_complete : content_fetch_on_complete, fetch); } static gboolean @@ -1445,15 +1603,10 @@ process_one_static_delta_fallback (OtPullData *pull_data, compressed_size = maybe_swap_endian_u64 (delta_byteswap, compressed_size); uncompressed_size = maybe_swap_endian_u64 (delta_byteswap, uncompressed_size); + pull_data->n_total_delta_fallbacks += 1; pull_data->total_deltapart_size += compressed_size; pull_data->total_deltapart_usize += uncompressed_size; - if (pull_data->dry_run) - { - ret = TRUE; - goto out; - } - objtype = (OstreeObjectType)objtype_y; checksum = ostree_checksum_from_bytes_v (csum_v); @@ -1462,28 +1615,37 @@ process_one_static_delta_fallback (OtPullData *pull_data, cancellable, error)) goto out; + if (is_stored) + pull_data->fetched_deltapart_size += compressed_size; + + if (pull_data->dry_run) + { + ret = TRUE; + goto out; + } + if (!is_stored) - { + { + /* The delta compiler never did this, there's no reason to support it */ if (OSTREE_OBJECT_TYPE_IS_META (objtype)) { - g_autoptr(GVariant) objname = ostree_object_name_serialize (checksum, objtype); - if (!g_hash_table_lookup (pull_data->requested_metadata, objname)) - { - gboolean do_fetch_detached; - g_hash_table_add (pull_data->requested_metadata, g_variant_ref (objname)); - - do_fetch_detached = (objtype == OSTREE_OBJECT_TYPE_COMMIT); - enqueue_one_object_request (pull_data, checksum, objtype, NULL, do_fetch_detached, FALSE); - checksum = NULL; /* Transfer ownership */ - } + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Found metadata object as fallback: %s.%s", checksum, + ostree_object_type_to_string (objtype)); + goto out; } else { if (!g_hash_table_lookup (pull_data->requested_content, checksum)) { + /* Mark this as requested, like we do in the non-delta path */ g_hash_table_add (pull_data->requested_content, checksum); + /* But also record it's a delta fallback object, so we can account + * for it as logically part of the delta fetch. + */ + g_hash_table_add (pull_data->requested_fallback_content, g_strdup (checksum)); enqueue_one_object_request (pull_data, checksum, OSTREE_OBJECT_TYPE_FILE, NULL, FALSE, FALSE); - checksum = NULL; /* Transfer ownership */ + checksum = NULL; /* We transferred ownership to the requested_content hash */ } } } @@ -1493,6 +1655,22 @@ process_one_static_delta_fallback (OtPullData *pull_data, return ret; } +static void +start_fetch_deltapart (OtPullData *pull_data, + FetchStaticDeltaData *fetch) +{ + g_autofree char *deltapart_path = _ostree_get_relative_static_delta_part_path (fetch->from_revision, fetch->to_revision, fetch->i); + pull_data->n_outstanding_deltapart_fetches++; + g_assert_cmpint (pull_data->n_outstanding_deltapart_fetches, <=, _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS); + _ostree_fetcher_request_to_tmpfile (pull_data->fetcher, + pull_data->content_mirrorlist, + deltapart_path, fetch->size, + OSTREE_FETCHER_DEFAULT_PRIORITY, + pull_data->cancellable, + static_deltapart_fetch_on_complete, + fetch); +} + static gboolean process_one_static_delta (OtPullData *pull_data, const char *from_revision, @@ -1618,11 +1796,15 @@ process_one_static_delta (OtPullData *pull_data, cancellable, error)) goto out; + pull_data->total_deltapart_size += size; + pull_data->total_deltapart_usize += usize; + if (have_all) { g_debug ("Have all objects from static delta %s-%s part %u", from_revision ? from_revision : "empty", to_revision, i); + pull_data->fetched_deltapart_size += size; pull_data->n_fetched_deltaparts++; continue; } @@ -1636,16 +1818,17 @@ process_one_static_delta (OtPullData *pull_data, inline_part_bytes = g_variant_get_data_as_bytes (part_datav); } - pull_data->total_deltapart_size += size; - pull_data->total_deltapart_usize += usize; - if (pull_data->dry_run) continue; fetch_data = g_new0 (FetchStaticDeltaData, 1); + fetch_data->from_revision = g_strdup (from_revision); + fetch_data->to_revision = g_strdup (to_revision); fetch_data->pull_data = pull_data; fetch_data->objects = g_variant_ref (objects); fetch_data->expected_checksum = ostree_checksum_from_bytes_v (csum_v); + fetch_data->size = size; + fetch_data->i = i; if (inline_part_bytes != NULL) { @@ -1669,14 +1852,12 @@ process_one_static_delta (OtPullData *pull_data, } else { - _ostree_fetcher_request_to_tmpfile (pull_data->fetcher, - pull_data->content_mirrorlist, - deltapart_path, size, - OSTREE_FETCHER_DEFAULT_PRIORITY, - pull_data->cancellable, - static_deltapart_fetch_on_complete, - fetch_data); - pull_data->n_outstanding_deltapart_fetches++; + if (!fetcher_queue_is_full (pull_data)) + start_fetch_deltapart (pull_data, fetch_data); + else + { + g_hash_table_add (pull_data->pending_fetch_deltaparts, fetch_data); + } } } @@ -1685,6 +1866,87 @@ process_one_static_delta (OtPullData *pull_data, return ret; } +/* Loop over the static delta data we got from the summary, + * and find the newest commit for @out_from_revision that + * goes to @to_revision. + */ +static gboolean +get_best_static_delta_start_for (OtPullData *pull_data, + const char *to_revision, + char **out_from_revision, + GCancellable *cancellable, + GError **error) +{ + GHashTableIter hiter; + gpointer hkey, hvalue; + /* Array of possible from checksums */ + g_autoptr(GPtrArray) candidates = g_ptr_array_new_with_free_func (g_free); + const char *newest_candidate = NULL; + guint64 newest_candidate_timestamp; + + g_assert (pull_data->summary_deltas_checksums != NULL); + g_hash_table_iter_init (&hiter, pull_data->summary_deltas_checksums); + + /* Loop over all deltas known from the summary file, + * finding ones which go to to_revision */ + while (g_hash_table_iter_next (&hiter, &hkey, &hvalue)) + { + const char *delta_name = hkey; + g_autofree char *cur_from_rev = NULL; + g_autofree char *cur_to_rev = NULL; + + /* Gracefully handle corrupted (or malicious) summary files */ + if (!_ostree_parse_delta_name (delta_name, &cur_from_rev, &cur_to_rev, error)) + return FALSE; + + /* Is this the checksum we want? */ + if (strcmp (cur_to_rev, to_revision) != 0) + continue; + + if (cur_from_rev) + g_ptr_array_add (candidates, g_steal_pointer (&cur_from_rev)); + } + + /* Loop over our candidates, find the newest one */ + for (guint i = 0; i < candidates->len; i++) + { + const char *candidate = candidates->pdata[i]; + guint64 candidate_ts; + g_autoptr(GVariant) commit = NULL; + OstreeRepoCommitState state; + gboolean have_candidate; + + /* Do we have this commit at all? If not, skip it */ + if (!ostree_repo_has_object (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, + candidate, &have_candidate, + NULL, error)) + return FALSE; + if (!have_candidate) + continue; + + /* Load it */ + if (!ostree_repo_load_commit (pull_data->repo, candidate, + &commit, &state, error)) + return FALSE; + + /* Ignore partial commits, we can't use them */ + if (state & OSTREE_REPO_COMMIT_STATE_PARTIAL) + continue; + + /* Is it newer? */ + candidate_ts = ostree_commit_get_timestamp (commit); + if (newest_candidate == NULL || + candidate_ts > newest_candidate_timestamp) + { + newest_candidate = candidate; + newest_candidate_timestamp = candidate_ts; + } + } + + *out_from_revision = g_strdup (newest_candidate); + return TRUE; +} + typedef struct { OtPullData *pull_data; char *from_revision; @@ -1926,7 +2188,7 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self, if (tls_permissive) fetcher_flags |= OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE; - fetcher = _ostree_fetcher_new (self->tmp_dir_fd, fetcher_flags); + fetcher = _ostree_fetcher_new (self->tmp_dir_fd, remote_name, fetcher_flags); { g_autofree char *tls_client_cert_path = NULL; @@ -2327,6 +2589,7 @@ reinitialize_fetcher (OtPullData *pull_data, const char *remote_name, GError **e * * override-url (s): Fetch objects from this URL if remote specifies no metalink in options * * inherit-transaction (b): Don't initiate, finish or abort a transaction, usefult to do mutliple pulls in one transaction. * * http-headers (a(ss)): Additional headers to add to all HTTP requests + * * update-frequency (u): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are valid */ gboolean ostree_repo_pull_with_options (OstreeRepo *self, @@ -2351,6 +2614,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, char **configured_branches = NULL; guint64 bytes_transferred; guint64 end_time; + guint update_frequency = 0; OstreeRepoPullFlags flags = 0; const char *dir_to_pull = NULL; g_autofree char **dirs_to_pull = NULL; @@ -2361,7 +2625,6 @@ ostree_repo_pull_with_options (OstreeRepo *self, gboolean opt_gpg_verify_set = FALSE; gboolean opt_gpg_verify_summary_set = FALSE; const char *url_override = NULL; - gboolean mirroring_into_archive; gboolean inherit_transaction = FALSE; int i; @@ -2387,6 +2650,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, (void) g_variant_lookup (options, "override-url", "&s", &url_override); (void) g_variant_lookup (options, "inherit-transaction", "b", &inherit_transaction); (void) g_variant_lookup (options, "http-headers", "@a(ss)", &pull_data->extra_headers); + (void) g_variant_lookup (options, "update-frequency", "u", &update_frequency); } g_return_val_if_fail (pull_data->maxdepth >= -1, FALSE); @@ -2400,6 +2664,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_return_val_if_fail (dirs_to_pull[i][0] == '/', FALSE); g_return_val_if_fail (!(disable_static_deltas && pull_data->require_static_deltas), FALSE); + /* We only do dry runs with static deltas, because we don't really have any * in-advance information for bare fetches. */ @@ -2410,8 +2675,6 @@ ostree_repo_pull_with_options (OstreeRepo *self, pull_data->is_untrusted = (flags & OSTREE_REPO_PULL_FLAGS_UNTRUSTED) > 0; pull_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - mirroring_into_archive = pull_data->is_mirror && self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2; - if (error) pull_data->async_error = &pull_data->cached_async_error; else @@ -2435,8 +2698,18 @@ ostree_repo_pull_with_options (OstreeRepo *self, (GDestroyNotify)g_variant_unref, NULL); pull_data->requested_content = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, NULL); + pull_data->requested_fallback_content = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify)g_free, NULL); pull_data->requested_metadata = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal, (GDestroyNotify)g_variant_unref, NULL); + pull_data->pending_fetch_content = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify)g_free, + (GDestroyNotify)fetch_object_data_free); + pull_data->pending_fetch_metadata = g_hash_table_new_full (ostree_hash_object_name, g_variant_equal, + (GDestroyNotify)g_variant_unref, + (GDestroyNotify)fetch_object_data_free); + pull_data->pending_fetch_deltaparts = g_hash_table_new_full (NULL, NULL, (GDestroyNotify)fetch_static_delta_data_free, NULL); + if (dir_to_pull != NULL || dirs_to_pull != NULL) { pull_data->dirs = g_ptr_array_new_with_free_func (g_free); @@ -2671,6 +2944,23 @@ ostree_repo_pull_with_options (OstreeRepo *self, if (pull_data->remote_repo_local && !pull_data->require_static_deltas) disable_static_deltas = TRUE; + /* We can't use static deltas if pulling into an archive-z2 repo. */ + if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2) + { + if (pull_data->require_static_deltas) + { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Can't use static deltas in an archive repo"); + goto out; + } + disable_static_deltas = TRUE; + } + + /* It's not efficient to use static deltas if all we want is the commit + * metadata. */ + if (pull_data->is_commit_only) + disable_static_deltas = TRUE; + pull_data->static_delta_superblocks = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref); { @@ -2953,11 +3243,23 @@ ostree_repo_pull_with_options (OstreeRepo *self, const char *ref = key; const char *to_revision = value; - if (!ostree_repo_resolve_rev (pull_data->repo, ref, TRUE, - &from_revision, error)) - goto out; + /* If we have a summary, find the latest local commit we have + * to use as a from revision for static deltas. + */ + if (pull_data->summary) + { + if (!get_best_static_delta_start_for (pull_data, to_revision, &from_revision, + cancellable, error)) + goto out; + } + else + { + if (!ostree_repo_resolve_rev (pull_data->repo, ref, TRUE, + &from_revision, error)) + goto out; + } - if (!(disable_static_deltas || mirroring_into_archive || pull_data->is_commit_only) && + if (!disable_static_deltas && (from_revision == NULL || g_strcmp0 (from_revision, to_revision) != 0)) { g_autofree char *delta_name = @@ -2984,7 +3286,12 @@ ostree_repo_pull_with_options (OstreeRepo *self, if (pull_data->progress) { - update_timeout = g_timeout_source_new_seconds (pull_data->dry_run ? 0 : 1); + /* Setup a custom frequency if set */ + if (update_frequency > 0) + update_timeout = g_timeout_source_new (pull_data->dry_run ? 0 : update_frequency); + else + update_timeout = g_timeout_source_new_seconds (pull_data->dry_run ? 0 : 1); + g_source_set_priority (update_timeout, G_PRIORITY_HIGH); g_source_set_callback (update_timeout, update_progress, pull_data, NULL); g_source_attach (update_timeout, pull_data->main_context); @@ -3147,7 +3454,11 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_clear_pointer (&pull_data->scanned_metadata, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->summary_deltas_checksums, (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); + g_clear_pointer (&pull_data->pending_fetch_content, (GDestroyNotify) g_hash_table_unref); + g_clear_pointer (&pull_data->pending_fetch_metadata, (GDestroyNotify) g_hash_table_unref); + g_clear_pointer (&pull_data->pending_fetch_deltaparts, (GDestroyNotify) g_hash_table_unref); g_clear_pointer (&pull_data->idle_src, (GDestroyNotify) g_source_destroy); g_clear_pointer (&pull_data->dirs, (GDestroyNotify) g_ptr_array_unref); g_clear_pointer (&remote_config, (GDestroyNotify) g_key_file_unref); @@ -3242,7 +3553,7 @@ out: return ret; } -#else /* HAVE_LIBSOUP */ +#else /* HAVE_LIBCURL_OR_LIBSOUP */ gboolean ostree_repo_pull_with_options (OstreeRepo *self, @@ -3271,4 +3582,4 @@ ostree_repo_remote_fetch_summary_with_options (OstreeRepo *self, return FALSE; } -#endif /* HAVE_LIBSOUP */ +#endif /* HAVE_LIBCURL_OR_LIBSOUP */ diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index 657e8676..47fae9f5 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -1003,11 +1003,7 @@ generate_delta_lowlatency (OstreeRepo *repo, if (!check_object_world_readable (repo, from_checksum, &from_world_readable, cancellable, error)) goto out; if (!from_world_readable) - { - g_hash_table_iter_steal (&hashiter); - g_hash_table_add (new_reachable_regfile_content, (char*)from_checksum); - continue; - } + continue; if (!try_content_rollsum (repo, opts, from_checksum, to_checksum, &rollsum, cancellable, error)) diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index edbf965b..21ed081d 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -884,10 +884,6 @@ _ostree_repo_static_delta_dump (OstreeRepo *self, OT_VARIANT_MAP_TRUSTED, &delta_superblock, error)) goto out; - { g_autofree char *variant_string = g_variant_print (delta_superblock, 1); - g_print ("%s\n", variant_string); - } - g_print ("Delta: %s\n", delta_id); { const char *endianness_description; gboolean was_heuristic; @@ -940,9 +936,13 @@ _ostree_repo_static_delta_dump (OstreeRepo *self, for (i = 0; i < n_fallback; i++) { guint64 size, usize; - g_variant_get_child (fallback, i, "(y@aytt)", NULL, NULL, &size, &usize); + g_autoptr(GVariant) checksum_v = NULL; + char checksum[OSTREE_SHA256_STRING_LEN+1]; + g_variant_get_child (fallback, i, "(y@aytt)", NULL, &checksum_v, &size, &usize); + ostree_checksum_inplace_from_bytes (ostree_checksum_bytes_peek (checksum_v), checksum); size = maybe_swap_endian_u64 (swap_endian, size); usize = maybe_swap_endian_u64 (swap_endian, usize); + g_print (" %s\n", checksum); total_fallback_size += size; total_fallback_usize += usize; } diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 3b3aa664..71604480 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -284,7 +284,7 @@ _ostree_repo_remote_name_is_file (const char *remote_name) * OSTree remotes are represented by keyfile groups, formatted like: * `[remote "remotename"]`. This function returns a value named @option_name * underneath that group, or @default_value if the remote exists but not the - * option name. + * option name. If an error is returned, @out_value will be set to %NULL. * * Returns: %TRUE on success, otherwise %FALSE with @error set */ @@ -360,8 +360,9 @@ ostree_repo_get_remote_option (OstreeRepo *self, * * OSTree remotes are represented by keyfile groups, formatted like: * `[remote "remotename"]`. This function returns a value named @option_name - * underneath that group, and returns it as an zero terminated array of strings. - * If the option is not set, @out_value will be set to %NULL. + * underneath that group, and returns it as a zero terminated array of strings. + * If the option is not set, or if an error is returned, @out_value will be set + * to %NULL. * * Returns: %TRUE on success, otherwise %FALSE with @error set */ @@ -435,7 +436,8 @@ ostree_repo_get_remote_list_option (OstreeRepo *self, * OSTree remotes are represented by keyfile groups, formatted like: * `[remote "remotename"]`. This function returns a value named @option_name * underneath that group, and returns it as a boolean. - * If the option is not set, @out_value will be set to @default_value. + * If the option is not set, @out_value will be set to @default_value. If an + * error is returned, @out_value will be set to %FALSE. * * Returns: %TRUE on success, otherwise %FALSE with @error set */ @@ -2002,14 +2004,138 @@ get_remotes_d_dir (OstreeRepo *self) } static gboolean -append_remotes_d (OstreeRepo *self, - GCancellable *cancellable, - GError **error) +reload_core_config (OstreeRepo *self, + GCancellable *cancellable, + GError **error) +{ + g_autofree char *version = NULL; + g_autofree char *mode = NULL; + g_autofree char *contents = NULL; + g_autofree char *parent_repo_path = NULL; + gboolean is_archive; + gsize len; + + g_clear_pointer (&self->config, (GDestroyNotify)g_key_file_unref); + self->config = g_key_file_new (); + + contents = glnx_file_get_contents_utf8_at (self->repo_dir_fd, "config", &len, + NULL, error); + if (!contents) + return FALSE; + if (!g_key_file_load_from_data (self->config, contents, len, 0, error)) + { + g_prefix_error (error, "Couldn't parse config file: "); + return FALSE; + } + + version = g_key_file_get_value (self->config, "core", "repo_version", error); + if (!version) + return FALSE; + + if (strcmp (version, "1") != 0) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Invalid repository version '%s'", version); + return FALSE; + } + + if (!ot_keyfile_get_boolean_with_default (self->config, "core", "archive", + FALSE, &is_archive, error)) + return FALSE; + if (is_archive) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, + "This version of OSTree no longer supports \"archive\" repositories; use archive-z2 instead"); + return FALSE; + } + + if (!ot_keyfile_get_value_with_default (self->config, "core", "mode", + "bare", &mode, error)) + return FALSE; + if (!ostree_repo_mode_from_string (mode, &self->mode, error)) + return FALSE; + + if (self->writable) + { + if (!ot_keyfile_get_boolean_with_default (self->config, "core", "enable-uncompressed-cache", + TRUE, &self->enable_uncompressed_cache, error)) + return FALSE; + } + else + self->enable_uncompressed_cache = FALSE; + + { + gboolean do_fsync; + + if (!ot_keyfile_get_boolean_with_default (self->config, "core", "fsync", + TRUE, &do_fsync, error)) + return FALSE; + + if (!do_fsync) + ostree_repo_set_disable_fsync (self, TRUE); + } + + { g_autofree char *tmp_expiry_seconds = NULL; + + /* 86400 secs = one day */ + if (!ot_keyfile_get_value_with_default (self->config, "core", "tmp-expiry-secs", "86400", + &tmp_expiry_seconds, error)) + return FALSE; + + self->tmp_expiry_seconds = g_ascii_strtoull (tmp_expiry_seconds, NULL, 10); + } + + { g_autofree char *compression_level_str = NULL; + + /* gzip defaults to 6 */ + (void)ot_keyfile_get_value_with_default (self->config, "archive", "zlib-level", NULL, + &compression_level_str, NULL); + + if (compression_level_str) + /* Ensure level is in [1,9] */ + self->zlib_compression_level = MAX (1, MIN (9, g_ascii_strtoull (compression_level_str, NULL, 10))); + else + self->zlib_compression_level = OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL; + } + + if (!ot_keyfile_get_value_with_default (self->config, "core", "parent", + NULL, &parent_repo_path, error)) + return FALSE; + + if (parent_repo_path && parent_repo_path[0]) + { + g_autoptr(GFile) parent_repo_f = g_file_new_for_path (parent_repo_path); + + g_clear_object (&self->parent_repo); + self->parent_repo = ostree_repo_new (parent_repo_f); + + if (!ostree_repo_open (self->parent_repo, cancellable, error)) + { + g_prefix_error (error, "While checking parent repository '%s': ", + gs_file_get_path_cached (parent_repo_f)); + return FALSE; + } + } + + return TRUE; +} + +static gboolean +reload_remote_config (OstreeRepo *self, + GCancellable *cancellable, + GError **error) { gboolean ret = FALSE; g_autoptr(GFile) remotes_d = NULL; g_autoptr(GFileEnumerator) direnum = NULL; + g_mutex_lock (&self->remotes_lock); + g_hash_table_remove_all (self->remotes); + g_mutex_unlock (&self->remotes_lock); + + if (!add_remotes_from_keyfile (self, self->config, NULL, error)) + goto out; + remotes_d = get_remotes_d_dir (self); if (remotes_d == NULL) return TRUE; @@ -2050,17 +2176,34 @@ append_remotes_d (OstreeRepo *self, return ret; } +/** + * ostree_repo_reload_config: + * @self: repo + * @cancellable: cancellable + * @error: error + * + * By default, an #OstreeRepo will cache the remote configuration and its + * own repo/config data. This API can be used to reload it. + */ +gboolean +ostree_repo_reload_config (OstreeRepo *self, + GCancellable *cancellable, + GError **error) +{ + if (!reload_core_config (self, cancellable, error)) + return FALSE; + if (!reload_remote_config (self, cancellable, error)) + return FALSE; + return TRUE; +} + gboolean ostree_repo_open (OstreeRepo *self, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; - gboolean is_archive; struct stat stbuf; - g_autofree char *version = NULL; - g_autofree char *mode = NULL; - g_autofree char *parent_repo_path = NULL; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -2126,102 +2269,6 @@ ostree_repo_open (OstreeRepo *self, self->target_owner_uid = self->target_owner_gid = -1; } - self->config = g_key_file_new (); - - { g_autofree char *contents = NULL; - gsize len; - - contents = glnx_file_get_contents_utf8_at (self->repo_dir_fd, "config", &len, - NULL, error); - if (!contents) - goto out; - if (!g_key_file_load_from_data (self->config, contents, len, 0, error)) - { - g_prefix_error (error, "Couldn't parse config file: "); - goto out; - } - } - if (!add_remotes_from_keyfile (self, self->config, NULL, error)) - goto out; - - version = g_key_file_get_value (self->config, "core", "repo_version", error); - if (!version) - goto out; - - if (strcmp (version, "1") != 0) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Invalid repository version '%s'", version); - goto out; - } - - if (!ot_keyfile_get_boolean_with_default (self->config, "core", "archive", - FALSE, &is_archive, error)) - goto out; - if (is_archive) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - "This version of OSTree no longer supports \"archive\" repositories; use archive-z2 instead"); - goto out; - } - - if (!ot_keyfile_get_value_with_default (self->config, "core", "mode", - "bare", &mode, error)) - goto out; - if (!ostree_repo_mode_from_string (mode, &self->mode, error)) - goto out; - - if (!ot_keyfile_get_value_with_default (self->config, "core", "parent", - NULL, &parent_repo_path, error)) - goto out; - - if (parent_repo_path && parent_repo_path[0]) - { - g_autoptr(GFile) parent_repo_f = g_file_new_for_path (parent_repo_path); - - self->parent_repo = ostree_repo_new (parent_repo_f); - - if (!ostree_repo_open (self->parent_repo, cancellable, error)) - { - g_prefix_error (error, "While checking parent repository '%s': ", - gs_file_get_path_cached (parent_repo_f)); - goto out; - } - } - - if (self->writable) - { - if (!ot_keyfile_get_boolean_with_default (self->config, "core", "enable-uncompressed-cache", - TRUE, &self->enable_uncompressed_cache, error)) - goto out; - } - else - self->enable_uncompressed_cache = FALSE; - - { - gboolean do_fsync; - - if (!ot_keyfile_get_boolean_with_default (self->config, "core", "fsync", - TRUE, &do_fsync, error)) - goto out; - - if (!do_fsync) - ostree_repo_set_disable_fsync (self, TRUE); - } - - { g_autofree char *tmp_expiry_seconds = NULL; - - /* 86400 secs = one day */ - if (!ot_keyfile_get_value_with_default (self->config, "core", "tmp-expiry-secs", "86400", - &tmp_expiry_seconds, error)) - goto out; - - self->tmp_expiry_seconds = g_ascii_strtoull (tmp_expiry_seconds, NULL, 10); - } - - if (!append_remotes_d (self, cancellable, error)) - goto out; - if (!glnx_opendirat (self->repo_dir_fd, "tmp", TRUE, &self->tmp_dir_fd, error)) goto out; @@ -2234,6 +2281,10 @@ ostree_repo_open (OstreeRepo *self, goto out; } + if (!ostree_repo_reload_config (self, cancellable, error)) + goto out; + + /* TODO - delete this */ if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2 && self->enable_uncompressed_cache) { if (!glnx_shutil_mkdir_p_at (self->repo_dir_fd, "uncompressed-objects-cache", 0755, @@ -3797,8 +3848,7 @@ _formatted_time_remaining_from_seconds (guint64 seconds_remaining) if (minutes_remaining) g_string_append_printf (description, "%" G_GUINT64_FORMAT " minutes ", minutes_remaining % 60); - if (seconds_remaining) - g_string_append_printf (description, "%" G_GUINT64_FORMAT " seconds ", seconds_remaining % 60); + g_string_append_printf (description, "%" G_GUINT64_FORMAT " seconds ", seconds_remaining % 60); return g_string_free (description, FALSE); } @@ -3827,12 +3877,15 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress { GString *buf; g_autofree char *status = NULL; + gboolean scanning; guint outstanding_fetches; guint outstanding_metadata_fetches; guint outstanding_writes; guint n_scanned_metadata; guint fetched_delta_parts; guint total_delta_parts; + guint fetched_delta_part_fallbacks; + guint total_delta_part_fallbacks; buf = g_string_new (""); @@ -3840,9 +3893,12 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress outstanding_fetches = ostree_async_progress_get_uint (progress, "outstanding-fetches"); outstanding_metadata_fetches = ostree_async_progress_get_uint (progress, "outstanding-metadata-fetches"); outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes"); + scanning = ostree_async_progress_get_uint (progress, "scanning") == 1; n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata"); fetched_delta_parts = ostree_async_progress_get_uint (progress, "fetched-delta-parts"); total_delta_parts = ostree_async_progress_get_uint (progress, "total-delta-parts"); + fetched_delta_part_fallbacks = ostree_async_progress_get_uint (progress, "fetched-delta-fallbacks"); + total_delta_part_fallbacks = ostree_async_progress_get_uint (progress, "total-delta-fallbacks"); if (status) { @@ -3860,35 +3916,56 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress g_autofree char *formatted_bytes_transferred = g_format_size_full (bytes_transferred, 0); g_autofree char *formatted_bytes_sec = NULL; - g_autofree char *formatted_est_time_remaining = NULL; + guint64 bytes_sec; /* Ignore the first second, or when we haven't transferred any * data, since those could cause divide by zero below. */ if ((current_time - start_time) < G_USEC_PER_SEC || bytes_transferred == 0) { + bytes_sec = 0; formatted_bytes_sec = g_strdup ("-"); - formatted_est_time_remaining = g_strdup ("- "); } else { - guint64 bytes_sec = bytes_transferred / ((current_time - start_time) / G_USEC_PER_SEC); - guint64 est_time_remaining = (total_delta_part_size - bytes_transferred) / bytes_sec; + bytes_sec = bytes_transferred / ((current_time - start_time) / G_USEC_PER_SEC); formatted_bytes_sec = g_format_size (bytes_sec); - formatted_est_time_remaining = _formatted_time_remaining_from_seconds (est_time_remaining); } + /* Are we doing deltas? If so, we can be more accurate */ if (total_delta_parts > 0) { - g_autofree char *formatted_total = - g_format_size (total_delta_part_size); - /* No space between %s and remaining, since formatted_est_time_remaining has a trailing space */ - g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/s %s/%s %sremaining", - fetched_delta_parts, total_delta_parts, - formatted_bytes_sec, formatted_bytes_transferred, - formatted_total, formatted_est_time_remaining); + guint64 fetched_delta_part_size = ostree_async_progress_get_uint64 (progress, "fetched-delta-part-size"); + g_autofree char *formatted_fetched = NULL; + g_autofree char *formatted_total = NULL; + + /* Here we merge together deltaparts + fallbacks to avoid bloating the text UI */ + fetched_delta_parts += fetched_delta_part_fallbacks; + total_delta_parts += total_delta_part_fallbacks; + + formatted_fetched = g_format_size (fetched_delta_part_size); + formatted_total = g_format_size (total_delta_part_size); + + if (bytes_sec > 0) + { + /* MAX(0, value) here just to be defensive */ + guint64 est_time_remaining = MAX(0, (total_delta_part_size - fetched_delta_part_size)) / bytes_sec; + g_autofree char *formatted_est_time_remaining = _formatted_time_remaining_from_seconds (est_time_remaining); + /* No space between %s and remaining, since formatted_est_time_remaining has a trailing space */ + g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/%s %s/s %sremaining", + fetched_delta_parts, total_delta_parts, + formatted_fetched, formatted_total, + formatted_bytes_sec, + formatted_est_time_remaining); + } + else + { + g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/%s", + fetched_delta_parts, total_delta_parts, + formatted_fetched, formatted_total); + } } - else if (outstanding_metadata_fetches) + else if (scanning || outstanding_metadata_fetches) { g_string_append_printf (buf, "Receiving metadata objects: %u/(estimating) %s/s %s", metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred); @@ -4232,16 +4309,14 @@ find_keyring (OstreeRepo *self, OstreeRemote *remote, GCancellable *cancellable) { - g_autoptr(GFile) remotes_d = NULL; - g_autoptr(GFile) file = NULL; - file = g_file_get_child (self->repodir, remote->keyring); + g_autoptr(GFile) file = g_file_get_child (self->repodir, remote->keyring); if (g_file_query_exists (file, cancellable)) { return g_steal_pointer (&file); } - remotes_d = get_remotes_d_dir (self); + g_autoptr(GFile) remotes_d = get_remotes_d_dir (self); if (remotes_d) { g_autoptr(GFile) file2 = g_file_get_child (remotes_d, remote->keyring); @@ -4356,8 +4431,8 @@ _ostree_repo_gpg_verify_with_metadata (OstreeRepo *self, _OSTREE_METADATA_GPGSIGS_TYPE); if (!signaturedata) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, - "GPG verification enabled, but no signatures found (use gpg-verify=false in remote config to disable)"); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "GPG verification enabled, but no signatures found (use gpg-verify=false in remote config to disable)"); return NULL; } @@ -4474,7 +4549,12 @@ ostree_repo_verify_commit (OstreeRepo *self, keyringdir, extra_keyring, cancellable, error); - return ostree_gpg_verify_result_require_valid_signature (result, error); + if (!ostree_gpg_verify_result_require_valid_signature (result, error)) + { + g_prefix_error (error, "Commit %s: ", commit_checksum); + return FALSE; + } + return TRUE; } /** diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 341a4d9c..34685cc6 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -101,6 +101,11 @@ GKeyFile * ostree_repo_get_config (OstreeRepo *self); _OSTREE_PUBLIC GKeyFile * ostree_repo_copy_config (OstreeRepo *self); +_OSTREE_PUBLIC +gboolean ostree_repo_reload_config (OstreeRepo *self, + GCancellable *cancellable, + GError **error); + _OSTREE_PUBLIC gboolean ostree_repo_remote_add (OstreeRepo *self, const char *name, @@ -717,11 +722,13 @@ typedef enum { /** * OstreeRepoCheckoutOverwriteMode: * @OSTREE_REPO_CHECKOUT_OVERWRITE_NONE: No special options - * @OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES: When layering checkouts, overwrite earlier files, but keep earlier directories + * @OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES: When layering checkouts, unlink() and replace existing files, but do not modify existing directories + * @OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES: Only add new files/directories */ typedef enum { OSTREE_REPO_CHECKOUT_OVERWRITE_NONE = 0, - OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES = 1 + OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES = 1, + OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES = 2, /* Since: 2017.3 */ } OstreeRepoCheckoutOverwriteMode; _OSTREE_PUBLIC diff --git a/src/libostree/ostree-soup-form.c b/src/libostree/ostree-soup-form.c new file mode 100644 index 00000000..74f9c7bb --- /dev/null +++ b/src/libostree/ostree-soup-form.c @@ -0,0 +1,140 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* soup-form.c : utility functions for HTML forms */ + +/* + * Copyright 2008 Red Hat, Inc. + */ + +/* This one is stripped down to only have soup_form_encode_hash() + * and soup_form_encode_valist() which are the only bits that soup-uri.c + * calls. + */ + +#include + +#include + +#include "ostree-soup-uri.h" + +/** + * SECTION:soup-form + * @short_description: HTML form handling + * @see_also: #SoupMultipart + * + * libsoup contains several help methods for processing HTML forms as + * defined by the + * HTML 4.01 specification. + **/ + +/** + * SOUP_FORM_MIME_TYPE_URLENCODED: + * + * A macro containing the value + * "application/x-www-form-urlencoded"; the default + * MIME type for POSTing HTML form data. + * + * Since: 2.26 + **/ + +/** + * SOUP_FORM_MIME_TYPE_MULTIPART: + * + * A macro containing the value + * "multipart/form-data"; the MIME type used for + * posting form data that contains files to be uploaded. + * + * Since: 2.26 + **/ + +#define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10) +#define HEXCHAR(s) ((XDIGIT (s[1]) << 4) + XDIGIT (s[2])) + +static void +append_form_encoded (GString *str, const char *in) +{ + const unsigned char *s = (const unsigned char *)in; + + while (*s) { + if (*s == ' ') { + g_string_append_c (str, '+'); + s++; + } else if (!g_ascii_isalnum (*s) && (*s != '-') && (*s != '_') + && (*s != '.')) + g_string_append_printf (str, "%%%02X", (int)*s++); + else + g_string_append_c (str, *s++); + } +} + +static void +encode_pair (GString *str, const char *name, const char *value) +{ + g_return_if_fail (name != NULL); + g_return_if_fail (value != NULL); + + if (str->len) + g_string_append_c (str, '&'); + append_form_encoded (str, name); + g_string_append_c (str, '='); + append_form_encoded (str, value); +} + +/** + * soup_form_encode_hash: + * @form_data_set: (element-type utf8 utf8): a hash table containing + * name/value pairs (as strings) + * + * Encodes @form_data_set into a value of type + * "application/x-www-form-urlencoded", as defined in the HTML 4.01 + * spec. + * + * Note that the HTML spec states that "The control names/values are + * listed in the order they appear in the document." Since this method + * takes a hash table, it cannot enforce that; if you care about the + * ordering of the form fields, use soup_form_encode_datalist(). + * + * Return value: the encoded form + **/ +char * +soup_form_encode_hash (GHashTable *form_data_set) +{ + GString *str = g_string_new (NULL); + GHashTableIter iter; + gpointer name, value; + + g_hash_table_iter_init (&iter, form_data_set); + while (g_hash_table_iter_next (&iter, &name, &value)) + encode_pair (str, name, value); + return g_string_free (str, FALSE); +} + +/** + * soup_form_encode_valist: + * @first_field: name of the first form field + * @args: pointer to additional values, as in soup_form_encode() + * + * See soup_form_encode(). This is mostly an internal method, used by + * various other methods such as soup_uri_set_query_from_fields() and + * soup_form_request_new(). + * + * Return value: the encoded form + **/ +char * +soup_form_encode_valist (const char *first_field, va_list args) +{ + GString *str = g_string_new (NULL); + const char *name, *value; + + name = first_field; + value = va_arg (args, const char *); + while (name && value) { + encode_pair (str, name, value); + + name = va_arg (args, const char *); + if (name) + value = va_arg (args, const char *); + } + + return g_string_free (str, FALSE); +} diff --git a/src/libostree/ostree-soup-uri.c b/src/libostree/ostree-soup-uri.c new file mode 100644 index 00000000..97f74636 --- /dev/null +++ b/src/libostree/ostree-soup-uri.c @@ -0,0 +1,1483 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* soup-uri.c : utility functions to parse URLs */ + +/* + * Copyright 1999-2003 Ximian, Inc. + */ + +#include "config.h" + +#include +#include + +#include "ostree-soup-uri.h" + +/* OSTREECHANGE: definitions from soup-misc-private.h */ +char *soup_uri_decoded_copy (const char *str, int length, int *decoded_length); +char *soup_uri_to_string_internal (SoupURI *uri, gboolean just_path_and_query, + gboolean force_port); +gboolean soup_uri_is_http (SoupURI *uri, char **aliases); +gboolean soup_uri_is_https (SoupURI *uri, char **aliases); + +/* OSTREECHANGE: import soup-misc's char helpers */ +#define SOUP_CHAR_URI_PERCENT_ENCODED 0x01 +#define SOUP_CHAR_URI_GEN_DELIMS 0x02 +#define SOUP_CHAR_URI_SUB_DELIMS 0x04 +#define SOUP_CHAR_HTTP_SEPARATOR 0x08 +#define SOUP_CHAR_HTTP_CTL 0x10 + +/* 00 URI_UNRESERVED + * 01 URI_PCT_ENCODED + * 02 URI_GEN_DELIMS + * 04 URI_SUB_DELIMS + * 08 HTTP_SEPARATOR + * 10 HTTP_CTL + */ +const char soup_char_attributes[] = { + /* 0x00 - 0x07 */ + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + /* 0x08 - 0x0f */ + 0x11, 0x19, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + /* 0x10 - 0x17 */ + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + /* 0x18 - 0x1f */ + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + /* !"#$%&' */ + 0x09, 0x04, 0x09, 0x02, 0x04, 0x01, 0x04, 0x04, + /* ()*+,-./ */ + 0x0c, 0x0c, 0x04, 0x04, 0x0c, 0x00, 0x00, 0x0a, + /* 01234567 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 89:;<=>? */ + 0x00, 0x00, 0x0a, 0x0c, 0x09, 0x0a, 0x09, 0x0a, + /* @ABCDEFG */ + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* HIJKLMNO */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* PQRSTUVW */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* XYZ[\]^_ */ + 0x00, 0x00, 0x00, 0x0a, 0x09, 0x0a, 0x01, 0x00, + /* `abcdefg */ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* hijklmno */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* pqrstuvw */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* xyz{|}~ */ + 0x00, 0x00, 0x00, 0x09, 0x01, 0x09, 0x00, 0x11, + /* 0x80 - 0xFF */ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 +}; + +#define soup_char_is_uri_percent_encoded(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_PERCENT_ENCODED) +#define soup_char_is_uri_gen_delims(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_GEN_DELIMS) +#define soup_char_is_uri_sub_delims(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_SUB_DELIMS) +#define soup_char_is_uri_unreserved(ch) (!(soup_char_attributes[(guchar)ch] & (SOUP_CHAR_URI_PERCENT_ENCODED | SOUP_CHAR_URI_GEN_DELIMS | SOUP_CHAR_URI_SUB_DELIMS))) +#define soup_char_is_token(ch) (!(soup_char_attributes[(guchar)ch] & (SOUP_CHAR_HTTP_SEPARATOR | SOUP_CHAR_HTTP_CTL))) + +/** + * soup_str_case_hash: + * @key: ASCII string to hash + * + * Hashes @key in a case-insensitive manner. + * + * Return value: the hash code. + **/ +static guint +soup_str_case_hash (gconstpointer key) +{ + const char *p = key; + guint h = g_ascii_toupper(*p); + + if (h) + for (p += 1; *p != '\0'; p++) + h = (h << 5) - h + g_ascii_toupper(*p); + + return h; +} + +/** + * SECTION:soup-uri + * @short_description: URIs + * + * A #SoupURI represents a (parsed) URI. + * + * Many applications will not need to use #SoupURI directly at all; on + * the client side, soup_message_new() takes a stringified URI, and on + * the server side, the path and query components are provided for you + * in the server callback. + **/ + +/** + * SoupURI: + * @scheme: the URI scheme (eg, "http") + * @user: a username, or %NULL + * @password: a password, or %NULL + * @host: the hostname or IP address + * @port: the port number on @host + * @path: the path on @host + * @query: a query for @path, or %NULL + * @fragment: a fragment identifier within @path, or %NULL + * + * A #SoupURI represents a (parsed) URI. #SoupURI supports RFC 3986 + * (URI Generic Syntax), and can parse any valid URI. However, libsoup + * only uses "http" and "https" URIs internally; You can use + * SOUP_URI_VALID_FOR_HTTP() to test if a #SoupURI is a valid HTTP + * URI. + * + * @scheme will always be set in any URI. It is an interned string and + * is always all lowercase. (If you parse a URI with a non-lowercase + * scheme, it will be converted to lowercase.) The macros + * %SOUP_URI_SCHEME_HTTP and %SOUP_URI_SCHEME_HTTPS provide the + * interned values for "http" and "https" and can be compared against + * URI @scheme values. + * + * @user and @password are parsed as defined in the older URI specs + * (ie, separated by a colon; RFC 3986 only talks about a single + * "userinfo" field). Note that @password is not included in the + * output of soup_uri_to_string(). libsoup does not normally use these + * fields; authentication is handled via #SoupSession signals. + * + * @host contains the hostname, and @port the port specified in the + * URI. If the URI doesn't contain a hostname, @host will be %NULL, + * and if it doesn't specify a port, @port may be 0. However, for + * "http" and "https" URIs, @host is guaranteed to be non-%NULL + * (trying to parse an http URI with no @host will return %NULL), and + * @port will always be non-0 (because libsoup knows the default value + * to use when it is not specified in the URI). + * + * @path is always non-%NULL. For http/https URIs, @path will never be + * an empty string either; if the input URI has no path, the parsed + * #SoupURI will have a @path of "/". + * + * @query and @fragment are optional for all URI types. + * soup_form_decode() may be useful for parsing @query. + * + * Note that @path, @query, and @fragment may contain + * %-encoded characters. soup_uri_new() calls + * soup_uri_normalize() on them, but not soup_uri_decode(). This is + * necessary to ensure that soup_uri_to_string() will generate a URI + * that has exactly the same meaning as the original. (In theory, + * #SoupURI should leave @user, @password, and @host partially-encoded + * as well, but this would be more annoying than useful.) + **/ + +/** + * SOUP_URI_IS_VALID: + * @uri: a #SoupURI + * + * Tests whether @uri is a valid #SoupURI; that is, that it is non-%NULL + * and its @scheme and @path members are also non-%NULL. + * + * This macro does not check whether http and https URIs have a non-%NULL + * @host member. + * + * Return value: %TRUE if @uri is valid for use. + * + * Since: 2.38 + **/ + +/** + * SOUP_URI_VALID_FOR_HTTP: + * @uri: a #SoupURI + * + * Tests if @uri is a valid #SoupURI for HTTP communication; that is, if + * it can be used to construct a #SoupMessage. + * + * Return value: %TRUE if @uri is a valid "http" or "https" URI. + * + * Since: 2.24 + **/ + +/** + * SOUP_URI_SCHEME_HTTP: + * + * "http" as an interned string; you can compare this directly to a + * #SoupURI's scheme field using + * ==. + */ +/** + * SOUP_URI_SCHEME_HTTPS: + * + * "https" as an interned string; you can compare this directly to a + * #SoupURI's scheme field using + * ==. + */ +/** + * SOUP_URI_SCHEME_FTP: + * + * "ftp" as an interned string; you can compare this directly to a + * #SoupURI's scheme field using + * ==. + * + * Since: 2.30 + */ +/** + * SOUP_URI_SCHEME_FILE: + * + * "file" as an interned string; you can compare this directly to a + * #SoupURI's scheme field using + * ==. + * + * Since: 2.30 + */ +/** + * SOUP_URI_SCHEME_DATA: + * + * "data" as an interned string; you can compare this directly to a + * #SoupURI's scheme field using + * ==. + * + * Since: 2.30 + */ +/** + * SOUP_URI_SCHEME_RESOURCE: + * + * "data" as an interned string; you can compare this directly to a + * #SoupURI's scheme field using + * ==. + * + * Since: 2.42 + */ +/** + * SOUP_URI_SCHEME_WS: + * + * "ws" (WebSocket) as an interned string; you can compare this + * directly to a #SoupURI's scheme field using + * ==. + * + * Since: 2.50 + */ +/** + * SOUP_URI_SCHEME_WSS: + * + * "wss" (WebSocket over TLS) as an interned string; you can compare + * this directly to a #SoupURI's scheme field using + * ==. + * + * Since: 2.50 + */ + +struct _SoupURI { + const char *scheme; + + char *user; + char *password; + + char *host; + guint port; + + char *path; + char *query; + + char *fragment; +}; + +static void append_uri_encoded (GString *str, const char *in, const char *extra_enc_chars); +static char *uri_normalized_copy (const char *str, int length, const char *unescape_extra); + +gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS; +gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS; +gpointer _SOUP_URI_SCHEME_FTP; +gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE; + +static inline const char * +soup_uri_parse_scheme (const char *scheme, int len) +{ + if (len == 4 && !g_ascii_strncasecmp (scheme, "http", len)) { + return SOUP_URI_SCHEME_HTTP; + } else if (len == 5 && !g_ascii_strncasecmp (scheme, "https", len)) { + return SOUP_URI_SCHEME_HTTPS; + } else if (len == 8 && !g_ascii_strncasecmp (scheme, "resource", len)) { + return SOUP_URI_SCHEME_RESOURCE; + } else if (len == 2 && !g_ascii_strncasecmp (scheme, "ws", len)) { + return SOUP_URI_SCHEME_WS; + } else if (len == 3 && !g_ascii_strncasecmp (scheme, "wss", len)) { + return SOUP_URI_SCHEME_WSS; + } else { + char *lower_scheme; + + lower_scheme = g_ascii_strdown (scheme, len); + scheme = g_intern_static_string (lower_scheme); + if (scheme != (const char *)lower_scheme) + g_free (lower_scheme); + return scheme; + } +} + +static inline guint +soup_scheme_default_port (const char *scheme) +{ + if (scheme == SOUP_URI_SCHEME_HTTP || scheme == SOUP_URI_SCHEME_WS) + return 80; + else if (scheme == SOUP_URI_SCHEME_HTTPS || scheme == SOUP_URI_SCHEME_WSS) + return 443; + else if (scheme == SOUP_URI_SCHEME_FTP) + return 21; + else + return 0; +} + +/** + * soup_uri_new_with_base: + * @base: a base URI + * @uri_string: the URI + * + * Parses @uri_string relative to @base. + * + * Return value: a parsed #SoupURI. + **/ +SoupURI * +soup_uri_new_with_base (SoupURI *base, const char *uri_string) +{ + SoupURI *uri, fixed_base; + const char *end, *hash, *colon, *at, *path, *question; + const char *p, *hostend; + gboolean remove_dot_segments = TRUE; + int len; + + g_return_val_if_fail (uri_string != NULL, NULL); + + /* Allow a %NULL path in @base, for compatibility */ + if (base && base->scheme && !base->path) { + g_warn_if_fail (SOUP_URI_IS_VALID (base)); + + memcpy (&fixed_base, base, sizeof (SoupURI)); + fixed_base.path = ""; + base = &fixed_base; + } + + g_return_val_if_fail (base == NULL || SOUP_URI_IS_VALID (base), NULL); + + /* First some cleanup steps (which are supposed to all be no-ops, + * but...). Skip initial whitespace, strip out internal tabs and + * line breaks, and ignore trailing whitespace. + */ + while (g_ascii_isspace (*uri_string)) + uri_string++; + + len = strcspn (uri_string, "\t\n\r"); + if (uri_string[len]) { + char *clean = g_malloc (strlen (uri_string) + 1), *d; + const char *s; + + for (s = uri_string, d = clean; *s; s++) { + if (*s != '\t' && *s != '\n' && *s != '\r') + *d++ = *s; + } + *d = '\0'; + + uri = soup_uri_new_with_base (base, clean); + g_free (clean); + return uri; + } + end = uri_string + len; + while (end > uri_string && g_ascii_isspace (end[-1])) + end--; + + uri = g_slice_new0 (SoupURI); + + /* Find fragment. */ + hash = strchr (uri_string, '#'); + if (hash) { + uri->fragment = uri_normalized_copy (hash + 1, end - hash + 1, + NULL); + end = hash; + } + + /* Find scheme */ + p = uri_string; + while (p < end && (g_ascii_isalpha (*p) || + (p > uri_string && (g_ascii_isdigit (*p) || + *p == '.' || + *p == '+' || + *p == '-')))) + p++; + + if (p > uri_string && *p == ':') { + uri->scheme = soup_uri_parse_scheme (uri_string, p - uri_string); + uri_string = p + 1; + } + + if (uri_string == end && !base && !uri->fragment) { + uri->path = g_strdup (""); + return uri; + } + + /* Check for authority */ + if (strncmp (uri_string, "//", 2) == 0) { + uri_string += 2; + + path = uri_string + strcspn (uri_string, "/?#"); + if (path > end) + path = end; + at = strchr (uri_string, '@'); + if (at && at < path) { + colon = strchr (uri_string, ':'); + if (colon && colon < at) { + uri->password = soup_uri_decoded_copy (colon + 1, + at - colon - 1, NULL); + } else { + uri->password = NULL; + colon = at; + } + + uri->user = soup_uri_decoded_copy (uri_string, + colon - uri_string, NULL); + uri_string = at + 1; + } else + uri->user = uri->password = NULL; + + /* Find host and port. */ + if (*uri_string == '[') { + const char *pct; + + uri_string++; + hostend = strchr (uri_string, ']'); + if (!hostend || hostend > path) { + soup_uri_free (uri); + return NULL; + } + if (*(hostend + 1) == ':') + colon = hostend + 1; + else + colon = NULL; + + pct = memchr (uri_string, '%', hostend - uri_string); + if (!pct || (pct[1] == '2' && pct[2] == '5')) { + uri->host = soup_uri_decoded_copy (uri_string, + hostend - uri_string, NULL); + } else + uri->host = g_strndup (uri_string, hostend - uri_string); + } else { + colon = memchr (uri_string, ':', path - uri_string); + hostend = colon ? colon : path; + uri->host = soup_uri_decoded_copy (uri_string, + hostend - uri_string, NULL); + } + + if (colon && colon != path - 1) { + char *portend; + uri->port = strtoul (colon + 1, &portend, 10); + if (portend != (char *)path) { + soup_uri_free (uri); + return NULL; + } + } + + uri_string = path; + } + + /* Find query */ + question = memchr (uri_string, '?', end - uri_string); + if (question) { + uri->query = uri_normalized_copy (question + 1, + end - (question + 1), + NULL); + end = question; + } + + if (end != uri_string) { + uri->path = uri_normalized_copy (uri_string, end - uri_string, + NULL); + } + + /* Apply base URI. This is spelled out in RFC 3986. */ + if (base && !uri->scheme && uri->host) + uri->scheme = base->scheme; + else if (base && !uri->scheme) { + uri->scheme = base->scheme; + uri->user = g_strdup (base->user); + uri->password = g_strdup (base->password); + uri->host = g_strdup (base->host); + uri->port = base->port; + + if (!uri->path) { + uri->path = g_strdup (base->path); + if (!uri->query) + uri->query = g_strdup (base->query); + remove_dot_segments = FALSE; + } else if (*uri->path != '/') { + char *newpath, *last; + + last = strrchr (base->path, '/'); + if (last) { + newpath = g_strdup_printf ("%.*s%s", + (int)(last + 1 - base->path), + base->path, + uri->path); + } else + newpath = g_strdup_printf ("/%s", uri->path); + + g_free (uri->path); + uri->path = newpath; + } + } + + if (remove_dot_segments && uri->path && *uri->path) { + char *p, *q; + + /* Remove "./" where "." is a complete segment. */ + for (p = uri->path + 1; *p; ) { + if (*(p - 1) == '/' && + *p == '.' && *(p + 1) == '/') + memmove (p, p + 2, strlen (p + 2) + 1); + else + p++; + } + /* Remove "." at end. */ + if (p > uri->path + 2 && + *(p - 1) == '.' && *(p - 2) == '/') + *(p - 1) = '\0'; + + /* Remove "/../" where != ".." */ + for (p = uri->path + 1; *p; ) { + if (!strncmp (p, "../", 3)) { + p += 3; + continue; + } + q = strchr (p + 1, '/'); + if (!q) + break; + if (strncmp (q, "/../", 4) != 0) { + p = q + 1; + continue; + } + memmove (p, q + 4, strlen (q + 4) + 1); + p = uri->path + 1; + } + /* Remove "/.." at end where != ".." */ + q = strrchr (uri->path, '/'); + if (q && !strcmp (q, "/..")) { + p = q - 1; + while (p > uri->path && *p != '/') + p--; + if (strncmp (p, "/../", 4) != 0) + *(p + 1) = 0; + } + + /* Remove extraneous initial "/.."s */ + while (!strncmp (uri->path, "/../", 4)) + memmove (uri->path, uri->path + 3, strlen (uri->path) - 2); + if (!strcmp (uri->path, "/..")) + uri->path[1] = '\0'; + } + + /* HTTP-specific stuff */ + if (uri->scheme == SOUP_URI_SCHEME_HTTP || + uri->scheme == SOUP_URI_SCHEME_HTTPS) { + if (!uri->path) + uri->path = g_strdup ("/"); + if (!SOUP_URI_VALID_FOR_HTTP (uri)) { + soup_uri_free (uri); + return NULL; + } + } + + if (uri->scheme == SOUP_URI_SCHEME_FTP) { + if (!uri->host) { + soup_uri_free (uri); + return NULL; + } + } + + if (!uri->port) + uri->port = soup_scheme_default_port (uri->scheme); + if (!uri->path) + uri->path = g_strdup (""); + + return uri; +} + +/** + * soup_uri_new: + * @uri_string: (allow-none): a URI + * + * Parses an absolute URI. + * + * You can also pass %NULL for @uri_string if you want to get back an + * "empty" #SoupURI that you can fill in by hand. (You will need to + * call at least soup_uri_set_scheme() and soup_uri_set_path(), since + * those fields are required.) + * + * Return value: (nullable): a #SoupURI, or %NULL if the given string + * was found to be invalid. + **/ +SoupURI * +soup_uri_new (const char *uri_string) +{ + SoupURI *uri; + + if (!uri_string) + return g_slice_new0 (SoupURI); + + uri = soup_uri_new_with_base (NULL, uri_string); + if (!uri) + return NULL; + if (!SOUP_URI_IS_VALID (uri)) { + soup_uri_free (uri); + return NULL; + } + + return uri; +} + + +char * +soup_uri_to_string_internal (SoupURI *uri, gboolean just_path_and_query, + gboolean force_port) +{ + GString *str; + char *return_result; + + g_return_val_if_fail (uri != NULL, NULL); + g_warn_if_fail (SOUP_URI_IS_VALID (uri)); + + str = g_string_sized_new (40); + + if (uri->scheme && !just_path_and_query) + g_string_append_printf (str, "%s:", uri->scheme); + if (uri->host && !just_path_and_query) { + g_string_append (str, "//"); + if (uri->user) { + append_uri_encoded (str, uri->user, ":;@?/"); + g_string_append_c (str, '@'); + } + if (strchr (uri->host, ':')) { + const char *pct; + + g_string_append_c (str, '['); + pct = strchr (uri->host, '%'); + if (pct) { + g_string_append_printf (str, "%.*s%%25%s", + (int) (pct - uri->host), + uri->host, pct + 1); + } else + g_string_append (str, uri->host); + g_string_append_c (str, ']'); + } else + append_uri_encoded (str, uri->host, ":/"); + if (uri->port && (force_port || uri->port != soup_scheme_default_port (uri->scheme))) + g_string_append_printf (str, ":%u", uri->port); + if (!uri->path && (uri->query || uri->fragment)) + g_string_append_c (str, '/'); + else if ((!uri->path || !*uri->path) && + (uri->scheme == SOUP_URI_SCHEME_HTTP || + uri->scheme == SOUP_URI_SCHEME_HTTPS)) + g_string_append_c (str, '/'); + } + + if (uri->path && *uri->path) + g_string_append (str, uri->path); + else if (just_path_and_query) + g_string_append_c (str, '/'); + + if (uri->query) { + g_string_append_c (str, '?'); + g_string_append (str, uri->query); + } + if (uri->fragment && !just_path_and_query) { + g_string_append_c (str, '#'); + g_string_append (str, uri->fragment); + } + + return_result = str->str; + g_string_free (str, FALSE); + + return return_result; +} + +/** + * soup_uri_to_string: + * @uri: a #SoupURI + * @just_path_and_query: if %TRUE, output just the path and query portions + * + * Returns a string representing @uri. + * + * If @just_path_and_query is %TRUE, this concatenates the path and query + * together. That is, it constructs the string that would be needed in + * the Request-Line of an HTTP request for @uri. + * + * Note that the output will never contain a password, even if @uri + * does. + * + * Return value: a string representing @uri, which the caller must free. + **/ +char * +soup_uri_to_string (SoupURI *uri, gboolean just_path_and_query) +{ + return soup_uri_to_string_internal (uri, just_path_and_query, FALSE); +} + +/** + * soup_uri_copy: + * @uri: a #SoupURI + * + * Copies @uri + * + * Return value: a copy of @uri, which must be freed with soup_uri_free() + **/ +SoupURI * +soup_uri_copy (SoupURI *uri) +{ + SoupURI *dup; + + g_return_val_if_fail (uri != NULL, NULL); + g_warn_if_fail (SOUP_URI_IS_VALID (uri)); + + dup = g_slice_new0 (SoupURI); + dup->scheme = uri->scheme; + dup->user = g_strdup (uri->user); + dup->password = g_strdup (uri->password); + dup->host = g_strdup (uri->host); + dup->port = uri->port; + dup->path = g_strdup (uri->path); + dup->query = g_strdup (uri->query); + dup->fragment = g_strdup (uri->fragment); + + return dup; +} + +static inline gboolean +parts_equal (const char *one, const char *two, gboolean insensitive) +{ + if (!one && !two) + return TRUE; + if (!one || !two) + return FALSE; + return insensitive ? !g_ascii_strcasecmp (one, two) : !strcmp (one, two); +} + +/** + * soup_uri_equal: + * @uri1: a #SoupURI + * @uri2: another #SoupURI + * + * Tests whether or not @uri1 and @uri2 are equal in all parts + * + * Return value: %TRUE or %FALSE + **/ +gboolean +soup_uri_equal (SoupURI *uri1, SoupURI *uri2) +{ + g_return_val_if_fail (uri1 != NULL, FALSE); + g_return_val_if_fail (uri2 != NULL, FALSE); + g_warn_if_fail (SOUP_URI_IS_VALID (uri1)); + g_warn_if_fail (SOUP_URI_IS_VALID (uri2)); + + if (uri1->scheme != uri2->scheme || + uri1->port != uri2->port || + !parts_equal (uri1->user, uri2->user, FALSE) || + !parts_equal (uri1->password, uri2->password, FALSE) || + !parts_equal (uri1->host, uri2->host, TRUE) || + !parts_equal (uri1->path, uri2->path, FALSE) || + !parts_equal (uri1->query, uri2->query, FALSE) || + !parts_equal (uri1->fragment, uri2->fragment, FALSE)) + return FALSE; + + return TRUE; +} + +/** + * soup_uri_free: + * @uri: a #SoupURI + * + * Frees @uri. + **/ +void +soup_uri_free (SoupURI *uri) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->user); + g_free (uri->password); + g_free (uri->host); + g_free (uri->path); + g_free (uri->query); + g_free (uri->fragment); + + g_slice_free (SoupURI, uri); +} + +static void +append_uri_encoded (GString *str, const char *in, const char *extra_enc_chars) +{ + const unsigned char *s = (const unsigned char *)in; + + while (*s) { + if (soup_char_is_uri_percent_encoded (*s) || + soup_char_is_uri_gen_delims (*s) || + (extra_enc_chars && strchr (extra_enc_chars, *s))) + g_string_append_printf (str, "%%%02X", (int)*s++); + else + g_string_append_c (str, *s++); + } +} + +/** + * soup_uri_encode: + * @part: a URI part + * @escape_extra: (allow-none): additional reserved characters to + * escape (or %NULL) + * + * This %-encodes the given URI part and returns the escaped + * version in allocated memory, which the caller must free when it is + * done. + * + * Return value: the encoded URI part + **/ +char * +soup_uri_encode (const char *part, const char *escape_extra) +{ + GString *str; + char *encoded; + + g_return_val_if_fail (part != NULL, NULL); + + str = g_string_new (NULL); + append_uri_encoded (str, part, escape_extra); + encoded = str->str; + g_string_free (str, FALSE); + + return encoded; +} + +#define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10) +#define HEXCHAR(s) ((XDIGIT (s[1]) << 4) + XDIGIT (s[2])) + +char * +soup_uri_decoded_copy (const char *part, int length, int *decoded_length) +{ + unsigned char *s, *d; + char *decoded; + + g_return_val_if_fail (part != NULL, NULL); + + decoded = g_strndup (part, length); + s = d = (unsigned char *)decoded; + do { + if (*s == '%') { + if (!g_ascii_isxdigit (s[1]) || + !g_ascii_isxdigit (s[2])) { + *d++ = *s; + continue; + } + *d++ = HEXCHAR (s); + s += 2; + } else + *d++ = *s; + } while (*s++); + + if (decoded_length) + *decoded_length = d - (unsigned char *)decoded - 1; + + return decoded; +} + +/** + * soup_uri_decode: + * @part: a URI part + * + * Fully %-decodes @part. + * + * In the past, this would return %NULL if @part contained invalid + * percent-encoding, but now it just ignores the problem (as + * soup_uri_new() already did). + * + * Return value: the decoded URI part. + */ +char * +soup_uri_decode (const char *part) +{ + g_return_val_if_fail (part != NULL, NULL); + + return soup_uri_decoded_copy (part, strlen (part), NULL); +} + +static char * +uri_normalized_copy (const char *part, int length, + const char *unescape_extra) +{ + unsigned char *s, *d, c; + char *normalized = g_strndup (part, length); + gboolean need_fixup = FALSE; + + if (!unescape_extra) + unescape_extra = ""; + + s = d = (unsigned char *)normalized; + while (*s) { + if (*s == '%') { + if (!g_ascii_isxdigit (s[1]) || + !g_ascii_isxdigit (s[2])) { + *d++ = *s++; + continue; + } + + c = HEXCHAR (s); + if (soup_char_is_uri_unreserved (c) || + (c && strchr (unescape_extra, c))) { + *d++ = c; + s += 3; + } else { + /* We leave it unchanged. We used to uppercase percent-encoded + * triplets but we do not do it any more as RFC3986 Section 6.2.2.1 + * says that they only SHOULD be case normalized. + */ + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + } + } else { + if (!g_ascii_isgraph (*s) && + !strchr (unescape_extra, *s)) + need_fixup = TRUE; + *d++ = *s++; + } + } + *d = '\0'; + + if (need_fixup) { + GString *fixed; + + fixed = g_string_new (NULL); + s = (guchar *)normalized; + while (*s) { + if (g_ascii_isgraph (*s) || + strchr (unescape_extra, *s)) + g_string_append_c (fixed, *s); + else + g_string_append_printf (fixed, "%%%02X", (int)*s); + s++; + } + g_free (normalized); + normalized = g_string_free (fixed, FALSE); + } + + return normalized; +} + +/** + * soup_uri_normalize: + * @part: a URI part + * @unescape_extra: (allow-none): reserved characters to unescape (or %NULL) + * + * %-decodes any "unreserved" characters (or characters in + * @unescape_extra) in @part, and %-encodes any non-ASCII + * characters, spaces, and non-printing characters in @part. + * + * "Unreserved" characters are those that are not allowed to be used + * for punctuation according to the URI spec. For example, letters are + * unreserved, so soup_uri_normalize() will turn + * http://example.com/foo/b%61r into + * http://example.com/foo/bar, which is guaranteed + * to mean the same thing. However, "/" is "reserved", so + * http://example.com/foo%2Fbar would not + * be changed, because it might mean something different to the + * server. + * + * In the past, this would return %NULL if @part contained invalid + * percent-encoding, but now it just ignores the problem (as + * soup_uri_new() already did). + * + * Return value: the normalized URI part + */ +char * +soup_uri_normalize (const char *part, const char *unescape_extra) +{ + g_return_val_if_fail (part != NULL, NULL); + + return uri_normalized_copy (part, strlen (part), unescape_extra); +} + + +/** + * soup_uri_uses_default_port: + * @uri: a #SoupURI + * + * Tests if @uri uses the default port for its scheme. (Eg, 80 for + * http.) (This only works for http, https and ftp; libsoup does not know + * the default ports of other protocols.) + * + * Return value: %TRUE or %FALSE + **/ +gboolean +soup_uri_uses_default_port (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, FALSE); + g_warn_if_fail (SOUP_URI_IS_VALID (uri)); + + return uri->port == soup_scheme_default_port (uri->scheme); +} + +/** + * soup_uri_get_scheme: + * @uri: a #SoupURI + * + * Gets @uri's scheme. + * + * Return value: @uri's scheme. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_scheme (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->scheme; +} + +/** + * soup_uri_set_scheme: + * @uri: a #SoupURI + * @scheme: the URI scheme + * + * Sets @uri's scheme to @scheme. This will also set @uri's port to + * the default port for @scheme, if known. + **/ +void +soup_uri_set_scheme (SoupURI *uri, const char *scheme) +{ + g_return_if_fail (uri != NULL); + g_return_if_fail (scheme != NULL); + + uri->scheme = soup_uri_parse_scheme (scheme, strlen (scheme)); + uri->port = soup_scheme_default_port (uri->scheme); +} + +/** + * soup_uri_get_user: + * @uri: a #SoupURI + * + * Gets @uri's user. + * + * Return value: @uri's user. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_user (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->user; +} + +/** + * soup_uri_set_user: + * @uri: a #SoupURI + * @user: (allow-none): the username, or %NULL + * + * Sets @uri's user to @user. + **/ +void +soup_uri_set_user (SoupURI *uri, const char *user) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->user); + uri->user = g_strdup (user); +} + +/** + * soup_uri_get_password: + * @uri: a #SoupURI + * + * Gets @uri's password. + * + * Return value: @uri's password. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_password (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->password; +} + +/** + * soup_uri_set_password: + * @uri: a #SoupURI + * @password: (allow-none): the password, or %NULL + * + * Sets @uri's password to @password. + **/ +void +soup_uri_set_password (SoupURI *uri, const char *password) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->password); + uri->password = g_strdup (password); +} + +/** + * soup_uri_get_host: + * @uri: a #SoupURI + * + * Gets @uri's host. + * + * Return value: @uri's host. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_host (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->host; +} + +/** + * soup_uri_set_host: + * @uri: a #SoupURI + * @host: (allow-none): the hostname or IP address, or %NULL + * + * Sets @uri's host to @host. + * + * If @host is an IPv6 IP address, it should not include the brackets + * required by the URI syntax; they will be added automatically when + * converting @uri to a string. + * + * http and https URIs should not have a %NULL @host. + **/ +void +soup_uri_set_host (SoupURI *uri, const char *host) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->host); + uri->host = g_strdup (host); +} + +/** + * soup_uri_get_port: + * @uri: a #SoupURI + * + * Gets @uri's port. + * + * Return value: @uri's port. + * + * Since: 2.32 + **/ +guint +soup_uri_get_port (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, 0); + + return uri->port; +} + +/** + * soup_uri_set_port: + * @uri: a #SoupURI + * @port: the port, or 0 + * + * Sets @uri's port to @port. If @port is 0, @uri will not have an + * explicitly-specified port. + **/ +void +soup_uri_set_port (SoupURI *uri, guint port) +{ + g_return_if_fail (uri != NULL); + + uri->port = port; +} + +/** + * soup_uri_get_path: + * @uri: a #SoupURI + * + * Gets @uri's path. + * + * Return value: @uri's path. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_path (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->path; +} + +/** + * soup_uri_set_path: + * @uri: a #SoupURI + * @path: the non-%NULL path + * + * Sets @uri's path to @path. + **/ +void +soup_uri_set_path (SoupURI *uri, const char *path) +{ + g_return_if_fail (uri != NULL); + + /* We allow a NULL path for compatibility, but warn about it. */ + if (!path) { + g_warn_if_fail (path != NULL); + path = ""; + } + + g_free (uri->path); + uri->path = g_strdup (path); +} + +/** + * soup_uri_get_query: + * @uri: a #SoupURI + * + * Gets @uri's query. + * + * Return value: @uri's query. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_query (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->query; +} + +/** + * soup_uri_set_query: + * @uri: a #SoupURI + * @query: (allow-none): the query + * + * Sets @uri's query to @query. + **/ +void +soup_uri_set_query (SoupURI *uri, const char *query) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->query); + uri->query = g_strdup (query); +} + +/** + * soup_uri_set_query_from_form: + * @uri: a #SoupURI + * @form: (element-type utf8 utf8): a #GHashTable containing HTML form + * information + * + * Sets @uri's query to the result of encoding @form according to the + * HTML form rules. See soup_form_encode_hash() for more information. + **/ +void +soup_uri_set_query_from_form (SoupURI *uri, GHashTable *form) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->query); + uri->query = soup_form_encode_hash (form); +} + +/** + * soup_uri_set_query_from_fields: + * @uri: a #SoupURI + * @first_field: name of the first form field to encode into query + * @...: value of @first_field, followed by additional field names + * and values, terminated by %NULL. + * + * Sets @uri's query to the result of encoding the given form fields + * and values according to the * HTML form rules. See + * soup_form_encode() for more information. + **/ +void +soup_uri_set_query_from_fields (SoupURI *uri, + const char *first_field, + ...) +{ + va_list args; + + g_return_if_fail (uri != NULL); + + g_free (uri->query); + va_start (args, first_field); + uri->query = soup_form_encode_valist (first_field, args); + va_end (args); +} + +/** + * soup_uri_get_fragment: + * @uri: a #SoupURI + * + * Gets @uri's fragment. + * + * Return value: @uri's fragment. + * + * Since: 2.32 + **/ +const char * +soup_uri_get_fragment (SoupURI *uri) +{ + g_return_val_if_fail (uri != NULL, NULL); + + return uri->fragment; +} + +/** + * soup_uri_set_fragment: + * @uri: a #SoupURI + * @fragment: (allow-none): the fragment + * + * Sets @uri's fragment to @fragment. + **/ +void +soup_uri_set_fragment (SoupURI *uri, const char *fragment) +{ + g_return_if_fail (uri != NULL); + + g_free (uri->fragment); + uri->fragment = g_strdup (fragment); +} + +/** + * soup_uri_copy_host: + * @uri: a #SoupURI + * + * Makes a copy of @uri, considering only the protocol, host, and port + * + * Return value: the new #SoupURI + * + * Since: 2.28 + **/ +SoupURI * +soup_uri_copy_host (SoupURI *uri) +{ + SoupURI *dup; + + g_return_val_if_fail (uri != NULL, NULL); + g_warn_if_fail (SOUP_URI_IS_VALID (uri)); + + dup = soup_uri_new (NULL); + dup->scheme = uri->scheme; + dup->host = g_strdup (uri->host); + dup->port = uri->port; + dup->path = g_strdup (""); + + return dup; +} + +/** + * soup_uri_host_hash: + * @key: (type Soup.URI): a #SoupURI with a non-%NULL @host member + * + * Hashes @key, considering only the scheme, host, and port. + * + * Return value: a hash + * + * Since: 2.28 + **/ +guint +soup_uri_host_hash (gconstpointer key) +{ + const SoupURI *uri = key; + + g_return_val_if_fail (uri != NULL && uri->host != NULL, 0); + g_warn_if_fail (SOUP_URI_IS_VALID (uri)); + + return GPOINTER_TO_UINT (uri->scheme) + uri->port + + soup_str_case_hash (uri->host); +} + +/** + * soup_uri_host_equal: + * @v1: (type Soup.URI): a #SoupURI with a non-%NULL @host member + * @v2: (type Soup.URI): a #SoupURI with a non-%NULL @host member + * + * Compares @v1 and @v2, considering only the scheme, host, and port. + * + * Return value: whether or not the URIs are equal in scheme, host, + * and port. + * + * Since: 2.28 + **/ +gboolean +soup_uri_host_equal (gconstpointer v1, gconstpointer v2) +{ + const SoupURI *one = v1; + const SoupURI *two = v2; + + g_return_val_if_fail (one != NULL && two != NULL, one == two); + g_return_val_if_fail (one->host != NULL && two->host != NULL, one->host == two->host); + g_warn_if_fail (SOUP_URI_IS_VALID (one)); + g_warn_if_fail (SOUP_URI_IS_VALID (two)); + + if (one->scheme != two->scheme) + return FALSE; + if (one->port != two->port) + return FALSE; + + return g_ascii_strcasecmp (one->host, two->host) == 0; +} + +gboolean +soup_uri_is_http (SoupURI *uri, char **aliases) +{ + int i; + + if (uri->scheme == SOUP_URI_SCHEME_HTTP) + return TRUE; + else if (uri->scheme == SOUP_URI_SCHEME_HTTPS) + return FALSE; + else if (!aliases) + return FALSE; + + for (i = 0; aliases[i]; i++) { + if (uri->scheme == aliases[i]) + return TRUE; + } + + if (!aliases[1] && !strcmp (aliases[0], "*")) + return TRUE; + else + return FALSE; +} + +gboolean +soup_uri_is_https (SoupURI *uri, char **aliases) +{ + int i; + + if (uri->scheme == SOUP_URI_SCHEME_HTTPS) + return TRUE; + else if (uri->scheme == SOUP_URI_SCHEME_HTTP) + return FALSE; + else if (!aliases) + return FALSE; + + for (i = 0; aliases[i]; i++) { + if (uri->scheme == aliases[i]) + return TRUE; + } + + return FALSE; +} + +/* OSTREECHANGE: drop boxed type definition */ +/* G_DEFINE_BOXED_TYPE (SoupURI, soup_uri, soup_uri_copy, soup_uri_free) */ diff --git a/src/libostree/ostree-soup-uri.h b/src/libostree/ostree-soup-uri.h new file mode 100644 index 00000000..650b7efc --- /dev/null +++ b/src/libostree/ostree-soup-uri.h @@ -0,0 +1,147 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Copyright 1999-2002 Ximian, Inc. + */ + +/* NOTE - taken from the libsoup codebase for use by the ostree curl backend + * (yes, ironically enough). + * + * Please watch for future changes in libsoup. + */ + + +#ifndef SOUP_URI_H +#define SOUP_URI_H 1 + +/* OSTREECHANGE: make struct private + * Only include gio, and skip available definitions. + */ +#include +#define SOUP_AVAILABLE_IN_2_4 +#define SOUP_AVAILABLE_IN_2_28 +#define SOUP_AVAILABLE_IN_2_32 + +G_BEGIN_DECLS + +/* OSTREECHANGE: make struct private */ +typedef struct _SoupURI SoupURI; + +/* OSTREECHANGE: import soup-misc's interning */ +#define SOUP_VAR extern +#define _SOUP_ATOMIC_INTERN_STRING(variable, value) ((const char *)(g_atomic_pointer_get (&(variable)) ? (variable) : (g_atomic_pointer_set (&(variable), (gpointer)g_intern_static_string (value)), (variable)))) +#define SOUP_URI_SCHEME_HTTP _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_HTTP, "http") +#define SOUP_URI_SCHEME_HTTPS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_HTTPS, "https") +#define SOUP_URI_SCHEME_FTP _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_FTP, "ftp") +#define SOUP_URI_SCHEME_FILE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_FILE, "file") +#define SOUP_URI_SCHEME_DATA _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_DATA, "data") +#define SOUP_URI_SCHEME_RESOURCE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_RESOURCE, "resource") +#define SOUP_URI_SCHEME_WS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WS, "ws") +#define SOUP_URI_SCHEME_WSS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WSS, "wss") + +/* OSTREECHANGE: import soup-form bits */ +SOUP_AVAILABLE_IN_2_4 +char *soup_form_encode_hash (GHashTable *form_data_set); +SOUP_AVAILABLE_IN_2_4 +char *soup_form_encode_valist (const char *first_field, + va_list args); + +SOUP_VAR gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS; +SOUP_VAR gpointer _SOUP_URI_SCHEME_FTP; +SOUP_VAR gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE; +SOUP_VAR gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS; + +SOUP_AVAILABLE_IN_2_4 +SoupURI *soup_uri_new_with_base (SoupURI *base, + const char *uri_string); +SOUP_AVAILABLE_IN_2_4 +SoupURI *soup_uri_new (const char *uri_string); + +SOUP_AVAILABLE_IN_2_4 +char *soup_uri_to_string (SoupURI *uri, + gboolean just_path_and_query); + +SOUP_AVAILABLE_IN_2_4 +SoupURI *soup_uri_copy (SoupURI *uri); + +SOUP_AVAILABLE_IN_2_4 +gboolean soup_uri_equal (SoupURI *uri1, + SoupURI *uri2); + +SOUP_AVAILABLE_IN_2_4 +void soup_uri_free (SoupURI *uri); + +SOUP_AVAILABLE_IN_2_4 +char *soup_uri_encode (const char *part, + const char *escape_extra); +SOUP_AVAILABLE_IN_2_4 +char *soup_uri_decode (const char *part); +SOUP_AVAILABLE_IN_2_4 +char *soup_uri_normalize (const char *part, + const char *unescape_extra); + +SOUP_AVAILABLE_IN_2_4 +gboolean soup_uri_uses_default_port (SoupURI *uri); + +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_scheme (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_scheme (SoupURI *uri, + const char *scheme); +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_user (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_user (SoupURI *uri, + const char *user); +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_password (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_password (SoupURI *uri, + const char *password); +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_host (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_host (SoupURI *uri, + const char *host); +SOUP_AVAILABLE_IN_2_32 +guint soup_uri_get_port (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_port (SoupURI *uri, + guint port); +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_path (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_path (SoupURI *uri, + const char *path); +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_query (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_query (SoupURI *uri, + const char *query); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_query_from_form (SoupURI *uri, + GHashTable *form); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_query_from_fields (SoupURI *uri, + const char *first_field, + ...) G_GNUC_NULL_TERMINATED; +SOUP_AVAILABLE_IN_2_32 +const char *soup_uri_get_fragment (SoupURI *uri); +SOUP_AVAILABLE_IN_2_4 +void soup_uri_set_fragment (SoupURI *uri, + const char *fragment); + +SOUP_AVAILABLE_IN_2_28 +SoupURI *soup_uri_copy_host (SoupURI *uri); +SOUP_AVAILABLE_IN_2_28 +guint soup_uri_host_hash (gconstpointer key); +SOUP_AVAILABLE_IN_2_28 +gboolean soup_uri_host_equal (gconstpointer v1, + gconstpointer v2); + +#define SOUP_URI_IS_VALID(uri) ((uri) && (uri)->scheme && (uri)->path) +#define SOUP_URI_VALID_FOR_HTTP(uri) ((uri) && ((uri)->scheme == SOUP_URI_SCHEME_HTTP || (uri)->scheme == SOUP_URI_SCHEME_HTTPS) && (uri)->host && (uri)->path) + +G_END_DECLS + +#endif /*SOUP_URI_H*/ diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index cb5a4615..1cfe6ab1 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -1692,8 +1692,13 @@ is_ro_mount (const char *path) fs = mnt_table_find_target(tb, path, MNT_ITER_BACKWARD); is_mount = fs && mnt_fs_get_target (fs); - mnt_free_cache (cache); +#ifdef HAVE_MNT_UNREF_CACHE + mnt_unref_table (tb); + mnt_unref_cache (cache); +#else mnt_free_table (tb); + mnt_free_cache (cache); +#endif if (!is_mount) return FALSE; diff --git a/src/libostree/ostree-sysroot-upgrader.c b/src/libostree/ostree-sysroot-upgrader.c index daf2445c..232f8435 100644 --- a/src/libostree/ostree-sysroot-upgrader.c +++ b/src/libostree/ostree-sysroot-upgrader.c @@ -552,7 +552,8 @@ ostree_sysroot_upgrader_pull_one_dir (OstreeSysrootUpgrader *self, g_assert (self->merge_deployment); from_revision = ostree_deployment_get_csum (self->merge_deployment); - if (self->origin_remote) + if (self->origin_remote && + (upgrader_flags & OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC) == 0) { if (!ostree_repo_pull_one_dir (repo, self->origin_remote, dir_to_pull, refs_to_fetch, flags, progress, diff --git a/src/libostree/ostree-sysroot-upgrader.h b/src/libostree/ostree-sysroot-upgrader.h index 77bc8a1d..83c4ad32 100644 --- a/src/libostree/ostree-sysroot-upgrader.h +++ b/src/libostree/ostree-sysroot-upgrader.h @@ -85,7 +85,8 @@ gboolean ostree_sysroot_upgrader_check_timestamps (OstreeRepo *repo, typedef enum { OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE = 0, - OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER = (1 << 0) + OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER = (1 << 0), + OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC = (1 << 1) /* Don't actually do a pull, just check timestamps/changed */ } OstreeSysrootUpgraderPullFlags; _OSTREE_PUBLIC diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index ba21b467..da32653e 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -309,7 +309,10 @@ ot_gfile_ensure_unlinked (GFile *path, if (unlink (gs_file_get_path_cached (path)) != 0) { if (errno != ENOENT) - return FALSE; + { + glnx_set_error_from_errno (error); + return FALSE; + } } return TRUE; } diff --git a/src/ostree/ostree-trivial-httpd.c b/src/ostree/ostree-trivial-httpd.c index ddcb2fc0..d6f0c4d4 100644 --- a/src/ostree/ostree-trivial-httpd.c +++ b/src/ostree/ostree-trivial-httpd.c @@ -59,12 +59,12 @@ typedef struct { static GOptionEntry options[] = { { "daemonize", 'd', 0, G_OPTION_ARG_NONE, &opt_daemonize, "Fork into background when ready", NULL }, { "autoexit", 0, 0, G_OPTION_ARG_NONE, &opt_autoexit, "Automatically exit when directory is deleted", NULL }, - { "port", 'P', 0, G_OPTION_ARG_INT, &opt_port, "Use the specified TCP port", NULL }, + { "port", 'P', 0, G_OPTION_ARG_INT, &opt_port, "Use the specified TCP port", "PORT" }, { "port-file", 'p', 0, G_OPTION_ARG_FILENAME, &opt_port_file, "Write port number to PATH (- for standard output)", "PATH" }, { "force-range-requests", 0, 0, G_OPTION_ARG_NONE, &opt_force_ranges, "Force range requests by only serving half of files", NULL }, { "random-500s", 0, 0, G_OPTION_ARG_INT, &opt_random_500s_percentage, "Generate random HTTP 500 errors approximately for PERCENTAGE requests", "PERCENTAGE" }, { "random-500s-max", 0, 0, G_OPTION_ARG_INT, &opt_random_500s_max, "Limit HTTP 500 errors to MAX (default 100)", "MAX" }, - { "log-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_log, "Put logs here", "PATH" }, + { "log-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_log, "Put logs here (use - for stdout)", "PATH" }, { "expected-cookies", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_expected_cookies, "Expect given cookies in the http request", "KEY=VALUE" }, { "expected-header", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_expected_headers, "Expect given headers in the http request", "KEY=VALUE" }, { NULL } @@ -520,7 +520,7 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) } else { - g_autoptr(GFile) log_file; + g_autoptr(GFile) log_file = NULL; GFileOutputStream* log_stream; log_file = g_file_new_for_path (opt_log); @@ -601,9 +601,12 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) if (setsid () < 0) err (1, "setsid"); /* Daemonising: close stdout/stderr so $() et al work on us */ - freopen("/dev/null", "r", stdin); - freopen("/dev/null", "w", stdout); - freopen("/dev/null", "w", stderr); + if (freopen("/dev/null", "r", stdin) == NULL) + err (1, "freopen"); + if (freopen("/dev/null", "w", stdout) == NULL) + err (1, "freopen"); + if (freopen("/dev/null", "w", stderr) == NULL) + err (1, "freopen"); } else { diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c index 877cbe96..d72aeebd 100644 --- a/src/ostree/ot-admin-builtin-switch.c +++ b/src/ostree/ot-admin-builtin-switch.c @@ -53,6 +53,7 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro g_autofree char *new_remote = NULL; g_autofree char *new_ref = NULL; g_autofree char *new_refspec = NULL; + const char* remote; glnx_unref_object OstreeSysrootUpgrader *upgrader = NULL; glnx_unref_object OstreeAsyncProgress *progress = NULL; gboolean changed; @@ -101,12 +102,17 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro if (!ostree_parse_refspec (new_provided_refspec, &new_remote, &new_ref, error)) goto out; } - + if (!new_remote) - new_refspec = g_strconcat (origin_remote, ":", new_ref, NULL); + remote = origin_remote; else - new_refspec = g_strconcat (new_remote, ":", new_ref, NULL); - + remote = new_remote; + + if (remote) + new_refspec = g_strconcat (remote, ":", new_ref, NULL); + else + new_refspec = g_strdup (new_ref); + if (strcmp (origin_refspec, new_refspec) == 0) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index 394b339a..7c710ffc 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -34,6 +34,8 @@ static gboolean opt_reboot; static gboolean opt_allow_downgrade; +static gboolean opt_pull_only; +static gboolean opt_deploy_only; static char *opt_osname; static char *opt_override_commit; @@ -42,6 +44,8 @@ static GOptionEntry options[] = { { "reboot", 'r', 0, G_OPTION_ARG_NONE, &opt_reboot, "Reboot after a successful upgrade", NULL }, { "allow-downgrade", 0, 0, G_OPTION_ARG_NONE, &opt_allow_downgrade, "Permit deployment of chronologically older trees", NULL }, { "override-commit", 0, 0, G_OPTION_ARG_STRING, &opt_override_commit, "Deploy CHECKSUM instead of the latest tree", "CHECKSUM" }, + { "pull-only", 0, 0, G_OPTION_ARG_NONE, &opt_pull_only, "Do not create a deployment, just download", NULL }, + { "deploy-only", 0, 0, G_OPTION_ARG_NONE, &opt_deploy_only, "Do not pull, only deploy", NULL }, { NULL } }; @@ -64,6 +68,19 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr &sysroot, cancellable, error)) goto out; + if (opt_pull_only && opt_deploy_only) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Cannot simultaneously specify --pull-only and --deploy-only"); + goto out; + } + else if (opt_pull_only && opt_reboot) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Cannot simultaneously specify --pull-only and --reboot"); + goto out; + } + if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; @@ -104,6 +121,9 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr } } + if (opt_deploy_only) + upgraderpullflags |= OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC; + { g_auto(GLnxConsoleRef) console = { 0, }; glnx_console_lock (&console); @@ -112,11 +132,23 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr if (opt_allow_downgrade) upgraderpullflags |= OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER; - + if (!ostree_sysroot_upgrader_pull (upgrader, 0, upgraderpullflags, progress, &changed, cancellable, error)) - goto out; + { + /* In the pull-only case, we do a cleanup here to ensure that if + * multiple commits were pulled, we garbage collect any old + * partially-pulled intermediate commits before pulling more. This is + * really a best practice in general, but for maximum compatiblity, we + * only do cleanup if a user specifies the new --pull-only option. + * Otherwise, we would break the case of trying to deploy a commit that + * isn't directly referenced. + */ + if (opt_pull_only) + (void) ostree_sysroot_cleanup (sysroot, NULL, NULL); + goto out; + } if (progress) ostree_async_progress_finish (progress); @@ -128,8 +160,11 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr } else { - if (!ostree_sysroot_upgrader_deploy (upgrader, cancellable, error)) - goto out; + if (!opt_pull_only) + { + if (!ostree_sysroot_upgrader_deploy (upgrader, cancellable, error)) + goto out; + } if (opt_reboot) { diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c index 4760e532..0d8290a8 100644 --- a/src/ostree/ot-builtin-admin.c +++ b/src/ostree/ot-builtin-admin.c @@ -125,7 +125,7 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError * if (!subcommand->name) { g_autoptr(GOptionContext) context = NULL; - g_autofree char *help; + g_autofree char *help = NULL; context = ostree_admin_option_context_new_with_commands (); diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c index 95172f8b..74e27cfb 100644 --- a/src/ostree/ot-builtin-checkout.c +++ b/src/ostree/ot-builtin-checkout.c @@ -36,6 +36,7 @@ static gboolean opt_allow_noent; static gboolean opt_disable_cache; static char *opt_subpath; static gboolean opt_union; +static gboolean opt_union_add; static gboolean opt_whiteouts; static gboolean opt_from_stdin; static char *opt_from_file; @@ -63,6 +64,7 @@ static GOptionEntry options[] = { { "disable-cache", 0, 0, G_OPTION_ARG_NONE, &opt_disable_cache, "Do not update or use the internal repository uncompressed object cache", NULL }, { "subpath", 0, 0, G_OPTION_ARG_STRING, &opt_subpath, "Checkout sub-directory PATH", "PATH" }, { "union", 0, 0, G_OPTION_ARG_NONE, &opt_union, "Keep existing directories, overwrite existing files", NULL }, + { "union-add", 0, 0, G_OPTION_ARG_NONE, &opt_union_add, "Keep existing files/directories, only add new", NULL }, { "whiteouts", 0, 0, G_OPTION_ARG_NONE, &opt_whiteouts, "Process 'whiteout' (Docker style) entries", NULL }, { "allow-noent", 0, 0, G_OPTION_ARG_NONE, &opt_allow_noent, "Do nothing if specified path does not exist", NULL }, { "from-stdin", 0, 0, G_OPTION_ARG_NONE, &opt_from_stdin, "Process many checkouts from standard input", NULL }, @@ -87,14 +89,23 @@ process_one_checkout (OstreeRepo *repo, * `ostree_repo_checkout_at` until such time as we have a more * convenient infrastructure for testing C APIs with data. */ - if (opt_disable_cache || opt_whiteouts || opt_require_hardlinks) + if (opt_disable_cache || opt_whiteouts || opt_require_hardlinks || opt_union_add) { OstreeRepoCheckoutAtOptions options = { 0, }; - + if (opt_user_mode) options.mode = OSTREE_REPO_CHECKOUT_MODE_USER; - if (opt_union) + /* Can't union these */ + if (opt_union && opt_union_add) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Cannot specify both --union and --union-add"); + goto out; + } + else if (opt_union) options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES; + else if (opt_union_add) + options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES; if (opt_whiteouts) options.process_whiteouts = TRUE; if (subpath) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index d3b634f9..218fb701 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -32,6 +32,7 @@ static char *opt_subject; static char *opt_body; +static char *opt_body_file; static gboolean opt_editor; static char *opt_parent; static gboolean opt_orphan; @@ -74,6 +75,7 @@ static GOptionEntry options[] = { { "parent", 0, 0, G_OPTION_ARG_STRING, &opt_parent, "Parent ref, or \"none\"", "REF" }, { "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, "One line subject", "SUBJECT" }, { "body", 'm', 0, G_OPTION_ARG_STRING, &opt_body, "Full description", "BODY" }, + { "body-file", 'F', 0, G_OPTION_ARG_STRING, &opt_body_file, "Commit message from FILE path", "FILE" }, { "editor", 'e', 0, G_OPTION_ARG_NONE, &opt_editor, "Use an editor to write the commit message", NULL }, { "branch", 'b', 0, G_OPTION_ARG_STRING, &opt_branch, "Branch", "BRANCH" }, { "orphan", 0, 0, G_OPTION_ARG_NONE, &opt_orphan, "Create a commit without writing a ref", NULL }, @@ -349,6 +351,7 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError OstreeRepoCommitModifier *modifier = NULL; OstreeRepoTransactionStats stats; struct CommitFilterData filter_data = { 0, }; + g_autofree char *commit_body = NULL; context = g_option_context_new ("[PATH] - Commit a new revision"); @@ -441,9 +444,18 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError if (opt_editor) { - if (!commit_editor (repo, opt_branch, &opt_subject, &opt_body, cancellable, error)) + if (!commit_editor (repo, opt_branch, &opt_subject, &commit_body, cancellable, error)) goto out; } + else if (opt_body_file) + { + commit_body = glnx_file_get_contents_utf8_at (AT_FDCWD, opt_body_file, NULL, + cancellable, error); + if (!commit_body) + goto out; + } + else if (opt_body) + commit_body = g_strdup (opt_body); if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error)) goto out; @@ -576,7 +588,7 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError timestamp = g_date_time_to_unix (now); g_date_time_unref (now); - if (!ostree_repo_write_commit (repo, parent, opt_subject, opt_body, metadata, + if (!ostree_repo_write_commit (repo, parent, opt_subject, commit_body, metadata, OSTREE_REPO_FILE (root), &commit_checksum, cancellable, error)) goto out; @@ -592,7 +604,7 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError } timestamp = ts.tv_sec; - if (!ostree_repo_write_commit_with_time (repo, parent, opt_subject, opt_body, metadata, + if (!ostree_repo_write_commit_with_time (repo, parent, opt_subject, commit_body, metadata, OSTREE_REPO_FILE (root), timestamp, &commit_checksum, cancellable, error)) diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c index f370ca01..4287afcd 100644 --- a/src/ostree/ot-builtin-pull.c +++ b/src/ostree/ot-builtin-pull.c @@ -38,6 +38,7 @@ static char** opt_subpaths; static char** opt_http_headers; static char* opt_cache_dir; static int opt_depth = 0; +static int opt_frequency = 0; static char* opt_url; static GOptionEntry options[] = { @@ -53,6 +54,7 @@ static GOptionEntry options[] = { { "depth", 0, 0, G_OPTION_ARG_INT, &opt_depth, "Traverse DEPTH parents (-1=infinite) (default: 0)", "DEPTH" }, { "url", 0, 0, G_OPTION_ARG_STRING, &opt_url, "Pull objects from this URL instead of the one from the remote config", NULL }, { "http-header", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_http_headers, "Add NAME=VALUE as HTTP header to all requests", "NAME=VALUE" }, + { "update-frequency", 0, 0, G_OPTION_ARG_INT, &opt_frequency, "Sets the update frequency, in milliseconds (0=1000ms) (default: 0)", "FREQUENCY" }, { NULL } }; @@ -80,27 +82,41 @@ dry_run_console_progress_changed (OstreeAsyncProgress *progress, gpointer user_data) { guint fetched_delta_parts, total_delta_parts; - guint64 total_delta_part_size, total_delta_part_usize; + guint fetched_delta_part_fallbacks, total_delta_part_fallbacks; + guint64 fetched_delta_part_size, total_delta_part_size, total_delta_part_usize; GString *buf; g_assert (!printed_console_progress); printed_console_progress = TRUE; + /* Number of parts */ fetched_delta_parts = ostree_async_progress_get_uint (progress, "fetched-delta-parts"); total_delta_parts = ostree_async_progress_get_uint (progress, "total-delta-parts"); + fetched_delta_part_fallbacks = ostree_async_progress_get_uint (progress, "fetched-delta-fallbacks"); + total_delta_part_fallbacks = ostree_async_progress_get_uint (progress, "total-delta-fallbacks"); + /* Fold the count of deltaparts + fallbacks for simplicity; if changing this, + * please change ostree_repo_pull_default_console_progress_changed() first. + */ + fetched_delta_parts += fetched_delta_part_fallbacks; + total_delta_parts += total_delta_part_fallbacks; + /* Size variables */ + fetched_delta_part_size = ostree_async_progress_get_uint64 (progress, "fetched-delta-part-size"); total_delta_part_size = ostree_async_progress_get_uint64 (progress, "total-delta-part-size"); total_delta_part_usize = ostree_async_progress_get_uint64 (progress, "total-delta-part-usize"); buf = g_string_new (""); - { g_autofree char *formatted_size = + { g_autofree char *formatted_fetched = + g_format_size (fetched_delta_part_size); + g_autofree char *formatted_size = g_format_size (total_delta_part_size); g_autofree char *formatted_usize = g_format_size (total_delta_part_usize); - g_string_append_printf (buf, "Delta update: %u/%u parts, %s to transfer, %s uncompressed", + g_string_append_printf (buf, "Delta update: %u/%u parts, %s/%s, %s total uncompressed", fetched_delta_parts, total_delta_parts, - formatted_size, formatted_usize); + formatted_fetched, formatted_size, + formatted_usize); } g_print ("%s\n", buf->str); g_string_free (buf, TRUE); @@ -238,6 +254,9 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** g_variant_builder_add (&builder, "{s@v}", "depth", g_variant_new_variant (g_variant_new_int32 (opt_depth))); + g_variant_builder_add (&builder, "{s@v}", "update-frequency", + g_variant_new_variant (g_variant_new_uint32 (opt_frequency))); + g_variant_builder_add (&builder, "{s@v}", "disable-static-deltas", g_variant_new_variant (g_variant_new_boolean (opt_disable_static_deltas))); diff --git a/src/ostree/ot-builtin-remote.c b/src/ostree/ot-builtin-remote.c index 4f01cac2..f0667a42 100644 --- a/src/ostree/ot-builtin-remote.c +++ b/src/ostree/ot-builtin-remote.c @@ -114,7 +114,7 @@ ostree_builtin_remote (int argc, char **argv, GCancellable *cancellable, GError if (!subcommand->name) { g_autoptr(GOptionContext) context = NULL; - g_autofree char *help; + g_autofree char *help = NULL; context = remote_option_context_new_with_commands (); diff --git a/src/ostree/ot-builtin-static-delta.c b/src/ostree/ot-builtin-static-delta.c index c8843a65..1019f06f 100644 --- a/src/ostree/ot-builtin-static-delta.c +++ b/src/ostree/ot-builtin-static-delta.c @@ -33,6 +33,7 @@ static char *opt_min_fallback_size; static char *opt_max_bsdiff_size; static char *opt_max_chunk_size; static char *opt_endianness; +static char *opt_filename; static gboolean opt_empty; static gboolean opt_swap_endianness; static gboolean opt_inline; @@ -71,6 +72,7 @@ static GOptionEntry generate_options[] = { { "min-fallback-size", 0, 0, G_OPTION_ARG_STRING, &opt_min_fallback_size, "Minimum uncompressed size in megabytes for individual HTTP request", NULL}, { "max-bsdiff-size", 0, 0, G_OPTION_ARG_STRING, &opt_max_bsdiff_size, "Maximum size in megabytes to consider bsdiff compression for input files", NULL}, { "max-chunk-size", 0, 0, G_OPTION_ARG_STRING, &opt_max_chunk_size, "Maximum size of delta chunks in megabytes", NULL}, + { "filename", 0, 0, G_OPTION_ARG_STRING, &opt_filename, "Write the delta content to PATH (a directory). If not specified, the OSTree repository is used", "PATH"}, { NULL } }; @@ -322,6 +324,9 @@ ot_static_delta_builtin_generate (int argc, char **argv, GCancellable *cancellab if (opt_inline) g_variant_builder_add (parambuilder, "{sv}", "inline-parts", g_variant_new_boolean (TRUE)); + if (opt_filename) + g_variant_builder_add (parambuilder, "{sv}", + "filename", g_variant_new_bytestring (opt_filename)); g_variant_builder_add (parambuilder, "{sv}", "verbose", g_variant_new_boolean (TRUE)); if (opt_endianness || opt_swap_endianness) diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c index fb782275..3484b18e 100644 --- a/src/ostree/ot-main.c +++ b/src/ostree/ot-main.c @@ -171,7 +171,7 @@ ostree_run (int argc, if (!command->fn) { g_autoptr(GOptionContext) context = NULL; - g_autofree char *help; + g_autofree char *help = NULL; context = ostree_option_context_new_with_commands (commands); @@ -241,7 +241,16 @@ ostree_option_context_parse (GOptionContext *context, if (opt_version) { - g_print ("%s\n %s\n", PACKAGE_STRING, OSTREE_FEATURES); + /* This should now be YAML, like `docker version`, so it's both nice to read + * possible to parse */ + g_auto(GStrv) features = g_strsplit (OSTREE_FEATURES, " ", -1); + g_print ("%s:\n", PACKAGE_NAME); + g_print (" Version: %s\n", PACKAGE_VERSION); + if (strlen (OSTREE_GITREV) > 0) + g_print (" Git: %s\n", OSTREE_GITREV); + g_print (" Features:\n"); + for (char **iter = features; iter && *iter; iter++) + g_print (" - %s\n", *iter); exit (EXIT_SUCCESS); } diff --git a/src/ostree/ot-remote-builtin-add-cookie.c b/src/ostree/ot-remote-builtin-add-cookie.c index 509c9c7a..e4156172 100644 --- a/src/ostree/ot-remote-builtin-add-cookie.c +++ b/src/ostree/ot-remote-builtin-add-cookie.c @@ -21,13 +21,12 @@ #include "config.h" -#include - #include "otutil.h" #include "ot-main.h" #include "ot-remote-builtins.h" #include "ostree-repo-private.h" +#include "ot-remote-cookie-util.h" static GOptionEntry option_entries[] = { @@ -46,8 +45,6 @@ ot_remote_builtin_add_cookie (int argc, char **argv, GCancellable *cancellable, const char *value; g_autofree char *jar_path = NULL; g_autofree char *cookie_file = NULL; - glnx_unref_object SoupCookieJar *jar = NULL; - SoupCookie *cookie; context = g_option_context_new ("NAME DOMAIN PATH COOKIE_NAME VALUE - Add a cookie to remote"); @@ -70,15 +67,8 @@ ot_remote_builtin_add_cookie (int argc, char **argv, GCancellable *cancellable, cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); jar_path = g_build_filename (gs_file_get_path_cached (repo->repodir), cookie_file, NULL); - jar = soup_cookie_jar_text_new (jar_path, FALSE); - - /* Pick a silly long expire time, we're just storing the cookies in the - * jar and on pull the jar is read-only so expiry has little actual value */ - cookie = soup_cookie_new (cookie_name, value, domain, path, - SOUP_COOKIE_MAX_AGE_ONE_YEAR * 25); - - /* jar takes ownership of cookie */ - soup_cookie_jar_add_cookie (jar, cookie); + if (!ot_add_cookie_at (AT_FDCWD, jar_path, domain, path, cookie_name, value, error)) + return FALSE; return TRUE; } diff --git a/src/ostree/ot-remote-builtin-delete-cookie.c b/src/ostree/ot-remote-builtin-delete-cookie.c index d974dd8d..6d1b85ad 100644 --- a/src/ostree/ot-remote-builtin-delete-cookie.c +++ b/src/ostree/ot-remote-builtin-delete-cookie.c @@ -21,14 +21,13 @@ #include "config.h" -#include - #include "otutil.h" +#include #include "ot-main.h" #include "ot-remote-builtins.h" #include "ostree-repo-private.h" - +#include "ot-remote-cookie-util.h" static GOptionEntry option_entries[] = { { NULL } @@ -45,9 +44,6 @@ ot_remote_builtin_delete_cookie (int argc, char **argv, GCancellable *cancellabl const char *cookie_name; g_autofree char *jar_path = NULL; g_autofree char *cookie_file = NULL; - glnx_unref_object SoupCookieJar *jar = NULL; - GSList *cookies; - gboolean found = FALSE; context = g_option_context_new ("NAME DOMAIN PATH COOKIE_NAME- Remote one cookie from remote"); @@ -69,28 +65,8 @@ ot_remote_builtin_delete_cookie (int argc, char **argv, GCancellable *cancellabl cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); jar_path = g_build_filename (gs_file_get_path_cached (repo->repodir), cookie_file, NULL); - jar = soup_cookie_jar_text_new (jar_path, FALSE); - cookies = soup_cookie_jar_all_cookies (jar); + if (!ot_delete_cookie_at (AT_FDCWD, jar_path, domain, path, cookie_name, error)) + return FALSE; - while (cookies != NULL) - { - SoupCookie *cookie = cookies->data; - - if (!strcmp (domain, soup_cookie_get_domain (cookie)) && - !strcmp (path, soup_cookie_get_path (cookie)) && - !strcmp (cookie_name, soup_cookie_get_name (cookie))) - { - soup_cookie_jar_delete_cookie (jar, cookie); - - found = TRUE; - } - - soup_cookie_free (cookie); - cookies = g_slist_delete_link (cookies, cookies); - } - - if (!found) - g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Cookie not found in jar"); - - return found; + return TRUE; } diff --git a/src/ostree/ot-remote-builtin-list-cookies.c b/src/ostree/ot-remote-builtin-list-cookies.c index 1865fb07..1c3924af 100644 --- a/src/ostree/ot-remote-builtin-list-cookies.c +++ b/src/ostree/ot-remote-builtin-list-cookies.c @@ -21,14 +21,12 @@ #include "config.h" -#include - #include "otutil.h" #include "ot-main.h" #include "ot-remote-builtins.h" #include "ostree-repo-private.h" - +#include "ot-remote-cookie-util.h" static GOptionEntry option_entries[] = { { NULL } @@ -42,8 +40,6 @@ ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable const char *remote_name; g_autofree char *jar_path = NULL; g_autofree char *cookie_file = NULL; - glnx_unref_object SoupCookieJar *jar = NULL; - GSList *cookies; context = g_option_context_new ("NAME - Show remote repository cookies"); @@ -62,25 +58,8 @@ ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); jar_path = g_build_filename (g_file_get_path (repo->repodir), cookie_file, NULL); - jar = soup_cookie_jar_text_new (jar_path, TRUE); - cookies = soup_cookie_jar_all_cookies (jar); - - while (cookies != NULL) - { - SoupCookie *cookie = cookies->data; - SoupDate *expiry = soup_cookie_get_expires (cookie); - - g_print ("--\n"); - g_print ("Domain: %s\n", soup_cookie_get_domain (cookie)); - g_print ("Path: %s\n", soup_cookie_get_path (cookie)); - g_print ("Name: %s\n", soup_cookie_get_name (cookie)); - g_print ("Secure: %s\n", soup_cookie_get_secure (cookie) ? "yes" : "no"); - g_print ("Expires: %s\n", soup_date_to_string (expiry, SOUP_DATE_COOKIE)); - g_print ("Value: %s\n", soup_cookie_get_value (cookie)); - - soup_cookie_free (cookie); - cookies = g_slist_delete_link (cookies, cookies); - } + if (!ot_list_cookies_at (AT_FDCWD, jar_path, error)) + return FALSE; return TRUE; } diff --git a/src/ostree/ot-remote-cookie-util.c b/src/ostree/ot-remote-cookie-util.c new file mode 100644 index 00000000..a96038aa --- /dev/null +++ b/src/ostree/ot-remote-cookie-util.c @@ -0,0 +1,333 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2015 Red Hat, Inc. + * Copyright (C) 2016 Sjoerd Simons + * + * 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. + */ + +#include "config.h" + +#include "ot-remote-cookie-util.h" + +#ifndef HAVE_LIBCURL +#include +#endif + +#include "otutil.h" +#include "ot-main.h" +#include "ot-remote-builtins.h" +#include "ostree-repo-private.h" + +typedef struct OtCookieParser OtCookieParser; +struct OtCookieParser { + char *buf; + char *iter; + + char *line; + char *domain; + char *flag; + char *path; + char *secure; + long long unsigned int expiration; + char *name; + char *value; +}; +void ot_cookie_parser_free (OtCookieParser *parser); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtCookieParser, ot_cookie_parser_free) + +gboolean +ot_parse_cookies_at (int dfd, const char *path, + OtCookieParser **out_parser, + GCancellable *cancellable, + GError **error); +gboolean +ot_parse_cookies_next (OtCookieParser *parser); + +static void +ot_cookie_parser_clear (OtCookieParser *parser) +{ + g_clear_pointer (&parser->domain, (GDestroyNotify)g_free); + g_clear_pointer (&parser->flag, (GDestroyNotify)g_free); + g_clear_pointer (&parser->path, (GDestroyNotify)g_free); + g_clear_pointer (&parser->secure, (GDestroyNotify)g_free); + g_clear_pointer (&parser->name, (GDestroyNotify)g_free); + g_clear_pointer (&parser->value, (GDestroyNotify)g_free); +} + +void +ot_cookie_parser_free (OtCookieParser *parser) +{ + ot_cookie_parser_clear (parser); + g_free (parser->buf); + g_free (parser); +} + +gboolean +ot_parse_cookies_at (int dfd, const char *path, + OtCookieParser **out_parser, + GCancellable *cancellable, + GError **error) +{ + OtCookieParser *parser; + g_autofree char *cookies_content = NULL; + glnx_fd_close int infd = -1; + + infd = openat (dfd, path, O_RDONLY | O_CLOEXEC); + if (infd < 0) + { + if (errno != ENOENT) + { + glnx_set_error_from_errno (error); + return FALSE; + } + } + else + { + cookies_content = glnx_fd_readall_utf8 (infd, NULL, cancellable, error); + if (!cookies_content) + return FALSE; + } + + parser = *out_parser = g_new0 (OtCookieParser, 1); + parser->buf = g_steal_pointer (&cookies_content); + parser->iter = parser->buf; + return TRUE; +} + +gboolean +ot_parse_cookies_next (OtCookieParser *parser) +{ + while (parser->iter) + { + char *iter = parser->iter; + char *next = strchr (iter, '\n'); + + if (next) + { + *next = '\0'; + parser->iter = next + 1; + } + else + parser->iter = NULL; + + ot_cookie_parser_clear (parser); + if (sscanf (iter, "%ms\t%ms\t%ms\t%ms\t%llu\t%ms\t%ms", + &parser->domain, + &parser->flag, + &parser->path, + &parser->secure, + &parser->expiration, + &parser->name, + &parser->value) != 7) + continue; + + parser->line = iter; + return TRUE; + } + + return FALSE; +} + +gboolean +ot_add_cookie_at (int dfd, const char *jar_path, + const char *domain, const char *path, + const char *name, const char *value, + GError **error) +{ +#ifdef HAVE_LIBCURL + glnx_fd_close int fd = openat (AT_FDCWD, jar_path, O_WRONLY | O_APPEND | O_CREAT, 0644); + g_autofree char *buf = NULL; + g_autoptr(GDateTime) now = NULL; + g_autoptr(GDateTime) expires = NULL; + + if (fd < 0) + { + glnx_set_error_from_errno (error); + return FALSE; + } + + now = g_date_time_new_now_utc (); + expires = g_date_time_add_years (now, 25); + + /* Adapted from soup-cookie-jar-text.c:write_cookie() */ + buf = g_strdup_printf ("%s\t%s\t%s\t%s\t%llu\t%s\t%s\n", + domain, + *domain == '.' ? "TRUE" : "FALSE", + path, + "FALSE", + (long long unsigned)g_date_time_to_unix (expires), + name, + value); + if (glnx_loop_write (fd, buf, strlen (buf)) < 0) + { + glnx_set_error_from_errno (error); + return FALSE; + } +#else + glnx_unref_object SoupCookieJar *jar = NULL; + SoupCookie *cookie; + + jar = soup_cookie_jar_text_new (jar_path, FALSE); + + /* Pick a silly long expire time, we're just storing the cookies in the + * jar and on pull the jar is read-only so expiry has little actual value */ + cookie = soup_cookie_new (name, value, domain, path, + SOUP_COOKIE_MAX_AGE_ONE_YEAR * 25); + + /* jar takes ownership of cookie */ + soup_cookie_jar_add_cookie (jar, cookie); +#endif + return TRUE; +} + +gboolean +ot_delete_cookie_at (int dfd, const char *jar_path, + const char *domain, const char *path, + const char *name, + GError **error) +{ + gboolean found = FALSE; +#ifdef HAVE_LIBCURL + glnx_fd_close int tempfile_fd = -1; + g_autofree char *tempfile_path = NULL; + g_autofree char *dnbuf = NULL; + const char *dn = NULL; + g_autoptr(OtCookieParser) parser = NULL; + + if (!ot_parse_cookies_at (dfd, jar_path, &parser, NULL, error)) + return FALSE; + + dnbuf = g_strdup (jar_path); + dn = dirname (dnbuf); + if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, dn, O_WRONLY | O_CLOEXEC, + &tempfile_fd, &tempfile_path, + error)) + return FALSE; + + while (ot_parse_cookies_next (parser)) + { + if (strcmp (domain, parser->domain) == 0 && + strcmp (path, parser->path) == 0 && + strcmp (name, parser->name) == 0) + { + found = TRUE; + /* Match, skip writing this one */ + continue; + } + + if (glnx_loop_write (tempfile_fd, parser->line, strlen (parser->line)) < 0 || + glnx_loop_write (tempfile_fd, "\n", 1) < 0) + { + glnx_set_error_from_errno (error); + return FALSE; + } + } + + if (!glnx_link_tmpfile_at (AT_FDCWD, GLNX_LINK_TMPFILE_REPLACE, + tempfile_fd, + tempfile_path, + AT_FDCWD, jar_path, + error)) + return FALSE; +#else + GSList *cookies; + glnx_unref_object SoupCookieJar *jar = NULL; + + jar = soup_cookie_jar_text_new (jar_path, FALSE); + cookies = soup_cookie_jar_all_cookies (jar); + + while (cookies != NULL) + { + SoupCookie *cookie = cookies->data; + + if (!strcmp (domain, soup_cookie_get_domain (cookie)) && + !strcmp (path, soup_cookie_get_path (cookie)) && + !strcmp (name, soup_cookie_get_name (cookie))) + { + soup_cookie_jar_delete_cookie (jar, cookie); + + found = TRUE; + } + + soup_cookie_free (cookie); + cookies = g_slist_delete_link (cookies, cookies); + } +#endif + + if (!found) + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Cookie not found in jar"); + + return TRUE; +} + + +gboolean +ot_list_cookies_at (int dfd, const char *jar_path, GError **error) +{ +#ifdef HAVE_LIBCURL + glnx_fd_close int tempfile_fd = -1; + g_autofree char *tempfile_path = NULL; + g_autofree char *dnbuf = NULL; + const char *dn = NULL; + g_autoptr(OtCookieParser) parser = NULL; + + if (!ot_parse_cookies_at (AT_FDCWD, jar_path, &parser, NULL, error)) + return FALSE; + + dnbuf = dirname (g_strdup (jar_path)); + dn = dnbuf; + if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, dn, O_WRONLY | O_CLOEXEC, + &tempfile_fd, &tempfile_path, + error)) + return FALSE; + + while (ot_parse_cookies_next (parser)) + { + g_autoptr(GDateTime) expires = g_date_time_new_from_unix_utc (parser->expiration); + g_autofree char *expires_str = g_date_time_format (expires, "%Y-%m-%d %H:%M:%S +0000"); + + g_print ("--\n"); + g_print ("Domain: %s\n", parser->domain); + g_print ("Path: %s\n", parser->path); + g_print ("Name: %s\n", parser->name); + g_print ("Secure: %s\n", parser->secure); + g_print ("Expires: %s\n", expires_str); + g_print ("Value: %s\n", parser->value); + } +#else + glnx_unref_object SoupCookieJar *jar = soup_cookie_jar_text_new (jar_path, TRUE); + GSList *cookies = soup_cookie_jar_all_cookies (jar); + + while (cookies != NULL) + { + SoupCookie *cookie = cookies->data; + SoupDate *expiry = soup_cookie_get_expires (cookie); + + g_print ("--\n"); + g_print ("Domain: %s\n", soup_cookie_get_domain (cookie)); + g_print ("Path: %s\n", soup_cookie_get_path (cookie)); + g_print ("Name: %s\n", soup_cookie_get_name (cookie)); + g_print ("Secure: %s\n", soup_cookie_get_secure (cookie) ? "yes" : "no"); + g_print ("Expires: %s\n", soup_date_to_string (expiry, SOUP_DATE_COOKIE)); + g_print ("Value: %s\n", soup_cookie_get_value (cookie)); + + soup_cookie_free (cookie); + cookies = g_slist_delete_link (cookies, cookies); + } +#endif + return TRUE; +} diff --git a/src/libostree/ostree-enumtypes.h b/src/ostree/ot-remote-cookie-util.h similarity index 55% rename from src/libostree/ostree-enumtypes.h rename to src/ostree/ot-remote-cookie-util.h index 95b516d1..1bcc0e87 100644 --- a/src/libostree/ostree-enumtypes.h +++ b/src/ostree/ot-remote-cookie-util.h @@ -1,8 +1,6 @@ - -/* Generated data (by glib-mkenums) */ - -/* - * Copyright (C) 2015 Red Hat, Inc. +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2017 Colin Walters * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,20 +20,23 @@ #pragma once -#include +#include "libglnx.h" G_BEGIN_DECLS -/* Enumerations from "./src/libostree/ostree-fetcher.h" */ +gboolean +ot_add_cookie_at (int dfd, const char *jar_path, + const char *domain, const char *path, + const char *name, const char *value, + GError **error); -#define OSTREE_TYPE_FETCHER_CONFIG_FLAGS (_ostree_fetcher_config_flags_get_type ()) -GType _ostree_fetcher_config_flags_get_type (void) G_GNUC_CONST; +gboolean +ot_delete_cookie_at (int dfd, const char *jar_path, + const char *domain, const char *path, + const char *name, + GError **error); -#define OSTREE_TYPE_FETCHER_REQUEST_FLAGS (_ostree_fetcher_request_flags_get_type ()) -GType _ostree_fetcher_request_flags_get_type (void) G_GNUC_CONST; +gboolean +ot_list_cookies_at (int dfd, const char *jar_path, GError **error); G_END_DECLS - - -/* Generated data ends here */ - diff --git a/src/rofiles-fuse/main.c b/src/rofiles-fuse/main.c index ac44a438..3f0832f5 100644 --- a/src/rofiles-fuse/main.c +++ b/src/rofiles-fuse/main.c @@ -344,6 +344,26 @@ callback_create(const char *path, mode_t mode, struct fuse_file_info *finfo) return do_open (path, mode, finfo); } +static int +callback_read_buf (const char *path, struct fuse_bufvec **bufp, + size_t size, off_t offset, struct fuse_file_info *finfo) +{ + struct fuse_bufvec *src; + + src = malloc (sizeof (struct fuse_bufvec)); + if (src == NULL) + return -ENOMEM; + + *src = FUSE_BUFVEC_INIT (size); + + src->buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK; + src->buf[0].fd = finfo->fh; + src->buf[0].pos = offset; + *bufp = src; + + return 0; +} + static int callback_read (const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *finfo) @@ -355,6 +375,19 @@ callback_read (const char *path, char *buf, size_t size, off_t offset, return r; } +static int +callback_write_buf (const char *path, struct fuse_bufvec *buf, off_t offset, + struct fuse_file_info *finfo) +{ + struct fuse_bufvec dst = FUSE_BUFVEC_INIT (fuse_buf_size (buf)); + + dst.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK; + dst.buf[0].fd = finfo->fh; + dst.buf[0].pos = offset; + + return fuse_buf_copy (&dst, buf, FUSE_BUF_SPLICE_NONBLOCK); +} + static int callback_write (const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *finfo) @@ -454,7 +487,9 @@ struct fuse_operations callback_oper = { .utime = callback_utime, .create = callback_create, .open = callback_open, + .read_buf = callback_read_buf, .read = callback_read, + .write_buf = callback_write_buf, .write = callback_write, .statfs = callback_statfs, .release = callback_release, diff --git a/tests/basic-test.sh b/tests/basic-test.sh index 5cad8ab3..045e4217 100644 --- a/tests/basic-test.sh +++ b/tests/basic-test.sh @@ -19,7 +19,11 @@ set -euo pipefail -echo "1..60" +echo "1..63" + +$CMD_PREFIX ostree --version > version.yaml +python -c 'import yaml; yaml.safe_load(open("version.yaml"))' +echo "ok yaml version" $OSTREE checkout test2 checkout-test2 echo "ok checkout" @@ -115,6 +119,22 @@ omitted_rev=$($OSTREE commit -b test2-no-subject-2 --timestamp="2005-10-29 12:43 assert_streq $empty_rev $omitted_rev echo "ok commit no subject" +cd ${test_tmpdir} +cat >commitmsg.txt < 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 '^ *Crunchy-With.*true$' +$OSTREE refs --delete branch-with-commitmsg +echo "ok commit body file" + cd ${test_tmpdir} $OSTREE commit -b test2-custom-parent -s '' $test_tmpdir/checkout-test2-4 $OSTREE commit -b test2-custom-parent -s '' $test_tmpdir/checkout-test2-4 @@ -259,6 +279,24 @@ cd checkout-test2-union assert_file_has_content ./yet/another/tree/green "leaf" echo "ok checkout union 1" +cd ${test_tmpdir} +$OSTREE commit -b test-union-add --tree=ref=test2 +$OSTREE checkout test-union-add checkout-test-union-add +echo 'file for union add testing' > checkout-test-union-add/union-add-test +echo 'another file for union add testing' > checkout-test-union-add/union-add-test2 +$OSTREE commit -b test-union-add --tree=dir=checkout-test-union-add +rm checkout-test-union-add -rf +# Check out previous +$OSTREE checkout test-union-add^ checkout-test-union-add +assert_not_has_file checkout-test-union-add/union-add-test +assert_not_has_file checkout-test-union-add/union-add-test2 +# Now create a file we don't want overwritten +echo 'existing file for union add' > checkout-test-union-add/union-add-test +$OSTREE checkout --union-add test-union-add checkout-test-union-add +assert_file_has_content checkout-test-union-add/union-add-test 'existing file for union add' +assert_file_has_content checkout-test-union-add/union-add-test2 'another file for union add testing' +echo "ok checkout union add" + cd ${test_tmpdir} rm -rf shadow-repo mkdir shadow-repo diff --git a/tests/libtest.sh b/tests/libtest.sh index 927b8b1a..0126827e 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -270,6 +270,106 @@ setup_fake_remote_repo1() { export OSTREE="${CMD_PREFIX} ostree --repo=repo" } +# Set up a large repository for stress testing. +# Something like the Fedora Atomic Workstation branch which has +# objects: meta: 7497 content: 103541 +# 9443 directories, 7097 symlinks, 112832 regfiles +# So we'll make ~11 files per dir, with one of them a symlink +# Actually, let's cut this down to 1/3 which is still useful. So: +# 3147 dirs, with still ~11 files per dir, for 37610 content objects +setup_exampleos_repo() { + args=${1:-} + cd ${test_tmpdir} + mkdir ostree-srv + mkdir -p ostree-srv/exampleos/{repo,build-repo} + export ORIGIN_REPO=ostree-srv/exampleos/repo + export ORIGIN_BUILD_REPO=ostree-srv/exampleos/build-repo + ${CMD_PREFIX} ostree --repo=${ORIGIN_REPO} init --mode=archive + ${CMD_PREFIX} ostree --repo=${ORIGIN_BUILD_REPO} init --mode=bare-user + cd ${test_tmpdir} + rm main -rf + mkdir main + cd main + ndirs=3147 + depth=0 + set +x # No need to spam the logs for this + echo "$(date): Generating initial content..." + while [ $ndirs -gt 0 ]; do + # 2/3 of the time, recurse a dir, up to a max of 9, otherwise back up + x=$(($ndirs % 3)) + case $x in + 0) if [ $depth -gt 0 ]; then cd ..; depth=$((depth-1)); fi ;; + 1|2) if [ $depth -lt 9 ]; then + mkdir dir-${ndirs} + cd dir-${ndirs} + depth=$((depth+1)) + else + if [ $depth -gt 0 ]; then cd ..; depth=$((depth-1)); fi + fi ;; + esac + # One symlink - we use somewhat predictable content to have dupes + ln -s $(($x % 20)) link-$ndirs + # 10 files + nfiles=10 + while [ $nfiles -gt 0 ]; do + echo file-$ndirs-$nfiles > f$ndirs-$nfiles + # Make an unreadable file to trigger https://github.com/ostreedev/ostree/pull/634 + if [ $(($x % 10)) -eq 0 ]; then + chmod 0600 f$ndirs-$nfiles + fi + nfiles=$((nfiles-1)) + done + ndirs=$((ndirs-1)) + done + cd ${test_tmpdir} + set -x + + export REF=exampleos/42/standard + + ${CMD_PREFIX} ostree --repo=${ORIGIN_BUILD_REPO} commit -b ${REF} --tree=dir=main + rm main -rf + ${CMD_PREFIX} ostree --repo=${ORIGIN_BUILD_REPO} checkout ${REF} main + + find main > files.txt + nfiles=$(wc -l files.txt | cut -f 1 -d ' ') + # We'll make 5 more commits + for iter in $(seq 5); do + set +x + # Change 10% of files + for fiter in $(seq $(($nfiles / 10))); do + filenum=$(($RANDOM % ${nfiles})) + set +o pipefail + filename=$(tail -n +${filenum} < files.txt | head -1) + set -o pipefail + if test -f $filename; then + rm -f $filename + echo file-${iter}-${fiter} > ${filename} + fi + done + set -x + ${CMD_PREFIX} ostree --repo=${ORIGIN_BUILD_REPO} commit --link-checkout-speedup -b ${REF} --tree=dir=main + done + + ${CMD_PREFIX} ostree --repo=${ORIGIN_REPO} pull-local --depth=-1 ${ORIGIN_BUILD_REPO} + + for x in "^^" "^" ""; do + ${CMD_PREFIX} ostree --repo=${ORIGIN_REPO} static-delta generate --from="${REF}${x}^" --to="${REF}${x}" + done + ${CMD_PREFIX} ostree --repo=${ORIGIN_REPO} summary -u + + cd ${test_tmpdir}/ostree-srv + mkdir httpd + ${OSTREE_HTTPD} --autoexit --log-file $(pwd)/httpd/httpd.log --daemonize -p httpd/port $args + port=$(cat httpd/port) + echo "http://127.0.0.1:${port}" > httpd/address + + cd ${test_tmpdir} + rm repo -rf + ${CMD_PREFIX} ostree --repo=repo init --mode=bare-user + ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat ostree-srv/httpd/address)/exampleos/repo + export OSTREE="${CMD_PREFIX} ostree --repo=repo" +} + setup_os_boot_syslinux() { # Stub syslinux configuration mkdir -p sysroot/boot/loader.0 @@ -438,7 +538,10 @@ skip_without_fuse () { } has_gpgme () { - ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme' + ${CMD_PREFIX} ostree --version > version.txt + assert_file_has_content version.txt '- gpgme' + rm -f version.txt + true } libtest_cleanup_gpg () { diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 56b24a0c..f6176079 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -35,7 +35,7 @@ function verify_initial_contents() { assert_file_has_content baz/cow '^moo$' } -echo "1..14" +echo "1..15" # Try both syntaxes repo_init @@ -69,6 +69,16 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main ${CMD_PREFIX} ostree --repo=mirrorrepo fsck echo "ok pull mirror (should not apply deltas)" +cd ${test_tmpdir} +if ${CMD_PREFIX} ostree --repo=mirrorrepo \ + pull origin main --require-static-deltas 2>err.txt; then + assert_not_reached "--require-static-deltas unexpectedly succeeded" +fi +assert_file_has_content err.txt "Can't use static deltas in an archive repo" +${CMD_PREFIX} ostree --repo=mirrorrepo pull origin main +${CMD_PREFIX} ostree --repo=mirrorrepo fsck +echo "ok pull (refuses deltas)" + cd ${test_tmpdir} rm mirrorrepo/refs/remotes/* -rf ${CMD_PREFIX} ostree --repo=mirrorrepo prune --refs-only @@ -144,7 +154,8 @@ cd ${test_tmpdir} repo_init ${CMD_PREFIX} ostree --repo=repo pull origin main@${prev_rev} ${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin main >dry-run-pull.txt -assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts' +# Compression can vary, so we support 400-699 +assert_file_has_content dry-run-pull.txt 'Delta update: 0/1 parts, 0 bytes/[456][0-9][0-9] bytes, 455 bytes total uncompressed' rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main) assert_streq "${prev_rev}" "${rev}" ${CMD_PREFIX} ostree --repo=repo fsck diff --git a/tests/test-admin-pull-deploy-split.sh b/tests/test-admin-pull-deploy-split.sh new file mode 100755 index 00000000..7a6750e2 --- /dev/null +++ b/tests/test-admin-pull-deploy-split.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Copyright (C) 2017 Colin Walters +# +# 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. + +# See https://github.com/ostreedev/ostree/pull/642 + +set -euo pipefail + +. $(dirname $0)/libtest.sh + +echo "1..1" + +setup_os_repository "archive-z2" "syslinux" + +cd ${test_tmpdir} +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +parent_rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse ${rev}^) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime@${parent_rev} +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0 +assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0 +# Do a pull, this one should get us new content +${CMD_PREFIX} ostree admin upgrade --os=testos --pull-only --os=testos > out.txt +assert_not_file_has_content out.txt 'No update available' +# And pull again should still tell us we have new content +${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-testos-0.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-testos-0.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 +assert_file_has_content out.txt 'No update available' + +echo 'ok upgrade --pull-only + --deploy-only' diff --git a/tests/test-delta.sh b/tests/test-delta.sh index bb523b47..b9883830 100755 --- a/tests/test-delta.sh +++ b/tests/test-delta.sh @@ -26,7 +26,7 @@ skip_without_user_xattrs bindatafiles="bash true ostree" morebindatafiles="false ls" -echo '1..11' +echo '1..12' mkdir repo ${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2 @@ -121,6 +121,14 @@ if ${CMD_PREFIX} ostree --repo=repo static-delta generate --from=${origrev} --to assert_not_reached "static-delta generate --from=${origrev} --empty unexpectedly succeeded" fi +${CMD_PREFIX} ostree --repo=temp-repo init --mode=archive +${CMD_PREFIX} ostree --repo=temp-repo pull-local repo +${CMD_PREFIX} ostree --repo=temp-repo static-delta generate --empty --to=${newrev} --filename=some.delta +assert_has_file some.delta +${CMD_PREFIX} ostree --repo=temp-repo static-delta list > delta-list.txt +assert_file_has_content delta-list.txt 'No static deltas' +rm temp-repo -rf + echo 'ok generate' ${CMD_PREFIX} ostree --repo=repo static-delta show ${origrev}-${newrev} > show.txt @@ -160,7 +168,7 @@ echo 'ok heuristic endian detection' ${CMD_PREFIX} ostree --repo=repo summary -u -mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=archive-z2 +mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user ${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${newrev} ${CMD_PREFIX} ostree --repo=repo2 fsck ${CMD_PREFIX} ostree --repo=repo2 ls ${newrev} >/dev/null @@ -228,7 +236,7 @@ echo 'ok generate + show empty delta part' ${CMD_PREFIX} ostree --repo=repo summary -u rm -rf repo2 -mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=archive-z2 +mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user ${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${newrev} ${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${samerev} ${CMD_PREFIX} ostree --repo=repo2 fsck @@ -236,6 +244,17 @@ ${CMD_PREFIX} ostree --repo=repo2 ls ${samerev} >/dev/null echo 'ok pull empty delta part' +# Make a new branch to test "rebase deltas" +echo otherbranch-content > files/otherbranch-content +${CMD_PREFIX} ostree --repo=repo commit -b otherbranch --tree=dir=files +samerev=$(${CMD_PREFIX} ostree --repo=repo rev-parse test) +${CMD_PREFIX} ostree --repo=repo static-delta generate --from=test --to=otherbranch +${CMD_PREFIX} ostree --repo=repo summary -u +${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo otherbranch + +echo 'ok rebase deltas' + +${CMD_PREFIX} ostree --repo=repo summary -u if ${CMD_PREFIX} ostree --repo=repo static-delta show GARBAGE 2> err.txt; then assert_not_reached "static-delta show GARBAGE unexpectedly succeeded" fi diff --git a/tests/test-libarchive.sh b/tests/test-libarchive.sh index 0c579459..6540b94b 100755 --- a/tests/test-libarchive.sh +++ b/tests/test-libarchive.sh @@ -19,7 +19,7 @@ set -euo pipefail -if ! ostree --version | grep -q -e '\+libarchive'; then +if ! ostree --version | grep -q -e '- libarchive'; then echo "1..0 #SKIP no libarchive support compiled in" exit 0 fi diff --git a/tests/test-pull-many.sh b/tests/test-pull-many.sh index d90280d5..73245a6b 100755 --- a/tests/test-pull-many.sh +++ b/tests/test-pull-many.sh @@ -21,80 +21,32 @@ set -euo pipefail . $(dirname $0)/libtest.sh -setup_fake_remote_repo1 "archive-z2" -cd ${test_tmpdir} -rm ostree-srv/gnomerepo/ -rf -mkdir ostree-srv/gnomerepo/ -${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo init --mode=archive +setup_exampleos_repo -echo '1..1' - -# Simulate a large archive pull from scratch. Large here is -# something like the Fedora Atomic Workstation branch which has -# objects: meta: 7497 content: 103541 -# 9443 directories, 7097 symlinks, 112832 regfiles -# So we'll make ~11 files per dir, with one of them a symlink +echo '1..3' cd ${test_tmpdir} -rm main -rf -mkdir main -cd main -ndirs=9443 -depth=0 -echo "$(date): Generating content..." -set +x # No need to spam the logs for this -while [ $ndirs -gt 0 ]; do - # 2/3 of the time, recurse a dir, up to a max of 9, otherwise back up - x=$(($ndirs % 3)) - case $x in - 0) if [ $depth -gt 0 ]; then cd ..; depth=$((depth-1)); fi ;; - 1|2) if [ $depth -lt 9 ]; then - mkdir dir-${ndirs} - cd dir-${ndirs} - depth=$((depth+1)) - else - if [ $depth -gt 0 ]; then cd ..; depth=$((depth-1)); fi - fi ;; - esac - - # One symlink - we use somewhat predictable content to have dupes - ln -s $(($x % 20)) link-$ndirs - # 10 files - nfiles=10 - while [ $nfiles -gt 0 ]; do - echo file-$ndirs-$nfiles > f$ndirs-$nfiles - nfiles=$((nfiles-1)) - done - ndirs=$((ndirs-1)) -done set -x -cd ${test_tmpdir} -mkdir build-repo -${CMD_PREFIX} ostree --repo=build-repo init --mode=bare-user -echo "$(date): Committing content..." -${CMD_PREFIX} ostree --repo=build-repo commit -b main -s 'big!' --tree=dir=main -for x in commit dirtree dirmeta file; do - find build-repo/objects -name '*.'${x} |wc -l > ${x}count - echo "$x: " $(cat ${x}count) -done -assert_file_has_content commitcount '^1$' -assert_file_has_content dirmetacount '^1$' -assert_file_has_content filecount '^94433$' -${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo pull-local build-repo echo "$(date): Pulling content..." -rm repo -rf -${CMD_PREFIX} ostree --repo=repo init --mode=archive -${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo - -${CMD_PREFIX} ostree --repo=repo pull --mirror origin main +rev=$(${CMD_PREFIX} ostree --repo=ostree-srv/exampleos/repo rev-parse ${REF}) +${CMD_PREFIX} ostree --repo=repo pull --disable-static-deltas origin ${REF} +${CMD_PREFIX} ostree --repo=repo fsck +assert_streq ${rev} $(${CMD_PREFIX} ostree --repo=repo rev-parse ${REF}) + +echo "ok without deltas" + +previous=$(${CMD_PREFIX} ostree --repo=repo rev-parse ${rev}^) +rm repo/refs/{heads,remotes}/* -rf +${CMD_PREFIX} ostree --repo=repo prune --refs-only +${CMD_PREFIX} ostree --repo=repo pull origin ${REF}@${previous} +${CMD_PREFIX} ostree --repo=repo pull --dry-run --require-static-deltas origin ${REF} > output.txt +assert_file_has_content output.txt 'Delta update: 0/1 parts, 0 bytes/1.[012] MB, 1.[345] MB total uncompressed' + +echo "ok delta dry-run" + +${CMD_PREFIX} ostree --repo=repo pull --require-static-deltas origin ${REF} +assert_streq $(${CMD_PREFIX} ostree --repo=repo rev-parse ${REF}) ${rev} ${CMD_PREFIX} ostree --repo=repo fsck -for x in commit dirtree dirmeta filez; do - find repo/objects -name '*.'${x} |wc -l > ${x}count - echo "$x: " $(cat ${x}count) -done -assert_file_has_content commitcount '^1$' -assert_file_has_content dirmetacount '^1$' -assert_file_has_content filezcount '^94433$' echo "ok" diff --git a/tests/test-remote-cookies.sh b/tests/test-remote-cookies.sh index 11c201f1..ab2bf263 100755 --- a/tests/test-remote-cookies.sh +++ b/tests/test-remote-cookies.sh @@ -28,12 +28,9 @@ setup_fake_remote_repo1 "archive-z2" "" \ "--expected-cookies foo=bar --expected-cookies baz=badger" assert_fail (){ - set +e - $@ - if [ $? = 0 ] ; then - echo 1>&2 "$@ did not fail"; exit 1 + if $@; then + (echo 1>&2 "$@ did not fail"; exit 1) fi - set -euo pipefail } cd ${test_tmpdir} @@ -50,12 +47,16 @@ echo "ok, setup done" # Add 2 cookies, pull should succeed now ${CMD_PREFIX} ostree --repo=repo remote add-cookie origin 127.0.0.1 / foo bar ${CMD_PREFIX} ostree --repo=repo remote add-cookie origin 127.0.0.1 / baz badger +assert_file_has_content repo/origin.cookies.txt foo.*bar +assert_file_has_content repo/origin.cookies.txt baz.*badger ${CMD_PREFIX} ostree --repo=repo pull origin main echo "ok, initial cookie pull succeeded" # Delete one cookie, if successful pulls will fail again ${CMD_PREFIX} ostree --repo=repo remote delete-cookie origin 127.0.0.1 / baz badger +assert_file_has_content repo/origin.cookies.txt foo.*bar +assert_not_file_has_content repo/origin.cookies.txt baz.*badger assert_fail ${CMD_PREFIX} ostree --repo=repo pull origin main echo "ok, delete succeeded" @@ -63,6 +64,8 @@ echo "ok, delete succeeded" # Re-add the removed cooking and things succeed again, verified the removal # removed exactly one cookie ${CMD_PREFIX} ostree --repo=repo remote add-cookie origin 127.0.0.1 / baz badger +assert_file_has_content repo/origin.cookies.txt foo.*bar +assert_file_has_content repo/origin.cookies.txt baz.*badger ${CMD_PREFIX} ostree --repo=repo pull origin main echo "ok, second cookie pull succeeded" diff --git a/tests/test-rofiles-fuse.sh b/tests/test-rofiles-fuse.sh index 4dfec514..56045c61 100755 --- a/tests/test-rofiles-fuse.sh +++ b/tests/test-rofiles-fuse.sh @@ -78,6 +78,6 @@ assert_file_has_content mnt/test2-checkout-copy-fallback/anewfile-for-fuse anewf if ${CMD_PREFIX} ostree --repo=repo checkout -UH test2 mnt/test2-checkout-copy-hardlinked 2>err.txt; then assert_not_reached "Checking out via hardlinks across mountpoint unexpectedly succeeded!" fi -assert_file_has_content err.txt "Invalid cross-device link" +assert_file_has_content err.txt "Unable to do hardlink checkout across devices" echo "ok checkout copy fallback" diff --git a/tests/test-rollsum.c b/tests/test-rollsum.c index 1ed99645..37c8bab8 100644 --- a/tests/test-rollsum.c +++ b/tests/test-rollsum.c @@ -137,9 +137,35 @@ test_rollsum (void) test_rollsum_helper (a, MAX_BUFFER_SIZE, b, MAX_BUFFER_SIZE, FALSE); } +#define BUP_SELFTEST_SIZE 100000 + +static void +test_bupsplit_sum(void) +{ + g_autofree uint8_t *buf = g_malloc (BUP_SELFTEST_SIZE); + uint32_t sum1a, sum1b, sum2a, sum2b, sum3a, sum3b; + unsigned count; + + for (count = 0; count < BUP_SELFTEST_SIZE; count++) + buf[count] = g_random_int_range (0, 256); + + sum1a = bupsplit_sum(buf, 0, BUP_SELFTEST_SIZE); + sum1b = bupsplit_sum(buf, 1, BUP_SELFTEST_SIZE); + sum2a = bupsplit_sum(buf, BUP_SELFTEST_SIZE - BUP_WINDOWSIZE*5/2, + BUP_SELFTEST_SIZE - BUP_WINDOWSIZE); + sum2b = bupsplit_sum(buf, 0, BUP_SELFTEST_SIZE - BUP_WINDOWSIZE); + sum3a = bupsplit_sum(buf, 0, BUP_WINDOWSIZE+3); + sum3b = bupsplit_sum(buf, 3, BUP_WINDOWSIZE+3); + + g_assert_cmpint (sum1a, ==, sum1b); + g_assert_cmpint (sum2a, ==, sum2b); + g_assert_cmpint (sum3a, ==, sum3b); +} + int main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/rollsum", test_rollsum); + g_test_add_func ("/bupsum", test_bupsplit_sum); return g_test_run(); }