Make tar invocation portable, fix OpenBSD build/test

At least on OpenBSD, tar(1) reads from /dev/rst0 not stdin by default
options must specififed consistently with or without dashes, not mixed.

Specify standard input explicitly to not rely on implementation details.
Use either option style consistently.
This commit is contained in:
Klemens Nanni 2023-03-11 21:38:44 +04:00
parent 2dff8c2b40
commit fda598cfdd
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -174,7 +174,7 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
Path tmpDir = createTempDir();
AutoDelete delTmpDir(tmpDir, true);
runProgram("tar", true, { "x", "-C", tmpDir }, tar);
runProgram("tar", true, { "-x", "-f", "-", "-C", tmpDir }, tar);
gitInfo.storePath = store->addToStore(name, tmpDir);

View File

@ -11,7 +11,7 @@ cp dependencies.nix $tarroot/default.nix
cp config.nix dependencies.builder*.sh $tarroot/
tarball=$TEST_ROOT/tarball.tar.xz
(cd $TEST_ROOT && tar c tarball) | xz > $tarball
(cd $TEST_ROOT && tar cf - tarball) | xz > $tarball
nix-env -f file://$tarball -qa --out-path | grep -q dependencies