From 85f44d172f8f2d1bf1893ba2d85e86d4cd5f221b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 11 Jun 2018 20:18:03 -0400 Subject: 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 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. --- db-import-pkg | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'db-import-pkg') 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 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 @@ -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}/" ;; -- cgit v1.2.2