From 4e5eaad9126a81d549e2c329caf82c2042e3c2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?coadde=20=5BM=C3=A1rcio=20Alexandre=20Silva=20Delgado=5D?= Date: Sat, 29 Aug 2015 21:12:13 -0300 Subject: fix xbs usage and add db-list-nonfree.py suppport --- src/bin/db-list-nonfree.py | 28 ++++++++++++++++++++++++++++ src/bin/xbs | 16 +++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100755 src/bin/db-list-nonfree.py (limited to 'src/bin') diff --git a/src/bin/db-list-nonfree.py b/src/bin/db-list-nonfree.py new file mode 100755 index 0000000..a486fa5 --- /dev/null +++ b/src/bin/db-list-nonfree.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python2 +#-*- encoding: utf-8 -*- +from 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])) diff --git a/src/bin/xbs b/src/bin/xbs index 862ddab..77a7825 100644 --- a/src/bin/xbs +++ b/src/bin/xbs @@ -230,10 +230,6 @@ CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc" source "${CONFIG_DIR}/xbs.cfg" source "${SHARE_DIR}/xbs-functions" -if [ "${#}" -eq '0' ]; then - msg "usage: %s {add,init,rm,sync} ..." "${0##*/}" -fi - rules=${1} case "${rules}" in @@ -263,11 +259,13 @@ case "${rules}" in fi done ;; - check-libraries|check-libs|chl|list-unsigned-packages|list-unsigd-pkgs|lup) + check-libraries|check-libs|chl|list-nonfree|list-nonlibre|lnf|lnl|list-unsigned-packages|list-unsigd-pkgs|lup) if [ "${rules}" == 'check-libraries' || "${rules}" == 'check-libs' || "${rules}" == 'chl' ]; then - "${BIN_DIR}/db-check-package-libraries.py ${@}" + "${BIN_DIR}/db-check-package-libraries.py ${@:2}" + elif [ "${rules}" == 'list-nonfree' || "${rules}" == 'list-nonlibre' || "${rules}" == 'lnf' || "${rules}" == 'lnl' ]; then + "${BIN_DIR}/db-list-nonfree.py ${@:2}" elif [ "${rules}" == 'list-unsigned-packages' || "${rules}" == 'list-unsigd-pkgs' || "${rules}" == 'lup' ]; then - "${BIN_DIR}/db-list-unsigned-packages.py ${@}" + "${BIN_DIR}/db-list-unsigned-packages.py ${@:2}" fi ;; init|sync|import) @@ -305,4 +303,8 @@ case "${rules}" in done fi ;; + *) + # XBS Usage + msg "usage: %s ..." "${0##*/}" + ;; esac -- cgit v1.2.3