From: Anthony Towns Date: Tue, 28 Aug 2007 06:47:47 +0000 (+1000) Subject: * examine_package.py: Summarise duplicate copyright file entries X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b18bae735f509f17d35a3f80284cd9bd374bd3a6;p=dak.git * examine_package.py: Summarise duplicate copyright file entries (same md5sum) with a reference to the previous instance, rather than repeating them. --- diff --git a/ChangeLog b/ChangeLog index 64b9754e..469a418c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ processing. * config/debian/dak.conf, scripts/debian/byhand-tag: Automatic processing of tag-overrides. + * examine_package.py: Summarise duplicate copyright file entries + (same md5sum) with a reference to the previous instance, rather + than repeating them. 2007-06-19 Anthony Towns diff --git a/dak/examine_package.py b/dak/examine_package.py index e87cc281..ba2855d4 100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@ -32,7 +32,7 @@ ################################################################################ -import errno, os, pg, re, sys +import errno, os, pg, re, sys, md5 import apt_pkg, apt_inst import daklib.database, daklib.utils @@ -82,6 +82,8 @@ Cnf = daklib.utils.get_conf() projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) daklib.database.init(Cnf, projectB) +printed_copyrights = {} + ################################################################################ def usage (exit_code=0): @@ -302,7 +304,15 @@ def print_copyright (deb_filename): return o = os.popen("ar p %s data.tar.gz | tar xzOf - %s" % (deb_filename, copyright)) - print o.read() + copyright = o.read() + copyrightmd5 = md5.md5(copyright).hexdigest() + + if printed_copyrights.has_key(copyrightmd5): + print "Copyright is the same as %s.\n" % \ + (printed_copyrights[copyrightmd5]) + else: + print copyright + printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename) def check_dsc (dsc_filename): print "---- .dsc file for %s ----" % (dsc_filename)