Blame SOURCES/BZ-1083182-traceback-on-nonexisting-pkglist.patch

485652
commit a45146a2e7bd623c72823edbeef1f22753625d78
485652
Author: Zdenek Pavlas <zpavlas@redhat.com>
485652
Date:   Thu Dec 19 15:48:52 2013 +0100
485652
485652
    catch IOErrors when loading pkglist. BZ 1044997
485652
485652
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
485652
index 946f6b6..35e7fc9 100755
485652
--- a/genpkgmetadata.py
485652
+++ b/genpkgmetadata.py
485652
@@ -199,14 +199,15 @@ def parse_args(args, conf):
485652
 
485652
     lst = []
485652
     if conf.pkglist:
485652
-        pfo = open(conf.pkglist, 'r')
485652
-        for line in pfo.readlines():
485652
-            line = line.strip()
485652
-            if re.match('^\s*\#.*', line) or re.match('^\s*$', line):
485652
-                continue
485652
-            lst.append(line)
485652
-        pfo.close()
485652
-
485652
+        try:
485652
+            for line in open(conf.pkglist):
485652
+                line = line.strip()
485652
+                if re.match('^\s*\#.*', line) or re.match('^\s*$', line):
485652
+                    continue
485652
+                lst.append(line)
485652
+        except EnvironmentError, e:
485652
+            print >> sys.stderr, e
485652
+            sys.exit(1)
485652
     conf.pkglist = lst
485652
 
485652
     if conf.includepkg: