From dafa404606acf09a3ea342508b0a27338757863b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 19 Mar 2021 22:23:16 +0000 Subject: [PATCH 01/33] configure: post-release version bump --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 26713077..e3d6b779 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ AC_PREREQ([2.63]) dnl To perform a release, follow the instructions in `docs/CONTRIBUTING.md`. m4_define([year_version], [2021]) -m4_define([release_version], [1]) +m4_define([release_version], [2]) m4_define([package_version], [year_version.release_version]) AC_INIT([libostree], [package_version], [walters@verbum.org]) -is_release_build=yes +is_release_build=no AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([buildutil]) AC_CONFIG_AUX_DIR([build-aux]) From ca2ea1455f6aa090944092b8472c917738cf36f4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 26 Mar 2021 17:32:51 +0000 Subject: [PATCH 02/33] .lgtm.yml: Add package deps I was recently looking at systemd's CI and came across this. AFAICS it's a proprietary analysis but it looks useful. We still have `clang-analyzer` for example for FOSS analysis. --- .lgtm.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .lgtm.yml diff --git a/.lgtm.yml b/.lgtm.yml new file mode 100644 index 00000000..8eec4480 --- /dev/null +++ b/.lgtm.yml @@ -0,0 +1,40 @@ +# See https://lgtm.com/ +extraction: + cpp: + prepare: + packages: + - "autoconf-archive" + - "libcurl4-openssl-dev" + - "libjson-c-dev" + - "libssl-dev" + - "acl" + - "attr" + - "bison" + - "cpio" + - "debhelper" + - "dh-autoreconf" + - "dh-systemd" + - "docbook-xml" + - "docbook-xsl" + - "e2fslibs-dev" + - "elfutils" + - "fuse" + - "gjs" + - "gnome-desktop-testing" + - "gobject-introspection" + - "gtk-doc-tools" + - "libarchive-dev" + - "libattr1-dev" + - "libcap-dev" + - "libfuse-dev" + - "libgirepository1.0-dev" + - "libglib2.0-dev" + - "libgpgme11-dev" + - "liblzma-dev" + - "libmount-dev" + - "libselinux1-dev" + - "libsoup2.4-dev" + - "libcurl4-openssl-dev" + - "procps" + - "zlib1g-dev" + - "python3-yaml" From 47bf29fed3b99d72c153d3c1581bf9a19c7a9b6d Mon Sep 17 00:00:00 2001 From: Felix Krull Date: Fri, 26 Mar 2021 20:31:01 +0100 Subject: [PATCH 03/33] lib: fix some version tags --- src/libostree/ostree-repo-static-delta-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index c2536724..e4280af0 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -178,7 +178,7 @@ ostree_repo_list_static_delta_names (OstreeRepo *self, * This function synchronously enumerates all static delta indexes in the * repository, returning its result in @out_indexes. * - * Since: 2020.7 + * Since: 2020.8 */ gboolean ostree_repo_list_static_delta_indexes (OstreeRepo *self, @@ -1254,6 +1254,8 @@ file_has_content (OstreeRepo *repo, * This is normally called automatically when the summary is updated in ostree_repo_regenerate_summary(). * * Locking: shared + * + * Since: 2020.8 */ gboolean ostree_repo_static_delta_reindex (OstreeRepo *repo, From 7170cf9efda8f97d75c31d6415180b8895a5a479 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 26 Mar 2021 21:38:51 +0000 Subject: [PATCH 04/33] installdeps: Drop PyYAML Doesn't exist anymore in f33 and we don't depend on python2 anymore. --- ci/installdeps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/installdeps.sh b/ci/installdeps.sh index 6880d91d..89b7ac12 100755 --- a/ci/installdeps.sh +++ b/ci/installdeps.sh @@ -18,7 +18,7 @@ pkg_upgrade pkg_install_buildroot pkg_builddep ostree pkg_install sudo which attr fuse strace \ - libubsan libasan libtsan PyYAML redhat-rpm-config \ + libubsan libasan libtsan redhat-rpm-config \ elfutils if test -n "${CI_PKGS:-}"; then pkg_install ${CI_PKGS} From cb0fd2bf93b52335225ad3921b4897bc8cc30266 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 26 Mar 2021 21:52:26 +0000 Subject: [PATCH 05/33] tests/pull-test: Use mv -f in a few cases For some reason I'm hitting this locally because some files are mode `0`. Which is clearly a different bug but anyways we don't want to prompt. --- tests/pull-test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 08921838..5e719bf8 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -196,7 +196,7 @@ if ! skip_one_without_user_xattrs; then # Preserve user.ostreemeta xattr cp -a ${path}{,.new} (dd if=${path} conv=swab) > ${path}.new - mv ${path}{.new,} + mv -f ${path}{.new,} if ${CMD_PREFIX} ostree --repo=cacherepo fsck 2>err.txt; then fatal "corrupt repo fsck?" fi @@ -631,12 +631,12 @@ if has_gpgme; then objpath=objects/${csum::2}/${csum:2}.commitmeta remotesig=ostree-srv/gnomerepo/$objpath localsig=repo/$objpath - mv $remotesig $remotesig.bak + mv -f $remotesig $remotesig.bak if ${CMD_PREFIX} ostree --repo=repo --depth=0 pull origin main; then assert_not_reached "pull with gpg-verify unexpectedly succeeded?" fi # ok now check that we can pull correctly - mv $remotesig.bak $remotesig + mv -f $remotesig.bak $remotesig ${CMD_PREFIX} ostree --repo=repo pull origin main echo "ok pull signed commit" rm $localsig From 6d0bb10bf07b3b793b091d5cb78049266bd28e41 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 26 Mar 2021 14:12:37 +0000 Subject: [PATCH 06/33] cci: Update for buildroot changes See latest in https://github.com/coreos/fedora-coreos-tracker/blob/master/docs/ci-and-builds.md --- .cci.jenkinsfile | 42 +++++++++++++++++++---------------- tests/kolainst/libinsttest.sh | 4 ++-- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 6a51594a..35c5f3d4 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -3,7 +3,7 @@ stage("Build") { parallel normal: { def n = 5 - cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") { + buildPod(runAsUser:0, memory: "2Gi", cpu: "${n}") { checkout scm stage("Core build") { shwrap(""" @@ -21,19 +21,25 @@ parallel normal: { make syntax-check """) } finally { + shwrap("cat test-suite.log || true") archiveArtifacts allowEmptyArchive: true, artifacts: 'test-suite.log' } } - shwrap(""" - make install DESTDIR=\$(pwd)/insttree/ - tar -c -C insttree/ -zvf insttree.tar.gz . - """) - stash includes: 'insttree.tar.gz', name: 'build' + stage("Build installed tests") { + shwrap("make -C tests/kolainst") + } + stage("Generate artifacts") { + shwrap(""" + make install DESTDIR=\$(pwd)/installed/rootfs + make -C tests/kolainst install DESTDIR=\$(pwd)/installed/tests + """) + } + stash includes: "installed/", name: 'build' } }, // A minimal build, helps test our build options minimal: { - cosaPod(buildroot: true, runAsUser: 0) { + buildPod(runAsUser:0) { checkout scm shwrap(""" git submodule update --init @@ -48,7 +54,7 @@ minimal: { } }, codestyle: { - cosaPod { + buildPod(runAsUser:0) { checkout scm shwrap(""" # Jenkins by default only fetches the branch it's testing. Explicitly fetch master @@ -63,27 +69,25 @@ codestyle: { // Build FCOS and do a kola basic run stage("More builds and test") { parallel fcos: { - cosaPod(buildroot: true, runAsUser: 0, memory: "3072Mi", cpu: "4") { + cosaPod(runAsUser: 0, memory: "3072Mi", cpu: "4") { stage("Build FCOS") { checkout scm unstash 'build' shwrap(""" - mkdir insttree - tar -C insttree -xzvf insttree.tar.gz - rsync -rlv insttree/ / + # Move the bits into the cosa pod + rsync -rlv installed/rootfs/ / + rsync -rlv installed/tests/ / coreos-assembler init --force https://github.com/coreos/fedora-coreos-config mkdir -p overrides/rootfs - mv insttree/* overrides/rootfs/ - rmdir insttree + # And override the on-host bits + mv installed/rootfs/* overrides/rootfs/ + rm installed -rf coreos-assembler fetch coreos-assembler build coreos-assembler buildextend-metal coreos-assembler buildextend-metal4k coreos-assembler buildextend-live --fast - # Install the tests - # Build and install the tests - make -C tests/kolainst - make -C tests/kolainst install + """) } stage("Test") { @@ -102,7 +106,7 @@ parallel fcos: { }, buildopts: { def n = 5 - cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") { + buildPod(memory: "2Gi", cpu: "${n}") { checkout scm shwrap(""" git submodule update --init diff --git a/tests/kolainst/libinsttest.sh b/tests/kolainst/libinsttest.sh index bf40a285..50c1a184 100644 --- a/tests/kolainst/libinsttest.sh +++ b/tests/kolainst/libinsttest.sh @@ -41,8 +41,8 @@ run_tmp_webserver() { dir=$1 port=8000 - podman create --name ostree-httpd --privileged -ti --net=host -v "${dir}":/srv --workdir /srv \ - registry.svc.ci.openshift.org/coreos/fedora:31 python3 -m http.server "${port}" + podman create --name ostree-httpd --privileged --user root -ti --net=host -v "${dir}":/srv --workdir /srv \ + quay.io/coreos-assembler/fcos-buildroot:testing-devel python3 -m http.server "${port}" podman generate systemd ostree-httpd > /etc/systemd/system/ostree-httpd.service systemctl daemon-reload systemctl start ostree-httpd.service From 0c0e58e06c3f63302fd68552b9a15f35df0bdbb2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 30 Mar 2021 20:00:13 +0000 Subject: [PATCH 07/33] repo: Fix load_variant_if_exists to return a nullable value Another introspection fix I hit when trying to use this in Rust. --- src/libostree/ostree-repo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 0c045c41..40841c7b 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -4452,12 +4452,13 @@ ostree_repo_query_object_storage_size (OstreeRepo *self, * @self: Repo * @objtype: Object type * @sha256: ASCII checksum - * @out_variant: (out) (transfer full): Metadata + * @out_variant: (out) (nullable) (transfer full): Metadata * @error: 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. + * @out_variant will be set to %NULL and the function will still + * return TRUE. */ gboolean ostree_repo_load_variant_if_exists (OstreeRepo *self, From 57270db9a1c75daa4ec11ab9f1bb41609c29214b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 30 Mar 2021 20:51:51 +0000 Subject: [PATCH 08/33] repo: Ensure load_variant_if_exists sets NULL value Spotted by @jlebon - we usually expect callers to zero, but let's be explicit. --- src/libostree/ostree-repo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 40841c7b..b2347b47 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3686,6 +3686,10 @@ load_metadata_internal (OstreeRepo *self, g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE); g_return_val_if_fail (objtype == OSTREE_OBJECT_TYPE_COMMIT || out_state == NULL, FALSE); + /* Ensure this is set to NULL if we didn't find the object */ + if (out_variant) + *out_variant = NULL; + /* Special caching for dirmeta objects, since they're commonly referenced many * times. */ From 81d3017463492f69b0e07a7496e70135da01bac9 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Wed, 31 Mar 2021 16:41:32 -0400 Subject: [PATCH 09/33] rofiles-fuse: Enable support for setting and getting xattrs Enable support for setting and getting xattrs. Allow modifications to xattrs only on user.ima xattr. Signed-off-by: Stefan Berger Co-authored-by: Colin Walters --- src/rofiles-fuse/main.c | 36 ++++++++++++++++++++++++++++++++---- tests/test-rofiles-fuse.sh | 22 +++++++++++++++++++++- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/rofiles-fuse/main.c b/src/rofiles-fuse/main.c index 4033caa4..7ace1af0 100644 --- a/src/rofiles-fuse/main.c +++ b/src/rofiles-fuse/main.c @@ -533,14 +533,29 @@ static int callback_setxattr (const char *path, const char *name, const char *value, size_t size, int flags) { - return -ENOTSUP; + PATH_WRITE_ENTRYPOINT (path); + + char buf[PATH_MAX]; + snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", basefd, path); + + if (setxattr (buf, name, value, size, flags) == -1) + return -errno; + return 0; } static int callback_getxattr (const char *path, const char *name, char *value, size_t size) { - return -ENOTSUP; + path = ENSURE_RELPATH (path); + + char buf[PATH_MAX]; + snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", basefd, path); + + ssize_t n = getxattr (buf, name, value, size); + if (n == -1) + return -errno; + return n; } /* @@ -549,8 +564,15 @@ callback_getxattr (const char *path, const char *name, char *value, static int callback_listxattr (const char *path, char *list, size_t size) { - return -ENOTSUP; + path = ENSURE_RELPATH (path); + char buf[PATH_MAX]; + snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", basefd, path); + + ssize_t n = llistxattr (buf, list, size); + if (n == -1) + return -errno; + return n; } /* @@ -559,8 +581,14 @@ callback_listxattr (const char *path, char *list, size_t size) static int callback_removexattr (const char *path, const char *name) { - return -ENOTSUP; + path = ENSURE_RELPATH (path); + char buf[PATH_MAX]; + snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", basefd, path); + + if (lremovexattr (buf, name) == -1) + return -errno; + return 0; } struct fuse_operations callback_oper = { diff --git a/tests/test-rofiles-fuse.sh b/tests/test-rofiles-fuse.sh index 1e09711c..55816899 100755 --- a/tests/test-rofiles-fuse.sh +++ b/tests/test-rofiles-fuse.sh @@ -28,7 +28,7 @@ skip_without_user_xattrs setup_test_repository "bare" -echo "1..11" +echo "1..12" cd ${test_tmpdir} mkdir mnt @@ -75,6 +75,10 @@ fi assert_file_has_content err.txt "chown:.*Read-only file system" echo "ok failed mutation chmod + chown" +if setfattr -n user.foo -v bar mnt/firstfile-link; then + assert_not_reached "set xattr on linked file" +fi + # Test creating new files, using chown + chmod on them as well echo anewfile-for-fuse > mnt/anewfile-for-fuse assert_file_has_content mnt/anewfile-for-fuse anewfile-for-fuse @@ -94,8 +98,14 @@ for i in $(seq 5); do chown $(id -u) mnt/newfusedir/test-morenewfuse.${i} done assert_file_has_content checkout-test2/newfusedir/test-morenewfuse.3 3-morenewfuse-3 + echo "ok new content" +setfattr -n user.foo -v bar mnt/anewfile-for-fuse +getfattr -d -m . mnt/anewfile-for-fuse > out.txt +assert_file_has_content_literal out.txt 'user.foo="bar"' +echo "ok new xattrs" + rm mnt/baz/cow assert_not_has_file checkout-test2/baz/cow rm mnt/baz/another -rf @@ -152,6 +162,16 @@ firstfile_new_inode=$(stat -c %i checkout-test2/firstfile) assert_not_streq "${firstfile_orig_inode}" "${firstfile_new_inode}" assert_test_file -f checkout-test2/firstfile +# Test xattr modifications +copyup_reset +firstfile_orig_inode=$(stat -c %i checkout-test2/firstfile) +setfattr -n user.foo -v bar mnt/firstfile +getfattr -d -m . mnt/firstfile > out.txt +assert_file_has_content_literal out.txt 'user.foo="bar"' +firstfile_new_inode=$(stat -c %i checkout-test2/firstfile) +assert_not_streq "${firstfile_orig_inode}" "${firstfile_new_inode}" +assert_test_file -f checkout-test2/firstfile + copyup_reset firstfile_link_orig_inode=$(stat -c %i checkout-test2/firstfile-link) firstfile_orig_inode=$(stat -c %i checkout-test2/firstfile) From ac38372f4988c48686463d8ce691235f2ea1983c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 5 Apr 2021 21:00:07 +0000 Subject: [PATCH 10/33] build-sys: Include all mkinitcpio bits It's still so tempting to switch to `git archive` to ship sources. Closes: https://github.com/ostreedev/ostree/issues/2312 --- Makefile-boot.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile-boot.am b/Makefile-boot.am index b51928f0..9a04bbdb 100644 --- a/Makefile-boot.am +++ b/Makefile-boot.am @@ -65,7 +65,7 @@ endif EXTRA_DIST += src/boot/dracut/module-setup.sh \ src/boot/dracut/ostree.conf \ - src/boot/mkinitcpio/ostree \ + src/boot/mkinitcpio \ src/boot/ostree-prepare-root.service \ src/boot/ostree-finalize-staged.path \ src/boot/ostree-remount.service \ From 80e4f27a599935ae2b98f469c8c5cd8b3889bc09 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 26 Mar 2021 19:46:25 +0000 Subject: [PATCH 11/33] manual-tests: Fix unused variables lgtm.com harshly makes our JS grade "D" due to these unused variables. --- manual-tests/upgrade-loop.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/manual-tests/upgrade-loop.js b/manual-tests/upgrade-loop.js index 15b9eddd..72086d58 100644 --- a/manual-tests/upgrade-loop.js +++ b/manual-tests/upgrade-loop.js @@ -24,9 +24,6 @@ // could watch the output, and assert that the system is in a // consistent state if this script is killed and restarted. randomly. -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; - const OSTree = imports.gi.OSTree; let sysroot = OSTree.Sysroot.new_default(); From b5c21defe9a66d601941a2408fd1aca310588108 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 27 Mar 2021 14:06:22 +0000 Subject: [PATCH 12/33] core: Fix lgtm.com warning about always true `if (bits > 0)` Since we're not going to change this, let's constant fold the logic here. --- src/libostree/ostree-core.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index f822101a..252b19a4 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -391,24 +391,18 @@ variant_to_lenprefixed_buffer (GVariant *variant) const guint32 variant_size_u32_be = GUINT32_TO_BE((guint32) variant_size); g_string_append_len (buf, (char*)&variant_size_u32_be, sizeof (variant_size_u32_be)); - const gsize alignment_offset = sizeof (variant_size_u32_be); /* Write NULs for alignment. At the moment this is a constant 4 bytes (i.e. - * align to 8, since the length is 4 bytes). For now, I decided to keep some - * of the (now legacy) more generic logic here in case we want to revive it - * later. + * align to 8, since the length is 4 bytes). If we ever change this, the + * logic is here: */ - const guint alignment = 8; - const guchar padding_nuls[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - guint bits; - if (alignment == 8) - bits = alignment_offset & 7; /* mod 8 */ - else - bits = alignment_offset & 3; /* mod 4 */ - const guint padding_len = alignment - bits; - - if (bits > 0) - g_string_append_len (buf, (char*)padding_nuls, padding_len); + // const gsize alignment_offset = sizeof (variant_size_u32_be); + // const guint bits = alignment_offset & 7; /* mod 8 */ + // const guint padding_len = alignment - bits; + #define padding_len sizeof(guint32) + const guchar padding_nuls[padding_len] = {0, 0, 0, 0}; + g_string_append_len (buf, (char*)padding_nuls, padding_len); + #undef padding_len g_string_append_len (buf, (char*)g_variant_get_data (variant), g_variant_get_size (variant)); return g_string_free_to_bytes (g_steal_pointer (&buf)); From 35d4e657e7a3cd38dca34b412632706cbaf4a5db Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 17:36:04 +0000 Subject: [PATCH 13/33] tests: Drop openat override No longer needed. --- tests/inst/Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index 3301616d..0986c0a7 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -46,7 +46,3 @@ with-procspawn-tempdir = { git = "https://github.com/cgwalters/with-procspawn-te # Internal crate for the test macro itest-macro = { path = "itest-macro" } - -[patch.crates-io] -# PR openat (pun intended) https://github.com/tailhook/openat/pull/36 -openat = { git = 'https://github.com/cgwalters/openat', branch = 'libc-rename-signed' } From 642dcd10efabb60763a465eb6babf9bafe7f0d90 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 17:37:26 +0000 Subject: [PATCH 14/33] tests/inst: Update ostree crate --- tests/inst/Cargo.toml | 2 +- tests/inst/src/destructive.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index 0986c0a7..65252330 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -19,7 +19,7 @@ anyhow = "1.0" tempfile = "3.1.0" glib = "0.10" gio = "0.9" -ostree = { version = "0.8.0", features = ["v2020_1"] } +ostree = { version = "0.10.0", features = ["v2021_1"] } libtest-mimic = "0.3.0" twoway = "0.2.1" hyper = "0.13" diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index 59ab59b1..26dba6b2 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -279,7 +279,7 @@ fn parse_and_validate_reboot_mark>( // Update the target state let srvrepo_obj = ostree::Repo::new(&gio::File::new_for_path(SRVREPO)); srvrepo_obj.open(gio::NONE_CANCELLABLE)?; - commitstates.target = srvrepo_obj.resolve_rev(TESTREF, false)?.into(); + commitstates.target = srvrepo_obj.resolve_rev(TESTREF, false)?.unwrap().into(); } else if commitstates.booted == commitstates.orig || commitstates.booted == commitstates.prev { println!( "Failed update to {} (booted={})", @@ -353,11 +353,12 @@ fn impl_transaction_test>( CommitStates { booted: booted_commit.to_string(), - orig: sysrepo_obj.resolve_rev(ORIGREF, false)?.into(), + orig: sysrepo_obj.resolve_rev(ORIGREF, false)?.unwrap().into(), prev: srvrepo_obj .resolve_rev(&format!("{}^", TESTREF), false)? + .unwrap() .into(), - target: srvrepo_obj.resolve_rev(TESTREF, false)?.into(), + target: srvrepo_obj.resolve_rev(TESTREF, false)?.unwrap().into(), } }; From 2628637a78614559fac48cc113f3ee81038a9539 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 17:40:26 +0000 Subject: [PATCH 15/33] tests/inst: Update rpm-ostree client --- tests/inst/Cargo.toml | 3 +-- tests/inst/src/destructive.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index 65252330..99ab4e8e 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -38,8 +38,7 @@ openat = "0.1.19" openat-ext = "0.1.4" nix = "0.17.0" # See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188 -# Currently pinned to a hash, but after the next stable release let's switch to tags -rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", rev = "170095bd60ec8802afeea42d120fb2e88298648f" } +rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" } # This one I might publish to crates.io, not sure yet with-procspawn-tempdir = { git = "https://github.com/cgwalters/with-procspawn-tempdir" } diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index 26dba6b2..562e1aed 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -244,6 +244,11 @@ impl CommitStates { } } +fn query_status() -> Result { + let client = rpmostree_client::CliClient::new("ostreetest"); + rpmostree_client::query_status(&client).map_err(anyhow::Error::msg) +} + /// In the case where we've entered via a reboot, this function /// checks the state of things, and also generates a new update /// if everything was successful. @@ -255,7 +260,7 @@ fn parse_and_validate_reboot_mark>( let mut mark: RebootMark = serde_json::from_str(markstr) .with_context(|| format!("Failed to parse reboot mark {:?}", markstr))?; // The first failed reboot may be into the original booted commit - let status = rpmostree_client::query_status().map_err(anyhow::Error::msg)?; + let status = query_status()?; let firstdeploy = &status.deployments[0]; // The first deployment should not be staged assert!(!firstdeploy.staged.unwrap_or(false)); @@ -315,7 +320,7 @@ fn validate_pending_commit(pending_commit: &str, commitstates: &CommitStates) -> /// In the case where we did a kill -9 of rpm-ostree, check the state fn validate_live_interrupted_upgrade(commitstates: &CommitStates) -> Result { - let status = rpmostree_client::query_status().map_err(anyhow::Error::msg)?; + let status = query_status()?; let firstdeploy = &status.deployments[0]; let pending_commit = firstdeploy.checksum.as_str(); let res = if firstdeploy.staged.unwrap_or(false) { @@ -484,7 +489,7 @@ fn impl_transaction_test>( } else { live_strategy = Some(strategy); } - let status = rpmostree_client::query_status().map_err(anyhow::Error::msg)?; + let status = query_status()?; let firstdeploy = &status.deployments[0]; let pending_commit = firstdeploy.checksum.as_str(); validate_pending_commit(pending_commit, &commitstates) From 4d9e6de46b815ca15c73ac40fe2d065dbad37f2b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 17:43:03 +0000 Subject: [PATCH 16/33] tests/inst: Update tokio, hyper and nix --- tests/inst/Cargo.toml | 8 ++++---- tests/inst/src/destructive.rs | 5 +++-- tests/inst/src/test.rs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index 99ab4e8e..bac4e42d 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -22,11 +22,11 @@ gio = "0.9" ostree = { version = "0.10.0", features = ["v2021_1"] } libtest-mimic = "0.3.0" twoway = "0.2.1" -hyper = "0.13" +hyper = { version = "0.14", features = ["runtime", "http1", "http2", "tcp", "server"] } +hyper-staticfile = "0.6.0" futures = "0.3.4" http = "0.2.0" -hyper-staticfile = "0.5.1" -tokio = { version = "0.2", features = ["full"] } +tokio = { version = "1.4.0", features = ["full"] } futures-util = "0.3.1" base64 = "0.12.0" procspawn = "0.8" @@ -36,7 +36,7 @@ strum = "0.18.0" strum_macros = "0.18.0" openat = "0.1.19" openat-ext = "0.1.4" -nix = "0.17.0" +nix = "0.20.0" # See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188 rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" } diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index 562e1aed..d631b9a7 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -208,12 +208,13 @@ fn upgrade_and_finalize() -> Result<()> { async fn run_upgrade_or_timeout(timeout: time::Duration) -> Result { let upgrade = tokio::task::spawn_blocking(upgrade_and_finalize); + tokio::pin!(upgrade); Ok(tokio::select! { res = upgrade => { let _res = res?; true }, - _ = tokio::time::delay_for(timeout) => { + _ = tokio::time::sleep(timeout) => { false } }) @@ -383,7 +384,7 @@ fn impl_transaction_test>( assert_ne!(commitstates.booted.as_str(), commitstates.target.as_str()); - let mut rt = tokio::runtime::Runtime::new()?; + let rt = tokio::runtime::Runtime::new()?; let cycle_time_ms = (tdata.cycle_time.as_secs_f64() * 1000f64 * FORCE_REBOOT_AFTER_MUL) as u64; // Set when we're trying an interrupt strategy that isn't a reboot, so we will // re-enter the loop below. diff --git a/tests/inst/src/test.rs b/tests/inst/src/test.rs index 11d23ab7..81592f7a 100644 --- a/tests/inst/src/test.rs +++ b/tests/inst/src/test.rs @@ -158,7 +158,7 @@ where F: Send + 'static, { let path = path.as_ref(); - let mut rt = Runtime::new()?; + let rt = Runtime::new()?; rt.block_on(async move { let addr = http_server(path, *opts).await?; tokio::task::spawn_blocking(move || f(&addr)).await? From a90d59cf2dd8d158c71fd0f14b9d249ac703895a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 17:10:44 +0000 Subject: [PATCH 17/33] build-sys: Remove --enable-experimental-api It was added for the collections bits, but we made that stable. It's now just cruft and we're very unlikely to reuse the infrastructure again. Motivated by a unit test failure when running from a tarball: https://github.com/ostreedev/ostree/issues/2313 --- .cci.jenkinsfile | 2 +- Makefile-libostree.am | 14 +------------- Makefile-ostree.am | 5 ----- Makefile-tests.am | 8 -------- apidoc/Makefile.am | 1 - apidoc/ostree-sections.txt | 22 +++++++++------------- configure.ac | 18 +----------------- tests/libtest.sh | 6 ------ tests/test-symbols.sh | 14 ++------------ 9 files changed, 14 insertions(+), 76 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 35c5f3d4..33bc115e 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -48,7 +48,7 @@ minimal: { ./configure --without-curl --without-soup --disable-gtk-doc --disable-man \ --disable-rust --without-libarchive --without-selinux --without-smack \ --without-openssl --without-avahi --without-libmount --disable-rofiles-fuse \ - --disable-experimental-api --without-libsodium + --without-libsodium make """) } diff --git a/Makefile-libostree.am b/Makefile-libostree.am index ce784aff..3bc6b7b6 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -147,14 +147,6 @@ libostree_1_la_SOURCES += \ src/libostree/ostree-tls-cert-interaction.h \ $(NULL) endif -libostree_experimental_headers = \ - $(NULL) -if !ENABLE_EXPERIMENTAL_API -libostree_1_la_SOURCES += $(libostree_experimental_headers) -else # if ENABLE_EXPERIMENTAL_API -libostree_1_la_SOURCES += \ - $(NULL) -endif if USE_AVAHI libostree_1_la_SOURCES += \ @@ -281,13 +273,9 @@ OSTree-1.0.gir: libostree-1.la Makefile OSTree_1_0_gir_EXPORT_PACKAGES = ostree-1 OSTree_1_0_gir_INCLUDES = Gio-2.0 OSTree_1_0_gir_CFLAGS = $(libostree_1_la_CFLAGS) -if ENABLE_EXPERIMENTAL_API -# When compiling this is set via config.h, but g-ir-scanner can't use that -OSTree_1_0_gir_CFLAGS += -DOSTREE_ENABLE_EXPERIMENTAL_API=1 -endif OSTree_1_0_gir_LIBS = libostree-1.la OSTree_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=Ostree --symbol-prefix=ostree $(GI_SCANNERFLAGS) -OSTree_1_0_gir_FILES = $(libostreeinclude_HEADERS) $(filter-out %-private.h %/ostree-soup-uri.h $(libostree_experimental_headers),$(libostree_1_la_SOURCES)) +OSTree_1_0_gir_FILES = $(libostreeinclude_HEADERS) $(filter-out %-private.h %/ostree-soup-uri.h,$(libostree_1_la_SOURCES)) INTROSPECTION_GIRS += OSTree-1.0.gir gir_DATA += OSTree-1.0.gir typelib_DATA += OSTree-1.0.typelib diff --git a/Makefile-ostree.am b/Makefile-ostree.am index e5767641..fd5ec9de 100644 --- a/Makefile-ostree.am +++ b/Makefile-ostree.am @@ -60,11 +60,6 @@ nodist_ostree_SOURCES = \ src/ostree/parse-datetime.c \ $(NULL) -if ENABLE_EXPERIMENTAL_API -ostree_SOURCES += \ - $(NULL) -endif - if USE_GPGME ostree_SOURCES += \ src/ostree/ot-builtin-gpg-sign.c \ diff --git a/Makefile-tests.am b/Makefile-tests.am index 257b4a5d..23dba331 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -156,8 +156,6 @@ _installed_or_uninstalled_test_scripts += \ $(NULL) endif -experimental_test_scripts = \ - $(NULL) test_extra_programs = \ tests/get-byte-order \ tests/repo-finder-mount \ @@ -171,12 +169,6 @@ tests_repo_finder_mount_SOURCES = tests/repo-finder-mount.c tests_repo_finder_mount_CFLAGS = $(common_tests_cflags) tests_repo_finder_mount_LDADD = $(common_tests_ldadd) libostreetest.la -if ENABLE_EXPERIMENTAL_API -_installed_or_uninstalled_test_scripts += $(experimental_test_scripts) -else -EXTRA_DIST += $(experimental_test_scripts) -endif - if BUILDOPT_FUSE _installed_or_uninstalled_test_scripts += tests/test-rofiles-fuse.sh uninstalled_test_data += tests/rofiles-fuse-symlink-stamp diff --git a/apidoc/Makefile.am b/apidoc/Makefile.am index 98a84d5f..fee3df8a 100644 --- a/apidoc/Makefile.am +++ b/apidoc/Makefile.am @@ -122,7 +122,6 @@ include $(top_srcdir)/gtk-doc.make EXTRA_DIST += \ version.xml \ ostree-sections.txt \ - ostree-experimental-sections.txt \ $(NULL) -include $(top_srcdir)/git.mk diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index e4954c70..a9e756eb 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -107,6 +107,7 @@ OSTREE_SUMMARY_GVARIANT_STRING OSTREE_SUMMARY_GVARIANT_FORMAT ostree_metadata_variant_type ostree_validate_checksum_string +ostree_validate_collection_id ostree_checksum_to_bytes ostree_checksum_to_bytes_v ostree_checksum_from_bytes @@ -304,6 +305,7 @@ ostree_repo_is_system ostree_repo_is_writable ostree_repo_create_at ostree_repo_create +ostree_repo_get_collection_id ostree_repo_get_bootloader ostree_repo_get_path ostree_repo_get_mode @@ -319,6 +321,7 @@ ostree_repo_remote_delete OstreeRepoRemoteChange ostree_repo_remote_change ostree_repo_remote_list +ostree_repo_remote_list_collection_refs ostree_repo_remote_get_url ostree_repo_remote_get_gpg_verify ostree_repo_remote_get_gpg_verify_summary @@ -337,10 +340,13 @@ ostree_repo_prepare_transaction ostree_repo_commit_transaction ostree_repo_abort_transaction ostree_repo_transaction_set_refspec +ostree_repo_transaction_set_collection_ref ostree_repo_transaction_set_ref ostree_repo_set_ref_immediate ostree_repo_set_alias_ref_immediate ostree_repo_set_cache_dir +ostree_repo_set_collection_id +ostree_repo_set_collection_ref_immediate ostree_repo_sign_delta ostree_repo_has_object ostree_repo_mark_commit_partial @@ -360,7 +366,9 @@ ostree_repo_resolve_rev_ext ostree_repo_list_refs OstreeRepoListRefsExtFlags ostree_repo_list_refs_ext +ostree_repo_list_collection_refs ostree_repo_remote_list_refs +ostree_repo_resolve_collection_ref ostree_repo_load_variant OstreeRepoCommitState ostree_repo_load_commit @@ -619,7 +627,7 @@ ostree_remote_get_type
-ostree-repo-experimental +ostree-repo-remote-finder ostree_repo_find_remotes_async ostree_repo_find_remotes_finish ostree_repo_pull_from_remotes_async @@ -683,18 +691,6 @@ ostree_repo_finder_override_add_uri ostree_repo_finder_override_get_type
-
-ostree-misc-experimental -ostree_repo_get_collection_id -ostree_repo_set_collection_id -ostree_validate_collection_id -ostree_repo_list_collection_refs -ostree_repo_remote_list_collection_refs -ostree_repo_set_collection_ref_immediate -ostree_repo_transaction_set_collection_ref -ostree_repo_resolve_collection_ref -
-
ostree-kernel-args OstreeKernelArgs diff --git a/configure.ac b/configure.ac index e3d6b779..f372a0eb 100644 --- a/configure.ac +++ b/configure.ac @@ -560,21 +560,6 @@ AS_IF([test "x$found_introspection" = xyes && test x$using_asan != xyes], [ ], [have_gjs=no]) AM_CONDITIONAL(BUILDOPT_GJS, test x$have_gjs = xyes) -# Do we enable building experimental (non-stable) API? -# The OSTREE_ENABLE_EXPERIMENTAL_API #define is used internally and in public -# headers, so any consumer of libostree who wants to use experimental API must -# #define OSTREE_ENABLE_EXPERIMENTAL_API 1 -# before including libostree headers. This means the name in the AC_DEFINE below -# is public API. -AC_ARG_ENABLE([experimental-api], - [AS_HELP_STRING([--enable-experimental-api], - [Enable unstable experimental API in libostree [default=no]])],, - [enable_experimental_api=no]) -AS_IF([test x$enable_experimental_api = xyes], - [AC_DEFINE([OSTREE_ENABLE_EXPERIMENTAL_API],[1],[Define if experimental API should be enabled]) - OSTREE_FEATURES="$OSTREE_FEATURES experimental"] -) -AM_CONDITIONAL([ENABLE_EXPERIMENTAL_API],[test x$enable_experimental_api = xyes]) AM_CONDITIONAL([BUILDOPT_IS_DEVEL_BUILD],[test x$is_release_build != xyes]) AM_COND_IF([BUILDOPT_IS_DEVEL_BUILD], AC_DEFINE([BUILDOPT_IS_DEVEL_BUILD], [1], [Define if doing a development build]) @@ -622,8 +607,7 @@ echo " gjs-based tests: $have_gjs dracut: $with_dracut mkinitcpio: $with_mkinitcpio - Static compiler for ostree-prepare-root: $with_static_compiler - Experimental API $enable_experimental_api" + Static compiler for ostree-prepare-root: $with_static_compiler" AS_IF([test x$with_builtin_grub2_mkconfig = xyes], [ echo " builtin grub2-mkconfig (instead of system): $with_builtin_grub2_mkconfig" ], [ diff --git a/tests/libtest.sh b/tests/libtest.sh index ffb05c7b..eda3b921 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -637,12 +637,6 @@ skip_without_fuse () { [ -e /etc/mtab ] || skip "no /etc/mtab" } -skip_without_experimental () { - if ! ostree --version | grep -q -e '- experimental'; then - skip "No experimental API is compiled in" - fi -} - has_gpgme () { local ret ${CMD_PREFIX} ostree --version > version.txt diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh index 77f07c4d..2f7d9d02 100755 --- a/tests/test-symbols.sh +++ b/tests/test-symbols.sh @@ -31,16 +31,9 @@ if echo "$OSTREE_FEATURES" | grep --quiet --no-messages "devel"; then else devel_syms= fi -if echo "$OSTREE_FEATURES" | grep --quiet --no-messages "experimental"; then - experimental_sym="${G_TEST_SRCDIR}/src/libostree/libostree-experimental.sym" - experimental_sections="${G_TEST_SRCDIR}/apidoc/ostree-experimental-sections.txt" -else - experimental_sym="" - experimental_sections="" -fi echo "Verifying all expected symbols are actually exported..." -grep --no-filename ' ostree_[A-Za-z0-9_]*;' ${released_syms} ${devel_syms} ${experimental_sym} | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt +grep --no-filename ' ostree_[A-Za-z0-9_]*;' ${released_syms} ${devel_syms} | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt eu-readelf -a ${G_TEST_BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9A-Z_.]*,\1,' |sort -u > found-symbols.txt diff -u expected-symbols.txt found-symbols.txt @@ -48,9 +41,6 @@ echo "Checking that the example symbol wasn't copy-pasted..." if test -f ${devel_syms}; then assert_file_has_content_once ${devel_syms} "someostree_symbol_deleteme" fi -if test -f ${experimental_sym}; then - assert_not_file_has_content ${experimental_sym} "someostree_symbol_deleteme" -fi assert_not_file_has_content ${released_syms} "someostree_symbol_deleteme" echo "ok exports" @@ -59,7 +49,7 @@ echo "ok exports" grep -E -v '(ostree_cmd__private__)|(ostree_fetcher_config_flags_get_type)' found-symbols.txt > expected-documented.txt echo "Verifying all public symbols are documented:" -grep --no-filename '^ostree_' ${G_TEST_SRCDIR}/apidoc/ostree-sections.txt $experimental_sections |sort -u > found-documented.txt +grep --no-filename '^ostree_' ${G_TEST_SRCDIR}/apidoc/ostree-sections.txt |sort -u > found-documented.txt diff -u expected-documented.txt found-documented.txt echo 'ok documented symbols' From 36da85ecbe5791e372cc0b689bf00c3c1167d185 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 7 Apr 2021 13:36:01 -0600 Subject: [PATCH 18/33] Remove apidoc .gitignore from version control Like the top level .gitignore, there's no reason to track this if it's being generated automatically. It only produces spurious diff changes that you almost certainly don't want. --- apidoc/.gitignore | 53 ----------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 apidoc/.gitignore diff --git a/apidoc/.gitignore b/apidoc/.gitignore deleted file mode 100644 index 80d2c112..00000000 --- a/apidoc/.gitignore +++ /dev/null @@ -1,53 +0,0 @@ -*.lo -*.o -.deps -.libs -/*.bak -/*.gcda -/*.gcno -/*.orig -/*.rej -/*.tab.c -/*~ -/.*.sw[nop] -/.dirstamp -/.gitignore -/GPATH -/GRTAGS -/GSYMS -/GTAGS -/ID -/Makefile -/Makefile.in -/TAGS -/gtkdoc-check.test -/html -/html-build.stamp -/html.stamp -/ostree-decl-list.txt -/ostree-decl.txt -/ostree-undeclared.txt -/ostree-undocumented.txt -/ostree-unused.txt -/ostree.args -/ostree.hierarchy -/ostree.interfaces -/ostree-overrides.txt -/ostree.pdf -/ostree.prerequisites -/ostree.signals -/ostree.types -/pdf-build.stamp -/pdf.stamp -/scan-build.stamp -/setup-build.stamp -/sgml-build.stamp -/sgml.stamp -/so_locations -/tags -/tmpl -/tmpl/*.bak -/tmpl/ostree-unused.sgml -/xml -/version.xml -_libs From d05e7ba2e2c07d010b44855f114ee19ce7a72103 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 7 Apr 2021 13:37:53 -0600 Subject: [PATCH 19/33] Ensure consistent apidoc .gitignore If you don't configure with --enable-gtk-doc, these won't be included in the generated .gitignore. If you later configure with --enable-gtk-doc in the same checkout, they'll show up as untracked files. Include them in GITIGNOREFILES to ensure they're always added regardless of configure options. --- apidoc/Makefile.am | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apidoc/Makefile.am b/apidoc/Makefile.am index 98a84d5f..774cee60 100644 --- a/apidoc/Makefile.am +++ b/apidoc/Makefile.am @@ -125,4 +125,11 @@ EXTRA_DIST += \ ostree-experimental-sections.txt \ $(NULL) +# These only get included in the generated .gitignore when building with +# --enable-gtk-doc, so ensure they're always added. +GITIGNOREFILES = \ + ostree-overrides.txt \ + version.xml \ + $(NULL) + -include $(top_srcdir)/git.mk From dfaf314c423443a1fba342d83609856c3fb76e0d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 20:01:07 +0000 Subject: [PATCH 20/33] core: Drop unused error handling from object stream helper I was going to add some new API and I noticed that this function never returns an error; presumably at one point it did, but not anymore. It simplifies the code flow noticeably to remove that. --- src/libostree/ostree-core.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index 252b19a4..83f409ba 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -412,18 +412,12 @@ variant_to_lenprefixed_buffer (GVariant *variant) * header_and_input_to_stream: * @file_header: A file header * @input: File raw content stream - * @out_input: (out): Serialized object stream - * @cancellable: Cancellable - * @error: Error * * Combines @file_header and @input into a single stream. */ -static gboolean +static GInputStream * header_and_input_to_stream (GBytes *file_header, - GInputStream *input, - GInputStream **out_input, - GCancellable *cancellable, - GError **error) + GInputStream *input) { /* Our result stream chain */ g_autoptr(GPtrArray) streams = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); @@ -438,10 +432,7 @@ header_and_input_to_stream (GBytes *file_header, g_ptr_array_add (streams, g_object_ref (input)); /* Return the result stream */ - g_autoptr(GInputStream) ret_input = (GInputStream*)ostree_chain_input_stream_new (streams); - ot_transfer_out_value (out_input, &ret_input); - - return TRUE; + return (GInputStream*)ostree_chain_input_stream_new (streams); } /* Convert file metadata + file content into an archive-format stream. */ @@ -462,11 +453,8 @@ _ostree_raw_file_to_archive_stream (GInputStream *input, zlib_input = g_converter_input_stream_new (input, zlib_compressor); } g_autoptr(GBytes) file_header = _ostree_zlib_file_header_new (file_info, xattrs); - return header_and_input_to_stream (file_header, - zlib_input, - out_input, - cancellable, - error); + *out_input = header_and_input_to_stream (file_header, zlib_input); + return TRUE; } /** @@ -560,12 +548,7 @@ ostree_raw_file_to_content_stream (GInputStream *input, GError **error) { g_autoptr(GBytes) file_header = _ostree_file_header_new (file_info, xattrs); - if (!header_and_input_to_stream (file_header, - input, - out_input, - cancellable, - error)) - return FALSE; + *out_input = header_and_input_to_stream (file_header, input); if (out_length) *out_length = g_bytes_get_size (file_header) + g_file_info_get_size (file_info); return TRUE; From 5d68a99a2f59ec1236cf4604874f95d136509b8d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 8 Apr 2021 14:45:28 +0000 Subject: [PATCH 21/33] tests: Silence a gcc warning We can't mix `goto` and `__attribute__((cleanup))`. --- tests/test-libarchive-import.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-libarchive-import.c b/tests/test-libarchive-import.c index 75b298bc..821a8869 100644 --- a/tests/test-libarchive-import.c +++ b/tests/test-libarchive-import.c @@ -510,6 +510,7 @@ test_libarchive_xattr_import_skip_xattr (gconstpointer data) GError *error = NULL; g_autoptr(OtAutoArchiveRead) a = archive_read_new (); OstreeRepoImportArchiveOptions opts = { 0 }; + g_autoptr(OstreeRepoCommitModifier) modifier = NULL; if (skip_if_no_xattr (td)) goto out; @@ -524,7 +525,7 @@ test_libarchive_xattr_import_skip_xattr (gconstpointer data) opts.ignore_unsupported_content = TRUE; - g_autoptr(OstreeRepoCommitModifier) modifier = ostree_repo_commit_modifier_new ( + modifier = ostree_repo_commit_modifier_new ( OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS, NULL, NULL, NULL); if (!import_write_and_ref (td->repo, &opts, a, "baz", modifier, &error)) goto out; From 4e2a14eb0c92e38c533c453f6e375953a7208f0e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 21:03:15 +0000 Subject: [PATCH 22/33] repo: Add ostree_repo_write_regfile_inline When working on ostree-ext and importing from tar, it's quite inefficient and awkward for small files to end up creating a whole `GInputStream` and `GFileInfo` and etc. for small files. Plus the gtk-rs binding API to map from `impl Read` to Gio https://docs.rs/gio/0.9.1/gio/struct.ReadInputStream.html requires that the input stream is `Send` but the Rust `tar` API isn't. This is only 1/3 of the problem; we also need similar APIs to directly create a symlink, and to stream large objects via a push-based API. --- Makefile-libostree.am | 6 ++-- apidoc/ostree-sections.txt | 1 + src/libostree/libostree-devel.sym | 9 ++++-- src/libostree/ostree-repo-commit.c | 45 ++++++++++++++++++++++++++++++ src/libostree/ostree-repo.h | 12 ++++++++ tests/test-core.js | 14 ++++++++++ tests/test-repo.c | 44 ++++++++++++++++++++++++++++- 7 files changed, 125 insertions(+), 6 deletions(-) diff --git a/Makefile-libostree.am b/Makefile-libostree.am index ce784aff..6dbd00f5 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -179,9 +179,9 @@ endif # USE_GPGME symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym # Uncomment this include when adding new development symbols. -#if BUILDOPT_IS_DEVEL_BUILD -#symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym -#endif +if BUILDOPT_IS_DEVEL_BUILD +symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym +endif # http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html wl_versionscript_arg = -Wl,--version-script= diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index e4954c70..6c84199a 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -349,6 +349,7 @@ ostree_repo_write_metadata ostree_repo_write_metadata_async ostree_repo_write_metadata_finish ostree_repo_write_content +ostree_repo_write_regfile_inline ostree_repo_write_metadata_trusted ostree_repo_write_metadata_stream_trusted ostree_repo_write_content_trusted diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index e2d6efc4..c4a70938 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -22,12 +22,17 @@ - uncomment the include in Makefile-libostree.am */ +LIBOSTREE_2021.2 { +global: + ostree_repo_write_regfile_inline; +} LIBOSTREE_2021.1; + /* Stub section for the stable release *after* this development one; don't * edit this other than to update the year. This is just a copy/paste * source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION * with whatever the next version with new symbols will be. -LIBOSTREE_2020.$NEWVERSION { +LIBOSTREE_2021.$NEWVERSION { global: someostree_symbol_deleteme; -} LIBOSTREE_2020.$LASTSTABLE; +} LIBOSTREE_2021.$LASTSTABLE; */ diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 9d5c6d3b..409738ad 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2769,6 +2769,51 @@ ostree_repo_write_content (OstreeRepo *self, cancellable, error); } +/** + * ostree_repo_write_regfile_inline: + * @self: repo + * @expected_checksum: (allow-none): The expected checksum + * @uid: User id + * @gid: Group id + * @mode: File mode + * @xattrs: (allow-none): Extended attributes, GVariant of type (ayay) + * @buf: (array length=len) (element-type guint8): File contents + * @cancellable: Cancellable + * @error: Error + * + * Synchronously create a file object from the provided content. This API + * is intended for small files where it is reasonable to buffer the entire + * content in memory. + * + * Unlike `ostree_repo_write_content()`, if @expected_checksum is provided, + * this function will not check for the presence of the object beforehand. + * + * Returns: (transfer full): Checksum (as a hex string) of the committed file + * Since: 2021.2 + */ +_OSTREE_PUBLIC +char * +ostree_repo_write_regfile_inline (OstreeRepo *self, + const char *expected_checksum, + guint32 uid, + guint32 gid, + guint32 mode, + GVariant *xattrs, + const guint8* buf, + gsize len, + GCancellable *cancellable, + GError **error) +{ + g_autoptr(GInputStream) memin = g_memory_input_stream_new_from_data (buf, len, NULL); + g_autoptr(GFileInfo) finfo = _ostree_mode_uidgid_to_gfileinfo (mode, uid, gid); + g_autofree guint8* csum = NULL; + if (!write_content_object (self, expected_checksum, + memin, finfo, xattrs, &csum, + cancellable, error)) + return NULL; + return ostree_checksum_from_bytes (csum); +} + typedef struct { OstreeRepo *repo; char *expected_checksum; diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index e64c3230..cd50fc43 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -423,6 +423,18 @@ gboolean ostree_repo_write_content (OstreeRepo *self, GCancellable *cancellable, GError **error); +_OSTREE_PUBLIC +char * ostree_repo_write_regfile_inline (OstreeRepo *self, + const char *expected_checksum, + guint32 uid, + guint32 gid, + guint32 mode, + GVariant *xattrs, + const guint8* buf, + gsize len, + GCancellable *cancellable, + GError **error); + _OSTREE_PUBLIC gboolean ostree_repo_write_metadata_trusted (OstreeRepo *self, OstreeObjectType objtype, diff --git a/tests/test-core.js b/tests/test-core.js index a9ef8919..8f460a5f 100755 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -49,6 +49,20 @@ let [,dirTree] = repo.write_mtree(mtree, null); let [,commit] = repo.write_commit(null, 'Some subject', 'Some body', null, dirTree, null); print("commit => " + commit); +// Test direct write APIs +let inline_content = "default 0.0.0.0\nloopback 127.0.0.0\nlink-local 169.254.0.0\n"; +let regfile_mode = 33188; // 0o100000 | 0o644 (but in decimal so old gjs works) +let inline_checksum = repo.write_regfile_inline(null, 0, 0, regfile_mode, null, inline_content, null); +assertEquals(inline_checksum, "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"); +let written = false; +try { + repo.write_regfile_inline("8baa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873", 0, 0, regfile_mode, null, inline_content, null); + written = true; +} catch (e) { +} +if (written) + throw new Error("Wrote invalid checksum"); + repo.commit_transaction(null, null); let [,root,checksum] = repo.read_commit(commit, null); diff --git a/tests/test-repo.c b/tests/test-repo.c index 9857228e..ad81a7d6 100644 --- a/tests/test-repo.c +++ b/tests/test-repo.c @@ -197,6 +197,47 @@ test_repo_get_min_free_space (Fixture *fixture, } } +static void +test_write_regfile_api (Fixture *fixture, + gconstpointer test_data) +{ + g_autoptr (GKeyFile) config = NULL; + g_autoptr(GError) error = NULL; + + g_autoptr(OstreeRepo) repo = ostree_repo_create_at (fixture->tmpdir.fd, ".", + OSTREE_REPO_MODE_ARCHIVE, + NULL, + NULL, &error); + g_assert_no_error (error); + + g_auto(GVariantBuilder) xattrs_builder; + g_variant_builder_init (&xattrs_builder, (GVariantType*)"a(ayay)"); + g_variant_builder_add (&xattrs_builder, "(^ay^ay)", "security.selinux", "system_u:object_r:etc_t:s0"); + g_autoptr(GVariant) xattrs = g_variant_ref_sink (g_variant_builder_end (&xattrs_builder)); + + // Current contents of /etc/networks in Fedora + static const char contents[] = "default 0.0.0.0\nloopback 127.0.0.0\nlink-local 169.254.0.0\n"; + // First with no xattrs + g_autofree char *checksum = ostree_repo_write_regfile_inline (repo, NULL, 0, 0, S_IFREG | 0644, NULL, (const guint8*)contents, sizeof (contents)-1, NULL, &error); + g_assert_no_error (error); + g_assert_cmpstr (checksum, ==, "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"); + g_clear_pointer (&checksum, g_free); + + // Invalid checksum + checksum = ostree_repo_write_regfile_inline (repo, "3272139f889f6a7007b3d64adc74be9e2979bf6bbe663d1512e5bd43f4de24a1", + 0, 0, S_IFREG | 0644, NULL, (const guint8*)contents, sizeof (contents)-1, NULL, &error); + g_assert (checksum == NULL); + g_assert (error != NULL); + g_clear_error (&error); + + // Now with xattrs + g_clear_pointer (&checksum, g_free); + checksum = ostree_repo_write_regfile_inline (repo, NULL, 0, 0, S_IFREG | 0644, xattrs, (const guint8*)contents, sizeof (contents)-1, NULL, &error); + g_assert_no_error (error); + g_assert_cmpstr (checksum, ==, "4f600d252338f93279c51c964915cb2c26f0d09082164c54890d1a3c78cdeb1e"); + g_clear_pointer (&checksum, g_free); +} + int main (int argc, char **argv) @@ -212,7 +253,8 @@ main (int argc, test_repo_equal, teardown); g_test_add ("/repo/get_min_free_space", Fixture, NULL, setup, test_repo_get_min_free_space, teardown); - + g_test_add ("/repo/write_regfile_api", Fixture, NULL, setup, + test_write_regfile_api, teardown); return g_test_run (); } From aff1d269bc4ef4cf07db74afbdbeff0c52240920 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 8 Apr 2021 15:36:08 +0000 Subject: [PATCH 23/33] travis: Bump Ubuntu versions xenial is EOL soon, let's bump to the latest LTS and the latest. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index be741cc9..1977b5ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ env: # debian has libsodium-dev, ubuntu doesn't in core at least - ci_docker=debian:buster-slim ci_distro=debian ci_suite=stretch ci_configopts="--with-ed25519-libsodium" ci_pkgs="libsodium-dev" - ci_docker=debian:buster-slim ci_distro=debian ci_suite=stretch ci_configopts="--with-curl --with-ed25519-libsodium --without-gpgme" ci_pkgs="libsodium-dev" - - ci_docker=ubuntu:xenial ci_distro=ubuntu ci_suite=xenial - - ci_docker=i386/ubuntu:bionic ci_distro=ubuntu ci_suite=bionic - - ci_docker=ubuntu:bionic ci_distro=ubuntu ci_suite=bionic + - ci_docker=ubuntu:focal ci_distro=ubuntu ci_suite=focal + - ci_docker=i386/ubuntu:focal ci_distro=ubuntu ci_suite=focal + - ci_docker=ubuntu:groovy ci_distro=ubuntu ci_suite=groovy script: - ci/travis-install.sh From 764116ef56e12f167bc5a2613d3835173e5301fc Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 8 Apr 2021 10:22:21 -0600 Subject: [PATCH 24/33] travis: Don't ask any debconf questions when installing packages Currently the Ubuntu builds are stuck waiting for an answer on what timezone to use. That could be fixed, but generally the way to do these types of installs is to set the DEBIAN_FRONTEND environment variable to `noninteractive` so that debconf just chooses a default. This is what debootstrap does, for instance. I tested installing tzdata on a local focal container this way and it just chooses `Etc/UTC` as the timezone. --- ci/travis-install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/travis-install.sh b/ci/travis-install.sh index 64801741..b40f4c55 100755 --- a/ci/travis-install.sh +++ b/ci/travis-install.sh @@ -82,6 +82,10 @@ esac case "$ci_distro" in (debian|ubuntu) + # Make debconf run non-interactively since its questions can't + # be answered. + export DEBIAN_FRONTEND=noninteractive + # TODO: fetch this list from the Debian packaging git repository? $sudo apt-get -y update $sudo apt-get -y install \ From 2fc0e237d8095676808fdc363aad76d1eb1b2068 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 8 Apr 2021 10:33:12 -0600 Subject: [PATCH 25/33] travis: Drop i386 Ubuntu target Ubuntu dropped i386[1], so there's no sense in attempting the build there. In 2021 I don't think it's worth the trouble to keep doing that, but if desired Debian still supports it. 1. https://wiki.ubuntu.com/FocalFossa/ReleaseNotes#Upgrades_on_i386 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1977b5ec..2f3ef055 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ env: - ci_docker=debian:buster-slim ci_distro=debian ci_suite=stretch ci_configopts="--with-ed25519-libsodium" ci_pkgs="libsodium-dev" - ci_docker=debian:buster-slim ci_distro=debian ci_suite=stretch ci_configopts="--with-curl --with-ed25519-libsodium --without-gpgme" ci_pkgs="libsodium-dev" - ci_docker=ubuntu:focal ci_distro=ubuntu ci_suite=focal - - ci_docker=i386/ubuntu:focal ci_distro=ubuntu ci_suite=focal - ci_docker=ubuntu:groovy ci_distro=ubuntu ci_suite=groovy script: From d4147b7e353dde732410df17eef63475139e61d3 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 8 Apr 2021 11:45:13 -0600 Subject: [PATCH 26/33] travis: Correct ci_suite settings for buster The install script no longer uses this anymore and maybe it should just be removed, but in the meantime it should at least be correct. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2f3ef055..986c1a19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ sudo: required env: # debian has libsodium-dev, ubuntu doesn't in core at least - - ci_docker=debian:buster-slim ci_distro=debian ci_suite=stretch ci_configopts="--with-ed25519-libsodium" ci_pkgs="libsodium-dev" - - ci_docker=debian:buster-slim ci_distro=debian ci_suite=stretch ci_configopts="--with-curl --with-ed25519-libsodium --without-gpgme" ci_pkgs="libsodium-dev" + - ci_docker=debian:buster-slim ci_distro=debian ci_suite=buster ci_configopts="--with-ed25519-libsodium" ci_pkgs="libsodium-dev" + - ci_docker=debian:buster-slim ci_distro=debian ci_suite=buster ci_configopts="--with-curl --with-ed25519-libsodium --without-gpgme" ci_pkgs="libsodium-dev" - ci_docker=ubuntu:focal ci_distro=ubuntu ci_suite=focal - ci_docker=ubuntu:groovy ci_distro=ubuntu ci_suite=groovy From ed16443c829e8e607120752af34072fdf5fd4e78 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 8 Apr 2021 11:49:19 -0600 Subject: [PATCH 27/33] travis: Add back a 32 bit i386 build Although people are likely not deploying on 32 bit x86 anymore, deploying on 32 bit armv7 is still often used. Add back an i386 build on debian to try to catch 32 bit bugs in CI. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 986c1a19..10d8e4bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ env: # debian has libsodium-dev, ubuntu doesn't in core at least - ci_docker=debian:buster-slim ci_distro=debian ci_suite=buster ci_configopts="--with-ed25519-libsodium" ci_pkgs="libsodium-dev" - ci_docker=debian:buster-slim ci_distro=debian ci_suite=buster ci_configopts="--with-curl --with-ed25519-libsodium --without-gpgme" ci_pkgs="libsodium-dev" + # A 32 bit build to act as a proxy for frequently deployed 32 bit armv7 + - ci_docker=i386/debian:buster-slim ci_distro=debian ci_suite=buster - ci_docker=ubuntu:focal ci_distro=ubuntu ci_suite=focal - ci_docker=ubuntu:groovy ci_distro=ubuntu ci_suite=groovy From fce69cdf70ca959410ffd324ee978300cc72a5e0 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 7 Apr 2021 21:03:15 +0000 Subject: [PATCH 28/33] repo: Add ostree_repo_write_symlink Continuation of the addition of `ostree_repo_write_regfile_inline()`. This will be helpful for ostree-rs-ext and importing from tar, it's quite inefficient and awkward for small files to end up creating a whole `GInputStream` and `GFileInfo` and etc. for small files. --- apidoc/ostree-sections.txt | 1 + src/libostree/libostree-devel.sym | 1 + src/libostree/ostree-repo-commit.c | 41 ++++++++++++++++++++++++++++++ src/libostree/ostree-repo.h | 10 ++++++++ tests/test-core.js | 1 + tests/test-repo.c | 12 +++++++++ 6 files changed, 66 insertions(+) diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index 3f48ef3a..65b9e7fd 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -356,6 +356,7 @@ ostree_repo_write_metadata_async ostree_repo_write_metadata_finish ostree_repo_write_content ostree_repo_write_regfile_inline +ostree_repo_write_symlink ostree_repo_write_metadata_trusted ostree_repo_write_metadata_stream_trusted ostree_repo_write_content_trusted diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index c4a70938..e218ddda 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -25,6 +25,7 @@ LIBOSTREE_2021.2 { global: ostree_repo_write_regfile_inline; + ostree_repo_write_symlink; } LIBOSTREE_2021.1; /* Stub section for the stable release *after* this development one; don't diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 409738ad..ae93eedb 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2814,6 +2814,47 @@ ostree_repo_write_regfile_inline (OstreeRepo *self, return ostree_checksum_from_bytes (csum); } +/** + * ostree_repo_write_symlink: + * @self: repo + * @expected_checksum: (allow-none): The expected checksum + * @uid: User id + * @gid: Group id + * @xattrs: (allow-none): Extended attributes, GVariant of type (ayay) + * @symlink_target: Target of the symbolic link + * @cancellable: Cancellable + * @error: Error + * + * Synchronously create a symlink object. + * + * Unlike `ostree_repo_write_content()`, if @expected_checksum is provided, + * this function will not check for the presence of the object beforehand. + * + * Returns: (transfer full): Checksum (as a hex string) of the committed file + * Since: 2021.2 + */ +char * +ostree_repo_write_symlink (OstreeRepo *self, + const char *expected_checksum, + guint32 uid, + guint32 gid, + GVariant *xattrs, + const char *symlink_target, + GCancellable *cancellable, + GError **error) +{ + g_assert (symlink_target != NULL); + + g_autoptr(GFileInfo) finfo = _ostree_mode_uidgid_to_gfileinfo (S_IFLNK | 0777, uid, gid); + g_file_info_set_attribute_byte_string (finfo, "standard::symlink-target", symlink_target); + g_autofree guint8* csum = NULL; + if (!write_content_object (self, expected_checksum, + NULL, finfo, xattrs, &csum, + cancellable, error)) + return NULL; + return ostree_checksum_from_bytes (csum); +} + typedef struct { OstreeRepo *repo; char *expected_checksum; diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index cd50fc43..7e08361b 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -435,6 +435,16 @@ char * ostree_repo_write_regfile_inline (OstreeRepo *self, GCancellable *cancellable, GError **error); +_OSTREE_PUBLIC +char * ostree_repo_write_symlink (OstreeRepo *self, + const char *expected_checksum, + guint32 uid, + guint32 gid, + GVariant *xattrs, + const char *symlink_target, + GCancellable *cancellable, + GError **error); + _OSTREE_PUBLIC gboolean ostree_repo_write_metadata_trusted (OstreeRepo *self, OstreeObjectType objtype, diff --git a/tests/test-core.js b/tests/test-core.js index 8f460a5f..5f3e9fe3 100755 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -56,6 +56,7 @@ let inline_checksum = repo.write_regfile_inline(null, 0, 0, regfile_mode, null, assertEquals(inline_checksum, "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"); let written = false; try { + // Changed an a to b from above to make the checksum not match repo.write_regfile_inline("8baa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873", 0, 0, regfile_mode, null, inline_content, null); written = true; } catch (e) { diff --git a/tests/test-repo.c b/tests/test-repo.c index ad81a7d6..35e929f9 100644 --- a/tests/test-repo.c +++ b/tests/test-repo.c @@ -236,6 +236,18 @@ test_write_regfile_api (Fixture *fixture, g_assert_no_error (error); g_assert_cmpstr (checksum, ==, "4f600d252338f93279c51c964915cb2c26f0d09082164c54890d1a3c78cdeb1e"); g_clear_pointer (&checksum, g_free); + + // Test symlinks + g_clear_pointer (&xattrs, g_variant_unref); + g_variant_builder_init (&xattrs_builder, (GVariantType*)"a(ayay)"); + g_variant_builder_add (&xattrs_builder, "(^ay^ay)", "security.selinux", "system_u:object_r:bin_t:s0"); + g_clear_pointer (&xattrs, g_variant_unref); + xattrs = g_variant_ref_sink (g_variant_builder_end (&xattrs_builder)); + + g_clear_pointer (&checksum, g_free); + checksum = ostree_repo_write_symlink (repo, NULL, 0, 0, xattrs, "bash", NULL, &error); + g_assert_no_error (error); + g_assert_cmpstr (checksum, ==, "23a2e97d21d960ac7a4e39a8721b1baff7b213e00e5e5641334f50506012fcff"); } int From 6f84aff0ae72b6b6b8b0b1c388c6a937c32160c8 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 9 Apr 2021 00:35:54 +0000 Subject: [PATCH 29/33] repo: Add ostree_repo_write_regfile This API is push rather than pull, which makes it much more suitable to use cases like parsing a tar file from external code. Now, we have a large mess in this area internally because the original file writing code was pull based, but static deltas hit the same problem of wanting a push API, so I added this special `OstreeRepoBareContent` just for writing regular files from a push API. Eventually...I'd like to deprecate the pull based API, and rework things so that for regular files the push API is the default, and then `write_content_object()` would be split up into archive/bare cases. In this world the `ostree_repo_write_content()` API would then need to hackily bridge pull to push and it'd be less efficient. Anyways for now due to this bifurcation, this API only works on non-archive repositories, but that's fine for now because that's what I want for the `ostree-ext-container` bits. --- Makefile-libostree.am | 2 + apidoc/ostree-sections.txt | 7 ++ src/libostree/libostree-devel.sym | 3 + src/libostree/ostree-content-writer.c | 144 ++++++++++++++++++++++++++ src/libostree/ostree-content-writer.h | 36 +++++++ src/libostree/ostree-repo-commit.c | 33 ++++++ src/libostree/ostree-repo-private.h | 10 ++ src/libostree/ostree-repo.h | 10 ++ src/libostree/ostree-types.h | 1 + tests/test-core.js | 43 ++++++-- tests/test-repo.c | 1 - 11 files changed, 282 insertions(+), 8 deletions(-) create mode 100644 src/libostree/ostree-content-writer.c create mode 100644 src/libostree/ostree-content-writer.h diff --git a/Makefile-libostree.am b/Makefile-libostree.am index 1a5d6f9f..d40de48d 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -66,6 +66,8 @@ libostree_1_la_SOURCES = \ src/libostree/ostree-checksum-input-stream.h \ src/libostree/ostree-chain-input-stream.c \ src/libostree/ostree-chain-input-stream.h \ + src/libostree/ostree-content-writer.c \ + src/libostree/ostree-content-writer.h \ src/libostree/ostree-lzma-common.c \ src/libostree/ostree-lzma-common.h \ src/libostree/ostree-lzma-compressor.c \ diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index 65b9e7fd..b09ba6f9 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -165,6 +165,12 @@ ostree_check_version ostree_commit_sizes_entry_get_type
+
+ostree-content-writer +ostree_content_writer_get_type +ostree_content_writer_finish +
+
ostree-deployment OstreeDeployment @@ -355,6 +361,7 @@ ostree_repo_write_metadata ostree_repo_write_metadata_async ostree_repo_write_metadata_finish ostree_repo_write_content +ostree_repo_write_regfile ostree_repo_write_regfile_inline ostree_repo_write_symlink ostree_repo_write_metadata_trusted diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index e218ddda..8cc11c65 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -26,6 +26,9 @@ LIBOSTREE_2021.2 { global: ostree_repo_write_regfile_inline; ostree_repo_write_symlink; + ostree_repo_write_regfile; + ostree_content_writer_get_type; + ostree_content_writer_finish; } LIBOSTREE_2021.1; /* Stub section for the stable release *after* this development one; don't diff --git a/src/libostree/ostree-content-writer.c b/src/libostree/ostree-content-writer.c new file mode 100644 index 00000000..2e375307 --- /dev/null +++ b/src/libostree/ostree-content-writer.c @@ -0,0 +1,144 @@ +/* + * SPDX-License-Identifier: LGPL-2.0+ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "ostree-content-writer.h" +#include "ostree-repo-private.h" +#include "ostree-autocleanups.h" + +struct _OstreeContentWriter +{ + GOutputStream parent_instance; + + OstreeRepo *repo; + OstreeRepoBareContent output; +}; + +G_DEFINE_TYPE (OstreeContentWriter, ostree_content_writer, G_TYPE_OUTPUT_STREAM) + +static void ostree_content_writer_finalize (GObject *object); +static gssize ostree_content_writer_write (GOutputStream *stream, + const void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); +static gboolean ostree_content_writer_close (GOutputStream *stream, + GCancellable *cancellable, + GError **error); + +static void +ostree_content_writer_class_init (OstreeContentWriterClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass); + + gobject_class->finalize = ostree_content_writer_finalize; + + stream_class->write_fn = ostree_content_writer_write; + stream_class->close_fn = ostree_content_writer_close; +} + +static void +ostree_content_writer_finalize (GObject *object) +{ + OstreeContentWriter *stream; + + stream = (OstreeContentWriter*)(object); + + g_clear_object (&stream->repo); + _ostree_repo_bare_content_cleanup (&stream->output); + + G_OBJECT_CLASS (ostree_content_writer_parent_class)->finalize (object); +} + +static void +ostree_content_writer_init (OstreeContentWriter *self) +{ + self->output.initialized = FALSE; + } + +OstreeContentWriter * +_ostree_content_writer_new (OstreeRepo *repo, + const char *checksum, + guint uid, + guint gid, + guint mode, + guint64 content_len, + GVariant *xattrs, + GError **error) +{ + g_autoptr(OstreeContentWriter) stream = g_object_new (OSTREE_TYPE_CONTENT_WRITER, NULL); + stream->repo = g_object_ref (repo); + if (!_ostree_repo_bare_content_open (stream->repo, checksum, content_len, uid, gid, mode, xattrs, + &stream->output, NULL, error)) + return NULL; + return g_steal_pointer (&stream); +} + +static gssize +ostree_content_writer_write (GOutputStream *stream, + const void *buffer, + gsize count, + GCancellable *cancellable, + GError **error) +{ + OstreeContentWriter *self = (OstreeContentWriter*) stream; + + if (g_cancellable_set_error_if_cancelled (cancellable, error)) + return -1; + + if (!_ostree_repo_bare_content_write (self->repo, &self->output, + buffer, count, cancellable, error)) + return -1; + return count; +} + +static gboolean +ostree_content_writer_close (GOutputStream *stream, + GCancellable *cancellable, + GError **error) +{ + /* We don't expect people to invoke close() - they need to call finish() + * to get the checksum. We'll clean up in finalize anyways if need be. + */ + return TRUE; +} + +/** + * ostree_content_writer_finish: + * @self: Writer + * @cancellable: Cancellable + * @error: Error + * + * Complete the object write and return the checksum. + * Returns: (transfer full): Checksum, or %NULL on error + */ +char * +ostree_content_writer_finish (OstreeContentWriter *self, + GCancellable *cancellable, + GError **error) +{ + char actual_checksum[OSTREE_SHA256_STRING_LEN+1]; + if (!_ostree_repo_bare_content_commit (self->repo, &self->output, actual_checksum, + sizeof (actual_checksum), cancellable, error)) + return NULL; + + return g_strdup (actual_checksum); +} diff --git a/src/libostree/ostree-content-writer.h b/src/libostree/ostree-content-writer.h new file mode 100644 index 00000000..87a85aa0 --- /dev/null +++ b/src/libostree/ostree-content-writer.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.0+ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * 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. + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define OSTREE_TYPE_CONTENT_WRITER (ostree_content_writer_get_type ()) +_OSTREE_PUBLIC G_DECLARE_FINAL_TYPE (OstreeContentWriter, ostree_content_writer, OSTREE, CONTENT_WRITER, GOutputStream) + +_OSTREE_PUBLIC +char * ostree_content_writer_finish (OstreeContentWriter *self, + GCancellable *cancellable, + GError **error); + +G_END_DECLS diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index ae93eedb..769dd6a7 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2855,6 +2855,39 @@ ostree_repo_write_symlink (OstreeRepo *self, return ostree_checksum_from_bytes (csum); } +/** + * ostree_repo_write_regfile: + * @self: Repo, + * @expected_checksum: (allow-none): Expected checksum (SHA-256 hex string) + * @uid: user id + * @gid: group id + * @mode: Unix file mode + * @content_len: Expected content length + * @xattrs: (allow-none): Extended attributes (GVariant type `(ayay)`) + * @error: Error + * + * Create an `OstreeContentWriter` that allows streaming output into + * the repository. + * + * Returns: (transfer full): A new writer, or %NULL on error + * Since: 2021.2 + */ +OstreeContentWriter * +ostree_repo_write_regfile (OstreeRepo *self, + const char *expected_checksum, + guint32 uid, + guint32 gid, + guint32 mode, + guint64 content_len, + GVariant *xattrs, + GError **error) +{ + if (self->mode == OSTREE_REPO_MODE_ARCHIVE) + return glnx_null_throw (error, "Cannot currently use ostree_repo_write_regfile() on an archive mode repository"); + + return _ostree_content_writer_new (self, expected_checksum, uid, gid, mode, content_len, xattrs, error); +} + typedef struct { OstreeRepo *repo; char *expected_checksum; diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h index 6c01bc6b..14b29c0b 100644 --- a/src/libostree/ostree-repo-private.h +++ b/src/libostree/ostree-repo-private.h @@ -462,6 +462,16 @@ _ostree_repo_bare_content_commit (OstreeRepo *self, GCancellable *cancellable, GError **error); +OstreeContentWriter * +_ostree_content_writer_new (OstreeRepo *repo, + const char *checksum, + guint uid, + guint gid, + guint mode, + guint64 content_len, + GVariant *xattrs, + GError **error); + gboolean _ostree_repo_load_file_bare (OstreeRepo *self, const char *checksum, diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 7e08361b..f94d70be 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -435,6 +435,16 @@ char * ostree_repo_write_regfile_inline (OstreeRepo *self, GCancellable *cancellable, GError **error); +_OSTREE_PUBLIC +OstreeContentWriter * ostree_repo_write_regfile (OstreeRepo *self, + const char *expected_checksum, + guint32 uid, + guint32 gid, + guint32 mode, + guint64 content_len, + GVariant *xattrs, + GError **error); + _OSTREE_PUBLIC char * ostree_repo_write_symlink (OstreeRepo *self, const char *expected_checksum, diff --git a/src/libostree/ostree-types.h b/src/libostree/ostree-types.h index bbc6ca64..c6f9cba1 100644 --- a/src/libostree/ostree-types.h +++ b/src/libostree/ostree-types.h @@ -38,6 +38,7 @@ typedef struct OstreeSysroot OstreeSysroot; typedef struct OstreeSysrootUpgrader OstreeSysrootUpgrader; typedef struct OstreeMutableTree OstreeMutableTree; typedef struct OstreeRepoFile OstreeRepoFile; +typedef struct _OstreeContentWriter OstreeContentWriter; typedef struct OstreeRemote OstreeRemote; G_END_DECLS diff --git a/tests/test-core.js b/tests/test-core.js index 5f3e9fe3..1d13cfbe 100755 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -27,6 +27,22 @@ function assertEquals(a, b) { throw new Error("assertion failed " + JSON.stringify(a) + " == " + JSON.stringify(b)); } +function assertThrows(s, f) { + let success = false; + try { + f(); + success = true; + } catch(e) { + let msg = e.toString(); + if (msg.indexOf(s) == -1) { + throw new Error("Error message didn't match '" + s + "': " + msg) + } + } + if (success) { + throw new Error("Function was expected to throw, but didn't") + } +} + print('1..1') let testDataDir = Gio.File.new_for_path('test-data'); @@ -51,18 +67,14 @@ print("commit => " + commit); // Test direct write APIs let inline_content = "default 0.0.0.0\nloopback 127.0.0.0\nlink-local 169.254.0.0\n"; +let networks_checksum = "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"; let regfile_mode = 33188; // 0o100000 | 0o644 (but in decimal so old gjs works) let inline_checksum = repo.write_regfile_inline(null, 0, 0, regfile_mode, null, inline_content, null); assertEquals(inline_checksum, "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"); -let written = false; -try { +assertThrows("Corrupted file object", function() { // Changed an a to b from above to make the checksum not match repo.write_regfile_inline("8baa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873", 0, 0, regfile_mode, null, inline_content, null); - written = true; -} catch (e) { -} -if (written) - throw new Error("Wrote invalid checksum"); +}); repo.commit_transaction(null, null); @@ -85,4 +97,21 @@ repo.commit_transaction(null, null); [,readCommit] = repo.resolve_rev('someref', true); assertEquals(readCommit, null); +// Test direct write API for regular files +let clen = inline_content.length; +assertThrows("Cannot currently use", function() { + let w = repo.write_regfile(null, 0, 0, regfile_mode, clen, null); +}); + +let bareRepoPath = Gio.File.new_for_path('repo'); +let repo_bareu = OSTree.Repo.new(Gio.File.new_for_path('repo-bare')); +repo_bareu.create(OSTree.RepoMode.BARE_USER_ONLY, null); +let w = repo_bareu.write_regfile(null, 0, 0, regfile_mode, clen, null); +// Test multiple write() calls +w.write(inline_content.slice(0, 4), null) +w.write(inline_content.slice(4, 10), null) +w.write(inline_content.slice(10), null) +let actual_checksum = w.finish(null) +assertEquals(actual_checksum, networks_checksum) + print("ok test-core"); diff --git a/tests/test-repo.c b/tests/test-repo.c index 35e929f9..9337ac3b 100644 --- a/tests/test-repo.c +++ b/tests/test-repo.c @@ -241,7 +241,6 @@ test_write_regfile_api (Fixture *fixture, g_clear_pointer (&xattrs, g_variant_unref); g_variant_builder_init (&xattrs_builder, (GVariantType*)"a(ayay)"); g_variant_builder_add (&xattrs_builder, "(^ay^ay)", "security.selinux", "system_u:object_r:bin_t:s0"); - g_clear_pointer (&xattrs, g_variant_unref); xattrs = g_variant_ref_sink (g_variant_builder_end (&xattrs_builder)); g_clear_pointer (&checksum, g_free); From 2cc11b7808f7d7d5be87fef6cf0db8a48a9dd539 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 9 Apr 2021 21:54:21 +0000 Subject: [PATCH 30/33] tests: More tests for inline writing I'm hitting a bug, add more tests. --- tests/test-core.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/test-core.js b/tests/test-core.js index 1d13cfbe..2c7162be 100755 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -19,6 +19,7 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +const ByteArray = imports.byteArray; const Gio = imports.gi.Gio; const OSTree = imports.gi.OSTree; @@ -70,12 +71,31 @@ let inline_content = "default 0.0.0.0\nloopback 127.0.0.0\nlink-local 169.254.0. let networks_checksum = "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"; let regfile_mode = 33188; // 0o100000 | 0o644 (but in decimal so old gjs works) let inline_checksum = repo.write_regfile_inline(null, 0, 0, regfile_mode, null, inline_content, null); -assertEquals(inline_checksum, "8aaa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873"); +assertEquals(inline_checksum, networks_checksum); assertThrows("Corrupted file object", function() { // Changed an a to b from above to make the checksum not match repo.write_regfile_inline("8baa9dc13a0c5839fe4a277756798c609c53fac6fa2290314ecfef9041065873", 0, 0, regfile_mode, null, inline_content, null); }); +{ + let [_, instream, info, xattrs] = repo.load_file(networks_checksum, null); + // Read the whole content into a string via this amazing rube goldberg machine + let datain = Gio.DataInputStream.new(instream); + let bufw = Gio.MemoryOutputStream.new_resizable(); + bufw.splice(datain, 0, null); + bufw.close(null); + let contents = bufw.steal_as_bytes(); + let contentsStr = ByteArray.toString(contents.get_data()) + assertEquals(contentsStr, inline_content); + + let uid = info.get_attribute_uint32("unix::uid"); + assertEquals(uid, 0); + let mode = info.get_attribute_uint32("unix::mode"); + assertEquals(mode, regfile_mode); + + assertEquals(xattrs.n_children(), 0); +} + repo.commit_transaction(null, null); let [,root,checksum] = repo.read_commit(commit, null); From 9b4bffc45488d628758ab2322849cbd3e94f7964 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 9 Apr 2021 22:29:55 +0000 Subject: [PATCH 31/33] repo: Ensure we set the size for regfile inline Need to clean up the internal APIs for this. --- src/libostree/ostree-repo-commit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 769dd6a7..1ac53259 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2806,6 +2806,7 @@ ostree_repo_write_regfile_inline (OstreeRepo *self, { g_autoptr(GInputStream) memin = g_memory_input_stream_new_from_data (buf, len, NULL); g_autoptr(GFileInfo) finfo = _ostree_mode_uidgid_to_gfileinfo (mode, uid, gid); + g_file_info_set_size (finfo, len); g_autofree guint8* csum = NULL; if (!write_content_object (self, expected_checksum, memin, finfo, xattrs, &csum, From 388764f1ed5bb5bdb0700cee3d8df4ddf0b7aa22 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 9 Apr 2021 22:58:54 -0400 Subject: [PATCH 32/33] docs: fix "Edit this page on GitHub" links --- docs/_config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/_config.yml b/docs/_config.yml index 835733a0..e28f6506 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -29,6 +29,7 @@ gh_edit_link: true gh_edit_link_text: "Edit this page on GitHub" gh_edit_repository: "https://github.com/ostreedev/ostree" gh_edit_branch: "master" +gh_edit_source: docs gh_edit_view_mode: "tree" compress_html: From 6a72674ec621a2282043c3a083fe1e45cd6a8761 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 15 Apr 2021 12:58:31 -0400 Subject: [PATCH 33/33] Release 2021.2 --- Makefile-libostree.am | 6 +++--- configure.ac | 2 +- docs/CONTRIBUTING.md | 2 +- src/libostree/libostree-devel.sym | 9 --------- src/libostree/libostree-released.sym | 9 +++++++++ tests/test-symbols.sh | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Makefile-libostree.am b/Makefile-libostree.am index d40de48d..dd396974 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -173,9 +173,9 @@ endif # USE_GPGME symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym # Uncomment this include when adding new development symbols. -if BUILDOPT_IS_DEVEL_BUILD -symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym -endif +#if BUILDOPT_IS_DEVEL_BUILD +#symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym +#endif # http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html wl_versionscript_arg = -Wl,--version-script= diff --git a/configure.ac b/configure.ac index f372a0eb..e8108732 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ m4_define([year_version], [2021]) m4_define([release_version], [2]) m4_define([package_version], [year_version.release_version]) AC_INIT([libostree], [package_version], [walters@verbum.org]) -is_release_build=no +is_release_build=yes AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([buildutil]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 1cf6250d..03797a25 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -182,4 +182,4 @@ For a detailed walk-through on building, modifying, and testing, see this [tutor Releases can be performed by [creating a new release ticket][new-release-ticket] and following the steps in the checklist there. -[new-release-ticket]: https://github.com/ostreedev/ostree/new?labels=kind/release&template=release-checklist.md +[new-release-ticket]: https://github.com/ostreedev/ostree/issues/new?labels=kind/release&template=release-checklist.md diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 8cc11c65..e3cd14a4 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -22,15 +22,6 @@ - uncomment the include in Makefile-libostree.am */ -LIBOSTREE_2021.2 { -global: - ostree_repo_write_regfile_inline; - ostree_repo_write_symlink; - ostree_repo_write_regfile; - ostree_content_writer_get_type; - ostree_content_writer_finish; -} LIBOSTREE_2021.1; - /* Stub section for the stable release *after* this development one; don't * edit this other than to update the year. This is just a copy/paste * source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION diff --git a/src/libostree/libostree-released.sym b/src/libostree/libostree-released.sym index f1c773b3..9a45c0d8 100644 --- a/src/libostree/libostree-released.sym +++ b/src/libostree/libostree-released.sym @@ -644,6 +644,15 @@ global: ostree_sysroot_require_booted_deployment; } LIBOSTREE_2020.8; +LIBOSTREE_2021.2 { +global: + ostree_repo_write_regfile_inline; + ostree_repo_write_symlink; + ostree_repo_write_regfile; + ostree_content_writer_get_type; + ostree_content_writer_finish; +} LIBOSTREE_2021.1; + /* NOTE: Only add more content here in release commits! See the * comments at the top of this file. */ diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh index 2f7d9d02..14adc867 100755 --- a/tests/test-symbols.sh +++ b/tests/test-symbols.sh @@ -56,7 +56,7 @@ echo 'ok documented symbols' # ONLY update this checksum in release commits! cat > released-sha256.txt <