aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--g_octave/ebuild.py25
-rw-r--r--g_octave/svn/description.py34
-rw-r--r--tests/test_overlay.py3
3 files changed, 52 insertions, 10 deletions
diff --git a/g_octave/ebuild.py b/g_octave/ebuild.py
index 6008ed9..85e2d6b 100644
--- a/g_octave/ebuild.py
+++ b/g_octave/ebuild.py
@@ -20,6 +20,9 @@ from config import Config
from description import *
from description_tree import *
from exception import EbuildException
+from svn.description import SvnDescription
+
+from portage.versions import vercmp
import os
import portage
@@ -44,6 +47,7 @@ class Ebuild:
self._config = conf
self.__dbtree = DescriptionTree(conf = self._config)
+ self.svn_version = False
atom = re_pkg_atom.match(pkg_atom)
if atom == None:
@@ -52,8 +56,17 @@ class Ebuild:
else:
self.pkgname = atom.group(1)
self.version = atom.group(2)
+ if self.version == '9999':
+ self.svn_version = True
- self.__desc = self.__dbtree['%s-%s' % (self.pkgname, self.version)]
+ if self.svn_version:
+ category = self.__dbtree.categories.get(self.pkgname, None)
+ if category is not None:
+ self.__desc = SvnDescription(category, self.pkgname)
+ else:
+ raise EbuildException('Failed to find the octave-forge category of this package.')
+ else:
+ self.__desc = self.__dbtree['%s-%s' % (self.pkgname, self.version)]
if self.__desc == None:
raise EbuildException('Package not found: %s' % pkg_atom)
@@ -108,6 +121,8 @@ class Ebuild:
EAPI="3"
+G_OCTAVE_CAT="%(category)s"
+
inherit g-octave%(eutils)s
DESCRIPTION="%(description)s"
@@ -118,8 +133,6 @@ SLOT="0"
KEYWORDS="%(keywords)s"
IUSE=""
-G_OCTAVE_CAT="%(category)s"
-
# it's annoying have to see the download of packages from the official
# mirrors fail with a 404 error.
RESTRICT="mirror"
@@ -250,10 +263,8 @@ RDEPEND="${DEPEND}
allowed_versions = []
for _version in versions:
- _tp_version = tuple(_version.split('.'))
- tp_version = tuple(version.split('.'))
-
- if eval('%s %s %s' % (_tp_version, comp, tp_version)):
+ comparation = vercmp(_version, version)
+ if eval('%s %s 0' % (comparation, comp)):
allowed_versions.append(_version)
to_install.append('%s-%s' % (pkg, self.__dbtree.version_compare(allowed_versions)))
diff --git a/g_octave/svn/description.py b/g_octave/svn/description.py
new file mode 100644
index 0000000..08c5260
--- /dev/null
+++ b/g_octave/svn/description.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+"""
+ description.py
+ ~~~~~~~~~~~~~~
+
+ This module implements a wrapper to the g_octave.description module,
+ creating a description object from the SVN trunk DESCRIPTION file of
+ a package.
+
+ :copyright: (c) 2010 by Rafael Goncalves Martins
+ :license: GPL-2, see LICENSE for more details.
+"""
+
+import os
+import tempfile
+
+from g_octave.svn import client
+from g_octave import description, exception
+
+class SvnDescription(description.Description):
+
+ def __init__(self, category, package):
+ self._svn = client.SvnClient()
+ temp_desc = config_file = tempfile.mkstemp()[1]
+ try:
+ self._svn.download_file(
+ category + '/' + package + '/DESCRIPTION',
+ temp_desc
+ )
+ except:
+ raise exception.DescriptionException('Failed to fetch DESCRIPTION file from SVN')
+ description.Description.__init__(self, temp_desc, parse_sysreq=True)
+ os.unlink(temp_desc)
diff --git a/tests/test_overlay.py b/tests/test_overlay.py
index 9242324..9ac7d2d 100644
--- a/tests/test_overlay.py
+++ b/tests/test_overlay.py
@@ -11,10 +11,7 @@
:license: GPL-2, see LICENSE for more details.
"""
-import ConfigParser
import os
-import shutil
-import tempfile
import unittest
import utils