summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdb-check-nonfree11
-rwxr-xr-xlist_nonfree_in_db.py28
2 files changed, 31 insertions, 8 deletions
diff --git a/db-check-nonfree b/db-check-nonfree
index 83efb14..d8f34f0 100755
--- a/db-check-nonfree
+++ b/db-check-nonfree
@@ -23,15 +23,10 @@ for repo in ${ARCHREPOS[@]}; do
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
+ cmd_="$(dirname $0)/list_nonfree_in_db.py -k ${BLACKLIST_FILE} \
+ -b ${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}"
+ cleanpkgs=($(${cmd_}))
if [ ${#cleanpkgs[@]} -ge 1 ]; then
arch_repo_remove "${repo}" "${pkgarch}" ${cleanpkgs[@]}
fi
diff --git a/list_nonfree_in_db.py b/list_nonfree_in_db.py
new file mode 100755
index 0000000..598a2e7
--- /dev/null
+++ b/list_nonfree_in_db.py
@@ -0,0 +1,28 @@
+#! /usr/bin/python
+#-*- encoding: utf-8 -*-
+from repm.filter import *
+import argparse
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ prog="nonfree_in_db",
+ description="Cleans nonfree files on repo",)
+
+ parser.add_argument("-k", "--blacklist-file", type=str,
+ help="File containing blacklisted names",
+ required=True,)
+
+ parser.add_argument("-b", "--database", type=str,
+ help="dabatase to clean",
+ required=True,)
+
+ args=parser.parse_args()
+
+ if not (args.blacklist_file and args.database):
+ parser.print_help()
+ exit(1)
+
+ blacklist=listado(args.blacklist_file)
+ pkgs=get_pkginfo_from_db(args.database)
+
+ print(" ".join([pkg["name"] for pkg in pkgs if pkg["name"] in blacklist]))