1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
from lxml.html import fromstring
import string, urllib2
class GNOME(object):
# TODO: Shall we use some kind of yaml or json based format instead?
# Or move this data into DB?
pkgs = {
# Package in Portage : Package in GNOME
'gnome-base/gconf' : 'platform:GConf',
'gnome-base/orbit' : 'platform:ORBit2',
'gnome-extra/at-spi' : 'platform:at-spi',
'dev-libs/atk' : 'platform:atk',
'media-libs/audiofile' : 'platform:audiofile',
'media-sound/esound' : 'platform:esound',
'dev-libs/glib' : 'platform:glib',
'gnome-base/gnome-mime-data': 'platform:gnome-mime-data',
'gnome-base/gnome-vfs' : 'platform:gnome-vfs',
'x11-libs/gtk+' : 'platform:gtk+',
'dev-util/gtk-doc' : 'platform:gtk-doc',
'dev-libs/libIDL' : 'platform:libIDL',
'media-libs/libart_lgpl' : 'platform:libart_lgpl',
'gnome-base/libbonobo' : 'platform:libbonobo',
'gnome-base/libbonoboui' : 'platform:libbonoboui',
'gnome-base/libglade' : 'platform:libglade',
'gnome-base/libgnome' : 'platform:libgnome',
'gnome-base/libgnomecanvas' : 'platform:libgnomecanvas',
'gnome-base/libgnomeui' : 'platform:libgnomeui',
'x11-libs/pango' : 'platform:pango',
# missing: platform:gnome-vfs-monikers
#
# TODO: desktop, admin, devtools, bindings
}
# Url for fetching version information
url = 'http://ftp.gnome.org/pub/GNOME'
#teams/releng/2.30.2/versions'
ids = ('platform', 'desktop', 'admin', 'devtools', 'bindings')
def __init__(self):
pass
def fetch_and_parse_all(self):
"""Download and parse package version information."""
items = {}
# Read the latest release tarball versions using SHA256SUMS-files
for x in self.ids:
data = urllib2.urlopen('%s/%s/2.30/2.30.2/sources/SHA256SUMS-for-bz2' % \
(self.url, x))
for line in data.readlines():
# Extract tarball names with versions
rawline = line.strip().split(' ')[1][:-len('.tar.bz2')]
pkg, ver = rawline.rsplit('-', 1)
items["%s:%s" % (x, pkg)] = [ver]
data.close()
return items
if __name__ == '__main__':
print GNOME().fetch_and_parse_all()
|