Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(709)

Unified Diff: pym/_emerge/main.py

Issue 6577024: Add --nousepkg-atoms, --useoldpkg-atoms and --reinstall-atoms flag to Portage (Closed) Base URL: http://git.chromium.org/git/portage_tool.git@cros-2.1.9
Patch Set: Add --useoldpkg-atoms as well Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pym/_emerge/depgraph.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pym/_emerge/main.py
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 40266943f00172499cbbf915c598802d0aeb1c7a..2f370b6f8b799557257ff70b54a820506010460e 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -511,6 +511,23 @@ def insert_optional_args(args):
return new_args
+def _find_bad_atoms(atoms):
+ bad_atoms = []
+ for x in ' '.join(atoms).split():
+ bad_atom = False
+ try:
+ atom = portage.dep.Atom(x, allow_wildcard=True)
+ except portage.exception.InvalidAtom:
+ try:
+ atom = portage.dep.Atom("*/"+x, allow_wildcard=True)
+ except portage.exception.InvalidAtom:
+ bad_atom = True
+
+ if bad_atom or atom.operator or atom.blocker or atom.use:
+ bad_atoms.append(x)
+ return bad_atoms
+
+
def parse_opts(tmpcmdline, silent=False):
myaction=None
myopts = {}
@@ -640,6 +657,14 @@ def parse_opts(tmpcmdline, silent=False):
"choices":["changed-use"]
},
+ "--reinstall-atoms": {
+ "help" :"A space separated list of package names or slot atoms. " + \
+ "Emerge will treat matching packages as if they are not " + \
+ "installed, and reinstall them if necessary. Implies --deep.",
+
+ "action" : "append",
+ },
+
"--binpkg-respect-use": {
"help" : "discard binary packages if their use flags \
don't match the current configuration",
@@ -661,6 +686,13 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : true_y_or_n
},
+ "--nousepkg-atoms": {
+ "help" :"A space separated list of package names or slot atoms. " + \
+ "Emerge will ignore matching binary packages. ",
+
+ "action" : "append",
+ },
+
"--package-moves": {
"help" : "perform package moves when necessary",
"type" : "choice",
@@ -711,6 +743,13 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : true_y_or_n
},
+ "--useoldpkg-atoms": {
+ "help" :"A space separated list of package names or slot atoms. " + \
+ "Emerge will prefer matching binary packages over newer unbuilt packages. ",
+
+ "action" : "append",
+ },
+
"--usepkg": {
"shortopt" : "-k",
"help" : "use binary packages",
@@ -794,32 +833,28 @@ def parse_opts(tmpcmdline, silent=False):
myoptions.depclean_lib_check = True
if myoptions.exclude:
- exclude = []
- bad_atoms = []
- for x in ' '.join(myoptions.exclude).split():
- bad_atom = False
- try:
- atom = portage.dep.Atom(x, allow_wildcard=True)
- except portage.exception.InvalidAtom:
- try:
- atom = portage.dep.Atom("*/"+x, allow_wildcard=True)
- 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)
-
+ bad_atoms = _find_bad_atoms(myoptions.exclude)
if bad_atoms and not silent:
parser.error("Invalid Atom(s) in --exclude parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
(",".join(bad_atoms),))
- if myoptions.fail_clean in true_y:
- myoptions.fail_clean = True
+ if myoptions.reinstall_atoms:
+ bad_atoms = _find_bad_atoms(myoptions.reinstall_atoms)
+ if bad_atoms and not silent:
+ parser.error("Invalid Atom(s) in --reinstall-atoms parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
+ (",".join(bad_atoms),))
+
+ if myoptions.nousepkg_atoms:
+ bad_atoms = _find_bad_atoms(myoptions.nousepkg_atoms)
+ if bad_atoms and not silent:
+ parser.error("Invalid Atom(s) in --nousepkg-atoms parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
+ (",".join(bad_atoms),))
+
+ if myoptions.useoldpkg_atoms:
+ bad_atoms = _find_bad_atoms(myoptions.useoldpkg_atoms)
+ if bad_atoms and not silent:
+ parser.error("Invalid Atom(s) in --useoldpkg-atoms parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
+ (",".join(bad_atoms),))
if myoptions.getbinpkg in true_y:
myoptions.getbinpkg = True
« no previous file with comments | « pym/_emerge/depgraph.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698