From c680afd2a2a913c7d43e5db515d4d4ab7762d010 Mon Sep 17 00:00:00 2001 From: abki Date: Wed, 1 Jul 2009 14:09:09 +0200 Subject: [PATCH] initial commit --- __init__.py | 0 commands/__init__.py | 0 commands/clean.sh | 5 + commands/layman | 37 + commands/lib/__init__.py | 0 commands/lib/layman/__init__.py | 1 + commands/lib/layman/action.py | 523 +++++ commands/lib/layman/bin/__init__.py | 0 commands/lib/layman/config.py | 325 ++++ commands/lib/layman/db.py | 588 ++++++ commands/lib/layman/debug.py | 507 +++++ commands/lib/layman/overlay.py | 244 +++ commands/lib/layman/overlays/__init__.py | 1 + commands/lib/layman/overlays/bzr.py | 66 + commands/lib/layman/overlays/cvs.py | 83 + commands/lib/layman/overlays/darcs.py | 64 + commands/lib/layman/overlays/git.py | 77 + commands/lib/layman/overlays/mercurial.py | 64 + commands/lib/layman/overlays/overlay.py | 301 +++ commands/lib/layman/overlays/rsync.py | 73 + commands/lib/layman/overlays/svn.py | 75 + commands/lib/layman/overlays/tar.py | 189 ++ commands/lib/layman/utils.py | 208 ++ commands/lib/layman/version.py | 24 + commands/manage_layman.py | 72 + commands/mylayman.cfg | 58 + commands/overlays.txt | 1232 ++++++++++++ commands/overlays.xml | 2999 +++++++++++++++++++++++++++++ commands/parse.py | 150 ++ commands/whoosh_manager.py | 56 + models.py | 29 + planet.py | 99 + templates/ebuildfind/bakup.html | 0 templates/ebuildfind/base.html | 131 ++ templates/ebuildfind/index.html | 2 + templates/ebuildfind/search.html | 21 + urls.py | 15 + views.py | 48 + 38 files changed, 8367 insertions(+) create mode 100644 __init__.py create mode 100644 commands/__init__.py create mode 100644 commands/clean.sh create mode 100755 commands/layman create mode 100644 commands/lib/__init__.py create mode 100644 commands/lib/layman/__init__.py create mode 100644 commands/lib/layman/action.py create mode 100644 commands/lib/layman/bin/__init__.py create mode 100644 commands/lib/layman/config.py create mode 100644 commands/lib/layman/db.py create mode 100644 commands/lib/layman/debug.py create mode 100644 commands/lib/layman/overlay.py create mode 100644 commands/lib/layman/overlays/__init__.py create mode 100644 commands/lib/layman/overlays/bzr.py create mode 100644 commands/lib/layman/overlays/cvs.py create mode 100644 commands/lib/layman/overlays/darcs.py create mode 100644 commands/lib/layman/overlays/git.py create mode 100644 commands/lib/layman/overlays/mercurial.py create mode 100644 commands/lib/layman/overlays/overlay.py create mode 100644 commands/lib/layman/overlays/rsync.py create mode 100644 commands/lib/layman/overlays/svn.py create mode 100644 commands/lib/layman/overlays/tar.py create mode 100644 commands/lib/layman/utils.py create mode 100644 commands/lib/layman/version.py create mode 100644 commands/manage_layman.py create mode 100644 commands/mylayman.cfg create mode 100644 commands/overlays.txt create mode 100644 commands/overlays.xml create mode 100644 commands/parse.py create mode 100644 commands/whoosh_manager.py create mode 100644 models.py create mode 100644 planet.py create mode 100644 templates/ebuildfind/bakup.html create mode 100644 templates/ebuildfind/base.html create mode 100755 templates/ebuildfind/index.html create mode 100644 templates/ebuildfind/search.html create mode 100644 urls.py create mode 100644 views.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/commands/__init__.py b/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/commands/clean.sh b/commands/clean.sh new file mode 100644 index 0000000..44a9815 --- /dev/null +++ b/commands/clean.sh @@ -0,0 +1,5 @@ +#!/usr/bin/bash + +rm -rf var/layman/$1 +./layman -c mylayman.cfg -a $1 +python parse.py \ No newline at end of file diff --git a/commands/layman b/commands/layman new file mode 100755 index 0000000..b0aa4f5 --- /dev/null +++ b/commands/layman @@ -0,0 +1,37 @@ +#!/usr/bin/python +################################################################################ +# LAYMAN - A UTILITY TO SELECT AND UPDATE GENTOO OVERLAYS +################################################################################ +# Distributed under the terms of the GNU General Public License v2 +# +# Copyright: +# (c) 2005 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# + +__version__ = "$Id$" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.config import Config +from layman.action import Actions + +#=============================================================================== +# +# MAIN +# +#------------------------------------------------------------------------------- + +def main(): + + Actions(Config()) + +if __name__ == "__main__": + main() diff --git a/commands/lib/__init__.py b/commands/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/commands/lib/layman/__init__.py b/commands/lib/layman/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/commands/lib/layman/__init__.py @@ -0,0 +1 @@ +# diff --git a/commands/lib/layman/action.py b/commands/lib/layman/action.py new file mode 100644 index 0000000..b7b36b6 --- /dev/null +++ b/commands/lib/layman/action.py @@ -0,0 +1,523 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN ACTIONS +################################################################################# +# File: action.py +# +# Handles layman actions. +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +''' Provides the different actions that can be performed by layman.''' + +__version__ = "$Id: action.py 312 2007-04-09 19:45:49Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import os, sys + +from layman.db import DB, RemoteDB + +from layman.debug import OUT + +#=============================================================================== +# +# Class Fetch +# +#------------------------------------------------------------------------------- + +class Fetch: + ''' Fetches the overlay listing. + + >>> import os + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> cache = os.tmpnam() + >>> config = {'overlays' : + ... 'file://' + here + '/tests/testfiles/global-overlays.xml', + ... 'cache' : cache, + ... 'nocheck' : True, + ... 'proxy' : None, + ... 'quietness':3} + >>> a = Fetch(config) + >>> a.run() + 0 + >>> b = open(a.db.path(config['overlays'])) + >>> b.readlines()[24] + ' A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].\\n' + + >>> b.close() + >>> os.unlink(a.db.path(config['overlays'])) + + >>> a.db.overlays.keys() + [u'wrobel', u'wrobel-stable'] + ''' + + def __init__(self, config): + self.db = RemoteDB(config) + + def run(self): + '''Fetch the overlay listing.''' + try: + self.db.cache() + except Exception, error: + OUT.die('Failed to fetch overlay list!\nError was: ' + + str(error)) + + return 0 + +#=============================================================================== +# +# Class Sync +# +#------------------------------------------------------------------------------- + +class Sync: + ''' Syncs the selected overlays.''' + + def __init__(self, config): + + self.db = DB(config) + + self.rdb = RemoteDB(config) + + self.quiet = int(config['quietness']) < 3 + + self.selection = config['sync'] + + if config['sync_all'] or 'ALL' in self.selection: + self.selection = self.db.overlays.keys() + + enc = sys.getfilesystemencoding() + if enc: + self.selection = [i.decode(enc) for i in self.selection] + + def run(self): + '''Synchronize the overlays.''' + + OUT.debug('Updating selected overlays', 6) + + warnings = [] + success = [] + for i in self.selection: + ordb = self.rdb.select(i) + odb = self.db.select(i) + if ordb and odb and ordb.src != odb.src: + warnings.append( + 'The source of the overlay "' + i + '" seems to have c' + 'hanged. You currently sync from "' + odb.src + '" whi' + 'le the global layman list reports "' + ordb.src + '" ' + 'as correct location. Please consider removing and rea' + 'dding the overlay!') + + try: + self.db.sync(i, self.quiet) + success.append('Successfully synchronized overlay "' + i + '".') + except Exception, error: + warnings.append( + 'Failed to sync overlay "' + i + '".\nError was: ' + + str(error)) + + if success: + OUT.info('\nSuccess:\n------\n', 3) + for i in success: + OUT.info(i, 3) + + if warnings: + OUT.warn('\nErrors:\n------\n', 2) + for i in warnings: + OUT.warn(i + '\n', 2) + return 1 + + return 0 + +#=============================================================================== +# +# Class Add +# +#------------------------------------------------------------------------------- + +class Add: + ''' Adds the selected overlays.''' + + def __init__(self, config): + + self.config = config + + self.db = DB(config) + + self.rdb = RemoteDB(config) + + self.quiet = int(config['quietness']) < 3 + + self.selection = config['add'] + + enc = sys.getfilesystemencoding() + if enc: + self.selection = [i.decode(enc) for i in self.selection] + + if 'ALL' in self.selection: + self.selection = self.rdb.overlays.keys() + + def run(self): + '''Add the overlay.''' + + OUT.debug('Adding selected overlays', 6) + + result = 0 + + for i in self.selection: + overlay = self.rdb.select(i) + + OUT.debug('Selected overlay', 7) + + if overlay: + try: + self.db.add(overlay, self.quiet) + OUT.info('Successfully added overlay "' + i + '".', 2) + except Exception, error: + OUT.warn('Failed to add overlay "' + i + '".\nError was: ' + + str(error), 2) + result = 1 + else: + OUT.warn('Overlay "' + i + '" does not exist!', 2) + result = 1 + + return result + +#=============================================================================== +# +# Class Delete +# +#------------------------------------------------------------------------------- + +class Delete: + ''' Deletes the selected overlays.''' + + def __init__(self, config): + + self.db = DB(config) + + self.selection = config['delete'] + + enc = sys.getfilesystemencoding() + if enc: + self.selection = [i.decode(enc) for i in self.selection] + + if 'ALL' in self.selection: + self.selection = self.db.overlays.keys() + + def run(self): + '''Delete the overlay.''' + + OUT.debug('Deleting selected overlays', 6) + + result = 0 + + for i in self.selection: + overlay = self.db.select(i) + + OUT.debug('Selected overlay', 7) + + if overlay: + try: + self.db.delete(overlay) + OUT.info('Successfully deleted overlay "' + i + '".', 2) + except Exception, error: + OUT.warn('Failed to delete overlay "' + i + '".\nError was: ' + + str(error), 2) + result = 1 + else: + OUT.warn('Overlay "' + i + '" does not exist!', 2) + result = 1 + + return result + +#=============================================================================== +# +# Class Info +# +#------------------------------------------------------------------------------- + +class Info: + ''' Print information about the specified overlays. + + >>> import os + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> cache = os.tmpnam() + >>> config = {'overlays' : + ... 'file://' + here + '/tests/testfiles/global-overlays.xml', + ... 'cache' : cache, + ... 'proxy' : None, + ... 'info' : ['wrobel'], + ... 'nocheck' : False, + ... 'verbose': False, + ... 'quietness':3} + >>> a = Info(config) + >>> a.rdb.cache() + >>> OUT.color_off() + >>> a.run() + * wrobel + * ~~~~~~ + * Source : https://overlays.gentoo.org/svn/dev/wrobel + * Contact : nobody@gentoo.org + * Type : Subversion; Priority: 10 + * + * Description: + * Test + * + 0 + ''' + + def __init__(self, config): + + OUT.debug('Creating RemoteDB handler', 6) + + self.rdb = RemoteDB(config) + self.config = config + + self.selection = config['info'] + + enc = sys.getfilesystemencoding() + if enc: + self.selection = [i.decode(enc) for i in self.selection] + + if 'ALL' in self.selection: + self.selection = self.rdb.overlays.keys() + + def run(self): + ''' Print information about the selected overlays.''' + + result = 0 + + for i in self.selection: + overlay = self.rdb.select(i) + + if overlay: + # Is the overlay supported? + OUT.info(overlay.__str__(), 1) + if not overlay.is_official(): + OUT.warn('*** This is no official gentoo overlay ***\n', 1) + if not overlay.is_supported(): + OUT.error('*** You are lacking the necessary tools to install t' + 'his overlay ***\n') + else: + OUT.warn('Overlay "' + i + '" does not exist!', 2) + result = 1 + + return result + +#=============================================================================== +# +# Class List +# +#------------------------------------------------------------------------------- + +class List: + ''' Lists the available overlays. + + >>> import os + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> cache = os.tmpnam() + >>> config = {'overlays' : + ... 'file://' + here + '/tests/testfiles/global-overlays.xml', + ... 'cache' : cache, + ... 'proxy' : None, + ... 'nocheck' : False, + ... 'verbose': False, + ... 'quietness':3, + ... 'width':80} + >>> a = List(config) + >>> a.rdb.cache() + >>> OUT.color_off() + >>> a.run() + * wrobel [Subversion] (https://o.g.o/svn/dev/wrobel ) + 0 + >>> a.config['verbose'] = True + >>> a.run() + * wrobel + * ~~~~~~ + * Source : https://overlays.gentoo.org/svn/dev/wrobel + * Contact : nobody@gentoo.org + * Type : Subversion; Priority: 10 + * + * Description: + * Test + * + * *** This is no official gentoo overlay *** + * + * wrobel-stable + * ~~~~~~~~~~~~~ + * Source : rsync://gunnarwrobel.de/wrobel-stable + * Contact : nobody@gentoo.org + * Type : Rsync; Priority: 50 + * + * Description: + * A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org]. + * + 0 + ''' + + def __init__(self, config): + + OUT.debug('Creating RemoteDB handler', 6) + + self.rdb = RemoteDB(config) + self.config = config + + def run(self): + ''' List the available overlays.''' + + for i in self.rdb.list(self.config['verbose'], self.config['width']): + # Is the overlay supported? + if i[1]: + # Is this an official overlay? + if i[2]: + OUT.info(i[0], 1) + # Unofficial overlays will only be listed if we are not + # checking or listing verbose + elif self.config['nocheck'] or self.config['verbose']: + # Give a reason why this is marked yellow if it is a verbose + # listing + if self.config['verbose']: + OUT.warn('*** This is no official gentoo overlay ***\n', 1) + OUT.warn(i[0], 1) + # Unsupported overlays will only be listed if we are not checking + # or listing verbose + elif self.config['nocheck'] or self.config['verbose']: + # Give a reason why this is marked red if it is a verbose + # listing + if self.config['verbose']: + OUT.error('*** You are lacking the necessary tools to insta' + 'll this overlay ***\n') + OUT.error(i[0]) + + return 0 + +#=============================================================================== +# +# Class ListLocal +# +#------------------------------------------------------------------------------- + +class ListLocal: + ''' Lists the local overlays.''' + + def __init__(self, config): + self.db = DB(config) + self.config = config + + def run(self): + '''List the overlays.''' + + for i in self.db.list(self.config['verbose']): + + OUT.debug('Printing local overlay.', 8) + + # Is the overlay supported? + if i[1]: + # Is this an official overlay? + if i[2]: + OUT.info(i[0], 1) + # Unofficial overlays will only be listed if we are not + # checking or listing verbose + else: + # Give a reason why this is marked yellow if it is a verbose + # listing + if self.config['verbose']: + OUT.warn('*** This is no official gentoo overlay ***\n', 1) + OUT.warn(i[0], 1) + # Unsupported overlays will only be listed if we are not checking + # or listing verbose + else: + # Give a reason why this is marked red if it is a verbose + # listing + if self.config['verbose']: + OUT.error('*** You are lacking the necessary tools to insta' + 'll this overlay ***\n') + OUT.error(i[0]) + + return 0 + +#=============================================================================== +# +# Class Actions +# +#------------------------------------------------------------------------------- + +class Actions: + '''Dispatches to the actions the user selected. ''' + + # Given in order of precedence + actions = [('fetch', Fetch), + ('add', Add), + ('sync', Sync), + ('info', Info), + ('sync_all', Sync), + ('delete', Delete), + ('list', List), + ('list_local', ListLocal),] + + def __init__(self, config): + + # Make fetching the overlay list a default action + if not 'nofetch' in config.keys(): + # Actions that implicitely call the fetch operation before + fetch_actions = ['fetch', 'sync', 'sync_all', 'list'] + for i in fetch_actions: + if i in config.keys(): + # Implicitely call fetch, break loop + Fetch(config).run() + break + + result = 0 + + # Set the umask + umask = config['umask'] + try: + new_umask = int(umask, 8) + old_umask = os.umask(new_umask) + except Exception, error: + OUT.die('Failed setting to umask "' + umask + '"!\nError was: ' + + str(error)) + + for i in self.actions: + + OUT.debug('Checking for action', 7) + + if i[0] in config.keys(): + result += i[1](config).run() + + # Reset umask + os.umask(old_umask) + + if not result: + sys.exit(0) + else: + sys.exit(1) + +#=============================================================================== +# +# Testing +# +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + import doctest, sys + + # Ignore warnings here. We are just testing + from warnings import filterwarnings, resetwarnings + filterwarnings('ignore') + + doctest.testmod(sys.modules[__name__]) + + resetwarnings() diff --git a/commands/lib/layman/bin/__init__.py b/commands/lib/layman/bin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/commands/lib/layman/config.py b/commands/lib/layman/config.py new file mode 100644 index 0000000..ba57c81 --- /dev/null +++ b/commands/lib/layman/config.py @@ -0,0 +1,325 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN CONFIGURATION +################################################################################# +# File: config.py +# +# Handles layman configuration +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +'''Defines the configuration options and provides parsing functionality.''' + +__version__ = "$Id: config.py 286 2007-01-09 17:48:23Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import sys, ConfigParser + +from optparse import OptionParser, OptionGroup +from layman.debug import OUT +from layman.version import VERSION + +#=============================================================================== +# +# Class Config +# +#------------------------------------------------------------------------------- + +class Config(object): + '''Handles the configuration.''' + + def __init__(self): + ''' + Creates and describes all possible polymeraZe options and creates + a debugging object. + + >>> import os.path + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> sys.argv.append('--config') + >>> sys.argv.append(here + '/../etc/layman.cfg') + >>> a = Config() + >>> a['overlays'] + '\\nhttp://www.gentoo.org/proj/en/overlays/layman-global.txt' + >>> sorted(a.keys()) + ['cache', 'config', 'local_list', 'make_conf', 'nocheck', 'overlays', 'proxy', 'quietness', 'storage', 'umask', 'width'] + ''' + + self.defaults = {'config' : '/etc/layman/layman.cfg', + 'storage' : '/usr/portage/local/layman', + 'cache' : '%(storage)s/cache', + 'local_list': '%(storage)s/overlays.xml', + 'make_conf' : '%(storage)s/make.conf', + 'nocheck' : 'yes', + 'proxy' : '', + 'umask' : '0022', + 'overlays' : + 'http://www.gentoo.org/proj/en/overlays/layman-global.' + 'txt',} + + + self.parser = OptionParser( + usage = '\n\nlayman -a/-d/-S|overlay\nlayman -f [-o url]\nlayman' \ + ' -l|-L', + version = VERSION) + + #----------------------------------------------------------------- + # Main Options + + group = OptionGroup(self.parser, + '') + + group.add_option('-a', + '--add', + action = 'append', + help = 'Add the given overlay from the cached remote li' + 'st to your locally installed overlays.. Specify "ALL" ' + 'to add all overlays from the remote list.') + + group.add_option('-d', + '--delete', + action = 'append', + help = 'Remove the given overlay from your locally inst' + 'alled overlays. Specify "ALL" to remove all overlays') + + group.add_option('-s', + '--sync', + action = 'append', + help = 'Update the specified overlay. Use "ALL" as para' + 'meter to synchronize all overlays') + + group.add_option('-i', + '--info', + action = 'append', + help = 'Display information about the specified overlay' + '.') + + group.add_option('-S', + '--sync-all', + action = 'store_true', + help = 'Update all overlays.') + + group.add_option('-L', + '--list', + action = 'store_true', + help = 'List the contents of the remote list.') + + group.add_option('-l', + '--list-local', + action = 'store_true', + help = 'List the locally installed overlays.') + + group.add_option('-f', + '--fetch', + action = 'store_true', + help = 'Fetch a remote list of overlays. This option is' + ' deprecated. The fetch operation will be performed by ' + 'default when you run sync, sync-all, or list.') + + group.add_option('-n', + '--nofetch', + action = 'store_true', + help = 'Do not fetch a remote list of overlays.') + + group.add_option('-p', + '--priority', + action = 'store', + help = 'Use this with the --add switch to set the prior' + 'ity of the added overlay. This will influence the sort' + 'ing order of the overlays in the PORTDIR_OVERLAY varia' + 'ble.') + + self.parser.add_option_group(group) + + #----------------------------------------------------------------- + # Additional Options + + group = OptionGroup(self.parser, + '') + + group.add_option('-c', + '--config', + action = 'store', + help = 'Path to the config file [default: ' \ + + self.defaults['config'] + '].') + + group.add_option('-o', + '--overlays', + action = 'append', + help = 'The list of overlays [default: ' \ + + self.defaults['overlays'] + '].') + + self.parser.add_option_group(group) + + #----------------------------------------------------------------- + # Output Options + + group = OptionGroup(self.parser, + '') + + group.add_option('-v', + '--verbose', + action = 'store_true', + help = 'Increase the amount of output and describe the ' + 'overlays.') + + group.add_option('-q', + '--quiet', + action = 'store_true', + help = 'Yield no output. Please be careful with this op' + 'tion: If the processes spawned by layman when adding o' + 'r synchronizing overlays require any input layman will' + ' hang without telling you why. This might happen for e' + 'xample if your overlay resides in subversion and the S' + 'SL certificate of the server needs acceptance.') + + group.add_option('-N', + '--nocolor', + action = 'store_true', + help = 'Remove color codes from the layman output.') + + group.add_option('-Q', + '--quietness', + action = 'store', + type = 'int', + default = '4', + help = 'Set the level of output (0-4). Default: 4. Once' + ' you set this below 2 the same warning as given for --' + 'quiet applies! ') + + group.add_option('-W', + '--width', + action = 'store', + type = 'int', + default = '0', + help = 'Sets the screen width. This setting is usually ' + 'not required as layman is capable of detecting the ava' + 'available number of columns automatically.') + + group.add_option('-k', + '--nocheck', + action = 'store_true', + help = 'Do not check overlay definitions and do not i' + 'ssue a warning if description or contact information' + ' are missing.') + + self.parser.add_option_group(group) + + #----------------------------------------------------------------- + # Debug Options + + OUT.cli_opts(self.parser) + + # Parse the command line first since we need to get the config + # file option. + (self.options, args) = self.parser.parse_args() + + # handle debugging + OUT.cli_handle(self.options) + + if self.options.__dict__['nocolor']: + OUT.color_off() + + # Fetch only an alternate config setting from the options + if not self.options.__dict__['config'] is None: + self.defaults['config'] = self.options.__dict__['config'] + + OUT.debug('Got config file at ' + self.defaults['config'], 8) + + # Now parse the config file + self.config = ConfigParser.ConfigParser(self.defaults) + self.config.add_section('MAIN') + + # handle quietness + if self['quiet']: + OUT.set_info_level(1) + OUT.set_warn_level(1) + self.defaults['quietness'] = 0 + + elif 'quietness' in self.keys(): + OUT.set_info_level(int(self['quietness'])) + OUT.set_warn_level(int(self['quietness'])) + + OUT.debug('Reading config file at ' + self.defaults['config'], 8) + + self.config.read(self.defaults['config']) + + def __getitem__(self, key): + + if key == 'overlays': + overlays = '' + if (key in self.options.__dict__.keys() + and not self.options.__dict__[key] is None): + overlays = '\n'.join(self.options.__dict__[key]) + if self.config.has_option('MAIN', 'overlays'): + overlays += '\n' + self.config.get('MAIN', 'overlays') + if overlays: + return overlays + + OUT.debug('Retrieving option', 8) + + if (key in self.options.__dict__.keys() + and not self.options.__dict__[key] is None): + return self.options.__dict__[key] + + OUT.debug('Retrieving option', 8) + + if self.config.has_option('MAIN', key): + if key == 'nocheck': + if self.config.get('MAIN', key).lower() == 'yes': + return True + else: + return False + return self.config.get('MAIN', key) + + OUT.debug('Retrieving option', 8) + + if key in self.defaults.keys(): + return self.defaults[key] + + OUT.debug('Retrieving option', 8) + + return None + + def keys(self): + '''Special handler for the configuration keys.''' + + OUT.debug('Retrieving keys', 8) + + keys = [i for i in self.options.__dict__.keys() + if not self.options.__dict__[i] is None] + + OUT.debug('Retrieving keys', 8) + + keys += [name for name, value in self.config.items('MAIN') + if not name in keys] + + OUT.debug('Retrieving keys', 8) + + keys += [i for i in self.defaults.keys() + if not i in keys] + + OUT.debug('Retrieving keys', 8) + + return keys + + +#=============================================================================== +# +# Testing +# +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + import doctest + doctest.testmod(sys.modules[__name__]) diff --git a/commands/lib/layman/db.py b/commands/lib/layman/db.py new file mode 100644 index 0000000..1baeabf --- /dev/null +++ b/commands/lib/layman/db.py @@ -0,0 +1,588 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN OVERLAY DB +################################################################################# +# File: db.py +# +# Access to the db of overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +'''Handles different storage files.''' + +__version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import os, codecs, os.path, urllib2, re, hashlib + +from layman.utils import path +from layman.overlay import Overlays + +from layman.debug import OUT + +#=============================================================================== +# +# Class DB +# +#------------------------------------------------------------------------------- + +class DB(Overlays): + ''' Handle the list of local overlays.''' + + def __init__(self, config): + + self.config = config + + self.path = config['local_list'] + + if config['nocheck']: + ignore = 2 + else: + ignore = 1 + + quiet = int(config['quietness']) < 3 + + Overlays.__init__(self, + [config['local_list'], ], + ignore, + quiet) + + OUT.debug('DB handler initiated', 6) + + def add(self, overlay, quiet = False): + ''' + Add an overlay to the local list of overlays. + + >>> write = os.tmpnam() + >>> write2 = os.tmpnam() + >>> write3 = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : write2, + ... 'nocheck' : True, + ... 'storage' : write3, + ... 'quietness':3} + + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> a = DB(config) + >>> config['local_list'] = write + >>> b = DB(config) + >>> OUT.color_off() + + >>> m = MakeConf(config, b.overlays) + >>> m.path = write2 + >>> m.write() + + Commented out since it needs network access: + + # >>> b.add(a.select('wrobel-stable')) #doctest: +ELLIPSIS + # * Running command "/usr/bin/rsync -rlptDvz --progress --delete --delete-after --timeout=180 --exclude="distfiles/*" --exclude="local/*" --exclude="packages/*" "rsync://gunnarwrobel.de/wrobel-stable/*" "/tmp/file.../wrobel-stable""... + # >>> c = Overlays([write, ]) + # >>> c.overlays.keys() + # [u'wrobel-stable'] + + # >>> m = MakeConf(config, b.overlays) + # >>> [i.name for i in m.overlays] #doctest: +ELLIPSIS + # [u'wrobel-stable'] + + + # >>> os.unlink(write) + >>> os.unlink(write2) + >>> import shutil + + # >>> shutil.rmtree(write3) + ''' + + if overlay.name not in self.overlays.keys(): + result = overlay.add(self.config['storage'], quiet) + if result == 0: + if 'priority' in self.config.keys(): + overlay.set_priority(self.config['priority']) + self.overlays[overlay.name] = overlay + self.write(self.path) + make_conf = MakeConf(self.config, self.overlays) + make_conf.add(overlay) + else: + raise Exception('Adding the overlay failed! Possible remains of' + ' the opration have NOT been removed and may be' + ' left at ' + path([self.config['storage'], + overlay.name]) + '. Please re' + 'move them manually if required.') + else: + raise Exception('Overlay "' + overlay.name + '" already in the loca' + 'l list!') + + def delete(self, overlay): + ''' + Add an overlay to the local list of overlays. + + >>> write = os.tmpnam() + >>> write2 = os.tmpnam() + >>> write3 = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : write2, + ... 'nocheck' : True, + ... 'storage' : write3, + ... 'quietness':3} + + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> a = DB(config) + >>> config['local_list'] = write + >>> b = DB(config) + >>> OUT.color_off() + + >>> m = MakeConf(config, b.overlays) + >>> m.path = here + '/tests/testfiles/make.conf' + >>> m.read() + + >>> m.path = write2 + >>> m.write() + + # >>> b.add(a.select('wrobel-stable')) #doctest: +ELLIPSIS + # * Running command "/usr/bin/rsync -rlptDvz --progress --delete --delete-after --timeout=180 --exclude="distfiles/*" --exclude="local/*" --exclude="packages/*" "rsync://gunnarwrobel.de/wrobel-stable/*" "/tmp/file.../wrobel-stable""... + # >>> b.add(a.select('wrobel')) #doctest: +ELLIPSIS + # * Running command "/usr/bin/svn co "https://overlays.gentoo.org/svn/dev/wrobel/" "/tmp/file.../wrobel""... + # >>> c = Overlays([write, ]) + # >>> c.overlays.keys() + # [u'wrobel', u'wrobel-stable'] + + # >>> b.delete(b.select('wrobel')) + # >>> c = Overlays([write, ]) + # >>> c.overlays.keys() + # [u'wrobel-stable'] + + # >>> m = MakeConf(config, b.overlays) + # >>> [i.name for i in m.overlays] #doctest: +ELLIPSIS + # [u'wrobel-stable'] + + # >>> os.unlink(write) + >>> os.unlink(write2) + >>> import shutil + + # >>> shutil.rmtree(write3) + ''' + + if overlay.name in self.overlays.keys(): + make_conf = MakeConf(self.config, self.overlays) + overlay.delete(self.config['storage']) + del self.overlays[overlay.name] + self.write(self.path) + make_conf.delete(overlay) + else: + raise Exception('No local overlay named "' + overlay.name + '"!') + + def sync(self, overlay_name, quiet = False): + '''Synchronize the given overlay.''' + + overlay = self.select(overlay_name) + + if overlay: + result = overlay.sync(self.config['storage'], quiet) + if result: + raise Exception('Syncing overlay "' + overlay_name + + '" returned status ' + str(result) + '!') + else: + raise Exception('No such overlay ("' + overlay_name + '")!') + +#=============================================================================== +# +# Class RemoteDB +# +#------------------------------------------------------------------------------- + +class RemoteDB(Overlays): + '''Handles fetching the remote overlay list.''' + + def __init__(self, config): + + self.config = config + + self.proxies = {} + + if config['proxy']: + self.proxies['http'] = config['proxy'] + elif os.getenv('http_proxy'): + self.proxies['http'] = os.getenv('http_proxy') + + if self.proxies: + proxy_handler = urllib2.ProxyHandler(self.proxies) + opener = urllib2.build_opener(proxy_handler) + urllib2.install_opener(opener) + + self.urls = [i.strip() for i in config['overlays'].split('\n') if i] + + paths = [self.path(i) for i in self.urls] + + if config['nocheck']: + ignore = 2 + else: + ignore = 0 + + quiet = int(config['quietness']) < 3 + + Overlays.__init__(self, paths, ignore, quiet) + + def cache(self): + ''' + Copy the remote overlay list to the local cache. + + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> cache = os.tmpnam() + >>> config = {'overlays' : + ... 'file://' + here + '/tests/testfiles/global-overlays.xml', + ... 'cache' : cache, + ... 'nocheck' : True, + ... 'proxy' : None, + ... 'quietness':3} + >>> a = RemoteDB(config) + >>> a.cache() + >>> b = open(a.path(config['overlays'])) + >>> b.readlines()[24] + ' A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].\\n' + + >>> b.close() + >>> os.unlink(a.path(config['overlays'])) + + >>> a.overlays.keys() + [u'wrobel', u'wrobel-stable'] + ''' + for url in self.urls: + + mpath = self.path(url) + + try: + + # Fetch the remote list + olist = urllib2.urlopen(url).read() + + # Create our storage directory if it is missing + if not os.path.exists(os.path.dirname(mpath)): + try: + os.makedirs(os.path.dirname(mpath)) + except OSError, error: + raise OSError('Failed to create layman storage direct' + + 'ory ' + os.path.dirname(mpath) + '\n' + + 'Error was:' + str(error)) + + # Before we overwrite the old cache, check that the downloaded + # file is intact and can be parsed + try: + self.read(olist) + except Exception, error: + raise IOError('Failed to parse the overlays list fetched fr' + 'om ' + url + '\nThis means that the download' + 'ed file is somehow corrupt or there was a pr' + 'oblem with the webserver. Check the content ' + 'of the file. Error was:\n' + str(error)) + + # Ok, now we can overwrite the old cache + try: + out_file = open(mpath, 'w') + out_file.write(olist) + out_file.close() + + except Exception, error: + raise IOError('Failed to temporarily cache overlays list in' + ' ' + mpath + '\nError was:\n' + str(error)) + + + except IOError, error: + OUT.warn('Failed to update the overlay list from: ' + + url + '\nError was:\n' + str(error)) + + try: + # Finally parse the contents of the cache + self.read_file(mpath) + except IOError, error: + OUT.warn('Failed to read a cached version of the overlay list f' + 'rom ' + url + '. You probably did not download the fi' + 'le before. The corresponding entry in your layman.cfg' + ' file will be disregarded.\nError was:\n' + str(error) + ) + + def path(self, url): + '''Return a unique file name for the url.''' + + base = self.config['cache'] + + OUT.debug('Generating cache path.', 6) + + return base + '_' + hashlib.md5(url).hexdigest() + '.xml' + +#=============================================================================== +# +# Helper class MakeConf +# +#------------------------------------------------------------------------------- + +class MakeConf: + ''' + Handles modifications to /etc/make.conf + + Check that an add/remove cycle does not modify the make.conf: + + >>> import hashlib + >>> write = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : here + '/tests/testfiles/make.conf', + ... 'nocheck' : True, + ... 'storage' : '/usr/portage/local/layman', + ... 'quietness':3} + >>> b = DB(config) + >>> a = MakeConf(config, b.overlays) + >>> o_md5 = str(hashlib.md5(open(here + '/tests/testfiles/make.conf').read()).hexdigest()) + >>> a.path = write + >>> a.add(b.overlays['wrobel-stable']) + >>> [i.name for i in a.overlays] + [u'wrobel-stable', u'wrobel-stable'] + >>> a.add(b.overlays['wrobel']) + >>> [i.name for i in a.overlays] + [u'wrobel', u'wrobel-stable', u'wrobel-stable'] + >>> a.delete(b.overlays['wrobel-stable']) + >>> [i.name for i in a.overlays] + [u'wrobel'] + >>> a.add(b.overlays['wrobel-stable']) + >>> [i.name for i in a.overlays] + [u'wrobel', u'wrobel-stable'] + >>> a.delete(b.overlays['wrobel']) + >>> n_md5 = str(hashlib.md5(open(write).read()).hexdigest()) + >>> o_md5 == n_md5 + True + >>> os.unlink(write) + ''' + + my_re = re.compile('PORTDIR_OVERLAY\s*=\s*"([^"]*)"') + + def __init__(self, config, overlays): + + self.path = config['make_conf'] + self.storage = config['storage'] + self.data = '' + self.db = overlays + self.overlays = [] + self.extra = [] + + self.read() + + def add(self, overlay): + ''' + Add an overlay to make.conf. + + >>> write = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : here + '/tests/testfiles/make.conf', + ... 'nocheck' : True, + ... 'storage' : '/usr/portage/local/layman', + ... 'quietness':3} + >>> c = DB(config) + >>> a = MakeConf(config, c.overlays) + >>> a.path = write + >>> a.add(c.select('wrobel')) + >>> config['make_conf'] = write + >>> b = MakeConf(config, c.overlays) + >>> [i.name for i in b.overlays] + [u'wrobel', u'wrobel-stable'] + >>> b.extra + [u'/usr/portage/local/ebuilds/testing', u'/usr/portage/local/ebuilds/stable', u'/usr/portage/local/kolab2', u'/usr/portage/local/gentoo-webapps-overlay/experimental', u'/usr/portage/local/gentoo-webapps-overlay/production-ready'] + + >>> os.unlink(write) + ''' + self.overlays.append(overlay) + self.write() + + def delete(self, overlay): + ''' + Delete an overlay from make.conf. + + >>> write = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : here + '/tests/testfiles/make.conf', + ... 'nocheck' : True, + ... 'storage' : '/usr/portage/local/layman', + ... 'quietness':3} + >>> c = DB(config) + >>> a = MakeConf(config, c.overlays) + >>> a.path = write + >>> a.delete(c.select('wrobel-stable')) + >>> config['make_conf'] = write + >>> b = MakeConf(config, c.overlays) + >>> [i.name for i in b.overlays] + [] + >>> b.extra + [u'/usr/portage/local/ebuilds/testing', u'/usr/portage/local/ebuilds/stable', u'/usr/portage/local/kolab2', u'/usr/portage/local/gentoo-webapps-overlay/experimental', u'/usr/portage/local/gentoo-webapps-overlay/production-ready'] + + >>> os.unlink(write) + ''' + self.overlays = [i + for i in self.overlays + if i.name != overlay.name] + self.write() + + def read(self): + ''' + Read the list of registered overlays from /etc/make.conf. + + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : here + '/tests/testfiles/make.conf', + ... 'nocheck' : True, + ... 'storage' : '/usr/portage/local/layman', + ... 'quietness':3} + >>> c = DB(config) + >>> a = MakeConf(config, c.overlays) + >>> [i.name for i in a.overlays] + [u'wrobel-stable'] + >>> a.extra + [u'/usr/portage/local/ebuilds/testing', u'/usr/portage/local/ebuilds/stable', u'/usr/portage/local/kolab2', u'/usr/portage/local/gentoo-webapps-overlay/experimental', u'/usr/portage/local/gentoo-webapps-overlay/production-ready'] + ''' + if os.path.isfile(self.path): + self.content() + + overlays = self.my_re.search(self.data) + + if not overlays: + raise Exception('Did not find a PORTDIR_OVERLAY entry in file ' + + self.path +'! Did you specify the correct file?') + + overlays = [i.strip() + for i in overlays.group(1).split('\n') + if i.strip()] + + for i in overlays: + if i[:len(self.storage)] == self.storage: + oname = os.path.basename(i) + if oname in self.db.keys(): + self.overlays.append(self.db[oname]) + else: + # These are additional overlays that we dont know + # anything about. The user probably added them manually + self.extra.append(i) + else: + # These are additional overlays that we dont know anything + # about. The user probably added them manually + self.extra.append(i) + + + else: + self.overlays = [] + self.data = 'PORTDIR_OVERLAY="\n"\n' + + self.extra = [i for i in self.extra + if (i != '$PORTDIR_OVERLAY' + and i != '${PORTDIR_OVERLAY}')] + + def write(self): + ''' + Write the list of registered overlays to /etc/make.conf. + + >>> write = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> config = {'local_list' : + ... here + '/tests/testfiles/global-overlays.xml', + ... 'make_conf' : here + '/tests/testfiles/make.conf', + ... 'nocheck' : True, + ... 'storage' : '/usr/portage/local/layman', + ... 'quietness':3} + >>> c = DB(config) + >>> a = MakeConf(config, c.overlays) + >>> a.path = write + >>> a.write() + >>> config['make_conf'] = write + >>> b = MakeConf(config, c.overlays) + >>> [i.name for i in b.overlays] + [u'wrobel-stable'] + >>> b.extra + [u'/usr/portage/local/ebuilds/testing', u'/usr/portage/local/ebuilds/stable', u'/usr/portage/local/kolab2', u'/usr/portage/local/gentoo-webapps-overlay/experimental', u'/usr/portage/local/gentoo-webapps-overlay/production-ready'] + + >>> os.unlink(write) + ''' + def prio_sort(a, b): + '''Sort by priority.''' + if a.priority < b.priority: + return -1 + elif a.priority > b.priority: + return 1 + return 0 + + self.overlays.sort(prio_sort) + + paths = [] + for i in self.overlays: + paths.append(path((self.storage, i.name, ))) + + overlays = 'PORTDIR_OVERLAY="\n' + overlays += '\n'.join(paths) + '\n' + overlays += '$PORTDIR_OVERLAY\n' + overlays += '\n'.join(self.extra) + overlays += '"' + + content = self.my_re.sub(overlays, self.data) + + if not self.my_re.search(content): + raise Exception('Ups, failed to set a proper PORTDIR_OVERLAY entry ' + 'in file ' + self.path +'! Did not overwrite the fi' + 'le.') + + try: + make_conf = codecs.open(self.path, 'w', 'utf-8') + + make_conf.write(content) + + make_conf.close() + + except Exception, error: + raise Exception('Failed to read "' + self.path + '".\nError was:\n' + + str(error)) + + def content(self): + ''' + Returns the content of the /etc/make.conf file. + ''' + try: + make_conf = codecs.open(self.path, 'r', 'utf-8') + + self.data = make_conf.read() + + make_conf.close() + + except Exception, error: + raise Exception('Failed to read "' + self.path + '".\nError was:\n' + + str(error)) + +#=============================================================================== +# +# Testing +# +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + import doctest, sys + + # Ignore warnings here. We are just testing + from warnings import filterwarnings, resetwarnings + filterwarnings('ignore') + + doctest.testmod(sys.modules[__name__]) + + resetwarnings() diff --git a/commands/lib/layman/debug.py b/commands/lib/layman/debug.py new file mode 100644 index 0000000..c5cf3a0 --- /dev/null +++ b/commands/lib/layman/debug.py @@ -0,0 +1,507 @@ +################################################################################# +# LAYMAN - DEBUGGING FUNCTIONS +################################################################################# +# debug.py -- Utility function for debugging +# Copyright 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 + +__version__ = "$Id: debug.py 153 2006-06-05 06:03:16Z wrobel $" + +################################################################################# +## +## Dependancies +## +################################################################################# + +import sys, inspect, types + +from optparse import OptionGroup + +################################################################################# +## +## Color codes (taken from portage) +## +################################################################################# + +esc_seq = '\x1b[' + +codes = {} +codes['reset'] = esc_seq + '39;49;00m' +codes['red'] = esc_seq + '31;01m' +codes['green'] = esc_seq + '32;01m' +codes['yellow'] = esc_seq + '33;01m' +codes['turquoise'] = esc_seq + '36;01m' + +################################################################################# +## +## Message Class +## +################################################################################# + +class Message: + #FIXME: Think about some simple doctests before you modify this class the + # next time. + + def __init__(self, module = '', + err = sys.stderr, + dbg = sys.stderr, + debugging_level = 4, + debugging_verbosity = 2, + info_level = 4, + warn_level = 4, + col = True, + mth = ['*'], + obj = ['*'], + var = ['*']): + + # A description of the module that is being debugged + self.debug_env = module + + # Where should the debugging output go? This can also be a file + self.debug_out = dbg + + # Where should the error output go? This can also be a file + self.error_out = err + + # The higher the level the more information you will get + self.warn_lev = warn_level + + # The higher the level the more information you will get + self.info_lev = info_level + + # The highest level of debugging messages acceptable for output + # The higher the level the more output you will get + self.debug_lev = debugging_level + + # The debugging output can range from very verbose (3) to + # very compressed (1) + self.debug_vrb = debugging_verbosity + + # Which methods should actually be debugged? + # Use '*' to indicate 'All methods' + self.debug_mth = mth + + # Which objects should actually be debugged? + # Use '*' to indicate 'All objects' + self.debug_obj = obj + + # Which variables should actually be debugged? + # Use '*' to indicate 'All variables' + self.debug_var = var + + # Exclude class variables by default + self.show_class_variables = False + + # Should the output be colored? + self.use_color = col + + self.has_error = False + + + ############################################################################ + # Add command line options + + def cli_opts(self, parser): + + group = OptionGroup(parser, + '', + 'Control the debugging features of ' + + self.debug_env) + + group.add_option('--debug', + action = 'store_true', + help = 'Activates debugging features.') + + group.add_option('--debug-level', + action = 'store', + type = 'int', + help = 'A value between 0 and 10. 0 means no debugging ' + 'messages will be selected, 10 selects all debugging me' + 'ssages. Default is "4".') + + group.add_option('--debug-verbose', + action = 'store', + type = 'int', + help = 'A value between 1 and 3. Lower values yield les' + 's verbose debugging output. Default is "2".') + + group.add_option('--debug-methods', + action = 'store', + help = 'Limits the methods that will return debugging o' + 'utput. The function name is sufficient and there is no' + 'difference between class methods or general functions.' + ' Several methods can be specified by seperating them w' + ' with a comma. Default is "*" which specifies all meth' + 'ods.') + + group.add_option('--debug-classes', + action = 'store', + help = 'Limits the classes that will return debugging o' + 'utput. Specify only the class name not including the m' + 'odules in which the class is defined (e.g. MyModule.ma' + 'in.Main should only be represented by "Main"). Several' + 'classes can be specified by seperating them with a com' + 'ma. Default is "*" which specifies all classes.') + + group.add_option('--debug-variables', + action = 'store', + help = 'Limits the variables that will return debugging' + ' output. Several variables can be specified by seperat' + 'ing them with a comma. Default is "*" which specifies ' + 'all variables.') + + group.add_option('--debug-class-vars', + action = 'store_true', + help = 'In default mode the debugging code will only re' + 'turn information on the local variable which does not ' + 'include the class variables. Use this switch to add al' + 'l values that are provided by "self".') + + group.add_option('--debug-nocolor', + action = 'store_true', + help = 'Deactivates colors in the debugging output.') + + parser.add_option_group(group) + + + ############################################################################# + # Handle command line options + + def cli_handle(self, options): + + if (options.__dict__.has_key('debug') + and options.__dict__['debug']): + self.debug_on() + else: + self.debug_off() + return + + if (options.__dict__.has_key('debug_class_vars') + and options.__dict__['debug_class_vars']): + self.class_variables_on() + else: + self.class_variables_off() + + if (options.__dict__.has_key('debug_nocolor') + and options.__dict__['debug_nocolor']): + self.color_off() + else: + self.color_on() + + if (options.__dict__.has_key('debug_level') and + options.__dict__['debug_level']): + dbglvl = int(options.__dict__['debug_level']) + if dbglvl < 0: + dbglvl = 0 + if dbglvl > 10: + dbglvl = 10 + self.set_debug_level(dbglvl) + + if (options.__dict__.has_key('debug_verbose') and + options.__dict__['debug_verbose']): + dbgvrb = int(options.__dict__['debug_verbose']) + if dbgvrb < 1: + dbgvrb = 1 + if dbgvrb > 3: + dbgvrb = 3 + self.set_debug_verbosity(dbgvrb) + + for i in [('debug_methods', self.set_debug_methods), + ('debug_classes', self.set_debug_classes), + ('debug_variables', self.set_debug_variables),]: + + if (options.__dict__.has_key(i[0]) and + options.__dict__[i[0]]): + i[1](options.__dict__[i[0]]) + + + ############################################################################# + ## Helper Functions + + def set_module(self, module): + + self.debug_env = module + + def set_debug_methods(self, methods): + + methods = methods.split(',') + + if methods: + self.debug_mth = methods + + def set_debug_classes(self, classes): + + classes = classes.split(',') + + if classes: + self.debug_obj = classes + + def set_debug_variables(self, variables): + + variables = variables.split(',') + + if variables: + self.debug_var = variables + + def maybe_color (self, col, text): + if self.use_color: + return codes[col] + text + codes['reset'] + return text + + def set_info_level(self, info_level = 4): + self.info_lev = info_level + + def info_off(self): + self.set_info_level(0) + + def info_on(self, info_level = 4): + self.set_info_level(info_level) + + def set_warn_level(self, warn_level = 4): + self.warn_lev = warn_level + + def warn_off(self): + self.set_warn_level(0) + + def warn_on(self, warn_level = 4): + self.set_warn_level(warn_level) + + def set_debug_level(self, debugging_level = 4): + self.debug_lev = debugging_level + + def set_debug_verbosity(self, debugging_verbosity = 2): + self.debug_vrb = debugging_verbosity + + def debug_off(self): + self.set_debug_level(0) + + def debug_on(self): + self.set_debug_level() + + def color_off(self): + self.use_color = False + + def color_on(self): + self.use_color = True + + def class_variables_off(self): + self.show_class_variables = False + + def class_variables_on(self): + self.show_class_variables = True + + ############################################################################# + ## Output Functions + + def notice (self, note): + print note + + def info (self, info, level = 4): + + if type(info) not in types.StringTypes: + info = str(info) + + if level > self.info_lev: + return + + for i in info.split('\n'): + print self.maybe_color('green', '* ') + i + + def status (self, message, status, info = 'ignored'): + + if type(message) not in types.StringTypes: + message = str(message) + + lines = message.split('\n') + + if not lines: + return + + for i in lines[0:-1]: + print self.maybe_color('green', '* ') + i + + i = lines[-1] + + if len(i) > 58: + i = i[0:57] + + if status == 1: + result = '[' + self.maybe_color('green', 'ok') + ']' + elif status == 0: + result = '[' + self.maybe_color('red', 'failed') + ']' + else: + result = '[' + self.maybe_color('yellow', info) + ']' + + print self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i)) \ + + ' ' + result + + def warn (self, warn, level = 4): + + if type(warn) not in types.StringTypes: + warn = str(warn) + + if level > self.warn_lev: + return + + for i in warn.split('\n'): + print self.maybe_color('yellow', '* ') + i + + def error (self, error): + + if type(error) not in types.StringTypes: + error = str(error) + + for i in error.split('\n'): + print >> self.error_out, self.maybe_color('red', '* ') + i + self.has_error = True + + def die (self, error): + + if type(error) not in types.StringTypes: + error = str(error) + + for i in error.split('\n'): + self.error(self.maybe_color('red', 'Fatal error: ') + i) + self.error(self.maybe_color('red', 'Fatal error(s) - aborting')) + sys.exit(1) + + def debug (self, message, level = 4): + ''' + This is a generic debugging method. + ''' + ## Check the debug level first. This is the most inexpensive check. + if level > self.debug_lev: + return + + ## Maybe this should be debugged. So get the stack first. + stack = inspect.stack() + + ## This can probably never happen but does not harm to check + ## that there is actually something calling this function + if len(stack) < 2: + return + + ## Get the stack length to determine indentation of the debugging output + stacklength = len(stack) + ls = ' ' * stacklength + + ## Get the information about the caller + caller = stack[1] + + ## The function name of the calling frame is the fourth item in the list + callermethod = caller[3] + + ## Is this actually one of the methods that should be debugged? + if not '*' in self.debug_mth and not callermethod in self.debug_mth: + return + + ## Still looks like this should be debugged. So retrieve the dictionary + ## of local variables from the caller + callerlocals = inspect.getargvalues(caller[0])[3] + + ## Is the caller an obejct? If so he provides 'self' + if 'self' in callerlocals.keys(): + callerobject = callerlocals['self'] + del callerlocals['self'] + if self.show_class_variables: + cv = inspect.getmembers(callerobject, + lambda x: not inspect.ismethod(x)) + callerlocals.sync(cv) + else: + callerobject = None + + # Remove variables not requested + if not '*' in self.debug_var: + callerlocals = dict([i for i in callerlocals.items() + if i[0] in self.debug_var]) + + ## Is the object among the list of objects to debug? + if (not '*' in self.debug_obj and + not str(callerobject.__class__.__name__) in self.debug_obj): + return + + if type(message) not in types.StringTypes: + message = str(message) + + def breaklines(x): + ''' + Helper function to keep width of the debugging output. + + This may look ugly for arrays but it is acceptable and not + breaking the line would break the output format + ''' + ## Get the number of lines we need (rounded down) + lines = len(x) // 60 + if lines > 0: + for j in range(lines): + ## Print line with continuation marker + print >> self.debug_out, ls + '// ' + x[0:60] + ' \\' + ## Remove printed characters from output + x = x[60:] + ## Print final line + print >> self.debug_out, ls + '// ' + x + + if self.debug_vrb == 1: + # Top line indicates class and method + c = '' + if callerobject: + c += 'Class: ' + str(callerobject.__class__.__name__) + ' | ' + if callermethod: + c += 'Method: ' + str(callermethod) + print >> self.debug_out, '// ' + c + # Selected variables follow + if callerlocals: + for i,j in callerlocals.items(): + print >> self.debug_out, '// ' \ + + self.maybe_color('turquoise', str(i)) + ':' + str(j) + # Finally the message + print >> self.debug_out, self.maybe_color('yellow', message) + return + + if self.debug_vrb == 3: + print >> self.debug_out, ls + '/////////////////////////////////' + \ + '////////////////////////////////' + + # General information about what is being debugged + #(module name or similar) + print >> self.debug_out, ls + '// ' + self.debug_env + print >> self.debug_out, ls + '//-----------------------------------' + \ + '----------------------------' + + ## If the caller is a class print the name here + if callerobject: + print >> self.debug_out, ls + \ + '// Object Class: ' + str(callerobject.__class__.__name__) + + ## If the method has been extracted print it here + if callermethod: + print >> self.debug_out, ls + '// ' \ + + self.maybe_color('green', 'Method: ') + str(callermethod) + if self.debug_vrb == 3: + print >> self.debug_out, ls + '//---------------------------' + \ + '------------------------------------' + + ## Print the information on all available local variables + if callerlocals: + if self.debug_vrb == 3: + print >> self.debug_out, ls + '//' + print >> self.debug_out, ls + '// VALUES ' + for i,j in callerlocals.items(): + print >> self.debug_out, ls + '// ------------------> ' \ + + self.maybe_color('turquoise', str(i)) + ':' + breaklines(str(j)) + if self.debug_vrb == 3: + print >> self.debug_out, ls + '//------------------------------'\ + '---------------------------------' + + # Finally print the message + breaklines(self.maybe_color('yellow', message)) + + if self.debug_vrb == 3: + print >> self.debug_out, ls + '//-------------------------------' + \ + '--------------------------------' + print >> self.debug_out, ls + '/////////////////////////////////' + \ + '////////////////////////////////' + +## gloabal message handler +OUT = Message('layman') diff --git a/commands/lib/layman/overlay.py b/commands/lib/layman/overlay.py new file mode 100644 index 0000000..fadb59d --- /dev/null +++ b/commands/lib/layman/overlay.py @@ -0,0 +1,244 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN OVERLAY HANDLER +################################################################################# +# File: overlay.py +# +# Access to an xml list of overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +'''Main handler for overlays.''' + +__version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import sys, codecs, os, os.path, xml.dom.minidom + +from layman.overlays.bzr import BzrOverlay +from layman.overlays.darcs import DarcsOverlay +from layman.overlays.git import GitOverlay +from layman.overlays.mercurial import MercurialOverlay +from layman.overlays.cvs import CvsOverlay +from layman.overlays.svn import SvnOverlay +from layman.overlays.rsync import RsyncOverlay +from layman.overlays.tar import TarOverlay + +from layman.debug import OUT + +#=============================================================================== +# +# Constants +# +#------------------------------------------------------------------------------- + +OVERLAY_TYPES = {'git' : GitOverlay, + 'cvs' : CvsOverlay, + 'svn' : SvnOverlay, + 'rsync' : RsyncOverlay, + 'tar' : TarOverlay, + 'bzr' : BzrOverlay, + 'mercurial' : MercurialOverlay, + 'darcs' : DarcsOverlay} + +#=============================================================================== +# +# Class Overlays +# +#------------------------------------------------------------------------------- + +class Overlays: + ''' Handle a list of overlays.''' + + def __init__(self, paths, ignore = 0, quiet = False): + + self.quiet = quiet + self.paths = paths + self.ignore = ignore + + self.overlays = {} + + OUT.debug('Initializing overlay list handler', 8) + + for path in self.paths: + if os.path.exists(path): + self.read_file(path) + + def read_file(self, path): + '''Read the overlay definition file.''' + + try: + document = open(path).read() + + except Exception, error: + raise IOError('Failed to read the overlay list at ("' + + path + '")!\nError was:\n' + str(error)) + + + self.read(document) + + def read(self, document): + ''' + Read an xml list of overlays. + + >>> here = os.path.dirname(os.path.realpath(__file__)) + + >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ]) + >>> a.overlays.keys() + [u'wrobel', u'wrobel-stable'] + + >>> a.overlays['wrobel-stable'].data['&src'] + u'rsync://gunnarwrobel.de/wrobel-stable' + ''' + try: + document = xml.dom.minidom.parseString(document) + + except Exception, error: + raise Exception('Failed to parse the overlay list!\nError was:\n' + + str(error)) + + overlays = document.getElementsByTagName('overlay') + + for overlay in overlays: + + OUT.debug('Parsing overlay entry', 8) + + for index in range(0, overlay.attributes.length): + attr = overlay.attributes.item(index) + if attr.name == 'type': + if attr.nodeValue in OVERLAY_TYPES.keys(): + try: + ovl = OVERLAY_TYPES[attr.nodeValue](overlay, + self.ignore, + self.quiet) + self.overlays[ovl.name] = ovl + except Exception, error: + OUT.warn(str(error), 3) + else: + raise Exception('Unknown overlay type "' + + attr.nodeValue + '"!') + + def write(self, path): + ''' + Write the list of overlays to a file. + + >>> write = os.tmpnam() + >>> here = os.path.dirname(os.path.realpath(__file__)) + + >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ]) + >>> b = Overlays([write,]) + >>> b.overlays['wrobel-stable'] = a.overlays['wrobel-stable'] + >>> b.write(write) + >>> c = Overlays([write,]) + >>> c.overlays.keys() + [u'wrobel-stable'] + + >>> os.unlink(write) + ''' + + imp = xml.dom.minidom.getDOMImplementation() + + doc = imp.createDocument('layman', 'overlays', None) + + root = doc.childNodes[0] + + for name, overlay in self.overlays.items(): + + root.appendChild(overlay.to_minidom(doc)) + + try: + + out_file = codecs.open(path, 'w', 'utf-8') + + doc.writexml(out_file, '', ' ', '\n') + + except Exception, error: + raise Exception('Failed to write to local overlays file: ' + + path + '\nError was:\n' + str(error)) + + def select(self, overlay): + ''' + Select an overlay from the list. + + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ]) + >>> a.select('wrobel-stable').data['&src'] + u'rsync://gunnarwrobel.de/wrobel-stable' + ''' + if overlay in self.overlays.keys(): + return self.overlays[overlay] + + def list(self, verbose = False, width = 0): + ''' + List all overlays. + + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ]) + >>> for i in a.list(True): + ... print i[0] + wrobel + ~~~~~~ + Source : https://overlays.gentoo.org/svn/dev/wrobel + Contact : nobody@gentoo.org + Type : Subversion; Priority: 10 + + Description: + Test + + wrobel-stable + ~~~~~~~~~~~~~ + Source : rsync://gunnarwrobel.de/wrobel-stable + Contact : nobody@gentoo.org + Type : Rsync; Priority: 50 + + Description: + A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org]. + + + >>> for i in a.list(False, 80): + ... print i[0] + wrobel [Subversion] (https://o.g.o/svn/dev/wrobel ) + wrobel-stable [Rsync ] (rsync://gunnarwrobel.de/wrobel-stable) + ''' + result = [] + + for name, overlay in self.overlays.items(): + + if verbose: + result.append((str(overlay), overlay.is_supported(), + overlay.is_official())) + else: + result.append((overlay.short_list(width), overlay.is_supported(), + overlay.is_official())) + + result = sorted(result) + + return result + +#=============================================================================== +# +# Testing +# +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + import doctest, sys + + # Ignore warnings here. We are just testing + from warnings import filterwarnings, resetwarnings + filterwarnings('ignore') + + doctest.testmod(sys.modules[__name__]) + + resetwarnings() diff --git a/commands/lib/layman/overlays/__init__.py b/commands/lib/layman/overlays/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/commands/lib/layman/overlays/__init__.py @@ -0,0 +1 @@ +# diff --git a/commands/lib/layman/overlays/bzr.py b/commands/lib/layman/overlays/bzr.py new file mode 100644 index 0000000..4c14278 --- /dev/null +++ b/commands/lib/layman/overlays/bzr.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN BZR OVERLAY HANDLER +################################################################################# +# File: bzr.py +# +# Handles bzr overlays +# +# Copyright: +# (c) 2005 - 2008 Adrian Perez, Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Adrian Perez +# Gunnar Wrobel +# +'''Should work with any version of Bzr equal to or better than 0.7 -- + caution: tested only with 0.8 and 0.8.2...''' + +__version__ = "$Id: bzr.py 236 2006-09-05 20:39:37Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class BzrOverlay +# +#------------------------------------------------------------------------------- + +class BzrOverlay(Overlay): + ''' Handles bzr overlays.''' + + type = 'Bzr' + + binary_command = '/usr/bin/bzr' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + return self.cmd(self.binary_command + ' get "' + self.src + '/" "' +\ + path([base, self.name]) + '"') + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + return self.cmd('cd "' + path([base, self.name]) + '" && ' + \ + self.binary_command + ' pull --overwrite "' + self.src \ + + '"') + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary_command, 'bzr', + 'dev-util/bzr'),]) diff --git a/commands/lib/layman/overlays/cvs.py b/commands/lib/layman/overlays/cvs.py new file mode 100644 index 0000000..096dfea --- /dev/null +++ b/commands/lib/layman/overlays/cvs.py @@ -0,0 +1,83 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN CVS OVERLAY HANDLER +################################################################################# +# File: cvs.py +# +# Handles cvs overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +''' Cvs overlay support.''' + +__version__ = "$Id$" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class CvsOverlay +# +#------------------------------------------------------------------------------- + +class CvsOverlay(Overlay): + ''' Handles cvs overlays.''' + + type = 'cvs' + + binary = '/usr/bin/cvs' + + def __init__(self, xml, ignore = 0, quiet = False): + + Overlay.__init__(self, xml, ignore, quiet) + + if '&subpath' in self.data.keys(): + self.subpath = self.data['&subpath'] + else: + self.subpath = '' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + if quiet: + quiet_option = ' -q' + else: + quiet_option = '' + + return self.cmd('cd "' + base + '" && CVSROOT="' + self.src + '" ' + + self.binary + quiet_option + ' co -d "' + self.name + + '" "' + self.subpath + '"' ) + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + if quiet: + quiet_option = ' -q' + else: + quiet_option = '' + + return self.cmd('cd "' + path([base, self.name]) + '" && ' + + self.binary + quiet_option + ' update') + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary, 'cvs', + 'dev-util/cvs'),]) diff --git a/commands/lib/layman/overlays/darcs.py b/commands/lib/layman/overlays/darcs.py new file mode 100644 index 0000000..0d27d5e --- /dev/null +++ b/commands/lib/layman/overlays/darcs.py @@ -0,0 +1,64 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN DARCS OVERLAY HANDLER +################################################################################# +# File: darcs.py +# +# Handles darcs overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel, Andres Loeh +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# Andres Loeh +# +''' Darcs overlay support.''' + +__version__ = "$Id: darcs.py 236 2006-09-05 20:39:37Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class BzrOverlay +# +#------------------------------------------------------------------------------- + +class DarcsOverlay(Overlay): + ''' Handles darcs overlays.''' + + type = 'Darcs' + + binary_command = '/usr/bin/darcs' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + return self.cmd(self.binary_command + ' get --partial "' + self.src + + '/" "' + path([base, self.name]) + '"') + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + return self.cmd('cd "' + path([base, self.name]) + '" && ' + + self.binary_command + ' pull --all "' + self.src + '"') + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary_command, 'darcs', + 'dev-util/darcs'),]) diff --git a/commands/lib/layman/overlays/git.py b/commands/lib/layman/overlays/git.py new file mode 100644 index 0000000..bda2df0 --- /dev/null +++ b/commands/lib/layman/overlays/git.py @@ -0,0 +1,77 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN GIT OVERLAY HANDLER +################################################################################# +# File: git.py +# +# Handles git overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel, Stefan Schweizer +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# Stefan Schweizer +''' Git overlay support.''' + +__version__ = "$Id: git.py 146 2006-05-27 09:52:36Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class GitOverlay +# +#------------------------------------------------------------------------------- + +class GitOverlay(Overlay): + ''' Handles git overlays.''' + + type = 'Git' + + binary_command = '/usr/bin/git' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + if quiet: + quiet_option = '-q ' + else: + quiet_option = '' + + # http:// should get trailing slash, other protocols shouldn't + slash = '' + if self.src.split(':')[0] == 'http': + slash = '/' + return self.cmd(self.binary_command + ' clone ' + quiet_option + '"' + self.src + slash + + '" "' + path([base, self.name]) + '"') + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + if quiet: + quiet_option = ' -q' + else: + quiet_option = '' + + return self.cmd('cd "' + path([base, self.name]) + '" && ' + + self.binary_command + ' pull' + quiet_option) + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary_command, 'git', + 'dev-util/git'),]) diff --git a/commands/lib/layman/overlays/mercurial.py b/commands/lib/layman/overlays/mercurial.py new file mode 100644 index 0000000..b010c8b --- /dev/null +++ b/commands/lib/layman/overlays/mercurial.py @@ -0,0 +1,64 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN MERCURIAL OVERLAY HANDLER +################################################################################# +# File: darcs.py +# +# Handles darcs overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel, Andres Loeh +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# Andres Loeh +# +''' Mercurial overlay support.''' + +__version__ = "$Id: mercurial.py 236 2006-09-05 20:39:37Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class MercurialOverlay +# +#------------------------------------------------------------------------------- + +class MercurialOverlay(Overlay): + ''' Handles mercurial overlays.''' + + type = 'Mercurial' + + binary_command = '/usr/bin/hg' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + return self.cmd(self.binary_command + ' clone "' + self.src + '/" "' + + path([base, self.name]) + '"') + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + return self.cmd('cd "' + path([base, self.name]) + '" && ' + + self.binary_command + ' pull -u "' + self.src + '"') + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary_command, 'mercurial', + 'dev-util/mercurial'),]) diff --git a/commands/lib/layman/overlays/overlay.py b/commands/lib/layman/overlays/overlay.py new file mode 100644 index 0000000..b9568b1 --- /dev/null +++ b/commands/lib/layman/overlays/overlay.py @@ -0,0 +1,301 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN OVERLAY BASE CLASS +################################################################################# +# File: overlay.py +# +# Base class for the different overlay types. +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +''' Basic overlay class.''' + +__version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import sys, types, re, os, os.path, shutil, subprocess + +from layman.utils import node_to_dict, dict_to_node, path + +from layman.debug import OUT + +#=============================================================================== +# +# Class Overlay +# +#------------------------------------------------------------------------------- + +class Overlay: + ''' Derive the real implementations from this.''' + + type = 'None' + + def __init__(self, xml, ignore = 0, quiet = False): + ''' + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> document = open(here + '/../tests/testfiles/global-overlays.xml').read() + >>> import xml.dom.minidom + >>> document = xml.dom.minidom.parseString(document) + >>> overlays = document.getElementsByTagName('overlay') + >>> a = Overlay(overlays[0]) + >>> a.name + u'wrobel' + >>> a.is_official() + True + >>> a.src + u'https://overlays.gentoo.org/svn/dev/wrobel' + >>> a.contact + u'nobody@gentoo.org' + >>> a.description + u'Test' + >>> a.priority + 10 + >>> b = Overlay(overlays[1]) + >>> b.is_official() + False + ''' + self.quiet = quiet + + self.data = node_to_dict(xml) + + if '&name' in self.data.keys(): + self.name = self.data['&name'] + else: + raise Exception('Overlay is missing a "name" attribute!') + + if '&src' in self.data.keys(): + self.src = self.data['&src'] + else: + raise Exception('Overlay "' + self.name + '" is missing a "src" ' + 'attribute!') + + if '&contact' in self.data.keys(): + self.contact = self.data['&contact'] + else: + self.contact = '' + if not ignore: + raise Exception('Overlay "' + self.name + '" is missing a ' + '"contact" attribute!') + elif ignore == 1: + OUT.warn('Overlay "' + self.name + '" is missing a ' + '"contact" attribute!', 4) + + if '1' in self.data.keys(): + self.description = self.data['1']['@'].strip() + else: + self.description = '' + if not ignore: + raise Exception('Overlay "' + self.name + '" is missing a ' + '"description" entry!') + elif ignore == 1: + OUT.warn('Overlay "' + self.name + '" is missing a ' + '"description" entry!', 4) + + if '&status' in self.data.keys(): + self.status = self.data['&status'] + else: + self.status = '' + + if '&priority' in self.data.keys(): + self.priority = int(self.data['&priority']) + else: + self.priority = 50 + + def set_priority(self, priority): + '''Set the priority of this overlay.''' + + self.data['&priority'] = str(priority) + self.priority = int(priority) + + def to_minidom(self, document): + '''Convert to xml.''' + + return dict_to_node(self.data, document, 'overlay') + + def add(self, base, quiet = False): + '''Add the overlay.''' + + mdir = path([base, self.name]) + + if os.path.exists(mdir): + raise Exception('Directory ' + mdir + ' already exists. Will not ov' + 'erwrite its contents!') + + os.makedirs(mdir) + + def sync(self, base, quiet = False): + '''Sync the overlay.''' + pass + + def delete(self, base): + '''Delete the overlay.''' + mdir = path([base, self.name]) + + if not os.path.exists(mdir): + raise Exception('Directory ' + mdir + ' does not exist. Cannot remo' + 've the overlay!') + + shutil.rmtree(mdir) + + def cmd(self, command): + '''Run a command.''' + + OUT.info('Running command "' + command + '"...', 2) + + if hasattr(sys.stdout,'encoding'): + enc = sys.stdout.encoding or sys.getfilesystemencoding() + if enc: + command = command.encode(enc) + + if not self.quiet: + return os.system(command) + else: + cmd = subprocess.Popen([command], shell = True, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + close_fds = True) + result = cmd.wait() + return result + + def __str__(self): + ''' + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> document = open(here + '/../tests/testfiles/global-overlays.xml').read() + >>> import xml.dom.minidom + >>> document = xml.dom.minidom.parseString(document) + >>> overlays = document.getElementsByTagName('overlay') + >>> a = Overlay(overlays[0]) + >>> print str(a) + wrobel + ~~~~~~ + Source : https://overlays.gentoo.org/svn/dev/wrobel + Contact : nobody@gentoo.org + Type : None; Priority: 10 + + Description: + Test + + ''' + + result = u'' + + result += self.name + u'\n' + (len(self.name) * u'~') + + result += u'\nSource : ' + self.src + result += u'\nContact : ' + self.contact + result += u'\nType : ' + self.type + result += u'; Priority: ' + str(self.priority) + u'\n' + + description = self.description + description = re.compile(u' +').sub(u' ', description) + description = re.compile(u'\n ').sub(u'\n', description) + result += u'\nDescription:' + result += u'\n '.join((u'\n' + description).split(u'\n')) + result += u'\n' + + if '1' in self.data.keys(): + link = self.data['1']['@'].strip() + link = re.compile(u' +').sub(u' ', link) + link = re.compile(u'\n ').sub(u'\n', link) + result += u'\nLink:\n' + result += u'\n '.join((u'\n' + link).split(u'\n')) + result += u'\n' + + return result + + def short_list(self, width = 0): + ''' + >>> here = os.path.dirname(os.path.realpath(__file__)) + >>> document = open(here + '/../tests/testfiles/global-overlays.xml').read() + >>> import xml.dom.minidom + >>> document = xml.dom.minidom.parseString(document) + >>> overlays = document.getElementsByTagName('overlay') + >>> a = Overlay(overlays[0]) + >>> print a.short_list(80) + wrobel [None ] (https://o.g.o/svn/dev/wrobel ) + ''' + + def pad(string, length): + '''Pad a string with spaces.''' + if len(string) <= length: + return string + ' ' * (length - len(string)) + else: + return string[:length - 3] + '...' + + def terminal_width(): + '''Determine width of terminal window.''' + try: + width = int(os.environ['COLUMNS']) + if width > 0: + return width + except: + pass + try: + import struct, fcntl, termios + query = struct.pack('HHHH', 0, 0, 0, 0) + response = fcntl.ioctl(1, termios.TIOCGWINSZ, query) + width = struct.unpack('HHHH', response)[1] + if width > 0: + return width + except: + pass + return 80 + + name = pad(self.name, 25) + mtype = ' [' + pad(self.type, 10) + ']' + if not width: + width = terminal_width() + srclen = width - 43 + source = self.src + if len(source) > srclen: + source = source.replace("overlays.gentoo.org", "o.g.o") + source = ' (' + pad(source, srclen) + ')' + + return name + mtype + source + + def supported(self, binaries = []): + '''Is the overlay type supported?''' + + if binaries: + for mpath, mtype, package in binaries: + if not os.path.exists(mpath): + raise Exception('Binary ' + mpath + ' seems to be missing!' + ' Overlay type "' + mtype + '" not support' + 'ed. Did you emerge ' + package + '?') + + return True + + def is_supported(self): + '''Is the overlay type supported?''' + + try: + self.supported() + return True + except Exception, error: + return False + + def is_official(self): + '''Is the overlay official?''' + + return self.status == 'official' + +#================================================================================ +# +# Testing +# +#-------------------------------------------------------------------------------- + +if __name__ == '__main__': + import doctest, sys + doctest.testmod(sys.modules[__name__]) diff --git a/commands/lib/layman/overlays/rsync.py b/commands/lib/layman/overlays/rsync.py new file mode 100644 index 0000000..6052bd0 --- /dev/null +++ b/commands/lib/layman/overlays/rsync.py @@ -0,0 +1,73 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN RSYNC OVERLAY HANDLER +################################################################################# +# File: rsync.py +# +# Handles rsync overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +''' Rsync overlay support.''' + +__version__ = "$Id: rsync.py 236 2006-09-05 20:39:37Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class RsyncOverlay +# +#------------------------------------------------------------------------------- + +class RsyncOverlay(Overlay): + ''' Handles rsync overlays.''' + + type = 'Rsync' + + binary = '/usr/bin/rsync' + + base = binary + ' -rlptDvz --progress --delete --delete-after ' + \ + '--timeout=180 --exclude="distfiles/*" --exclude="local/*" ' + \ + '--exclude="packages/*" ' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + Overlay.add(self, base) + + return self.sync(base) + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + if quiet: + quiet_option = '-q ' + else: + quiet_option = '' + + return self.cmd(self.base + quiet_option + '"' + self.src + '/" "' + + path([base, self.name]) + '"') + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary, 'rsync', + 'net-misc/rsync'),]) diff --git a/commands/lib/layman/overlays/svn.py b/commands/lib/layman/overlays/svn.py new file mode 100644 index 0000000..4ff3da4 --- /dev/null +++ b/commands/lib/layman/overlays/svn.py @@ -0,0 +1,75 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN SVN OVERLAY HANDLER +################################################################################# +# File: svn.py +# +# Handles subversion overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +''' Subversion overlay support.''' + +__version__ = "$Id: svn.py 236 2006-09-05 20:39:37Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class SvnOverlay +# +#------------------------------------------------------------------------------- + +class SvnOverlay(Overlay): + ''' Handles subversion overlays.''' + + type = 'Subversion' + + binary = '/usr/bin/svn' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + Overlay.add(self, base) + + if quiet: + quiet_option = '-q ' + else: + quiet_option = '' + + return self.cmd(self.binary + ' co ' + quiet_option + '"' + self.src + '/" "' + + path([base, self.name]) + '"') + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + if quiet: + quiet_option = '-q ' + else: + quiet_option = '' + + return self.cmd(self.binary + ' up ' + quiet_option + '"' + path([base, self.name]) + + '"') + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary, 'svn', + 'dev-util/subversion'),]) diff --git a/commands/lib/layman/overlays/tar.py b/commands/lib/layman/overlays/tar.py new file mode 100644 index 0000000..5786931 --- /dev/null +++ b/commands/lib/layman/overlays/tar.py @@ -0,0 +1,189 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN TAR OVERLAY HANDLER +################################################################################# +# File: tar.py +# +# Handles tar overlays +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# +''' Tar overlay support.''' + +__version__ = "$Id: tar.py 310 2007-04-09 16:30:40Z wrobel $" + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import os, os.path, sys, urllib2, shutil + +from layman.utils import path +from layman.overlays.overlay import Overlay + +#=============================================================================== +# +# Class TarOverlay +# +#------------------------------------------------------------------------------- + +class TarOverlay(Overlay): + ''' Handles tar overlays. + + A dummy tar handler that overwrites the __init__ method + so that we don't need to provide xml input: + + >>> from layman.debug import OUT + >>> class DummyTar(TarOverlay): + ... def __init__(self): + ... self.name = 'dummy' + ... here = os.path.dirname(os.path.realpath(__file__)) + ... self.src = 'file://' + here + '/../tests/testfiles/layman-test.tar.bz2' + ... self.subpath = 'layman-test' + ... self.format = 'bz2' + ... self.quiet = False + >>> testdir = os.tmpnam() + >>> os.mkdir(testdir) + >>> a = DummyTar() + >>> OUT.color_off() + >>> a.add(testdir) #doctest: +ELLIPSIS + * Running command "/bin/tar -v -x -j -f... + >>> sorted(os.listdir(testdir + '/dummy')) + ['app-admin', 'app-portage'] + >>> shutil.rmtree(testdir) + ''' + + type = 'Tar' + + binary = u'/bin/tar' + + def __init__(self, xml, ignore = 0, quiet = False): + + Overlay.__init__(self, xml, ignore) + + if '&format' in self.data.keys(): + self.format = self.data['&format'] + else: + self.format = '' + + if '&subpath' in self.data.keys(): + self.subpath = self.data['&subpath'] + else: + self.subpath = '' + + if '&category' in self.data.keys(): + if self.subpath: + raise Exception('Cannot use "category" and "subpath" at the same' + ' time!') + + self.category = self.data['&category'] + else: + self.category = '' + + def add(self, base, quiet = False): + '''Add overlay.''' + + self.supported() + + mdir = path([base, self.name]) + + if os.path.exists(mdir): + raise Exception('Directory ' + mdir + ' already exists. Will not ov' + 'erwrite its contents!') + + if self.format == 'bz2' or (not self.format and self.src[-3:] == 'bz2'): + ext = 'bz2' + opt = '-j' + elif self.format == 'gz' or (not self.format and self.src[-2:] == 'gz'): + ext = 'gz' + opt = '-z' + else: + raise Exception('Unsupported file format!') + + try: + + tar = urllib2.urlopen(self.src).read() + + except Exception, error: + raise Exception('Failed to fetch the tar package from: ' + + self.src + '\nError was:' + str(error)) + + pkg = path([base, self.name + '.tar.' + ext]) + + try: + + out_file = open(pkg, 'w') + out_file.write(tar) + out_file.close() + + except Exception, error: + raise Exception('Failed to store tar package in ' + + pkg + '\nError was:' + str(error)) + + if self.subpath: + target = path([base, 'tmp']) + else: + if self.category: + target = mdir + '/' + self.category + else: + target = mdir + + os.makedirs(target) + + result = self.cmd(self.binary + u' -v -x ' + opt + u' -f "' + pkg + + u'" -C "' + target + u'"') + + if self.subpath: + source = target + '/' + self.subpath + if os.path.exists(source): + try: + os.rename(source, mdir) + except Exception, error: + raise Exception('Failed to rename tar subdirectory ' + + source + ' to ' + mdir + '\nError was:' + + str(error)) + else: + raise Exception('Given subpath "' + source + '" does not exist ' + ' in the tar package!') + try: + shutil.rmtree(target) + except Exception, error: + raise Exception('Failed to remove unnecessary tar structure "' + + target + '"\nError was:' + str(error)) + + os.unlink(pkg) + + return result + + def sync(self, base, quiet = False): + '''Sync overlay.''' + + self.supported() + + self.delete(base) + + self.add(base) + + def supported(self): + '''Overlay type supported?''' + + return Overlay.supported(self, [(self.binary, 'tar', 'app-arch/tar'), ]) + +if __name__ == '__main__': + import doctest + + # Ignore warnings here. We are just testing + from warnings import filterwarnings, resetwarnings + filterwarnings('ignore') + + doctest.testmod(sys.modules[__name__]) + + resetwarnings() diff --git a/commands/lib/layman/utils.py b/commands/lib/layman/utils.py new file mode 100644 index 0000000..178ad11 --- /dev/null +++ b/commands/lib/layman/utils.py @@ -0,0 +1,208 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# POLYMERAZE XML UTILITIES +################################################################################# +# File: xml.py +# +# Utilities to deal with xml nodes. +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# + +'''Utility functions to deal with xml nodes. ''' + +__version__ = '$Id: utils.py 236 2006-09-05 20:39:37Z wrobel $' + +#=============================================================================== +# +# Dependencies +# +#------------------------------------------------------------------------------- + +import types, re + +#=============================================================================== +# +# Helper functions +# +#------------------------------------------------------------------------------- + +def node_to_text(node): + ''' + Reduces an xml node to its text elements. The function does not + collect the text nodes recursively. + + >>> import xml.dom.minidom + >>> imp = xml.dom.minidom.getDOMImplementation() + >>> doc = imp.createDocument('test', 'root', None) + >>> root = doc.childNodes[0] + >>> node = doc.createTextNode('text') + >>> a = root.appendChild(node) + >>> node = doc.createElement('text') + >>> node2 = doc.createTextNode('text') + >>> a = node.appendChild(node2) + >>> a = root.appendChild(node) + >>> node = doc.createTextNode('text') + >>> a = root.appendChild(node) + >>> doc.toprettyxml('', '') #doctest: +ELLIPSIS + '...texttexttext' + + >>> node_to_text(root) + 'texttext' + + ''' + text = '' + + for child in node.childNodes: + if child.nodeType == child.TEXT_NODE: + text = text + child.data + + return text + +def node_to_dict(node): + ''' Converts a xml node to a dictionary. The function collects the + nodes recursively. Attributes will be prepended with '&', child + nodes will be surrounded with tags. An index will be appended + since several child nodes with the same tag may exist. Text + elements will be collapsed and stored in a n entry prepended with + '@'. Comments will be ignored. + + >>> import xml.dom.minidom + >>> imp = xml.dom.minidom.getDOMImplementation() + >>> doc = imp.createDocument('test', 'root', None) + >>> root = doc.childNodes[0] + >>> node = doc.createTextNode('text') + >>> a = root.appendChild(node) + >>> node = doc.createElement('text') + >>> node2 = doc.createTextNode('text') + >>> comm = doc.createComment('comment') + >>> attr = doc.createAttribute('&attr') + >>> a = node.appendChild(node2) + >>> a = root.appendChild(comm) + >>> node.setAttributeNode(attr) + >>> node.setAttribute('&attr','test') + >>> a = root.appendChild(node) + >>> node3 = doc.createElement('text') + >>> a = root.appendChild(node3) + >>> node = doc.createTextNode('text') + >>> a = root.appendChild(node) + >>> doc.toprettyxml('', '') #doctest: +ELLIPSIS + '...texttexttext' + + >>> node_to_dict(root) + {'1': {'@': 'text', '&&attr': 'test'}, '2': {'@': ''}, '@': 'texttext'} + + ''' + result = {} + + # Map the attributes + for index in range(0, node.attributes.length): + attr = node.attributes.item(index) + result['&' + attr.name] = attr.nodeValue + + text = '' + + # Map the nodes + for child in node.childNodes: + if child.nodeType == child.TEXT_NODE: + text = text + child.data + if child.nodeType == child.ELEMENT_NODE: + index = 1 + while ('<' + child.tagName + '>' + str(index)) in result.keys(): + index += 1 + result['<' + child.tagName + '>' + str(index)] = node_to_dict(child) + + result['@'] = text + + return result + +def dict_to_node(data, document, root_name): + ''' Reverts the node_to_dict operation. + + >>> import xml.dom.minidom + >>> imp = xml.dom.minidom.getDOMImplementation() + >>> doc = imp.createDocument('test', 'root', None) + >>> a = {'1': {'@': 'text', '&&attr': 'test'}, '2': {'@': ''}, '@': 'texttext'} + >>> doc.childNodes[0] = dict_to_node(a, doc, 'root') + >>> doc.toprettyxml('', '') #doctest: +ELLIPSIS + '...texttexttext' + + ''' + node = document.createElement(root_name) + + for i, j in data.items(): + + if i[0] == '&': + attr = document.createAttribute(i[1:]) + node.setAttributeNode(attr) + node.setAttribute(i[1:], j) + if i[0] == '<': + k = i[1:] + while k[-1] in '0123456789': + k = k[:-1] + child = dict_to_node(data[i], + document, + k[:-1]) + node.appendChild(child) + if i[0] == '@': + child = document.createTextNode(j) + node.appendChild(child) + + return node + +def path(path_elements): + ''' + Concatenate a path from several elements. + + >>> path([]) + '' + >>> path(['a']) + 'a' + >>> path(['a','b']) + 'a/b' + >>> path(['a/','b']) + 'a/b' + >>> path(['/a/','b']) + '/a/b' + >>> path(['/a/','b/']) + '/a/b' + >>> path(['/a/','b/']) + '/a/b' + >>> path(['/a/','/b/']) + '/a/b' + >>> path(['/a/','/b','c/']) + '/a/b/c' + ''' + pathname = '' + + if type(path_elements) in types.StringTypes: + path_elements = [path_elements] + + # Concatenate elements and seperate with / + for i in path_elements: + pathname += i + '/' + + # Replace multiple consecutive slashes + pathname = re.compile('/+').sub('/', pathname) + + # Remove the final / if there is one + if pathname and pathname[-1] == '/': + pathname = pathname[:-1] + + return pathname + +#=============================================================================== +# +# Testing +# +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + import doctest, sys + doctest.testmod(sys.modules[__name__]) diff --git a/commands/lib/layman/version.py b/commands/lib/layman/version.py new file mode 100644 index 0000000..a366b47 --- /dev/null +++ b/commands/lib/layman/version.py @@ -0,0 +1,24 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +################################################################################# +# LAYMAN VERSION +################################################################################# +# File: version.py +# +# Current version number +# +# Copyright: +# (c) 2005 - 2008 Gunnar Wrobel +# Distributed under the terms of the GNU General Public License v2 +# +# Author(s): +# Gunnar Wrobel +# + +__version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $" + + +VERSION = '1.2.3' + +if __name__ == '__main__': + print VERSION diff --git a/commands/manage_layman.py b/commands/manage_layman.py new file mode 100644 index 0000000..a490c0a --- /dev/null +++ b/commands/manage_layman.py @@ -0,0 +1,72 @@ +from subprocess import call + +from commands import getstatusoutput + +import sys, ConfigParser, os.path, re + +from layman.config import Config +from layman.action import * +from layman.db import DB + +here = os.path.split(os.path.realpath(__file__))[0] + +class LaymanManager: + def AddAll(self): + """add overlays and sync them""" + + command1 = "./layman -c mylayman.cfg -a ALL" + print command1 + (status, output) = getstatusoutput(command1) + print status + print output + + """ + command2 = "./layman -c mylayman.cfg -s ALL" + getstatusoutput(command2) + + print command1, "\n", command2 + """ + + def List(self): + """return overlays dict""" + + sys.argv.append('-c') + sys.argv.append('mylayman.cfg') + config = Config() + + """ + l = ListLocal(a) + l.run() + """ + + db = DB(config) + overlays = dict() + + for name, overlay in db.overlays.items(): + overlays[name] = dict() + overlays[name]["src"] = overlay.src + overlays[name]["contact"] = overlay.contact + + description = overlay.description + description = re.compile(u' +').sub(u' ', description) + description = re.compile(u'\n ').sub(u'\n', description) + + overlays[name]["description"] = description + + if '1' in overlay.data.keys(): + link = overlay.data['1']['@'].strip() + link = re.compile(u' +').sub(u' ', link) + link = re.compile(u'\n ').sub(u'\n', link) + else: + link = "" + + overlays[name]["link"] = link + return overlays + +def main(): + h = LaymanManager() + h.AddAll() + overlays = h.List() + +if __name__ == '__main__': + main() diff --git a/commands/mylayman.cfg b/commands/mylayman.cfg new file mode 100644 index 0000000..d0ddbfa --- /dev/null +++ b/commands/mylayman.cfg @@ -0,0 +1,58 @@ +[MAIN] + +#----------------------------------------------------------- +# Defines the directory where overlays should be installed + +storage : /home/timemachine/www/ebuildfnd/ebuildfind/commands/var/ + +#----------------------------------------------------------- +# Remote overlay lists will be stored here +# layman will append _md5(url).xml to each filename + +cache : %(storage)s/cache + +#----------------------------------------------------------- +# The list of locally installed overlays + +local_list: /home/timemachine/www/ebuildfnd/ebuildfind/commands/overlays.xml + +#----------------------------------------------------------- +# Path to the make.conf file that should be modified by +# layman + +make_conf : %(storage)s/make.conf + +#----------------------------------------------------------- +# URLs of the remote lists of overlays (one per line) or +# local overlay definitions +# +#overlays : http://www.gentoo.org/proj/en/overlays/layman-global.txt +# http://dev.gentoo.org/~wrobel/layman/global-overlays.xml +# http://mydomain.org/my-layman-list.xml +# file:///usr/portage/local/layman/my-list.xml + +overlays : file:///home/timemachine/www/ebuildfnd/ebuildfind/commands/overlays.txt + +#----------------------------------------------------------- +# Proxy support +# +#proxy : http://[user:pass@]www.my-proxy.org:3128 + +#----------------------------------------------------------- +# Strict checking of overlay definitions +# +# Set either to "yes" or "no". If "no" layman will issue +# warnings if an overlay definition is missing either +# description or contact information. +# +nocheck : yes + +#----------------------------------------------------------- +# Umask settings +# +# layman should usually work with a umask of 0022. You should +# only change this setting if you are absolutely certain that +# you know what you are doing. +# +#umask : 0022 + diff --git a/commands/overlays.txt b/commands/overlays.txt new file mode 100644 index 0000000..3f246d9 --- /dev/null +++ b/commands/overlays.txt @@ -0,0 +1,1232 @@ + + + + https://overlays.gentoo.org/dev/betelgeuse + Betelgeuse's developer overlay + + + http://repo.or.cz/w/gentoo-lisp-overlay.git + Common Lisp/Scheme development, recruitment and + live overlay. Support and feedback in `#gentoo-lisp' and via + `gentoo-lisp@gentoo.org'. + + + http://roslin.mlodyinteligent.pl/ + This is roslin, my small overlay. Enjoy! + (: + + + http://s3d.berlios.de/ + Gentoo ebuilds for s3d and related packages. s3d + is a 3d network display server which can be used as 3d desktop + enviroment. + + + Experimental overlay for desktop effects + packages. + + + Experimental overlay for .NET + packages. + + + Packages for players and authors of interactive + fiction + + + Gentoo ebuild overlay with misc stuff that I find + interesting. + + + Experimental overlay for zen related + packages. + + + Miscellaneous ebuilds not yet in + portage + + + Linux Terminal Server Project + overlay + + + Arcon Overlay! + http://code.google.com/p/arcon/ + + + http://www.thepetersclan.net + This is a Gnash ( flash player ) cvs and snapshot + overlay. + + + http://overlays.gentoo.org/dev/aross + Personal scratch space. + + + http://overlays.gentoo.org/dev/dirtyepic + Various work-in-progress stuff including GCC-svn + and wxGTK. + + + http://overlays.gentoo.org/proj/xfce/wiki + Experimental ebuilds for the Xfce4 Desktop + Environment + + + http://overlays.gentoo.org/dev/je_fro + Helpful ebuilds for the macbook pro, and + experimental gentoo-science packages. + + + http://overlays.gentoo.org/dev/suka + experimental stuff of all sorts + + + http://luke.dashjr.org + Misc ebuilds by Luke-Jr + + + http://www.lila-center.info + The Lila theme is a community project, originally + created by Daniel G. Taylor and members of the Gentoo Linux + community. The theme is based around SVG graphics - which means + they can be scaled to any size without loss of quality - and is + meant to be usable across different desktops and platforms. For + more information about the Lila theme project or to see how you + could get involved, there are a few places to look: The Lila + theme forums #lila on chat.freenode.org + + + http://www.verlihub-project.org + Verlihub is a Direct Connect protocol server runs + on Linux OS written in C++; Many features are available: MySQL + database, very low use of CPU, RAM and Bandwidth, deflood + integrated protection, plugins + + + http://jyujin.de/ + eINIT, kyuuba, dev9, various splash + daemons + + + http://overlays.gentoo.org/proj/mozilla + New mozilla development that is not yet in + tree + + + http://overlays.gentoo.org/proj/science/wiki/en + The Gentoo Science Overlay is intended as a place + to work outside of the main portage tree on experimental + ebuilds. Our aim is to increase the rate of development of + scientific packages for Gentoo, but ebuilds in this repository + are by their very nature more experimental. If you wish to use + them you should be willing to help test and report + bugs. + + + + experimental gnome ebuilds + + + experimental gpe ebuilds + + + http://genkdesvn.mailstation.de + Paludis-only kde4 overlay. Unsupported by KDE team. + + + http://kde.gentoo.org + Official KDE team's testing overlay. + + + http://kde.gentoo.org + KDE 3 overlay + + + http://gentoo.zugaina.org/ + collection of ebuilds by ycarus + + + http://overlays.gentoo.org + This is the home of Gentoo's wider collection of + ebuilds for web-based applications. This is where we collect + all the ebuilds submitted to Bugzilla by our users, and make + them available in an easy-to-use overlay for wider + testing. + + + http://overlays.gentoo.org/dev/anant/wiki + A collection of ebuilds related to the D + programming language. + + + http://overlays.gentoo.org/dev/anant/wiki + A collection of useful ebuilds related to + Plan9. + + + http://git.xnull.de/gitweb/?p=overlay.git + A collection of work-in-progress ebuilds and other + fun broken things. + + + http://overlays.gentoo.org + A collection of stable ebuilds from Gunnar Wrobel + [wrobel@gentoo.org]. + + + http://www.gentoo.org/proj/en/kolab/index.xml + Project to allow running Kolab on + Gentoo. + + + http://armagetronad.net + 3D light cycles, like the movie TRON + + + http://games.gentoo.org/ + A collection of work-in-progress ebuilds and + ebuilds which require testing. + + + http://svn.netdomination.org/gentoo-voip + Voice over IP related ebuilds. + + + http://www.initng.org + Initng is a full replacement of the old and in + many ways deprecated sysvinit tool. It is designed with speed + in mind because it does as much as possible asynchronously. In + other words: It will boot your unix-system much faster, and + give you more control and statistics over your + system. + + + http://overlays.gentoo.org/proj/nx + Overlay for the NX/FreeNX packages for + Gentoo. + + + http://proaudio.tuxfamily.org/wiki + Evermind's overlay with ebuilds for a lot of + pro-audio production software. + + + http://pda.gentoo.ru + This overlay contains some pda-related ebuilds + (for now for devices such as iPAQ hx4700, Sharp Zaurus, Asus + a620 and some others) + + + http://bugs.gentoo.org/show_bug.cgi?id=122500 + Testing ground for vmware-server and + vmware-server-console ebuilds until they can eventually be + committed into portage. + + + http://sabayonlinux.org + Purpose To provide ebuilds that were created from + the Sabayon Linux project such as customized programs, ebuilds + not in the official portage, artwork, themes, etc. Bugs to + http://bugs.sabayonlinux.org/bugs/ + + + http://code.google.com/p/gentoo-china-overlay + Purpose To provide some programs useful to Chinese + users. + + + http://overlays.gentoo.org/proj/java + The only java overlay available via layman. This + overlays contains ebuilds that are expected to work when you + emerge them. The ebuilds also need to use the generation 2 + eclasses. + + + + http://overlays.gentoo.org/proj/java/wiki/GCJ_as_a_JDK + An overlay for GCJ to use as a Java SDK / + RE. + + + http://blog.flameeyes.eu/ + Flameeyes' private developer overlay + + + http://www.gentoo.org/proj/en/desktop/x/x11/ + Gentoo X11 team overlay + + + http://dev.gentoo.org/~dberkholz/overlay/ + Donnie Berkholz's private developer + overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/loki_val.git;a=summary + Peter Alfredsen's private developer + overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/darkside.git;a=summary + Jeremy Olexa's (darkside) private developer + overlay + + + http://drizzt.bsdnet.eu/ + drizzt's private developer overlay + + + http://overlays.gentoo.org/dev/trapni/ + trapni's private developer overlay (mostly + covering YaCS/server related ebuilds for now) + + + http://overlays.gentoo.org/proj/sunrise + Ebuilds for bugs assigned to + maintainer-wanted + + + http://overlays.gentoo.org + A collection of stable ebuilds from Wolfram + Schlich [wschlich@gentoo.org]. + + + http://overlays.gentoo.org + A collection of testing ebuilds from Wolfram + Schlich [wschlich@gentoo.org]. + + + http://overlays.gentoo.org + Some ebuilds not yet ready for mainstream portage + from Thilo Bangert [bangert@gentoo.org]. + + + http://overlays.gentoo.org + Some ebuilds not yet ready for mainstream portage + from Tobias Scherbaum [dertobi123@gentoo.org]. + + + http://overlays.gentoo.org/proj/vps + Gentoo VPS project overlay (experimental + ebuilds) + + + http://www.hboeck.de + Purpose To provide new Xgl and AIGLX desktop + developments as mentioned on his blog. + + + http://www.hboeck.de + Hanno Boeck developer overlay. + + + http://geki.ath.cx/index.php/OpenOffice + Purpose Unsupported openoffice version with + experimental patchset + + + http://overlays.gentoo.org + Mostly Python-related ebuilds. + + + http://overlays.gentoo.org/proj/python/wiki + Python development tree, staging area for the tree. + + + http://overlays.gentoo.org/proj/python/wiki + Python experimental tree. + + + http://overlays.gentoo.org + Development overlay for ebuilds that I plan to + commit to the tree that are sourced from bugzilla or + liquidx. + + + http://gentoo-taiwan.googlecode.com/ + A collection of ebuilds from Gentoo + Taiwan. + + + http://dev.gentoo.org/~dev-zero/ + Dev-zeros personal developer overlay + + + http://overlays.gentoo.org/dev/genstef + Genstef's Overlay - It usually contains some + experimental ebuilds on their way to the tree + + + http://overlays.gentoo.org/dev/jokey + Jokey's Overlay - Contains pre-tree stuff like + italc, pkgcore-test-ebuilds and lcd stuff + + + http://overlays.gentoo.org/dev/chtekk + Overlay for various applications I use myself and + plan on adding to the tree or update/fix. + + + http://overlays.gentoo.org/dev/chtekk + Development overlay for a SysCP (syscp.org) ebuild + and Gentoo port, as well as additional + patches/features. + + + http://overlays.gentoo.org/proj/mysql + Development overlay for MySQL, testing + branch. + + + http://overlays.gentoo.org/proj/php + Contains a copy of everything + dev-lang/php-4*-related, which can no longer be kept in the + official tree for security reasons. + + + http://overlays.gentoo.org/proj/php + Development overlay for PHP, testing + branch. + + + http://overlays.gentoo.org/proj/php + Development overlay for PHP, experimental + branch. + + + http://overlays.gentoo.org/proj/postgresql + Development overlay for PostgreSQL, testing + branch. + + + http://overlays.gentoo.org/proj/postgresql + Development overlay for PostgreSQL, experimental + branch. + + + http://n4g.mars.arge.at + The goal for this overlay is to reproduce the Open + Enterprise server from novell on gentoo + + + http://n4g.mars.arge.at + The goal for this overlay is to reproduce the Open + Enterprise server from novell on gentoo + + + + http://mpd.wikia.com/wiki/Repositories#Experimental_Gentoo_Overlay + The experimental gentoo overlay was designed as a + way to keep up-to-date. Most of it are live ebuilds, ebuilds + that pull the latest HEAD from whatever repository. It also + includes ebuilds for clients that are not yet in portage. It is + maintained by avuton, send new ebuilds, corrections or bugs + directly to him. + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/halcy0n.git;a=summary + Various packages, probably some toolchain stuff + though + + + http://www.haskell.org/~gentoo/gentoo-haskell/ + The Official Gentoo Haskell overlay. + + + http://opensvn.csie.org/rmh3093/iwlwifi + This overlay provides ebuilds for the new wireless + driver iwlwifi + + + http://scm.calivia.com/svn/sipx/gentoo + This repository contains sipx and related + ebuilds. + + + http://overlays.gentoo.org/proj/vdr + Development overlay for VDR, testing + branch. + + + http://overlays.gentoo.org/proj/vdr + Overlay for VDR, that contains ebuilds for + development version of VDR, and specific plugins for that + version. + + + http://overlays.gentoo.org/proj/vdr + Development overlay for VDR, experimental branch. + WARNING: This branch can kill your VDR! Only use it if you know + what you are doing. It is best to stay in touch with the + developers if you would like to try this out. We are available + in #gentoo-vdr on Freenode. + + + http://overlays.gentoo.org/proj/vdr + Overlay for VDR, that contains ebuilds for + the vdr-xine output plugin, and the needed patched xine-lib + + + + http://nouveau.freedesktop.org/ + Experimental ebuilds for the free nouveau driver + for nvidia cards. + + + Temporary overlay for adding support for the EFIKA + platform to Gentoo. + + + http://overlays.gentoo.org/dev/seemant + Seemant's development overlay for django and other + things. + + + + http://overlays.gentoo.org/dev/vapier/wiki/enlightenment + Support for the Enlightenment project, most + notably DR17/e17. + + + http://overlays.gentoo.org/proj/toolchain/wiki + Toolchain ebuilds that are unsuitable for the + tree. Snapshots, unstable versions, etc... + + + http://dev.gentoo.org/~serkan + Serkan Kaba's (serkan) private developer + overlay + + + http://gentoo.xwing.info + This overlay contains some experimental stuff, + such as turboprint printers driver (bug #61311), intel-536ep + driver for lastest 2.6 kernels (bug #127464), lastest grisbi + version (proxy maintainer) before it's portage integration and + so on. + + + http://svn.digital-trauma.de/gentoo/ + This overlay has a binary, current version of + eclipse with many plugins and some small new ebuilds from + trauma and bugzilla.g.o. + + + http://overlays.gentoo.org + Experimental ebuilds from the private overlay of + Ioannis Aslanidis [deathwing00@gentoo.org]. + + + http://overlays.gentoo.org/dev/marineam + Experimental ebuilds for Xen. + + + http://overlays.gentoo.org/proj/xen + Experimental ebuilds for Xen. + + + http://overlays.gentoo.org/proj/cell + Support for Cell architecture, including IBM blade + and Sony Playstation 3 + + + http://overlays.gentoo.org/proj/powerpc + Support for PowerPC-based ebuilds that are not + appropriate for the portage tree. + + + http://overlays.gentoo.org/proj/emacs/ + Provide Emacs related ebuilds which are a bit + experimental or work-in-progress. Don't rely on them, but don't + hesitate to file bugs or write emails. + + + http://overlays.gentoo.org/proj/emacs/ + Provide XEmacs related ebuilds which are a bit + experimental or work-in-progress. Don't rely on them, but don't + hesitate to file bugs or write emails. + + + http://blog.pioto.org + Most things in here are still works in progress or + not stable enough for the main ebuild tree. If something + breaks, you're on your own. + + + http://overlays.gentoo.org/dev/matsuu/ + Matsuu's Second Life Overlay + + + http://overlays.gentoo.org/proj/gnustep + Experimental ebuilds for GNUstep packages in + Gentoo. Comments and bugreports are welcome! + + + http://overlays.gentoo.org/proj/rox + Experimental ebuilds for the Rox + Desktop. + + + http://overlays.gentoo.org/proj/perl/ + Experimental ebuilds for Perl packages in Gentoo. + Comments and bugreports are welcome! + + + http://svn.liveforge.org/berkano/trunk + Berkano overlay provides an overlay for Gentoo + Linux with ebuilds of bleeding edge software (such as live + subversion builds) and other handy tools that are missing from + the official portage tree. Areas of interest include multimedia + and system administration. + + + http://www.freevo.org + The Freevo overlay provides ebuils for development + snapshots of the unreleased Freevo 2.0 and its + dependencies. + + + http://dev.gentoo.org/~swegener/ + This overlay contains some experimental stuff, but + mostly stuff I quickly wrote an ebuild for or grabed it from + bugzilla and did not have the time to commit it to the official + tree or do not consider it ready for it. + + + http://genkdesvn.mailstation.de + A collection of work-in-progress ebuilds and other + fun broken things. + + + http://overlays.gentoo.org/dev/rbu/wiki + Random stuff. + + + http://moving-innovations.com/blog/ + Developer overlay of Hans de Graaff with mostly + ruby and xemacs ebuilds, and a few assorted other + goodies. + + + http://devnull.core.ws/EbuildRepository/ + Various ebuilds, most of them are bleeding edge + scm versions, the others have not found their way into portage + yet. + + + http://pd-overlay.sourceforge.net/ + Subversion ebuilds for PureData the dataflow + language + + + http://overlays.gentoo.org/proj/finnish + Finnish overlay for spell checking etc. + etc. + + + http://overlays.gentoo.org/dev/lu_zero + Experimental Media and PowerPC/CELL related + ebuilds. + + + + http://cafarelli.fr/websvn/listing.php?repname=voyageur-overlay + Voyageur's random ebuilds stuff + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/uberlord;a=summary + Uberlord's openrc ebuilds + + + http://dev.gentoo.org/~hawking/ + hawking's random ebuilds. + + + http://dev.gentoo.org/~hwoarang/ + hwoarangs' testing ebuilds + + + http://overlays.gentoo.org/proj/gcc-porting/ + Compatibility patches for upcoming GCC + releases. + + + http://dev.gentoo.org/~falco/ + Falco's random stuff about netmon, net-mail or + security, unofficial ebuilds like proxsmtp, unofficial patches + on Postfix; also pre-stable security upgrades, perhaps merged + in the Security Overlay Project some day. + + + http://www.mavrinac.com/index.cgi?page=tp + Overlay for the Thousand Parsec framework for + turn-based space empire building games. + + + Kernel Virtual Machine userspace + support + + + http://ebuild.gentoo.gr.jp/ + GentooJP provides custom ebuilds for Japanese + Gentoo users. + + + https://trac.poildetroll.net/trac/akoya + Akoya overlay + + + http://gentoo-wiki.com/Howto_OSS4 + OSSv4 overlay + + + http://overlays.gentoo.org/proj/ruby/wiki + Experimental ebuilds from the Ruby + edge. + + + http://dev.gentoo.org/~mueli + Overlay which provides the bleeding edge on the + kerberos integration in gentoo. + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/ikelos.git;a=summary + Ikelos's hospice for broken and damaged + ebuilds. + + + http://www.wolf31o2.org + Wolf31o2's project ebuilds + + + http://www.gentoo.org/proj/en/desktop/lxde/ + Repo for development of ebuilds for the LXDE + desktop environment. + + + http://os-rostov.ru/ + Repo for development of ebuilds. + + + http://www.lordvan.com + LordVan's project ebuilds + + + + http://github.com/eatnumber1/pcsx2-overlay/tree/master + Experimental overlay for pcsx2 + ebuilds. + + + + http://sugarlabs.org/go/Community/Distributions/Gentoo + Sugar (sugarlabs.org) related + packages + + + + http://overlays.gentoo.org/proj/embedded/wiki/openmoko + Openmoko's project overlay. + + + https://launchpad.net/bzr-gentoo-overlay/ + A collection of Bazaar-related ebuilds, including + release candidates of Bazaar. + + + http://github.com/gentoo-qt/qting-edge/ + Experimental Qt4 ebuilds and related packages, + provided by Gentoo's Qt team. The overlay contains ebuilds for + official pre-releases, and live ebuilds for both the official + Nokia Qt Software git repository and KDE's qt-copy subversion + repository. It also has various (non-KDE) packages that use + Qt4. + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/alexxy.git + Some random work in progress stuff from + alexxy + + + + http://dev.openbossa.org/trac/mamona/wiki/MamonaGentooOverlay + Mamona is an embedded Linux distribution, based on + Open Embedded, for ARM EABI. + + + http://www.gentoo-quebec.org + New ebuilds created by the Gentoo-Quebec + team. + + + https://overlays.gentoo.org/dev/mescalinum + Tcl/Tk multi-slot system, with tcltk eselect module + for switching across multiple versions (actually: 8.4 8.5 8.6) + + + + http://git.goodpoint.de/?p=overlay-sping.git;a=summary + Gentoo overlay of Sebastian Pipping + + + http://github.com/steev/steev-overlay/tree/master + Steev Klimaszewski's Overlay + + + http://repo.or.cz/w/otih-overlay.git + Otih's Provide-Patches Overlay + + + https://overlays.gentoo.org/dev/mescalinum + Tcl/Tk 8.8, Itcl/Itk 4 (beta) and other fixed packages + + + + http://wiki.cregion.ru/moin.cgi/CRG_Overlay + CRG-Overlay for Gentoo Linux + + + http://gitorious.org/projects/tante_overlay/repos/mainline + Overlay of tante + + + http://code.google.com/p/raw/ + some raw stuff + + + http://repo.or.cz/w/gentoo-overlay-ibormuth.git + Personal Overlay of Ingo Bormuth + + + + http://git.overlays.gentoo.org/gitweb/?p=proj/m68k.git + m68k team overlay + + + + http://repo.or.cz/w/dottout.git + + Dottout overlay + + + + http://repo.or.cz/w/ub0rlay.git + + This is an ub0r overlay! + + + + http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git + Gentoo/BSD Project Overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/maekke.git + Markus Meier developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/scarabeus.git + Tomas Chvatal developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/nirbheek.git + Nirbheek Chauhan developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/leio.git + Mart Raudsepp developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/remi.git + Remi Cardona developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/jmbsvicetto.git + Jorge Manuel B. S. Vicetto developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/tove.git + Torsten Veller developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/pchrist.git + Panagiotis Christopoulos developer overlay + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/matsuu.git + MATSUU Takuto developer overlay + + + + http://code.google.com/p/rion-overlay/ + Russian ovelay with a some patched and specific software + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/dagger.git;a=summary + Dagger developer overlay + + + + http://slonopotamus.org/gentoo-on-n8x0 + + Packages to support Nokia Internet Tablets (N8x0) + + + + diff --git a/commands/overlays.xml b/commands/overlays.xml new file mode 100644 index 0000000..d3dc486 --- /dev/null +++ b/commands/overlays.xml @@ -0,0 +1,2999 @@ + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/maekke.git + + + + + Markus Meier developer overlay + + + + + + + + + + + + + + + http://www.mavrinac.com/index.cgi?page=tp + + + + + Overlay for the Thousand Parsec framework for + turn-based space empire building games. + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/xen + + + + + Experimental ebuilds for Xen. + + + + + + + + + + + + + + + http://jyujin.de/ + + + + + eINIT, kyuuba, dev9, various splash + daemons + + + + + + + + + + + + + + + http://kde.gentoo.org + + + + + Official KDE team's testing overlay. + + + + + + + + + + + + + + + http://www.lordvan.com + + + + + LordVan's project ebuilds + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/rox + + + + + Experimental ebuilds for the Rox + Desktop. + + + + + + + + + + + + + + + + http://code.google.com/p/rion-overlay/ + + + + + Russian ovelay with a some patched and specific software + + + + + + + + + + + + + + + http://www.thepetersclan.net + + + + + This is a Gnash ( flash player ) cvs and snapshot + overlay. + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/php + + + + + Contains a copy of everything + dev-lang/php-4*-related, which can no longer be kept in the + official tree for security reasons. + + + + + + + + + + + + + + + http://os-rostov.ru/ + + + + + Repo for development of ebuilds. + + + + + + + + + + + + + + + http://roslin.mlodyinteligent.pl/ + + + + + This is roslin, my small overlay. Enjoy! + (: + + + + + + + + + + + + + + + http://kde.gentoo.org + + + + + KDE 3 overlay + + + + + + + + + + + + + + + http://repo.or.cz/w/otih-overlay.git + + + + + Otih's Provide-Patches Overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/postgresql + + + + + Development overlay for PostgreSQL, testing + branch. + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/xfce/wiki + + + + + Experimental ebuilds for the Xfce4 Desktop + Environment + + + + + + + + + + + + + + + + http://sugarlabs.org/go/Community/Distributions/Gentoo + + + + + Sugar (sugarlabs.org) related + packages + + + + + + + + + + + + + + + http://pd-overlay.sourceforge.net/ + + + + + Subversion ebuilds for PureData the dataflow + language + + + + + + + + + + + + + + + http://geki.ath.cx/index.php/OpenOffice + + + + + Purpose Unsupported openoffice version with + experimental patchset + + + + + + + + + + + + + Experimental overlay for desktop effects + packages. + + + + + + + + + + + + + + + http://overlays.gentoo.org + + + + + A collection of stable ebuilds from Gunnar Wrobel + [wrobel@gentoo.org]. + + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/vapier/wiki/enlightenment + + + + + Support for the Enlightenment project, most + notably DR17/e17. + + + + + + + + + + + + + + + http://drizzt.bsdnet.eu/ + + + + + drizzt's private developer overlay + + + + + + + + + + + + + + + + http://slonopotamus.org/gentoo-on-n8x0 + + + + + + Packages to support Nokia Internet Tablets (N8x0) + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/loki_val.git;a=summary + + + + + Peter Alfredsen's private developer + overlay + + + + + + + + + + + + + + + + http://mpd.wikia.com/wiki/Repositories#Experimental_Gentoo_Overlay + + + + + The experimental gentoo overlay was designed as a + way to keep up-to-date. Most of it are live ebuilds, ebuilds + that pull the latest HEAD from whatever repository. It also + includes ebuilds for clients that are not yet in portage. It is + maintained by avuton, send new ebuilds, corrections or bugs + directly to him. + + + + + + + + + + + + + + + http://www.gentoo-quebec.org + + + + + New ebuilds created by the Gentoo-Quebec + team. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/uberlord;a=summary + + + + + Uberlord's openrc ebuilds + + + + + + + + + + + + + + + http://gentoo.zugaina.org/ + + + + + collection of ebuilds by ycarus + + + + + + + + + + + + + + + http://dev.gentoo.org/~dberkholz/overlay/ + + + + + Donnie Berkholz's private developer + overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org + + + + + A collection of testing ebuilds from Wolfram + Schlich [wschlich@gentoo.org]. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/darkside.git;a=summary + + + + + Jeremy Olexa's (darkside) private developer + overlay + + + + + + + + + + + + + Miscellaneous ebuilds not yet in + portage + + + + + + + + + + + + + + + + http://dev.openbossa.org/trac/mamona/wiki/MamonaGentooOverlay + + + + + Mamona is an embedded Linux distribution, based on + Open Embedded, for ARM EABI. + + + + + + + + + + + + + + + http://gitorious.org/projects/tante_overlay/repos/mainline + + + + + Overlay of tante + + + + + + + + + + + + + + + http://svn.netdomination.org/gentoo-voip + + + + + Voice over IP related ebuilds. + + + + + + + + + + + + + + + http://nouveau.freedesktop.org/ + + + + + Experimental ebuilds for the free nouveau driver + for nvidia cards. + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/anant/wiki + + + + + A collection of ebuilds related to the D + programming language. + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/finnish + + + + + Finnish overlay for spell checking etc. + etc. + + + + + + + + + + + + + + + http://www.gentoo.org/proj/en/desktop/lxde/ + + + + + Repo for development of ebuilds for the LXDE + desktop environment. + + + + + + + + + + + + + + + http://repo.or.cz/w/gentoo-lisp-overlay.git + + + + + Common Lisp/Scheme development, recruitment and + live overlay. Support and feedback in `#gentoo-lisp' and via + `gentoo-lisp@gentoo.org'. + + + + + + + + + + + + + + + http://git.goodpoint.de/?p=overlay-sping.git;a=summary + + + + + Gentoo overlay of Sebastian Pipping + + + + + + + + + + + + + + + http://repo.or.cz/w/gentoo-overlay-ibormuth.git + + + + + Personal Overlay of Ingo Bormuth + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/chtekk + + + + + Development overlay for a SysCP (syscp.org) ebuild + and Gentoo port, as well as additional + patches/features. + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/matsuu/ + + + + + Matsuu's Second Life Overlay + + + + + + + + + + + + + + + http://gentoo.xwing.info + + + + + This overlay contains some experimental stuff, + such as turboprint printers driver (bug #61311), intel-536ep + driver for lastest 2.6 kernels (bug #127464), lastest grisbi + version (proxy maintainer) before it's portage integration and + so on. + + + + + + + + + + + + + + + http://wiki.cregion.ru/moin.cgi/CRG_Overlay + + + + + CRG-Overlay for Gentoo Linux + + + + + + + + + + + + + Gentoo ebuild overlay with misc stuff that I find + interesting. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/alexxy.git + + + + + Some random work in progress stuff from + alexxy + + + + + + + + + + + + + Experimental overlay for .NET + packages. + + + + + + + + + + + + + + + http://www.gentoo.org/proj/en/desktop/x/x11/ + + + + + Gentoo X11 team overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/jokey + + + + + Jokey's Overlay - Contains pre-tree stuff like + italc, pkgcore-test-ebuilds and lcd stuff + + + + + + + + + + + + + + + http://dev.gentoo.org/~falco/ + + + + + Falco's random stuff about netmon, net-mail or + security, unofficial ebuilds like proxsmtp, unofficial patches + on Postfix; also pre-stable security upgrades, perhaps merged + in the Security Overlay Project some day. + + + + + + + + + + http://sabayonlinux.org + + + Purpose To provide ebuilds that were created from + the Sabayon Linux project such as customized programs, ebuilds + not in the official portage, artwork, themes, etc. Bugs to + http://bugs.sabayonlinux.org/bugs/ + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/java + + + + + The only java overlay available via layman. This + overlays contains ebuilds that are expected to work when you + emerge them. The ebuilds also need to use the generation 2 + eclasses. + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/dirtyepic + + + + + Various work-in-progress stuff including GCC-svn + and wxGTK. + + + + + + + + + + + + + + + http://genkdesvn.mailstation.de + + + + + Paludis-only kde4 overlay. Unsupported by KDE team. + + + + + + + + + + http://overlays.gentoo.org/dev/aross + + + Personal scratch space. + + + + + + + + + + + + + + https://overlays.gentoo.org/dev/betelgeuse + + + + + Betelgeuse's developer overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/python/wiki + + + + + Python development tree, staging area for the tree. + + + + + + + + + + + + + + + http://www.hboeck.de + + + + + Purpose To provide new Xgl and AIGLX desktop + developments as mentioned on his blog. + + + + + + + + + + + + + + + http://scm.calivia.com/svn/sipx/gentoo + + + + + This repository contains sipx and related + ebuilds. + + + + + + + + + + + + + + + http://bugs.gentoo.org/show_bug.cgi?id=122500 + + + + + Testing ground for vmware-server and + vmware-server-console ebuilds until they can eventually be + committed into portage. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/halcy0n.git;a=summary + + + + + Various packages, probably some toolchain stuff + though + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/je_fro + + + + + Helpful ebuilds for the macbook pro, and + experimental gentoo-science packages. + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/cell + + + + + Support for Cell architecture, including IBM blade + and Sony Playstation 3 + + + + + + + + + + http://overlays.gentoo.org/proj/vdr + + + Development overlay for VDR, experimental branch. + WARNING: This branch can kill your VDR! Only use it if you know + what you are doing. It is best to stay in touch with the + developers if you would like to try this out. We are available + in #gentoo-vdr on Freenode. + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/pchrist.git + + + + + Panagiotis Christopoulos developer overlay + + + + + + + + + + + + + + + http://www.gentoo.org/proj/en/kolab/index.xml + + + + + Project to allow running Kolab on + Gentoo. + + + + + + + + + + + + + + + http://www.verlihub-project.org + + + + + Verlihub is a Direct Connect protocol server runs + on Linux OS written in C++; Many features are available: MySQL + database, very low use of CPU, RAM and Bandwidth, deflood + integrated protection, plugins + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git + + + + + Gentoo/BSD Project Overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/vdr + + + + + Overlay for VDR, that contains ebuilds for + development version of VDR, and specific plugins for that + version. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/nirbheek.git + + + + + Nirbheek Chauhan developer overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/powerpc + + + + + Support for PowerPC-based ebuilds that are not + appropriate for the portage tree. + + + + + + + + + + + + + + + http://moving-innovations.com/blog/ + + + + + Developer overlay of Hans de Graaff with mostly + ruby and xemacs ebuilds, and a few assorted other + goodies. + + + + + + + + + + + + + + + http://gentoo-taiwan.googlecode.com/ + + + + + A collection of ebuilds from Gentoo + Taiwan. + + + + + + + + + + http://overlays.gentoo.org/dev/genstef + + + Genstef's Overlay - It usually contains some + experimental ebuilds on their way to the tree + + + + + + + + + + + + + + http://www.wolf31o2.org + + + + + Wolf31o2's project ebuilds + + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/java/wiki/GCJ_as_a_JDK + + + + + An overlay for GCJ to use as a Java SDK / + RE. + + + + + + + + + + + + + + + + http://github.com/eatnumber1/pcsx2-overlay/tree/master + + + + + Experimental overlay for pcsx2 + ebuilds. + + + + + + + + + + http://overlays.gentoo.org + + + A collection of stable ebuilds from Wolfram + Schlich [wschlich@gentoo.org]. + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/toolchain/wiki + + + + + Toolchain ebuilds that are unsuitable for the + tree. Snapshots, unstable versions, etc... + + + + + + + + + + + + + experimental gnome ebuilds + + + + + + + + + + + + + + + + http://repo.or.cz/w/dottout.git + + + + + + Dottout overlay + + + + + + + + + + + + + + + https://overlays.gentoo.org/dev/mescalinum + + + + + Tcl/Tk 8.8, Itcl/Itk 4 (beta) and other fixed packages + + + + + + + + + + + + + + + + http://code.google.com/p/gentoo-china-overlay + + + + + Purpose To provide some programs useful to Chinese + users. + + + + + + + + + + + + + + + http://opensvn.csie.org/rmh3093/iwlwifi + + + + + This overlay provides ebuilds for the new wireless + driver iwlwifi + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/matsuu.git + + + + + MATSUU Takuto developer overlay + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/jmbsvicetto.git + + + + + Jorge Manuel B. S. Vicetto developer overlay + + + + + + + + + + + + + + + http://games.gentoo.org/ + + + + + A collection of work-in-progress ebuilds and + ebuilds which require testing. + + + + + + + + + + + + + + + http://blog.pioto.org + + + + + Most things in here are still works in progress or + not stable enough for the main ebuild tree. If something + breaks, you're on your own. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/ikelos.git;a=summary + + + + + Ikelos's hospice for broken and damaged + ebuilds. + + + + + + + + + + + + + + + http://pda.gentoo.ru + + + + + This overlay contains some pda-related ebuilds + (for now for devices such as iPAQ hx4700, Sharp Zaurus, Asus + a620 and some others) + + + + + + + + + + + + + + + http://svn.liveforge.org/berkano/trunk + + + + + Berkano overlay provides an overlay for Gentoo + Linux with ebuilds of bleeding edge software (such as live + subversion builds) and other handy tools that are missing from + the official portage tree. Areas of interest include multimedia + and system administration. + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/dagger.git;a=summary + + + + + Dagger developer overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/dev/marineam + + + + + Experimental ebuilds for Xen. + + + + + + + + + + + + + + + http://git.xnull.de/gitweb/?p=overlay.git + + + + + A collection of work-in-progress ebuilds and other + fun broken things. + + + + + + + + + + + + + + + http://armagetronad.net + + + + + 3D light cycles, like the movie TRON + + + + + + + + + + + + + + + http://blog.flameeyes.eu/ + + + + + Flameeyes' private developer overlay + + + + + + + + + + + + + + + http://www.haskell.org/~gentoo/gentoo-haskell/ + + + + + The Official Gentoo Haskell overlay. + + + + + + + + + + + + + + + http://s3d.berlios.de/ + + + + + Gentoo ebuilds for s3d and related packages. s3d + is a 3d network display server which can be used as 3d desktop + enviroment. + + + + + + + + + + + + + + + http://n4g.mars.arge.at + + + + + The goal for this overlay is to reproduce the Open + Enterprise server from novell on gentoo + + + + + + + + + + + + + Linux Terminal Server Project + overlay + + + + + + + + + + + + + + + http://n4g.mars.arge.at + + + + + The goal for this overlay is to reproduce the Open + Enterprise server from novell on gentoo + + + + + + + + + + + + + + + http://overlays.gentoo.org + + + + + Some ebuilds not yet ready for mainstream portage + from Tobias Scherbaum [dertobi123@gentoo.org]. + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/python/wiki + + + + + Python experimental tree. + + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/embedded/wiki/openmoko + + + + + Openmoko's project overlay. + + + + + + + + + + + + + experimental gpe ebuilds + + + + + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/tove.git + + + + + Torsten Veller developer overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/emacs/ + + + + + Provide Emacs related ebuilds which are a bit + experimental or work-in-progress. Don't rely on them, but don't + hesitate to file bugs or write emails. + + + + + + + + + + http://dev.gentoo.org/~hawking/ + + + hawking's random ebuilds. + + + + + + + + + + http://cafarelli.fr/websvn/listing.php?repname=voyageur-overlay + + + Voyageur's random ebuilds stuff + + + + + + + + + http://overlays.gentoo.org/proj/php + + + Development overlay for PHP, experimental + branch. + + + + + + + + + http://dev.gentoo.org/~dev-zero/ + + + Dev-zeros personal developer overlay + + + + + + + + + http://overlays.gentoo.org + + + Experimental ebuilds from the private overlay of + Ioannis Aslanidis [deathwing00@gentoo.org]. + + + + + + + + + http://overlays.gentoo.org/proj/vps + + + Gentoo VPS project overlay (experimental + ebuilds) + + + + + + + + + http://overlays.gentoo.org/proj/mozilla + + + New mozilla development that is not yet in + tree + + + + + + + + + http://www.lila-center.info + + + The Lila theme is a community project, originally + created by Daniel G. Taylor and members of the Gentoo Linux + community. The theme is based around SVG graphics - which means + they can be scaled to any size without loss of quality - and is + meant to be usable across different desktops and platforms. For + more information about the Lila theme project or to see how you + could get involved, there are a few places to look: The Lila + theme forums #lila on chat.freenode.org + + + + + + + + Temporary overlay for adding support for the EFIKA + platform to Gentoo. + + + + + + + + + http://devnull.core.ws/EbuildRepository/ + + + Various ebuilds, most of them are bleeding edge + scm versions, the others have not found their way into portage + yet. + + + + + + + + + http://overlays.gentoo.org/dev/trapni/ + + + trapni's private developer overlay (mostly + covering YaCS/server related ebuilds for now) + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/ruby/wiki + + + + + Experimental ebuilds from the Ruby + edge. + + + + + + + + + + http://overlays.gentoo.org + + + This is the home of Gentoo's wider collection of + ebuilds for web-based applications. This is where we collect + all the ebuilds submitted to Bugzilla by our users, and make + them available in an easy-to-use overlay for wider + testing. + + + + + + + + + http://www.freevo.org + + + The Freevo overlay provides ebuils for development + snapshots of the unreleased Freevo 2.0 and its + dependencies. + + + + + + + + + http://overlays.gentoo.org/proj/science/wiki/en + + + The Gentoo Science Overlay is intended as a place + to work outside of the main portage tree on experimental + ebuilds. Our aim is to increase the rate of development of + scientific packages for Gentoo, but ebuilds in this repository + are by their very nature more experimental. If you wish to use + them you should be willing to help test and report + bugs. + + + + + + + + + http://overlays.gentoo.org/dev/rbu/wiki + + + Random stuff. + + + + + + + + + http://proaudio.tuxfamily.org/wiki + + + Evermind's overlay with ebuilds for a lot of + pro-audio production software. + + + + + + + + + http://overlays.gentoo.org/dev/seemant + + + Seemant's development overlay for django and other + things. + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/remi.git + + + Remi Cardona developer overlay + + + + + + + + + + + + + + http://svn.digital-trauma.de/gentoo/ + + + + + This overlay has a binary, current version of + eclipse with many plugins and some small new ebuilds from + trauma and bugzilla.g.o. + + + + + + + + + + http://overlays.gentoo.org + + + Mostly Python-related ebuilds. + + + + + + + + + + + + + + http://dev.gentoo.org/~hwoarang/ + + + + + hwoarangs' testing ebuilds + + + + + + + + + + + + + + + http://github.com/steev/steev-overlay/tree/master + + + + + Steev Klimaszewski's Overlay + + + + + + + + + + + + + + + http://overlays.gentoo.org/proj/vdr + + + + + Overlay for VDR, that contains ebuilds for + the vdr-xine output plugin, and the needed patched xine-lib + + + + + + + + + + + + http://repo.or.cz/w/ub0rlay.git + + + + This is an ub0r overlay! + + + + + + + + + http://www.initng.org + + + Initng is a full replacement of the old and in + many ways deprecated sysvinit tool. It is designed with speed + in mind because it does as much as possible asynchronously. In + other words: It will boot your unix-system much faster, and + give you more control and statistics over your + system. + + + + + + + + + http://gentoo-wiki.com/Howto_OSS4 + + + OSSv4 overlay + + + + + + + + + http://overlays.gentoo.org/dev/anant/wiki + + + A collection of useful ebuilds related to + Plan9. + + + + + + + + + http://code.google.com/p/raw/ + + + some raw stuff + + + + + + + + + http://overlays.gentoo.org/proj/php + + + Development overlay for PHP, testing + branch. + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=proj/m68k.git + + + m68k team overlay + + + + + + + + Packages for players and authors of interactive + fiction + + + + + + + + + http://overlays.gentoo.org/dev/chtekk + + + Overlay for various applications I use myself and + plan on adding to the tree or update/fix. + + + + + + + + + http://overlays.gentoo.org/proj/postgresql + + + Development overlay for PostgreSQL, experimental + branch. + + + + + + + + + http://overlays.gentoo.org + + + Some ebuilds not yet ready for mainstream portage + from Thilo Bangert [bangert@gentoo.org]. + + + + + + + + + http://overlays.gentoo.org/dev/suka + + + experimental stuff of all sorts + + + + + + + + + http://overlays.gentoo.org/proj/vdr + + + Development overlay for VDR, testing + branch. + + + + + + + + + http://overlays.gentoo.org/proj/nx + + + Overlay for the NX/FreeNX packages for + Gentoo. + + + + + + + + + http://dev.gentoo.org/~serkan + + + Serkan Kaba's (serkan) private developer + overlay + + + + + + + + + http://github.com/gentoo-qt/qting-edge/ + + + Experimental Qt4 ebuilds and related packages, + provided by Gentoo's Qt team. The overlay contains ebuilds for + official pre-releases, and live ebuilds for both the official + Nokia Qt Software git repository and KDE's qt-copy subversion + repository. It also has various (non-KDE) packages that use + Qt4. + + + + + + + + + http://overlays.gentoo.org/proj/sunrise + + + Ebuilds for bugs assigned to + maintainer-wanted + + + + + + + + + http://overlays.gentoo.org/proj/perl/ + + + Experimental ebuilds for Perl packages in Gentoo. + Comments and bugreports are welcome! + + + + + + + + + http://overlays.gentoo.org/proj/emacs/ + + + Provide XEmacs related ebuilds which are a bit + experimental or work-in-progress. Don't rely on them, but don't + hesitate to file bugs or write emails. + + + + + + + + + http://genkdesvn.mailstation.de + + + A collection of work-in-progress ebuilds and other + fun broken things. + + + + + + + + + + + + + + https://overlays.gentoo.org/dev/mescalinum + + + + + Tcl/Tk multi-slot system, with tcltk eselect module + for switching across multiple versions (actually: 8.4 8.5 8.6) + + + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/leio.git + + + Mart Raudsepp developer overlay + + + + + + + + + http://dev.gentoo.org/~mueli + + + Overlay which provides the bleeding edge on the + kerberos integration in gentoo. + + + + + + + + + http://overlays.gentoo.org/dev/lu_zero + + + Experimental Media and PowerPC/CELL related + ebuilds. + + + + + + + + Kernel Virtual Machine userspace + support + + + + + + + + + http://overlays.gentoo.org/proj/mysql + + + Development overlay for MySQL, testing + branch. + + + + + + + + + + http://git.overlays.gentoo.org/gitweb/?p=dev/scarabeus.git + + + Tomas Chvatal developer overlay + + + + + + + + + http://overlays.gentoo.org + + + Development overlay for ebuilds that I plan to + commit to the tree that are sourced from bugzilla or + liquidx. + + + + + + + + + http://overlays.gentoo.org/proj/gcc-porting/ + + + Compatibility patches for upcoming GCC + releases. + + + + + + + + + http://luke.dashjr.org + + + Misc ebuilds by Luke-Jr + + + diff --git a/commands/parse.py b/commands/parse.py new file mode 100644 index 0000000..8fff38a --- /dev/null +++ b/commands/parse.py @@ -0,0 +1,150 @@ +from __future__ import with_statement + +import os, re + +from django.conf import settings + +os.environ['DJANGO_SETTINGS_MODULE'] = 'ebuildfnd.settings' + +from layman.debug import Message +from manage_layman import LaymanManager + +from ebuildfnd.ebuildfind.models import Ebuild, Overlay + +from whoosh_manager import WhooshEbuildManager + +OVERLAYS_BASE = "/home/timemachine/www/ebuildfnd/ebuildfind/commands/var/" +OUT = Message("parser") + +class EbuildParser: + def __init__(self, overlay, category, app, file_path): + path, filename = os.path.split(os.path.realpath(file_path)) + + #OUT.warn("%s\n%s\n%s\n%s" % (overlay, category, app, file_path)) + #OUT.warn("****************************************************") + + name_version, ext = os.path.splitext(filename) + n = len(app) + + version = name_version[n+1:] + + self.name = app + self.version = version + self.category = category + self.overlay = overlay + + with open(file_path) as file: + f = file.read() + regex1 = re.compile(r'([a-z_]+\s*\(\))\s*{.*}', re.DOTALL) + f = re.sub(regex1, r'', f) + regex2 = re.compile(r'(for.*done)', re.DOTALL) + f = re.sub(regex2, r'', f) + data = dict(re.findall("(DESCRIPTION|HOMEPAGE|KEYWORDS|LICENSE|IUSE)=\"(.+)\"", f)) + + def notnull(d, key): + try: + return d[key] + except: + return "" + + self.description = notnull(data, "DESCRIPTION") + self.description = self.description.replace("\n"," ") + self.homepage = notnull(data, "HOMEPAGE") + self.keywords = notnull(data, "KEYWORDS") + self.license = notnull(data, "LICENSE") + self.iuse = notnull(data, "IUSE") + + def __repr__(self): + output = "%s/%s [%s] @ %s" % (self.category, self.name, self.version, self.overlay) + output += " " + self.description + output += " " + self.homepage + output += " " + self.keywords + output += " " + self.license + output += " " + self.iuse + return output + +def exclude_directory(path, dir): + exclude_dir = ["eclass", "profiles", "README-TODO", "Documentation", "sets", "index"] + return os.path.isdir(path) and dir not in exclude_dir and not dir.startswith(".") + +def ParseEbuilds(): + i = 0 + Ebuild.objects.all().delete() + overlays = os.listdir(OVERLAYS_BASE) + + whoosh = WhooshEbuildManager(True) + + for overlay in overlays: + path_overlay = os.path.join(OVERLAYS_BASE, overlay) + + if exclude_directory(path_overlay, overlay): + print overlay + overlay_name = overlay + overlay = Overlay.objects.get(name=overlay) + + categories = os.listdir(path_overlay) + + for category in categories: + path_overlay_category = os.path.join(path_overlay, category) + + if exclude_directory(path_overlay_category, category): + apps = os.listdir(path_overlay_category) + for app in apps: + path_overlay_category_app = os.path.join(path_overlay_category, app) + if exclude_directory(path_overlay_category_app, app): + ebuilds = os.listdir(path_overlay_category_app) + + for ebuild in ebuilds: + if ebuild.endswith(".ebuild"): + if exclude_directory(path_overlay_category_app, ebuild): + #OUT.warn(ebuild) + + path_ebuild = os.path.join(path_overlay_category_app, ebuild) + + e = EbuildParser(overlay_name, category, app, path_ebuild) + + + ebuild = Ebuild() + ebuild.name = unicode(e.name) + ebuild.category = unicode(e.category) + ebuild.version = unicode(e.version) + ebuild.description = unicode(e.description, errors="replace") + ebuild.keywords = unicode(e.keywords) + ebuild.license = unicode(e.license) + ebuild.iuse = unicode(e.iuse) + ebuild.homepage = unicode(e.homepage) + ebuild.overlay = overlay + #ebuild.save() + + + whoosh.Update(ebuild) + + i +=1 + print i + +def SyncOverlays(): + h = LaymanManager() + h.AddAll() + +def ParseOverlays(): + h = LaymanManager() + overlays = h.List() + + for name, overlay in overlays.items() : + """ check if new overlay is ready """ + o = Overlay.objects.all().filter(name=name) + + if not o: + o = Overlay() + o.name = name + o.description = overlay["description"] + o.link = overlay["link"] + o.save() + +def main(): + #SyncOverlays() + ParseOverlays() + ParseEbuilds() + +if __name__ == "__main__": + main() diff --git a/commands/whoosh_manager.py b/commands/whoosh_manager.py new file mode 100644 index 0000000..e4acb95 --- /dev/null +++ b/commands/whoosh_manager.py @@ -0,0 +1,56 @@ +import os + +from whoosh import store +from whoosh.fields import Schema, TEXT, ID +from whoosh.index import Index +from whoosh.qparser import QueryParser + +from shutil import rmtree + +from django.conf import settings + +os.environ['DJANGO_SETTINGS_MODULE'] = 'ebuilds.settings' + +INDEX_BASE = settings.ROOT_PATH + "/ebuildfind/commands/var/index" + +class WhooshEbuildManager: + def __init__(self, reset=False): + if reset : + if os.path.exists(INDEX_BASE): + rmtree(INDEX_BASE) + os.mkdir(INDEX_BASE) + storage = store.FileStorage(INDEX_BASE) + else: + storage = store.FileStorage(INDEX_BASE) + storage = store.copy_to_ram(storage) + + schema = Schema(permalink=ID(stored=True), + content=TEXT(phrase=False)) + + self.index = Index(storage, schema=schema, create=reset) + self.searcher = self.index.searcher() + self.parser = QueryParser("content", schema = self.index.schema) + + def Update(self, ebuild): + writer = self.index.writer() + + def clean(text): + return text.lower.replace("-", " ") + + content_raw = [ebuild.overlay.name, ebuild.category, ebuild.name, ebuild.description] + content = [] + + for e in content_raw: + e = e.lower().replace("-", " ") + content.append(e) + + content.append(ebuild.version) + + content = ' '.join(content) + + writer.add_document(permalink=ebuild.permalink(), + content=content) + writer.commit() + + def Search(self, query): + return self.searcher.search(self.parser.parse(query), sortedby = "permalink") diff --git a/models.py b/models.py new file mode 100644 index 0000000..7e062d6 --- /dev/null +++ b/models.py @@ -0,0 +1,29 @@ +from django.db import models + +class Overlay(models.Model): + name = models.CharField(max_length=255) + description = models.TextField() + link = models.URLField() + + def __repr__(self): + return self.name + + def get_absolute_url(self): + return "/search/?q=%s" % self.name + +class Ebuild(models.Model): + name = models.CharField(max_length=255) + category = models.CharField(max_length=255) + version = models.CharField(max_length=255) + description = models.TextField() + keywords = models.CharField(max_length=255) + license = models.CharField(max_length=255) + iuse = models.CharField(max_length=255) + homepage = models.URLField() + overlay = models.ForeignKey(Overlay) + + def permalink(self): + return "/%s/%s/%s/%s" % (self.overlay.name, self.category, self.name, self.version) + + def get_absolute_url(self): + return "/search/?q=%s" % self.name \ No newline at end of file diff --git a/planet.py b/planet.py new file mode 100644 index 0000000..6c9abd5 --- /dev/null +++ b/planet.py @@ -0,0 +1,99 @@ +import shelve + +from feedcache.cache import Cache + +import pdb + +from django.template.defaultfilters import truncatewords_html +from django.utils.encoding import smart_unicode + +def TryEncoding(content): + for body_charset in 'UTF-8', 'US-ASCII', 'ISO-8859-1', : + try: + return content.encode(body_charset) + except UnicodeError: + pass + except Exception, e: + if not type(content) is str: + pass + + +def GetContent(feed): + if hasattr(feed, "content"): + return feed.content[0]["value"] + else: + return feed.summary + + +class Parser: + """ + "http://planet.gentoo.org/atom.xml" + "http://overlays.gentoo.org/rss20.xml" + "http://www.gentoo.org/rdf/en/gentoo-news.rdf" + >>> f = Parser() + >>> f.GetTitle() + u'Planet Gentoo' + >>> f.GetLink() + u'http://planet.gentoo.org/' + >>> for e in f: print e["title"], e["content"] + """ + + def __init__(self, url, summary=False): + storage = shelve.open(".feedcache") + try : + fc = Cache(storage) + self.feed = fc.fetch(url) + self.iterator = 0 + self.summary = summary + finally: + storage.close() + def GetTitle(self): + return self.feed.feed.title + + def GetLink(self): + return self.feed.feed.link + + def next(self): + if self.iterator >= len(self.feed.entries): raise StopIteration + + entry = self.feed.entries[self.iterator] + + title = TryEncoding(entry["title"]) + content = TryEncoding(GetContent(entry)) + link = entry.link + + if self.summary: + content = TryEncoding(truncatewords_html(content, 30)) + content = "".join((content , "...")) + + entry = dict((("title", title), ("content", content), ("link", link))) + + self.iterator += 1 + return entry + + def __iter__(self): + return self + +def _test(): + """ + import doctest, ebuilds.ebuildfind.planet as planet + return doctest.testmod(planet) + + "http://news.google.fr/news?pz=1&ned=us&hl=en&q=gentoo+AND+(linux+OR+OS+OR+Operating+System+OR+GNU)&output=rss" + "http://www.gentoo.org/rdf/en/gentoo-news.rdf" + "http://planet.gentoo.org/atom.xml" + "http://overlays.gentoo.org/rss20.xml" + """ + + f = Parser("http://planet.gentoo.org/atom.xml", True) + + print f.GetTitle() + print f.GetLink() + + for e in f: + print e["title"] + print e["content"] + print e["link"] + +if __name__ == "__main__": + _test() diff --git a/templates/ebuildfind/bakup.html b/templates/ebuildfind/bakup.html new file mode 100644 index 0000000..e69de29 diff --git a/templates/ebuildfind/base.html b/templates/ebuildfind/base.html new file mode 100644 index 0000000..a332a1d --- /dev/null +++ b/templates/ebuildfind/base.html @@ -0,0 +1,131 @@ + + + + + ebuildfind - search engine for gentoo overlays + + + + + + + + + + +
+
+ + + +
+ + + +
+ {% block results %}{% endblock %} +
+
+ + +
+ {% block info %} +
+

