[packages/rpm-build-tools: 1/2] - script that might be useful when sending big sets of packages to builders (for example kde4).

witekfl witekfl at pld-linux.org
Thu Apr 10 19:05:43 CEST 2014


commit 1859b517c444d47d9b9802e938a871cecdd918bf
Author: Witold Filipczyk <witekfl at poczta.onet.pl>
Date:   Thu Apr 10 19:02:02 2014 +0200

    - script that might be useful when sending big sets of packages to builders (for example kde4).

 sort-pkgs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
---
diff --git a/sort-pkgs b/sort-pkgs
new file mode 100755
index 0000000..acd5bdd
--- /dev/null
+++ b/sort-pkgs
@@ -0,0 +1,58 @@
+#!/usr/bin/python
+
+"""
+This script tries to set ordering in which packages ought to be sent to builders.
+Input: file with names of packages (without the .spec suffix). One package name per line.
+Output: sorted packages on stdout.
+
+If the script goes in a infinite loop, that means there is a cycle or other bug.
+"""
+
+import os
+import re
+import sys
+
+PATTERN = re.compile('BuildRequires:\t(.*)-devel')
+DIR = '/home/users/builder/rpm/packages'
+
+packages = {}
+packages_res = {}
+
+def build_requires(name):
+	res = []
+	with open(os.path.join(DIR, name, name + '.spec'), 'r') as f:
+		for line in f:
+			br = PATTERN.match(line)
+			if br:
+				p = br.group(1)
+				if p in packages:
+					res.append(p)
+	return res
+
+def print_packages(p):
+	if packages_res[p] == 1:
+		return
+	for pp in packages[p]:
+		print_packages(pp)
+	packages_res[p] = 1
+	print p#, packages[p]
+
+if __name__ == "__main__":
+	if len(sys.argv) < 2:
+		print "Usage: %s filename" % sys.argv[0]
+		sys.exit(1)
+	with open(sys.argv[1], 'r') as f:
+		for line in f:
+			p = line.rstrip()
+			packages[p] = []
+			packages_res[p] = 0
+	for p in packages.keys():
+		res = build_requires(p)
+		if res:
+			packages[p] = res[:]
+
+#	for p in packages.keys():
+#		print p, packages[p]
+
+	for p in packages.keys():
+		print_packages(p)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/10e5a81309733a45f42a3cfbb70f0337d829c04f



More information about the pld-cvs-commit mailing list