Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 290 Details for
Bug 989
genpkgxml.py script
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
genpkgxml.py
genpkgxml.py (text/plain), 1.81 KB, created by
Grant Goodyear (RETIRED)
on 2002-03-06 17:21:33 UTC
(
hide
)
Description:
genpkgxml.py
Filename:
MIME Type:
Creator:
Grant Goodyear (RETIRED)
Created:
2002-03-06 17:21:33 UTC
Size:
1.81 KB
patch
obsolete
>#! /usr/bin/env python ># genpkgxml.py > ># Very simple program to generate "main-packages.xml", an xml page ># containing a list of all "current" packages, where "current" means the ># most up-to-date version that isn't masked. > >import portage, string, os, os.path, time > ># xml file to be generated >out = file("main-packages.xml", "w") > ># xml boilerplate >header = """<?xml version='1.0'?> ><mainpage id="packages"> ><title>Gentoo Linux Packages</title> ><author title="Grant Goodyear"><mail link="g2boojum@gentoo.org">Grant Goodyear</mail></author> > ><version>Current</version> ><date>%s</date> >""" % time.asctime(time.localtime()) > >tableheader = """<table> > <tr> > <th>Package</th> > <th>Version</th> > <th>Category</th> > </tr> >""" >footer = """</table> ></body> ></section> ></chapter> ></mainpage> >""" > ># get a sorted list of "current" packages, where each ># list entry is [<PN>, <PV>, <PR>, <category>] >def getcurrentpkgs(): > tree = portage.portagetree() > currentlist = [] > for node in tree.getallnodes(): > best = tree.dep_bestmatch(node) > cat, PN, PV, PR = portage.catpkgsplit(best) > currentlist.append([PN.lower(), PV, PR, cat]) > currentlist.sort() > return currentlist > ># take a package (a [PN, PV, PR, category] list) and return the table entry ># for that package: ># <name> <version> <category> >def getpkgentry(pkg): > pkgentry = "\t<tr>\n" > pkgentry += "\t\t<ti>%s</ti>\n" % pkg[0] > pkgentry += "\t\t<ti>%s</ti>\n" % pkg[1] > pkgentry += "\t\t<ti>%s</ti>\n" % pkg[3] > pkgentry += "\t</tr>\n" > return pkgentry > > >if __name__ == "__main__": > pkglist = getcurrentpkgs() > out.write(header) > out.write("<chapter>\n") > out.write("<section>\n") > out.write("<title>Today's list of %d Gentoo Packages</title>\n" % len(pkglist)) > out.write("<body>\n") > out.write(tableheader) > for pkg in pkglist: > pkgentry = getpkgentry(pkg) > out.write(pkgentry) > out.write(footer)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 989
: 290