Overlays Planet

+
+ + {% for post in GOverlays %} +
+
{{ post.title }}
+
{{ post.content|safe }}
+
+ {% endfor %} + +
+
+
+
+
+

Gentoo Planet

+
+ + {% for post in GPlanet %} +
+
{{ post.title }}
+
{{ post.content|truncatewords_html:100|safe }}
+
+ {% endfor %} + +
+
+
+
+ +
+

Gentoo News

+
+ + {% for post in GNews %} +
+
{{ post.title }}
+
{{ post.content|safe }}
+
+ {% endfor %} + +
+
+ +
+
+
+

Google News

+
+ + {% for post in GGoogle %} +
+
{{ post.title }}
+
{{ post.content|safe }}
+
+ {% endfor %} + +
+
+ {% endblock %} +
+
+
+

"Gentoo" and "G" logo are the property of Gentoo + Foundation, Inc.

+

This website is made + with + django and whoosh + hosted by alwaysdata.com

+
+
+ + + + diff --git a/templates/ebuildfind/index.html b/templates/ebuildfind/index.html new file mode 100755 index 0000000..7e2c510 --- /dev/null +++ b/templates/ebuildfind/index.html @@ -0,0 +1,2 @@ +{% extends "ebuildfind/base.html" %} + diff --git a/templates/ebuildfind/search.html b/templates/ebuildfind/search.html new file mode 100644 index 0000000..ced17d8 --- /dev/null +++ b/templates/ebuildfind/search.html @@ -0,0 +1,21 @@ +{% extends "ebuildfind/base.html" %} + +{% block search-value%}{{query}}{% endblock %} + +{% block help %}{% endblock %} + +{% block results %} + +{% if error %} +

