summaryrefslogtreecommitdiff
path: root/db-list-nonfree.py
blob: 4e1b16498573e08a9810c68e1e095d16fd1f8f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/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]))