From 46a0911c6d3999e36a10861c94f0c48c033a46f2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 15 Apr 2021 11:13:31 -0400 Subject: [PATCH 01/50] build-sys: Add toplevel workspace Cargo.toml rust-analyzer is happier with this because it understands the project structure out of the box. We aren't actually again adding a dependency on Rust/cargo in the core, this is only used to make `cargo build` work out of the box to build the Rust test code. --- Cargo.toml | 6 ++++++ Makefile.am | 3 +++ tests/inst/.gitignore | 2 -- tests/kolainst/Makefile | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 Cargo.toml delete mode 100644 tests/inst/.gitignore diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..b2aa3f4e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +# Today, this repository only uses Rust for tests. This +# toplevel Cargo.toml helps tools like rust-analyzer understand +# that this project contains Rust code. We don't otherwise currently +# use `cargo` for any part of the core build. +[workspace] +members = ["tests/inst"] diff --git a/Makefile.am b/Makefile.am index b2588ad7..2f3cb53f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,9 @@ GITIGNOREFILES = aclocal.m4 build-aux/ buildutil/*.m4 config.h.in gtk-doc.make # Generated by coreos-assembler build-fast and kola GITIGNOREFILES += fastbuild-*.qcow2 _kola_temp/ +# Rust stuff +GITIGNOREFILES += target/ Cargo.lock + SUBDIRS += . if ENABLE_GTK_DOC diff --git a/tests/inst/.gitignore b/tests/inst/.gitignore deleted file mode 100644 index 2c96eb1b..00000000 --- a/tests/inst/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -target/ -Cargo.lock diff --git a/tests/kolainst/Makefile b/tests/kolainst/Makefile index acfdc3b7..5dc18281 100644 --- a/tests/kolainst/Makefile +++ b/tests/kolainst/Makefile @@ -12,6 +12,6 @@ all: install: install -D -m 0644 -t $(KOLA_TESTDIR) $(LIBSCRIPTS) for x in $(TESTDIRS); do rsync -rlv ./$${x} $(KOLA_TESTDIR)/; done - install -D -m 0755 -t $(KOLA_TESTDIR)/nondestructive-rs ../inst/target/release/ostree-test + install -D -m 0755 -t $(KOLA_TESTDIR)/nondestructive-rs ../../target/release/ostree-test install -D -m 0644 destructive-stamp.ign $(KOLA_TESTDIR)/destructive-rs/config.ign ./install-wrappers.sh destructive-list.txt $(KOLA_TESTDIR)/destructive-rs From 7310203ce93c21502295c47cd116ab28a881223b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 15 Apr 2021 10:43:33 -0400 Subject: [PATCH 02/50] tests/inst: Make nondestructive tests runnable as unit tests Ideally in the future we change more of our unit tests to support running installed; we've tried this in the past with https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests I'd like to pick that back up again. This takes a step towards that by having our Rust tests. To make this even easier, add a `tests/run-installed` which runs the installed tests (uninstalled, confusingly but conveniently for now). --- Makefile-tests.am | 3 +++ tests/inst/src/sysroot.rs | 9 ++++++++- tests/run-installed | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 tests/run-installed diff --git a/Makefile-tests.am b/Makefile-tests.am index 23dba331..c99a7ede 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -431,8 +431,11 @@ if ENABLE_INSTALLED_TESTS_EXCLUSIVE dist_installed_test_scripts = $(_installed_or_uninstalled_test_scripts) installed_test_programs = $(_installed_or_uninstalled_test_programs) check-local: + echo "NOTE: Run the Rust installed tests (uninstalled) with ./tests/run-installed" echo "NOTE: Exclusive installed tests are enabled; to run them, make install, then: gnome-desktop-testing-runner -p 0 libostree/" else +check-local: + echo "NOTE: Run the Rust installed tests (uninstalled) with ./tests/run-installed" dist_test_scripts += $(_installed_or_uninstalled_test_scripts) test_programs += $(_installed_or_uninstalled_test_programs) endif diff --git a/tests/inst/src/sysroot.rs b/tests/inst/src/sysroot.rs index a8ff3eb3..ce0378eb 100644 --- a/tests/inst/src/sysroot.rs +++ b/tests/inst/src/sysroot.rs @@ -6,10 +6,14 @@ use ostree::prelude::*; use crate::test::*; +fn skip_non_ostree_host() -> bool { + !std::path::Path::new("/run/ostree-booted").exists() +} + #[itest] fn test_sysroot_ro() -> Result<()> { // TODO add a skipped identifier - if !std::path::Path::new("/run/ostree-booted").exists() { + if skip_non_ostree_host() { return Ok(()); } let cancellable = Some(gio::Cancellable::new()); @@ -34,6 +38,9 @@ fn test_sysroot_ro() -> Result<()> { #[itest] fn test_immutable_bit() -> Result<()> { + if skip_non_ostree_host() { + return Ok(()); + } // https://bugzilla.redhat.com/show_bug.cgi?id=1867601 cmd_has_output(sh_inline::bash_command!("lsattr -d /").unwrap(), "-i-")?; Ok(()) diff --git a/tests/run-installed b/tests/run-installed new file mode 100755 index 00000000..e9f9842b --- /dev/null +++ b/tests/run-installed @@ -0,0 +1,6 @@ +#!/bin/bash +# Run this script after e.g. `sudo make install` in a development container/host +# to run tests which operate on the installed binaries. +set -xeuo pipefail +dn=$(dirname $0) +(cd ${dn}/../tests/inst && cargo run --release) From 3595414c867362a9bd4fee3aae5220de03d3a3ca Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 15 Apr 2021 13:02:19 -0400 Subject: [PATCH 03/50] configure: post-release version bump --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e8108732..2ce7bdf1 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], [2]) +m4_define([release_version], [3]) 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 9d48d39a4b16c4faa58488107cd0a53c8144a7ca Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Apr 2021 12:16:45 +0100 Subject: [PATCH 04/50] libtest: On failure, make it clearer what has happened If we fail as a result of `set -x`, It's often not completely obvious which command failed or how. Use a trap on ERR to show the command that failed, and its exit status. Signed-off-by: Simon McVittie --- tests/libtest.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/libtest.sh b/tests/libtest.sh index eda3b921..2e9a99df 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -46,6 +46,14 @@ run_exit_cmds() { } trap run_exit_cmds EXIT +report_err () { + local exit_status="$?" + { { local BASH_XTRACEFD=3; } 2> /dev/null + echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2 + } 3> /dev/null +} +trap report_err ERR + save_core() { if [ -e core ]; then cp core "$test_srcdir/core" From e660855796a40ad417d13cbe081bd62e56a1c6f5 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 19 Apr 2021 11:00:20 -0600 Subject: [PATCH 05/50] tests: Test without a cache directory by default Several tests generate summaries and then expect to use the generated summary immediately. However, this can cause intermittent test failures when they inadvertantly get a cached summary file. This typically happens when the test is run on a filesystem that doesn't support user extended attributes. In that case, the caching code can only use the last modified time, which only has 1 second granularity. If tests don't carefully manage the summary modification times or the repo cache then they are likely subject to races in some test environments. This introduces an environment variable `OSTREE_SKIP_CACHE` that prevents the repo from using a cache directory. This is enabled by default in tests and disabled for tests that are a explicitly trying to test the caching behavior. Fixes: #2313 Fixes: #2351 --- src/libostree/ostree-repo.c | 2 +- tests/libtest.sh | 5 +++++ tests/test-pull-summary-caching.sh | 3 +++ tests/test-pull-summary-sigs.sh | 3 +++ tests/test-signed-pull-summary.sh | 3 +++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index b2347b47..76b02482 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3291,7 +3291,7 @@ ostree_repo_open (OstreeRepo *self, if (!glnx_opendirat (self->repo_dir_fd, "tmp", TRUE, &self->tmp_dir_fd, error)) return FALSE; - if (self->writable) + if (self->writable && getenv ("OSTREE_SKIP_CACHE") == NULL) { if (!glnx_shutil_mkdir_p_at (self->tmp_dir_fd, _OSTREE_CACHE_DIR, DEFAULT_DIRECTORY_MODE, cancellable, error)) return FALSE; diff --git a/tests/libtest.sh b/tests/libtest.sh index 2e9a99df..40f362be 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -86,6 +86,11 @@ unset TAR_OPTIONS # easily clean up. export OSTREE_SYSROOT_DEBUG=mutable-deployments +# By default, don't use a cache directory since it makes the tests racy. +# Tests that are explicitly testing the cache operation should unset +# this. +export OSTREE_SKIP_CACHE=1 + export TEST_GPG_KEYID_1="7FCA23D8472CDAFA" export TEST_GPG_KEYFPR_1="5E65DE75AB1C501862D476347FCA23D8472CDAFA" export TEST_GPG_KEYID_2="D8228CFECA950D41" diff --git a/tests/test-pull-summary-caching.sh b/tests/test-pull-summary-caching.sh index 9671199a..37c2aed6 100755 --- a/tests/test-pull-summary-caching.sh +++ b/tests/test-pull-summary-caching.sh @@ -31,6 +31,9 @@ if ! has_gpgme; then exit 0 fi +# Ensure repo caching is in use. +unset OSTREE_SKIP_CACHE + COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}" echo "1..1" diff --git a/tests/test-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh index 3819cbf3..04a8e488 100755 --- a/tests/test-pull-summary-sigs.sh +++ b/tests/test-pull-summary-sigs.sh @@ -23,6 +23,9 @@ set -euo pipefail . $(dirname $0)/libtest.sh +# Ensure repo caching is in use. +unset OSTREE_SKIP_CACHE + COMMIT_SIGN="" if has_gpgme; then COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}" diff --git a/tests/test-signed-pull-summary.sh b/tests/test-signed-pull-summary.sh index e953f2ea..3d468693 100755 --- a/tests/test-signed-pull-summary.sh +++ b/tests/test-signed-pull-summary.sh @@ -27,6 +27,9 @@ set -euo pipefail echo "1..14" +# Ensure repo caching is in use. +unset OSTREE_SKIP_CACHE + # This is explicitly opt in for testing export OSTREE_DUMMY_SIGN_ENABLED=1 From 73a896e62c3400a8f5eb4337225c95287be621cb Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 27 Apr 2021 13:08:57 -0400 Subject: [PATCH 06/50] ci: Fix GH action for rustfmt Since we now have a toplevel workspace, just use that. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 42eaac83..6a867d2c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,4 +24,4 @@ jobs: default: true components: rustfmt, clippy - name: cargo fmt (check) - run: cd tests/inst && cargo fmt -- --check -l + run: cargo fmt -- --check -l From 0f3bccf640947306a0369ef3cecc756eef3f106d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 27 Apr 2021 11:35:13 -0400 Subject: [PATCH 07/50] pull: Cleanly error out on unknown schemes Previous to this we'd trip an assertion `abort()` deep in the curl code if e.g. a user did `ostree remote add foo htttp://...` etc. Motivated by considering supporting "external remotes" where code outside ostree does a pull, but we want to reuse the signing verification infrastructure. --- src/libostree/ostree-fetcher-uri.c | 18 ++++++++++++++++++ src/libostree/ostree-fetcher.h | 3 +++ src/libostree/ostree-repo-pull.c | 3 +++ tests/pull-test.sh | 12 ++++++++++-- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-fetcher-uri.c b/src/libostree/ostree-fetcher-uri.c index 485ed187..a08c623e 100644 --- a/src/libostree/ostree-fetcher-uri.c +++ b/src/libostree/ostree-fetcher-uri.c @@ -117,3 +117,21 @@ _ostree_fetcher_uri_to_string (OstreeFetcherURI *uri) { return soup_uri_to_string ((SoupURI*)uri, FALSE); } + + +/* Only accept http, https, and file; particularly curl has a ton of other + * backends like sftp that we don't want, and this also gracefully filters + * out invalid input. + */ +gboolean +_ostree_fetcher_uri_validate (OstreeFetcherURI *uri, GError **error) +{ + const char *scheme = soup_uri_get_scheme ((SoupURI*)uri); + // TODO only allow file if explicitly requested by a higher level + if (!(g_str_equal (scheme, "http") || g_str_equal (scheme, "https") || g_str_equal (scheme, "file"))) + { + g_autofree char *s = _ostree_fetcher_uri_to_string (uri); + return glnx_throw (error, "Invalid URI scheme in %s", s); + } + return TRUE; +} diff --git a/src/libostree/ostree-fetcher.h b/src/libostree/ostree-fetcher.h index 2065ee54..c02ac38c 100644 --- a/src/libostree/ostree-fetcher.h +++ b/src/libostree/ostree-fetcher.h @@ -90,6 +90,9 @@ _ostree_fetcher_uri_get_path (OstreeFetcherURI *uri); char * _ostree_fetcher_uri_to_string (OstreeFetcherURI *uri); +gboolean +_ostree_fetcher_uri_validate (OstreeFetcherURI *uri, GError **error); + GType _ostree_fetcher_get_type (void) G_GNUC_CONST; OstreeFetcher *_ostree_fetcher_new (int tmpdir_dfd, diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index ab47a2a4..12409e63 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -3446,6 +3446,9 @@ compute_effective_mirrorlist (OstreeRepo *self, if (!baseuri) return FALSE; + if (!_ostree_fetcher_uri_validate (baseuri, error)) + return FALSE; + *out_mirrorlist = g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free); g_ptr_array_add (*out_mirrorlist, g_steal_pointer (&baseuri)); diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 5e719bf8..274bd978 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -55,10 +55,10 @@ function verify_initial_contents() { } if has_gpgme; then - echo "1..36" + echo "1..37" else # 3 tests needs GPG support - echo "1..33" + echo "1..34" fi # Try both syntaxes @@ -142,6 +142,14 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo pull origin main ${CMD_PREFIX} ostree --repo=mirrorrepo fsck echo "ok pull (refuses deltas)" +${CMD_PREFIX} ostree --repo=mirrorrepo remote add broken badscheme://something +if ${CMD_PREFIX} ostree --repo=mirrorrepo pull broken main 2>err.txt; then + assert_not_reached "pulled from invalid" +fi +assert_file_has_content_literal err.txt "Invalid URI scheme in badscheme://something" +${CMD_PREFIX} ostree --repo=mirrorrepo remote delete broken +echo "ok clean error on invalid scheme" + cd ${test_tmpdir} rm mirrorrepo/refs/remotes/* -rf ${CMD_PREFIX} ostree --repo=mirrorrepo prune --refs-only From 788e171b7cf3ff87b2a73cd4734644eebb9db989 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 30 Apr 2021 10:50:15 -0400 Subject: [PATCH 08/50] docs: Add more details about 3-way merge This came up a few times so let's go into more details in the docs. --- docs/atomic-upgrades.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/atomic-upgrades.md b/docs/atomic-upgrades.md index f4b31aca..3270ff6e 100644 --- a/docs/atomic-upgrades.md +++ b/docs/atomic-upgrades.md @@ -69,10 +69,26 @@ given commit is deployed more than once, it will be incremented. This is supported because the previous deployment may have configuration in `/etc` that we do not want to use or overwrite. -Now that we have a deployment directory, a 3-way merge is -performed between the (by default) currently booted deployment's -`/etc`, its default -configuration, and the new deployment (based on its `/usr/etc`). +Now that we have a deployment directory, a 3-way merge is performed +between the (by default) currently booted deployment's `/etc`, its +default configuration, and the new deployment (based on its `/usr/etc`). + +How it works is: +- Files in the currently booted deployment's `/etc` which were modified + from the default `/usr/etc` (of the same deployment) are retained. +- Files in the currently booted deployment's `/etc` which were not + modified from the default `/usr/etc` (of the same deployment) are + upgraded to the new defaults from the new deployment's `/etc/etc`. + +Roughly, this means that as soon as you modify or add a file in `/etc`, +this file will be propagated forever as is (though there is a +corner-case, where if your modification eventually exactly matches a +future default file, then the file will go back to following future +default updates from that point on). + +You can use `ostree admin config-diff` to see the differences between +your booted deployment's `/etc` and the OSTree defaults. A command like +`diff {/usr,}/etc` will additional print line-level differences. ## Atomically swapping boot configuration From 7893e1907b66a742e4ce8e29dd9b5df0272e12ff Mon Sep 17 00:00:00 2001 From: Micah Abbott Date: Mon, 3 May 2021 10:34:01 -0400 Subject: [PATCH 09/50] docs: typo fix for /usr/etc --- docs/atomic-upgrades.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/atomic-upgrades.md b/docs/atomic-upgrades.md index 3270ff6e..6d58d845 100644 --- a/docs/atomic-upgrades.md +++ b/docs/atomic-upgrades.md @@ -78,7 +78,7 @@ How it works is: from the default `/usr/etc` (of the same deployment) are retained. - Files in the currently booted deployment's `/etc` which were not modified from the default `/usr/etc` (of the same deployment) are - upgraded to the new defaults from the new deployment's `/etc/etc`. + upgraded to the new defaults from the new deployment's `/usr/etc`. Roughly, this means that as soon as you modify or add a file in `/etc`, this file will be propagated forever as is (though there is a From 135675243addec680b88f47c9a1e34b175fde6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Fri, 7 May 2021 16:37:56 +0200 Subject: [PATCH 10/50] packit: update for F34, rawhide branch & master rename --- .packit.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index ebfe5648..1f2e8128 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -1,14 +1,14 @@ -# build into f32-coreos-continuous on every commit to master +# build into f34-coreos-continuous on every commit to main jobs: - job: production_build trigger: commit metadata: branch: master - targets: f32-coreos-continuous + targets: f34-coreos-continuous specfile_path: ostree.spec actions: # https://packit.dev/faq/#how-can-i-download-rpm-spec-file-if-it-is-not-part-of-upstream-repository post-upstream-clone: - - "wget https://src.fedoraproject.org/rpms/ostree/raw/master/f/ostree.spec" + - "wget https://src.fedoraproject.org/rpms/ostree/raw/rawhide/f/ostree.spec" # we don't want any downstream patches - "sed -ie 's/^Patch/# Patch/g' ostree.spec" From b8cca6cef14716987bbf7ef8f6edcbfc1688cc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Fri, 7 May 2021 16:38:16 +0200 Subject: [PATCH 11/50] *: rename master branch to main --- .cci.jenkinsfile | 4 +-- .github/ISSUE_TEMPLATE/release-checklist.md | 4 +-- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 4 +-- .packit.yaml | 2 +- README.md | 4 +-- ci/ci-commitmessage-submodules.sh | 2 +- docs/CONTRIBUTING.md | 2 +- docs/_config.yml | 2 +- docs/adapting-existing.md | 2 +- docs/contributing-tutorial.md | 34 ++++++++++----------- docs/index.md | 4 +-- docs/repo.md | 2 +- docs/repository-management.md | 2 +- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 33bc115e..12d9988a 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -57,9 +57,9 @@ codestyle: { buildPod(runAsUser:0) { checkout scm shwrap(""" - # Jenkins by default only fetches the branch it's testing. Explicitly fetch master + # Jenkins by default only fetches the branch it's testing. Explicitly fetch main # for ci-commitmessage-submodules.sh - git fetch origin +refs/heads/master:refs/remotes/origin/master + git fetch origin +refs/heads/main:refs/remotes/origin/main ci/ci-commitmessage-submodules.sh """) } diff --git a/.github/ISSUE_TEMPLATE/release-checklist.md b/.github/ISSUE_TEMPLATE/release-checklist.md index 3b02847f..ff290222 100644 --- a/.github/ISSUE_TEMPLATE/release-checklist.md +++ b/.github/ISSUE_TEMPLATE/release-checklist.md @@ -18,7 +18,7 @@ This guide requires: - Prepare local environment: - [ ] `git remote get-url --push origin` - [ ] validate that the output above points to `git@github.com:ostreedev/ostree.git` - - [ ] `git checkout master && git pull` + - [ ] `git checkout main && git pull` - [ ] `git clean -fd` - [ ] `RELEASE_VER=yyyy.n` (matching `package_version` in `configure.ac`) - [ ] `git checkout -b release-${RELEASE_VER}` @@ -56,7 +56,7 @@ This guide requires: - Clean up: - [ ] `git clean -fd` - - [ ] `git checkout master` + - [ ] `git checkout main` - [ ] `git pull` - [ ] `git push origin :release-${RELEASE_VER}` - [ ] `git branch -d release-${RELEASE_VER}` diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77a5bda3..399b6637 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: pull_request: - branches: [master] + branches: [main] paths: - 'configure.ac' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a867d2c..70233b8e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,9 @@ name: Rust on: push: - branches: [master] + branches: [main] pull_request: - branches: [master] + branches: [main] env: CARGO_TERM_COLOR: always diff --git a/.packit.yaml b/.packit.yaml index 1f2e8128..857d6ec4 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -3,7 +3,7 @@ jobs: - job: production_build trigger: commit metadata: - branch: master + branch: main targets: f34-coreos-continuous specfile_path: ostree.spec actions: diff --git a/README.md b/README.md index fcde7015..7074dbbc 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ However, in order to build from a git clone, you must update the submodules. If you're packaging OSTree and want a tarball, I recommend using a "recursive git archive" script. There are several available online; -[this code](https://github.com/ostreedev/ostree/blob/master/packaging/Makefile.dist-packaging#L11) +[this code](https://github.com/ostreedev/ostree/blob/main/packaging/Makefile.dist-packaging#L11) in OSTree is an example. Once you have a git clone or recursive archive, building is the @@ -157,7 +157,7 @@ See [Contributing](CONTRIBUTING.md). ## Licensing The licensing for the *code* of libostree can be canonically found in the individual files; -and the overall status in the [COPYING](https://github.com/ostreedev/ostree/blob/master/COPYING) +and the overall status in the [COPYING](https://github.com/ostreedev/ostree/blob/main/COPYING) file in the source. Currently, that's LGPLv2+. This also covers the man pages and API docs. The license for the manual documentation in the `doc/` directory is: diff --git a/ci/ci-commitmessage-submodules.sh b/ci/ci-commitmessage-submodules.sh index edc0d780..ebc18022 100755 --- a/ci/ci-commitmessage-submodules.sh +++ b/ci/ci-commitmessage-submodules.sh @@ -40,7 +40,7 @@ gitdir=$(realpath $(pwd)) # require a newer git, we could use `git worktree`. cp -a ${gitdir} ${tmpd}/workdir cd ${tmpd}/workdir -git log --pretty=oneline origin/master..$HEAD | while read logline; do +git log --pretty=oneline origin/main..$HEAD | while read logline; do commit=$(echo ${logline} | cut -f 1 -d ' ') # For merge commits, just check that they're empty (i.e. no conflict # resolution was needed). Otherwise, let's just error out. Conflicts should diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 03797a25..f7d7a5ca 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -72,7 +72,7 @@ For more information see [How to Write a Git Commit Message](https://chris.beams **Editing a Committed Message:** -To edit the message from the most recent commit run `git commit --amend`. To change older commits on the branch use `git rebase -i`. For a successful rebase have the branch track `upstream master`. Once the changes have been made and saved, run `git push --force origin `. +To edit the message from the most recent commit run `git commit --amend`. To change older commits on the branch use `git rebase -i`. For a successful rebase have the branch track `upstream main`. Once the changes have been made and saved, run `git push --force origin `. ## Running the test suite diff --git a/docs/_config.yml b/docs/_config.yml index e28f6506..836b22d8 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -28,7 +28,7 @@ last_edit_time_format: "%b %e %Y at %I:%M %p" 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_branch: "main" gh_edit_source: docs gh_edit_view_mode: "tree" diff --git a/docs/adapting-existing.md b/docs/adapting-existing.md index cc4b76d2..b9a157a4 100644 --- a/docs/adapting-existing.md +++ b/docs/adapting-existing.md @@ -92,7 +92,7 @@ After these steps, systemd switches root. If you are not using dracut or systemd, using OSTree should still be possible, but you will have to write the integration code. See the existing sources in -[src/switchroot](https://github.com/ostreedev/ostree/tree/master/src/switchroot) +[src/switchroot](https://github.com/ostreedev/ostree/tree/main/src/switchroot) as a reference. Patches to support other initramfs technologies and init systems, if diff --git a/docs/contributing-tutorial.md b/docs/contributing-tutorial.md index bb656f0e..a9e8d670 100644 --- a/docs/contributing-tutorial.md +++ b/docs/contributing-tutorial.md @@ -17,14 +17,14 @@ Fork https://github.com/ostreedev/ostree, then run the following commands. ```bash $ git clone https://github.com//ostree && cd ostree $ git remote add upstream https://github.com/ostreedev/ostree -$ git checkout master -$ git fetch upstream && git branch --set-upstream-to=upstream/master master +$ git checkout main +$ git fetch upstream && git branch --set-upstream-to=upstream/main main ``` -Make a branch from master for your patch. +Make a branch from main for your patch. ```bash $ git checkout -b -$ git branch --set-upstream-to=upstream/master +$ git branch --set-upstream-to=upstream/main ``` ## Building OSTree @@ -55,7 +55,7 @@ apt-get install build-essential && \ apt-get build-dep ostree ``` -[build.sh](https://github.com/ostreedev/ostree/blob/master/ci/build.sh) will have a list of packages needed to build ostree. +[build.sh](https://github.com/ostreedev/ostree/blob/main/ci/build.sh) will have a list of packages needed to build ostree. ### OSTree Build Commands @@ -120,7 +120,7 @@ RUN dnf update -y && \ dnf -y builddep ostree && \ dnf clean all -# clone ostree and update master branch +# clone ostree and update main branch COPY ostree-git.sh / RUN ../ostree-git.sh @@ -142,7 +142,7 @@ Save the following bash scripts in the same directory as the Dockerfile. Then ch #!/bin/bash # ostree-git.sh -# Clone ostree and update master branch +# Clone ostree and update main branch set -euo pipefail @@ -153,10 +153,10 @@ USERNAME="" git clone https://github.com/$USERNAME/ostree.git cd ostree -# Add upstream as remote and update master branch -git checkout master +# Add upstream as remote and update main branch +git checkout main git remote add upstream https://github.com/ostreedev/ostree.git -git pull --rebase upstream master +git pull --rebase upstream main ``` ```bash @@ -407,13 +407,13 @@ Tests for OSTree are done by shell scripting, by running OSTree commands and exa After you have committed your changes and tested, you are ready to submit your patch! -You should make sure your commits are placed on top of the latest changes from `upstream/master`: +You should make sure your commits are placed on top of the latest changes from `upstream/main`: ```bash -$ git pull --rebase upstream master +$ git pull --rebase upstream main ``` -To submit your patch, open a pull request from your forked repository. Most often, you'll be merging into `ostree:master` from `:`. +To submit your patch, open a pull request from your forked repository. Most often, you'll be merging into `ostree:main` from `:`. If some of your changes are complete and you would like feedback, you may also open a pull request that has WIP (Work In Progress) in the title. @@ -423,13 +423,13 @@ See [CONTRIBUTING.md](CONTRIBUTING.md#submitting-patches) for information on squ ### Returning Workflow -When returning to work on a patch, it is recommended to update your fork with the latest changes in the upstream master branch. +When returning to work on a patch, it is recommended to update your fork with the latest changes in the upstream main branch. If creating a new branch: ```bash -$ git checkout master -$ git pull upstream master +$ git checkout main +$ git pull upstream main $ git checkout -b ``` @@ -437,5 +437,5 @@ If continuing on a branch already created: ```bash $ git checkout -$ git pull --rebase upstream master +$ git pull --rebase upstream main ``` diff --git a/docs/index.md b/docs/index.md index 57e9439f..d5235ed6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -127,7 +127,7 @@ However, in order to build from a git clone, you must update the submodules. If you're packaging OSTree and want a tarball, I recommend using a "recursive git archive" script. There are several available online; -[this code](https://github.com/ostreedev/ostree/blob/master/packaging/Makefile.dist-packaging#L11) +[this code](https://github.com/ostreedev/ostree/blob/main/packaging/Makefile.dist-packaging#L11) in OSTree is an example. Once you have a git clone or recursive archive, building is the @@ -148,7 +148,7 @@ See [Contributing](docs/CONTRIBUTING.md). ## Licensing The licensing for the *code* of libostree can be canonically found in the individual files; -and the overall status in the [COPYING](https://github.com/ostreedev/ostree/blob/master/COPYING) +and the overall status in the [COPYING](https://github.com/ostreedev/ostree/blob/main/COPYING) file in the source. Currently, that's LGPLv2+. This also covers the man pages and API docs. The license for the manual documentation in the `doc/` directory is: diff --git a/docs/repo.md b/docs/repo.md index 9b254b12..0269934e 100644 --- a/docs/repo.md +++ b/docs/repo.md @@ -121,7 +121,7 @@ Like git, OSTree uses the terminology "references" (abbreviated commits. See the [Git Documentation](https://git-scm.com/book/en/v2/Git-Internals-Git-References) for information on how git uses them. Unlike git though, it doesn't -usually make sense to have a "master" branch. There is a convention +usually make sense to have a "main" branch. There is a convention for references in OSTree that looks like this: `exampleos/buildmaster/x86_64-runtime` and `exampleos/buildmaster/x86_64-devel-debug`. These two refs point to diff --git a/docs/repository-management.md b/docs/repository-management.md index ace150ad..7dda781d 100644 --- a/docs/repository-management.md +++ b/docs/repository-management.md @@ -117,7 +117,7 @@ log links to build logs, etc.), but we're reusing the *content* from the `buildm commit `aec070645fe53` that passed the smoketests. For a more sophisticated implementation of this model, see the -[do-release-tags](https://github.com/ostreedev/ostree-releng-scripts/blob/master/do-release-tags) +[do-release-tags](https://github.com/ostreedev/ostree-releng-scripts/blob/main/do-release-tags) script, which includes support for things like propagating version numbers across commit promotion. From 02527f115e934d40a37a4b2b41f1a93eaf70732b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Fri, 7 May 2021 16:42:37 +0200 Subject: [PATCH 12/50] *: rename master to main in tests & examples --- docs/atomic-upgrades.md | 4 +- docs/repo.md | 8 +-- docs/repository-management.md | 14 ++-- man/ostree-admin-deploy.xml | 10 +-- man/ostree-admin-set-origin.xml | 2 +- man/ostree-admin-status.xml | 4 +- man/ostree-admin-undeploy.xml | 6 +- man/ostree-refs.xml | 2 +- src/libostree/ostree-core.c | 8 +-- tests/admin-test.sh | 66 +++++++++---------- tests/basic-test.sh | 2 +- tests/libtest.sh | 8 +-- tests/test-admin-deploy-2.sh | 10 +-- tests/test-admin-deploy-bootid-gc.sh | 12 ++-- tests/test-admin-deploy-clean.sh | 6 +- .../test-admin-deploy-etcmerge-cornercases.sh | 26 ++++---- tests/test-admin-deploy-karg.sh | 18 ++--- tests/test-admin-deploy-nomerge.sh | 6 +- tests/test-admin-deploy-none.sh | 4 +- tests/test-admin-deploy-switch.sh | 14 ++-- tests/test-admin-deploy-syslinux.sh | 14 ++-- tests/test-admin-deploy-uboot.sh | 4 +- tests/test-admin-gpg.sh | 10 +-- tests/test-admin-instutil-set-kargs.sh | 6 +- tests/test-admin-locking.sh | 8 +-- tests/test-admin-pull-deploy-commit.sh | 4 +- tests/test-admin-pull-deploy-split.sh | 10 +-- tests/test-admin-upgrade-endoflife.sh | 12 ++-- tests/test-admin-upgrade-not-backwards.sh | 2 +- tests/test-admin-upgrade-systemd-update.sh | 8 +-- tests/test-admin-upgrade-unconfigured.sh | 12 ++-- tests/test-find-remotes.sh | 62 ++++++++--------- tests/test-no-initramfs.sh | 14 ++-- tests/test-osupdate-dtb.sh | 12 ++-- tests/test-repo-finder-config.c | 2 +- tests/test-repo-finder-mount.c | 2 +- tests/test-sysroot-c.c | 4 +- tests/test-sysroot.js | 2 +- 38 files changed, 209 insertions(+), 209 deletions(-) diff --git a/docs/atomic-upgrades.md b/docs/atomic-upgrades.md index 6d58d845..92ae2c49 100644 --- a/docs/atomic-upgrades.md +++ b/docs/atomic-upgrades.md @@ -25,8 +25,8 @@ implements this. To begin a simple upgrade, OSTree fetches the contents of the ref from the remote server. Suppose we're tracking a ref named -`exampleos/buildmaster/x86_64-runtime`. OSTree fetches the URL -`http://example.com/repo/refs/heads/exampleos/buildmaster/x86_64-runtime`, +`exampleos/buildmain/x86_64-runtime`. OSTree fetches the URL +`http://example.com/repo/refs/heads/exampleos/buildmain/x86_64-runtime`, which contains a SHA256 checksum. This determines the tree to deploy, and `/etc` will be merged from currently booted tree. diff --git a/docs/repo.md b/docs/repo.md index 0269934e..69f26172 100644 --- a/docs/repo.md +++ b/docs/repo.md @@ -123,16 +123,16 @@ commits. See the for information on how git uses them. Unlike git though, it doesn't usually make sense to have a "main" branch. There is a convention for references in OSTree that looks like this: -`exampleos/buildmaster/x86_64-runtime` and -`exampleos/buildmaster/x86_64-devel-debug`. These two refs point to +`exampleos/buildmain/x86_64-runtime` and +`exampleos/buildmain/x86_64-devel-debug`. These two refs point to two different generated filesystem trees. In this example, the "runtime" tree contains just enough to run a basic system, and "devel-debug" contains all of the developer tools and debuginfo. The `ostree` supports a simple syntax using the caret `^` to refer to the parent of a given commit. For example, -`exampleos/buildmaster/x86_64-runtime^` refers to the previous build, -and `exampleos/buildmaster/x86_64-runtime^^` refers to the one before +`exampleos/buildmain/x86_64-runtime^` refers to the previous build, +and `exampleos/buildmain/x86_64-runtime^^` refers to the one before that. ## The summary file diff --git a/docs/repository-management.md b/docs/repository-management.md index 7dda781d..2db6383a 100644 --- a/docs/repository-management.md +++ b/docs/repository-management.md @@ -80,7 +80,7 @@ Then, what you'll want to do is promote content from "dev" to "prod". We'll discuss this later, but first, let's talk about promotion *inside* our "dev" repository. -## Promoting content along OSTree branches - "buildmaster", "smoketested" +## Promoting content along OSTree branches - "buildmain", "smoketested" Besides multiple repositories, OSTree also supports multiple branches inside one repository, equivalent to git's branches. We saw in an @@ -88,16 +88,16 @@ earlier section an example branch name like `exampleos/x86_64/standard`. Choosing the branch name for your "prod" repository is absolutely critical as client systems will reference it. It becomes an important part of your face to the world, in the same -way the "master" branch in a git repository is. +way the "main" branch in a git repository is. But with your "dev" repository internally, it can be very useful to use OSTree's branching concepts to represent different stages in a software delivery pipeline. Deriving from `exampleos/x86_64/standard`, let's say our "dev" -repository contains `exampleos/x86_64/buildmaster/standard`. We choose the -term "buildmaster" to represent something that came straight from git -master. It may not be tested very much. +repository contains `exampleos/x86_64/buildmain/standard`. We choose the +term "buildmain" to represent something that came straight from git +main. It may not be tested very much. Our next step should be to hook up a testing system (Jenkins, Buildbot, etc.) to this. When a build (commit) passes some tests, we @@ -106,14 +106,14 @@ want to "promote" that commit. Let's create a new branch called complete system. This might be where human testers get involved, for example. -This is a basic way to "promote" the `buildmaster` commit that passed testing: +This is a basic way to "promote" the `buildmain` commit that passed testing: ``` ostree commit -b exampleos/x86_64/smoketested/standard -s 'Passed tests' --tree=ref=aec070645fe53... ``` Here we're generating a new commit object (perhaps include in the commit -log links to build logs, etc.), but we're reusing the *content* from the `buildmaster` +log links to build logs, etc.), but we're reusing the *content* from the `buildmain` commit `aec070645fe53` that passed the smoketests. For a more sophisticated implementation of this model, see the diff --git a/man/ostree-admin-deploy.xml b/man/ostree-admin-deploy.xml index 396d9016..fbb8b96a 100644 --- a/man/ostree-admin-deploy.xml +++ b/man/ostree-admin-deploy.xml @@ -146,12 +146,12 @@ Boston, MA 02111-1307, USA. $ ostree admin status * gnome-ostree 67e382b11d213a402a5313e61cbc69dfd5ab93cb07.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime gnome-ostree ce19c41036cc45e49b0cecf6b157523c2105c4de1ce3.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime -$ ostree admin deploy gnome-ostree/buildmaster/x86_64-runtime +$ ostree admin deploy gnome-ostree/buildmain/x86_64-runtime ostadmin: Creating deployment /ostree/deploy/gnome-ostree/deploy/7e382b11d213a402a5313e61cbc69dfd5ab93cb07.1 ostadmin: Processing /etc: 3 modified, 0 removed, 29 added @@ -161,9 +161,9 @@ Boston, MA 02111-1307, USA. $ ostree admin status gnome-ostree 67e382b11d213a402a5313e61cbc69dfd5ab93cb07.1 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime * gnome-ostree 67e382b11d213a402a5313e61cbc69dfd5ab93cb07.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime diff --git a/man/ostree-admin-set-origin.xml b/man/ostree-admin-set-origin.xml index ffa5cd20..c52c410c 100644 --- a/man/ostree-admin-set-origin.xml +++ b/man/ostree-admin-set-origin.xml @@ -93,6 +93,6 @@ Boston, MA 02111-1307, USA. Example - $ ostree admin set-origin exampleos http://os.example.com/repo exampleos/10.0/master/router + $ ostree admin set-origin exampleos http://os.example.com/repo exampleos/10.0/main/router diff --git a/man/ostree-admin-status.xml b/man/ostree-admin-status.xml index 096c0dae..020c601a 100644 --- a/man/ostree-admin-status.xml +++ b/man/ostree-admin-status.xml @@ -68,9 +68,9 @@ Boston, MA 02111-1307, USA. $ ostree admin status * gnome-ostree 67e382b11d213a402a5313e61cbc69dfd5ab93cb07.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime gnome-ostree ce19c41036cc45e49b0cecf6b157523c2105c4de1c.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime diff --git a/man/ostree-admin-undeploy.xml b/man/ostree-admin-undeploy.xml index 818f12da..4fde382f 100644 --- a/man/ostree-admin-undeploy.xml +++ b/man/ostree-admin-undeploy.xml @@ -68,9 +68,9 @@ Boston, MA 02111-1307, USA. $ ostree admin status * gnome-ostree 67e382b11d213a402a5313e61cbc69dfd5ab93cb07.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime gnome-ostree ce19c41036cc45e49b0cecf6b157523c2105c4de1c.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime $ ostree admin undeploy 1 @@ -81,7 +81,7 @@ Boston, MA 02111-1307, USA. $ ostree admin status * gnome-ostree 67e382b11d213a402a5313e61cbc69dfd5ab93cb07.0 - origin refspec: gnome-ostree/buildmaster/x86_64-runtime + origin refspec: gnome-ostree/buildmain/x86_64-runtime diff --git a/man/ostree-refs.xml b/man/ostree-refs.xml index 0ba6b1d7..62aac5ce 100644 --- a/man/ostree-refs.xml +++ b/man/ostree-refs.xml @@ -144,7 +144,7 @@ Boston, MA 02111-1307, USA. $ ostree refs my-branch - gnome-ostree/buildmaster/x86_64-runtime + gnome-ostree/buildmain/x86_64-runtime diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index 83f409ba..6a7c2afa 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -160,11 +160,11 @@ ostree_validate_checksum_string (const char *sha256, * @out_ref: (out) (not nullable) (optional): Return location for the ref name * @error: Error * - * Split a refspec like `gnome-ostree:gnome-ostree/buildmaster` or just - * `gnome-ostree/buildmaster` into two parts. In the first case, @out_remote - * will be set to `gnome-ostree`, and @out_ref to `gnome-ostree/buildmaster`. + * Split a refspec like `gnome-ostree:gnome-ostree/buildmain` or just + * `gnome-ostree/buildmain` into two parts. In the first case, @out_remote + * will be set to `gnome-ostree`, and @out_ref to `gnome-ostree/buildmain`. * In the second case (a local ref), @out_remote will be %NULL, and @out_ref - * will be `gnome-ostree/buildmaster`. In both cases, %TRUE will be returned. + * will be `gnome-ostree/buildmain`. In both cases, %TRUE will be returned. * * Returns: %TRUE on successful parsing, %FALSE otherwise */ diff --git a/tests/admin-test.sh b/tests/admin-test.sh index a7016a87..dd5ffd14 100644 --- a/tests/admin-test.sh +++ b/tests/admin-test.sh @@ -53,11 +53,11 @@ assert_ostree_deployment_refs() { } orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy) -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy) assert_not_streq "${orig_mtime}" "${new_mtime}" ${CMD_PREFIX} ostree admin status | tee status.txt @@ -66,9 +66,9 @@ assert_not_file_has_content status.txt "rollback" validate_bootloader # Test the bootable and linux keys -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.linux show testos:testos/buildmaster/x86_64-runtime >out.txt +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.linux show testos:testos/buildmain/x86_64-runtime >out.txt assert_file_has_content_literal out.txt 3.6.0 -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.bootable show testos:testos/buildmaster/x86_64-runtime >out.txt +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo --print-metadata-key=ostree.bootable show testos:testos/buildmain/x86_64-runtime >out.txt assert_file_has_content_literal out.txt true echo "ok deploy command" @@ -92,14 +92,14 @@ assert_ostree_deployment_refs 1/1/0 ${CMD_PREFIX} ostree admin status echo "ok layout" -if ${CMD_PREFIX} ostree admin deploy --stage --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then +if ${CMD_PREFIX} ostree admin deploy --stage --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then fatal "staged when not booted" fi assert_file_has_content_literal err.txt "Cannot stage deployment: Not currently booted into an OSTree system" echo "ok staging does not work when not booted" orig_mtime=$(stat -c '%.Y' sysroot/ostree/deploy) -${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy) assert_not_streq "${orig_mtime}" "${new_mtime}" # Need a new bootversion, sine we now have two deployments @@ -119,7 +119,7 @@ validate_bootloader echo "ok second deploy" -${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime # Keep the same bootversion assert_has_dir sysroot/boot/loader.0 assert_not_has_dir sysroot/boot/loader.1 @@ -134,7 +134,7 @@ echo "ok third deploy (swap)" ${CMD_PREFIX} ostree admin os-init otheros -${CMD_PREFIX} ostree admin deploy --os=otheros testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=otheros testos/buildmain/x86_64-runtime assert_not_has_dir sysroot/boot/loader.0 assert_has_dir sysroot/boot/loader.1 assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf @@ -147,7 +147,7 @@ validate_bootloader echo "ok independent deploy" -${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/loader.0 assert_not_has_dir sysroot/boot/loader.1 assert_has_file sysroot/boot/loader/entries/ostree-4-testos.conf @@ -164,7 +164,7 @@ echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/et rm -r sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/testdirectory rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink -${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime assert_not_has_dir sysroot/boot/loader.0 assert_has_dir sysroot/boot/loader.1 link=sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink @@ -189,7 +189,7 @@ done assert_has_file sysroot/boot/loader/entries/ostree-1-testos.conf assert_not_has_file sysroot/boot/loader/entries/ostree-2-testos.conf assert_not_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf -${CMD_PREFIX} ostree admin deploy --not-as-default --os=otheros testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --not-as-default --os=otheros testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/loader.0 assert_not_has_dir sysroot/boot/loader.1 assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf @@ -199,7 +199,7 @@ validate_bootloader echo "ok deploy --not-as-default" -${CMD_PREFIX} ostree admin deploy --retain-rollback --os=otheros testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --retain-rollback --os=otheros testos:testos/buildmain/x86_64-runtime assert_not_has_dir sysroot/boot/loader.0 assert_has_dir sysroot/boot/loader.1 assert_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf @@ -211,12 +211,12 @@ validate_bootloader echo "ok deploy --retain-rollback" os_repository_new_commit -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmain/x86_64-runtime) export newrev assert_not_streq ${rev} ${newrev} -${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS' # New files in /usr/etc assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file" @@ -234,24 +234,24 @@ if env OSTREE_EX_STAGE_DEPLOYMENTS=1 ${CMD_PREFIX} ostree admin upgrade --os=tes fi echo "ok upgrade failed when staged" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin upgrade --os=testos origrev=${rev} rev=${newrev} -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_not_streq ${rev} ${newrev} assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS' ${CMD_PREFIX} ostree admin status validate_bootloader ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo refs testos:testos > reftest.txt -assert_file_has_content reftest.txt testos:buildmaster/x86_64-runtime +assert_file_has_content reftest.txt testos:buildmain/x86_64-runtime echo "ok upgrade" originfile=$(${CMD_PREFIX} ostree admin --print-current-dir).origin cp ${originfile} saved-origin ${CMD_PREFIX} ostree admin set-origin --index=0 bacon --set=gpg-verify=false http://tasty.com -assert_file_has_content "${originfile}" "bacon:testos/buildmaster/x86_64-runtime" +assert_file_has_content "${originfile}" "bacon:testos/buildmain/x86_64-runtime" ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote list -u > remotes.txt assert_file_has_content remotes.txt 'bacon.*http://tasty\.com' cp saved-origin ${originfile} @@ -272,22 +272,22 @@ validate_bootloader echo "ok undeploy" -if ${CMD_PREFIX} ostree admin deploy --os=unknown testos:testos/buildmaster/x86_64-runtime; then +if ${CMD_PREFIX} ostree admin deploy --os=unknown testos:testos/buildmain/x86_64-runtime; then assert_not_reached "Unexpected successful deploy of unknown OS" fi echo "ok deploy with unknown OS" -${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=console=/dev/foo --karg-append=console=/dev/bar testos:testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=console=/dev/foo --karg-append=console=/dev/bar testos:testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf 'console=/dev/foo.*console=/dev/bar' validate_bootloader echo "ok deploy with multiple kernel args" -origrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +origrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) os_repository_new_commit 0 "test upgrade multiple kernel args" ${CMD_PREFIX} ostree admin upgrade --os=testos -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_not_streq ${origrev} ${newrev} assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf 'console=/dev/foo.*console=/dev/bar' validate_bootloader @@ -297,7 +297,7 @@ echo "ok upgrade with multiple kernel args" os_repository_new_commit ${CMD_PREFIX} ostree admin upgrade --os=testos assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 ${version} (ostree:testos:0)$" -os_repository_new_commit 0 0 testos/buildmaster/x86_64-runtime 42 +os_repository_new_commit 0 0 testos/buildmain/x86_64-runtime 42 ${CMD_PREFIX} ostree admin upgrade --os=testos assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 (ostree:testos:0)$" @@ -310,8 +310,8 @@ sleep 1 os_repository_new_commit # upgrade to the latest ${CMD_PREFIX} ostree admin upgrade --os=testos -head_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime) -prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime^) +head_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime) +prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime^) assert_not_streq ${head_rev} ${prev_rev} # Don't use `ostree admin status | head -n 1` directly here because `head` # exiting early might cause SIGPIPE to ostree, which with `set -euo pipefail` @@ -342,14 +342,14 @@ sleep 1 os_repository_new_commit sleep 1 os_repository_new_commit -${CMD_PREFIX} ostree pull --repo=sysroot/ostree/repo --commit-metadata-only --depth=-1 testos:testos/buildmaster/x86_64-runtime -curr_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime) -prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmaster/x86_64-runtime^) +${CMD_PREFIX} ostree pull --repo=sysroot/ostree/repo --commit-metadata-only --depth=-1 testos:testos/buildmain/x86_64-runtime +curr_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime) +prev_rev=$(${CMD_PREFIX} ostree rev-parse --repo=sysroot/ostree/repo testos/buildmain/x86_64-runtime^) ${CMD_PREFIX} ostree admin upgrade --os=testos --override-commit=${prev_rev} echo "ok upgrade to newer version older than branch tip" ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string "version=${version}" \ - --add-metadata-string 'ostree.source-title=libtest os_repository_new_commit()' -b testos/buildmaster/x86_64-runtime \ + --add-metadata-string 'ostree.source-title=libtest os_repository_new_commit()' -b testos/buildmain/x86_64-runtime \ -s "Build" --tree=dir=${test_tmpdir}/osdata ${CMD_PREFIX} ostree admin upgrade --os=testos ${CMD_PREFIX} ostree admin status | tee status.txt @@ -381,7 +381,7 @@ assert_file_has_content sysroot/ostree/repo/config remote-test-config-dir echo "ok remote add nonphysical sysroot add-remotes-config-dir false" if env OSTREE_SYSROOT_DEBUG="${OSTREE_SYSROOT_DEBUG},test-fifreeze" \ - ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then + ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then fatal "fifreeze-test exited successfully?" fi assert_file_has_content err.txt "fifreeze watchdog was run" diff --git a/tests/basic-test.sh b/tests/basic-test.sh index 75333f4d..03f2cb1b 100644 --- a/tests/basic-test.sh +++ b/tests/basic-test.sh @@ -1017,7 +1017,7 @@ if ! skip_one_without_user_xattrs; then fi cd ${test_tmpdir} -${CMD_PREFIX} ostree --repo=repo remote --set=tls-permissive=true add aremote http://remote.example.com/repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=repo remote --set=tls-permissive=true add aremote http://remote.example.com/repo testos/buildmain/x86_64-runtime assert_file_has_content repo/config 'tls-permissive=true' assert_file_has_content repo/config 'remote\.example\.com' echo "ok remote add with set" diff --git a/tests/libtest.sh b/tests/libtest.sh index 40f362be..bf34cd5e 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -455,12 +455,12 @@ EOF mkdir -p usr/etc/testdirectory echo "a default daemon file" > usr/etc/testdirectory/test - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-runtime -s "Build" + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-runtime -s "Build" # Ensure these commits have distinct second timestamps sleep 2 echo "a new executable" > usr/bin/sh - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.10 -b testos/buildmaster/x86_64-runtime -s "Build" + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.10 -b testos/buildmain/x86_64-runtime -s "Build" cd ${test_tmpdir} rm -rf osdata-devel @@ -469,7 +469,7 @@ EOF cd osdata-devel mkdir -p usr/include echo "a development header" > usr/include/foo.h - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-devel -s "Build" + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit ${bootable_flag} --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-devel -s "Build" ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo fsck -q @@ -516,7 +516,7 @@ os_repository_new_commit () { boot_checksum_iteration=${1:-0} content_iteration=${2:-0} - branch=${3:-testos/buildmaster/x86_64-runtime} + branch=${3:-testos/buildmain/x86_64-runtime} export version=${4:-$(date "+%Y%m%d.${content_iteration}")} echo "BOOT ITERATION: $boot_checksum_iteration" cd ${test_tmpdir}/osdata diff --git a/tests/test-admin-deploy-2.sh b/tests/test-admin-deploy-2.sh index 6df4877c..33c38988 100755 --- a/tests/test-admin-deploy-2.sh +++ b/tests/test-admin-deploy-2.sh @@ -28,11 +28,11 @@ setup_os_repository "archive" "syslinux" echo "1..8" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/ostree/testos-${bootcsum} echo "ok deploy command" @@ -40,14 +40,14 @@ echo "ok deploy command" # Commit + upgrade twice, so that we'll rotate out the original deployment bootcsum1=${bootcsum} os_repository_new_commit -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin upgrade --os=testos bootcsum2=${bootcsum} os_repository_new_commit "1" bootcsum3=${bootcsum} ${CMD_PREFIX} ostree admin upgrade --os=testos -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_not_streq ${rev} ${newrev} assert_not_streq ${bootcsum1} ${bootcsum2} assert_not_streq ${bootcsum2} ${bootcsum3} diff --git a/tests/test-admin-deploy-bootid-gc.sh b/tests/test-admin-deploy-bootid-gc.sh index 9a5094ce..051dae6d 100755 --- a/tests/test-admin-deploy-bootid-gc.sh +++ b/tests/test-admin-deploy-bootid-gc.sh @@ -28,16 +28,16 @@ setup_os_repository "archive" "syslinux" echo "1..1" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime os_repository_new_commit rm sysroot/ostree/repo/tmp/* -rf export TEST_BOOTID=4072029c-8b10-60d1-d31b-8422eeff9b42 if env OSTREE_REPO_TEST_ERROR=pre-commit OSTREE_BOOTID=${TEST_BOOTID} \ - ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then + ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then assert_not_reached "Should have hit OSTREE_REPO_TEST_ERROR_PRE_COMMIT" fi stagepath=$(ls -d sysroot/ostree/repo/tmp/staging-${TEST_BOOTID}-*) @@ -47,12 +47,12 @@ assert_has_dir "${stagepath}" export NEW_TEST_BOOTID=5072029c-8b10-60d1-d31b-8422eeff9b42 if env OSTREE_REPO_TEST_ERROR=pre-commit OSTREE_BOOTID=${NEW_TEST_BOOTID} \ - ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=FOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime 2>err.txt; then + ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=FOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime 2>err.txt; then assert_not_reached "Should have hit OSTREE_REPO_TEST_ERROR_PRE_COMMIT" fi newstagepath=$(ls -d sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*) assert_has_dir "${newstagepath}" -env OSTREE_BOOTID=${NEW_TEST_BOOTID} ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +env OSTREE_BOOTID=${NEW_TEST_BOOTID} ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime newstagepath=$(echo sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*) assert_not_has_dir "${stagepath}" assert_not_has_dir "${newstagepath}" diff --git a/tests/test-admin-deploy-clean.sh b/tests/test-admin-deploy-clean.sh index bca45251..f26eaa0c 100755 --- a/tests/test-admin-deploy-clean.sh +++ b/tests/test-admin-deploy-clean.sh @@ -28,10 +28,10 @@ setup_os_repository "archive" "syslinux" echo "1..1" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin undeploy 0 ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo refs > refs.txt assert_not_file_has_content refs.txt '^ostree/' diff --git a/tests/test-admin-deploy-etcmerge-cornercases.sh b/tests/test-admin-deploy-etcmerge-cornercases.sh index fab50d16..4f55bc3a 100755 --- a/tests/test-admin-deploy-etcmerge-cornercases.sh +++ b/tests/test-admin-deploy-etcmerge-cornercases.sh @@ -28,12 +28,12 @@ setup_os_repository "archive" "syslinux" echo "1..2" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev echo "rev=${rev}" # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/ostree/testos-${bootcsum} etc=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc @@ -58,9 +58,9 @@ rm ${etc}/testdirectory -rf # Now deploy a new commit os_repository_new_commit -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin upgrade --os=testos -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) echo "newrev=${newrev}" newroot=sysroot/ostree/deploy/testos/deploy/${newrev}.0 newetc=${newroot}/etc @@ -94,32 +94,32 @@ echo "ok" # Add /etc/initially-empty cd "${test_tmpdir}/osdata" mkdir -p usr/etc/initially-empty -${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Add empty directory" +${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Add empty directory" cd ${test_tmpdir} # Upgrade, check that we have it ${CMD_PREFIX} ostree admin upgrade --os=testos -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_has_dir sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty # Now add a two files in initially-empty cd "${test_tmpdir}/osdata" touch usr/etc/initially-empty/{afile,bfile} -${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Add empty directory" +${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Add empty directory" # Upgrade, check that we have the two new files cd ${test_tmpdir} ${CMD_PREFIX} ostree admin upgrade --os=testos -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_has_file sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty/afile assert_has_file sysroot/ostree/deploy/testos/deploy/$rev.0/etc/initially-empty/bfile # Replace config file with default directory cd "${test_tmpdir}/osdata" mkdir usr/etc/somenewdir -${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Add default dir" +${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Add default dir" cd ${test_tmpdir} -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) newconfpath=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/somenewdir echo "some content blah" > ${newconfpath} if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then @@ -131,12 +131,12 @@ rm ${newconfpath} # Remove parent directory of modified config file cd "${test_tmpdir}/osdata" rm -rf usr/etc/initially-empty -${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Remove default dir" +${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmain/x86_64-runtime -s "Remove default dir" cd ${test_tmpdir} newconfpath=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/initially-empty/mynewfile touch ${newconfpath} ${CMD_PREFIX} ostree admin upgrade --os=testos -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.0/usr/etc/initially-empty assert_has_file sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/initially-empty/mynewfile rm ${newconfpath} diff --git a/tests/test-admin-deploy-karg.sh b/tests/test-admin-deploy-karg.sh index ccf66b0e..9bd5025d 100755 --- a/tests/test-admin-deploy-karg.sh +++ b/tests/test-admin-deploy-karg.sh @@ -28,23 +28,23 @@ setup_os_repository "archive" "syslinux" echo "1..3" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree admin deploy --karg=FOO=BAR --os=testos testos:testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree admin deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=FOO=BAR --os=testos testos:testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR' assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*FOO=BAR' assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' -${CMD_PREFIX} ostree admin deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*ANOTHERARG=ANOTHERVALUE' echo "ok deploy with --karg, but same config" -${CMD_PREFIX} ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/buildmain/x86_64-runtime for arg in $(cat /proc/cmdline); do case "$arg" in ostree=*) # Skip ostree arg that gets stripped out @@ -61,13 +61,13 @@ echo "ok deploy --karg-proc-cmdline" ${CMD_PREFIX} ostree admin status ${CMD_PREFIX} ostree admin undeploy 0 -${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*FOO=BAR' assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' # Check correct ordering of different-valued args of the same key. -${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=FOO=TESTORDERED --karg-append=APPENDARG=3RDAPPEND testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=FOO=TESTORDERED --karg-append=APPENDARG=3RDAPPEND testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND .*FOO=TESTORDERED .*APPENDARG=3RDAPPEND' echo "ok deploy --karg-append" diff --git a/tests/test-admin-deploy-nomerge.sh b/tests/test-admin-deploy-nomerge.sh index 06271421..8637691c 100755 --- a/tests/test-admin-deploy-nomerge.sh +++ b/tests/test-admin-deploy-nomerge.sh @@ -25,15 +25,15 @@ set -euo pipefail # Exports OSTREE_SYSROOT so --sysroot not needed. setup_os_repository "archive" "syslinux" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime echo "1..1" -${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testkarg=1 testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testkarg=1 testos:testos/buildmain/x86_64-runtime origdeployment=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir) testconfig=etc/modified-config-file-that-will-be-removed touch "${origdeployment}"/"${testconfig}" assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf "^options.*root=LABEL=foo.*testkarg" -${CMD_PREFIX} ostree admin deploy --os=testos --no-merge --karg=root=LABEL=bar testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos --no-merge --karg=root=LABEL=bar testos:testos/buildmain/x86_64-runtime deployment=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir) assert_not_streq "${origdeployment}" "${deployment}" assert_not_has_file "${deployment}/${testconfig}" diff --git a/tests/test-admin-deploy-none.sh b/tests/test-admin-deploy-none.sh index 09dee624..982addbe 100755 --- a/tests/test-admin-deploy-none.sh +++ b/tests/test-admin-deploy-none.sh @@ -34,12 +34,12 @@ extra_admin_tests=1 cd ${test_tmpdir} rm httpd osdata testos-repo sysroot -rf setup_os_repository "archive" "sysroot.bootloader none" -${CMD_PREFIX} ostree pull-local --repo=sysroot/ostree/repo --remote testos testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree pull-local --repo=sysroot/ostree/repo --remote testos testos-repo testos/buildmain/x86_64-runtime # Test that configuring sysroot.bootloader="none" is a workaround for previous # grub2 bootloader issue (see https://github.com/ostreedev/ostree/issues/1774) mkdir -p sysroot/boot/grub2 touch sysroot/boot/grub2/grub.cfg -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos testos/buildmaster/x86_64-runtime > out.txt +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos testos/buildmain/x86_64-runtime > out.txt assert_file_has_content out.txt "Bootloader updated.*" assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' diff --git a/tests/test-admin-deploy-switch.sh b/tests/test-admin-deploy-switch.sh index bae67667..275ba026 100755 --- a/tests/test-admin-deploy-switch.sh +++ b/tests/test-admin-deploy-switch.sh @@ -29,23 +29,23 @@ setup_os_repository "archive" "syslinux" echo "1..4" ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmain/x86_64-runtime) assert_not_has_file sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h -if ${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-runtime; then +if ${CMD_PREFIX} ostree admin switch --os=testos testos/buildmain/x86_64-runtime; then assert_not_reached "Switch to same ref unexpectedly succeeded" fi echo "ok switch expected error" -${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-devel -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-devel) +${CMD_PREFIX} ostree admin switch --os=testos testos/buildmain/x86_64-devel +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmain/x86_64-devel) assert_file_has_content sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h 'header' echo "ok switch" ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false anothertestos file://$(pwd)/testos-repo -${CMD_PREFIX} ostree admin switch --os=testos anothertestos:testos/buildmaster/x86_64-devel +${CMD_PREFIX} ostree admin switch --os=testos anothertestos:testos/buildmain/x86_64-devel # Ok this is lame, need a better shell command to extract config, or switch to gjs ${CMD_PREFIX} ostree admin status > status.txt assert_file_has_content status.txt anothertestos diff --git a/tests/test-admin-deploy-syslinux.sh b/tests/test-admin-deploy-syslinux.sh index 4d4ac7ae..8f9f0259 100755 --- a/tests/test-admin-deploy-syslinux.sh +++ b/tests/test-admin-deploy-syslinux.sh @@ -35,9 +35,9 @@ for test_bootdir in "boot" "usr/lib/ostree-boot"; do cd ${test_tmpdir} rm httpd osdata testos-repo sysroot -rf setup_os_repository "archive" "syslinux" $test_bootdir - ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime - rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) - ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime + ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime + rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) + ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* quiet' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' @@ -59,11 +59,11 @@ setup_os_repository "archive" "syslinux" "usr/lib/ostree-boot" cd osdata echo "this is a kernel without an initramfs like Fedora 26" > usr/lib/modules/3.6.0/vmlinuz usrlib_modules_bootcsum=$(cat usr/lib/modules/3.6.0/vmlinuz | sha256sum | cut -f 1 -d ' ') -${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-runtime -s "Build" +${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-runtime -s "Build" cd ${test_tmpdir} -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs' diff --git a/tests/test-admin-deploy-uboot.sh b/tests/test-admin-deploy-uboot.sh index e3163cb0..98bd580b 100755 --- a/tests/test-admin-deploy-uboot.sh +++ b/tests/test-admin-deploy-uboot.sh @@ -46,7 +46,7 @@ loadramdisk=load mmc ${bootpart} ${rdaddr} ${ramdisk_image} mmcargs=setenv bootargs $bootargs console=${console} ${optargs} root=${mmcroot} rootfstype=${mmcrootfstype} mmcboot=run loadramdisk; echo Booting from mmc ....; run mmcargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr} EOF -${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin upgrade --os=testos assert_file_has_content sysroot/boot/uEnv.txt "loadfdt=" assert_file_has_content sysroot/boot/uEnv.txt "kernel_image=" @@ -71,7 +71,7 @@ bootcsum=$( cat ${devicetree_path} ${devicetree_overlay_path} ) | sha256sum | cut -f 1 -d ' ') -${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin upgrade --os=testos assert_file_has_content sysroot/boot/uEnv.txt "fdtdir=" assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/dtb/asoc-board.dtb 'a device tree' diff --git a/tests/test-admin-gpg.sh b/tests/test-admin-gpg.sh index dc776743..2167f673 100755 --- a/tests/test-admin-gpg.sh +++ b/tests/test-admin-gpg.sh @@ -82,12 +82,12 @@ EOF mkdir -p usr/etc/testdirectory echo "a default daemon file" > usr/etc/testdirectory/test - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome # Ensure these commits have distinct second timestamps sleep 2 echo "a new executable" > usr/bin/sh - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.10 -b testos/buildmaster/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.10 -b testos/buildmain/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome cd ${test_tmpdir} rm -rf osdata-devel @@ -96,7 +96,7 @@ EOF cd osdata-devel mkdir -p usr/include echo "a development header" > usr/include/foo.h - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-devel -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmain/x86_64-devel -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo fsck -q @@ -137,9 +137,9 @@ setup_os_repository_signed "archive" "syslinux" echo "1..2" ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add testos $(cat httpd-address)/ostree/testos-repo -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --gpg-verify=true --remote=testos testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --gpg-verify=true --remote=testos testos-repo testos/buildmain/x86_64-runtime # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/ostree/testos-${bootcsum} echo "ok deploy command" diff --git a/tests/test-admin-instutil-set-kargs.sh b/tests/test-admin-instutil-set-kargs.sh index 1cb32189..a6d40813 100755 --- a/tests/test-admin-instutil-set-kargs.sh +++ b/tests/test-admin-instutil-set-kargs.sh @@ -29,8 +29,8 @@ setup_os_repository "archive" "syslinux" echo "1..5" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAR ${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE KEYWORD EMPTYLIST= @@ -50,7 +50,7 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'option assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' echo "ok instutil set-kargs --replace" -${CMD_PREFIX} ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=XXX.*FOO=BAR' assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' echo "ok instutil set-kargs --append" diff --git a/tests/test-admin-locking.sh b/tests/test-admin-locking.sh index 7e708502..05bdb9bf 100755 --- a/tests/test-admin-locking.sh +++ b/tests/test-admin-locking.sh @@ -36,12 +36,12 @@ echo "1..1" 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) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev echo "rev=${rev}" # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/ostree/testos-${bootcsum} parallel_cmd="parallel --gnu" @@ -50,7 +50,7 @@ if parallel --help | grep -q -e --no-notice; then fi count=$(($(getconf _NPROCESSORS_ONLN) * 2)) -seq "${count}" | ${parallel_cmd} -n0 ${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime +seq "${count}" | ${parallel_cmd} -n0 ${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin status > status.txt grep "testos ${rev}" status.txt | wc -l > status-matches.txt diff --git a/tests/test-admin-pull-deploy-commit.sh b/tests/test-admin-pull-deploy-commit.sh index 557ae60a..f1323913 100755 --- a/tests/test-admin-pull-deploy-commit.sh +++ b/tests/test-admin-pull-deploy-commit.sh @@ -31,8 +31,8 @@ setup_os_repository "archive" "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) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) parent_rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse ${rev}^) ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos ${parent_rev} ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos ${parent_rev} diff --git a/tests/test-admin-pull-deploy-split.sh b/tests/test-admin-pull-deploy-split.sh index 1196368d..8695024e 100755 --- a/tests/test-admin-pull-deploy-split.sh +++ b/tests/test-admin-pull-deploy-split.sh @@ -31,11 +31,11 @@ setup_os_repository "archive" "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) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/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 +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime@${parent_rev} +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/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 @@ -47,7 +47,7 @@ assert_not_file_has_content out.txt 'No update available' assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0 assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0 assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'TestOS 42 1\.0\.9' -assert_streq "${rev}" $(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +assert_streq "${rev}" $(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/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 diff --git a/tests/test-admin-upgrade-endoflife.sh b/tests/test-admin-upgrade-endoflife.sh index 8a0dc9c2..cb2abd7e 100755 --- a/tests/test-admin-upgrade-endoflife.sh +++ b/tests/test-admin-upgrade-endoflife.sh @@ -36,27 +36,27 @@ echo "1..3" 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) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) echo "rev=${rev}" # Now sysroot/ostree has the objects from the testos-repo (obtained over http # and kept in remote "testos"), but there is no deployment # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/ostree/testos-${bootcsum} echo "ok deploy" # Create a new branch which we want to migrate to -os_repository_new_commit 1 1 testos/buildmaster/newbranch +os_repository_new_commit 1 1 testos/buildmain/newbranch # bootcsum now refers to this new commit # Create a new commit with an empty tree, which marks the original branch as # EOL, redirecting to the new one. mkdir empty -${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=$(pwd)/empty --add-metadata-string "ostree.endoflife=Product discontinued" --add-metadata-string "ostree.endoflife-rebase=testos/buildmaster/newbranch" -b testos/buildmaster/x86_64-runtime -s "EOL redirect to new branch" +${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=$(pwd)/empty --add-metadata-string "ostree.endoflife=Product discontinued" --add-metadata-string "ostree.endoflife-rebase=testos/buildmain/newbranch" -b testos/buildmain/x86_64-runtime -s "EOL redirect to new branch" echo "ok new branch" @@ -66,7 +66,7 @@ ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only # Check we got redirected to the new branch assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf "${bootcsum}" -rev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo rev-parse testos/buildmaster/newbranch) +rev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo rev-parse testos/buildmain/newbranch) assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/usr/bin/content-iteration "1" assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0.origin "newbranch" diff --git a/tests/test-admin-upgrade-not-backwards.sh b/tests/test-admin-upgrade-not-backwards.sh index c23dbf29..599284dc 100755 --- a/tests/test-admin-upgrade-not-backwards.sh +++ b/tests/test-admin-upgrade-not-backwards.sh @@ -28,7 +28,7 @@ setup_os_repository "archive" "syslinux" echo "1..2" -ref=testos/buildmaster/x86_64-runtime +ref=testos/buildmain/x86_64-runtime 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 ${ref} diff --git a/tests/test-admin-upgrade-systemd-update.sh b/tests/test-admin-upgrade-systemd-update.sh index 94b750d7..b1f9956b 100755 --- a/tests/test-admin-upgrade-systemd-update.sh +++ b/tests/test-admin-upgrade-systemd-update.sh @@ -29,9 +29,9 @@ echo "1..2" # Setup a deployment 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) -${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) +${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0/usr assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0/etc assert_has_dir sysroot/ostree/deploy/testos/var @@ -50,7 +50,7 @@ touch -r ${usr} sysroot/ostree/deploy/testos/var/.updated # (current) deployment os_repository_new_commit ${CMD_PREFIX} ostree admin upgrade --os=testos -newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_not_has_file sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/.updated assert_not_has_file sysroot/ostree/deploy/testos/var/.updated assert_has_file sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/.updated diff --git a/tests/test-admin-upgrade-unconfigured.sh b/tests/test-admin-upgrade-unconfigured.sh index d9a15fcc..5cb588af 100755 --- a/tests/test-admin-upgrade-unconfigured.sh +++ b/tests/test-admin-upgrade-unconfigured.sh @@ -28,15 +28,15 @@ setup_os_repository "archive" "syslinux" echo "1..2" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) export rev echo "rev=${rev}" # This initial deployment gets kicked off with some kernel arguments -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime echo "unconfigured-state=Use \"subscription-manager\" to enable online updates for example.com OS" >> sysroot/ostree/deploy/testos/deploy/${rev}.0.origin -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime if ${CMD_PREFIX} ostree admin upgrade --os=testos 2>err.txt; then assert_not_reached "upgrade unexpectedly succeeded" fi @@ -44,7 +44,7 @@ assert_file_has_content err.txt "Use.*subscription.*online" echo "ok error" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false otheros file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree admin switch --os=testos otheros:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false otheros file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin switch --os=testos otheros:testos/buildmain/x86_64-runtime echo "ok switch" diff --git a/tests/test-find-remotes.sh b/tests/test-find-remotes.sh index 5dd880f0..044bd468 100755 --- a/tests/test-find-remotes.sh +++ b/tests/test-find-remotes.sh @@ -43,7 +43,7 @@ mkdir os-collection ostree_repo_init os-collection --collection-id org.example.OsCollection mkdir -p files pushd files -${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 1" -b os/amd64/master --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum +${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 1" -b os/amd64/main --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum popd ${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} @@ -54,16 +54,16 @@ ${CMD_PREFIX} ostree --repo=local remote add apps-remote file://$(pwd)/apps-coll ${CMD_PREFIX} ostree --repo=local remote add os-remote file://$(pwd)/os-collection --collection-id org.example.OsCollection --gpg-import=${test_tmpdir}/gpghome/key2.asc ${CMD_PREFIX} ostree --repo=local pull apps-remote app1 -${CMD_PREFIX} ostree --repo=local pull os-remote os/amd64/master +${CMD_PREFIX} ostree --repo=local pull os-remote os/amd64/main ${CMD_PREFIX} ostree --repo=local refs > refs assert_file_has_content refs "^apps-remote:app1$" -assert_file_has_content refs "^os-remote:os/amd64/master$" +assert_file_has_content refs "^os-remote:os/amd64/main$" ${CMD_PREFIX} ostree --repo=local refs --collections > refs cat refs | wc -l > refscount assert_file_has_content refs "^(org\.example\.AppsCollection, app1)$" -assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$" +assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/main)$" assert_file_has_content refscount "^2$" # Create a local mirror repository where we pull the branches *in mirror mode* from the two remotes. @@ -74,7 +74,7 @@ ${CMD_PREFIX} ostree --repo=local-mirror remote add apps-remote file://$(pwd)/ap ${CMD_PREFIX} ostree --repo=local-mirror remote add os-remote file://$(pwd)/os-collection --collection-id org.example.OsCollection --gpg-import=${test_tmpdir}/gpghome/key2.asc ${CMD_PREFIX} ostree --repo=local-mirror pull --mirror apps-remote app1 -${CMD_PREFIX} ostree --repo=local-mirror pull --mirror os-remote os/amd64/master +${CMD_PREFIX} ostree --repo=local-mirror pull --mirror os-remote os/amd64/main ${CMD_PREFIX} ostree --repo=local-mirror refs | wc -l > refscount assert_file_has_content refscount "^0$" @@ -83,10 +83,10 @@ assert_file_has_content remotescount "^0$" ${CMD_PREFIX} ostree --repo=local-mirror refs --collections > refs assert_file_has_content refs "^(org\.example\.AppsCollection, app1)$" -assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/master)$" +assert_file_has_content refs "^(org\.example\.OsCollection, os/amd64/main)$" assert_file_has_content local-mirror/refs/mirrors/org.example.AppsCollection/app1 "^$(cat app1-checksum)$" -assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/amd64/master "^$(cat os-checksum)$" +assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/amd64/main "^$(cat os-checksum)$" for repo in local local-mirror; do # Try finding an update for an existing branch. @@ -98,25 +98,25 @@ for repo in local local-mirror; do assert_not_file_has_content find "^No results\.$" # Find several updates for several existing branches. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > find + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.OsCollection os/amd64/main > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$" assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$" assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$" assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" - assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum)$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum)$" assert_file_has_content find "^2/2 refs were found\.$" assert_not_file_has_content find "^No results\.$" # Find some updates and a new branch. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > find + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/main > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$" assert_file_has_content find "^ - Keyring: apps-remote\.trustedkeys\.gpg$" assert_file_has_content find "^ - (org\.example\.AppsCollection, app1) = $(cat app1-checksum)$" assert_file_has_content find "^ - (org\.example\.AppsCollection, app2) = $(cat app2-checksum)$" assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" - assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum)$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum)$" assert_file_has_content find "^3/3 refs were found\.$" assert_not_file_has_content find "^No results\.$" @@ -138,20 +138,20 @@ for repo in local local-mirror; do assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > pull + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/main > pull assert_file_has_content pull "^2/2 refs were found\.$" assert_file_has_content pull "^Pulled 2/2 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) - assert_ref $repo os/amd64/master $(cat os-checksum) + assert_ref $repo os/amd64/main $(cat os-checksum) - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > pull + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/main > pull assert_file_has_content pull "^3/3 refs were found\.$" assert_file_has_content pull "^Pulled 3/3 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" assert_ref $repo app1 $(cat app1-checksum) assert_ref $repo app2 $(cat app2-checksum) - assert_ref $repo os/amd64/master $(cat os-checksum) + assert_ref $repo os/amd64/main $(cat os-checksum) ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection not-an-app > pull assert_file_has_content pull "^1/2 refs were found\.$" @@ -162,30 +162,30 @@ done # Test pulling a new commit into the local mirror from one of the repositories. pushd files -${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 2" -b os/amd64/master --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-2 +${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 2" -b os/amd64/main --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-2 popd ${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} for repo in local-mirror; do # Try finding an update for that branch. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/main > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" - assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-2)$" assert_file_has_content find "^1/1 refs were found\.$" assert_not_file_has_content find "^No results\.$" # Pull it. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/main > pull || true assert_file_has_content pull "^1/1 refs were found\.$" assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" - assert_ref $repo os/amd64/master $(cat os-checksum-2) + assert_ref $repo os/amd64/main $(cat os-checksum-2) # We need to manually update the refs afterwards, since the original pull # into the local-mirror was a --mirror pull — so it wrote refs/mirrors/blah. # This pull was not, so it wrote refs/remotes/blah. - ${CMD_PREFIX} ostree --repo=$repo refs --collections --create org.example.OsCollection:os/amd64/master os-remote:os/amd64/master + ${CMD_PREFIX} ostree --repo=$repo refs --collections --create org.example.OsCollection:os/amd64/main os-remote:os/amd64/main done # Add the local mirror to the local repository as a remote, so that the local repo @@ -195,46 +195,46 @@ ${CMD_PREFIX} ostree --repo=local remote add os-remote-local-mirror file://$(pwd for repo in local; do # Try finding an update for that branch. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/main > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" - assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-2)$" assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/local-mirror$" assert_file_has_content find "^ - Keyring: os-remote-local-mirror\.trustedkeys\.gpg$" - assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-2)$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-2)$" assert_file_has_content find "^1/1 refs were found\.$" assert_not_file_has_content find "^No results\.$" # Pull it. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/main > pull || true assert_file_has_content pull "^1/1 refs were found\.$" assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" - assert_ref $repo os/amd64/master $(cat os-checksum-2) + assert_ref $repo os/amd64/main $(cat os-checksum-2) done # Add another commit to the OS collection, but don’t update the mirror. Then try pulling # into the local repository again, and check that the outdated ref in the mirror is ignored. pushd files -${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 3" -b os/amd64/master --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-3 +${CMD_PREFIX} ostree --repo=../os-collection commit -s "Test os-collection commit 3" -b os/amd64/main --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} > ../os-checksum-3 popd ${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_2} for repo in local; do # Try finding an update for that branch. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/main > find assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$" assert_file_has_content find "^ - Keyring: os-remote\.trustedkeys\.gpg$" - assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/master) = $(cat os-checksum-3)$" + assert_file_has_content find "^ - (org\.example\.OsCollection, os/amd64/main) = $(cat os-checksum-3)$" assert_file_has_content find "^1/1 refs were found\.$" assert_not_file_has_content find "^No results\.$" # Pull it. - ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true + ${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/main > pull || true assert_file_has_content pull "^1/1 refs were found\.$" assert_file_has_content pull "^Pulled 1/1 refs successfully\.$" assert_not_file_has_content pull "Failed to pull some refs from the remotes" - assert_ref $repo os/amd64/master $(cat os-checksum-3) + assert_ref $repo os/amd64/main $(cat os-checksum-3) done echo "ok find-remotes" diff --git a/tests/test-no-initramfs.sh b/tests/test-no-initramfs.sh index 22846c8f..84c44576 100755 --- a/tests/test-no-initramfs.sh +++ b/tests/test-no-initramfs.sh @@ -9,8 +9,8 @@ setup_os_repository "archive-z2" "uboot" 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 -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=rootfs --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=rootfs --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'root=LABEL=rootfs' assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'init=' @@ -47,8 +47,8 @@ pull_test_tree() { exit 1 fi cd - - ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime - ${CMD_PREFIX} ostree pull testos:testos/buildmaster/x86_64-runtime + ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime + ${CMD_PREFIX} ostree pull testos:testos/buildmain/x86_64-runtime } get_key_from_bootloader_conf() { @@ -62,7 +62,7 @@ get_key_from_bootloader_conf() { for layout in /usr/lib/modules /usr/lib/ostree-boot /boot; do pull_test_tree "the kernel only" - ${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=/dev/sda2 --karg=rootwait testos:testos/buildmaster/x86_64-runtime + ${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=/dev/sda2 --karg=rootwait testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'rootwait' assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init=' assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd' @@ -70,7 +70,7 @@ do echo "ok switching to bootdir with no initramfs layout=$layout" pull_test_tree "the kernel" "initramfs to assist the kernel" - ${CMD_PREFIX} ostree admin deploy --os=testos --karg-none --karg=root=LABEL=rootfs testos:testos/buildmaster/x86_64-runtime + ${CMD_PREFIX} ostree admin deploy --os=testos --karg-none --karg=root=LABEL=rootfs testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd' assert_file_has_content sysroot/boot/$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf "initrd") "initramfs to assist the kernel" assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'root=LABEL=rootfs' @@ -80,7 +80,7 @@ do echo "ok switching from no initramfs to initramfs enabled sysroot layout=$layout" pull_test_tree "the kernel" "" "my .dtb file" - ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime + ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init=' assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf 'devicetree')" "my \.dtb file" diff --git a/tests/test-osupdate-dtb.sh b/tests/test-osupdate-dtb.sh index 9e0c4686..33e752f5 100755 --- a/tests/test-osupdate-dtb.sh +++ b/tests/test-osupdate-dtb.sh @@ -41,17 +41,17 @@ echo "a device tree" > ${devicetree_path} mkdir -p osdata/${modulesdir}/dtb/overlays echo "a device tree overlay" > ${devicetree_overlay_path} -${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime -${CMD_PREFIX} env OSTREE_SYSROOT_DEBUG=${OSTREE_SYSROOT_DEBUG},no-dtb ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime +${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmain/x86_64-runtime +${CMD_PREFIX} env OSTREE_SYSROOT_DEBUG=${OSTREE_SYSROOT_DEBUG},no-dtb ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime assert_has_file sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 assert_not_has_file sysroot/boot/ostree/testos-${bootcsum}/dtb/asoc-board.dtb 'a device tree' assert_streq $(ls sysroot/boot/ostree | wc -l) 1 assert_streq $(find sysroot/boot/ostree -name '*.dtb' | wc -l) 0 -${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime env OSTREE_SYSROOT_DEBUG=${OSTREE_SYSROOT_DEBUG},no-dtb ${CMD_PREFIX} ostree admin upgrade --os=testos -${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime +${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin upgrade --os=testos assert_streq $(ls sysroot/boot/ostree | wc -l) 2 # Note that the bootcsum computed by the test suite doesn't include devicetree diff --git a/tests/test-repo-finder-config.c b/tests/test-repo-finder-config.c index b3e8a264..8a803aba 100644 --- a/tests/test-repo-finder-config.c +++ b/tests/test-repo-finder-config.c @@ -112,7 +112,7 @@ test_repo_finder_config_no_configs (Fixture *fixture, g_autoptr(GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */ g_autoptr(GError) error = NULL; const OstreeCollectionRef ref1 = { "org.example.Os", "exampleos/x86_64/standard" }; - const OstreeCollectionRef ref2 = { "org.example.Os", "exampleos/x86_64/buildmaster/standard" }; + const OstreeCollectionRef ref2 = { "org.example.Os", "exampleos/x86_64/buildmain/standard" }; const OstreeCollectionRef * const refs[] = { &ref1, &ref2, NULL }; context = g_main_context_new (); diff --git a/tests/test-repo-finder-mount.c b/tests/test-repo-finder-mount.c index 45e58fa4..5b670f50 100644 --- a/tests/test-repo-finder-mount.c +++ b/tests/test-repo-finder-mount.c @@ -125,7 +125,7 @@ test_repo_finder_mount_no_mounts (Fixture *fixture, g_autoptr(GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */ g_autoptr(GError) error = NULL; const OstreeCollectionRef ref1 = { "org.example.Collection1", "exampleos/x86_64/standard" }; - const OstreeCollectionRef ref2 = { "org.example.Collection1", "exampleos/x86_64/buildmaster/standard" }; + const OstreeCollectionRef ref2 = { "org.example.Collection1", "exampleos/x86_64/buildmain/standard" }; const OstreeCollectionRef ref3 = { "org.example.Collection2", "exampleos/x86_64/standard" }; const OstreeCollectionRef ref4 = { "org.example.Collection2", "exampleos/arm64/standard" }; const OstreeCollectionRef * const refs[] = { &ref1, &ref2, &ref3, &ref4, NULL }; diff --git a/tests/test-sysroot-c.c b/tests/test-sysroot-c.c index 4e51216c..ceff1dd1 100644 --- a/tests/test-sysroot-c.c +++ b/tests/test-sysroot-c.c @@ -53,10 +53,10 @@ test_sysroot_reload (gconstpointer data) goto out; g_assert (!changed); - if (!run_sync ("ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime", &error)) + if (!run_sync ("ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime", &error)) goto out; - if (!run_sync ("ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime", &error)) + if (!run_sync ("ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime", &error)) goto out; if (!ostree_sysroot_load_if_changed (sysroot, &changed, NULL, &error)) diff --git a/tests/test-sysroot.js b/tests/test-sysroot.js index d27c6e1d..f3db2b5e 100755 --- a/tests/test-sysroot.js +++ b/tests/test-sysroot.js @@ -49,7 +49,7 @@ GLib.setenv("OSTREE_SYSROOT_DEBUG", "mutable-deployments", true); let upstreamRepo = OSTree.Repo.new(Gio.File.new_for_path('testos-repo')); upstreamRepo.open(null); -let runtimeRef = 'testos/buildmaster/x86_64-runtime'; +let runtimeRef = 'testos/buildmain/x86_64-runtime'; let [,rev] = upstreamRepo.resolve_rev(runtimeRef, false); print("testos => " + rev); From a709d4f8461c867c1c60029d27cbd3efa3c5a1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Fri, 7 May 2021 16:44:06 +0200 Subject: [PATCH 13/50] *: rename master branch to main (external repos) --- .cci.jenkinsfile | 2 +- tests/inst/src/destructive.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 12d9988a..213d23c9 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -1,4 +1,4 @@ -// Documentation: https://github.com/coreos/coreos-ci/blob/master/README-upstream-ci.md +// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md stage("Build") { parallel normal: { diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index d631b9a7..5f4fb790 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -1,7 +1,7 @@ //! Test that interrupting an upgrade is safe. //! //! This test builds on coreos-assembler's "external tests": -//! https://github.com/coreos/coreos-assembler/blob/master/mantle/kola/README-kola-ext.md +//! https://github.com/coreos/coreos-assembler/blob/main/mantle/kola/README-kola-ext.md //! Key to this in particular is coreos-assembler implementing the Debian autopkgtest reboot API. //! //! The basic model of this test is: From e4105a0366bf0d905c610a18ad6e343ae9965b2e Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 20 May 2021 16:42:29 -0600 Subject: [PATCH 14/50] docs: Fix CONTRIBUTING link This returns a 404 since the site is already generated from the docs directory. Furthermore, the `CONTRIBUTING.md` markdown file isn't in the generated site, just the HTML. Instead, use jekyll's `link` tag to create the link. Unfortunately, before jekyll 4.0 (github-pages uses 3.9), you have to prepend the base URL. --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index d5235ed6..b6cdc663 100644 --- a/docs/index.md +++ b/docs/index.md @@ -143,7 +143,7 @@ make install DESTDIR=/path/to/dest ## Contributing -See [Contributing](docs/CONTRIBUTING.md). +See [Contributing]({{ site.baseurl }}{% link CONTRIBUTING.md %}). ## Licensing From 3c7449397a6e49df4d717317945ff1274f020606 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 20 May 2021 14:48:16 -0600 Subject: [PATCH 15/50] docs: Provide bundler setup for building site locally This mimics the GitHub Pages environment so that you can build and serve the site locally for testing. It's will also be required later for using Jekyll Actions[1] instead of the automated GitHub Pages flow. 1. https://github.com/marketplace/actions/jekyll-actions --- Makefile.am | 8 ++++++++ docs/Gemfile | 14 ++++++++++++++ docs/README.md | 28 ++++++++++++++++++++++++++++ docs/_config.yml | 8 ++++++++ 4 files changed, 58 insertions(+) create mode 100644 docs/Gemfile create mode 100644 docs/README.md diff --git a/Makefile.am b/Makefile.am index 2f3cb53f..25428ec1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,6 +49,14 @@ GITIGNOREFILES += fastbuild-*.qcow2 _kola_temp/ # Rust stuff GITIGNOREFILES += target/ Cargo.lock +# Jekyll docs +GITIGNOREFILES += \ + docs/.bundle/ \ + docs/Gemfile.lock \ + docs/_site/ \ + docs/vendor/ \ + $(NULL) + SUBDIRS += . if ENABLE_GTK_DOC diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100644 index 00000000..1ffd2a02 --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,14 @@ +# Bundler setup for jekyll to be deployed on github pages. + +source "https://rubygems.org" + +# Note that we're using the github-pages gem to mimic the GitHub pages +# automated setup. That installs jekyll, a default set of jekyll +# plugins, and a modified jekyll configuration. +group :jekyll_plugins do + gem "github-pages" + gem "jekyll-remote-theme" +end + +# Prefer the GitHub flavored markdown version of kramdown. +gem "kramdown-parser-gfm" diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..7963b04e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,28 @@ +This documentation is written in [Jekyll](https://jekyllrb.com/) format +to be published on [GitHub Pages](https://pages.github.com/). The +rendered HTML will be automatically built and published, but you can +also use Jekyll locally to test changes. + +First you need to install [Ruby](https://www.ruby-lang.org/en/) and +[RubyGems](https://rubygems.org/) to get Jekyll and the other gem +dependencies. This is easiest using the distro's packages. On RedHat +systems this is `rubygems` and on Debian systems this is +`ruby-rubygems`. + +Next [Bundler](https://bundler.io/) is needed to install the gems using +the provided [Gemfile](Gemfile). You can do this by running `gem install +bundler` or using distro packages. On RedHat systems this is +`rubygem-bundler` and on Debian systems this is `ruby-bundler`. + +Now you can prepare the Jekyll environment. Change to this directory and +run: + +``` +bundle config set --local path vendor/bundle +bundle install +``` + +Finally, render and serve the site locally with Jekyll: +``` +bundle exec jekyll serve +``` diff --git a/docs/_config.yml b/docs/_config.yml index 836b22d8..abe17b88 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -7,6 +7,14 @@ url: "https://ostreedev.github.io" permalink: /:title/ markdown: kramdown +# Exclude the README and the bundler files that would normally be +# ignored by default. +exclude: + - README.md + - Gemfile + - Gemfile.lock + - vendor/ + remote_theme: coreos/just-the-docs plugins: - jekyll-remote-theme From 19a306ecefa6f1ef84e7e4c03cd533c30d070fbe Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 20 May 2021 16:03:25 -0600 Subject: [PATCH 16/50] docs: Add github workflow for building and publishing docs This uses the Jekyll Actions GitHub action to push the rendered docs to the gh-pages branch rather than GitHub's automated docs flow. That will allow greater control over how the docs are generated. Pushing to the gh-pages branch only happens on pushes to main. For pull requests, the docs are only built. --- .github/workflows/docs.yml | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..966f983e --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,62 @@ +--- +name: Docs +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + docs: + name: Build documentation + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # This is taken from ci/travis-install.sh but should probably be + # refactored. + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + 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 + + - name: Build and publish jekyll docs + uses: helaili/jekyll-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + jekyll_src: docs + target_branch: gh-pages + # Only publish when pushing to main. + # XXX: Maybe this should only run on the release event? + build_only: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }} From e19840a25220b399fb213407ec545c8262d1bc39 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 20 May 2021 16:03:56 -0600 Subject: [PATCH 17/50] docs: Copy in API docs and add link Make a copy of `apidoc/html` to `docs/reference` and then tell Jekyll to include it verbatim. This will include the gtk-doc API docs on the static site. A link is added to the main index. A script is added to do the copy (a symlink won't do) and is setup to run before Jekyll in the GitHub workflow. Ideally this would be a local Jekyll plugin to make the process automatic, but the github-pages gem doesn't allow that. --- .github/workflows/docs.yml | 7 +++++++ Makefile.am | 1 + docs/README.md | 5 ++++- docs/_config.yml | 5 +++++ docs/index.md | 4 ++++ docs/prep-docs.sh | 23 +++++++++++++++++++++++ 6 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 docs/prep-docs.sh diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 966f983e..6ff16fe7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -51,6 +51,11 @@ jobs: zlib1g-dev \ python3-yaml + - name: Build API docs + run: | + ./autogen.sh --enable-gtk-doc + make -C apidoc + - name: Build and publish jekyll docs uses: helaili/jekyll-action@v2 with: @@ -60,3 +65,5 @@ jobs: # Only publish when pushing to main. # XXX: Maybe this should only run on the release event? build_only: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }} + # Run the prep script to put the API docs in place. + pre_build_commands: ./docs/prep-docs.sh diff --git a/Makefile.am b/Makefile.am index 25428ec1..1b9449c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,6 +54,7 @@ GITIGNOREFILES += \ docs/.bundle/ \ docs/Gemfile.lock \ docs/_site/ \ + docs/reference/ \ docs/vendor/ \ $(NULL) diff --git a/docs/README.md b/docs/README.md index 7963b04e..f1f89ecb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -22,7 +22,10 @@ bundle config set --local path vendor/bundle bundle install ``` -Finally, render and serve the site locally with Jekyll: +Finally, run the `prep-docs.sh` script and then render and serve the +site locally with Jekyll: + ``` +./prep-docs.sh bundle exec jekyll serve ``` diff --git a/docs/_config.yml b/docs/_config.yml index abe17b88..44135c82 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -13,8 +13,13 @@ exclude: - README.md - Gemfile - Gemfile.lock + - prep-docs.sh - vendor/ +# This is a copy of the apidoc/html directory. Run prep-docs.sh before +# jekyll to put it in place. +include: [reference] + remote_theme: coreos/just-the-docs plugins: - jekyll-remote-theme diff --git a/docs/index.md b/docs/index.md index b6cdc663..5d925d6f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -141,6 +141,10 @@ make make install DESTDIR=/path/to/dest ``` +## API Reference + +The libostree API documentation is available in [Reference](reference/). + ## Contributing See [Contributing]({{ site.baseurl }}{% link CONTRIBUTING.md %}). diff --git a/docs/prep-docs.sh b/docs/prep-docs.sh new file mode 100755 index 00000000..2ae15a74 --- /dev/null +++ b/docs/prep-docs.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Prepare docs directory for running jekyll. This would be better as a +# local Jekyll plugin, but those aren't allowed by the github-pages gem. + +set -e + +docsdir=$(dirname "$0") +topdir="$docsdir/.." + +# Make sure the API docs have been generated and copy them to the +# reference directory. +apidocs="$topdir/apidoc/html" +refdir="$docsdir/reference" +if [ ! -d "$apidocs" ]; then + echo "error: API docs $apidocs have not been generated" >&2 + echo "Rebuild with --enable-gtk-doc option" >&2 + exit 1 +fi + +echo "Copying $apidocs to $refdir" +rm -rf "$refdir" +cp -r "$apidocs" "$refdir" From bd42df4c9beeadf17234ecfc031a26bc16d93549 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Tue, 25 May 2021 14:25:28 -0600 Subject: [PATCH 18/50] workflow/docs: Give token write permission to push gh-pages The ostree repo has read permissions set for workflows, which prevents the documentation job from pushing the built docs to the gh-pages branch. Raise the job's permissions to write for repo contents to allow that. --- .github/workflows/docs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6ff16fe7..05ede2e9 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,6 +10,10 @@ jobs: docs: name: Build documentation runs-on: ubuntu-latest + permissions: + # This job pushes to the gh-pages branch, so the token needs write + # privileges for repo contents. + contents: write steps: - name: Checkout repository uses: actions/checkout@v2 From 6664ee4ed42e2f72f5cff7190983754621cfe176 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 25 May 2021 16:28:19 -0400 Subject: [PATCH 19/50] ci: Fix staged-delay to work with newer systemd Yeah, we should stop parsing the text; I need to dig at that at some point. --- tests/kolainst/destructive/staged-delay.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kolainst/destructive/staged-delay.sh b/tests/kolainst/destructive/staged-delay.sh index 5671bbea..699c3550 100755 --- a/tests/kolainst/destructive/staged-delay.sh +++ b/tests/kolainst/destructive/staged-delay.sh @@ -31,7 +31,7 @@ if systemctl --version | head -1 | grep -qF -e 'systemd 239'; then assert_file_has_content_literal logs.txt 'Stopped OSTree Finalize Staged Deployment' assert_not_file_has_content logs.txt 'Failed with result' else - assert_file_has_content_literal logs.txt 'ostree-finalize-staged.service: Succeeded.' + assert_file_has_content logs.txt 'ostree-finalize-staged.service: \(Succeeded\|Deactivated successfully\)' fi assert_file_has_content_literal /proc/cmdline somedummykarg=1 ;; From 9c20d162a410ad445a5a1b73bcdbb01c202f7964 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 28 May 2021 15:23:54 -0600 Subject: [PATCH 20/50] tests/gpg: Don't assert subkey expiration when only primary expired In gnupg 2.3.0[1], if a primary key is expired and a subkey does not have an expiration or its expiration is older than the primary key, the subkey's expiration will be reported as the primary's. Previously a subkey without an expiration would not report one regardless of the primary key's expiration. This caused a regression in a test setting an expiration on a primary key. The test was checking that the subkey was not expired by asserting that there was no `Key expired` line in the signature verification output. With gnupg 2.3.0+, it will show as expired, causing the test to fail. Remove the assertion since it's not consistent across gnupg versions. In practice we don't care whether the subkey is considered expired or not as long as the signature verification fails when the primary key is expired. 1. https://dev.gnupg.org/T3343 Fixes: #2359 --- tests/test-gpg-signed-commit.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test-gpg-signed-commit.sh b/tests/test-gpg-signed-commit.sh index 090b4bfe..67ce4f74 100755 --- a/tests/test-gpg-signed-commit.sh +++ b/tests/test-gpg-signed-commit.sh @@ -235,7 +235,6 @@ assert_file_has_content test2-show "${key1_id}" assert_file_has_content test2-show "${key2_sub_id}" assert_file_has_content test2-show 'Good signature from "Test Key 1 <>"' assert_file_has_content test2-show 'BAD signature from "Test Key 2 <>"' -assert_not_file_has_content test2-show 'Key expired' assert_file_has_content test2-show "Primary key ID ${key2_id}" assert_file_has_content test2-show 'Primary key expired' From c848b71cf21a3f0ca1d5266904e96bfbe8994ecc Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 26 May 2021 10:16:01 +0100 Subject: [PATCH 21/50] docs: Change IRC channel to libera.chat from freenode Freenode appears to be imploding. Signed-off-by: Philip Withnall --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7074dbbc..234ad6c6 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ make install DESTDIR=/path/to/dest ## Contact and discussion forums OSTree has a [mailing list](https://mail.gnome.org/archives/ostree-list/) and -there is also an `#ostree` channel on FreeNode. However, asynchronous+logged +there is also an `#ostree` channel on [Libera.Chat](ircs://irc.libera.chat/ostree). However, asynchronous+logged communication is preferred for nontrivial questions. ## Contributing From 0f36d8c2219decbb5794ff19b5259d15d3d8d791 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 14 Apr 2021 20:43:53 -0400 Subject: [PATCH 22/50] repo: Make locking APIs public Doing anything even somewhat sophisticated requires this; turns out our own `ostree prune` CLI wants this, e.g. https://github.com/ostreedev/ostree/issues/2337 Closes: https://github.com/ostreedev/ostree/issues/2286 --- Makefile-libostree.am | 6 +-- apidoc/ostree-sections.txt | 6 +++ src/libostree/libostree-devel.sym | 8 +++ src/libostree/ostree-repo-commit.c | 8 +-- src/libostree/ostree-repo-private.h | 24 --------- src/libostree/ostree-repo-prune.c | 8 +-- src/libostree/ostree-repo-static-delta-core.c | 2 +- src/libostree/ostree-repo.c | 51 ++++++++++--------- src/libostree/ostree-repo.h | 50 ++++++++++++++++++ src/libostree/ostree-sysroot-cleanup.c | 2 +- tests/test-core.js | 8 +++ tests/test-repo.c | 26 ++++++++++ 12 files changed, 139 insertions(+), 60 deletions(-) diff --git a/Makefile-libostree.am b/Makefile-libostree.am index dd396974..d40de48d 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/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index b09ba6f9..2da1d749 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -319,6 +319,12 @@ ostree_repo_get_min_free_space_bytes ostree_repo_get_config ostree_repo_get_dfd ostree_repo_get_default_repo_finders +OstreeRepoLockType +ostree_repo_lock_pop +ostree_repo_lock_push +OstreeRepoAutoLock +ostree_repo_auto_lock_push +ostree_repo_auto_lock_cleanup ostree_repo_hash ostree_repo_equal ostree_repo_copy_config diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index e3cd14a4..1af5f449 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -22,6 +22,14 @@ - uncomment the include in Makefile-libostree.am */ +LIBOSTREE_2021.3 { +global: + ostree_repo_auto_lock_push; + ostree_repo_auto_lock_cleanup; + ostree_repo_lock_push; + ostree_repo_lock_pop; +} LIBOSTREE_2021.2; + /* 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/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 1ac53259..dd5cd862 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -1684,8 +1684,8 @@ ostree_repo_prepare_transaction (OstreeRepo *self, memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats)); - self->txn_locked = _ostree_repo_lock_push (self, OSTREE_REPO_LOCK_SHARED, - cancellable, error); + self->txn_locked = ostree_repo_lock_push (self, OSTREE_REPO_LOCK_SHARED, + cancellable, error); if (!self->txn_locked) return FALSE; @@ -2341,7 +2341,7 @@ ostree_repo_commit_transaction (OstreeRepo *self, if (self->txn_locked) { - if (!_ostree_repo_lock_pop (self, cancellable, error)) + if (!ostree_repo_lock_pop (self, cancellable, error)) return FALSE; self->txn_locked = FALSE; } @@ -2399,7 +2399,7 @@ ostree_repo_abort_transaction (OstreeRepo *self, if (self->txn_locked) { - if (!_ostree_repo_lock_pop (self, cancellable, error)) + if (!ostree_repo_lock_pop (self, cancellable, error)) return FALSE; self->txn_locked = FALSE; } diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h index 14b29c0b..20af1b38 100644 --- a/src/libostree/ostree-repo-private.h +++ b/src/libostree/ostree-repo-private.h @@ -506,30 +506,6 @@ _ostree_repo_maybe_regenerate_summary (OstreeRepo *self, GCancellable *cancellable, GError **error); -/* Locking APIs are currently private. - * See https://github.com/ostreedev/ostree/pull/1555 - */ -typedef enum { - OSTREE_REPO_LOCK_SHARED, - OSTREE_REPO_LOCK_EXCLUSIVE -} OstreeRepoLockType; - -gboolean _ostree_repo_lock_push (OstreeRepo *self, - OstreeRepoLockType lock_type, - GCancellable *cancellable, - GError **error); -gboolean _ostree_repo_lock_pop (OstreeRepo *self, - GCancellable *cancellable, - GError **error); - -typedef OstreeRepo OstreeRepoAutoLock; - -OstreeRepoAutoLock * _ostree_repo_auto_lock_push (OstreeRepo *self, - OstreeRepoLockType lock_type, - GCancellable *cancellable, - GError **error); -void _ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock); -G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoAutoLock, _ostree_repo_auto_lock_cleanup) gboolean _ostree_repo_parse_fsverity_config (OstreeRepo *self, GError **error); diff --git a/src/libostree/ostree-repo-prune.c b/src/libostree/ostree-repo-prune.c index 0b953628..c4ce64ab 100644 --- a/src/libostree/ostree-repo-prune.c +++ b/src/libostree/ostree-repo-prune.c @@ -204,7 +204,7 @@ ostree_repo_prune_static_deltas (OstreeRepo *self, const char *commit, GError **error) { g_autoptr(OstreeRepoAutoLock) lock = - _ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); + ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); if (!lock) return FALSE; @@ -325,7 +325,7 @@ ostree_repo_traverse_reachable_refs (OstreeRepo *self, GError **error) { g_autoptr(OstreeRepoAutoLock) lock = - _ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_SHARED, cancellable, error); + ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_SHARED, cancellable, error); if (!lock) return FALSE; @@ -400,7 +400,7 @@ ostree_repo_prune (OstreeRepo *self, GError **error) { g_autoptr(OstreeRepoAutoLock) lock = - _ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); + ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); if (!lock) return FALSE; @@ -486,7 +486,7 @@ ostree_repo_prune_from_reachable (OstreeRepo *self, GError **error) { g_autoptr(OstreeRepoAutoLock) lock = - _ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); + ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); if (!lock) return FALSE; diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index e4280af0..d8c33b7c 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -1270,7 +1270,7 @@ ostree_repo_static_delta_reindex (OstreeRepo *repo, /* Protect against parallel prune operation */ g_autoptr(OstreeRepoAutoLock) lock = - _ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_SHARED, cancellable, error); + ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_SHARED, cancellable, error); if (!lock) return FALSE; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 76b02482..1036a81f 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -444,7 +444,7 @@ pop_repo_lock (OstreeRepo *self, return TRUE; } -/* +/** * ostree_repo_lock_push: * @self: a #OstreeRepo * @lock_type: the type of lock to acquire @@ -470,12 +470,13 @@ pop_repo_lock (OstreeRepo *self, * %TRUE is returned. * * Returns: %TRUE on success, otherwise %FALSE with @error set + * Since: 2021.3 */ gboolean -_ostree_repo_lock_push (OstreeRepo *self, - OstreeRepoLockType lock_type, - GCancellable *cancellable, - GError **error) +ostree_repo_lock_push (OstreeRepo *self, + OstreeRepoLockType lock_type, + GCancellable *cancellable, + GError **error) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE); @@ -538,8 +539,8 @@ _ostree_repo_lock_push (OstreeRepo *self, } } -/* - * _ostree_repo_lock_pop: +/** + * ostree_repo_lock_pop: * @self: a #OstreeRepo * @cancellable: a #GCancellable * @error: a #GError @@ -560,11 +561,12 @@ _ostree_repo_lock_push (OstreeRepo *self, * %TRUE is returned. * * Returns: %TRUE on success, otherwise %FALSE with @error set + * Since: 2021.3 */ gboolean -_ostree_repo_lock_pop (OstreeRepo *self, - GCancellable *cancellable, - GError **error) +ostree_repo_lock_pop (OstreeRepo *self, + GCancellable *cancellable, + GError **error) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE); @@ -628,7 +630,7 @@ _ostree_repo_lock_pop (OstreeRepo *self, } /* - * _ostree_repo_auto_lock_push: (skip) + * ostree_repo_auto_lock_push: (skip) * @self: a #OstreeRepo * @lock_type: the type of lock to acquire * @cancellable: a #GCancellable @@ -642,34 +644,37 @@ _ostree_repo_lock_pop (OstreeRepo *self, * * |[ * g_autoptr(OstreeRepoAutoLock) lock = NULL; - * lock = _ostree_repo_auto_lock_push (repo, lock_type, cancellable, error); + * lock = ostree_repo_auto_lock_push (repo, lock_type, cancellable, error); * if (!lock) * return FALSE; * ]| * * Returns: @self on success, otherwise %NULL with @error set + * Since: 2021.3 */ OstreeRepoAutoLock * -_ostree_repo_auto_lock_push (OstreeRepo *self, - OstreeRepoLockType lock_type, - GCancellable *cancellable, - GError **error) +ostree_repo_auto_lock_push (OstreeRepo *self, + OstreeRepoLockType lock_type, + GCancellable *cancellable, + GError **error) { - if (!_ostree_repo_lock_push (self, lock_type, cancellable, error)) + if (!ostree_repo_lock_push (self, lock_type, cancellable, error)) return NULL; return (OstreeRepoAutoLock *)self; } -/* - * _ostree_repo_auto_lock_cleanup: (skip) +/** + * ostree_repo_auto_lock_cleanup: (skip) * @lock: a #OstreeRepoAutoLock * * A cleanup handler for use with ostree_repo_auto_lock_push(). If @lock is * not %NULL, ostree_repo_lock_pop() will be called on it. If * ostree_repo_lock_pop() fails, a critical warning will be emitted. + * + * Since: 2021.3 */ void -_ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock) +ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock) { OstreeRepo *repo = lock; if (repo) @@ -677,7 +682,7 @@ _ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock) g_autoptr(GError) error = NULL; int errsv = errno; - if (!_ostree_repo_lock_pop (repo, NULL, &error)) + if (!ostree_repo_lock_pop (repo, NULL, &error)) g_critical ("Cleanup repo lock failed: %s", error->message); errno = errsv; @@ -5791,8 +5796,8 @@ ostree_repo_regenerate_summary (OstreeRepo *self, g_autoptr(OstreeRepoAutoLock) lock = NULL; gboolean no_deltas_in_summary = FALSE; - lock = _ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, - cancellable, error); + lock = ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE, + cancellable, error); if (!lock) return FALSE; diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index f94d70be..62e238c9 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -1498,6 +1498,56 @@ gboolean ostree_repo_regenerate_summary (OstreeRepo *self, GCancellable *cancellable, GError **error); + +/** + * OstreeRepoLockType: + * @OSTREE_REPO_LOCK_SHARED: A "read only" lock; multiple readers are allowed. + * @OSTREE_REPO_LOCK_EXCLUSIVE: A writable lock at most one writer can be active, and zero readers. + * + * Flags controlling repository locking. + * + * Since: 2021.3 + */ +typedef enum { + OSTREE_REPO_LOCK_SHARED, + OSTREE_REPO_LOCK_EXCLUSIVE +} OstreeRepoLockType; + +_OSTREE_PUBLIC +gboolean ostree_repo_lock_push (OstreeRepo *self, + OstreeRepoLockType lock_type, + GCancellable *cancellable, + GError **error); +_OSTREE_PUBLIC +gboolean ostree_repo_lock_pop (OstreeRepo *self, + GCancellable *cancellable, + GError **error); + +/* C convenience API only */ +#ifndef __GI_SCANNER__ + +/** + * OstreeRepoAutoLock: (skip) + * + * An opaque type for use with ostree_repo_auto_lock_push(). + * + * Since: 2021.3 + */ +typedef OstreeRepo OstreeRepoAutoLock; + +_OSTREE_PUBLIC +OstreeRepoAutoLock * ostree_repo_auto_lock_push (OstreeRepo *self, + OstreeRepoLockType lock_type, + GCancellable *cancellable, + GError **error); + +_OSTREE_PUBLIC +void ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock); +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoAutoLock, ostree_repo_auto_lock_cleanup) + +#endif + + /** * OSTREE_REPO_METADATA_REF: * diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c index 27122834..91381cb0 100644 --- a/src/libostree/ostree-sysroot-cleanup.c +++ b/src/libostree/ostree-sysroot-cleanup.c @@ -505,7 +505,7 @@ ostree_sysroot_cleanup_prune_repo (OstreeSysroot *sysroot, * the prune. */ g_autoptr(OstreeRepoAutoLock) lock = - _ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); + ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error); if (!lock) return FALSE; diff --git a/tests/test-core.js b/tests/test-core.js index 2c7162be..7d871c1f 100755 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -134,4 +134,12 @@ w.write(inline_content.slice(10), null) let actual_checksum = w.finish(null) assertEquals(actual_checksum, networks_checksum) +// Basic locking API sanity test +repo.lock_push(OSTree.RepoLockType.SHARED, null); +repo.lock_push(OSTree.RepoLockType.SHARED, null); +repo.lock_pop(null); +repo.lock_pop(null); +repo.lock_push(OSTree.RepoLockType.EXCLUSIVE, null); +repo.lock_pop(null); + print("ok test-core"); diff --git a/tests/test-repo.c b/tests/test-repo.c index 9337ac3b..b388f5bf 100644 --- a/tests/test-repo.c +++ b/tests/test-repo.c @@ -249,6 +249,30 @@ test_write_regfile_api (Fixture *fixture, g_assert_cmpstr (checksum, ==, "23a2e97d21d960ac7a4e39a8721b1baff7b213e00e5e5641334f50506012fcff"); } +/* Just a sanity check of the C autolocking API */ +static void +test_repo_autolock (Fixture *fixture, + gconstpointer test_data) +{ + 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_autoptr(OstreeRepoAutoLock) lock = ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + } + + g_autoptr(OstreeRepoAutoLock) lock1 = ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + + g_autoptr(OstreeRepoAutoLock) lock2 = ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); +} + int main (int argc, char **argv) @@ -266,6 +290,8 @@ main (int argc, test_repo_get_min_free_space, teardown); g_test_add ("/repo/write_regfile_api", Fixture, NULL, setup, test_write_regfile_api, teardown); + g_test_add ("/repo/autolock", Fixture, NULL, setup, + test_repo_autolock, teardown); return g_test_run (); } From c3ada6fa7a1db488fced6acde5faaaf435e09aba Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 28 Apr 2021 21:13:15 -0600 Subject: [PATCH 23/50] repo: Require lock type in ostree_repo_lock_pop This simplifies the lock state management considerably since the previously pushed type doesn't need to be tracked. Instead, 2 counters are kept to track how many times each lock type has been pushed. When the number of exclusive locks drops to 0, the lock transitions back to shared. --- src/libostree/ostree-repo-commit.c | 4 +- src/libostree/ostree-repo.c | 184 +++++++++++++++++++---------- src/libostree/ostree-repo.h | 9 +- tests/test-core.js | 6 +- 4 files changed, 132 insertions(+), 71 deletions(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index dd5cd862..ffd8319f 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2341,7 +2341,7 @@ ostree_repo_commit_transaction (OstreeRepo *self, if (self->txn_locked) { - if (!ostree_repo_lock_pop (self, cancellable, error)) + if (!ostree_repo_lock_pop (self, OSTREE_REPO_LOCK_SHARED, cancellable, error)) return FALSE; self->txn_locked = FALSE; } @@ -2399,7 +2399,7 @@ ostree_repo_abort_transaction (OstreeRepo *self, if (self->txn_locked) { - if (!ostree_repo_lock_pop (self, cancellable, error)) + if (!ostree_repo_lock_pop (self, OSTREE_REPO_LOCK_SHARED, cancellable, error)) return FALSE; self->txn_locked = FALSE; } diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 1036a81f..61ee327b 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -214,7 +214,8 @@ static GPrivate repo_lock_table = G_PRIVATE_INIT (free_repo_lock_table); typedef struct { int fd; - GQueue stack; + guint shared; /* Number of shared locks */ + guint exclusive; /* Number of exclusive locks */ } OstreeRepoLock; typedef struct { @@ -223,6 +224,22 @@ typedef struct { const char *name; } OstreeRepoLockInfo; +static const char * +lock_state_name (int state) +{ + switch (state) + { + case LOCK_EX: + return "exclusive"; + case LOCK_SH: + return "shared"; + case LOCK_UN: + return "unlocked"; + default: + g_assert_not_reached (); + } +} + static void repo_lock_info (OstreeRepoLock *lock, OstreeRepoLockInfo *out_info) { @@ -230,17 +247,14 @@ repo_lock_info (OstreeRepoLock *lock, OstreeRepoLockInfo *out_info) g_assert (out_info != NULL); OstreeRepoLockInfo info; - info.len = g_queue_get_length (&lock->stack); + info.len = lock->shared + lock->exclusive; if (info.len == 0) - { info.state = LOCK_UN; - info.name = "unlocked"; - } + else if (lock->exclusive > 0) + info.state = LOCK_EX; else - { - info.state = GPOINTER_TO_INT (g_queue_peek_head (&lock->stack)); - info.name = (info.state == LOCK_EX) ? "exclusive" : "shared"; - } + info.state = LOCK_SH; + info.name = lock_state_name (info.state); *out_info = info; } @@ -256,7 +270,6 @@ free_repo_lock (gpointer data) repo_lock_info (lock, &info); g_debug ("Free lock: state=%s, depth=%u", info.name, info.len); - g_queue_clear (&lock->stack); if (lock->fd >= 0) { g_debug ("Closing repo lock file"); @@ -339,6 +352,7 @@ push_repo_lock (OstreeRepo *self, GError **error) { int flags = (lock_type == OSTREE_REPO_LOCK_EXCLUSIVE) ? LOCK_EX : LOCK_SH; + int next_state = flags; if (!blocking) flags |= LOCK_NB; @@ -355,7 +369,6 @@ push_repo_lock (OstreeRepo *self, if (lock == NULL) { lock = g_new0 (OstreeRepoLock, 1); - g_queue_init (&lock->stack); g_debug ("Opening repo lock file"); lock->fd = TEMP_FAILURE_RETRY (openat (self->repo_dir_fd, ".lock", O_CREAT | O_RDWR | O_CLOEXEC, @@ -374,31 +387,42 @@ push_repo_lock (OstreeRepo *self, repo_lock_info (lock, &info); g_debug ("Push lock: state=%s, depth=%u", info.name, info.len); - if (info.state == LOCK_EX) + guint *counter; + if (next_state == LOCK_EX) + counter = &(lock->exclusive); + else + counter = &(lock->shared); + + /* Check for overflow */ + g_assert_cmpuint (*counter, <, G_MAXUINT); + + if (info.state == LOCK_EX || info.state == next_state) { - g_debug ("Repo already locked exclusively, extending stack"); - g_queue_push_head (&lock->stack, GINT_TO_POINTER (LOCK_EX)); + g_debug ("Repo already locked %s, maintaining state", info.name); } else { - int next_state = (flags & LOCK_EX) ? LOCK_EX : LOCK_SH; - const char *next_state_name = (flags & LOCK_EX) ? "exclusive" : "shared"; + /* We should never upgrade from exclusive to shared */ + g_assert (!(info.state == LOCK_EX && next_state == LOCK_SH)); + const char *next_state_name = lock_state_name (next_state); g_debug ("Locking repo %s", next_state_name); if (!do_repo_lock (lock->fd, flags)) return glnx_throw_errno_prefix (error, "Locking repo %s failed", next_state_name); - - g_queue_push_head (&lock->stack, GINT_TO_POINTER (next_state)); } + /* Update state */ + (*counter)++; + return TRUE; } static gboolean -pop_repo_lock (OstreeRepo *self, - gboolean blocking, - GError **error) +pop_repo_lock (OstreeRepo *self, + OstreeRepoLockType lock_type, + gboolean blocking, + GError **error) { int flags = blocking ? 0 : LOCK_NB; @@ -412,34 +436,57 @@ pop_repo_lock (OstreeRepo *self, OstreeRepoLockInfo info; repo_lock_info (lock, &info); g_return_val_if_fail (info.len > 0, FALSE); - g_debug ("Pop lock: state=%s, depth=%u", info.name, info.len); - if (info.len > 1) - { - int next_state = GPOINTER_TO_INT (g_queue_peek_nth (&lock->stack, 1)); - /* Drop back to the previous lock state if it differs */ - if (next_state != info.state) - { - /* We should never drop from shared to exclusive */ - g_return_val_if_fail (next_state == LOCK_SH, FALSE); - g_debug ("Returning lock state to shared"); - if (!do_repo_lock (lock->fd, next_state | flags)) - return glnx_throw_errno_prefix (error, - "Setting repo lock to shared failed"); - } - else - g_debug ("Maintaining lock state as %s", info.name); + int state_to_drop; + guint *counter; + if (lock_type == OSTREE_REPO_LOCK_EXCLUSIVE) + { + state_to_drop = LOCK_EX; + counter = &(lock->exclusive); } else { - /* Lock stack will be empty, unlock */ + state_to_drop = LOCK_SH; + counter = &(lock->shared); + } + + /* Make sure caller specified a valid type to release */ + g_assert_cmpuint (*counter, >, 0); + + int next_state; + if (info.len == 1) + { + /* Lock counters will be empty, unlock */ + next_state = LOCK_UN; + } + else if (state_to_drop == LOCK_EX) + next_state = (lock->exclusive > 1) ? LOCK_EX : LOCK_SH; + else + next_state = (lock->exclusive > 0) ? LOCK_EX : LOCK_SH; + + if (next_state == LOCK_UN) + { g_debug ("Unlocking repo"); if (!do_repo_unlock (lock->fd, flags)) return glnx_throw_errno_prefix (error, "Unlocking repo failed"); } + else if (info.state == next_state) + { + g_debug ("Maintaining lock state as %s", info.name); + } + else + { + /* We should never drop from shared to exclusive */ + g_return_val_if_fail (next_state == LOCK_SH, FALSE); + g_debug ("Returning lock state to shared"); + if (!do_repo_lock (lock->fd, next_state | flags)) + return glnx_throw_errno_prefix (error, + "Setting repo lock to shared failed"); + } - g_queue_pop_head (&lock->stack); + /* Update state */ + (*counter)--; return TRUE; } @@ -451,13 +498,13 @@ pop_repo_lock (OstreeRepo *self, * @cancellable: a #GCancellable * @error: a #GError * - * Takes a lock on the repository and adds it to the lock stack. If @lock_type + * Takes a lock on the repository and adds it to the lock state. If @lock_type * is %OSTREE_REPO_LOCK_SHARED, a shared lock is taken. If @lock_type is * %OSTREE_REPO_LOCK_EXCLUSIVE, an exclusive lock is taken. The actual lock * state is only changed when locking a previously unlocked repository or - * upgrading the lock from shared to exclusive. If the requested lock state is + * upgrading the lock from shared to exclusive. If the requested lock type is * unchanged or would represent a downgrade (exclusive to shared), the lock - * state is not changed and the stack is simply updated. + * state is not changed. * * ostree_repo_lock_push() waits for the lock depending on the repository's * lock-timeout-secs configuration. When lock-timeout-secs is -1, a blocking lock is @@ -542,13 +589,16 @@ ostree_repo_lock_push (OstreeRepo *self, /** * ostree_repo_lock_pop: * @self: a #OstreeRepo + * @lock_type: the type of lock to release * @cancellable: a #GCancellable * @error: a #GError * - * Remove the current repository lock state from the lock stack. If the lock - * stack becomes empty, the repository is unlocked. Otherwise, the lock state - * only changes when transitioning from an exclusive lock back to a shared - * lock. + * Release a lock of type @lock_type from the lock state. If the lock state + * becomes empty, the repository is unlocked. Otherwise, the lock state only + * changes when transitioning from an exclusive lock back to a shared lock. The + * requested @lock_type must be the same type that was requested in the call to + * ostree_repo_lock_push(). It is a programmer error if these do not match and + * the program may abort if the lock would reach an invalid state. * * ostree_repo_lock_pop() waits for the lock depending on the repository's * lock-timeout-secs configuration. When lock-timeout-secs is -1, a blocking lock is @@ -564,9 +614,10 @@ ostree_repo_lock_push (OstreeRepo *self, * Since: 2021.3 */ gboolean -ostree_repo_lock_pop (OstreeRepo *self, - GCancellable *cancellable, - GError **error) +ostree_repo_lock_pop (OstreeRepo *self, + OstreeRepoLockType lock_type, + GCancellable *cancellable, + GError **error) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE); @@ -583,7 +634,7 @@ ostree_repo_lock_pop (OstreeRepo *self, else if (self->lock_timeout_seconds == REPO_LOCK_BLOCKING) { g_debug ("Popping lock blocking"); - return pop_repo_lock (self, TRUE, error); + return pop_repo_lock (self, lock_type, TRUE, error); } else { @@ -598,7 +649,7 @@ ostree_repo_lock_pop (OstreeRepo *self, return FALSE; g_autoptr(GError) local_error = NULL; - if (pop_repo_lock (self, FALSE, &local_error)) + if (pop_repo_lock (self, lock_type, FALSE, &local_error)) return TRUE; if (!g_error_matches (local_error, G_IO_ERROR, @@ -629,18 +680,22 @@ ostree_repo_lock_pop (OstreeRepo *self, } } -/* +struct OstreeRepoAutoLock { + OstreeRepo *repo; + OstreeRepoLockType lock_type; +}; + +/** * ostree_repo_auto_lock_push: (skip) * @self: a #OstreeRepo * @lock_type: the type of lock to acquire * @cancellable: a #GCancellable * @error: a #GError * - * Like ostree_repo_lock_push(), but for usage with #OstreeRepoAutoLock. - * The intended usage is to declare the #OstreeRepoAutoLock with - * g_autoptr() so that ostree_repo_auto_lock_cleanup() is called when it - * goes out of scope. This will automatically pop the lock status off - * the stack if it was acquired successfully. + * Like ostree_repo_lock_push(), but for usage with #OstreeRepoAutoLock. The + * intended usage is to declare the #OstreeRepoAutoLock with g_autoptr() so + * that ostree_repo_auto_lock_cleanup() is called when it goes out of scope. + * This will automatically release the lock if it was acquired successfully. * * |[ * g_autoptr(OstreeRepoAutoLock) lock = NULL; @@ -660,7 +715,11 @@ ostree_repo_auto_lock_push (OstreeRepo *self, { if (!ostree_repo_lock_push (self, lock_type, cancellable, error)) return NULL; - return (OstreeRepoAutoLock *)self; + + OstreeRepoAutoLock *auto_lock = g_slice_new (OstreeRepoAutoLock); + auto_lock->repo = self; + auto_lock->lock_type = lock_type; + return auto_lock; } /** @@ -674,18 +733,19 @@ ostree_repo_auto_lock_push (OstreeRepo *self, * Since: 2021.3 */ void -ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock) +ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *auto_lock) { - OstreeRepo *repo = lock; - if (repo) + if (auto_lock != NULL) { g_autoptr(GError) error = NULL; int errsv = errno; - if (!ostree_repo_lock_pop (repo, NULL, &error)) + if (!ostree_repo_lock_pop (auto_lock->repo, auto_lock->lock_type, NULL, &error)) g_critical ("Cleanup repo lock failed: %s", error->message); errno = errsv; + + g_slice_free (OstreeRepoAutoLock, auto_lock); } } diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 62e238c9..08d3d408 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -1519,9 +1519,10 @@ gboolean ostree_repo_lock_push (OstreeRepo *self, GCancellable *cancellable, GError **error); _OSTREE_PUBLIC -gboolean ostree_repo_lock_pop (OstreeRepo *self, - GCancellable *cancellable, - GError **error); +gboolean ostree_repo_lock_pop (OstreeRepo *self, + OstreeRepoLockType lock_type, + GCancellable *cancellable, + GError **error); /* C convenience API only */ #ifndef __GI_SCANNER__ @@ -1533,7 +1534,7 @@ gboolean ostree_repo_lock_pop (OstreeRepo *self, * * Since: 2021.3 */ -typedef OstreeRepo OstreeRepoAutoLock; +typedef struct OstreeRepoAutoLock OstreeRepoAutoLock; _OSTREE_PUBLIC OstreeRepoAutoLock * ostree_repo_auto_lock_push (OstreeRepo *self, diff --git a/tests/test-core.js b/tests/test-core.js index 7d871c1f..b804e007 100755 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -137,9 +137,9 @@ assertEquals(actual_checksum, networks_checksum) // Basic locking API sanity test repo.lock_push(OSTree.RepoLockType.SHARED, null); repo.lock_push(OSTree.RepoLockType.SHARED, null); -repo.lock_pop(null); -repo.lock_pop(null); +repo.lock_pop(OSTree.RepoLockType.SHARED, null); +repo.lock_pop(OSTree.RepoLockType.SHARED, null); repo.lock_push(OSTree.RepoLockType.EXCLUSIVE, null); -repo.lock_pop(null); +repo.lock_pop(OSTree.RepoLockType.EXCLUSIVE, null); print("ok test-core"); From eb09207e1abd7499bd92866cce1de6148d659a4a Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 28 Apr 2021 13:25:38 -0600 Subject: [PATCH 24/50] build-sys: Bump required GLib to 2.44 This will allow usage of `GMutexLocker`. This should be available on many older distros: * RHEL 7 - 2.56.1 * RHEL 8 - 2.56.4 * Debian 9 stretch (oldstable) - 2.50.3 * Debian 10 buster (stable) - 2.58.3 * Ubuntu 16.04 xenial - 2.48.2 * Ubuntu 18.04 bionic - 2.56.4 --- Makefile.am | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1b9449c9..1dcf6b74 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,7 +31,7 @@ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \ -DOSTREE_COMPILATION \ -DG_LOG_DOMAIN=\"OSTree\" \ -DOSTREE_GITREV='"$(OSTREE_GITREV)"' \ - -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 '-DGLIB_VERSION_MAX_ALLOWED=G_ENCODE_VERSION(2,50)' \ + -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_44 '-DGLIB_VERSION_MAX_ALLOWED=G_ENCODE_VERSION(2,50)' \ -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_40 '-DSOUP_VERSION_MAX_ALLOWED=G_ENCODE_VERSION(2,48)' # For strict aliasing, see https://bugzilla.gnome.org/show_bug.cgi?id=791622 AM_CFLAGS += -std=gnu99 -fno-strict-aliasing $(WARN_CFLAGS) diff --git a/configure.ac b/configure.ac index 2ce7bdf1..f37b9cb3 100644 --- a/configure.ac +++ b/configure.ac @@ -109,7 +109,7 @@ AM_PATH_GLIB_2_0(,,AC_MSG_ERROR([GLib not found])) dnl When bumping the gio-unix-2.0 dependency (or glib-2.0 in general), dnl remember to bump GLIB_VERSION_MIN_REQUIRED and dnl GLIB_VERSION_MAX_ALLOWED in Makefile.am -GIO_DEPENDENCY="gio-unix-2.0 >= 2.40.0" +GIO_DEPENDENCY="gio-unix-2.0 >= 2.44.0" PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY) dnl 5.1.0 is an arbitrary version here From ccef9784d76c032b00ce5524fbfba39fa732b2fd Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 16 Apr 2021 09:55:40 -0600 Subject: [PATCH 25/50] repo: Make locking per-OstreeRepo Previously each thread maintained its own lock file descriptor regardless of whether the thread was using the same `OstreeRepo` as another thread. This was very safe but it made certain multithreaded procedures difficult. For example, if a main thread took an exclusive lock and then spawned worker threads, it would deadlock if one of the worker threads tried to acquire the lock. This moves the file descriptor from thread local storage to the `OstreeRepo` structure so that threads using the same `OstreeRepo` can share the lock. A mutex guards against threads altering the lock state concurrently. Fixes: #2344 --- src/libostree/ostree-repo-private.h | 9 ++ src/libostree/ostree-repo.c | 165 ++++++++++------------------ 2 files changed, 68 insertions(+), 106 deletions(-) diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h index 20af1b38..0cd9d8bb 100644 --- a/src/libostree/ostree-repo-private.h +++ b/src/libostree/ostree-repo-private.h @@ -104,6 +104,13 @@ typedef struct { fsblkcnt_t max_blocks; } OstreeRepoTxn; +typedef struct { + GMutex mutex; /* All other members should only be accessed with this held */ + int fd; /* The open file or flock file descriptor */ + guint shared; /* Number of shared locks curently held */ + guint exclusive; /* Number of exclusive locks currently held */ +} OstreeRepoLock; + typedef enum { _OSTREE_FEATURE_NO, _OSTREE_FEATURE_MAYBE, @@ -159,6 +166,8 @@ struct OstreeRepo { GWeakRef sysroot; /* Weak to avoid a circular ref; see also `is_system` */ char *remotes_config_dir; + OstreeRepoLock lock; + GMutex txn_lock; OstreeRepoTxn txn; gboolean txn_locked; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 61ee327b..73f374e5 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -172,52 +172,43 @@ G_DEFINE_TYPE (OstreeRepo, ostree_repo, G_TYPE_OBJECT) /* Repository locking * * To guard against objects being deleted (e.g., prune) while they're in - * use by another operation is accessing them (e.g., commit), the + * use by another operation that is accessing them (e.g., commit), the * repository must be locked by concurrent writers. * - * The locking is implemented by maintaining a thread local table of - * lock stacks per repository. This allows thread safe locking since - * each thread maintains its own lock stack. See the OstreeRepoLock type - * below. + * The repository locking has several important features: * - * The actual locking is done using either open file descriptor locks or - * flock locks. This allows the locking to work with concurrent - * processes. The lock file is held on the ".lock" file within the - * repository. + * * There are 2 states - shared and exclusive. Multiple users can hold + * a shared lock concurrently while only one user can hold an + * exclusive lock. + * + * * The lock can be taken recursively so long as each acquisition is paired + * with a matching release. The recursion is also latched to the strongest + * state. Once an exclusive lock has been taken, it will remain exclusive + * until all exclusive locks have been released. + * + * * It is both multiprocess- and multithread-safe. Threads that share + * an OstreeRepo use the lock cooperatively while processes and + * threads using separate OstreeRepo structures will block when + * acquiring incompatible lock states. + * + * The actual locking is implemented using either open file descriptor + * locks or flock locks. This allows the locking to work with concurrent + * processes or concurrent threads using a separate OstreeRepo. The lock + * file is held on the ".lock" file within the repository. * * The intended usage is to take a shared lock when writing objects or * reading objects in critical sections. Exclusive locks are taken when * deleting objects. * - * To allow fine grained locking within libostree, the lock is - * maintained as a stack. The core APIs then push or pop from the stack. - * When pushing or popping a lock state identical to the existing or - * next state, the stack is simply updated. Only when upgrading or - * downgrading the lock (changing to/from unlocked, pushing exclusive on - * shared or popping exclusive to shared) are actual locking operations - * performed. + * To allow fine grained locking, the lock state is maintained in shared and + * exclusive counters. Callers then push or pop lock types to increment or + * decrement the counters. When pushing or popping a lock type identical to + * the existing or next state, the lock state is simply updated. Only when + * upgrading or downgrading the lock (changing to/from unlocked, pushing + * exclusive on shared or popping exclusive to shared) are actual locking + * operations performed. */ -static void -free_repo_lock_table (gpointer data) -{ - GHashTable *lock_table = data; - - if (lock_table != NULL) - { - g_debug ("Free lock table"); - g_hash_table_destroy (lock_table); - } -} - -static GPrivate repo_lock_table = G_PRIVATE_INIT (free_repo_lock_table); - -typedef struct { - int fd; - guint shared; /* Number of shared locks */ - guint exclusive; /* Number of exclusive locks */ -} OstreeRepoLock; - typedef struct { guint len; int state; @@ -241,16 +232,18 @@ lock_state_name (int state) } static void -repo_lock_info (OstreeRepoLock *lock, OstreeRepoLockInfo *out_info) +repo_lock_info (OstreeRepo *self, GMutexLocker *locker, + OstreeRepoLockInfo *out_info) { - g_assert (lock != NULL); + g_assert (self != NULL); + g_assert (locker != NULL); g_assert (out_info != NULL); OstreeRepoLockInfo info; - info.len = lock->shared + lock->exclusive; + info.len = self->lock.shared + self->lock.exclusive; if (info.len == 0) info.state = LOCK_UN; - else if (lock->exclusive > 0) + else if (self->lock.exclusive > 0) info.state = LOCK_EX; else info.state = LOCK_SH; @@ -259,26 +252,6 @@ repo_lock_info (OstreeRepoLock *lock, OstreeRepoLockInfo *out_info) *out_info = info; } -static void -free_repo_lock (gpointer data) -{ - OstreeRepoLock *lock = data; - - if (lock != NULL) - { - OstreeRepoLockInfo info; - repo_lock_info (lock, &info); - - g_debug ("Free lock: state=%s, depth=%u", info.name, info.len); - if (lock->fd >= 0) - { - g_debug ("Closing repo lock file"); - (void) close (lock->fd); - } - g_free (lock); - } -} - /* Wrapper to handle flock vs OFD locking based on GLnxLockFile */ static gboolean do_repo_lock (int fd, @@ -356,42 +329,29 @@ push_repo_lock (OstreeRepo *self, if (!blocking) flags |= LOCK_NB; - GHashTable *lock_table = g_private_get (&repo_lock_table); - if (lock_table == NULL) - { - g_debug ("Creating repo lock table"); - lock_table = g_hash_table_new_full (NULL, NULL, NULL, - (GDestroyNotify)free_repo_lock); - g_private_set (&repo_lock_table, lock_table); - } + g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->lock.mutex); - OstreeRepoLock *lock = g_hash_table_lookup (lock_table, self); - if (lock == NULL) + if (self->lock.fd == -1) { - lock = g_new0 (OstreeRepoLock, 1); g_debug ("Opening repo lock file"); - lock->fd = TEMP_FAILURE_RETRY (openat (self->repo_dir_fd, ".lock", - O_CREAT | O_RDWR | O_CLOEXEC, - DEFAULT_REGFILE_MODE)); - if (lock->fd < 0) - { - free_repo_lock (lock); - return glnx_throw_errno_prefix (error, - "Opening lock file %s/.lock failed", - gs_file_get_path_cached (self->repodir)); - } - g_hash_table_insert (lock_table, self, lock); + self->lock.fd = TEMP_FAILURE_RETRY (openat (self->repo_dir_fd, ".lock", + O_CREAT | O_RDWR | O_CLOEXEC, + DEFAULT_REGFILE_MODE)); + if (self->lock.fd < 0) + return glnx_throw_errno_prefix (error, + "Opening lock file %s/.lock failed", + gs_file_get_path_cached (self->repodir)); } OstreeRepoLockInfo info; - repo_lock_info (lock, &info); + repo_lock_info (self, locker, &info); g_debug ("Push lock: state=%s, depth=%u", info.name, info.len); guint *counter; if (next_state == LOCK_EX) - counter = &(lock->exclusive); + counter = &(self->lock.exclusive); else - counter = &(lock->shared); + counter = &(self->lock.shared); /* Check for overflow */ g_assert_cmpuint (*counter, <, G_MAXUINT); @@ -407,7 +367,7 @@ push_repo_lock (OstreeRepo *self, const char *next_state_name = lock_state_name (next_state); g_debug ("Locking repo %s", next_state_name); - if (!do_repo_lock (lock->fd, flags)) + if (!do_repo_lock (self->lock.fd, flags)) return glnx_throw_errno_prefix (error, "Locking repo %s failed", next_state_name); } @@ -426,15 +386,11 @@ pop_repo_lock (OstreeRepo *self, { int flags = blocking ? 0 : LOCK_NB; - GHashTable *lock_table = g_private_get (&repo_lock_table); - g_return_val_if_fail (lock_table != NULL, FALSE); - - OstreeRepoLock *lock = g_hash_table_lookup (lock_table, self); - g_return_val_if_fail (lock != NULL, FALSE); - g_return_val_if_fail (lock->fd != -1, FALSE); + g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->lock.mutex); + g_return_val_if_fail (self->lock.fd != -1, FALSE); OstreeRepoLockInfo info; - repo_lock_info (lock, &info); + repo_lock_info (self, locker, &info); g_return_val_if_fail (info.len > 0, FALSE); g_debug ("Pop lock: state=%s, depth=%u", info.name, info.len); @@ -443,12 +399,12 @@ pop_repo_lock (OstreeRepo *self, if (lock_type == OSTREE_REPO_LOCK_EXCLUSIVE) { state_to_drop = LOCK_EX; - counter = &(lock->exclusive); + counter = &(self->lock.exclusive); } else { state_to_drop = LOCK_SH; - counter = &(lock->shared); + counter = &(self->lock.shared); } /* Make sure caller specified a valid type to release */ @@ -461,14 +417,14 @@ pop_repo_lock (OstreeRepo *self, next_state = LOCK_UN; } else if (state_to_drop == LOCK_EX) - next_state = (lock->exclusive > 1) ? LOCK_EX : LOCK_SH; + next_state = (self->lock.exclusive > 1) ? LOCK_EX : LOCK_SH; else - next_state = (lock->exclusive > 0) ? LOCK_EX : LOCK_SH; + next_state = (self->lock.exclusive > 0) ? LOCK_EX : LOCK_SH; if (next_state == LOCK_UN) { g_debug ("Unlocking repo"); - if (!do_repo_unlock (lock->fd, flags)) + if (!do_repo_unlock (self->lock.fd, flags)) return glnx_throw_errno_prefix (error, "Unlocking repo failed"); } else if (info.state == next_state) @@ -480,7 +436,7 @@ pop_repo_lock (OstreeRepo *self, /* We should never drop from shared to exclusive */ g_return_val_if_fail (next_state == LOCK_SH, FALSE); g_debug ("Returning lock state to shared"); - if (!do_repo_lock (lock->fd, next_state | flags)) + if (!do_repo_lock (self->lock.fd, next_state | flags)) return glnx_throw_errno_prefix (error, "Setting repo lock to shared failed"); } @@ -1117,13 +1073,8 @@ ostree_repo_finalize (GObject *object) g_clear_pointer (&self->remotes, g_hash_table_destroy); g_mutex_clear (&self->remotes_lock); - GHashTable *lock_table = g_private_get (&repo_lock_table); - if (lock_table) - { - g_hash_table_remove (lock_table, self); - if (g_hash_table_size (lock_table) == 0) - g_private_replace (&repo_lock_table, NULL); - } + glnx_close_fd (&self->lock.fd); + g_mutex_clear (&self->lock.mutex); G_OBJECT_CLASS (ostree_repo_parent_class)->finalize (object); } @@ -1285,6 +1236,7 @@ ostree_repo_init (OstreeRepo *self) self->test_error_flags = g_parse_debug_string (g_getenv ("OSTREE_REPO_TEST_ERROR"), test_error_keys, G_N_ELEMENTS (test_error_keys)); + g_mutex_init (&self->lock.mutex); g_mutex_init (&self->cache_lock); g_mutex_init (&self->txn_lock); @@ -1298,6 +1250,7 @@ ostree_repo_init (OstreeRepo *self) self->tmp_dir_fd = -1; self->objects_dir_fd = -1; self->uncompressed_objects_dir_fd = -1; + self->lock.fd = -1; self->sysroot_kind = OSTREE_REPO_SYSROOT_KIND_UNKNOWN; } From 89f4ce2c1d3cacccee8129ac54bd60775dbbe5d2 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 6 May 2021 16:49:51 -0600 Subject: [PATCH 26/50] repo: Make locking precondition failures fatal Use `g_error` and `g_assert*` rather than `g_return*` when checking the locking preconditions so that failures result in the program terminating. Since this code is protecting filesystem data, we'd rather crash than delete or corrupt data unexpectedly. `g_error` is used when the error is due to the caller requesting an invalid transition like attempting to pop a lock type that hasn't been taken. It also provides a semi-useful message about what happened. --- src/libostree/ostree-repo.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 73f374e5..8fe3812d 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -354,7 +354,8 @@ push_repo_lock (OstreeRepo *self, counter = &(self->lock.shared); /* Check for overflow */ - g_assert_cmpuint (*counter, <, G_MAXUINT); + if (*counter == G_MAXUINT) + g_error ("Repo lock %s counter would overflow", lock_state_name (next_state)); if (info.state == LOCK_EX || info.state == next_state) { @@ -387,13 +388,16 @@ pop_repo_lock (OstreeRepo *self, int flags = blocking ? 0 : LOCK_NB; g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->lock.mutex); - g_return_val_if_fail (self->lock.fd != -1, FALSE); + if (self->lock.fd == -1) + g_error ("Cannot pop repo never locked repo lock"); OstreeRepoLockInfo info; repo_lock_info (self, locker, &info); - g_return_val_if_fail (info.len > 0, FALSE); g_debug ("Pop lock: state=%s, depth=%u", info.name, info.len); + if (info.len == 0 || info.state == LOCK_UN) + g_error ("Cannot pop already unlocked repo lock"); + int state_to_drop; guint *counter; if (lock_type == OSTREE_REPO_LOCK_EXCLUSIVE) @@ -408,7 +412,9 @@ pop_repo_lock (OstreeRepo *self, } /* Make sure caller specified a valid type to release */ - g_assert_cmpuint (*counter, >, 0); + if (*counter == 0) + g_error ("Repo %s lock pop requested, but none have been taken", + lock_state_name (state_to_drop)); int next_state; if (info.len == 1) @@ -434,7 +440,7 @@ pop_repo_lock (OstreeRepo *self, else { /* We should never drop from shared to exclusive */ - g_return_val_if_fail (next_state == LOCK_SH, FALSE); + g_assert (next_state == LOCK_SH); g_debug ("Returning lock state to shared"); if (!do_repo_lock (self->lock.fd, next_state | flags)) return glnx_throw_errno_prefix (error, From 055b263dee7a26ae085527a3a39d96e68e78a512 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 19 Apr 2021 10:03:57 -0600 Subject: [PATCH 27/50] test-concurrency: Lower lock timeout If there's a locking issue in this test, then it's likely not going to resolve after a few seconds of serializing access. Lower the default 30 second lock timeout to 5 seconds to prevent the test from hanging unnecessarily. --- tests/test-concurrency.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test-concurrency.py b/tests/test-concurrency.py index e4ce21e9..3679ddb6 100755 --- a/tests/test-concurrency.py +++ b/tests/test-concurrency.py @@ -40,11 +40,15 @@ def mktree(dname, serial=0): f.write('{} {} {}\n'.format(dname, serial, v)) subprocess.check_call(['ostree', '--repo=repo', 'init', '--mode=bare']) -# like the bit in libtest, but let's do it unconditionally since it's simpler, -# and we don't need xattr coverage for this with open('repo/config', 'a') as f: + # like the bit in libtest, but let's do it unconditionally since + # it's simpler, and we don't need xattr coverage for this f.write('disable-xattrs=true\n') + # Make any locking errors fail quickly instead of blocking the test + # for 30 seconds. + f.write('lock-timeout-secs=5\n') + def commit(v): tdir='tree{}'.format(v) cmd = ['ostree', '--repo=repo', 'commit', '--fsync=0', '-b', tdir, '--tree=dir='+tdir] From 06bb56be6d0376906433a8e34cb56bca85c39dc5 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 22 Apr 2021 09:10:15 -0600 Subject: [PATCH 28/50] tests: Add single process repo locking tests The semantics of multiple process locking are covered by test-concurrency.py, but the semantics of the repository locking from a single process aren't handled there. This checks how the repository locking is handled from a single thread with one OstreeRepo, a single thread with multiple OstreeRepos, and multiple threads sharing an OstreeRepo. --- tests/test-repo.c | 306 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 306 insertions(+) diff --git a/tests/test-repo.c b/tests/test-repo.c index b388f5bf..0c7e0dd3 100644 --- a/tests/test-repo.c +++ b/tests/test-repo.c @@ -51,6 +51,29 @@ setup (Fixture *fixture, g_test_message ("Using temporary directory: %s", fixture->tmpdir.path); } +/* Common setup for locking tests. Create an archive repo in the tmpdir and + * set the locking timeout to 0 so lock failures don't block. + */ +static void +lock_setup (Fixture *fixture, + gconstpointer test_data) +{ + setup (fixture, test_data); + + 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); + + /* Set the lock timeout to 0 so failures don't block the test */ + g_autoptr(GKeyFile) config = ostree_repo_copy_config (repo); + g_key_file_set_integer (config, "core", "lock-timeout-secs", 0); + ostree_repo_write_config (repo, config, &error); + g_assert_no_error (error); +} + static void teardown (Fixture *fixture, gconstpointer test_data) @@ -273,6 +296,277 @@ test_repo_autolock (Fixture *fixture, g_assert_no_error (error); } +/* Locking from single thread with a single OstreeRepo */ +static void +test_repo_lock_single (Fixture *fixture, + gconstpointer test_data) +{ + g_autoptr(GError) error = NULL; + g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + + /* Single thread on a single repo can freely recurse in any state */ + ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); +} + +/* Unlocking without having ever locked */ +static void +test_repo_lock_unlock_never_locked (Fixture *fixture, + gconstpointer test_data) +{ + if (g_test_subprocess ()) + { + g_autoptr(GError) error = NULL; + g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + + return; + } + + g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*ERROR*Cannot pop repo never locked repo lock\n"); +} + +/* Unlocking after already unlocked */ +static void +test_repo_lock_double_unlock (Fixture *fixture, + gconstpointer test_data) +{ + if (g_test_subprocess ()) + { + g_autoptr(GError) error = NULL; + g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + + ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + + return; + } + + g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*ERROR*Cannot pop already unlocked repo lock\n"); +} + +/* Unlocking the wrong type */ +static void +test_repo_lock_unlock_wrong_type (Fixture *fixture, + gconstpointer test_data) +{ + if (g_test_subprocess ()) + { + g_autoptr(GError) error = NULL; + g_autoptr(OstreeRepo) repo = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + + ostree_repo_lock_push (repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + + return; + } + + g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*ERROR*Repo exclusive lock pop requested, but none have been taken\n"); +} + +/* Locking with single thread and multiple OstreeRepos */ +static void +test_repo_lock_multi_repo (Fixture *fixture, + gconstpointer test_data) +{ + g_autoptr(GError) error = NULL; + + /* Open two OstreeRepo instances */ + g_autoptr(OstreeRepo) repo1 = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + g_autoptr(OstreeRepo) repo2 = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + + /* Single thread with multiple OstreeRepo's conflict */ + ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + ostree_repo_lock_pop (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + + /* Recursive lock should stay exclusive once acquired */ + ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_push (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + ostree_repo_lock_pop (repo1, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + ostree_repo_lock_pop (repo1, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); +} + +/* Locking from multiple threads with a single OstreeRepo */ +typedef struct { + OstreeRepo *repo; + guint step; +} LockThreadData; + +static gpointer +lock_thread1 (gpointer thread_data) +{ + LockThreadData *data = thread_data; + g_autoptr(GError) error = NULL; + + /* Step 0: Take an exclusive lock */ + g_assert_cmpuint (data->step, ==, 0); + g_test_message ("Thread 1: Push exclusive lock"); + ostree_repo_lock_push (data->repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + data->step++; + + /* Step 2: Take a shared lock */ + while (data->step != 2) + g_thread_yield (); + g_test_message ("Thread 1: Push shared lock"); + ostree_repo_lock_push (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + data->step++; + + /* Step 4: Pop both locks */ + while (data->step != 4) + g_thread_yield (); + g_test_message ("Thread 1: Pop shared lock"); + ostree_repo_lock_pop (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + g_test_message ("Thread 1: Pop exclusive lock"); + ostree_repo_lock_pop (data->repo, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + data->step++; + + return NULL; +} + +static gpointer +lock_thread2 (gpointer thread_data) +{ + LockThreadData *data = thread_data; + g_autoptr(GError) error = NULL; + + /* Step 1: Wait for the other thread to acquire a lock and then take a + * shared lock. + */ + while (data->step != 1) + g_thread_yield (); + g_test_message ("Thread 2: Push shared lock"); + ostree_repo_lock_push (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + data->step++; + + /* Step 6: Pop lock */ + while (data->step != 6) + g_thread_yield (); + g_test_message ("Thread 2: Pop shared lock"); + ostree_repo_lock_pop (data->repo, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + data->step++; + + return NULL; +} + +static void +test_repo_lock_multi_thread (Fixture *fixture, + gconstpointer test_data) +{ + g_autoptr(GError) error = NULL; + g_autoptr(OstreeRepo) repo1 = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + g_autoptr(OstreeRepo) repo2 = ostree_repo_open_at (fixture->tmpdir.fd, ".", + NULL, &error); + g_assert_no_error (error); + + LockThreadData thread_data = {repo1, 0}; + GThread *thread1 = g_thread_new ("lock-thread-1", lock_thread1, &thread_data); + GThread *thread2 = g_thread_new ("lock-thread-2", lock_thread2, &thread_data); + + /* Step 3: Try to take a shared lock on repo2. This should fail since + * thread1 still has an exclusive lock. + */ + while (thread_data.step != 3) + g_thread_yield (); + g_test_message ("Repo 2: Push failing shared lock"); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + thread_data.step++; + + /* Step 5: Try to a lock on repo2. A shared lock should succeed since + * thread1 has dropped its exclusive lock. + */ + while (thread_data.step != 5) + g_thread_yield (); + g_test_message ("Repo 2: Push shared lock"); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + g_test_message ("Repo 2: Push failing exclusive lock"); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + thread_data.step++; + + /* Step 7: Now both threads have dropped their locks and taking an exclusive + * lock should succeed. + */ + while (thread_data.step != 7) + g_thread_yield (); + g_test_message ("Repo 2: Push exclusive lock"); + ostree_repo_lock_push (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + g_test_message ("Repo 2: Pop exclusive lock"); + ostree_repo_lock_pop (repo2, OSTREE_REPO_LOCK_EXCLUSIVE, NULL, &error); + g_assert_no_error (error); + g_test_message ("Repo 2: Pop shared lock"); + ostree_repo_lock_pop (repo2, OSTREE_REPO_LOCK_SHARED, NULL, &error); + g_assert_no_error (error); + thread_data.step++; + + g_thread_join (thread1); + g_thread_join (thread2); +} + int main (int argc, char **argv) @@ -292,6 +586,18 @@ main (int argc, test_write_regfile_api, teardown); g_test_add ("/repo/autolock", Fixture, NULL, setup, test_repo_autolock, teardown); + g_test_add ("/repo/lock/single", Fixture, NULL, lock_setup, + test_repo_lock_single, teardown); + g_test_add ("/repo/lock/unlock-never-locked", Fixture, NULL, lock_setup, + test_repo_lock_unlock_never_locked, teardown); + g_test_add ("/repo/lock/double-unlock", Fixture, NULL, lock_setup, + test_repo_lock_double_unlock, teardown); + g_test_add ("/repo/lock/unlock-wrong-type", Fixture, NULL, lock_setup, + test_repo_lock_unlock_wrong_type, teardown); + g_test_add ("/repo/lock/multi-repo", Fixture, NULL, lock_setup, + test_repo_lock_multi_repo, teardown); + g_test_add ("/repo/lock/multi-thread", Fixture, NULL, lock_setup, + test_repo_lock_multi_thread, teardown); return g_test_run (); } From 0cd9dfe815b4c7445a32ea0442fe72c43949ec0c Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 7 Jun 2021 13:14:05 -0600 Subject: [PATCH 29/50] repo: Use g_new for OstreeRepoAutoLock GSlice is effectively deprecated and has little to no advantage over using the system allocator on Linux. --- src/libostree/ostree-repo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 8fe3812d..b90e1c13 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -678,7 +678,7 @@ ostree_repo_auto_lock_push (OstreeRepo *self, if (!ostree_repo_lock_push (self, lock_type, cancellable, error)) return NULL; - OstreeRepoAutoLock *auto_lock = g_slice_new (OstreeRepoAutoLock); + OstreeRepoAutoLock *auto_lock = g_new (OstreeRepoAutoLock, 1); auto_lock->repo = self; auto_lock->lock_type = lock_type; return auto_lock; @@ -707,7 +707,7 @@ ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *auto_lock) errno = errsv; - g_slice_free (OstreeRepoAutoLock, auto_lock); + g_free (auto_lock); } } From edf7477ee9e2c1d238aae35b1a0414e478870837 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 9 Jun 2021 09:44:09 -0400 Subject: [PATCH 30/50] deploy: Warn if we find content in the deployment's /var This will be ignored, so let's make it very clear people are doing something wrong. Motivated by a bug in a build pipeline that injected `/var/lib/rpm` into an ostree commit which ended up crashing rpm-ostree because it was an empty db which it wasn't expecting. It *also* turns out rpm-ostree is incorrectly dumping content in the deployment `/var` today, which is another bug. --- src/libostree/ostree-sysroot-deploy.c | 36 ++++++++++++++++++++++ tests/kolainst/destructive/deployment-lint | 13 ++++++++ 2 files changed, 49 insertions(+) create mode 100755 tests/kolainst/destructive/deployment-lint diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 32748a62..840775d4 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -2632,6 +2632,39 @@ _ostree_deployment_set_bootconfig_from_kargs (OstreeDeployment *deployment, } } +// Perform some basic static analysis and emit warnings for things +// that are likely to fail later. This function only returns +// a hard error if something unexpected (e.g. I/O error) occurs. +static gboolean +lint_deployment_fs (OstreeSysroot *self, + OstreeDeployment *deployment, + int deployment_dfd, + GCancellable *cancellable, + GError **error) +{ + g_auto(GLnxDirFdIterator) dfd_iter = { 0, }; + glnx_autofd int dest_dfd = -1; + gboolean exists; + + if (!ot_dfd_iter_init_allow_noent (deployment_dfd, "var", &dfd_iter, &exists, error)) + return FALSE; + while (exists) + { + struct dirent *dent; + + if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) + return FALSE; + if (dent == NULL) + break; + + fprintf (stderr, "note: Deploying commit %s which contains content in /var/%s that will be ignored.\n", + ostree_deployment_get_csum (deployment), + dent->d_name); + } + + return TRUE; +} + /* The first part of writing a deployment. This primarily means doing the * hardlink farm checkout, but we also compute some initial state. */ @@ -2680,6 +2713,9 @@ sysroot_initialize_deployment (OstreeSysroot *self, cancellable, error)) return FALSE; + if (!lint_deployment_fs (self, new_deployment, deployment_dfd, cancellable, error)) + return FALSE; + ot_transfer_out_value (out_new_deployment, &new_deployment); return TRUE; } diff --git a/tests/kolainst/destructive/deployment-lint b/tests/kolainst/destructive/deployment-lint new file mode 100755 index 00000000..6981ebbc --- /dev/null +++ b/tests/kolainst/destructive/deployment-lint @@ -0,0 +1,13 @@ +#!/bin/bash +set -xeuo pipefail + +. ${KOLA_EXT_DATA}/libinsttest.sh + +require_writable_sysroot +prepare_tmpdir + +mkdir -p rootfs/var/shouldntdothis/subdir +ostree commit -b testlint --no-bindings --selinux-policy-from-base --tree=ref="${host_refspec}" --consume --tree=dir=rootfs +ostree admin deploy testlint 2>err.txt +assert_file_has_content err.txt 'Deploying commit.*which contains content in /var/shouldntdothis' +echo "ok content in /var" From f653545833070eaa852cf31c00acb8d9914f4c49 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 15 Jun 2021 23:02:10 +0200 Subject: [PATCH 31/50] Fix small typo in ostree-sysroot.c --- src/libostree/ostree-sysroot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index b0ae66cf..64018b55 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1063,7 +1063,7 @@ _ostree_sysroot_reload_staged (OstreeSysroot *self, return TRUE; } -/* Loads the current bootversion, subbootversion, and deplyments, starting from the +/* Loads the current bootversion, subbootversion, and deployments, starting from the * bootloader configs which are the source of truth. */ static gboolean From 73e3ccc401829025a9151fddff29d67a0ac2321d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 16 Jun 2021 09:26:24 -0400 Subject: [PATCH 32/50] Use generator to enable ostree-remount.service and ostree-finalize-staged.path We struggled for a long time with enablement of our "internal units", trying to follow the philosophy that units should only be enabled by explicit preset. See https://bugzilla.redhat.com/show_bug.cgi?id=1451458 and https://github.com/coreos/rpm-ostree/pull/1482 etc. And I just saw chat (RH internal on a proprietary system sadly) where someone hit `ostree-remount.service` not being enabled in CentOS8. Thinking about this more, I realized we've shipped a systemd generator for a long time and while its only role until now was to generate `var.mount`, but by using it to force on our internal units, we don't require people to deal with presets anymore. Basically we're inverting things so that "if ostree= is on the kernel cmdline, then enable our units" and not "enable our units, but have them use ConditionKernelCmdline=ostree to skip". Drop the weird gyrations we were doing around `ostree-finalize-staged.path` too; forking `systemctl start` is just asking for bugs. So after this, hopefully we won't ever again have to think about distribution presets and our units. --- configure.ac | 1 + src/libostree/ostree-impl-system-generator.c | 56 +++++++++++++++++--- src/libostree/ostree-sysroot-deploy.c | 22 -------- src/libostree/ostree-sysroot-private.h | 3 +- src/libostree/ostree-sysroot.c | 1 - tests/kolainst/destructive/staged-deploy.sh | 8 +-- 6 files changed, 56 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index f37b9cb3..82b9cf32 100644 --- a/configure.ac +++ b/configure.ac @@ -499,6 +499,7 @@ AS_IF([test "x$with_libsystemd" = "xyes"], [ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) + AC_DEFINE_UNQUOTED([SYSTEM_DATA_UNIT_PATH], ["$with_systemdsystemunitdir"], ["unit path"]) ]) AC_ARG_WITH([systemdsystemgeneratordir], AS_HELP_STRING([--with-systemdsystemgeneratordir=DIR], [Directory for systemd generators]), diff --git a/src/libostree/ostree-impl-system-generator.c b/src/libostree/ostree-impl-system-generator.c index cb9170b3..73da882d 100644 --- a/src/libostree/ostree-impl-system-generator.c +++ b/src/libostree/ostree-impl-system-generator.c @@ -113,13 +113,39 @@ stateroot_from_ostree_cmdline (const char *ostree_cmdline, } #endif -/* Implementation of ostree-system-generator */ -gboolean -_ostree_impl_system_generator (const char *ostree_cmdline, - const char *normal_dir, - const char *early_dir, - const char *late_dir, - GError **error) +/* Forcibly enable our internal units, since we detected ostree= on the kernel cmdline */ +static gboolean +require_internal_units (const char *normal_dir, + const char *early_dir, + const char *late_dir, + GError **error) +{ + GCancellable *cancellable = NULL; + + glnx_autofd int normal_dir_dfd = -1; + if (!glnx_opendirat (AT_FDCWD, normal_dir, TRUE, &normal_dir_dfd, error)) + return FALSE; + + if (!glnx_shutil_mkdir_p_at (normal_dir_dfd, "local-fs.target.requires", 0755, cancellable, error)) + return FALSE; + if (symlinkat (SYSTEM_DATA_UNIT_PATH "/ostree-remount.service", normal_dir_dfd, "local-fs.target.requires/ostree-remount.service") < 0) + return glnx_throw_errno_prefix (error, "symlinkat"); + + if (!glnx_shutil_mkdir_p_at (normal_dir_dfd, "multi-user.target.wants", 0755, cancellable, error)) + return FALSE; + if (symlinkat (SYSTEM_DATA_UNIT_PATH "/ostree-finalize-staged.path", normal_dir_dfd, "multi-user.target.wants/ostree-finalize-staged.path") < 0) + return glnx_throw_errno_prefix (error, "symlinkat"); + + return TRUE; +} + +/* Generate var.mount */ +static gboolean +fstab_generator (const char *ostree_cmdline, + const char *normal_dir, + const char *early_dir, + const char *late_dir, + GError **error) { #ifdef HAVE_LIBMOUNT /* Not currently cancellable, but define a var in case we care later */ @@ -225,3 +251,19 @@ _ostree_impl_system_generator (const char *ostree_cmdline, return glnx_throw (error, "Not implemented"); #endif } + +/* Implementation of ostree-system-generator */ +gboolean +_ostree_impl_system_generator (const char *ostree_cmdline, + const char *normal_dir, + const char *early_dir, + const char *late_dir, + GError **error) +{ + if (!require_internal_units (normal_dir, early_dir, late_dir, error)) + return FALSE; + if (!fstab_generator (ostree_cmdline, normal_dir, early_dir, late_dir, error)) + return FALSE; + + return TRUE; +} diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 840775d4..6a13a41b 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -3106,28 +3106,6 @@ ostree_sysroot_stage_tree_with_options (OstreeSysroot *self, if (booted_deployment == NULL) return glnx_prefix_error (error, "Cannot stage deployment"); - /* This is used by the testsuite to exercise the path unit, until it becomes the default - * (which is pending on the preset making it everywhere). */ - if ((self->debug_flags & OSTREE_SYSROOT_DEBUG_TEST_STAGED_PATH) == 0) - { - /* This is a bit of a hack. When adding a new service we have to end up getting - * into the presets for downstream distros; see e.g. https://src.fedoraproject.org/rpms/ostree/pull-request/7 - * - * Then again, it's perhaps a bit nicer to only start the service on-demand anyways. - */ - const char *const systemctl_argv[] = {"systemctl", "start", "ostree-finalize-staged.service", NULL}; - int estatus; - if (!g_spawn_sync (NULL, (char**)systemctl_argv, NULL, G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, NULL, &estatus, error)) - return FALSE; - if (!g_spawn_check_exit_status (estatus, error)) - return FALSE; - } - else - { - g_print ("test-staged-path: Not running `systemctl start`\n"); - } /* OSTREE_SYSROOT_DEBUG_TEST_STAGED_PATH */ - g_autoptr(OstreeDeployment) deployment = NULL; if (!sysroot_initialize_deployment (self, osname, revision, origin, opts, &deployment, cancellable, error)) diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index 641f0533..bf3ecf32 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -37,8 +37,7 @@ typedef enum { OSTREE_SYSROOT_DEBUG_TEST_FIFREEZE = 1 << 2, /* This is a temporary flag until we fully drop the explicit `systemctl start * ostree-finalize-staged.service` so that tests can exercise the new path unit. */ - OSTREE_SYSROOT_DEBUG_TEST_STAGED_PATH = 1 << 3, - OSTREE_SYSROOT_DEBUG_TEST_NO_DTB = 1 << 4, /* https://github.com/ostreedev/ostree/issues/2154 */ + OSTREE_SYSROOT_DEBUG_TEST_NO_DTB = 1 << 3, /* https://github.com/ostreedev/ostree/issues/2154 */ } OstreeSysrootDebugFlags; typedef enum { diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index b0ae66cf..9d4d64c9 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -190,7 +190,6 @@ ostree_sysroot_init (OstreeSysroot *self) { "mutable-deployments", OSTREE_SYSROOT_DEBUG_MUTABLE_DEPLOYMENTS }, { "test-fifreeze", OSTREE_SYSROOT_DEBUG_TEST_FIFREEZE }, { "no-xattrs", OSTREE_SYSROOT_DEBUG_NO_XATTRS }, - { "test-staged-path", OSTREE_SYSROOT_DEBUG_TEST_STAGED_PATH }, { "no-dtb", OSTREE_SYSROOT_DEBUG_TEST_NO_DTB }, }; diff --git a/tests/kolainst/destructive/staged-deploy.sh b/tests/kolainst/destructive/staged-deploy.sh index 0068ed56..b5d0b319 100755 --- a/tests/kolainst/destructive/staged-deploy.sh +++ b/tests/kolainst/destructive/staged-deploy.sh @@ -8,6 +8,10 @@ prepare_tmpdir case "${AUTOPKGTEST_REBOOT_MARK:-}" in "") + # Test our generator + test -f /run/systemd/generator/multi-user.target.wants/ostree-finalize-staged.path + test -f /run/systemd/generator/local-fs.target.requires/ostree-remount.service + # Initial cleanup to handle the cosa fast-build case ## TODO remove workaround for https://github.com/coreos/rpm-ostree/pull/2021 mkdir -p /var/lib/rpm-ostree/history @@ -19,7 +23,6 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in # Start up path unit systemctl enable --now ostree-finalize-staged.path # Write staged-deploy commit - export OSTREE_SYSROOT_DEBUG="test-staged-path" cd /ostree/repo/tmp # https://github.com/ostreedev/ostree/issues/1569 ostree checkout -H ${commit} t @@ -29,8 +32,7 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in systemctl show -p SubState ostree-finalize-staged.path | grep -q waiting systemctl show -p ActiveState ostree-finalize-staged.service | grep -q inactive systemctl show -p TriggeredBy ostree-finalize-staged.service | grep -q path - ostree admin deploy --stage staged-deploy | tee out.txt - assert_file_has_content out.txt 'test-staged-path: Not running' + ostree admin deploy --stage staged-deploy systemctl show -p SubState ostree-finalize-staged.path | grep running systemctl show -p ActiveState ostree-finalize-staged.service | grep active new_mtime=$(stat -c '%.Y' /sysroot/ostree/deploy) From c934fc8f9904d66c443d784ec3f93209b7b9f1b0 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 26 Nov 2019 09:25:15 +0100 Subject: [PATCH 33/50] libtest-core: Add assert_files_equal [Originally from bubblewrap commits c5c999a7 "tests: test --userns" and 3e5fe1bf "tests: Better error message if assert_files_equal fails"; separated into this commit by Simon McVittie.] --- tests/kolainst/libtest-core.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/kolainst/libtest-core.sh b/tests/kolainst/libtest-core.sh index 64b3e0a3..471a63f0 100644 --- a/tests/kolainst/libtest-core.sh +++ b/tests/kolainst/libtest-core.sh @@ -83,6 +83,18 @@ _fatal_print_file() { fatal "$@" } +_fatal_print_files() { + file1="$1" + shift + file2="$1" + shift + ls -al "$file1" >&2 + sed -e 's/^/# /' < "$file1" >&2 + ls -al "$file2" >&2 + sed -e 's/^/# /' < "$file2" >&2 + fatal "$@" +} + assert_not_has_file () { if test -f "$1"; then _fatal_print_file "$1" "File '$1' exists" @@ -156,6 +168,12 @@ assert_file_empty() { fi } +assert_files_equal() { + if ! cmp "$1" "$2"; then + _fatal_print_files "$1" "$2" "File '$1' and '$2' is not equal" + fi +} + # Use to skip all of these tests skip() { echo "1..0 # SKIP" "$@" From d7cdde5d3445e004c783f86a985d58725f3e6646 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Apr 2021 12:45:24 +0100 Subject: [PATCH 34/50] libtest-core: On failure, make it clearer what has happened If we fail as a result of `set -x`, It's often not completely obvious which command failed or how. Use a trap on ERR to show the command that failed, and its exit status. Signed-off-by: Simon McVittie --- tests/kolainst/libtest-core.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/kolainst/libtest-core.sh b/tests/kolainst/libtest-core.sh index 471a63f0..7179a408 100644 --- a/tests/kolainst/libtest-core.sh +++ b/tests/kolainst/libtest-core.sh @@ -179,3 +179,11 @@ skip() { echo "1..0 # SKIP" "$@" exit 0 } + +report_err () { + local exit_status="$?" + { { local BASH_XTRACEFD=3; } 2> /dev/null + echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2 + } 3> /dev/null +} +trap report_err ERR From c0157f96b2c797c35391f1c50fab5659259be925 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 18 Jun 2021 10:13:36 +0100 Subject: [PATCH 35/50] libtest-core: Update URL of rpm-ostree Signed-off-by: Simon McVittie --- tests/kolainst/libtest-core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kolainst/libtest-core.sh b/tests/kolainst/libtest-core.sh index 7179a408..8d1f36c6 100644 --- a/tests/kolainst/libtest-core.sh +++ b/tests/kolainst/libtest-core.sh @@ -5,7 +5,7 @@ # # Known copies are in the following repos: # -# - https://github.com/projectatomic/rpm-ostree +# - https://github.com/coreos/rpm-ostree # # Copyright (C) 2017 Colin Walters # From 14d6e757520c853cd14ada5a4d0a084ddf400f51 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 18 Jun 2021 10:14:01 +0100 Subject: [PATCH 36/50] libtest-core: Mention bubblewrap as a user of this file Signed-off-by: Simon McVittie --- tests/kolainst/libtest-core.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/kolainst/libtest-core.sh b/tests/kolainst/libtest-core.sh index 8d1f36c6..9632e905 100644 --- a/tests/kolainst/libtest-core.sh +++ b/tests/kolainst/libtest-core.sh @@ -5,6 +5,7 @@ # # Known copies are in the following repos: # +# - https://github.com/containers/bubblewrap # - https://github.com/coreos/rpm-ostree # # Copyright (C) 2017 Colin Walters From d9ef76a598ca66fba04b4a1de87e20ebf41ebcf2 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 18 Jun 2021 12:35:41 -0600 Subject: [PATCH 37/50] Don't fail build when systemd unit path not defined In configure the systemd unit path is optional, but in the code it's assumed to be defined. Add an `#ifdef` that throws an error when it's not defined like the handling of `HAVE_LIBMOUNT` below it. --- src/libostree/ostree-impl-system-generator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libostree/ostree-impl-system-generator.c b/src/libostree/ostree-impl-system-generator.c index 73da882d..b5a7cde2 100644 --- a/src/libostree/ostree-impl-system-generator.c +++ b/src/libostree/ostree-impl-system-generator.c @@ -120,6 +120,7 @@ require_internal_units (const char *normal_dir, const char *late_dir, GError **error) { +#ifdef SYSTEM_DATA_UNIT_PATH GCancellable *cancellable = NULL; glnx_autofd int normal_dir_dfd = -1; @@ -137,6 +138,9 @@ require_internal_units (const char *normal_dir, return glnx_throw_errno_prefix (error, "symlinkat"); return TRUE; +#else + return glnx_throw (error, "Not implemented"); +#endif } /* Generate var.mount */ From 9ff141fe80f145862c947c3a25d9367c01ebe43c Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 18 Jun 2021 11:00:16 -0600 Subject: [PATCH 38/50] ci: Rename GitHub Actions rust workflow metadata file This workflow is specific to using rust and not just the general test suite. --- .github/workflows/{tests.yml => rust.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{tests.yml => rust.yml} (100%) diff --git a/.github/workflows/tests.yml b/.github/workflows/rust.yml similarity index 100% rename from .github/workflows/tests.yml rename to .github/workflows/rust.yml From a0012ae0eea82d47a83b44a938d621535b7bc2da Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 18 Jun 2021 11:33:56 -0600 Subject: [PATCH 39/50] ci: Add GitHub Actions workflow for test suite This runs the test suite in various distros. The intention is to use this to replace the Travis CI setup since it often has rate limit failures. Each configuration in the matrix runs in a Docker container, installs system dependencies and then builds and tests ostree. The scripts are basically copy and paste of the travis ones with some of the lesser used features pruned out. Some differences from the travis setup: * OS details are gathered from `/etc/os-release` instead of being passed in as environment variables. * The scripts always assume the user is root and don't try to use `sudo`. * The `installcheck` test has been removed since ostree doesn't actually use that. It could be added to run the installed tests or `gnome-desktop-testing-runner` could just be called directly. There should be enough flexibility to run other distros like Fedora, Arch or Alpine. Another option would be to use the other build scripts in ci/. --- .github/workflows/tests.yml | 106 ++++++++++++++++++++++++++++++++++++ ci/gh-build.sh | 62 +++++++++++++++++++++ ci/gh-install.sh | 84 ++++++++++++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100755 ci/gh-build.sh create mode 100755 ci/gh-install.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..436dfbe9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,106 @@ +--- +name: Tests +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + tests: + # Distro configuration matrix + # + # Each build is run in a Docker container specific to the distro. + # When adding a new distro, handle the dependency installation in + # `ci/gh-install.sh`. The matrix configuration options are: + # + # name: A friendly name to use for the job. + # + # image: The Docker image to use. + # + # pre-checkout-setup: Commands to run before the git repo checkout. + # If git is not in the Docker image, it must be installed here. + # Otherwise, the checkout action uses the GitHub REST API, which + # doesn't result in an actual git repo. A real git repo is + # required to checkout the submodules. + # + # extra-packages: Packages to install in addition to those in + # `ci/gh-install.sh`. This can be used to support features from + # additional `configure` options. + # + # configure-options: Options to pass to `configure`. + strategy: + matrix: + include: + - name: Debian Buster (10) with sign-ed25519 + image: debian:buster-slim + pre-checkout-setup: | + apt-get update + apt-get install -y git + extra-packages: >- + libsodium-dev + configure-options: >- + --with-ed25519-libsodium + + - name: Debian Buster (10) with curl, sign-ed25519 and no gpgme + image: debian:buster-slim + pre-checkout-setup: | + apt-get update + apt-get install -y git + extra-packages: >- + libsodium-dev + configure-options: >- + --with-curl + --with-ed25519-libsodium + --without-gpgme + + # A 32 bit build to act as a proxy for frequently deployed 32 + # bit armv7 + - name: Debian Buster (10) 32 bit + image: i386/debian:buster-slim + # This is pretty nasty. The checkout action uses an x86_64 + # node binary in the container, so we need to provide an + # x86_64 ld.so and libstdc++. + pre-checkout-setup: | + dpkg --add-architecture amd64 + apt-get update + apt-get install -y git libc6:amd64 libstdc++6:amd64 + + - name: Ubuntu Focal (20.04) + image: ubuntu:focal + pre-checkout-setup: | + apt-get update + apt-get install -y git + + - name: Ubuntu Groovy (20.10) + image: ubuntu:groovy + pre-checkout-setup: | + apt-get update + apt-get install -y git + + name: ${{ matrix.name }} + runs-on: ubuntu-latest + container: + image: ${{ matrix.image }} + + steps: + - name: Pre-checkout setup + run: ${{ matrix.pre-checkout-setup }} + if: ${{ matrix.pre-checkout-setup }} + + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install dependencies + run: ./ci/gh-install.sh ${{ matrix.extra-packages }} + + - name: Build and test + run: ./ci/gh-build.sh ${{ matrix.configure-options }} + env: + # GitHub hosted runners currently have 2 CPUs, so run 2 + # parallel make jobs. + # + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + MAKEFLAGS: -j2 diff --git a/ci/gh-build.sh b/ci/gh-build.sh new file mode 100755 index 00000000..949ce5fa --- /dev/null +++ b/ci/gh-build.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Copyright © 2015-2016 Collabora Ltd. +# Copyright © 2021 Endless OS Foundation LLC +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set -euo pipefail +set -x + +NOCONFIGURE=1 ./autogen.sh + +srcdir="$(pwd)" +mkdir ci-build +cd ci-build + +make="make V=1 VERBOSE=1" + +../configure \ + --enable-always-build-tests \ + "$@" + +${make} + +# Run the tests both using check and distcheck and dump the logs on +# failures. For distcheck the logs will be inside the dist directory, so +# tell make to use the current directory. +if ! ${make} check; then + cat test-suite.log || : + exit 1 +fi +if ! ${make} distcheck \ + TEST_SUITE_LOG=$(pwd)/test-suite.log \ + DISTCHECK_CONFIGURE_FLAGS="$*" +then + cat test-suite.log || : + exit 1 +fi + +# Show the installed files +${make} install DESTDIR=$(pwd)/DESTDIR +( cd DESTDIR && find . ) + +# vim:set sw=4 sts=4 et: diff --git a/ci/gh-install.sh b/ci/gh-install.sh new file mode 100755 index 00000000..dc0c7fde --- /dev/null +++ b/ci/gh-install.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# Copyright © 2015-2016 Collabora Ltd. +# Copyright © 2021 Endless OS Foundation LLC +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set -euo pipefail +set -x + +NULL= + +# Get the OS release info +. /etc/os-release + +case "$ID" 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? + apt-get -y update + apt-get -y install \ + 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 \ + libcurl4-openssl-dev \ + libfuse-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + libgpgme11-dev \ + liblzma-dev \ + libmount-dev \ + libselinux1-dev \ + libsoup2.4-dev \ + libsystemd-dev \ + procps \ + python3-yaml \ + systemd \ + zlib1g-dev \ + "$@" + ;; + + (*) + echo "Don't know how to set up ${ID}" >&2 + exit 1 + ;; +esac + +# vim:set sw=4 sts=4 et: From 00f7c88a2dce019b9e6f06f31c9e64793f7efe57 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 18 Jun 2021 15:22:39 -0600 Subject: [PATCH 40/50] ci: So long, Travis CI travis-ci.org stopped running builds on June 15, 2021. Since this organization is very unlikely to switch to travis-ci.com, just drop the setup. The new GitHub Actions tests completely replace it. --- .travis.yml | 18 ----- ci/travis-Dockerfile.in | 10 --- ci/travis-build.sh | 110 ------------------------------- ci/travis-install.sh | 141 ---------------------------------------- 4 files changed, 279 deletions(-) delete mode 100644 .travis.yml delete mode 100644 ci/travis-Dockerfile.in delete mode 100755 ci/travis-build.sh delete mode 100755 ci/travis-install.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10d8e4bf..00000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: c -sudo: required - -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 - -script: - - ci/travis-install.sh - - ci_parallel=2 ci_sudo=yes ci/travis-build.sh - -notifications: - email: false diff --git a/ci/travis-Dockerfile.in b/ci/travis-Dockerfile.in deleted file mode 100644 index 9e47876e..00000000 --- a/ci/travis-Dockerfile.in +++ /dev/null @@ -1,10 +0,0 @@ -FROM @ci_docker@ -ENV container docker - -ADD ci/travis-install.sh /travis-install.sh -RUN ci_suite="@ci_suite@" ci_distro="@ci_distro@" ci_pkgs="@ci_pkgs@" ci_in_docker=yes /travis-install.sh - -ADD . /home/user/ostree -RUN chown -R user:user /home/user/ostree -WORKDIR /home/user/ostree -USER user diff --git a/ci/travis-build.sh b/ci/travis-build.sh deleted file mode 100755 index e31da81f..00000000 --- a/ci/travis-build.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -# Copyright © 2015-2016 Collabora Ltd. -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -set -euo pipefail -set -x - -NULL= - -# ci_docker: -# If non-empty, this is the name of a Docker image. travis-install.sh will -# fetch it with "docker pull" and use it as a base for a new Docker image -# named "ci-image" in which we will do our testing. -# -# If empty, we test on "bare metal". -# Typical values: ubuntu:xenial, debian:jessie-slim -: "${ci_docker:=}" - -# ci_parallel: -# A number of parallel jobs, passed to make -j -: "${ci_parallel:=1}" - -# ci_sudo: -# If yes, assume we can get root using sudo; if no, only use current user -: "${ci_sudo:=no}" - -# ci_test: -# If yes, run tests; if no, just build -: "${ci_test:=yes}" - -# ci_test_fatal: -# If yes, test failures break the build; if no, they are reported but ignored -: "${ci_test_fatal:=yes}" - -# ci_configopts: -# Additional args for configure -: "${ci_configopts:=}" - -if [ -n "$ci_docker" ]; then - exec docker run \ - --env=ci_docker="" \ - --env=ci_parallel="${ci_parallel}" \ - --env=ci_sudo=yes \ - --env=ci_test="${ci_test}" \ - --env=ci_test_fatal="${ci_test_fatal}" \ - --env=ci_configopts="${ci_configopts}" \ - --privileged \ - ci-image \ - ci/travis-build.sh -fi - -maybe_fail_tests () { - if [ "$ci_test_fatal" = yes ]; then - exit 1 - fi -} - -NOCONFIGURE=1 ./autogen.sh - -srcdir="$(pwd)" -mkdir ci-build -cd ci-build - -make="make -j${ci_parallel} V=1 VERBOSE=1" - -../configure \ - --enable-always-build-tests \ - ${ci_configopts} \ - "$@" - -${make} -[ "$ci_test" = no ] || ${make} check || maybe_fail_tests -cat test-suite.log || : -[ "$ci_test" = no ] || ${make} distcheck DISTCHECK_CONFIGURE_FLAGS="${ci_configopts}" || maybe_fail_tests -cat test-suite.log || : - -${make} install DESTDIR=$(pwd)/DESTDIR -( cd DESTDIR && find . ) - -if [ "$ci_sudo" = yes ] && [ "$ci_test" = yes ]; then - sudo ${make} install - env \ - LD_LIBRARY_PATH=/usr/local/lib \ - GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0 \ - ${make} installcheck || \ - maybe_fail_tests - cat test-suite.log || : -fi - -# vim:set sw=4 sts=4 et: diff --git a/ci/travis-install.sh b/ci/travis-install.sh deleted file mode 100755 index b40f4c55..00000000 --- a/ci/travis-install.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -# Copyright © 2015-2016 Collabora Ltd. -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -set -euo pipefail -set -x - -NULL= - -# ci_distro: -# OS distribution in which we are testing -# Typical values: ubuntu, debian; maybe fedora in future -: "${ci_distro:=debian}" - -# ci_docker: -# If non-empty, this is the name of a Docker image. travis-install.sh will -# fetch it with "docker pull" and use it as a base for a new Docker image -# named "ci-image" in which we will do our testing. -: "${ci_docker:=}" - -# ci_in_docker: -# Used internally by travis-install.sh. If yes, we are inside the Docker image -# (ci_docker is empty in this case). -: "${ci_in_docker:=no}" - -# ci_suite: -# OS suite (release, branch) in which we are testing. -# Typical values for ci_distro=ubuntu: xenial, trusty -# Typical values for ci_distro=debian: sid, jessie -# Typical values for ci_distro=fedora might be 25, rawhide -: "${ci_suite:=stretch}" - -# ci_configopts: Additional arguments for configure -: "${ci_configopts:=}" - -# ci_pkgs: Additional packages to be installed -: "${ci_pkgs:=}" - -if [ $(id -u) = 0 ]; then - sudo= -else - sudo=sudo -fi - -if [ -n "$ci_docker" ]; then - sed \ - -e "s,@ci_distro@,${ci_distro}," \ - -e "s,@ci_docker@,${ci_docker}," \ - -e "s,@ci_suite@,${ci_suite}," \ - -e "s,@ci_pkgs@,${ci_pkgs}," \ - < ci/travis-Dockerfile.in > Dockerfile - exec docker build -t ci-image . -fi - -case "$ci_distro" in - (debian) - # Docker images use httpredir.debian.org but it seems to be - # unreliable; use a CDN instead - sed -i -e 's/httpredir\.debian\.org/deb.debian.org/g' /etc/apt/sources.list - ;; -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 \ - 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 \ - ${ci_pkgs:-} \ - ${NULL} - - if [ "$ci_in_docker" = yes ]; then - # Add the user that we will use to do the build inside the - # Docker container, and let them use sudo - adduser --disabled-password user /etc/sudoers.d/nopasswd - chmod 0440 /etc/sudoers.d/nopasswd - fi - ;; - - (*) - echo "Don't know how to set up ${ci_distro}" >&2 - exit 1 - ;; -esac - -# vim:set sw=4 sts=4 et: From f1b900340f04e1555ed9fd5ef7776bffbbff14a7 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 21 Jun 2021 11:55:59 -0600 Subject: [PATCH 41/50] ci: Disable fail-fast in GitHub Tests workflow Don't cancel all the jobs if one distro config fails. The jobs are mostly independent, so we do want to let the others continue in case the failure is isolated to that particular distro configuration. --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 436dfbe9..70af9d3b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,6 +30,9 @@ jobs: # # configure-options: Options to pass to `configure`. strategy: + # Let other configurations continue if one fails. + fail-fast: false + matrix: include: - name: Debian Buster (10) with sign-ed25519 From 156ec07f01f04b878a278a8bc8259ac0b303979f Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 21 Jun 2021 13:42:20 -0600 Subject: [PATCH 42/50] ci: Drop special handling of test-suite.log The automake test harness[1] already dumps the contents of `test-suite.log` when `VERBOSE=1` is set, so we don't need to add special handling for it. 1. https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html --- ci/gh-build.sh | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ci/gh-build.sh b/ci/gh-build.sh index 949ce5fa..11434327 100755 --- a/ci/gh-build.sh +++ b/ci/gh-build.sh @@ -32,6 +32,8 @@ srcdir="$(pwd)" mkdir ci-build cd ci-build +# V=1 shows the full build commands. VERBOSE=1 dumps test-suite.log on +# failures. make="make V=1 VERBOSE=1" ../configure \ @@ -40,20 +42,9 @@ make="make V=1 VERBOSE=1" ${make} -# Run the tests both using check and distcheck and dump the logs on -# failures. For distcheck the logs will be inside the dist directory, so -# tell make to use the current directory. -if ! ${make} check; then - cat test-suite.log || : - exit 1 -fi -if ! ${make} distcheck \ - TEST_SUITE_LOG=$(pwd)/test-suite.log \ - DISTCHECK_CONFIGURE_FLAGS="$*" -then - cat test-suite.log || : - exit 1 -fi +# Run the tests both using check and distcheck. +${make} check +${make} distcheck DISTCHECK_CONFIGURE_FLAGS="$*" # Show the installed files ${make} install DESTDIR=$(pwd)/DESTDIR From 410b46f09de34b61bb6e0e2b33db58c4568e2054 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 21 Jun 2021 11:40:07 -0600 Subject: [PATCH 43/50] ci: Update Debian and Ubuntu build dependencies This refreshes the build dependencies installed for the GitHub Tests workflow based on the Build-Depends in the upstream packaging. The handling is now more explicit about any deviations and any release differences. --- ci/gh-install.sh | 127 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 91 insertions(+), 36 deletions(-) diff --git a/ci/gh-install.sh b/ci/gh-install.sh index dc0c7fde..25f451a0 100755 --- a/ci/gh-install.sh +++ b/ci/gh-install.sh @@ -26,8 +26,6 @@ set -euo pipefail set -x -NULL= - # Get the OS release info . /etc/os-release @@ -37,42 +35,99 @@ case "$ID" in # be answered. export DEBIAN_FRONTEND=noninteractive + # Debian upstream data: + # https://tracker.debian.org/pkg/ostree + # https://salsa.debian.org/debian/ostree + # https://salsa.debian.org/debian/ostree/-/blob/debian/master/debian/control + # + # Ubuntu package data: + # https://packages.ubuntu.com/source/impish/ostree + # # TODO: fetch this list from the Debian packaging git repository? + + # First construct a list of Build-Depends common to all + # versions. This includes build-essential, which is assumed to + # be installed on all Debian builders. We also add gjs to allow + # the JS tests to run even though gjs is explicitly disable in + # Debian. + PACKAGES=( + attr + autoconf + automake + bison + build-essential + ca-certificates + cpio + debhelper + dh-exec + docbook-xml + docbook-xsl + e2fslibs-dev + elfutils + fuse + gnupg + gobject-introspection + gtk-doc-tools + libarchive-dev + libattr1-dev + libavahi-client-dev + libavahi-glib-dev + libcap-dev + libfuse-dev + libgirepository1.0-dev + libglib2.0-dev + libglib2.0-doc + libgpgme-dev + liblzma-dev + libmount-dev + libselinux1-dev + libsoup2.4-dev + libsystemd-dev + libtool + procps + python3 + python3-yaml + xsltproc + zlib1g-dev + ) + + # Additional common packages: + # + # gjs - To allow running JS tests even though this has been + # disabled in Debian for a while. + # + # gnome-desktop-testing - To eventually allow running the + # installed tests. + # + # libcurl4-openssl-dev - To allow building the cURL fetch + # backend in addition to the soup fetch backend. + # + # systemd - To get the unit and generator paths from systemd.pc + # rather than passing them as configure options. + PACKAGES+=( + gjs + gnome-desktop-testing + libcurl4-openssl-dev + systemd + ) + + # Distro specific packages. Matching is on VERSION_CODENAME from + # /etc/os-release. Debian testing and unstable may not have this + # set, so assume an empty or unset value represents those. + + # hexdump was previously provided by bsdmainutils but is now in + # bsdextrautils. + case "${VERSION_CODENAME:-}" in + (buster|focal|bionic) + PACKAGES+=(bsdmainutils) + ;; + (*) + PACKAGES+=(bsdextrautils) + ;; + esac + apt-get -y update - apt-get -y install \ - 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 \ - libcurl4-openssl-dev \ - libfuse-dev \ - libgirepository1.0-dev \ - libglib2.0-dev \ - libgpgme11-dev \ - liblzma-dev \ - libmount-dev \ - libselinux1-dev \ - libsoup2.4-dev \ - libsystemd-dev \ - procps \ - python3-yaml \ - systemd \ - zlib1g-dev \ - "$@" + apt-get -y install "${PACKAGES[@]}" "$@" ;; (*) From dfe3bdc13f7e8576806042a0aeb65c2aaeaba5ab Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 21 Jun 2021 10:56:53 -0600 Subject: [PATCH 44/50] ci: Use Debian and Ubuntu release stage tags Rather than use the release codename tags, use the release stage tags. This way the configuration (theoretically) doesn't need to be updated when new Debian and Ubuntu releases are made. For Debian stable is used instead of buster and a testing (bullseye) build is added. For Ubuntu, latest is used instead of focal for the current LTS and rolling is used instead of groovy for the latest release. This actually changes the Ubuntu build from groovy to hirsute. --- .github/workflows/tests.yml | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 70af9d3b..45626be2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,8 +35,13 @@ jobs: matrix: include: - - name: Debian Buster (10) with sign-ed25519 - image: debian:buster-slim + # Debian builds. Currently stable and testing are tested. + # Other options would be stable-backports, oldstable, + # oldstable-backports and unstable. + # + # https://hub.docker.com/_/debian + - name: Debian Stable with sign-ed25519 + image: debian:stable-slim pre-checkout-setup: | apt-get update apt-get install -y git @@ -45,8 +50,8 @@ jobs: configure-options: >- --with-ed25519-libsodium - - name: Debian Buster (10) with curl, sign-ed25519 and no gpgme - image: debian:buster-slim + - name: Debian Stable with curl, sign-ed25519 and no gpgme + image: debian:stable-slim pre-checkout-setup: | apt-get update apt-get install -y git @@ -59,8 +64,8 @@ jobs: # A 32 bit build to act as a proxy for frequently deployed 32 # bit armv7 - - name: Debian Buster (10) 32 bit - image: i386/debian:buster-slim + - name: Debian Stable 32 bit + image: i386/debian:stable-slim # This is pretty nasty. The checkout action uses an x86_64 # node binary in the container, so we need to provide an # x86_64 ld.so and libstdc++. @@ -69,14 +74,26 @@ jobs: apt-get update apt-get install -y git libc6:amd64 libstdc++6:amd64 - - name: Ubuntu Focal (20.04) - image: ubuntu:focal + - name: Debian Testing + image: debian:testing-slim pre-checkout-setup: | apt-get update apt-get install -y git - - name: Ubuntu Groovy (20.10) - image: ubuntu:groovy + # Ubuntu builds. Unfortunately, when the latest release is + # also the latest LTS, latest and rolling are the same. Other + # options would be to test the previous LTS by name or to test + # the devel tag, which is the unreleased version. + # + # https://hub.docker.com/_/ubuntu + - name: Ubuntu Latest LTS + image: ubuntu:latest + pre-checkout-setup: | + apt-get update + apt-get install -y git + + - name: Ubuntu Latest Release + image: ubuntu:rolling pre-checkout-setup: | apt-get update apt-get install -y git From 3cc4f8710f377c2f61d05c818c4bcc372e532c89 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 22 Jun 2021 10:37:39 +0100 Subject: [PATCH 45/50] libtest.sh: Remove duplicate ERR trap and report_err() Since #2377 was merged, this is in libtest-core.sh, which is sourced by libtest.sh. Signed-off-by: Simon McVittie --- tests/libtest.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/libtest.sh b/tests/libtest.sh index bf34cd5e..260b8d1d 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -46,14 +46,6 @@ run_exit_cmds() { } trap run_exit_cmds EXIT -report_err () { - local exit_status="$?" - { { local BASH_XTRACEFD=3; } 2> /dev/null - echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2 - } 3> /dev/null -} -trap report_err ERR - save_core() { if [ -e core ]; then cp core "$test_srcdir/core" From 70a8f56ce134a718b9b09a7ca14de7513865e516 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Tue, 22 Jun 2021 10:42:36 +0000 Subject: [PATCH 46/50] lib/commit: respect SOURCE_DATE_EPOCH for commit timestamp This tweaks `ostree_repo_write_commit` so that it checks for the envinroment variable `SOURCE_DATE_EPOCH` as a way to override the current time, which is used as the commit timestamp. Ref: https://reproducible-builds.org/docs/source-date-epoch/ Ref: https://reproducible-builds.org/specs/source-date-epoch/ --- Makefile-tests.am | 1 + src/libostree/ostree-repo-commit.c | 25 +++++++++++++++-- tests/test-commit-timestamp.sh | 45 ++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100755 tests/test-commit-timestamp.sh diff --git a/Makefile-tests.am b/Makefile-tests.am index c99a7ede..295c734e 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -69,6 +69,7 @@ _installed_or_uninstalled_test_scripts = \ tests/test-remote-add.sh \ tests/test-remote-headers.sh \ tests/test-commit-sign.sh \ + tests/test-commit-timestamp.sh \ tests/test-export.sh \ tests/test-help.sh \ tests/test-libarchive.sh \ diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index ffd8319f..c07526fc 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -3020,6 +3020,10 @@ create_empty_gvariant_dict (void) * * Write a commit metadata object, referencing @root_contents_checksum * and @root_metadata_checksum. + * This uses the current time as the commit timestamp, but it can be + * overridden with an explicit timestamp via the + * [standard](https://reproducible-builds.org/specs/source-date-epoch/) + * `SOURCE_DATE_EPOCH` environment flag. */ gboolean ostree_repo_write_commit (OstreeRepo *self, @@ -3032,9 +3036,26 @@ ostree_repo_write_commit (OstreeRepo *self, GCancellable *cancellable, GError **error) { - g_autoptr(GDateTime) now = g_date_time_new_now_utc (); + gint64 timestamp = 0; + const gchar *env_timestamp = g_getenv ("SOURCE_DATE_EPOCH"); + if (env_timestamp == NULL) + { + g_autoptr(GDateTime) now = g_date_time_new_now_utc (); + timestamp = g_date_time_to_unix (now); + } + else + { + gchar *ret = NULL; + errno = 0; + timestamp = g_ascii_strtoll (env_timestamp, &ret, 10); + if (errno != 0) + return glnx_throw_errno_prefix (error, "Parsing SOURCE_DATE_EPOCH"); + if (ret == env_timestamp) + return glnx_throw (error, "Failed to convert SOURCE_DATE_EPOCH"); + } + return ostree_repo_write_commit_with_time (self, parent, subject, body, - metadata, root, g_date_time_to_unix (now), + metadata, root, timestamp, out_commit, cancellable, error); } diff --git a/tests/test-commit-timestamp.sh b/tests/test-commit-timestamp.sh new file mode 100755 index 00000000..7dbdbdfc --- /dev/null +++ b/tests/test-commit-timestamp.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: LGPL-2.0+ + +set -euo pipefail + +. $(dirname $0)/libtest.sh +TZ='UTC' +LANG='C' + +echo "1..2" + +# Explicit timestamp via CLI flag. +mkdir testrepo +ostree_repo_init testrepo --mode="archive" +mkdir testrepo-files +cd testrepo-files +echo first > firstfile +cd .. +${CMD_PREFIX} ostree --repo=./testrepo commit -b cli --timestamp='@1234567890' -s "cli timestamp" +${CMD_PREFIX} ostree --repo=./testrepo show cli > show-cli.txt +rm -rf testrepo testrepo-files +assert_file_has_content_literal show-cli.txt 'Date: 2009-02-13 23:31:30 +0000' +echo "ok commit with CLI timestamp" + +# Reproducible timestamp via env flag. +mkdir testrepo +ostree_repo_init testrepo --mode="archive" +mkdir testrepo-files +cd testrepo-files +echo first > firstfile +cd .. +${CMD_PREFIX} SOURCE_DATE_EPOCH='1234567890' ostree --repo=./testrepo commit -b env -s "env timestamp" +if (${CMD_PREFIX} SOURCE_DATE_EPOCH='invalid' ostree --repo=./testrepo commit -b env -s "invalid timestamp") 2> commit-invalid.txt; then + assert_not_reached "commit with invalid timestamp succeeded" +fi +if (${CMD_PREFIX} SOURCE_DATE_EPOCH='12345678901234567890' ostree --repo=./testrepo commit -b env -s "overflowing timestamp") 2> commit-overflowing.txt; then + assert_not_reached "commit with overflowing timestamp succeeded" +fi +${CMD_PREFIX} ostree --repo=./testrepo show env > show-env.txt +rm -rf testrepo testrepo-files +assert_file_has_content_literal commit-invalid.txt 'Failed to convert SOURCE_DATE_EPOCH' +assert_file_has_content_literal commit-overflowing.txt 'Parsing SOURCE_DATE_EPOCH: Numerical result out of range' +assert_file_has_content_literal show-env.txt 'Date: 2009-02-13 23:31:30 +0000' +echo "ok commit with env timestamp" From 301b52704edcc894d071af3bbc53157912f66014 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 22 Jun 2021 11:18:48 -0400 Subject: [PATCH 47/50] ostree-remount: Order before systemd-rfkill.* The `systemd-rfkill.*` service falls in the category of early things that need write access to `/var`, so we need to make sure we run before or it might hit the read-only sysroot. The long-term fix for this is https://github.com/ostreedev/ostree/issues/2115. Closes: https://github.com/coreos/fedora-coreos-tracker/issues/746 --- src/boot/ostree-remount.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boot/ostree-remount.service b/src/boot/ostree-remount.service index af40453c..a54114f9 100644 --- a/src/boot/ostree-remount.service +++ b/src/boot/ostree-remount.service @@ -28,7 +28,7 @@ After=systemd-remount-fs.service # But we run *before* most other core bootup services that need write access to /etc and /var Before=local-fs.target umount.target Before=systemd-random-seed.service plymouth-read-write.service systemd-journal-flush.service -Before=systemd-tmpfiles-setup.service +Before=systemd-tmpfiles-setup.service systemd-rfkill.service systemd-rfkill.socket [Service] Type=oneshot From d6ad11461441a463d5f99fe4fa6c76d407446a1e Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 2 Jul 2021 17:47:33 -0400 Subject: [PATCH 48/50] OWNERS: remove Prow is not managing merges on this repo. --- OWNERS | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 OWNERS diff --git a/OWNERS b/OWNERS deleted file mode 100644 index 4e8de5f5..00000000 --- a/OWNERS +++ /dev/null @@ -1,18 +0,0 @@ -# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md - -# Keep these lists in alphabetical order (just to avoid ordering implying anything) -# Changes to this list can be done via regular pull requests. A generally good -# approach can be to just start reviewing pull requests - if you do that enough -# and understand the libostree code base, feel free to submit a PR to add -# yourself to one of these lists. -# Use the responsibility to merge carefully. -approvers: - - cgwalters - - jlebon - - pwithnall - - wmanley -reviewers: - - lucab - - mwleeds - - rfairley - - d4s From d573b8dc2f8eb11068e40d93aa54c9794bfce6bb Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 9 Jul 2021 16:17:31 +0000 Subject: [PATCH 49/50] ci/release-build: evaluate package_version from m4 definition This fixes the ci-release-build.sh script to directly source and evaluate 'package_version' from its m4 definition, without requiring a fully configured source tree. --- ci/ci-release-build.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ci/ci-release-build.sh b/ci/ci-release-build.sh index e7e7f111..ca60a4a3 100755 --- a/ci/ci-release-build.sh +++ b/ci/ci-release-build.sh @@ -10,14 +10,26 @@ set -euo pipefail HEAD=${PAPR_COMMIT:-HEAD} git log --format=%B -n 1 $HEAD > log.txt -trap "rm -f log.txt" EXIT +trap "rm -f version.m4 log.txt" EXIT if grep -q ^is_release_build=yes configure.ac; then echo "*** is_release_build is set to yes ***" - V=$(grep -Po '^#define PACKAGE_VERSION "\K[0-9]+\.[0-9]+(?=")' config.h) + # assemble a short m4 macro file to evaluate 'package_version' + cat > version.m4 <> version.m4 + + cat >> version.m4 < Date: Mon, 12 Jul 2021 08:38:38 +0000 Subject: [PATCH 50/50] Release 2021.3 --- Makefile-libostree.am | 6 +++--- configure.ac | 2 +- src/libostree/libostree-devel.sym | 8 -------- src/libostree/libostree-released.sym | 8 ++++++++ tests/test-symbols.sh | 2 +- 5 files changed, 13 insertions(+), 13 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 82b9cf32..c3f700ad 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ m4_define([year_version], [2021]) m4_define([release_version], [3]) 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/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 1af5f449..e3cd14a4 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -22,14 +22,6 @@ - uncomment the include in Makefile-libostree.am */ -LIBOSTREE_2021.3 { -global: - ostree_repo_auto_lock_push; - ostree_repo_auto_lock_cleanup; - ostree_repo_lock_push; - ostree_repo_lock_pop; -} LIBOSTREE_2021.2; - /* 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 9a45c0d8..becdfc55 100644 --- a/src/libostree/libostree-released.sym +++ b/src/libostree/libostree-released.sym @@ -653,6 +653,14 @@ global: ostree_content_writer_finish; } LIBOSTREE_2021.1; +LIBOSTREE_2021.3 { +global: + ostree_repo_auto_lock_push; + ostree_repo_auto_lock_cleanup; + ostree_repo_lock_push; + ostree_repo_lock_pop; +} LIBOSTREE_2021.2; + /* 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 14adc867..89c3eb07 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 <