djeuscan: temporary fix for ebuild/metadata

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-11-19 22:54:52 +01:00
parent fa4916f5f8
commit 8a11e1fc39
4 changed files with 8 additions and 9 deletions

View File

@ -102,7 +102,7 @@ def get_layman_repos():
def versiontag_to_attrs(tag): def versiontag_to_attrs(tag):
import re import re
match = re.match(r"(.+)-(.+):(\d+)-(.+)", tag) match = re.match(r"(.+)-(.+)-(.+)", tag)
if match: if match:
return match.groups() return match.groups()
else: else:

View File

@ -158,8 +158,7 @@ class Version(models.Model):
@property @property
def tag(self): def tag(self):
return '%s-%s:%s-%s' % (self.version, self.revision, self.slot, return '%s-%s-%s' % (self.version, self.revision, self.overlay)
self.overlay)
@property @property
def urls_list(self): def urls_list(self):

View File

@ -23,9 +23,9 @@ package_patterns = patterns('djeuscan.views',
url(r'^unfavourite/$', unfavourite_package, name="unfavourite_package"), url(r'^unfavourite/$', unfavourite_package, name="unfavourite_package"),
url(r'^refresh$', "refresh_package", name="refresh_package"), url(r'^refresh$', "refresh_package", name="refresh_package"),
url(r'^problem$', 'problem', name="problem"), url(r'^problem$', 'problem', name="problem"),
url(r'^(?P<version_tag>[^/]+)/ebuild$', "package_version_ebuild", url(r'^(?P<version_tag>.*)/ebuild$', "package_version_ebuild",
name="package_version_ebuild"), name="package_version_ebuild"),
url(r'^(?P<version_tag>[^/]+)/metadata$', "package_version_metadata", url(r'^(?P<version_tag>.*)/metadata$', "package_version_metadata",
name="package_version_metadata"), name="package_version_metadata"),
) )

View File

@ -227,11 +227,11 @@ def package(request, category, package):
def package_version_metadata(request, category, package, version_tag): def package_version_metadata(request, category, package, version_tag):
package = get_object_or_404(Package, category=category, name=package) package = get_object_or_404(Package, category=category, name=package)
try: try:
ver, rev, slot, over = versiontag_to_attrs(version_tag) ver, rev, over = versiontag_to_attrs(version_tag)
except TypeError: except TypeError:
return HttpResponseNotFound() return HttpResponseNotFound()
version = get_object_or_404(Version, package=package, version=ver, version = get_object_or_404(Version, package=package, version=ver,
revision=rev, slot=slot, overlay=over) revision=rev, overlay=over)
content = "" content = ""
if version.metadata_path: if version.metadata_path:
with open(version.metadata_path) as meta_file: with open(version.metadata_path) as meta_file:
@ -242,11 +242,11 @@ def package_version_metadata(request, category, package, version_tag):
def package_version_ebuild(request, category, package, version_tag): def package_version_ebuild(request, category, package, version_tag):
package = get_object_or_404(Package, category=category, name=package) package = get_object_or_404(Package, category=category, name=package)
try: try:
ver, rev, slot, over = versiontag_to_attrs(version_tag) ver, rev, over = versiontag_to_attrs(version_tag)
except TypeError: except TypeError:
return HttpResponseNotFound() return HttpResponseNotFound()
version = get_object_or_404(Version, package=package, version=ver, version = get_object_or_404(Version, package=package, version=ver,
revision=rev, slot=slot, overlay=over) revision=rev, overlay=over)
if version.ebuild_path: if version.ebuild_path:
with open(version.ebuild_path) as ebuild_file: with open(version.ebuild_path) as ebuild_file:
content = ebuild_file.read() content = ebuild_file.read()