#!/usr/bin/env python # # Search for packages that have become # stable since their installation as unstable ones. # # Copyright (c) 2006 Johannes Weiner # # This program is free software; you can modify and redistribute it # under the terms of the GNU General Public License version 2. # import sys sys.path.insert(0, "/usr/lib/portage/pym") from portage import catpkgsplit, settings, portdb, best, \ vartree, getmaskingstatus from output import green, bold # List of packages installed to the system vtree = vartree() all_installed = vtree.getallnodes() # All entries in package.keywords all_overrides = settings.pkeywordsdict # List of packages to check for recent stabilization checklist = [] # Check all overrides for if they are installed and if package.keywords # makes them unstable with an unstable keyword. If not, the packages # are not of interest to us. Otherwise, add them to our checklist with # their current installed versions. unstable_keywords = ['~alpha', '~amd64', '~hppa', '~ia64', '~mips', \ '~ppc', '~ppc64', '~s390', '~sparc', '~x86'] for tuple in all_overrides.values(): for keylist in tuple.values(): for ukey in unstable_keywords: if ukey in keylist and tuple.keys()[0] in all_installed: checklist.append(vtree.dep_bestmatch(tuple.keys()[0])) # We clear all keywords from this instance of portage and check # if the package version has a masking status. If not, the package # should have stabilized. settings.pkeywordsdict.clear() stabs = [] for pkg in checklist: if getmaskingstatus(pkg) == []: stabs.append(pkg) def notice(text): print green(" *"), text if len(stabs) > 0: print "" notice("I found packages that have been stabilized since your") notice("installation of them as unstable ones. If you want to") notice("switch to the stable branch of an affected package, you") notice("have to remove its entry in package.keywords.") print "" notice("If you want to keep track of the unstable branch, just") notice("ignore this warning and update your world.") print "" print " The following package have stabilized:" print "" for pkg in stabs: print green(" *"), bold(pkg) print "" else: print green("*"), bold("No packages stabilized")