]> git.decadent.org.uk Git - dak.git/commitdiff
* examine_package.py: Summarise duplicate copyright file entries
authorAnthony Towns <aj@azure.humbug.org.au>
Tue, 28 Aug 2007 06:47:47 +0000 (16:47 +1000)
committerAnthony Towns <aj@azure.humbug.org.au>
Tue, 28 Aug 2007 06:47:47 +0000 (16:47 +1000)
(same md5sum) with a reference to the previous instance, rather
than repeating them.

ChangeLog
dak/examine_package.py

index 64b9754ec73a250fec86c69aa81eafdbe30df5fc..469a418c8089b0df7cbd99606c301c81aedf5fe7 100644 (file)
--- 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  <ajt@debian.org>
 
index e87cc281e802e1dbeb554e4a51972f793bd2d358..ba2855d4aacdc3f9f567aca92b5c8d4f17e9fe0e 100755 (executable)
@@ -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)