aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Loeser <halcy0n@gentoo.org>2008-06-01 18:15:20 -0400
committerMark Loeser <halcy0n@gentoo.org>2008-06-01 18:15:20 -0400
commit571d9a9e2683f4f61d5387b7b7ff559f175303bb (patch)
treeb1a09f026186c671b55d751448263879648905b3 /gentoo-scripts/changelog.py
parentAdding base file (diff)
downloadrbot-gentoo-571d9a9e2683f4f61d5387b7b7ff559f175303bb.tar.gz
rbot-gentoo-571d9a9e2683f4f61d5387b7b7ff559f175303bb.tar.bz2
rbot-gentoo-571d9a9e2683f4f61d5387b7b7ff559f175303bb.zip
Initial commit of this. Very very rough, does the following:
!meta !changelog !devaway
Diffstat (limited to 'gentoo-scripts/changelog.py')
-rw-r--r--gentoo-scripts/changelog.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/gentoo-scripts/changelog.py b/gentoo-scripts/changelog.py
new file mode 100644
index 0000000..066f736
--- /dev/null
+++ b/gentoo-scripts/changelog.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python -O
+
+# Copyright (C) 2004 Eric Olinger, http://evvl.rustedhalo.net
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Author : Eric Olinger <EvvL AT RustedHalo DOT net>
+
+# I changed stuff. solar@gentoo.org
+
+import os,sys
+
+sys.stderr=open("/dev/null","w")
+
+import portage,string,re
+from stat import *
+from output import *
+from xml.sax import saxutils, make_parser, handler
+from xml.sax.handler import feature_namespaces
+
+nocolor()
+
+version="0.2.5"
+
+def usage(code):
+ """Prints the uage information for this script"""
+ print green("metadata v" + version + "\n")
+ print "Usage: metadata [package-cat/]package"
+ sys.exit(code)
+
+def grab_changelog_stuff(catpkg):
+ try:
+ foo=""
+ os.chdir(portage.settings["PORTDIR"] + "/" + catpkg)
+ r=re.compile("<[A-Za-z_0-9]+@gentoo.org>", re.I)
+
+ s="\n".join(portage.grabfile("ChangeLog"))
+
+ d={}
+ for x in r.findall(s):
+ if x not in d:
+ d[x] = 0
+ d[x] += 1
+
+ l=[(d[x], x) for x in d.keys()]
+ l.sort(lambda x,y: cmp(y[0], x[0]))
+ for x in l:
+ p = str(x[0]) +" "+ x[1].lstrip("<").rstrip(">")
+ foo += p[:p.find("@")]+", "
+ return foo
+ except:
+ raise
+
+def main ():
+ if len( sys.argv ) < 2:
+ usage( 1 )
+
+ for pkg in sys.argv[1:]:
+ package_list = portage.portdb.xmatch("match-all", pkg)
+ print darkgreen("Package: ") + portage.pkgsplit(package_list[0])[0] + " " + darkgreen("ChangeLog: ") + grab_changelog_stuff(portage.pkgsplit(package_list[0])[0])
+
+if __name__ == '__main__':
+ main()