################################################################################
-import errno, os, re, sys
-import utils
+import errno, os, pg, re, sys, md5
import apt_pkg, apt_inst
-import pg, database
+import daklib.database, daklib.utils
################################################################################
Cnf = None
projectB = None
-Cnf = utils.get_conf()
+Cnf = daklib.utils.get_conf()
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
-database.init(Cnf, projectB)
+daklib.database.init(Cnf, projectB)
+
+printed_copyrights = {}
################################################################################
maintainer = ''
arch = ''
- deb_file = utils.open_file(filename)
+ deb_file = daklib.utils.open_file(filename)
try:
extracts = apt_inst.debExtractControl(deb_file)
control = apt_pkg.ParseSection(extracts)
def read_dsc (dsc_filename):
dsc = {}
- dsc_file = utils.open_file(dsc_filename)
+ dsc_file = daklib.utils.open_file(dsc_filename)
try:
- dsc = utils.parse_changes(dsc_filename)
+ dsc = daklib.utils.parse_changes(dsc_filename)
except:
print "can't parse control info"
dsc_file.close()
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) and printed_copyrights[copyrightmd5] != "%s (%s)" % (package, deb_filename):
+ print "NOTE: Copyright is the same as %s.\n" % \
+ (printed_copyrights[copyrightmd5])
+ else:
+ printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename)
+
+ print copyright
def check_dsc (dsc_filename):
print "---- .dsc file for %s ----" % (dsc_filename)
output_deb_info(deb_filename)
if is_a_udeb:
- print "---- skipping lintian check for µdeb ----"
+ print "---- skipping lintian check for udeb ----"
print
else:
print "---- lintian check for %s ----" % (filename)
- do_command ("lintian", deb_filename)
+ do_command ("lintian --show-overrides --color always", deb_filename)
print "---- linda check for %s ----" % (filename)
do_command ("linda", deb_filename)
do_command ("dpkg -c", deb_filename)
if is_a_udeb:
- print "---- skipping copyright for µdeb ----"
+ print "---- skipping copyright for udeb ----"
else:
print "---- copyright of %s ----" % (filename)
print_copyright(deb_filename)
# Read a file, strip the signature and return the modified contents as
# a string.
def strip_pgp_signature (filename):
- file = utils.open_file (filename)
+ file = daklib.utils.open_file (filename)
contents = ""
inside_signature = 0
skip_next = 0
def check_changes (changes_filename):
display_changes(changes_filename)
- changes = utils.parse_changes (changes_filename)
- files = utils.build_file_list(changes)
+ changes = daklib.utils.parse_changes (changes_filename)
+ files = daklib.utils.build_file_list(changes)
for file in files.keys():
if file.endswith(".deb") or file.endswith(".udeb"):
check_deb(file)
def main ():
global Cnf, projectB, db_files, waste, excluded
-# Cnf = utils.get_conf()
+# Cnf = daklib.utils.get_conf()
Arguments = [('h',"help","Examine-Package::Options::Help")]
for i in [ "help" ]:
elif file.endswith(".dsc"):
check_dsc(file)
else:
- utils.fubar("Unrecognised file type: '%s'." % (file))
+ daklib.utils.fubar("Unrecognised file type: '%s'." % (file))
finally:
# Reset stdout here so future less invocations aren't FUBAR
less_fd.close()
sys.stdout = stdout_fd
except IOError, e:
if errno.errorcode[e.errno] == 'EPIPE':
- utils.warn("[examine-package] Caught EPIPE; skipping.")
+ daklib.utils.warn("[examine-package] Caught EPIPE; skipping.")
pass
else:
raise
except KeyboardInterrupt:
- utils.warn("[examine-package] Caught C-c; skipping.")
+ daklib.utils.warn("[examine-package] Caught C-c; skipping.")
pass
#######################################################################################