X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=jennifer;h=a2fb8dc025dba42a19d57db081ac798065f3f061;hb=79011f8bc9062017ac69772b61288b533b0851f3;hp=8e55ece0d69b6e509d025def27e66d0d747f884d;hpb=6e9b8f62a83fe45787ee884ac97d888536b0d30a;p=dak.git diff --git a/jennifer b/jennifer index 8e55ece0..a2fb8dc0 100755 --- a/jennifer +++ b/jennifer @@ -2,7 +2,7 @@ # Checks Debian packages from Incoming # Copyright (C) 2000, 2001 James Troup -# $Id: jennifer,v 1.4 2002-02-22 01:03:20 troup Exp $ +# $Id: jennifer,v 1.13 2002-04-16 17:35: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 @@ -44,7 +44,7 @@ re_is_changes = re.compile (r"(.+?)_(.+?)_(.+?)\.changes$"); ################################################################################ # Globals -jennifer_version = "$Revision: 1.4 $"; +jennifer_version = "$Revision: 1.13 $"; Cnf = None; Options = None; @@ -459,30 +459,12 @@ def check_changes(): changes["chopversion"] = utils.re_no_epoch.sub('', changes["version"]) changes["chopversion2"] = utils.re_no_revision.sub('', changes["chopversion"]) - # Ensure the changes filename matches it's contents. - - base_filename = os.path.basename(filename); - m = re_is_changes.match(base_filename); - # source package name - if m: - file_source = m.group(1); - if changes["source"] != file_source: - reject("package name part of changes filename (%s) does not match source field (%s) in the changes file." % (file_source, changes["source"])); - # source version - file_version = m.group(2); - if changes["chopversion"] != file_version: - reject("version part of changes filename (%s) does not match version field (%s) in the changes file." % (file_version, changes["chopversion"])); - else: - reject("invalid changes filename '%s'." % (filename)); - - # But ... we can't check architecture because there's no - # established policy or practice on how to handle - # multi-architecture uploads. Instead we check what we can and - # reject if there's a changes file of the same name already in one + # Check there isn't already a changes file of the same name in one # of the queue directories. + base_filename = os.path.basename(filename); for dir in [ "Accepted", "Byhand", "Done", "New" ]: if os.path.exists(Cnf["Dir::Queue%sDir" % (dir) ]+'/'+base_filename): - reject("a changes file with the same name exists in the %s directory." % (dir)); + reject("a changes file with the same name already exists in the %s directory." % (dir)); return 1; @@ -705,6 +687,15 @@ def check_files(): if files[file]["oldfiles"].has_key(suite) and files[file]["oldfiles"][suite]["name"] != files[file]["component"]: files[file]["othercomponents"] = files[file]["oldfiles"][suite]["name"]; + # 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."); + ############################################################################### def check_dsc (): @@ -752,6 +743,18 @@ def check_dsc (): if epochless_dsc_version != files[file]["version"]: reject("version ('%s') in .dsc does not match version ('%s') in .changes." % (epochless_dsc_version, changes_version)); + # Ensure there is a .tar.gz in the .dsc file + has_tar = 0; + for f in dsc_files.keys(): + m = utils.re_issource.match(f); + if not m: + reject("%s mentioned in the Files field of %s not recognised as source." % (f, file)); + type = m.group(3); + if type == "orig.tar.gz" or type == "tar.gz": + has_tar = 1; + if not has_tar: + reject("no .tar.gz or .orig.tar.gz listed in the Files field of %s." % (file)); + # Ensure source is newer than existing source in target suites reject(Katie.check_source_against_db(file),""); @@ -867,7 +870,6 @@ def check_timestamps(): time.ctime(ancient_date))); except: reject("%s: timestamp check failed; caught %s" % (filename, sys.exc_type)); - raise; ################################################################################ ################################################################################ @@ -876,17 +878,25 @@ def check_timestamps(): # the file is still being uploaded. def upload_too_new(): + too_new = 0; + # Move back to the original directory to get accurate time stamps + cwd = os.getcwd(); + os.chdir(pkg.directory); file_list = pkg.files.keys(); file_list.extend(pkg.dsc_files.keys()); file_list.append(pkg.changes_file); for file in file_list: try: - last_modified = time.time()-os.path.getmtime(pkg.changes_file); + last_modified = time.time()-os.path.getmtime(file); if last_modified < int(Cnf["Dinstall::SkipTime"]): - return 1; + too_new = 1; + break; except: pass; - return 0; + os.chdir(cwd); + return too_new; + +################################################################################ def action (): # changes["distribution"] may not exist in corner cases @@ -933,12 +943,11 @@ def action (): answer = 'A'; while string.find(prompt, answer) == -1: - print prompt,; - answer = utils.our_raw_input() - m = katie.re_default_answer.match(prompt) + answer = utils.our_raw_input(prompt); + m = katie.re_default_answer.match(prompt); if answer == "": - answer = m.group(1) - answer = string.upper(answer[:1]) + answer = m.group(1); + answer = string.upper(answer[:1]); if answer == 'R': os.chdir (pkg.directory); @@ -977,10 +986,10 @@ def do_byhand (summary): file_keys = files.keys(); - # Move all the files into the accepted directory + # Move all the files into the byhand directory utils.move (pkg.changes_file, Cnf["Dir::QueueByhandDir"]); for file in file_keys: - utils.move (file, Cnf["Dir::QueueByhandDir"]); + utils.move (file, Cnf["Dir::QueueByhandDir"], perms=0660); # Check for override disparities if not Cnf["Dinstall::Options::No-Mail"]: @@ -1008,7 +1017,7 @@ def acknowledge_new (summary): # Move all the files into the accepted directory utils.move (pkg.changes_file, Cnf["Dir::QueueNewDir"]); for file in file_keys: - utils.move (file, Cnf["Dir::QueueNewDir"]); + utils.move (file, Cnf["Dir::QueueNewDir"], perms=0660); if not Options["No-Mail"]: print "Sending new ack.";