diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-02 22:20:39 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-02 22:33:04 -0400 |
commit | c9c5a69cc2098e999ddb76d8fd282a3fb6334cb1 (patch) | |
tree | 63c70b7a4a58c9547eab265f5ea2cc58ea4136ef /src | |
parent | a6ef2ffed4af47ff360bf0fc508aa24e83418f97 (diff) |
bugfix [1/2]: libredbdiff: Add a test for handling multiple provides.
Also make the minimal changes to the program to make this testing possible.
Diffstat (limited to 'src')
-rwxr-xr-x | src/abslibre-tools/libredbdiff | 33 | ||||
-rw-r--r-- | src/abslibre-tools/libredbdiff.conf | 7 |
2 files changed, 19 insertions, 21 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index 2617323..50bc78f 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -19,8 +19,12 @@ name="Libredbdiff" # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -baseconfpath="/etc/libredbdiff" -basedbpath="/var/lib/libredbdiff" +. "$(librelib messages)" +. "$(librelib conf)" +load_files libredbdiff || exit 1 + +baseconfpath="$statedir" +basedbpath="$statedir" conffile="$baseconfpath/pacman.conf.parabola" conffilearch="$baseconfpath/pacman.conf.archlinux" @@ -31,17 +35,11 @@ dbpatharch="$basedbpath/pacman.archlinux" mirrorlist="$baseconfpath/mirrorlist.parabola" mirrorlistarch="$baseconfpath/mirrorlist.archlinux" -mirror='http://repo.parabola.nu/$repo/os/$arch' -mirrorarch='http://mirrors.kernel.org/archlinux/$repo/os/$arch' - repos="libre pcr libre-multilib nonprism" field_pkgname_parabola=30 field_pkgname_arch=30 - -. "$(librelib messages)" - cmd="${0##*/}" arch_packages_tmp="/tmp/${cmd}.arch-packages" @@ -276,6 +274,7 @@ main() { "$name" \ "$cmd" fi + check_vars libredbdiff statedir mirror mirrorarch || exit 1 if ! [[ -e "${conffile}" && \ -e "${conffilearch}" && \ @@ -305,31 +304,23 @@ main() { createdir "$dbpatharch" msg "Synchronizing %s pacman databases for Arch" "$name" - pacman --config "${conffilearch}" -b "${dbpatharch}" -Sy || + pacman --config "${conffilearch}" -Sy || die "Failed to synchronize pacman database for Arch. Exiting." msg "%s pacman databases are updated. %s is ready. Run %q -n to print results." \ "$name" "$name" "$cmd" return 0 else - filenotfound "${dbpath}" - filenotfound "${dbpatharch}" + check_vars libredbdiff statedir || exit 1 + + filenotfound "${dbpath}/sync/libre.db" + filenotfound "${dbpatharch}/sync/core.db" filenotfound "${conffile}" filenotfound "${conffilearch}" - filenotfound "${mirrorlist}" - filenotfound "${mirrorlistarch}" unset provides ver verarch declare -gA provides ver verarch - if ! [[ -d "$dbpath" && \ - -d "$dbpatharch" ]]; then - die "At least one %s pacman DB directory is missing. To update %s pacman databases, %s must be run as root. Nothing done." \ - "$name" \ - "$name" \ - "$cmd" - fi - pacman --config "${conffilearch}" -Ss | \ grep -v '^ ' | \ awk -F/ '{print $2}' \ diff --git a/src/abslibre-tools/libredbdiff.conf b/src/abslibre-tools/libredbdiff.conf new file mode 100644 index 0000000..18bc643 --- /dev/null +++ b/src/abslibre-tools/libredbdiff.conf @@ -0,0 +1,7 @@ +#!/hint/bash +# shellcheck disable=2034 + +statedir='/var/lib/libredbdiff' + +mirror='http://repo.parabola.nu/$repo/os/$arch' +mirrorarch='http://mirrors.kernel.org/archlinux/$repo/os/$arch' |