xbps-query: add repo and pkgdb mode to --cat

This commit is contained in:
Duncan Overbruck
2021-12-19 16:07:25 +01:00
parent 3939d9aeb5
commit f5355e53cd
7 changed files with 75 additions and 3 deletions

View File

@@ -3,3 +3,4 @@ syntax("kyuafile", 1)
test_suite("xbps-query")
atf_test_program{name="ignore_repos_test"}
atf_test_program{name="remote_test"}
atf_test_program{name="query_test"}

View File

@@ -1,7 +1,7 @@
TOPDIR = ../../..
-include $(TOPDIR)/config.mk
TESTSHELL = ignore_repos_test remote_test
TESTSHELL = ignore_repos_test remote_test query_test
TESTSSUBDIR = xbps/xbps-query
EXTRA_FILES = Kyuafile

View File

@@ -0,0 +1,45 @@
#! /usr/bin/env atf-sh
cat_file_head() {
atf_set "descr" "xbps-query(1) --cat: cat pkgdb file"
}
cat_file_body() {
mkdir -p repo pkg_A/bin
echo "hello world!" > pkg_A/bin/file
cd repo
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a *.xbps
atf_check_equal $? 0
cd ..
mkdir root
xbps-install -r root --repository=repo -dvy foo
atf_check_equal $? 0
res=$(xbps-query -r root -dv -C empty.conf --cat /bin/file foo)
atf_check_equal $? 0
atf_check_equal "$res" "hello world!"
}
repo_cat_file_head() {
atf_set "descr" "xbps-query(1) -R --cat: cat repo file"
}
repo_cat_file_body() {
mkdir -p repo pkg_A/bin
echo "hello world!" > pkg_A/bin/file
cd repo
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a *.xbps
atf_check_equal $? 0
cd ..
res=$(xbps-query -r root -dv --repository=repo -C empty.conf --cat /bin/file foo)
atf_check_equal $? 0
atf_check_equal "$res" "hello world!"
}
atf_init_test_cases() {
atf_add_test_case cat_file
atf_add_test_case repo_cat_file
}