[Yum-devel] [PATCH 2/2] Return exitcode for success in finding matching files.

Matěj Cepl mcepl at redhat.com
Wed Jul 24 09:08:26 UTC 2013


Returns 0 when it finds any packages matching the criteria, 1 when not.

Signed-off-by: Matěj Cepl <mcepl at redhat.com>
---
 repomanage.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/repomanage.py b/repomanage.py
index d4f6cb7..c95c3a1 100755
--- a/repomanage.py
+++ b/repomanage.py
@@ -203,8 +203,13 @@ def main(args):
             print '%s' % pkg,
         else:
             print pkg
-        
-    
+
+    if len(outputpackages) > 0:
+        return 0
+    else:
+        return 1
+
+
 def usage():
     print """
       repomanage [--old] [--new] path
@@ -223,4 +228,5 @@ if __name__ == "__main__":
         usage()
         sys.exit(1)
     else:
-        main(sys.argv[1:])
+        ret = main(sys.argv[1:])
+        sys.exit(ret)
-- 
1.8.3.GIT



More information about the Yum-devel mailing list