]> git.decadent.org.uk Git - dak.git/blobdiff - dak/poolize.py
Merge branch 'psycopg2' into content_generation
[dak.git] / dak / poolize.py
index 1a445eab0d3ea7b093ea2d1942ff93913c977f86..ef41d7421198835f78c516d5ed09d230f2910bc4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Poolify (move packages from "legacy" type locations to pool locations)
+""" Poolify (move packages from "legacy" type locations to pool locations) """
 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006  James Troup <james@nocrew.org>
 
 # This program is free software; you can redistribute it and/or modify
@@ -29,14 +29,13 @@ import os, pg, re, stat, sys
 import apt_pkg, apt_inst
 import daklib.database
 import daklib.utils
+from daklib.regexes import re_isadeb, re_extract_src_version, re_no_epoch, re_issource
 
 ################################################################################
 
 Cnf = None
 projectB = None
 
-re_isadeb = re.compile (r"(.+?)_(.+?)(_(.+))?\.u?deb$")
-
 ################################################################################
 
 def usage (exit_code=0):
@@ -84,17 +83,17 @@ def poolize (q, limit, verbose, no_action):
             package = control.Find("Package", "")
             source = control.Find("Source", package)
             if source.find("(") != -1:
-                m = daklib.utils.re_extract_src_version.match(source)
+                m = re_extract_src_version.match(source)
                 source = m.group(1)
             # If it's a binary, we need to also rename the file to include the architecture
             version = control.Find("Version", "")
             architecture = control.Find("Architecture", "")
             if package == "" or version == "" or architecture == "":
                 daklib.utils.fubar("%s: couldn't determine required information to rename .deb file." % (legacy_filename))
-            version = daklib.utils.re_no_epoch.sub('', version)
+            version = re_no_epoch.sub('', version)
             destination_filename = "%s_%s_%s.deb" % (package, version, architecture)
         else:
-            m = daklib.utils.re_issource.match(base_filename)
+            m = re_issource.match(base_filename)
             if m:
                 source = m.group(1)
             else:
@@ -141,8 +140,8 @@ def main ():
     Cnf = daklib.utils.get_conf()
 
     for i in ["help", "limit", "no-action", "verbose" ]:
-       if not Cnf.has_key("Poolize::Options::%s" % (i)):
-           Cnf["Poolize::Options::%s" % (i)] = ""
+        if not Cnf.has_key("Poolize::Options::%s" % (i)):
+            Cnf["Poolize::Options::%s" % (i)] = ""
 
 
     Arguments = [('h',"help","Poolize::Options::Help"),
@@ -190,4 +189,3 @@ UNION SELECT l.path, f.filename, f.id as files_id, null as component
 
 if __name__ == '__main__':
     main()
-