From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S5yKi-0002jC-9H for garchives@archives.gentoo.org; Fri, 09 Mar 2012 11:50:04 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B6ECEE0752; Fri, 9 Mar 2012 11:49:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7AA09E0752 for ; Fri, 9 Mar 2012 11:49:56 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B8F151B4037 for ; Fri, 9 Mar 2012 11:49:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 9A86FE542C for ; Fri, 9 Mar 2012 11:49:53 +0000 (UTC) From: "Paweł Hajdan" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paweł Hajdan" Message-ID: <1331293750.4a2ba0432b825af79fd4348689d3ae9033450b88.phajdan.jr@gentoo> Subject: [gentoo-commits] proj/arch-tools:master commit in: / X-VCS-Repository: proj/arch-tools X-VCS-Files: batch-stabilize.py X-VCS-Directories: / X-VCS-Committer: phajdan.jr X-VCS-Committer-Name: Paweł Hajdan X-VCS-Revision: 4a2ba0432b825af79fd4348689d3ae9033450b88 X-VCS-Branch: master Date: Fri, 9 Mar 2012 11:49:53 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: bd132134-bca8-40a3-9a78-21c40dda84be X-Archives-Hash: afaafc09ff0212a8e6ebef0b540bde05 commit: 4a2ba0432b825af79fd4348689d3ae9033450b88 Author: Pawel Hajdan, Jr gentoo org> AuthorDate: Fri Mar 9 11:49:10 2012 +0000 Commit: Pawe=C5=82 Hajdan gentoo org> CommitDate: Fri Mar 9 11:49:10 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/arch-tools.gi= t;a=3Dcommit;h=3D4a2ba043 Avoid duplicating work: remember which bugs have been done. --- batch-stabilize.py | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) diff --git a/batch-stabilize.py b/batch-stabilize.py index db869bb..877e5dc 100755 --- a/batch-stabilize.py +++ b/batch-stabilize.py @@ -6,6 +6,7 @@ import glob import itertools import optparse import os +import pickle import re import shutil import subprocess @@ -37,6 +38,10 @@ def run_command(args, cwd, log): finally: log.flush() =20 +def save_state(done_bugs): + with open('batch-stabilize.state', 'w') as state_file: + pickle.dump(done_bugs, state_file) + class MyBugz(bugz.bugzilla.Bugz): def get_input(self, prompt): return raw_input(prompt) @@ -58,6 +63,11 @@ if __name__ =3D=3D "__main__": if args: parser.error("unrecognized command-line args") =20 + done_bugs =3D [] + if os.path.exists('batch-stabilize.state'): + with open('batch-stabilize.state', 'r') as state_file: + done_bugs =3D pickle.load(state_file) + url =3D 'https://bugs.gentoo.org' print 'You may be prompted for your Gentoo Bugzilla username and passwo= rd (%s).' % url bugzilla =3D MyBugz(url) @@ -110,6 +120,10 @@ if __name__ =3D=3D "__main__": =20 with open('batch-stabilize.log', 'a') as log_file: for bug_id in stabilization_dict: + if bug_id in done_bugs: + print_and_log('Skipping bug #%d because it is marked as done.' % bu= g_id, log_file) + continue + print_and_log('Working on bug %d...' % bug_id, log_file) commit_message =3D "%s stable wrt bug #%d" % (options.arch, bug_id) for (pn, ebuild_name) in stabilization_dict[bug_id]: @@ -140,10 +154,11 @@ if __name__ =3D=3D "__main__": # It seems that cvs diff returns 1 if there are differences. if return_code =3D=3D 0 and not output: print_and_log('Seems already keyworded, skipping.', log_file) + done_bugs.append(bug_id) + save_state(done_bugs) continue if run_command(["echangelog", commit_message], cvs_path, log_file)[= 0] !=3D 0: - print '!!! echangelog failed' - sys.exit(1) + print_and_log('echangelog failed, maybe just the Manifest is being= updated; continuing', log_file) if run_command(["repoman", "manifest"], cvs_path, log_file)[0] !=3D= 0: print '!!! repoman manifest failed' sys.exit(1) @@ -162,6 +177,8 @@ if __name__ =3D=3D "__main__": =20 if not has_my_arch: print_and_log('Seems that bugzilla has already been updated.', log_= file) + done_bugs.append(bug_id) + save_state(done_bugs) continue =20 print_and_log('Posting automated reply in bugzilla...', log_file) @@ -181,3 +198,9 @@ if __name__ =3D=3D "__main__": status=3D'RESOLVED', resolution=3D'FIXED') print_and_log('Succesfully updated bug %d and closed it.' % bug_id,= log_file) + + done_bugs.append(bug_id) + save_state(done_bugs) +=09 + if os.path.exists('batch-stabilize.state'): + os.remove('batch-stabilize.state')