From fa3d711519eb2ab6e4205ea351d54ef908171297 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 23 Nov 2008 05:47:57 +0000 Subject: Bug #247548 - Remove 'last' and 'lfull' commands since nobody uses them. Thanks to Alec Warner . svn path=/main/trunk/; revision=12049 --- bin/repoman | 76 ++---------------------------------------------- man/repoman.1 | 6 ---- pym/repoman/utilities.py | 2 +- 3 files changed, 3 insertions(+), 81 deletions(-) diff --git a/bin/repoman b/bin/repoman index 820fa9c47..07183b756 100755 --- a/bin/repoman +++ b/bin/repoman @@ -25,11 +25,6 @@ import platform from itertools import chain, izip from stat import S_ISDIR, ST_CTIME -try: - import cPickle as pickle -except ImportError: - import pickle - try: import cStringIO as StringIO except ImportError: @@ -151,8 +146,6 @@ def ParseArgs(args, qahelp): 'fix' : 'Fix simple QA issues (stray digests, missing digests)', 'full' : 'Scan directory tree and print all issues (not a summary)', 'help' : 'Show this screen', - 'last' : 'Remember report from last run', - 'lfull' : 'Remember report from last run (full listing)', 'manifest' : 'Generate a Manifest (fetches files if necessary)', 'scan' : 'Scan directory tree for QA issues' } @@ -228,7 +221,7 @@ def ParseArgs(args, qahelp): break if not opts.mode: - opts.mode = 'full' #default to full + opts.mode = 'full' if opts.mode == 'ci': opts.mode = 'commit' # backwards compat shortcut @@ -424,61 +417,8 @@ suspect_rdepend = frozenset([ # file.executable no_exec = frozenset(["Manifest","ChangeLog","metadata.xml"]) -def last(full=False): - """Print the results of the last repoman run - Args: - full - Print the complete results, if false, print a summary - Returns: - Doesn't return (invokes sys.exit() - """ - #Retrieve and unpickle stats and fails from saved files - savedf=open(os.path.join(portage.const.CACHE_PATH, 'repo.stats'),'r') - stats = pickle.load(savedf) - savedf.close() - savedf=open(os.path.join(portage.const.CACHE_PATH, 'repo.fails'),'r') - fails = pickle.load(savedf) - savedf.close() - - #dofail will be set to 1 if we have failed in at least one non-warning category - dofail=0 - #dowarn will be set to 1 if we tripped any warnings - dowarn=0 - #dofull will be set if we should print a "repoman full" informational message - dofull=0 - - dofull = options.mode not in ("full", "lfull") - - for x in qacats: - if not stats[x]: - continue - dowarn = 1 - if x not in qawarnings: - dofail = 1 - - print - print green("RepoMan remembers...") - print - style_file = ConsoleStyleFile(sys.stdout) - console_writer = StyleWriter(file=style_file, maxcol=9999) - console_writer.style_listener = style_file.new_styles - f = formatter.AbstractFormatter(console_writer) - utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings) - print - if dofull: - print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.") - print - if dowarn and not dofail: - print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\n I took it, but I wasn't happy.\"" - elif not dofail: - print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"" - print - sys.exit(0) - options, arguments = ParseArgs(sys.argv, qahelp) -if options.mode in ('last', 'lfull'): - last('lfull' in options.mode) - # Set this to False when an extraordinary issue (generally # something other than a QA issue) makes it impossible to # commit (like if Manifest generation fails). @@ -1608,24 +1548,12 @@ for x in scanlist: if options.mode == "manifest": sys.exit(dofail) -#Pickle and save results for instant reuse in last and lfull -if os.access(portage.const.CACHE_PATH, os.W_OK): - for myobj, fname in (stats, "repo.stats"), (fails, "repo.fails"): - fpath = os.path.join(portage.const.CACHE_PATH, fname) - savef = open(fpath, 'w') - pickle.dump(myobj, savef) - savef.close() - portage.apply_secpass_permissions(fpath, gid=portage.portage_gid, - mode=0664) - -# TODO(antarus) This function and last () look familiar ;) - #dofail will be set to 1 if we have failed in at least one non-warning category dofail=0 #dowarn will be set to 1 if we tripped any warnings dowarn=0 #dofull will be set if we should print a "repoman full" informational message -dofull = options.mode not in ("full", "lfull") +dofull = options.mode != 'full' for x in qacats: if not stats[x]: diff --git a/man/repoman.1 b/man/repoman.1 index 14165aae9..c6d83d5cd 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -59,9 +59,6 @@ Show this screen .B full Scan directory tree for QA issues (full listing) .TP -.B last -Remember report from last run -.TP .B help Show this screen .TP @@ -71,9 +68,6 @@ Scan directory tree for QA issues (short listing) .B fix Fix simple QA issues (stray digests, missing digests) .TP -.B lfull -Remember report from last run (full listing) -.TP .B manifest Generate a Manifest (fetches files if necessary) .TP diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index cee52186e..6003deeac 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -211,7 +211,7 @@ def format_qa_output(formatter, stats, fails, dofull, dofail, options, qawarning Returns: None (modifies formatter) """ - full = options.mode in ("full", "lfull") + full = options.mode == 'full' # we only want key value pairs where value > 0 for category, number in \ itertools.ifilter(lambda myitem: myitem[1] > 0, stats.iteritems()): -- cgit v1.2.3-1-g7c22