diff options
author | 2010-07-31 14:08:18 +0300 | |
---|---|---|
committer | 2010-07-31 14:08:18 +0300 | |
commit | c08c484e59ef5a5e93e9514ad4ee7b9b79c25235 (patch) | |
tree | a1ea205513b4abb3f2e760f5aa96690f9e93cf04 | |
parent | Init Ebuild directly using pkgcore's ebuild_src (diff) | |
download | gsoc2010-grumpy-c08c484e59ef5a5e93e9514ad4ee7b9b79c25235.tar.gz gsoc2010-grumpy-c08c484e59ef5a5e93e9514ad4ee7b9b79c25235.tar.bz2 gsoc2010-grumpy-c08c484e59ef5a5e93e9514ad4ee7b9b79c25235.zip |
Show full version (including revision) in web frontend
-rw-r--r-- | grumpy/models.py | 6 | ||||
-rw-r--r-- | grumpy/templates/browse_pkg.html | 2 | ||||
-rw-r--r-- | grumpy/testsuite/pkgmodel.py | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/grumpy/models.py b/grumpy/models.py index 679a1b5..e236067 100644 --- a/grumpy/models.py +++ b/grumpy/models.py @@ -105,6 +105,12 @@ class Ebuild(db.Model): p = ebuild_src return "%s/%s-%s" % (p.package, p.category, p.fullver) + @property + def fullver(self): + if self.revision > 0: + return "%s-r%d" % (self.version, self.revision) + return self.version + def __repr__(self): return '<%s> - %s' % (self.__class__.__name__, self.pcv) diff --git a/grumpy/templates/browse_pkg.html b/grumpy/templates/browse_pkg.html index cb6bcc7..80d803d 100644 --- a/grumpy/templates/browse_pkg.html +++ b/grumpy/templates/browse_pkg.html @@ -5,7 +5,7 @@ <ul> <li><a href="{{ url_for('browse_cat', cat=cat) }}">..</a></li> {% for ebuild in pkg.ebuilds %} - <li>{{ ebuild.version | e }}</li> + <li>{{ ebuild.fullver | e }}</li> {% endfor %} </ul> {% if qa %} diff --git a/grumpy/testsuite/pkgmodel.py b/grumpy/testsuite/pkgmodel.py index c59ecd4..63f48b8 100644 --- a/grumpy/testsuite/pkgmodel.py +++ b/grumpy/testsuite/pkgmodel.py @@ -36,10 +36,11 @@ class PkgModelTestCase(GrumpyTestCase): p.ebuilds.append(Ebuild(self.get_pkg('app-misc/testpkg-1.0-r4', data))) self.db.session.add(p) self.db.session.commit() + return p def test_ebuild_parsing(self): with self.app.test_request_context(): - self.make_package_and_ebuilds() + p = self.make_package_and_ebuilds() e = Ebuild.query.first() assert e.iuse == 'test,flags,split-flag' assert e.iuse_neg == 'negative' @@ -48,6 +49,7 @@ class PkgModelTestCase(GrumpyTestCase): assert e.eapi == 0 assert e.slot == '1.1' assert e.pcv == 'testpkg/app-misc-1.0-r3' + assert e.package == p def test_category_and_package_model(self): with self.app.test_request_context(): |