In order to know exactly which atoms/sets should be added to the
authorZac Medico <zmedico@gentoo.org>
Wed, 5 Dec 2007 00:52:24 +0000 (00:52 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 5 Dec 2007 00:52:24 +0000 (00:52 -0000)
world file, the depgraph performs set expansion later. It will get
confused about where the atoms came from if it's not allowed to
expand them itself.

svn path=/main/trunk/; revision=8844

pym/_emerge/__init__.py

index ee58ff75d510ff94e8ff77536d316390fcd328f7..481906a6cdba89d4e0a3c3b9f966e9d6a625c039 100644 (file)
@@ -6919,43 +6919,50 @@ def emerge_main():
                                print "emerge: incomplete set configuration, no \"%s\" set defined" % s
                                print "        sets defined: %s" % ", ".join(sets)
                                return 1
-               newargs = []
-               for a in myfiles:
-                       if a in ("system", "world"):
-                               newargs.append(SETPREFIX+a)
-                       else:
-                               newargs.append(a)
-               myfiles = newargs
-               del newargs
-               newargs = []
-               for a in myfiles:
-                       if a.startswith(SETPREFIX):
-                               s = a[len(SETPREFIX):]
-                               if s not in sets:
-                                       print "emerge: there are no sets to satisfy %s." % \
-                                               colorize("INFORM", s)
-                                       return 1
-                               if myaction in ["unmerge", "prune", "clean", "depclean"] and \
-                                               not sets[s].supportsOperation("unmerge"):
-                                       print "emerge: the given set %s does not support unmerge operations" % s
-                                       return 1
-                               if not setconfig.getSetAtoms(s):
-                                       print "emerge: '%s' is an empty set" % s
-                               elif myaction != None:
-                                       newargs.extend(setconfig.getSetAtoms(s))
+               unmerge_actions = ("unmerge", "prune", "clean", "depclean")
+               # In order to know exactly which atoms/sets should be added to the
+               # world file, the depgraph performs set expansion later. It will get
+               # confused about where the atoms came from if it's not allowed to
+               # expand them itself.
+               if myaction not in (None,):
+                       newargs = []
+                       for a in myfiles:
+                               if a in ("system", "world"):
+                                       newargs.append(SETPREFIX+a)
                                else:
-                                       newargs.append(SETPREFIX+s)
-                               for e in sets[s].errors:
-                                       print e
-                       else:
-                               newargs.append(a)
-               myfiles = newargs
-               del newargs
-               # Need to handle empty sets specially, otherwise emerge will react 
-               # with the help message for empty argument lists
-               if oldargs and not myfiles:
-                       print "emerge: no targets left after set expansion"
-                       return 0
+                                       newargs.append(a)
+                       myfiles = newargs
+                       del newargs
+                       newargs = []
+                       for a in myfiles:
+                               if a.startswith(SETPREFIX):
+                                       s = a[len(SETPREFIX):]
+                                       if s not in sets:
+                                               print "emerge: there are no sets to satisfy %s." % \
+                                                       colorize("INFORM", s)
+                                               return 1
+                                       if myaction in unmerge_actions and \
+                                                       not sets[s].supportsOperation("unmerge"):
+                                               sys.stderr.write("emerge: the given set %s does " + \
+                                                       "not support unmerge operations\n" % s)
+                                               return 1
+                                       if not setconfig.getSetAtoms(s):
+                                               print "emerge: '%s' is an empty set" % s
+                                       elif myaction != None:
+                                               newargs.extend(setconfig.getSetAtoms(s))
+                                       else:
+                                               newargs.append(SETPREFIX+s)
+                                       for e in sets[s].errors:
+                                               print e
+                               else:
+                                       newargs.append(a)
+                       myfiles = newargs
+                       del newargs
+                       # Need to handle empty sets specially, otherwise emerge will react 
+                       # with the help message for empty argument lists
+                       if oldargs and not myfiles:
+                               print "emerge: no targets left after set expansion"
+                               return 0
 
        if ("--tree" in myopts) and ("--columns" in myopts):
                print "emerge: can't specify both of \"--tree\" and \"--columns\"."