ostree export: Add --prefix option

This lets you set a prefix for the resulting archive patsh.
Especially useful in combination with --subpath, for instance
--subpath=subdir --prefix=subdir to extract just subdir.

Closes: #265
Approved by: cgwalters
This commit is contained in:
Alexander Larsson authored and Colin Walters (automation) committed 2016-04-19 12:28:06 +00:00
1 parent 5079f70ec0
commit 5595664e47
4 files changed
+35 -3

No files matched your search

+21 -2
View File
@@ -23,7 +23,7 @@ set -euo pipefail
setup_test_repository "archive-z2"
echo '1..3'
echo '1..5'
$OSTREE checkout test2 test2-co
$OSTREE commit --no-xattrs -b test2-noxattrs -s "test2 without xattrs" --tree=dir=test2-co
@@ -47,7 +47,26 @@ assert_file_empty diff.txt
echo 'ok export --subpath gnutar diff (no xattrs)'
rm test2.tar test2-subpath.tar diff.txt t t2 -rf
cd ${test_tmpdir}
${OSTREE} 'export' test2-noxattrs --prefix=the-prefix/ -o test2-prefix.tar
mkdir t3
(cd t3 && tar xf ../test2-prefix.tar)
${CMD_PREFIX} ostree --repo=repo diff --no-xattrs test2-noxattrs ./t3/the-prefix > diff.txt
assert_file_empty diff.txt
echo 'ok export --prefix gnutar diff (no xattrs)'
cd ${test_tmpdir}
${OSTREE} 'export' test2-noxattrs --subpath=baz --prefix=the-prefix/ -o test2-prefix-subpath.tar
mkdir t4
(cd t4 && tar xf ../test2-prefix-subpath.tar)
${CMD_PREFIX} ostree --repo=repo diff --no-xattrs ./t4/the-prefix ./t/baz > diff.txt
${CMD_PREFIX} ostree --repo=repo diff --no-xattrs test2-noxattrs ./t3/the-prefix > diff.txt
assert_file_empty diff.txt
echo 'ok export --prefix --subpath gnutar diff (no xattrs)'
rm test2.tar test2-subpath.tar diff.txt t t2 t3 t4 -rf
cd ${test_tmpdir}
${OSTREE} 'export' test2 -o test2.tar