X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fchanges.py;h=59c7da17d15da775e7a3e4d843f4f643e3894210;hb=68ef7be81d7e958d0147d92ee5f6919746448377;hp=5cd26e2a69e071689e5adba343f0590a1973b3f1;hpb=3b1a95b1ac0b05ca86ac1fde96ca51fdae429ccd;p=dak.git diff --git a/daklib/changes.py b/daklib/changes.py index 5cd26e2a..59c7da17 100755 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -76,6 +76,10 @@ CHANGESFIELDS_DSCFILES_OPTIONAL = [ "files id" ] __all__.append('CHANGESFIELDS_DSCFILES_OPTIONAL') +CHANGESFIELDS_ORIGFILES = [ "id", "location" ] + +__all__.append('CHANGESFIELDS_ORIGFILES') + ############################################################################### class Changes(object): @@ -91,10 +95,7 @@ class Changes(object): self.dsc = {} self.files = {} self.dsc_files = {} - - self.orig_tar_id = None - self.orig_tar_location = "" - self.orig_tar_gz = None + self.orig_files = {} def file_summary(self): # changes["distribution"] may not exist in corner cases @@ -150,7 +151,6 @@ class Changes(object): or the text of a warning if there are """ - conf = Config() summary = "" # Abandon the check if it's a non-sourceful upload @@ -166,7 +166,7 @@ class Changes(object): entry["override section"]) if entry["priority"] != "-": - if entry["priority"] != entry["override_priority"]: + if entry["priority"] != entry["override priority"]: summary += "%s: package says priority is %s, override says %s.\n" % (name, entry["priority"], entry["override priority"]) @@ -190,8 +190,24 @@ class Changes(object): self.files.update(p.load()) self.dsc_files.update(p.load()) - self.orig_tar_id = p.load() - self.orig_tar_location = p.load() + next_obj = p.load() + if type(next_obj) is DictType: + self.pkg.orig_files.update(next_obj) + else: + # Auto-convert old dak files to new format supporting + # multiple tarballs + orig_tar_gz = None + for dsc_file in self.dsc_files.keys(): + if dsc_file.endswith(".orig.tar.gz"): + orig_tar_gz = dsc_file + self.orig_files[orig_tar_gz] = {} + if next_obj != None: + self.orig_files[orig_tar_gz]["id"] = next_obj + next_obj = p.load() + if next_obj != None and next_obj != "": + self.orig_files[orig_tar_gz]["location"] = next_obj + if len(self.orig_files[orig_tar_gz]) == 0: + del self.orig_files[orig_tar_gz] dump_file.close() @@ -241,6 +257,17 @@ class Changes(object): return ret + def sanitised_orig_files(self): + ret = {} + for name, entry in self.orig_files.items(): + ret[name] = {} + # Optional orig_files fields + for i in CHANGESFIELDS_ORIGFILES: + if entry.has_key(i): + ret[name][i] = entry[i] + + return ret + def write_dot_dak(self, dest_dir): """ Dump ourself into a cPickle file. @@ -282,8 +309,7 @@ class Changes(object): p.dump(self.sanitised_dsc()) p.dump(self.sanitised_files()) p.dump(self.sanitised_dsc_files()) - p.dump(self.orig_tar_id) - p.dump(self.orig_tar_location) + p.dump(self.sanitised_orig_files()) dump_file.close()