[Dev] [dbscripts] [RFC] config: Add more repos to default ARCHTAGS for db-import-pkg

Luke Shumaker lukeshu at lukeshu.com
Fri Sep 28 19:47:30 GMT 2018


From: Luke Shumaker <lukeshu at parabola.nu>

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.
---
 config-list-tags          | 80 +++++++++++++++++++++++++++++++++++++++
 config.local.archlinux32  |  2 +-
 config.local.archlinuxarm |  2 +-
 config.local.community    |  2 +-
 config.local.packages     |  2 +-
 5 files changed, 84 insertions(+), 4 deletions(-)
 create mode 100755 config-list-tags

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 at 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 "$@"
diff --git a/config.local.archlinux32 b/config.local.archlinux32
index f8582e8..1a5f18c 100644
--- a/config.local.archlinux32
+++ b/config.local.archlinux32
@@ -6,7 +6,7 @@ PKGPOOL='pool/archlinux32'
 SRCPOOL='sources/archlinux32'
 
 # "tags" are repo-arch pairs
-ARCHTAGS=({build-support,core,testing,extra,community}-i686)
+ARCHTAGS=("${PKGREPOS[@]/%/-i686}") # leaves out *-i486 and releng-x86_64
 ARCHPATH='$arch/$repo'
 ARCHPKGPOOL='pool'
 
diff --git a/config.local.archlinuxarm b/config.local.archlinuxarm
index 8947f5c..ec1cb72 100644
--- a/config.local.archlinuxarm
+++ b/config.local.archlinuxarm
@@ -6,7 +6,7 @@ PKGPOOL='pool/alarm'
 SRCPOOL='sources/alarm'
 
 # "tags" are repo-arch pairs
-ARCHTAGS=({core,extra,community}-armv7h)
+ARCHTAGS=("${PKGREPOS[@]/%/-armv7h}")
 ARCHPATH='$arch/$repo'
 
 INHERIT=(
diff --git a/config.local.community b/config.local.community
index 6569eef..cabfa5b 100644
--- a/config.local.community
+++ b/config.local.community
@@ -6,7 +6,7 @@ PKGPOOL='pool/community'
 SRCPOOL='sources/community'
 
 # "tags" are repo-arch pairs
-ARCHTAGS=({community,multilib,multilib-testing}-x86_64)
+ARCHTAGS=({community,multilib}{,-testing,-staging}-x86_64)
 ARCHPATH='$repo/os/$arch'
 ARCHPKGPOOL='pool/community'
 ARCHSRCPOOL='sources/community'
diff --git a/config.local.packages b/config.local.packages
index 1d47755..403fc9c 100644
--- a/config.local.packages
+++ b/config.local.packages
@@ -6,7 +6,7 @@ PKGPOOL='pool/packages'
 SRCPOOL='sources/packages'
 
 # "tags" are repo-arch pairs
-ARCHTAGS=({core,testing,extra}-x86_64)
+ARCHTAGS=("${PKGREPOS[@]/%/-x86_64}")
 ARCHPATH='$repo/os/$arch'
 ARCHPKGPOOL='pool/packages'
 ARCHSRCPOOL='sources/packages'
-- 
2.19.0




More information about the Dev mailing list