lib/checkout: add filter API to skip over files
This is analogous to the filtering support for the commit API: we allow library users to skip over checking out specific files. This is useful in some tricky situations where we *know* that the files to be checked out will conflict with existing files in subtle ways. One such example is in rpm-ostree support for multilib. There, we want to allow checking out a package onto an existing tree, but skipping over files that are not coloured to our preferred value (e.g. not overwriting an i686 version of `ldconfig` if we already have the `x86_64` version). See https://github.com/projectatomic/rpm-ostree/pull/1227 for details. Closes: #1441 Approved by: cgwalters
This commit is contained in:
1 parent
6bed647648
commit
2e95e06616
7 files changed
+226
-31
No files matched your search
+30
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((79 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((81 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -518,6 +518,35 @@ assert_file_has_content saucer alien
|
||||
rm t -rf
|
||||
echo "ok checkout subpath"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm -rf checkout-test2-skiplist
|
||||
cat > test-skiplist.txt <<EOF
|
||||
/baz/saucer
|
||||
/yet/another/tree
|
||||
EOF
|
||||
$OSTREE checkout --skip-list test-skiplist.txt test2 checkout-test2-skiplist
|
||||
cd checkout-test2-skiplist
|
||||
! test -f baz/saucer
|
||||
! test -d yet/another/tree
|
||||
test -f baz/cow
|
||||
test -d baz/deeper
|
||||
echo "ok checkout skip-list"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm -rf checkout-test2-skiplist
|
||||
cat > test-skiplist.txt <<EOF
|
||||
/saucer
|
||||
/deeper
|
||||
EOF
|
||||
$OSTREE checkout --skip-list test-skiplist.txt --subpath /baz \
|
||||
test2 checkout-test2-skiplist
|
||||
cd checkout-test2-skiplist
|
||||
! test -f saucer
|
||||
! test -d deeper
|
||||
test -f cow
|
||||
test -d another
|
||||
echo "ok checkout skip-list with subpath"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
$OSTREE checkout --union test2 checkout-test2-union
|
||||
find checkout-test2-union | wc -l > union-files-count
|
||||
|
||||
@@ -69,7 +69,19 @@ ostree checkout testbranch --selinux-policy / \
|
||||
--subpath subdir --selinux-prefix / co
|
||||
newcon=$(getfattr --only-values -m security.selinux co/usr/bin/bash)
|
||||
assert_streq "${oldcon}" "${newcon}"
|
||||
|
||||
ostree refs --delete testbranch
|
||||
rm co -rf
|
||||
echo "ok checkout with sepolicy and selinux-prefix"
|
||||
|
||||
# Now check that combining --selinux-policy with --skip-list doesn't blow up
|
||||
echo > skip-list.txt << EOF
|
||||
/usr/bin/true
|
||||
EOF
|
||||
ostree checkout testbranch --selinux-policy / --skip-list skip-list.txt \
|
||||
--subpath subdir --selinux-prefix / co
|
||||
! test -f co/usr/bin/true
|
||||
test -f co/usr/bin/bash
|
||||
newcon=$(getfattr --only-values -m security.selinux co/usr/bin/bash)
|
||||
assert_streq "${oldcon}" "${newcon}"
|
||||
rm co -rf
|
||||
ostree refs --delete testbranch
|
||||
echo "ok checkout selinux and skip-list"
|
||||
Reference in new issue
Block a user