diff options
author | Isaac David <isacdaavid@isacdaavid.info> | 2017-10-14 00:54:20 -0500 |
---|---|---|
committer | Isaac David <isacdaavid@isacdaavid.info> | 2017-10-14 00:54:20 -0500 |
commit | 313d1ee619363eca0b8b0742a2d58c9ce18877fd (patch) | |
tree | 11c1d7b920f0019423b4e5c7477c30e02b2efd75 /test/lib-blacklist-test.sh | |
parent | 2a7b161e6aa234aa5d434f47d3aedbe48ff7b251 (diff) |
blacklist get-rep: re-implement to query repos instead of blacklist.txt
Rationale: https://lists.parabola.nu/pipermail/dev/2017-October/005936.html
This makes get-rep a general-purpose tool for finding replacements and
providers of any package, not just blacklisted-ones. It works equally
well reading from full blacklist.txt lines, just pkgname lines, and
unwittingly; a single line with many pkgnames.
Some caveats for further discussion:
- This changes behavior from showing just one replacement/provider to
_all_ replacements and providers (including pkgname itself) in the repos.
- By "repos" I mean the repos the executing machine is configured to
access. This could be changed in the future with `expac --config`
if more package databases are desired (e.g. different
architecture).
- Results are shown using the "repo/pkgname ..." format rather than
just "pkgname ...". I think this makes the program more useful.
- Results aren't reordered to ensure that the first provider of
pkgname is pkgname itself. Order will be as expected otherwise, by
virtue of expac parsing repos in order.
Diffstat (limited to 'test/lib-blacklist-test.sh')
-rwxr-xr-x | test/lib-blacklist-test.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh index 1f8c518..7b88b72 100755 --- a/test/lib-blacklist-test.sh +++ b/test/lib-blacklist-test.sh @@ -8,16 +8,16 @@ _blacklist_url=https://projects.parabola.nu/blacklist.git/plain/blacklist.txt it_works_with_just_pkgname() { v="$(libreblacklist normalize <<<skype)"; [[ $v == 'skype::::' ]] v="$(libreblacklist get-pkg <<<skype)"; [[ $v == skype ]] - libreblacklist get-rep <<<skype | equals $'\n' + libreblacklist get-rep <<<irreplaceable | equals $'\n' libreblacklist get-url <<<skype | equals $'\n' libreblacklist get-reason <<<skype | equals $'\n' } it_works_with_everything_set() { - line='linux:linux-libre:parabola:id:[semifree] blobs and firmware' + line='linux:conflict:parabola:id:[semifree] blobs and firmware' v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]] v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'linux' ]] - v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'linux-libre' ]] + v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'libre/linux-libre' ]] v="$(libreblacklist get-url <<<"$line")"; [[ $v == 'https://labs.parabola.nu/issues/id' ]] v="$(libreblacklist get-reason <<<"$line")"; [[ $v == '[semifree] blobs and firmware' ]] } @@ -37,10 +37,10 @@ it_normalizes_correctly() { } it_works_with_colons_in_reason() { - line='package:replacement:parabola:id:my:reason' + line='package:conflict:parabola:id:my:reason' v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]] v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'package' ]] - v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'replacement' ]] + libreblacklist get-rep <<<"$line" | equals $'\n' v="$(libreblacklist get-url <<<"$line")"; [[ $v == 'https://labs.parabola.nu/issues/id' ]] v="$(libreblacklist get-reason <<<"$line")"; [[ $v == 'my:reason' ]] } |