From fc461bbba2814ee97eb20cbb1c01b82218ab3abd Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 22 Mar 2010 04:49:24 +0100 Subject: oeaudit: Use optparse to specify the parameters --- contrib/oeaudit/oe_audit.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'contrib/oeaudit') diff --git a/contrib/oeaudit/oe_audit.py b/contrib/oeaudit/oe_audit.py index b15a32fdea..986a12e758 100755 --- a/contrib/oeaudit/oe_audit.py +++ b/contrib/oeaudit/oe_audit.py @@ -82,10 +82,25 @@ def compare_versions(oe, freebsd, not_known): handle_package("%s-full-native" % package, package) handle_package("%s-sdk" % package, package) +def handle_options(args): + import optparse + parser = optparse.OptionParser(version = "OE Audit version 0.1", + usage = "%prog [options]") + parser.add_option("-a", "--auditfile", help = "FreeBSD auditfile to use", + action = "store", dest = "freebsd_auditfile", default = None) + parser.add_option("-p", "--available", help = "Output of bitbake -s", + action = "store", dest = "oe_available", default = None) + parser.add_option("-b", "--buggy", help = "Write out unmaped packets", + action = "store", dest = "buggy", default = "not_in_oe.bugs") + + options, args = parser.parse_args(args) + return options # read the input data -oe_packages = oe.read_available("available") -freebsd_vuln = freebsd.read_auditfile("auditfile") -buggy = open("not_in_oe.bugs", "w+") +import sys +opts = handle_options(sys.argv) +oe_packages = oe.read_available(opts.oe_available) +freebsd_vuln = freebsd.read_auditfile(opts.freebsd_auditfile) +buggy = open(opts.buggy, "w+") compare_versions(oe=oe_packages, freebsd=freebsd_vuln, not_known=buggy) -- cgit v1.2.3