summaryrefslogtreecommitdiff
path: root/db-check-nonfree
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 15:49:31 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 15:49:31 -0400
commitdfd907361f9b8ca470a7feb55339b2b8e2cb1b12 (patch)
tree190c7ea980b584093a56d98035e82cf7005f8933 /db-check-nonfree
parentda0737360ab185844e4461d7580cf81c639e9ded (diff)
parent0d7d26fb58525411847795e65ce4ce6260349732 (diff)
Merge branch 'master' into lukeshu/xbs
# Conflicts: # config # cron-jobs/db-cleanup # db-check-nonfree # db-import-archlinux-any-to-ours # db-import-archlinux-pkg # db-import-archlinux-src # test/lib/common.inc # test/test.d/create-filelists.sh # test/test.d/db-update.sh # test/test.d/testing2x.sh
Diffstat (limited to 'db-check-nonfree')
-rwxr-xr-xdb-check-nonfree47
1 files changed, 47 insertions, 0 deletions
diff --git a/db-check-nonfree b/db-check-nonfree
new file mode 100755
index 0000000..ea123fa
--- /dev/null
+++ b/db-check-nonfree
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-check-nonfree.conf"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
+
+if [ $# -ge 1 ]; then
+ error "Calling %s with a specific repository is not supported" "${0##*/}"
+ 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 "%s %s" "$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+=("${pkgname}")
+ fi
+ done
+ if [ ${#cleanpkgs[@]} -ge 1 ]; then
+ msg2 "Nonfree: %s" "${cleanpkgs[*]}"
+ 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