summaryrefslogtreecommitdiff
path: root/layman
diff options
context:
space:
mode:
Diffstat (limited to 'layman')
-rw-r--r--layman/__init__.py0
-rw-r--r--layman/dbtools/__init__.py0
-rw-r--r--layman/dbtools/extradata.py93
-rw-r--r--layman/dbtools/feedextractors.py60
-rw-r--r--layman/dbtools/sharedutils.py45
5 files changed, 198 insertions, 0 deletions
diff --git a/layman/__init__.py b/layman/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layman/__init__.py
diff --git a/layman/dbtools/__init__.py b/layman/dbtools/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layman/dbtools/__init__.py
diff --git a/layman/dbtools/extradata.py b/layman/dbtools/extradata.py
new file mode 100644
index 0000000..117509f
--- /dev/null
+++ b/layman/dbtools/extradata.py
@@ -0,0 +1,93 @@
+# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
+# Licensed under GPL 2 or later
+
+QUALITY_CORE = 'core'
+QUALITY_STABLE = 'stable'
+QUALITY_TESTING = 'testing'
+QUALITY_EXPERIMENTAL = 'experimental'
+QUALITY_GRAVEYARD = 'graveyard'
+
+TRANSITION_DATA_EXTRA = {
+ 'bazaar':{
+ 'owner':{
+ 'name':'Mark Lee',
+ 'email':'malept@malept.com',
+ },
+ 'feeds':[
+ 'http://bazaar.launchpad.net/~serkan-kaba/serkan-overlay/mainline/atom',
+ ],
+ },
+ 'lila-theme':{
+ 'owner':{
+ 'email':'fosstux@gmail.com',
+ },
+ },
+ 'rbu':{
+ 'quality':QUALITY_EXPERIMENTAL,
+ 'owner':{
+ 'name':'Robert Buchholz',
+ },
+ },
+ 'sping':{
+ 'quality':QUALITY_EXPERIMENTAL,
+ 'owner':{
+ 'name':'Sebastian Pipping',
+ },
+ },
+ 'jyujin':{'feeds':['http://git.jyujin.de/?p=portage-overlay.git;a=atom']},
+ 'pioto-overlay':{'feeds':['http://git.pioto.org/gitweb/pioto-overlay.git?a=atom']},
+ 'thousand-parsec':{'feeds':['http://git.thousandparsec.net/gitweb/gitweb.cgi?p=gentoo-overlay.git;a=atom']},
+ 'hollow':{'feeds':['http://git.xnull.de/gitweb/?p=overlay.git;a=atom']},
+ 'zen-overlay':{'feeds':['http://git.zen-sources.org/?p=portage-overlay.git;a=atom']},
+ 'THE':{'feeds':['http://git.zen-sources.org/?p=THE.git;a=atom']},
+ 'lxde':{'feeds':['http://bitbucket.org/yngwin/lxde-overlay/atom/']},
+ 'njw':{'feeds':['http://git.njw.me.uk/cgit/cgit.cgi/njw-gentoo-local/atom/?h=master']},
+ 'oss-overlay':{'feeds':['http://hg.atheme.org/users/majeru/portage-overlay/atom-log']},
+ 'devnull':{'feeds':['http://hg.core.ws/devnull/atom-log']},
+ 'mamona':{'feeds':['http://rsalveti.net/git/?p=mamona-overlay;a=atom']},
+ 'voyageur':{'feeds':['http://cafarelli.fr/websvn/rss.php?repname=voyageur-overlay&path=&isdir=1']},
+ 'akoya':{'feeds':['https://hg.poildetroll.net/gentoo/overlay/atom-log']},
+ 'pd-overlay':{'feeds':['http://sourceforge.net/export/rss2_keepsake.php?group_id=180376']},
+ 'tryton':{'feeds':['http://hg.tryton.org/hgwebdir.cgi/tryton-overlay/atom-log']},
+ 'sabayon':{'feeds':['http://gitweb.sabayon.org/?p=overlay.git;a=atom']},
+}
+
+# List more or less from current <http://overlays.gentoo.org/>
+TRANSITION_DATA_PROJECTS = set((
+ 'cell',
+ 'efika',
+ 'emacs',
+ 'finnish',
+ 'gnome',
+ 'gnustep',
+ 'hardened-development',
+ 'java-overlay',
+ 'kde-testing',
+ 'kolab',
+ 'mozilla',
+ 'mysql-testing',
+ 'nx',
+ 'perl-experimental',
+ 'php-4',
+ 'php-experimental',
+ 'php-testing',
+ 'postgresql-experimental',
+ 'postgresql-testing',
+ 'powerpc',
+ 'python',
+ 'rox',
+ 'ruby',
+ 'science',
+ 'sunrise',
+ 'toolchain',
+ 'vdr-devel',
+ 'vdr-experimental',
+ 'vdr-testing',
+ 'vdr-xine',
+ 'vmware',
+ 'voip',
+ 'vps',
+ 'webapps-experimental',
+ 'xen',
+ 'xfce-dev',
+))
diff --git a/layman/dbtools/feedextractors.py b/layman/dbtools/feedextractors.py
new file mode 100644
index 0000000..553d9a8
--- /dev/null
+++ b/layman/dbtools/feedextractors.py
@@ -0,0 +1,60 @@
+# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
+# Licensed under GPL 2 or later
+
+import re
+FEED_EXTRACTORS = []
+
+def _register_feed_extractor(pattern, format):
+ regex = re.compile(pattern)
+ FEED_EXTRACTORS.append({'regex':regex, 'format':format})
+
+
+# git://github.com/dang/kvm.git
+# http://github.com/feeds/dang/commits/kvm/master
+_register_feed_extractor(
+ '^[^ ]+://github.com/([^/]+)/([^/.]+)(?:.git)?$',
+ 'http://github.com/feeds/\\1/commits/\\2/master')
+
+
+# git://gitorious.org/gentoo-multimedia/gentoo-multimedia.git
+# http://gitorious.org/gentoo-multimedia.atom
+_register_feed_extractor(
+ '^[^ ]+://gitorious.org/([^/]+)/[^/.]+(?:.git)?$',
+ 'http://gitorious.org/\\1.atom')
+
+# git://git.overlays.gentoo.org/dev/alexxy.git
+# http://git.overlays.gentoo.org/gitweb/?p=dev/alexxy.git;a=atom
+_register_feed_extractor(
+ '^[^ ]+://git.overlays.gentoo.org/(dev|proj)/([^/.]+)(?:.git)?$',
+ 'http://git.overlays.gentoo.org/gitweb/?p=\\1/\\2.git;a=atom')
+
+# git://repo.or.cz/dottout.git
+# http://repo.or.cz/w/dottout.git?a=rss
+_register_feed_extractor(
+ '^[^ ]+://repo.or.cz/([^/.]+)(?:.git)?$',
+ 'http://repo.or.cz/w/\\1.git?a=rss') # atom broken currently
+
+# http://gentoo-china-overlay.googlecode.com/svn/trunk/
+# http://code.google.com/feeds/p/gentoo-china-overlay/svnchanges/basic
+_register_feed_extractor(
+ '^[^ ]+://([^ ]+).googlecode.com/svn/.*$',
+ 'http://code.google.com/feeds/p/\\1/svnchanges/basic')
+
+# https://arcon.googlecode.com/hg/
+# http://code.google.com/feeds/p/arcon/hgchanges/basic
+_register_feed_extractor(
+ '^[^ ]+://([^ ]+).googlecode.com/hg/.*$',
+ 'http://code.google.com/feeds/p/\\1/hgchanges/basic')
+
+# git://git.goodpoint.de/overlay-sping.git
+# http://git.goodpoint.de/?p=overlay-sping.git;a=atom
+_register_feed_extractor(
+ '^[^ ]+://git.goodpoint.de/([^/.]+)(?:.git)?$',
+ 'http://git.goodpoint.de/?p=\\1.git;a=atom')
+
+
+# svn://overlays.gentoo.org/proj/toolchain
+# http://overlays.gentoo.org/proj/toolchain/timeline
+_register_feed_extractor(
+ '^svn://overlays.gentoo.org/(dev|proj)/([^/]+)(?:/.*)?$',
+ 'http://overlays.gentoo.org/\\1/\\2/timeline')
diff --git a/layman/dbtools/sharedutils.py b/layman/dbtools/sharedutils.py
new file mode 100644
index 0000000..9837b76
--- /dev/null
+++ b/layman/dbtools/sharedutils.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
+# Licensed under GPL 2 or later
+
+import codecs
+
+# From <http://effbot.org/zone/element-lib.htm>
+# BEGIN
+def indent(elem, level=0):
+ i = "\n" + level*" "
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ for elem in elem:
+ indent(elem, level+1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+# END
+
+def recurse_print(e, level=0):
+ t = e.text
+ if t:
+ if t == '' or t.isspace():
+ t = None
+ else:
+ t = t.strip('\n\r')
+ print '%s<%s>%s' % (' '*level, e.tag, t and (' .. %s' % to_ascii(t)) or '')
+ for k, v in sorted(e.attrib.items()):
+ print '%s| %s = %s' % (' '*(level+2), k, v)
+ for c in e.getchildren():
+ recurse_print(c, level=level + 1)
+
+def to_ascii(o, current_encoding='utf-8'):
+ if not isinstance(o, basestring):
+ return o
+
+ if isinstance(o, unicode):
+ s = o
+ else:
+ s = unicode(o, current_encoding)
+ return codecs.encode(s, 'ascii', 'ignore')