summaryrefslogtreecommitdiff
path: root/db-import-pkg
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-06-11 20:18:03 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-06-11 20:20:52 -0400
commit85f44d172f8f2d1bf1893ba2d85e86d4cd5f221b (patch)
tree547fcf60c214d3c8215acefd755c61380f6da973 /db-import-pkg
parent65f901a0f29597005d606f4e4a907d3e6ee37301 (diff)
db-import-*.conf: Split ARCHMIRROR in to ARCHMIRROR{,PATH}
Previously, db-import-pkg split ARCHMIRROR in to ARCHMIRROR_fullmodule and ARCHMIRROR_path; such that ARCHMIRROR=${ARCHMIRROR_fullmodule}/${ARCHMIRROR_path} This assumes that server gives the Arch mirror its own module; that isn't always the case; for example in <rsync://ftp.acc.umu.se/mirror/archlinux/> it lives in a subdirectory in the 'mirror' module. So, we need a way to specify which part of the path leads to the root of the mirror, and which part identifies the repo within it. So, remove the latter part from ARCHMIRROR, and create a separate ARCHMIRRORPATH variable for it. In db-import-pkg, this simply means that ARCHMIRROR_fullmodule becomes ARCHMIRROR, and ARCHMIRROR_path becomes ARCHMIRRORPATH.
Diffstat (limited to 'db-import-pkg')
-rwxr-xr-xdb-import-pkg19
1 files changed, 8 insertions, 11 deletions
diff --git a/db-import-pkg b/db-import-pkg
index 67c803a..e8e94c1 100755
--- a/db-import-pkg
+++ b/db-import-pkg
@@ -34,7 +34,7 @@ fetch_dbs() {
# Prints repo directory path for the given <repo> <arch> combination,
# relative to the rsync root.
get_repo_dir() {
- repo=$1 arch=$2 envsubst '$repo $arch' <<<"$ARCHMIRROR_path"
+ repo=$1 arch=$2 envsubst '$repo $arch' <<<"$ARCHMIRRORPATH"
}
# usage: db_list_pkgs <path-to-db>
@@ -256,15 +256,12 @@ main() {
local vars
case "$UPSTREAM" in
- packages|community) vars=(ARCHMIRROR ARCHTAGS ARCHPKGPOOL ARCHSRCPOOL) ;;
- archlinux32|archlinuxarm) vars=(ARCHMIRROR ARCHTAGS ARCHPKGPOOL ) ;;
+ packages|community) vars=(ARCHMIRROR ARCHMIRRORPATH ARCHTAGS ARCHPKGPOOL ARCHSRCPOOL) ;;
+ archlinux32|archlinuxarm) vars=(ARCHMIRROR ARCHMIRRORPATH ARCHTAGS ARCHPKGPOOL ) ;;
esac
load_conf "$(dirname "$(readlink -e "$0")")/config" DBEXT FILESEXT FTP_BASE
load_conf "$(dirname "$(readlink -e "$0")")/db-import-${UPSTREAM}.conf" "${vars[@]}"
- declare -rg ARCHMIRROR_path="${ARCHMIRROR#rsync://*/*/}"
- declare -rg ARCHMIRROR_fullmodule="${ARCHMIRROR%"/${ARCHMIRROR_path}"}"
-
WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
trap "rm -rf -- ${WORKDIR@Q}" EXIT
@@ -278,7 +275,7 @@ main() {
# Sync the repos databases
msg 'Downloading .db and .files files to import'
mkdir "${WORKDIR}/rsync"
- fetch_dbs "${ARCHMIRROR_fullmodule}/" "$WORKDIR/rsync"
+ fetch_dbs "${ARCHMIRROR}/" "$WORKDIR/rsync"
##############################################################
# 2. Figure out what we want #
@@ -356,7 +353,7 @@ main() {
whitelists+=("${WORKDIR}/${_tag}.whitelist")
# Get repo packages (symlinks)
sync_repo \
- "${ARCHMIRROR_fullmodule}/$(get_repo_dir "${_repo}" "${_arch}")/" \
+ "${ARCHMIRROR}/$(get_repo_dir "${_repo}" "${_arch}")/" \
"${WORKDIR}/${_tag}.whitelist" \
"${WORKDIR}/staging-rsync/${_repo}/os/${_arch}/"
;;
@@ -367,7 +364,7 @@ main() {
| sed -e 's/ /-/' -e 's|.$|&*|g' \
> "${WORKDIR}/${_tag}.whitelist"
sync_pool \
- "${ARCHMIRROR_fullmodule}/$(get_repo_dir "${_repo}" "${_arch}")/" \
+ "${ARCHMIRROR}/$(get_repo_dir "${_repo}" "${_arch}")/" \
"${WORKDIR}/${_tag}.whitelist" \
"${FTP_BASE}/${ARCHPKGPOOL}/"
poolify "${_arch}" "${ARCHPKGPOOL}" \
@@ -389,13 +386,13 @@ main() {
msg "Syncing package pool"
sync_pool \
- "${ARCHMIRROR_fullmodule}/${ARCHPKGPOOL}/" \
+ "${ARCHMIRROR}/${ARCHPKGPOOL}/" \
"${WORKDIR}/all.whitelist" \
"${FTP_BASE}/${ARCHPKGPOOL}/"
msg "Syncing source pool"
sync_pool \
- "${ARCHMIRROR_fullmodule}/${ARCHSRCPOOL}/" \
+ "${ARCHMIRROR}/${ARCHSRCPOOL}/" \
"${WORKDIR}/all.whitelist" \
"${FTP_BASE}/${ARCHSRCPOOL}/"
;;