diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-09-28 15:26:55 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-10-03 01:46:42 -0400 |
commit | 435025e98adc3db8628fbe8e08d68766737d2943 (patch) | |
tree | 2b2fdb769fbc8bfb9eb8f12fdbbc4874e906d483 /config-list-tags | |
parent | 013531bb6b11eb250cc897ef487532a34a1da836 (diff) |
config: Add more repos to default ARCHTAGS for db-import-pkg
This adds staging and testing repos, which we mostly don't currently
import.
The only bits of this change that I don't feel 100% about are the
Arch Linux ARM repos. <https://labs.parabola.nu/issues/1178>
packages:
+ staging-x86_64
+ gnome-unstable-x86_64
+ kde-unstable-x86_64
community:
+ community-staging-x86_64
+ community-testing-x86_64
+ multilib-staging-x86_64
archlinux32: (still leaves out *-i486 and releng-x86_64)
+ community-staging-i686
+ community-testing-i686
+ staging-i686
+ gnome-unstable-i686
+ kde-unstable-i686
archlinuxarm: (still leaves out *-aarch64, *-arm, and *-armv6h)
+ alarm-armv7h
+ aur-armv7h
This also adds a `config-list-tags` script that (like the other `config-*`
scripts) helps with writing the config files; it displays discrepancies
between the configured ARCHTAGS for an upstream and the list of .db's that
fetch_dbs() finds.
Diffstat (limited to 'config-list-tags')
-rwxr-xr-x | config-list-tags | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/config-list-tags b/config-list-tags new file mode 100755 index 0000000..679c0ea --- /dev/null +++ b/config-list-tags @@ -0,0 +1,80 @@ +#!/bin/bash + +set -eE -o pipefail +shopt -s extglob globstar nullglob +source "$(librelib messages)" +setup_traps + +# usage: fetch_dbs <from> <into> +fetch_dbs() { + rsync --no-motd -mrtLH --no-p \ + --include="*/" \ + --include="*.db" \ + --exclude="*" \ + --delete-after \ + "$1" "$2" +} + +list_found() { + local ret=0 + local dbfile repo re arch tag + while read -r -d '' dbfile; do + repo=${dbfile##*/} + repo=${repo%.db} + re=$(repo=$repo arch='(.*)' envsubst '$repo $arch' <<<"$ARCHPATH") + arch=$(sed -rn "s,^$re\$,\1,p" <<<"${dbfile%/*}") + if [[ -z $arch ]]; then + error 'Could not figure out architecture for %q' "$dbfile" + ret=1 + continue + fi + printf '%s\n' "$repo-$arch" + done < <(find "$WORKDIR" -name '*.db' -printf '%P\0') | sort -u + return $ret +} + +list_configured() { + printf '%s\n' "${ARCHTAGS[@]}" | sort -u +} + +main() { + if [[ $# -ne 0 ]] || [[ -z "$DBSCRIPTS_CONFIG" ]] || ! grep -q ARCHMIRROR -- "$DBSCRIPTS_CONFIG"; then + msg 'usage: DBSCRIPTS_CONFIG=/path/to/file %s' "${0##*/}" + exit $EXIT_INVALIDARGUMENT + fi + + local config_file + config_file="$(dirname "$(readlink -e "$0")")/config" + source "$config_file" + + WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX") + readonly WORKDIR + trap "rm -rf -- ${WORKDIR@Q}" EXIT + + fetch_dbs "${ARCHMIRROR}/" "$WORKDIR" + + y="${GREEN}✓${ALL_OFF}" + n="${RED}✗${ALL_OFF}" + while IFS='' read -r line; do + case "$line" in + $'\t\t'*) + rmt=$y + cfg=$y + val=${line#$'\t\t'} + ;; + $'\t'*) + rmt=$n + cfg=$y + val=${line#$'\t'} + ;; + *) + rmt=$y + cfg=$n + val=$line + ;; + esac + printf '%s:%s:%s\n' "$val" "$rmt" "$cfg" + done < <(comm <(list_found) <(list_configured)) | column -t -s: +} + +main "$@" |