summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/main.py
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-04-29 07:54:17 +0200
committerZac Medico <zmedico@gentoo.org>2010-04-29 05:54:01 -0700
commit87250d0cdfa74598f1564668cc446cd3ae1cf9a0 (patch)
treeffbaa9f1bc2c8d750d3aa5b80896e9b7f2f08a38 /pym/_emerge/main.py
parent13e7e7277b50c525c31588e52953b9defbe07e8b (diff)
downloadportage-87250d0cdfa74598f1564668cc446cd3ae1cf9a0.tar.gz
portage-87250d0cdfa74598f1564668cc446cd3ae1cf9a0.tar.bz2
portage-87250d0cdfa74598f1564668cc446cd3ae1cf9a0.zip
Add --exclude option
Diffstat (limited to 'pym/_emerge/main.py')
-rw-r--r--pym/_emerge/main.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 21888f590..11dc9a4f0 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -560,6 +560,14 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : ("True", "n")
},
+ "--exclude": {
+ "help" :"A comma separated list of package names or slot atoms. " + \
+ "Emerge won't install any ebuild or binary package that " + \
+ "matches any of the given package atoms.",
+
+ "action" : "store"
+ },
+
"--fail-clean": {
"help" : "clean temp files after build failure",
"type" : "choice",
@@ -724,6 +732,33 @@ def parse_opts(tmpcmdline, silent=False):
else:
myoptions.complete_graph = None
+ if myoptions.exclude:
+ exclude = []
+ bad_atoms = []
+ for x in myoptions.exclude.split(","):
+ bad_atom = False
+ try:
+ atom = portage.dep.Atom(x)
+ except portage.exception.InvalidAtom:
+ try:
+ atom = portage.dep.Atom("null/"+x)
+ except portage.exception.InvalidAtom:
+ bad_atom = True
+
+ if bad_atom:
+ bad_atoms.append(x)
+ else:
+ if atom.operator or atom.blocker or atom.use:
+ bad_atoms.append(x)
+ else:
+ exclude.append(atom)
+
+ if bad_atoms and not silent:
+ writemsg("!!! Invalid Atom(s) in --exclude parameter: '%s' (only package names and slot atoms allowed)\n" % \
+ (",".join(bad_atoms),), noiselevel=-1)
+
+ myoptions.exclude = exclude
+
if myoptions.fail_clean == "True":
myoptions.fail_clean = True