Date: Wed, 07 Jun 2006 18:13:56 +0800 From: Dryice Liu <dryice@dryice.name> To: freebsd-ports@freebsd.org Subject: a script to find installed ports@ maintained ports infos Message-ID: <86lks95l3v.fsf@makesig.3322.org>
next in thread | raw e-mail | index | archive | help
I really like the script posted here some time ago that shows all the un-maintained ports installed on one's system. However when I tried to take maintainership of some of them, I found lots of them are already in the latest version and builds perfectly on all platform. And I'm not comfitable with sending a PR that just put my name there :) So I scratch this script to check against http://beta.inerd.com/portscout/ports@freebsd.org.html and http://portsmon.firepipe.net/portsconcordanceformaintainer.py?maintainer=ports%40freebsd for possible new versions, build errors, and related PRs. Thus I can have a better idea which one I should look at first. The script is attached below. Wish someone find it useful. And welcome comments. ====================================================================== #!/usr/local/bin/python import urllib, commands from sgmllib import SGMLParser class portsoutParser(SGMLParser): def reset(self): self.needUpdate = [] self.inTable = False self.inTR = False self.tdCount = 0 SGMLParser.reset(self) def start_table(self, attrs): if ("class", "results") in attrs: self.inTable = True self.unknown_starttag("table", attrs) def end_table(self): self.unknown_endtag("table") self.inTable = False def start_tr(self, attrs): if self.inTable: self.inTR = True self.tdCount = 0 self.unknown_starttag("tr", attrs) def end_tr(self): self.unknown_endtag("tr") if self.inTable: self.inTR = False def start_td(self, attrs): self.tdCount += 1 self.unknown_starttag("td", attrs) def handle_data(self, data): if self.tdCount == 1: self.portName = data elif self.tdCount == 2: self.category = data elif self.tdCount == 4: self.needUpdate.append("%s/%s" % (self.category, self.portName)) def findPortsOut(): #get html source sock = urllib.urlopen("http://beta.inerd.com/portscout/ports@freebsd.org.html") htmlSource = sock.read() sock.close() parser = portsoutParser() parser.feed(htmlSource) parser.close() return parser.needUpdate class portsmonParser(SGMLParser): def reset(self): self.buildError = [] self.withPR = [] self.inTable = False self.tableCount = 0 self.inTR = False self.tdCount = 0 self.inPortName = False self.inBuildError = False self.inPR = False SGMLParser.reset(self) def start_table(self, attrs): self.tableCount += 1 if self.tableCount == 2: self.inTable = True self.unknown_starttag("table", attrs) def start_tr(self, attrs): if self.inTable: self.inTR = True self.tdCount = 0 self.unknown_starttag("tr", attrs) def end_tr(self): self.unknown_endtag("tr") if self.inTable: self.inTR = False def start_td(self, attrs): self.tdCount += 1 self.inPortName = False self.inBuildError = False self.inPR = False self.unknown_starttag("td", attrs) def start_a(self, attrs): if self.tdCount == 1: self.inPortName = True elif self.tdCount == 3: self.inBuildError = True elif self.tdCount == 4: self.inPR = True def end_a(self): if self.inTR: if self.inPortName: self.inPortName = False if self.inBuildError: self.inBuildError = False if self.inPR: self.inPR = False def handle_data(self, data): if self.inPortName: self.portName = data elif self.inBuildError: self.buildError.append(self.portName) elif self.inPR: self.withPR.append(self.portName) def findPortsmon(): #get html source sock = urllib.urlopen("http://portsmon.firepipe.net/portsconcordanceformaintainer.py?maintainer=ports%40freebsd") htmlSource = sock.read() sock.close() parser = portsmonParser() parser.feed(htmlSource) parser.close() return parser.buildError, parser.withPR def findInstalled(): thecmd = """cd /usr/ports; grep -F "`for o in \`pkg_info -qao\` ; \ do echo "|/usr/ports/${o}|" ; done`" `make -V INDEXFILE` | \ grep -i \|ports@freebsd.org\| | cut -f 2 -d \| | cut -f 4,5 -d /""" return commands.getstatusoutput(thecmd)[1].split() # when run as a script if __name__ == "__main__": installed = findInstalled() portsout = findPortsOut() buildError, withPR = findPortsmon() for i in installed: print "\n%-40s" % (i,), if i in portsout: print "new version,", if i in buildError: print "build error,", if i in withPR: print "with PR", ====================================================================== -- Dryice @ http://dryice.name Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/sylvester-response.html
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lks95l3v.fsf>