{{search_results.error}}

+{% endif %} + +
    + {% for result in results %} +
  • {{result}}
  • + {% endfor %} +
+ +{% endblock %} + +{% block info %}{% endblock %} diff --git a/urls.py b/urls.py new file mode 100644 index 0000000..41d3376 --- /dev/null +++ b/urls.py @@ -0,0 +1,15 @@ +from django.conf.urls.defaults import * +import views + +urlpatterns = patterns('', + # Example: + + + # Uncomment the admin/doc line below and add 'django.contrib.admindocs' + # to INSTALLED_APPS to enable admin documentation: + # (r'^admin/doc/', include('django.contrib.admindocs.urls')), + + # Uncomment the next line to enable the admin: + (r'^search/', views.search), + (r'^$', views.index), +) diff --git a/views.py b/views.py new file mode 100644 index 0000000..cc17e83 --- /dev/null +++ b/views.py @@ -0,0 +1,48 @@ + + + + + +from commands.whoosh_manager import WhooshEbuildManager +from django.shortcuts import render_to_response +from planet import Parser + +whoosh = WhooshEbuildManager() + + +def index(request): + GPlanet = Parser("http://planet.gentoo.org/atom.xml") + GOverlays = Parser("http://overlays.gentoo.org/rss20.xml") + GNews = Parser("http://www.gentoo.org/rdf/en/gentoo-news.rdf") + GGoogle = Parser("http://news.google.fr/news?pz=1&ned=us&hl=en&q=gentoo+AND+(linux+OR+OS+OR+Operating+System+OR+GNU)&output=rss") + + response = dict() + response['GGoogle'] = GGoogle + response['GNews'] = GNews + response['GOverlays'] = GOverlays + response['GPlanet'] = GPlanet + + return render_to_response("ebuildfind/index.html", response) + + +def search(request): + response = {"error":"Query should be at least 3 caracters long"} + query = "" + + if request.method == 'GET': + try: + query = request.GET["q"] + except: + pass + + if(len(query)>2): + response["error"] = False + response["query"] = query + + results = whoosh.Search(query) + response["results"] = list() + + for result in results: + response["results"].append(result["permalink"]) + + return render_to_response("ebuildfind/search.html", response) -- 2.11.4.GIT