X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=jennifer;h=132752588faa5c1125c5e39e92d445d7d588ae82;hb=62c69fc3bb5fba75bc0ca305ed278246b3c5c974;hp=721d85c84c53f7aaf5247f51afacedfbd0964fbb;hpb=c06dd5b8fc75e69389949a046d6fe8ba9b01abf3;p=dak.git diff --git a/jennifer b/jennifer index 721d85c8..13275258 100755 --- a/jennifer +++ b/jennifer @@ -2,7 +2,7 @@ # Checks Debian packages from Incoming # Copyright (C) 2000, 2001, 2002, 2003 James Troup -# $Id: jennifer,v 1.31 2003-02-07 14:53:42 troup Exp $ +# $Id: jennifer,v 1.39 2003-10-14 19:16:16 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ ################################################################################ -import FCNTL, errno, fcntl, gzip, os, re, shutil, stat, sys, time, traceback; +import errno, fcntl, gzip, os, re, shutil, stat, sys, time, traceback; import apt_inst, apt_pkg; import db_access, katie, logging, utils; @@ -45,7 +45,7 @@ re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$"); ################################################################################ # Globals -jennifer_version = "$Revision: 1.31 $"; +jennifer_version = "$Revision: 1.39 $"; Cnf = None; Options = None; @@ -241,7 +241,7 @@ def check_changes(): base_filename = os.path.basename(filename); for dir in [ "Accepted", "Byhand", "Done", "New" ]: if os.path.exists(Cnf["Dir::Queue::%s" % (dir) ]+'/'+base_filename): - reject("a changes file with the same name already exists in the %s directory." % (dir)); + reject("%s: a file with this name already exists in the %s directory." % (base_filename, dir)); return 1; @@ -304,6 +304,8 @@ def check_files(): os.chdir(cwd); reprocess = 0; + has_binaries = 0; + has_source = 0; for file in file_keys: # Ensure the file does not already exist in one of the accepted directories @@ -329,6 +331,7 @@ def check_files(): files[file]["type"] = "byhand"; # Checks for a binary package... elif utils.re_isadeb.match(file) != None: + has_binaries = 1; files[file]["type"] = "deb"; # Extract package control information @@ -432,7 +435,7 @@ def check_files(): reject("source version (%s) for %s doesn't match changes version %s." % (source_version, file, changes["version"])); else: # Check in the SQL database - if not Katie.source_exists(source_package, source_version): + if not Katie.source_exists(source_package, source_version, changes["distribution"].keys()): # Check in one of the other directories source_epochless_version = utils.re_no_epoch.sub('', source_version); dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version); @@ -449,6 +452,7 @@ def check_files(): else: m = utils.re_issource.match(file); if m != None: + has_source = 1; files[file]["package"] = m.group(1); files[file]["version"] = m.group(2); files[file]["type"] = m.group(3); @@ -497,7 +501,7 @@ def check_files(): if Cnf.has_key("Suite:%s::Components" % (suite)) and \ files[file]["component"] not in Cnf.ValueList("Suite::%s::Components" % (suite)): reject("unknown component `%s' for suite `%s'." % (files[file]["component"], suite)); - continue + continue; # See if the package is NEW if not Katie.in_override_p(files[file]["package"], files[file]["component"], suite, files[file].get("dbtype",""), file): @@ -546,13 +550,12 @@ SELECT c.name FROM binaries b, bin_associations ba, suite s, location l, # If the .changes file says it has source, it must have source. if changes["architecture"].has_key("source"): - has_source = 0; - for file in file_keys: - if files[file]["type"] == "dsc": - has_source = 1; if not has_source: reject("no source found and Architecture line in changes mention source."); + if not has_binaries and Cnf.FindB("Dinstall::Reject::NoSourceOnly"): + reject("source only uploads are not supported."); + ############################################################################### def check_dsc (): @@ -596,13 +599,25 @@ def check_dsc (): if dsc.has_key("version") and not re_valid_version.match(dsc["version"]): reject("%s: invalid version number '%s'." % (file, dsc["version"])); - # The dpkg maintainer from hell strikes again! Bumping the - # version number of the .dsc breaks extraction by stable's - # dpkg-source. + # Bumping the version number of the .dsc breaks extraction by stable's + # dpkg-source. So let's not do that... if dsc["format"] != "1.0": - reject("""[dpkg-sucks] source package was produced by a broken version - of dpkg-dev 1.9.1{3,4}; please rebuild with >= 1.9.15 version - installed."""); + reject("%s: incompatible 'Format' version produced by a broken version of dpkg-dev 1.9.1{3,4}." % (file)); + + # Validate the build-depends field(s) + for field_name in [ "build-depends", "build-depends-indep" ]: + field = dsc.get(field_name); + if field: + # Check for broken dpkg-dev lossage... + if field.find("ARRAY") == 0: + reject("%s: invalid %s field produced by a broken version of dpkg-dev (1.10.11)" % (file, field_name.title())); + + # Have apt try to parse them... + try: + apt_pkg.ParseSrcDepends(field); + except: + reject("%s: invalid %s field (can not be parsed by apt)." % (file, field_name.title())); + pass; # Ensure the version number in the .dsc matches the version number in the .changes epochless_dsc_version = utils.re_no_epoch.sub('', dsc.get("version")); @@ -642,19 +657,16 @@ def check_dsc (): ################################################################################ -# Some cunning stunt broke dpkg-source in dpkg 1.8{,.1}; detect the +# dpkg-source broke .diff.gz generation in dpkg 1.8.x; detect the # resulting bad source packages and reject them. -# Even more amusingly the fix in 1.8.1.1 didn't actually fix the -# problem just changed the symptoms. - def check_diff (): for filename in files.keys(): if files[filename]["type"] == "diff.gz": file = gzip.GzipFile(filename, 'r'); for line in file.readlines(): if re_bad_diff.search(line): - reject("[dpkg-sucks] source package was produced by a broken version of dpkg-dev 1.8.x; please rebuild with >= 1.8.3 version installed."); + reject("%s: invalid .diff.gz produced by a broken version of dpkg-dev 1.8.x." % (filename)); break; ################################################################################ @@ -762,7 +774,7 @@ def check_timestamps(): % (filename, num_ancient_files, ancient_file, time.ctime(ancient_date))); except: - reject("%s: timestamp check failed; caught %s" % (filename, sys.exc_type)); + reject("%s: deb contents timestamp check failed [%s: %s]" % (filename, sys.exc_type, sys.exc_value)); ################################################################################ ################################################################################ @@ -912,7 +924,7 @@ def acknowledge_new (summary): print "Sending new ack."; Subst["__SUMMARY__"] = summary; new_ack_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/jennifer.new"); - utils.send_mail(new_ack_message,""); + utils.send_mail(new_ack_message); # Finally remove the originals. os.chdir (pkg.directory); @@ -1008,7 +1020,13 @@ def main(): if not Options["No-Action"]: lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT); - fcntl.lockf(lock_fd, FCNTL.F_TLOCK); + try: + fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB); + except IOError, e: + if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN': + utils.fubar("Couldn't obtain lock; assuming another jennifer is already running."); + else: + raise; Logger = Katie.Logger = logging.Logger(Cnf, "jennifer"); # debian-{devel-,}-changes@lists.debian.org toggles writes access based on this header