public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Agostino Sarubbo" <ago@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/ago:master commit in: script/
Date: Sun,  5 May 2013 09:38:37 +0000 (UTC)	[thread overview]
Message-ID: <1367746692.82c73ed3631aeffa3b9a0b14a6ab9693b834fd32.ago@gentoo> (raw)

commit:     82c73ed3631aeffa3b9a0b14a6ab9693b834fd32
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun May  5 09:38:12 2013 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun May  5 09:38:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=82c73ed3

Add batch* script

---
 .../{batch-pretend.py => batch-ekeyword-only.py}   |   18 +--------
 script/{batch-pretend.py => batch-keyword.py}      |    6 +-
 .../{batch-pretend.py => batch-stabilize-force.py} |   41 +++++++++++++++++++-
 ...batch-pretend.py => batch-stabilize-pretend.py} |    4 +-
 script/{batch-pretend.py => batch-stabilize.py}    |   41 +++++++++++++++++++-
 5 files changed, 84 insertions(+), 26 deletions(-)

diff --git a/script/batch-pretend.py b/script/batch-ekeyword-only.py
similarity index 85%
copy from script/batch-pretend.py
copy to script/batch-ekeyword-only.py
index 5e45453..4506001 100755
--- a/script/batch-pretend.py
+++ b/script/batch-ekeyword-only.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -136,19 +136,3 @@ if __name__ == "__main__":
 					if run_command(["repoman", "manifest"], cvs_path, log_file)[0] != 0:
 						print '!!! repoman manifest failed'
 						sys.exit(1)
-				for (pn, ebuild_name) in stabilization_dict[bug_id]:
-					cvs_path = os.path.join(options.repo, pn)
-					print_and_log('Working in %s...' % cvs_path, log_file)
-					return_code, output = run_command(["cvs", "diff"], cvs_path, log_file)
-					# It seems that cvs diff returns 1 if there are differences.
-					if return_code == 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(["repoman", "full"], cvs_path, log_file)[0] != 0:
-						os.chdir(cvs_path)
-						os.system("repoman full")
-						sys.exit(1)
-	if os.path.exists('batch-stabilize.state'):
-		os.remove('batch-stabilize.state')

diff --git a/script/batch-pretend.py b/script/batch-keyword.py
similarity index 95%
copy from script/batch-pretend.py
copy to script/batch-keyword.py
index 5e45453..1c1c126 100755
--- a/script/batch-pretend.py
+++ b/script/batch-keyword.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -125,7 +125,7 @@ if __name__ == "__main__":
 					continue
 
 				print_and_log('Working on bug %d...' % bug_id, log_file)
-				commit_message = "Stable for %s, wrt bug #%d" % (options.arch, bug_id)
+				commit_message = "Add %s, wrt bug #%d" % (options.arch, bug_id)
 				for (pn, ebuild_name) in stabilization_dict[bug_id]:
 					cvs_path = os.path.join(options.repo, pn)
 					print_and_log('Working in %s...' % cvs_path, log_file)
@@ -146,7 +146,7 @@ if __name__ == "__main__":
 						done_bugs.append(bug_id)
 						save_state(done_bugs)
 						continue
-					if run_command(["repoman", "full"], cvs_path, log_file)[0] != 0:
+					if run_command(["repoman", "commit", "--include-arches", options.arch, "-m", commit_message], cvs_path, log_file)[0] != 0:
 						os.chdir(cvs_path)
 						os.system("repoman full")
 						sys.exit(1)

diff --git a/script/batch-pretend.py b/script/batch-stabilize-force.py
similarity index 75%
copy from script/batch-pretend.py
copy to script/batch-stabilize-force.py
index 5e45453..e6432b9 100755
--- a/script/batch-pretend.py
+++ b/script/batch-stabilize-force.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -146,9 +146,46 @@ if __name__ == "__main__":
 						done_bugs.append(bug_id)
 						save_state(done_bugs)
 						continue
-					if run_command(["repoman", "full"], cvs_path, log_file)[0] != 0:
+					if run_command(["repoman", "commit", "--include-arches", options.arch, "-f", "-m", commit_message], cvs_path, log_file)[0] != 0:
 						os.chdir(cvs_path)
 						os.system("repoman full")
 						sys.exit(1)
