]> err.no Git - dak/commitdiff
move logic into a function
authorMark Hymers <mhy@debian.org>
Sat, 21 Feb 2009 21:00:38 +0000 (21:00 +0000)
committerMark Hymers <mhy@debian.org>
Sat, 21 Feb 2009 21:00:38 +0000 (21:00 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/process_accepted.py
dak/process_unchecked.py
daklib/utils.py

index 07d611d5f0bac72c2d88f48de6f7288bc94c599b..e53a969f48c1f35a88d292c3cb94d3ce86b3d855 100755 (executable)
@@ -183,13 +183,7 @@ def init():
         if len(changes_files) > 0:
             utils.warn("Directory provided so ignoring files given on command line")
 
-        dir = Cnf["Dinstall::Options::Directory"]
-        try:
-            # Much of the rest of p-a depends on being in the right place
-            os.chdir(dir)
-            changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
-        except OSError, e:
-            utils.fubar("Failed to read list from directory %s (%s)" % (dir, e))
+        changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
 
     Upload = queue.Upload(Cnf)
     projectB = Upload.projectB
index e04572604648a4bb226e00d2bee70c3f122d38af..c2adb6393529d0ab6dc264f84d5b2933b79316d0 100755 (executable)
@@ -98,13 +98,7 @@ def init():
         if len(changes_files) > 0:
             utils.warn("Directory provided so ignoring files given on command line")
 
-        dir = Cnf["Dinstall::Options::Directory"]
-        try:
-            # Much of the rest of p-u depends on being in the right place
-            os.chdir(dir)
-            changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
-        except OSError, e:
-            utils.fubar("Failed to read list from directory %s (%s)" % (dir, e))
+        changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
 
     Upload = queue.Upload(Cnf)
 
index e0bdfe8412dca1f5f062ac249f16eb8714b04cec..963abd5db40469c3484b52254d078b280c5728b9 100755 (executable)
@@ -1498,6 +1498,18 @@ def is_email_alias(email):
 
 ################################################################################
 
+def get_changes_files(dir):
+    try:
+        # Much of the rest of p-u/p-a depends on being in the right place
+        os.chdir(dir)
+        changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
+    except OSError, e:
+        fubar("Failed to read list from directory %s (%s)" % (dir, e))
+
+    return changes_files
+
+################################################################################
+
 apt_pkg.init()
 
 Cnf = apt_pkg.newConfiguration()