From: W. Trevor King Date: Tue, 22 Jul 2014 01:02:07 +0000 (-0700) Subject: empty-system.py: Add a @system-emptying script for trim.sh X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5ccecff9d00cf325828ab281b17428245a8869f0;p=dockerfile.git empty-system.py: Add a @system-emptying script for trim.sh --- diff --git a/empty-system.py b/empty-system.py new file mode 100755 index 0000000..7cfafbc --- /dev/null +++ b/empty-system.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# +# Previous discussion: +# * RFC: replacing "packages" 2007-10-24 +# http://thread.gmane.org/gmane.linux.gentoo.portage.devel/2575 +# * [RFC] Reducing the size of the system package set 2008-01-07 +# http://thread.gmane.org/gmane.linux.gentoo.devel/54035 +# * Re: remove system set? 2012-08-15 +# http://thread.gmane.org/gmane.linux.gentoo.devel/79186/focus=79412 +# * System packages in (R)DEPEND? 2008-10-12 +# http://thread.gmane.org/gmane.linux.gentoo.devel/58488 + +import portage +from portage._sets import load_default_config + +eroot = portage.settings['EROOT'] +trees = portage.db[eroot] +vartree = trees['vartree'] +settings = vartree.settings +settings._init_dirs() +setconfig = load_default_config(settings, trees) +sets = setconfig.getSets() +system = sets['system'] +with open('/etc/portage/make.profile/packages', 'w') as f: + for atom in system.getAtoms(): + f.write('-*{0}\n'.format(atom))