X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fqueue.py;h=fa1c809ea0a70b7821b6defa8beab41c8492e576;hb=3b1a95b1ac0b05ca86ac1fde96ca51fdae429ccd;hp=599b077f5547faae50cba80eb07cb8393071194f;hpb=41310a4a047af310a0130abb6274caaa1ffbdb1d;p=dak.git diff --git a/daklib/queue.py b/daklib/queue.py index 599b077f..fa1c809e 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -552,7 +552,7 @@ distribution.""" ########################################################################### - def accept (self, summary, short_summary): + def accept (self, summary, short_summary, targetdir=None): """ Accept an upload. @@ -577,16 +577,19 @@ distribution.""" changes_file = self.pkg.changes_file dsc = self.pkg.dsc + if targetdir is None: + targetdir = Cnf["Dir::Queue::Accepted"] + print "Accepting." self.Logger.log(["Accepting changes",changes_file]) - self.dump_vars(Cnf["Dir::Queue::Accepted"]) + self.dump_vars(targetdir) # Move all the files into the accepted directory - utils.move(changes_file, Cnf["Dir::Queue::Accepted"]) + utils.move(changes_file, targetdir) file_keys = files.keys() for file_entry in file_keys: - utils.move(file_entry, Cnf["Dir::Queue::Accepted"]) + utils.move(file_entry, targetdir) self.accept_bytes += float(files[file_entry]["size"]) self.accept_count += 1 @@ -635,6 +638,18 @@ distribution.""" os.rename(temp_filename, filename) os.chmod(filename, 0644) + # Its is Cnf["Dir::Queue::Accepted"] here, not targetdir! + # we do call queue_build too + # well yes, we'd have had to if we were inserting into accepted + # now. thats database only. + # urgh, that's going to get messy + # so i make the p-n call to it *also* using accepted/ + # but then the packages will be in the queue_build table without the files being there + # as the buildd queue is only regenerated whenever unchecked runs + # ah, good point + # so it will work out, as unchecked move it over + # that's all completely sick + # yes self.queue_build("accepted", Cnf["Dir::Queue::Accepted"]) ########################################################################### @@ -803,7 +818,7 @@ distribution.""" ########################################################################### - def do_reject (self, manual = 0, reject_message = ""): + def do_reject (self, manual = 0, reject_message = "", note = ""): """ Reject an upload. If called without a reject message or C{manual} is true, spawn an editor so the user can write one. @@ -821,6 +836,11 @@ distribution.""" # editor so the user can add one in... if manual and not reject_message: (fd, temp_filename) = utils.temp_filename() + temp_file = os.fdopen(fd, 'w') + if len(note) > 0: + for line in note: + temp_file.write(line) + temp_file.close() editor = os.environ.get("EDITOR","vi") answer = 'E' while answer == 'E': @@ -1272,7 +1292,7 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su if os.path.exists(in_unchecked) and False: return (self.reject_message, in_unchecked) else: - for directory in [ "Accepted", "New", "Byhand", "ProposedUpdates", "OldProposedUpdates" ]: + for directory in [ "Accepted", "New", "Byhand", "ProposedUpdates", "OldProposedUpdates", "Embargoed", "Unembargoed" ]: in_otherdir = os.path.join(self.Cnf["Dir::Queue::%s" % (directory)],dsc_file) if os.path.exists(in_otherdir): in_otherdir_fh = utils.open_file(in_otherdir) @@ -1295,21 +1315,3 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su self.reject("size for %s doesn't match %s." % (found, file)) return (self.reject_message, None) - - def do_query(self, query): - """ - Executes a database query. Writes statistics / timing to stderr. - - @type query: string - @param query: database query string, passed unmodified - - @return: db result - - @warning: The query is passed B{unmodified}, so be careful what you use this for. - """ - sys.stderr.write("query: \"%s\" ... " % (query)) - before = time.time() - r = self.projectB.query(query) - time_diff = time.time()-before - sys.stderr.write("took %.3f seconds.\n" % (time_diff)) - return r