ostree: Re-add patches that were incorrectly removed

Partially reverts 1a56b3515b8434f91af104e987b05227a0b28eff

Also make the patch comments clearly mention that they are for *installed* tests.

Jan Tojnar e3395bce 0f96dffd

+220
+151
pkgs/by-name/os/ostree/fix-1592.patch
···
··· 1 + diff --git a/tests/basic-test.sh b/tests/basic-test.sh 2 + index c8f853f8..a58ad3de 100644 3 + --- a/tests/basic-test.sh 4 + +++ b/tests/basic-test.sh 5 + @@ -242,7 +242,7 @@ cd ${test_tmpdir} 6 + if $OSTREE commit ${COMMIT_ARGS} -b test-bootable --bootable $test_tmpdir/checkout-test2-4 2>err.txt; then 7 + fatal "committed non-bootable tree" 8 + fi 9 + -assert_file_has_content err.txt "error: .*No such file or directory" 10 + +assert_file_has_content err.txt "error:.*No such file or directory" 11 + echo "ok commit fails bootable if no kernel" 12 + 13 + cd ${test_tmpdir} 14 + diff --git a/tests/pull-test.sh b/tests/pull-test.sh 15 + index d61735a0..9e751d82 100644 16 + --- a/tests/pull-test.sh 17 + +++ b/tests/pull-test.sh 18 + @@ -297,7 +297,7 @@ ostree_repo_init mirrorrepo-local --mode=archive 19 + if ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo 2>err.txt; then 20 + fatal "pull with mixed refs succeeded?" 21 + fi 22 + -assert_file_has_content err.txt "error: Invalid ref name origin:main" 23 + +assert_file_has_content err.txt "Invalid ref name origin:main" 24 + ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo localbranch 25 + ${CMD_PREFIX} ostree --repo=mirrorrepo-local rev-parse localbranch 26 + ${CMD_PREFIX} ostree --repo=mirrorrepo-local fsck 27 + @@ -308,7 +308,7 @@ if ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo nosuchbranc 28 + fatal "pulled nonexistent branch" 29 + fi 30 + # So true 31 + -assert_file_has_content_literal err.txt "error: Refspec 'nosuchbranch' not found" 32 + +assert_file_has_content_literal err.txt "Refspec 'nosuchbranch' not found" 33 + echo "ok pull-local nonexistent branch" 34 + 35 + cd ${test_tmpdir} 36 + @@ -687,5 +687,5 @@ rm ostree-srv/gnomerepo/summary 37 + if ${CMD_PREFIX} ostree --repo=repo pull origin main 2>err.txt; then 38 + fatal "pull of invalid ref succeeded" 39 + fi 40 + -assert_file_has_content_literal err.txt 'error: Fetching checksum for ref ((empty), main): Invalid rev lots of html here lots of html here lots of html here lots of' 41 + +assert_file_has_content_literal err.txt 'Fetching checksum for ref ((empty), main): Invalid rev lots of html here lots of html here lots of html here lots of' 42 + echo "ok pull got HTML for a ref" 43 + diff --git a/tests/test-config.sh b/tests/test-config.sh 44 + index 2d9aaf53..f1e28614 100755 45 + --- a/tests/test-config.sh 46 + +++ b/tests/test-config.sh 47 + @@ -44,7 +44,7 @@ assert_file_has_content list.txt "http://example\.com/ostree/repo/" 48 + if ${CMD_PREFIX} ostree config --repo=repo get --group=core lock-timeout-secs extra 2>err.txt; then 49 + assert_not_reached "ostree config get should error out if too many arguments are given" 50 + fi 51 + -assert_file_has_content err.txt "error: Too many arguments given" 52 + +assert_file_has_content err.txt "Too many arguments given" 53 + echo "ok config get" 54 + 55 + ${CMD_PREFIX} ostree config --repo=repo set core.mode bare-user-only 56 + @@ -61,7 +61,7 @@ assert_file_has_content repo/config "http://example\.com/ostree/" 57 + if ${CMD_PREFIX} ostree config --repo=repo set --group=core lock-timeout-secs 120 extra 2>err.txt; then 58 + assert_not_reached "ostree config set should error out if too many arguments are given" 59 + fi 60 + -assert_file_has_content err.txt "error: Too many arguments given" 61 + +assert_file_has_content err.txt "Too many arguments given" 62 + echo "ok config set" 63 + 64 + # Check that using `--` works and that "ostree config unset" works 65 + @@ -78,7 +78,7 @@ if ${CMD_PREFIX} ostree config --repo=repo get core.lock-timeout-secs 2>err.txt; 66 + fi 67 + # Check for any character where quotation marks would be as they appear differently in the Fedora and Debian 68 + # test suites (“” and '' respectively). See: https://github.com/ostreedev/ostree/pull/1839 69 + -assert_file_has_content err.txt "error: Key file does not have key .lock-timeout-secs. in group .core." 70 + +assert_file_has_content err.txt "Key file does not have key .lock-timeout-secs. in group .core." 71 + 72 + # Check that it's idempotent 73 + ${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs 74 + @@ -95,5 +95,5 @@ ${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.ti 75 + if ${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs extra 2>err.txt; then 76 + assert_not_reached "ostree config unset should error out if too many arguments are given" 77 + fi 78 + -assert_file_has_content err.txt "error: Too many arguments given" 79 + +assert_file_has_content err.txt "Too many arguments given" 80 + echo "ok config unset" 81 + diff --git a/tests/test-fsck-collections.sh b/tests/test-fsck-collections.sh 82 + index 3dbcdd23..d6359979 100755 83 + --- a/tests/test-fsck-collections.sh 84 + +++ b/tests/test-fsck-collections.sh 85 + @@ -98,7 +98,7 @@ ${CMD_PREFIX} ostree fsck --repo=repo 86 + if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then 87 + assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" 88 + fi 89 + -assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)" 90 + +assert_file_has_content fsck-error "Commit has no requested ref .new-ref. in ref binding metadata (.ref1.)" 91 + assert_file_has_content fsck "^Validating refs\.\.\.$" 92 + 93 + echo "ok 3 fsck detects missing ref bindings" 94 + @@ -111,7 +111,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collect 95 + if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then 96 + assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" 97 + fi 98 + -assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)" 99 + +assert_file_has_content fsck-error "Commit has no requested ref .new-ref. in ref binding metadata (.ref1.)" 100 + assert_file_has_content fsck "^Validating refs\.\.\.$" 101 + assert_file_has_content fsck "^Validating refs in collections\.\.\.$" 102 + 103 + @@ -125,7 +125,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collect 104 + if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then 105 + assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" 106 + fi 107 + -assert_file_has_content fsck-error "Commit has collection ID ‘org\.example\.Collection’ in collection binding metadata, while the remote it came from has collection ID ‘org\.example\.Collection2’" 108 + +assert_file_has_content fsck-error "Commit has collection ID .org\.example\.Collection. in collection binding metadata, while the remote it came from has collection ID .org\.example\.Collection2." 109 + assert_file_has_content fsck "^Validating refs\.\.\.$" 110 + assert_file_has_content fsck "^Validating refs in collections\.\.\.$" 111 + 112 + @@ -145,7 +145,7 @@ echo "ok 6 fsck ignores unreferenced ref bindings" 113 + if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error; then 114 + assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" 115 + fi 116 + -assert_file_has_content fsck-error "Collection–ref (org\.example\.Collection, ref1) in bindings for commit .* does not exist" 117 + +assert_file_has_content fsck-error 'Collection.ref (org\.example\.Collection, ref1) in bindings for commit .* does not exist' 118 + assert_file_has_content fsck "^Validating refs\.\.\.$" 119 + assert_file_has_content fsck "^Validating refs in collections\.\.\.$" 120 + 121 + @@ -184,7 +184,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --create=new-ref $(cat ref3-checksum) 122 + if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then 123 + assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" 124 + fi 125 + -assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref3’, ‘ref4’)" 126 + +assert_file_has_content fsck-error "Commit has no requested ref .new-ref. in ref binding metadata (.ref3., .ref4.)" 127 + assert_file_has_content fsck "^Validating refs\.\.\.$" 128 + 129 + echo "ok 9 fsck detects missing ref bindings" 130 + @@ -203,7 +203,7 @@ echo "ok 10 fsck ignores unreferenced ref bindings" 131 + if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error; then 132 + assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!" 133 + fi 134 + -assert_file_has_content fsck-error "Ref ‘ref3’ in bindings for commit .* does not exist" 135 + +assert_file_has_content fsck-error 'Ref .ref3. in bindings for commit .* does not exist' 136 + assert_file_has_content fsck "^Validating refs\.\.\.$" 137 + 138 + echo "ok 11 fsck ignores unreferenced ref bindings" 139 + diff --git a/tests/test-remote-add.sh b/tests/test-remote-add.sh 140 + index 2f5ea634..0f63853c 100755 141 + --- a/tests/test-remote-add.sh 142 + +++ b/tests/test-remote-add.sh 143 + @@ -81,7 +81,7 @@ echo "ok remote delete" 144 + if $OSTREE remote delete nosuchremote 2>err.txt; then 145 + assert_not_reached "Deleting remote unexpectedly succeeded" 146 + fi 147 + -assert_file_has_content err.txt "error: " 148 + +assert_file_has_content err.txt "not found" 149 + 150 + $OSTREE remote delete --if-exists nosuchremote 151 + echo "ok"
+55
pkgs/by-name/os/ostree/fix-test-paths.patch
···
··· 1 + diff --git a/tests/libtest.sh b/tests/libtest.sh 2 + index 2c2a33f0..4e9d3fa2 100755 3 + --- a/tests/libtest.sh 4 + +++ b/tests/libtest.sh 5 + @@ -761,12 +761,12 @@ gen_ed25519_keys () 6 + { 7 + # Generate private key in PEM format 8 + pemfile="$(mktemp -p ${test_tmpdir} ed25519_XXXXXX.pem)" 9 + - openssl genpkey -algorithm ed25519 -outform PEM -out "${pemfile}" 10 + + @openssl@ genpkey -algorithm ed25519 -outform PEM -out "${pemfile}" 11 + 12 + # Based on: http://openssl.6102.n7.nabble.com/ed25519-key-generation-td73907.html 13 + # Extract the private and public parts from generated key. 14 + - ED25519PUBLIC="$(openssl pkey -outform DER -pubout -in ${pemfile} | tail -c 32 | base64)" 15 + - ED25519SEED="$(openssl pkey -outform DER -in ${pemfile} | tail -c 32 | base64)" 16 + + ED25519PUBLIC="$(@openssl@ pkey -outform DER -pubout -in ${pemfile} | tail -c 32 | base64)" 17 + + ED25519SEED="$(@openssl@ pkey -outform DER -in ${pemfile} | tail -c 32 | base64)" 18 + # Secret key is concantination of SEED and PUBLIC 19 + ED25519SECRET="$(echo ${ED25519SEED}${ED25519PUBLIC} | base64 -d | base64 -w 0)" 20 + 21 + @@ -777,7 +777,7 @@ gen_ed25519_keys () 22 + 23 + gen_ed25519_random_public() 24 + { 25 + - openssl genpkey -algorithm ED25519 | openssl pkey -outform DER | tail -c 32 | base64 26 + + @openssl@ genpkey -algorithm ED25519 | @openssl@ pkey -outform DER | tail -c 32 | base64 27 + } 28 + 29 + is_bare_user_only_repo () { 30 + diff --git a/tests/test-basic-user-only.sh b/tests/test-basic-user-only.sh 31 + index f6e8606d..1fed2465 100755 32 + --- a/tests/test-basic-user-only.sh 33 + +++ b/tests/test-basic-user-only.sh 34 + @@ -27,7 +27,7 @@ extra_basic_tests=7 35 + . $(dirname $0)/basic-test.sh 36 + 37 + $CMD_PREFIX ostree --version > version.yaml 38 + -python3 -c 'import yaml; yaml.safe_load(open("version.yaml"))' 39 + +@python3@ -c 'import yaml; yaml.safe_load(open("version.yaml"))' 40 + echo "ok yaml version" 41 + 42 + # Reset things so we don't inherit a lot of state from earlier tests 43 + diff --git a/tests/test-remote-headers.sh b/tests/test-remote-headers.sh 44 + index d3bf4f97..0d2331ba 100755 45 + --- a/tests/test-remote-headers.sh 46 + +++ b/tests/test-remote-headers.sh 47 + @@ -24,7 +24,7 @@ echo '1..2' 48 + . $(dirname $0)/libtest.sh 49 + 50 + V=$($CMD_PREFIX ostree --version | \ 51 + - python3 -c 'import sys, yaml; print(yaml.safe_load(sys.stdin)["libostree"]["Version"])') 52 + + @python3@ -c 'import sys, yaml; print(yaml.safe_load(sys.stdin)["libostree"]["Version"])') 53 + 54 + setup_fake_remote_repo1 "archive" "" \ 55 + --expected-header foo=bar \
+14
pkgs/by-name/os/ostree/package.nix
··· 40 gobject-introspection, 41 withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, 42 systemd, 43 }: 44 45 let ··· 64 url = "https://github.com/ostreedev/ostree/releases/download/v${finalAttrs.version}/libostree-${finalAttrs.version}.tar.xz"; 65 hash = "sha256-8kSkCMkJmYp3jhJ/zCLBtQK00BPxXyaUj0fMcv/i7vQ="; 66 }; 67 68 nativeBuildInputs = 69 [
··· 40 gobject-introspection, 41 withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, 42 systemd, 43 + replaceVars, 44 + openssl, 45 }: 46 47 let ··· 66 url = "https://github.com/ostreedev/ostree/releases/download/v${finalAttrs.version}/libostree-${finalAttrs.version}.tar.xz"; 67 hash = "sha256-8kSkCMkJmYp3jhJ/zCLBtQK00BPxXyaUj0fMcv/i7vQ="; 68 }; 69 + 70 + patches = [ 71 + # Workarounds for installed tests failing in pseudoterminal 72 + # https://github.com/ostreedev/ostree/issues/1592 73 + ./fix-1592.patch 74 + 75 + # Hard-code paths in installed tests 76 + (replaceVars ./fix-test-paths.patch { 77 + python3 = testPython.interpreter; 78 + openssl = "${openssl}/bin/openssl"; 79 + }) 80 + ]; 81 82 nativeBuildInputs = 83 [