SVN: toys/stbr/buildlog_link.py

shadzik shadzik at pld-linux.org
Fri Nov 23 16:10:04 CET 2007


Author: shadzik
Date: Fri Nov 23 16:10:03 2007
New Revision: 9078

Added:
   toys/stbr/buildlog_link.py   (contents, props changed)
Log:
- new


Added: toys/stbr/buildlog_link.py
==============================================================================
--- (empty file)
+++ toys/stbr/buildlog_link.py	Fri Nov 23 16:10:03 2007
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+import os
+import sys
+import re
+import readline
+
+html = "queue.html"
+
+lines = []
+links = []
+
+def parseHtml():
+	try:
+		id = sys.argv[1]
+	except(IndexError):
+		print "Usage: %s buildID [th-arch]" % sys.argv[0]
+		return
+	f = open(html, 'r')
+	read = f.xreadlines()
+	for l in read:
+		l = l.strip()
+		lines.append(l)
+	for i in range(len(lines)):
+		if re.findall(id, lines[i]):
+			log = 1
+			while (lines[i+log] != "</ul>"):
+				if re.findall("http",lines[i+log]):
+					links = lines[i+log].split(" ")
+					break
+				log = log + 1
+	try:
+		if links:
+			for i in range(len(links)):
+				if re.findall("http", links[i]):
+					link = links[i].split("\"")[1]
+					try:
+						arch = sys.argv[2].split("th-")[1]
+						if re.findall(arch, link):
+							print link
+							break
+						else:
+							i = i + 1
+					except(IndexError):
+						print link
+						pass
+	except(UnboundLocalError):
+		return
+
+def getQueue():
+	os.popen("wget -qc http://ep09.pld-linux.org/~builderth/queue.html")
+
+getQueue()
+parseHtml()


More information about the pld-cvs-commit mailing list