action_depclean: fix return code
authorZac Medico <zmedico@gentoo.org>
Fri, 2 Dec 2011 18:30:25 +0000 (10:30 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 2 Dec 2011 18:30:25 +0000 (10:30 -0800)
The fixes some cases where emerge.log would show that depclean was
unsuccessful when it was really successful but there was nothing to
remove.

pym/_emerge/actions.py
pym/_emerge/unmerge.py

index ba2e631f2f6be1f89fd3290e8a016290e44b5b93..a62b305107c42c6bca836236802377e36960b905 100644 (file)
@@ -588,15 +588,18 @@ def action_depclean(settings, trees, ldpath_mtimes,
                return rval
 
        if cleanlist:
-               unmerge(root_config, myopts, "unmerge",
+               if unmerge(root_config, myopts, "unmerge",
                        cleanlist, ldpath_mtimes, ordered=ordered,
-                       scheduler=scheduler)
+                       scheduler=scheduler):
+                       rval = os.EX_OK
+               else:
+                       rval = 1
 
        if action == "prune":
-               return
+               return rval
 
        if not cleanlist and "--quiet" in myopts:
-               return
+               return rval
 
        print("Packages installed:   " + str(len(vardb.cpv_all())))
        print("Packages in world:    " + \
@@ -609,6 +612,8 @@ def action_depclean(settings, trees, ldpath_mtimes,
        else:
                print("Number removed:       "+str(len(cleanlist)))
 
+       return rval
+
 def calc_depclean(settings, trees, ldpath_mtimes,
        myopts, action, args_set, spinner):
        allow_missing_deps = bool(args_set)
index 852ad936a8f6ecee8ed1f3f6419f525ab19abe10..c76afdf738f54ba820a8b6d8539d72e0ce354358 100644 (file)
@@ -526,7 +526,7 @@ def unmerge(root_config, myopts, unmerge_action,
 
        if "--pretend" in myopts:
                #we're done... return
-               return 0
+               return 1
        if "--ask" in myopts:
                if userquery("Would you like to unmerge these packages?",
                        enter_invalid) == "No":