diff options
-rw-r--r-- | db-check-nonfree | 45 | ||||
-rwxr-xr-x | db-update | 24 | ||||
-rwxr-xr-x | repo-update | 3 |
3 files changed, 47 insertions, 25 deletions
diff --git a/db-check-nonfree b/db-check-nonfree new file mode 100644 index 0000000..83efb14 --- /dev/null +++ b/db-check-nonfree @@ -0,0 +1,45 @@ +#!/bin/bash + +. "$(dirname $0)/db-functions" +. "$(dirname $0)/config" + +if [ $# -ge 1 ]; then + warning "Calling $(basename $0) with a specific repository is not supported" + exit 1 +fi + +# TODO: this might lock too much (architectures) +for repo in ${repos[@]}; do + for pkgarch in ${ARCHES[@]}; do + repo_lock ${repo} ${pkgarch} || exit 1 + done +done + +msg "Check nonfree in repo:" +nonfree=($(cut -d: -f1 ${BLACKLIST_FILE} | sort -u)) +for repo in ${ARCHREPOS[@]}; do + for pkgarch in ${ARCHES[@]}; do + msg2 "$repo $pkgarch" + if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then + continue + fi + unset dbpkgs + unset cleanpkgs + cleanpkgs=() + dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u )) + for pkgname in ${dbpkgs[@]}; do + if in_array ${pkgname} ${nonfree[@]}; then + cleanpkgs[${#cleanpkgs[*]}]=${pkgname} + fi + done + if [ ${#cleanpkgs[@]} -ge 1 ]; then + arch_repo_remove "${repo}" "${pkgarch}" ${cleanpkgs[@]} + fi + done +done + +for repo in ${repos[@]}; do + for pkgarch in ${ARCHES[@]}; do + repo_unlock ${repo} ${pkgarch} + done +done @@ -77,30 +77,6 @@ for repo in ${repos[@]}; do done done -# Repo check nonfree -msg "Check nonfree in repo:" -nonfree=($(cut -d: -f1 ${BLACKLIST_FILE} | sort -u)) -for repo in ${ARCHREPOS[@]}; do - for pkgarch in ${ARCHES[@]}; do - msg2 "$repo $pkgarch" - if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then - continue - fi - unset dbpkgs - unset cleanpkgs - cleanpkgs=() - dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u )) - for pkgname in ${dbpkgs[@]}; do - if in_array ${pkgname} ${nonfree[@]}; then - cleanpkgs[${#cleanpkgs[*]}]=${pkgname} - fi - done - if [ ${#cleanpkgs[@]} -ge 1 ]; then - arch_repo_remove "${repo}" "${pkgarch}" ${cleanpkgs[@]} - fi - done -done - for repo in ${repos[@]}; do for pkgarch in ${ARCHES[@]}; do repo_unlock ${repo} ${pkgarch} diff --git a/repo-update b/repo-update index 60960f2..a44ae87 100755 --- a/repo-update +++ b/repo-update @@ -51,4 +51,5 @@ find ${repodir}/staging/ -type f \! -name "*${PKGEXT}" -delete find ${repodir}/staging/ -type l -delete $(dirname $0)/db-update -#$(dirname $0)/cron-jobs/ftpdir-cleanup +$(dirname $0)/db-check-nonfree + |