pld-ftp-admin: bin/pfa-lintpkg - unlock tree on exception

glen glen at pld-linux.org
Sat Feb 12 20:18:14 CET 2011


Author: glen                         Date: Sat Feb 12 19:18:14 2011 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- unlock tree on exception

---- Files affected:
pld-ftp-admin/bin:
   pfa-lintpkg (1.9 -> 1.10) 

---- Diffs:

================================================================
Index: pld-ftp-admin/bin/pfa-lintpkg
diff -u pld-ftp-admin/bin/pfa-lintpkg:1.9 pld-ftp-admin/bin/pfa-lintpkg:1.10
--- pld-ftp-admin/bin/pfa-lintpkg:1.9	Sat Feb 12 19:59:39 2011
+++ pld-ftp-admin/bin/pfa-lintpkg	Sat Feb 12 20:18:09 2011
@@ -145,22 +145,26 @@
             rc = 1
         return rc == 0
 
-lock = 'rpmlint:'+treename
-if not ftpio.lock(lock, True):
-    print >>sys.stderr, "ERR: %s tree already locked for rpmlint" % treename
-    sys.exit(1)
+try:
+    lock = 'rpmlint:'+treename
+    if not ftpio.lock(lock, True):
+        print >>sys.stderr, "ERR: %s tree already locked for rpmlint" % treename
+        sys.exit(1)
 
-if not quiet:
-    print "rpmlint of %d files from %d packages" % (len(files), len(tree.loadedpkgs))
-lint = LintPkg("~/tmp/rpmlint")
-for file in files:
-    lint.rpmlint(file)
     if not quiet:
-        lint.print_stats(file)
-    if show:
-        lint.show_results(file)
+        print "rpmlint of %d files from %d packages" % (len(files), len(tree.loadedpkgs))
+    lint = LintPkg("~/tmp/rpmlint")
+    for file in files:
+        lint.rpmlint(file)
+        if not quiet:
+            lint.print_stats(file)
+        if show:
+            lint.show_results(file)
 
-if not quiet:
-    lint.print_stats()
+    if not quiet:
+        lint.print_stats()
 
-ftpio.unlock(lock)
+    ftpio.unlock(lock)
+except Exception:
+    ftpio.unlock(lock)
+    raise
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/bin/pfa-lintpkg?r1=1.9&r2=1.10&f=u



More information about the pld-cvs-commit mailing list