]> git.decadent.org.uk Git - dak.git/blobdiff - dak/generate_releases.py
[ajt] handle udebs in any component in generate_releases
[dak.git] / dak / generate_releases.py
index 6ca6d3d320c075c0e76761a2ec8d25dbfadfcc0b..094c05644c8fde9a9932f225d10c8de7dc507d5c 100755 (executable)
@@ -23,8 +23,8 @@
 ################################################################################
 
 import sys, os, popen2, tempfile, stat, time
-import dak.lib.utils
 import apt_pkg
+import daklib.utils
 
 ################################################################################
 
@@ -104,13 +104,13 @@ def print_md5sha_files (tree, files, hashop):
                    (cat, path, name, ext))
            else:
                size = os.stat(path + name)[stat.ST_SIZE]
-                       file_handle = dak.lib.utils.open_file(path + name)
-        except dak.lib.utils.cant_open_exc:
+                       file_handle = daklib.utils.open_file(path + name)
+        except daklib.utils.cant_open_exc:
             print "ALERT: Couldn't open " + path + name
         else:
            hash = hashop(file_handle)
            file_handle.close()
-           out.write(" %s         %8d %s\n" % (hash, size, name))
+           out.write(" %s %8d %s\n" % (hash, size, name))
 
 def print_md5_files (tree, files):
     print_md5sha_files (tree, files, apt_pkg.md5sum)
@@ -118,13 +118,16 @@ def print_md5_files (tree, files):
 def print_sha1_files (tree, files):
     print_md5sha_files (tree, files, apt_pkg.sha1sum)
 
+def print_sha256_files (tree, files):
+    print_md5sha_files (tree, files, apt_pkg.sha256sum)
+
 ################################################################################
 
 def main ():
     global Cnf, AptCnf, projectB, out
     out = sys.stdout
 
-    Cnf = dak.lib.utils.get_conf()
+    Cnf = daklib.utils.get_conf()
 
     Arguments = [('h',"help","Generate-Releases::Options::Help")]
     for i in [ "help" ]:
@@ -138,7 +141,7 @@ def main ():
        usage()
 
     AptCnf = apt_pkg.newConfiguration()
-    apt_pkg.ReadConfigFileISC(AptCnf,dak.lib.utils.which_apt_conf_file())
+    apt_pkg.ReadConfigFileISC(AptCnf,daklib.utils.which_apt_conf_file())
 
     if not suites:
         suites = Cnf.SubTree("Suite").List()
@@ -181,7 +184,7 @@ def main ():
        elif AptCnf.has_key("bindirectory::%s" % (tree)):
            pass
        else:
-            aptcnf_filename = os.path.basename(dak.lib.utils.which_apt_conf_file())
+            aptcnf_filename = os.path.basename(daklib.utils.which_apt_conf_file())
            print "ALERT: suite %s not in %s, nor untouchable!" % (suite, aptcnf_filename)
            continue
 
@@ -198,7 +201,7 @@ def main ():
        out.write("Date: %s\n" % (time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time()))))
        if notautomatic != "":
            out.write("NotAutomatic: %s\n" % (notautomatic))
-       out.write("Architectures: %s\n" % (" ".join(filter(dak.lib.utils.real_arch, SuiteBlock.ValueList("Architectures")))))
+       out.write("Architectures: %s\n" % (" ".join(filter(daklib.utils.real_arch, SuiteBlock.ValueList("Architectures")))))
        if components:
             out.write("Components: %s\n" % (" ".join(components)))
 
@@ -237,7 +240,7 @@ def main ():
                         release = open(relpath, "w")
                         #release = open(longsuite.replace("/","_") + "_" + arch + "_" + sec + "_Release", "w")
                     except IOError:
-                        dak.lib.utils.fubar("Couldn't write to " + relpath)
+                        daklib.utils.fubar("Couldn't write to " + relpath)
 
                     release.write("Archive: %s\n" % (suite))
                     if version != "":
@@ -255,14 +258,18 @@ def main ():
                     files.append(rel)
 
            if AptCnf.has_key("tree::%s/main" % (tree)):
-               sec = AptCnf["tree::%s/main::Sections" % (tree)].split()[0]
-               if sec != "debian-installer":
-                   print "ALERT: weird non debian-installer section in %s" % (tree)
-
-               for arch in AptCnf["tree::%s/main::Architectures" % (tree)].split():
-                   if arch != "source":  # always true
-                       for file in compressnames("tree::%s/main" % (tree), "Packages", "main/%s/binary-%s/Packages" % (sec, arch)):
-                           files.append(file)
+               for dis in ["main", "contrib", "non-free"]:
+                   if not AptCnf.has_key("tree::%s/%s" % (tree, dis)): continue
+                   sec = AptCnf["tree::%s/%s::Sections" % (tree,dis)].split()[0]
+                   if sec != "debian-installer":
+                       print "ALERT: weird non debian-installer section in %s" % (tree)
+
+                   for arch in AptCnf["tree::%s/%s::Architectures" % (tree,dis)].split():
+                       if arch != "source":  # always true
+                           for file in compressnames("tree::%s/%s" % (tree,dis),
+                               "Packages", 
+                               "%s/%s/binary-%s/Packages" % (dis, sec, arch)):
+                               files.append(file)
            elif AptCnf.has_key("tree::%s::FakeDI" % (tree)):
                usetree = AptCnf["tree::%s::FakeDI" % (tree)]
                sec = AptCnf["tree::%s/main::Sections" % (usetree)].split()[0]
@@ -286,6 +293,8 @@ def main ():
        print_md5_files(tree, files)
        out.write("SHA1:\n")
        print_sha1_files(tree, files)
+       out.write("SHA256:\n")
+       print_sha256_files(tree, files)
 
        out.close()
        if Cnf.has_key("Dinstall::SigningKeyring"):