+				bug_xml = bugzilla.get(bug_id).find('bug')
+				has_my_arch = False
+				has_other_arches = False
+				for cc in bug_xml.findall('cc'):
+					body, domain = cc.text.split('@', 1)
+					if domain == 'gentoo.org' and body == options.arch:
+						has_my_arch = True
+					if domain == 'gentoo.org' and body in portage.archlist and body != options.arch:
+						has_other_arches=True
+
+				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
+
+				print_and_log('Posting automated reply in bugzilla...', log_file)
+				# We don't close bugs which still have other arches for obvious reasons,
+				# and security bugs because stabilization is not the last step for them.
+				if has_other_arches or 'Security' in bug_xml.find('product').text:
+					bugzilla.modify(
+						bug_id,
+						comment='%s stable' % options.arch,
+						remove_cc='%s@gentoo.org' % options.arch)
+					print_and_log('Successfully updated bug %d.' % bug_id, log_file)
+				else:
+					bugzilla.modify(
+						bug_id,
+						comment='%s stable. Last arch, closing' % options.arch,
+						remove_cc='%s@gentoo.org' % options.arch,
+						status='RESOLVED',
+						resolution='FIXED')
+					print_and_log('Succesfully updated bug %d and closed it.' % bug_id, log_file)
+
+				done_bugs.append(bug_id)
+				save_state(done_bugs)
+	
 	if os.path.exists('batch-stabilize.state'):
 		os.remove('batch-stabilize.state')

diff --git a/script/batch-pretend.py b/script/batch-stabilize-pretend.py
similarity index 97%
copy from script/batch-pretend.py
copy to script/batch-stabilize-pretend.py
index 5e45453..daafc5a 100755
--- a/script/batch-pretend.py
+++ b/script/batch-stabilize-pretend.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -146,7 +146,7 @@ if __name__ == "__main__":
 						done_bugs.append(bug_id)
 						save_state(done_bugs)
 						continue
-					if run_command(["repoman", "full"], cvs_path, log_file)[0] != 0:
+					if run_command(["repoman", "full", "--include-arches", options.arch], cvs_path, log_file)[0] != 0:
 						os.chdir(cvs_path)
 						os.system("repoman full")
 						sys.exit(1)

diff --git a/script/batch-pretend.py b/script/batch-stabilize.py
similarity index 75%
rename from script/batch-pretend.py
rename to script/batch-stabilize.py
index 5e45453..9bdfe8d 100755
--- a/script/batch-pretend.py
+++ b/script/batch-stabilize.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -146,9 +146,46 @@ if __name__ == "__main__":
 						done_bugs.append(bug_id)
 						save_state(done_bugs)
 						continue
-					if run_command(["repoman", "full"], cvs_path, log_file)[0] != 0:
+					if run_command(["repoman", "commit", "--include-arches", options.arch, "-m", commit_message], cvs_path, log_file)[0] != 0:
 						os.chdir(cvs_path)
 						os.system("repoman full")
 						sys.exit(1)
+				bug_xml = bugzilla.get(bug_id).find('bug')
+				has_my_arch = False
+				has_other_arches = False
+				for cc in bug_xml.findall('cc'):
+					body, domain = cc.text.split('@', 1)
+					if domain == 'gentoo.org' and body == options.arch:
+						has_my_arch = True
+					if domain == 'gentoo.org' and body in portage.archlist and body != options.arch:
+						has_other_arches=True
+
+				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
+
+				print_and_log('Posting automated reply in bugzilla...', log_file)
+				# We don't close bugs which still have other arches for obvious reasons,
+				# and security bugs because stabilization is not the last step for them.
+				if has_other_arches or 'Security' in bug_xml.find('product').text:
+					bugzilla.modify(
+						bug_id,
+						comment='%s stable' % options.arch,
+						remove_cc='%s@gentoo.org' % options.arch)
+					print_and_log('Successfully updated bug %d.' % bug_id, log_file)
+				else:
+					bugzilla.modify(
+						bug_id,
+						comment='%s stable. Last arch, closing' % options.arch,
+						remove_cc='%s@gentoo.org' % options.arch,
+						status='RESOLVED',
+						resolution='FIXED')
+					print_and_log('Succesfully updated bug %d and closed it.' % bug_id, log_file)
+
+				done_bugs.append(bug_id)
+				save_state(done_bugs)
+	
 	if os.path.exists('batch-stabilize.state'):
 		os.remove('batch-stabilize.state')


             reply	other threads:[~2013-05-05  9:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-05  9:38 Agostino Sarubbo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-13 14:49 [gentoo-commits] dev/ago:master commit in: script/ Agostino Sarubbo
2014-08-13 14:45 Agostino Sarubbo
2013-03-24 17:52 Agostino Sarubbo
2013-01-14 10:20 Agostino Sarubbo
2013-01-14  9:46 Agostino Sarubbo
2013-01-01 14:17 Agostino Sarubbo
2012-12-30 17:16 Agostino Sarubbo
2012-12-30 17:13 Agostino Sarubbo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367746692.82c73ed3631aeffa3b9a0b14a6ab9693b834fd32.ago@gentoo \
    --to=ago@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox