summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-02 22:30:19 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-02 22:50:36 -0400
commit3f4c2e4f1f3d28981e5121af97206cdc85427042 (patch)
tree3d0906575cee3efb03285086ffa5c7c486fef342
parentebbde88b7c08a5e9fe9ba8aca1ca2ac2dbd1b41d (diff)
libredbdiff: make repos be a true array, make it configurable
-rwxr-xr-xsrc/abslibre-tools/libredbdiff8
-rw-r--r--src/abslibre-tools/libredbdiff.conf2
-rw-r--r--test/libredbdiff-test.sh14
-rw-r--r--test/libredbdiff.d/expected-explicit.txt (renamed from test/libredbdiff.d/expected.txt)0
-rw-r--r--test/libredbdiff.d/expected-implicit.txt2
5 files changed, 19 insertions, 7 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff
index 924b9f4..6a56f06 100755
--- a/src/abslibre-tools/libredbdiff
+++ b/src/abslibre-tools/libredbdiff
@@ -35,8 +35,6 @@ dbpatharch="$basedbpath/pacman.archlinux"
mirrorlist="$baseconfpath/mirrorlist.parabola"
mirrorlistarch="$baseconfpath/mirrorlist.archlinux"
-repos="libre pcr libre-multilib nonprism"
-
field_pkgname_parabola=30
field_pkgname_arch=30
@@ -157,7 +155,7 @@ initialize() {
}
repo_test() {
- for repo in ${repos} ; do
+ for repo in "${repos[@]}" ; do
if [[ $repo == "$1" ]] ; then
found=1
return 0
@@ -313,7 +311,7 @@ main() {
"$name" "$name" "$cmd"
return 0
else
- check_vars libredbdiff statedir || exit 1
+ check_vars libredbdiff statedir repos || exit 1
filenotfound "${dbpath}/sync/libre.db"
filenotfound "${dbpatharch}/sync/core.db"
@@ -342,7 +340,7 @@ main() {
if [[ ${repo_arg} ]] ; then
print_cmp "${repo_arg}"
else
- for repo in ${repos} ; do
+ for repo in "${repos[@]}" ; do
echo "[$repo]"
print_cmp "$repo"
done
diff --git a/src/abslibre-tools/libredbdiff.conf b/src/abslibre-tools/libredbdiff.conf
index 18bc643..4ec024b 100644
--- a/src/abslibre-tools/libredbdiff.conf
+++ b/src/abslibre-tools/libredbdiff.conf
@@ -5,3 +5,5 @@ statedir='/var/lib/libredbdiff'
mirror='http://repo.parabola.nu/$repo/os/$arch'
mirrorarch='http://mirrors.kernel.org/archlinux/$repo/os/$arch'
+
+repos=(libre pcr libre-multilib nonprism)
diff --git a/test/libredbdiff-test.sh b/test/libredbdiff-test.sh
index 1b267e3..0ded607 100644
--- a/test/libredbdiff-test.sh
+++ b/test/libredbdiff-test.sh
@@ -9,6 +9,7 @@ common_before() {
'statedir="$PWD"' \
"mirror='http://repo.parabola.nu/\$repo/os/\$arch'" \
"mirrorarch='http://mirrors.kernel.org/archlinux/\$repo/os/\$arch'" \
+ 'repos=(libre)' \
> $XDG_CONFIG_HOME/libretools/libredbdiff.conf
}
@@ -19,11 +20,20 @@ it_displays_help() {
empty $tmpdir/stderr
}
-it_handles_packages_with_multiple_provides() {
+it_handles_packages_with_multiple_provides_explicit() {
cd libredbdiff.d/statedir
libredbdiff -n libre >$tmpdir/stdout 2>$tmpdir/stderr
empty $tmpdir/stderr
- diff -w ../expected.txt $tmpdir/stdout
+ diff -w ../expected-explicit.txt $tmpdir/stdout
+}
+
+it_handles_packages_with_multiple_provides_implicit() {
+ cd libredbdiff.d/statedir
+
+ libredbdiff -n >$tmpdir/stdout 2>$tmpdir/stderr
+
+ empty $tmpdir/stderr
+ diff -w ../expected-implicit.txt $tmpdir/stdout
}
diff --git a/test/libredbdiff.d/expected.txt b/test/libredbdiff.d/expected-explicit.txt
index 8fb89bf..8fb89bf 100644
--- a/test/libredbdiff.d/expected.txt
+++ b/test/libredbdiff.d/expected-explicit.txt
diff --git a/test/libredbdiff.d/expected-implicit.txt b/test/libredbdiff.d/expected-implicit.txt
new file mode 100644
index 0000000..afc2689
--- /dev/null
+++ b/test/libredbdiff.d/expected-implicit.txt
@@ -0,0 +1,2 @@
+[libre]
+p linux-libre linux 4.10.12_gnu-2 | 4.10.13-1