diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-08-28 17:50:16 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-08-31 21:26:07 -0400 |
commit | 859dd56e5937a990c3b7aa9f4614eecc9041bb88 (patch) | |
tree | 6a08352836cb9862df679e60d837eaf717de889c | |
parent | c1dd10cce04633fbf2d018ec7927e1348dc24f84 (diff) |
db-import-pkg: Add expac_file function, use it to list packages in DBs.
I don't actually care about using it to list the packages in the DBs right
now (but maybe I will if we ever change to blacklisting by pkgbase).
The reason for this change is so that I can later use expac to get PGP
signatures out of the DBs.
-rwxr-xr-x | db-import-pkg | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/db-import-pkg b/db-import-pkg index d05f4f8..a49f5e0 100755 --- a/db-import-pkg +++ b/db-import-pkg @@ -12,6 +12,29 @@ setup_traps readonly -a UPSTREAMS=(packages community archlinux{32,arm}) +# usage: expac_file <FILE.db> <EXPAC_ARGS> +expac_file() { + local dbfile=$1 + local args=("${@:2}") + + local reponame=${dbfile##*/} + reponame=${reponame%%.*} + + mkdir -p -- "${WORKDIR}/expac/root" + cat >"${WORKDIR}/expac/pacman.conf" <<-EOT + [options] + RootDir = ${WORKDIR}/expac/root + DBPath = ${WORKDIR}/expac/root + + [${reponame}] + Server = file://$(realpath --no-symlinks -- "${dbfile%/*}") + EOT + + fakeroot pacman --config="${WORKDIR}/expac/pacman.conf" -Syy >/dev/null + # expac exits with non-zero on emtpy databases, so ignore errors + expac --config="${WORKDIR}/expac/pacman.conf" --sync "${args[@]}" || true +} + # usage: fetch_dbs <from> <into> # # Fetch excluding everything but db files @@ -41,10 +64,7 @@ get_repo_dir() { # # pkgname [epoch:]pkgver-pkgrel db_list_pkgs() { - bsdtar tf "$1" | - cut -d "/" -f 1 | - sed -r 's/-([^-]*-[^-]*)$/ \1/' | - sort -u + expac_file "$1" '%n %v' | sort -u } # usage: filter_blacklisted <FULL_LIST >FILTERED_LIST |