summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2011-12-12 16:47:26 (GMT)
committerLuke Macken <lmacken@redhat.com>2011-12-12 16:47:26 (GMT)
commitfcad91dd40702cebc184feb115d5232dd3605a6c (patch)
tree59c1e78b545207f94760b6175dc9491b12fd087c
parent58347f8764d6ebbe98eb49f9b029489f4ab76ee6 (diff)
downloadfedoracommunity-fcad91dd40702cebc184feb115d5232dd3605a6c.zip
fedoracommunity-fcad91dd40702cebc184feb115d5232dd3605a6c.tar.gz
fedoracommunity-fcad91dd40702cebc184feb115d5232dd3605a6c.tar.xz
Get our Sources widgets working with dead packages.
-rw-r--r--fedoracommunity/connectors/gitconnector.py16
-rw-r--r--fedoracommunity/widgets/package/templates/patches.mak6
-rw-r--r--fedoracommunity/widgets/package/templates/tarballs.mak8
3 files changed, 24 insertions, 6 deletions
diff --git a/fedoracommunity/connectors/gitconnector.py b/fedoracommunity/connectors/gitconnector.py
index bd355ab..a94d842 100644
--- a/fedoracommunity/connectors/gitconnector.py
+++ b/fedoracommunity/connectors/gitconnector.py
@@ -66,6 +66,8 @@ class FedoraGitRepo(object):
def get_spec(self):
""" Return the contents of this package's RPM spec file """
+ if os.path.exists(os.path.join(self.repo_path, 'dead.package')):
+ return to_unicode(self.repo.tree()['dead.package'].data_stream.read())
return to_unicode(self.repo.tree()[self.package + '.spec'].data_stream.read())
def get_patches(self):
@@ -135,11 +137,15 @@ class FedoraGitRepo(object):
return DateTimeDisplay(date, format='%a %b %d %H:%M:%S %Y').datetime
def get_source_url(self):
- return self._run('spectool -S *.spec').split()[1]
+ source = self._run('spectool -S *.spec')
+ if source:
+ return source.split()[1]
def get_fedora_source(self):
url = config.get('fedora_lookaside', 'http://pkgs.fedoraproject.org/repo/pkgs')
- tarball = self.get_source_url().split('/')[-1]
- md5 = self._run('grep %s sources' % tarball).split()[0]
- url += '/%s/%s/%s/%s' % (self.package, tarball, md5, tarball)
- return url
+ source = self.get_source_url()
+ if source:
+ tarball = source.split('/')[-1]
+ md5 = self._run('grep %s sources' % tarball).split()[0]
+ url += '/%s/%s/%s/%s' % (self.package, tarball, md5, tarball)
+ return url
diff --git a/fedoracommunity/widgets/package/templates/patches.mak b/fedoracommunity/widgets/package/templates/patches.mak
index 8fa768e..2738d9b 100644
--- a/fedoracommunity/widgets/package/templates/patches.mak
+++ b/fedoracommunity/widgets/package/templates/patches.mak
@@ -10,6 +10,7 @@ function on_change(self) {
${w.children[0].display(on_change='on_change', package=w.package)}
<div id="patches" class="patches">
+% if w.patches:
<%namespace file="diffstat.mak" import="render_diffstat"/>
<a class="frame_link" href="#" onclick="return toggle_diffstat()">Show summary of all patches</a>
@@ -28,6 +29,10 @@ ${w.children[0].display(on_change='on_change', package=w.package)}
% endfor
</table>
+% else:
+ No patches found
+% endif # if w.patches
+
<script type="text/javascript">
function toggle_patch(patch) {
var tr = $('#' + patch.replace(/\./g, '\\.'));
@@ -58,4 +63,3 @@ function toggle_diffstat() {
}
</script>
</div>
-
diff --git a/fedoracommunity/widgets/package/templates/tarballs.mak b/fedoracommunity/widgets/package/templates/tarballs.mak
index 8dd577a..1ae243e 100644
--- a/fedoracommunity/widgets/package/templates/tarballs.mak
+++ b/fedoracommunity/widgets/package/templates/tarballs.mak
@@ -10,10 +10,18 @@ function on_change(self) {
${w.children[0].display(on_change='on_change', package=w.package)}
<div id="tarballs">
+% if w.upstream_tarball:
<h2>Upstream Tarball</h2>
<a href="${w.upstream_tarball}">${w.upstream_tarball}</a>
+% else:
+ No upstream tarball found
+% endif
<br/>
<br/>
+% if w.fedora_tarball:
<h2>Fedora Look-aside Tarball</h2>
<a href="${w.fedora_tarball}">${w.fedora_tarball}</a>
+% else:
+ No Fedora tarball found
+% endif
</div>