public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/ago:master commit in: script/
@ 2012-12-30 17:13 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2012-12-30 17:13 UTC (permalink / raw
  To: gentoo-commits

commit:     c5696e8abc894929fc3066ff7ae39f4cab84cb1b
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 30 17:13:02 2012 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Dec 30 17:13:02 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=c5696e8a

Add batch-pretend.py

---
 script/batch-pretend.py |  165 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 165 insertions(+), 0 deletions(-)

diff --git a/script/batch-pretend.py b/script/batch-pretend.py
new file mode 100755
index 0000000..ee7e0f4
--- /dev/null
+++ b/script/batch-pretend.py
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+# Copyright 2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import glob
+import itertools
+import optparse
+import os
+import pickle
+import re
+import shutil
+import subprocess
+import sys
+
+import bugz.bugzilla
+import portage.versions
+
+BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
+
+def print_and_log(message, log):
+	try:
+		print message
+		log.write(message + '\n')
+	finally:
+		log.flush()
+
+def run_command(args, cwd, log):
+	try:
+		message = "Running %r in %s...\n" % (args, cwd)
+		sys.stdout.write(message)
+		log.write(message)
+
+		cmd  = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+		output = cmd.communicate()[0]
+		log.write("Finished with exit code %d\n" % cmd.returncode)
+		log.write(output)
+		return (cmd.returncode, output)
+	finally:
+		log.flush()
+
+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)
+
+if __name__ == "__main__":
+	parser = optparse.OptionParser()
+	parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
+	parser.add_option("-i", "--input", dest="input_filename", default="package.keywords", help="Input filename for generated package.keywords file [default=%default]")
+	parser.add_option("--repo", dest="repo", help="Path to portage CVS repository")
+	parser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False)
+
+	(options, args) = parser.parse_args()
+	if not options.arch:
+		parser.error("--arch option is required")
+	if not options.input_filename:
+		parser.error("--input option is required")
+	if not options.repo:
+		parser.error("--repo option is required")
+	if args:
+		parser.error("unrecognized command-line args")
+
+	done_bugs = []
+	if os.path.exists('batch-stabilize.state'):
+		with open('batch-stabilize.state', 'r') as state_file:
+			done_bugs = pickle.load(state_file)
+
+	url = 'https://bugs.gentoo.org'
+	print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
+	bugzilla = MyBugz(url)
+	bugzilla.auth()
+	
+	with open(options.input_filename, "r") as input_file:
+		stabilization_dict = {}
+		bug_id = -1
+		for line in input_file:
+			line = line.strip()
+
+			# Skip empty/whitespace lines.
+			if not line:
+				continue
+
+			if line.startswith("#"):
+				match = BUG_REGEX.search(line, re.IGNORECASE)
+				if not match:
+					print 'Ignoring comment line [%s]...' % line
+					continue
+				else:
+					bug_id = int(match.group(1))
+				continue
+
+			if bug_id == -1:
+				print 'Could not recognize bug id'
+				sys.exit(1)
+
+			# Drop the leading '='.
+			cpv = line[1:]
+
+			p = portage.versions.catsplit(cpv)[1]
+			pn = portage.versions.pkgsplit(cpv)[0]
+			ebuild_name = p + ".ebuild"
+			if bug_id not in stabilization_dict:
+				stabilization_dict[bug_id] = []
+			stabilization_dict[bug_id].append((pn, ebuild_name))
+
+		# Sanity check.
+		success = True
+		for bug_id in stabilization_dict:
+			for (pn, ebuild_name) in stabilization_dict[bug_id]:
+				ebuild_path = os.path.join(options.repo, pn, ebuild_name)
+				if not os.path.exists(ebuild_path):
+					print '%s: file does not exist' % ebuild_path
+					success = False
+		if not success:
+			print 'Sanity check failed. Please make sure your CVS repo is up to date (cvs up).'
+			sys.exit(1)
+
+		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.' % bug_id, log_file)
+					continue
+
+				print_and_log('Working on bug %d...' % bug_id, log_file)
+				commit_message = "Stable for %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)
+
+					# Remove whole directory to prevent problems with conflicts.
+					if os.path.exists(cvs_path):
+						try:
+							shutil.rmtree(cvs_path)
+						except OSError:
+							print '!!! rmtree %s failed' % cvs_path
+							sys.exit(1)
+
+					if run_command(["cvs", "up", pn], options.repo, log_file)[0] != 0:
+						print '!!! cvs up failed'
+						sys.exit(1)
+					if run_command(["ekeyword", options.arch, ebuild_name], cvs_path, log_file)[0] != 0:
+						print '!!! ekeyword failed'
+						sys.exit(1)
+					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')


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2012-12-30 17:16 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2012-12-30 17:16 UTC (permalink / raw
  To: gentoo-commits

commit:     29b6c10cd1ab282c22a4086654d5fd7213ce27b1
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 30 17:15:54 2012 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Dec 30 17:15:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=29b6c10c

It must work with python2

---
 script/batch-pretend.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/script/batch-pretend.py b/script/batch-pretend.py
index ee7e0f4..cef8021 100755
--- a/script/batch-pretend.py
+++ b/script/batch-pretend.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2013-01-01 14:17 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2013-01-01 14:17 UTC (permalink / raw
  To: gentoo-commits

commit:     8c309d46b620636b1f6798604bbe88776a438e12
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  1 14:17:01 2013 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Tue Jan  1 14:17:01 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=8c309d46

remove 'cvs up' part since it was recommented to run cvs up in gentoo-x86

---
 script/batch-pretend.py |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/script/batch-pretend.py b/script/batch-pretend.py
index cef8021..5e45453 100755
--- a/script/batch-pretend.py
+++ b/script/batch-pretend.py
@@ -130,17 +130,6 @@ if __name__ == "__main__":
 					cvs_path = os.path.join(options.repo, pn)
 					print_and_log('Working in %s...' % cvs_path, log_file)
 
-					# Remove whole directory to prevent problems with conflicts.
-					if os.path.exists(cvs_path):
-						try:
-							shutil.rmtree(cvs_path)
-						except OSError:
-							print '!!! rmtree %s failed' % cvs_path
-							sys.exit(1)
-
-					if run_command(["cvs", "up", pn], options.repo, log_file)[0] != 0:
-						print '!!! cvs up failed'
-						sys.exit(1)
 					if run_command(["ekeyword", options.arch, ebuild_name], cvs_path, log_file)[0] != 0:
 						print '!!! ekeyword failed'
 						sys.exit(1)


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2013-01-14  9:46 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2013-01-14  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     ed87fb57207ab2a0a5cd2457f980becb8d96c962
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 14 09:45:57 2013 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Mon Jan 14 09:45:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=ed87fb57

add best_makeopts

---
 script/best_makeopts.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/script/best_makeopts.sh b/script/best_makeopts.sh
new file mode 100755
index 0000000..58b070c
--- /dev/null
+++ b/script/best_makeopts.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+PACKAGE="kde-base/kdelibs"
+
+DISTDIR="/tmp/" emerge -f ${PACKAGE}
+
+for i in {1..10}
+do
+	echo 1 > /proc/sys/vm/drop_caches
+	time DISTDIR="/tmp" MAKEOPTS="-j${i}" emerge -q1OB ${PACKAGE}
+	echo -ne "\n\n\n"
+done


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2013-01-14 10:20 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2013-01-14 10:20 UTC (permalink / raw
  To: gentoo-commits

commit:     c9ea94258dab8d9f25e28a392af0ea3b6bbd49c0
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 14 10:20:10 2013 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Mon Jan 14 10:20:10 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=c9ea9425

Be sure you don't use strange EMERGE_DEFAULT_OPTS

---
 script/best_makeopts.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/script/best_makeopts.sh b/script/best_makeopts.sh
index b11c53e..ae9e9ce 100755
--- a/script/best_makeopts.sh
+++ b/script/best_makeopts.sh
@@ -9,6 +9,6 @@ DISTDIR="/tmp/" emerge -f ${PACKAGE}
 for i in {1..10}
 do
 	echo 1 > /proc/sys/vm/drop_caches
-	time DISTDIR="/tmp" MAKEOPTS="-j${i}" emerge -q1OB ${PACKAGE}
+	time DISTDIR="/tmp" EMERGE_DEFAULT_OPTS="" MAKEOPTS="-j${i}" emerge -q1OB ${PACKAGE}
 	echo -ne "\n\n\n"
 done


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2013-03-24 17:52 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2013-03-24 17:52 UTC (permalink / raw
  To: gentoo-commits

commit:     224c623af141951c95ba26be56d658b85b70a24e
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 24 17:51:56 2013 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Sun Mar 24 17:51:56 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=224c623a

Add script to check the kde's categories consistency

---
 script/kde_repoman_check.sh |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/script/kde_repoman_check.sh b/script/kde_repoman_check.sh
new file mode 100755
index 0000000..e948756
--- /dev/null
+++ b/script/kde_repoman_check.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+MY_PORTDIR="$( portageq envvar PORTDIR )"
+
+for k in kde-base kde-misc
+do
+	for i in $( ls "${MY_PORTDIR}"/"${k}"/ | grep -v "metadata\.xml" )
+	do
+		cd "${MY_PORTDIR}"/${k}/"${i}"
+		result="$( repoman full > /dev/null 2>&1 )"
+		if [ "${?}" = "1" ]
+		then
+			echo "The package "${k}"/"${i}" has the following problem:"
+			repoman full
+		fi
+	done
+done
+
+exit 0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2013-05-05  9:38 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2013-05-05  9:38 UTC (permalink / raw
  To: gentoo-commits

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')


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2014-08-13 14:45 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2014-08-13 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     35fa89fea5a43dc1b0e59227344eb0ed4ee96060
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 13 14:44:05 2014 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Wed Aug 13 14:44:05 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=35fa89fe

more logical var names

---
 script/kde_repoman_check.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/script/kde_repoman_check.sh b/script/kde_repoman_check.sh
index e948756..39019d9 100755
--- a/script/kde_repoman_check.sh
+++ b/script/kde_repoman_check.sh
@@ -2,15 +2,15 @@
 
 MY_PORTDIR="$( portageq envvar PORTDIR )"
 
-for k in kde-base kde-misc
+for category in kde-base kde-misc
 do
-	for i in $( ls "${MY_PORTDIR}"/"${k}"/ | grep -v "metadata\.xml" )
+	for package in $( ls "${MY_PORTDIR}"/"${category}"/ | grep -v "metadata\.xml" )
 	do
-		cd "${MY_PORTDIR}"/${k}/"${i}"
+		cd "${MY_PORTDIR}"/"${category}"/"${package}"
 		result="$( repoman full > /dev/null 2>&1 )"
-		if [ "${?}" = "1" ]
+		if [ "${?}" != "0" ]
 		then
-			echo "The package "${k}"/"${i}" has the following problem:"
+			echo "The package "${category}"/"${package}" has the following problem:"
 			repoman full
 		fi
 	done


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] dev/ago:master commit in: script/
@ 2014-08-13 14:49 Agostino Sarubbo
  0 siblings, 0 replies; 9+ messages in thread
From: Agostino Sarubbo @ 2014-08-13 14:49 UTC (permalink / raw
  To: gentoo-commits

commit:     2fb3bebf42dd93236157c8d26afc91b932ef24c2
Author:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 13 14:48:58 2014 +0000
Commit:     Agostino Sarubbo <ago <AT> gentoo <DOT> org>
CommitDate: Wed Aug 13 14:48:58 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/ago.git;a=commit;h=2fb3bebf

New version of the batch-* script that work with pybugz-0.10

---
 script/batch-ekeyword-only.py     | 17 +++++-------
 script/batch-keyword.py           | 15 ++++-------
 script/batch-stabilize-force.py   | 54 +++++----------------------------------
 script/batch-stabilize-pretend.py | 15 ++++-------
 script/batch-stabilize.py         | 52 ++++---------------------------------
 5 files changed, 28 insertions(+), 125 deletions(-)

diff --git a/script/batch-ekeyword-only.py b/script/batch-ekeyword-only.py
index 4506001..b4fcd14 100755
--- a/script/batch-ekeyword-only.py
+++ b/script/batch-ekeyword-only.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -12,7 +12,7 @@ import shutil
 import subprocess
 import sys
 
-import bugz.bugzilla
+from bugz.bugzilla import BugzillaProxy
 import portage.versions
 
 BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
@@ -42,10 +42,6 @@ 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)
-
 if __name__ == "__main__":
 	parser = optparse.OptionParser()
 	parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
@@ -68,10 +64,8 @@ if __name__ == "__main__":
 		with open('batch-stabilize.state', 'r') as state_file:
 			done_bugs = pickle.load(state_file)
 
-	url = 'https://bugs.gentoo.org'
-	print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
-	bugzilla = MyBugz(url)
-	bugzilla.auth()
+	url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+	bugzilla = BugzillaProxy(url)
 	
 	with open(options.input_filename, "r") as input_file:
 		stabilization_dict = {}
@@ -136,3 +130,6 @@ if __name__ == "__main__":
 					if run_command(["repoman", "manifest"], cvs_path, log_file)[0] != 0:
 						print '!!! repoman manifest failed'
 						sys.exit(1)
+
+	if os.path.exists('batch-stabilize.state'):
+		os.remove('batch-stabilize.state')

diff --git a/script/batch-keyword.py b/script/batch-keyword.py
index 1c1c126..d99fdb8 100755
--- a/script/batch-keyword.py
+++ b/script/batch-keyword.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -12,7 +12,7 @@ import shutil
 import subprocess
 import sys
 
-import bugz.bugzilla
+from bugz.bugzilla import BugzillaProxy
 import portage.versions
 
 BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
@@ -42,10 +42,6 @@ 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)
-
 if __name__ == "__main__":
 	parser = optparse.OptionParser()
 	parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
@@ -68,10 +64,8 @@ if __name__ == "__main__":
 		with open('batch-stabilize.state', 'r') as state_file:
 			done_bugs = pickle.load(state_file)
 
-	url = 'https://bugs.gentoo.org'
-	print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
-	bugzilla = MyBugz(url)
-	bugzilla.auth()
+	url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+	bugzilla = BugzillaProxy(url)
 	
 	with open(options.input_filename, "r") as input_file:
 		stabilization_dict = {}
@@ -150,5 +144,6 @@ if __name__ == "__main__":
 						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-stabilize-force.py b/script/batch-stabilize-force.py
index e6432b9..d335545 100755
--- a/script/batch-stabilize-force.py
+++ b/script/batch-stabilize-force.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -12,7 +12,7 @@ import shutil
 import subprocess
 import sys
 
-import bugz.bugzilla
+from bugz.bugzilla import BugzillaProxy
 import portage.versions
 
 BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
@@ -42,10 +42,6 @@ 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)
-
 if __name__ == "__main__":
 	parser = optparse.OptionParser()
 	parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
@@ -68,10 +64,8 @@ if __name__ == "__main__":
 		with open('batch-stabilize.state', 'r') as state_file:
 			done_bugs = pickle.load(state_file)
 
-	url = 'https://bugs.gentoo.org'
-	print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
-	bugzilla = MyBugz(url)
-	bugzilla.auth()
+	url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+	bugzilla = BugzillaProxy(url)
 	
 	with open(options.input_filename, "r") as input_file:
 		stabilization_dict = {}
@@ -146,46 +140,10 @@ if __name__ == "__main__":
 						done_bugs.append(bug_id)
 						save_state(done_bugs)
 						continue
-					if run_command(["repoman", "commit", "--include-arches", options.arch, "-f", "-m", commit_message], cvs_path, log_file)[0] != 0:
+					if run_command(["repoman", "commit", "-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-stabilize-pretend.py b/script/batch-stabilize-pretend.py
index daafc5a..2e5996b 100755
--- a/script/batch-stabilize-pretend.py
+++ b/script/batch-stabilize-pretend.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -12,7 +12,7 @@ import shutil
 import subprocess
 import sys
 
-import bugz.bugzilla
+from bugz.bugzilla import BugzillaProxy
 import portage.versions
 
 BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
@@ -42,10 +42,6 @@ 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)
-
 if __name__ == "__main__":
 	parser = optparse.OptionParser()
 	parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
@@ -68,10 +64,8 @@ if __name__ == "__main__":
 		with open('batch-stabilize.state', 'r') as state_file:
 			done_bugs = pickle.load(state_file)
 
-	url = 'https://bugs.gentoo.org'
-	print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
-	bugzilla = MyBugz(url)
-	bugzilla.auth()
+	url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+	bugzilla = BugzillaProxy(url)
 	
 	with open(options.input_filename, "r") as input_file:
 		stabilization_dict = {}
@@ -150,5 +144,6 @@ if __name__ == "__main__":
 						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-stabilize.py b/script/batch-stabilize.py
index 9bdfe8d..f86151f 100755
--- a/script/batch-stabilize.py
+++ b/script/batch-stabilize.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # Copyright 2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -12,7 +12,7 @@ import shutil
 import subprocess
 import sys
 
-import bugz.bugzilla
+from bugz.bugzilla import BugzillaProxy
 import portage.versions
 
 BUG_REGEX = re.compile("[Bb]ug #?(\d+)")
@@ -42,10 +42,6 @@ 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)
-
 if __name__ == "__main__":
 	parser = optparse.OptionParser()
 	parser.add_option("--arch", dest="arch", help="Gentoo arch to use, e.g. x86, amd64, ...")
@@ -68,10 +64,8 @@ if __name__ == "__main__":
 		with open('batch-stabilize.state', 'r') as state_file:
 			done_bugs = pickle.load(state_file)
 
-	url = 'https://bugs.gentoo.org'
-	print 'You may be prompted for your Gentoo Bugzilla username and password (%s).' % url
-	bugzilla = MyBugz(url)
-	bugzilla.auth()
+	url = 'https://bugs.gentoo.org/xmlrpc.cgi'
+	bugzilla = BugzillaProxy(url)
 	
 	with open(options.input_filename, "r") as input_file:
 		stabilization_dict = {}
@@ -150,42 +144,6 @@ if __name__ == "__main__":
 						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')


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-13 14:49 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox