X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fgenerate_releases.py;h=b21f30a5483f11ab5997bb393fbcb603473bd252;hb=e1156b3b857f5496a299e621d291cff0ba957d23;hp=07220a1d5ec7f1f596622aac9e890613ed40ef5e;hpb=b4022bd29f8d8b8b6923c943071f7e9849c9d244;p=dak.git diff --git a/dak/generate_releases.py b/dak/generate_releases.py index 07220a1d..b21f30a5 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -138,9 +138,9 @@ class ReleaseWriter(object): ('Codename', 'codename') ) # A "Sub" Release file has slightly different fields - subattribs = ( ('Origin', 'origin'), + subattribs = ( ('Archive', 'suite_name'), + ('Origin', 'origin'), ('Label', 'label'), - ('Archive', 'suite_name'), ('Version', 'version') ) # Boolean stuff. If we find it true in database, write out "yes" into the release file @@ -149,8 +149,9 @@ class ReleaseWriter(object): cnf = Config() - outfile = os.path.join("/tmp/mhy", cnf["Dir::Root"][1:], 'dists', suite.suite_name, "Release") - print outfile + suite_suffix = "%s" % (cnf.Find("Dinstall::SuiteSuffix")) + + outfile = os.path.join(cnf["Dir::Root"], 'dists', "%s/%s" % (suite.suite_name, suite_suffix), "Release") out = open(outfile, "w") for key, dbfield in attribs: @@ -169,8 +170,6 @@ class ReleaseWriter(object): out.write("Architectures: %s\n" % (" ".join([a.arch_string for a in architectures]))) - suite_suffix = "%s" % (cnf.Find("Dinstall::SuiteSuffix")) - ## FIXME: Components need to be adjusted to whatever will be in the db ## Needs putting in the DB components = ['main', 'contrib', 'non-free'] @@ -183,12 +182,12 @@ class ReleaseWriter(object): out.write("Description: %s\n" % suite.description) for comp in components: - for dirpath, dirnames, filenames in os.walk("%sdists/%s/%s" % (cnf["Dir::Root"], suite.suite_name, comp), topdown=True): + for dirpath, dirnames, filenames in os.walk("%sdists/%s/%s%s" % (cnf["Dir::Root"], suite.suite_name, suite_suffix, comp), topdown=True): if not re_gensubrelease.match(dirpath): continue - subfile = os.path.join("/tmp/mhy", dirpath[1:], "Release") - subrel = open(subfile, "w") + subfile = os.path.join(dirpath, "Release") + subrel = open(subfile + '.new', "w") for key, dbfield in subattribs: if getattr(suite, dbfield) is not None: @@ -199,13 +198,23 @@ class ReleaseWriter(object): subrel.write("%s: yes\n" % (key)) subrel.write("Component: %s%s\n" % (suite_suffix, comp)) + + # Urgh, but until we have all the suite/component/arch stuff in the DB, + # this'll have to do + arch = os.path.split(dirpath)[-1] + if arch.startswith('binary-'): + arch = arch[7:] + + subrel.write("Architecture: %s\n" % (arch)) subrel.close() + os.rename(subfile + '.new', subfile) + # Now that we have done the groundwork, we want to get off and add the files with # their checksums to the main Release file oldcwd = os.getcwd() - os.chdir("%sdists/%s" % (cnf["Dir::Root"], suite.suite_name)) + os.chdir("%sdists/%s/%s" % (cnf["Dir::Root"], suite.suite_name, suite_suffix)) hashfuncs = { 'MD5Sum' : apt_pkg.md5sum, 'SHA1' : apt_pkg.sha1sum,