diff --git a/config b/config index 842d6848c5a18214a08838293504d6abd81e4cc4..b8c2924a4c72d815c4127317c04b4cd2d4d8f309 100644 --- a/config +++ b/config @@ -2,6 +2,7 @@ FTP_BASE="/srv/ftp" ARCHIVE_BASE="/srv/archive" +ARCHIVE_INDEX_URL="https://archive.archlinux.org/packages/.all/index.0.xz" ARCHIVEUSER='archive' PKGREPOS=() DEBUGREPOS=() diff --git a/cron-jobs/archive-index b/cron-jobs/archive-index new file mode 100755 index 0000000000000000000000000000000000000000..93370acdb1e3265566a935ad812b3ca91a3bb596 --- /dev/null +++ b/cron-jobs/archive-index @@ -0,0 +1,16 @@ +#!/bin/bash +set -eo pipefail + +. "$(dirname "$(readlink -e "$0")")/../config" +. /usr/share/makepkg/util.sh + +http_code="$(curl --silent --show-error --fail --write-out "%{http_code}" --time-cond "${ARCHIVE_BASE}/index.0" --remote-time --output "${ARCHIVE_BASE}/.index.0.xz" "${ARCHIVE_INDEX_URL}")" + +if (( http_code == 200 )); then + msg "Updating ${ARCHIVE_BASE}/index.0" + rm -f "${ARCHIVE_BASE}/.index.0" + xz --decompress --keep "${ARCHIVE_BASE}/.index.0.xz" + touch --reference "${ARCHIVE_BASE}/.index.0"{.xz,} --time mtime + rm "${ARCHIVE_BASE}/.index.0.xz" + mv "${ARCHIVE_BASE}/"{.,}"index.0" +fi diff --git a/db-functions b/db-functions index 84a0b09bae476112976029a9a9a1504f8b8d0ace..786c04365917618573d76cd2209d3b52016ddcb8 100644 --- a/db-functions +++ b/db-functions @@ -790,6 +790,11 @@ check_reproducible() { # fast lookup with none glob file exists check using default PKGEXT [[ -f "${FTP_BASE}"/pool/packages/${dependency}${PKGEXT_DEFAULT} ]] && continue [[ -f "${ARCHIVE_BASE}/packages/${pkgname:0:1}/${pkgname}/${dependency}${PKGEXT_DEFAULT}" ]] && continue + # the local archive directory contains at most a few + # days worth of packages, so the archive index must be + # checked for older packages. Both checks are needed as + # the archive index is only updated once a day + grep --quiet --no-messages --max-count=1 "^${dependency}\$" "${ARCHIVE_BASE}/index.0" && continue # fallback lookup in csae fast lookup with default pkgext fails # shellcheck disable=2086