diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | doc/layman.8.xml | 46 | ||||
-rw-r--r-- | etc/layman.cfg | 4 | ||||
-rw-r--r-- | layman/config.py | 9 | ||||
-rw-r--r-- | layman/overlay.py | 17 | ||||
-rw-r--r-- | layman/overlays/overlay.py | 51 |
7 files changed, 84 insertions, 50 deletions
@@ -18,3 +18,4 @@ A. F. T. Arahesis (arfrever.fta@gmail.com) - Quieten the VC systems - Better locale support. Donnie Berkholz (dberkholz@gentoo.org) - git support fixes Martin von Gagern (Martin.vGagern@gmx.net) - Better list format. +Sebastian Pipping (sebastian@pipping.org) - repositories.xml support @@ -1,6 +1,12 @@ CHANGES ------- +TODO +=================================== + + - Add support for repositories.xml database format + + Version 1.2.3 - Released 2009/01/01 =================================== diff --git a/doc/layman.8.xml b/doc/layman.8.xml index 95fee44..a7df688 100644 --- a/doc/layman.8.xml +++ b/doc/layman.8.xml @@ -22,7 +22,7 @@ </authorgroup> <copyright> - <year>2005-2008</year> + <year>2005-2009</year> <holder>Gunnar Wrobel</holder> </copyright> </articleinfo> @@ -618,7 +618,7 @@ <listitem> <para>Specifies the URL for the remote list of all available overlays. The default is - <filename>http://www.gentoo.org/proj/en/overlays/layman-global.txt</filename>. You + <filename>http://www.gentoo.org/proj/en/overlays/repositories.xml</filename>. You can specify several URLs here (one per line). The contents will get merged to a single list of overlays. This allows to add a personal collection of @@ -664,7 +664,7 @@ files. In order for this to be possible the script needs an external list of possible overlay sources. There is a centralized list available at <ulink - url="http://www.gentoo.org/proj/en/overlays/layman-global.txt"/> + url="http://www.gentoo.org/proj/en/overlays/repositories.xml"/> but nothing will prevent you from using or publishing your own list of overlays. The location of the remote lists can also be modified using the <option>--overlays</option> @@ -857,26 +857,26 @@ <para> Layman uses a central list of overlays in XML format. The file looks like this: <example> - <title>An example overlay.xml file</title> + <title>An example overlays.xml file</title> <programlisting> - <?xml version="1.0" ?> - <layman> - <overlays> - <overlay - type = "svn" - src = "https://mydomain.net/svn/myoverlay/" - contact = "me@mydomain.net" - name = "myoverlay"> - - <link> - http://mydomain.net/myoverlay - </link> - - <description> - Contains some of my ebuilds. - </description> - </overlay> - </overlays> + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE repositories SYSTEM "/dtd/repositories.dtd"> + <repositories xmlns="" version="1.0"> + <repo quality="experimental" status="official"> + <name>gnome</name> + <description>experimental gnome ebuilds</description> + <homepage>http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=summary</homepage> + <owner type="project"> + <email>gnome@gentoo.org</email> + <name>GNOME herd</name> + </owner> + <source type="git">git://git.overlays.gentoo.org/proj/gnome.git</source> + <source type="git">http://git.overlays.gentoo.org/gitroot/proj/gnome.git</source> + <source type="git">git+ssh://git@git.overlays.gentoo.org/proj/gnome.git</source> + <feed>http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=atom</feed> + <feed>http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=rss</feed> + </repo> + </repositories> </programlisting> </example> </para> @@ -904,7 +904,7 @@ <para> The global list of overlays used by <command>layman</command> lies at - <filename>http://www.gentoo.org/proj/en/overlays/layman-global.txt</filename>. + <filename>http://www.gentoo.org/proj/en/overlays/repositories.xml</filename>. </para> <para> diff --git a/etc/layman.cfg b/etc/layman.cfg index 2759f84..a52984e 100644 --- a/etc/layman.cfg +++ b/etc/layman.cfg @@ -26,12 +26,12 @@ 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 +#overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml # http://dev.gentoo.org/~wrobel/layman/global-overlays.xml # http://mydomain.org/my-layman-list.xml # file:///usr/local/portage/layman/my-list.xml -overlays : http://www.gentoo.org/proj/en/overlays/layman-global.txt +overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml #----------------------------------------------------------- # Proxy support diff --git a/layman/config.py b/layman/config.py index 63b1c15..d41491e 100644 --- a/layman/config.py +++ b/layman/config.py @@ -8,11 +8,13 @@ # Handles layman configuration # # Copyright: -# (c) 2005 - 2008 Gunnar Wrobel +# (c) 2005 - 2009 Gunnar Wrobel +# (c) 2009 Sebastian Pipping # Distributed under the terms of the GNU General Public License v2 # # Author(s): # Gunnar Wrobel <wrobel@gentoo.org> +# Sebastian Pipping <sebastian@pipping.org> # '''Defines the configuration options and provides parsing functionality.''' @@ -50,7 +52,7 @@ class Config(object): >>> sys.argv.append(here + '/../etc/layman.cfg') >>> a = Config() >>> a['overlays'] - '\\nhttp://www.gentoo.org/proj/en/overlays/layman-global.txt' + '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml' >>> sorted(a.keys()) ['cache', 'config', 'local_list', 'make_conf', 'nocheck', 'overlays', 'proxy', 'quietness', 'storage', 'umask', 'width'] ''' @@ -64,8 +66,7 @@ class Config(object): 'proxy' : '', 'umask' : '0022', 'overlays' : - 'http://www.gentoo.org/proj/en/overlays/layman-global.' - 'txt',} + 'http://www.gentoo.org/proj/en/overlays/repositories.xml',} self.parser = OptionParser( diff --git a/layman/overlay.py b/layman/overlay.py index a9a1980..5b8c73f 100644 --- a/layman/overlay.py +++ b/layman/overlay.py @@ -8,11 +8,13 @@ # Access to an xml list of overlays # # Copyright: -# (c) 2005 - 2008 Gunnar Wrobel +# (c) 2005 - 2009 Gunnar Wrobel +# (c) 2009 Sebastian Pipping # Distributed under the terms of the GNU General Public License v2 # # Author(s): # Gunnar Wrobel <wrobel@gentoo.org> +# Sebastian Pipping <sebastian@pipping.org> # '''Main handler for overlays.''' @@ -110,14 +112,19 @@ class Overlays: raise Exception('Failed to parse the overlay list!\nError was:\n' + str(error)) - overlays = document.getElementsByTagName('overlay') + overlays = document.getElementsByTagName('overlay') + \ + document.getElementsByTagName('repo') for overlay in overlays: OUT.debug('Parsing overlay entry', 8) + try: + element_to_scan = overlay.getElementsByTagName('source')[0] + except IndexError: + element_to_scan = overlay - for index in range(0, overlay.attributes.length): - attr = overlay.attributes.item(index) + for index in range(0, element_to_scan.attributes.length): + attr = element_to_scan.attributes.item(index) if attr.name == 'type': if attr.nodeValue in OVERLAY_TYPES.keys(): try: @@ -151,7 +158,7 @@ class Overlays: imp = xml.dom.minidom.getDOMImplementation() - doc = imp.createDocument('layman', 'overlays', None) + doc = imp.createDocument('layman', 'repositories', None) root = doc.childNodes[0] diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py index b9568b1..bee7529 100644 --- a/layman/overlays/overlay.py +++ b/layman/overlays/overlay.py @@ -8,11 +8,13 @@ # Base class for the different overlay types. # # Copyright: -# (c) 2005 - 2008 Gunnar Wrobel +# (c) 2005 - 2009 Gunnar Wrobel +# (c) 2009 Sebastian Pipping # Distributed under the terms of the GNU General Public License v2 # # Author(s): # Gunnar Wrobel <wrobel@gentoo.org> +# Sebastian Pipping <sebastian@pipping.org> # ''' Basic overlay class.''' @@ -55,7 +57,7 @@ class Overlay: True >>> a.src u'https://overlays.gentoo.org/svn/dev/wrobel' - >>> a.contact + >>> a.owner_email u'nobody@gentoo.org' >>> a.description u'Test' @@ -69,27 +71,40 @@ class Overlay: self.data = node_to_dict(xml) - if '&name' in self.data.keys(): + if '<name>1' in self.data.keys(): + self.name = self.data['<name>1']['@'].strip() + elif '&name' in self.data.keys(): self.name = self.data['&name'] else: - raise Exception('Overlay is missing a "name" attribute!') + raise Exception('Overlay is missing a "name" entry!') - if '&src' in self.data.keys(): + if '<source>1' in self.data.keys(): + self.src = self.data['<source>1']['@'].strip() + elif '&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'] + raise Exception('Overlay "' + self.name + '" is missing a "source" ' + 'entry!') + + if '<owner>1' in self.data.keys() and \ + '<email>1' in self.data['<owner>1']: + self.owner_email = self.data['<owner>1']['<email>1']['@'].strip() + if '<name>1' in self.data['<owner>1']: + self.owner_name = self.data['<owner>1']['<name>1']['@'].strip() + else: + self.owner_name = None + elif '&contact' in self.data.keys(): + self.owner_email = self.data['&contact'] + self.owner_name = None else: - self.contact = '' + self.owner_email = '' + self.owner_name = None if not ignore: raise Exception('Overlay "' + self.name + '" is missing a ' - '"contact" attribute!') + '"owner.email" entry!') elif ignore == 1: OUT.warn('Overlay "' + self.name + '" is missing a ' - '"contact" attribute!', 4) + '"owner.email" entry!', 4) if '<description>1' in self.data.keys(): self.description = self.data['<description>1']['@'].strip() @@ -193,7 +208,10 @@ class Overlay: result += self.name + u'\n' + (len(self.name) * u'~') result += u'\nSource : ' + self.src - result += u'\nContact : ' + self.contact + if self.owner_name != None: + result += u'\nContact : %s <%s>' % (self.owner_name, self.owner_email) + else: + result += u'\nContact : ' + self.owner_email result += u'\nType : ' + self.type result += u'; Priority: ' + str(self.priority) + u'\n' @@ -204,13 +222,14 @@ class Overlay: result += u'\n '.join((u'\n' + description).split(u'\n')) result += u'\n' - if '<link>1' in self.data.keys(): - link = self.data['<link>1']['@'].strip() + for key in (e for e in ('<homepage>1', '<link>1') if e in self.data.keys()): + link = self.data[key]['@'].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' + break return result |