aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--master/autotua/models.py2
-rw-r--r--master/autotua/process/__init__.py16
-rw-r--r--master/autotua/process/const.py26
-rw-r--r--master/autotua/templates/jobs.html22
-rw-r--r--master/autotua/templates/userpage.html (renamed from master/autotua/templates/content.html)0
-rw-r--r--master/autotua/urls.py1
-rw-r--r--master/autotua/views.py16
7 files changed, 60 insertions, 23 deletions
diff --git a/master/autotua/models.py b/master/autotua/models.py
index 958bb3e..e45293a 100644
--- a/master/autotua/models.py
+++ b/master/autotua/models.py
@@ -28,5 +28,7 @@ class Job(models.Model):
jobtagerev = models.CharField(max_length=50)
# Space-separated list of atoms
atoms = models.TextField()
+ # Status of job
+ #status = models.BooleanField()
class Meta:
unique_together = [("name", "maintainer")]
diff --git a/master/autotua/process/__init__.py b/master/autotua/process/__init__.py
index 6eb934c..2997d7d 100644
--- a/master/autotua/process/__init__.py
+++ b/master/autotua/process/__init__.py
@@ -12,13 +12,15 @@ import const, validate
schemes = ['http', 'https', 'ftp']
-def generate_stage_url(**kwargs):
- scheme = kwargs['stage'].split('://', 1)[0]
+def generate_stage_url(job):
+ scheme, stage = job.stage.split('://', 1)
if scheme in schemes:
- return kwargs['stage']
- kwargs['gen_arch'] = _get_arch_dir(kwargs['arch'])
- kwargs['mirror'] = random.choice(const.MIRRORS[scheme])
- url = const.STAGE_URI % kwargs
+ return job.stage
+ else:
+ job.stage = stage
+ job.gen_arch = _get_arch_dir(job.arch)
+ job.mirror = random.choice(const.MIRRORS[scheme])
+ url = const.STAGE_URI % job.__dict__
return url
def _get_arch_dir(arch):
@@ -28,6 +30,6 @@ def _get_arch_dir(arch):
mips4 -> mips
"""
for i in const.ARCHS:
- if arch in const.ARCHSs[i]:
+ if arch in const.ARCHS[i]:
return i
raise ValidationError(const.VERRORS['invalid_arch'] % i)
diff --git a/master/autotua/process/const.py b/master/autotua/process/const.py
index d88e2a0..149e254 100644
--- a/master/autotua/process/const.py
+++ b/master/autotua/process/const.py
@@ -11,16 +11,16 @@
# Use a custom stage url if you want to use arm
#
# 'Mirror dir': (<archs that reside there>)
-ARCHS = { 'x86': ('i686', 'x86',),
- 'amd64': ('amd64',),
- 'ppc': ('970-32ul', '970-64ul', 'g4', 'power5', 'ppc', 'ppc64',),
- 'sparc': ('sparc64',)
- 'alpha': ('alpha',),
- 'ia64': ('ia64',),
- 'hppa': ('hppa1.1', 'hppa2.0',),
- 'mips': ('cobalt', 'mips3', 'mips4', 'n32',),
- 'sh': ('sh4',),
- 's390': ('s390', 's390x',) }
+ARCHS = { 'x86': ('i686', 'x86',),
+ 'amd64': ('amd64',),
+ 'ppc': ('970-32ul', '970-64ul', 'g4', 'power5', 'ppc', 'ppc64',),
+ 'sparc': ('sparc64',),
+ 'alpha': ('alpha',),
+ 'ia64': ('ia64',),
+ 'hppa': ('hppa1.1', 'hppa2.0',),
+ 'mips': ('cobalt', 'mips3', 'mips4', 'n32',),
+ 'sh': ('sh4',),
+ 's390': ('s390', 's390x',) }
# How do we get this list? Keep updating it regularly?
# Do we associate mirrors with the slave's geo location?
@@ -28,7 +28,7 @@ MIRRORS = { 'gentoo': ('http://gentoo.osuosl.org',) }
# Example:
# http://gentoo.osuosl.org/releases/hppa/2008.0/stages/stage3-hppa2.0-2008.0.tar.bz2
STAGES = ('stage1', 'stage2', 'stage3', 'stage4',)
-STAGE_URI = '%(mirror)/releases/%(gen_arch)s/%(release)s/stages/%(stage)s-%(arch)s-%(release)s.tar.bz2'
+STAGE_URI = '%(mirror)s/releases/%(gen_arch)s/%(release)s/stages/%(stage)s-%(arch)s-%(release)s.tar.bz2'
#stage_types = ('', 'hardened', 'hardened+nomultilib')
VERRORS = { 'invalid_stage': 'Invalid stage: %s',
@@ -36,5 +36,5 @@ VERRORS = { 'invalid_stage': 'Invalid stage: %s',
'invalid_type': 'Invalid type: %s',
'invalid_release': 'Invalid release: %s' }
-for arch in ARCHS.values()[:]:
- ARCHS['all'] = ARCHS['all'].__add__(arch)
+#for arch in ARCHS.values()[:]:
+# ARCHS['all'] = ARCHS['all'].__add__(arch)
diff --git a/master/autotua/templates/jobs.html b/master/autotua/templates/jobs.html
new file mode 100644
index 0000000..f334921
--- /dev/null
+++ b/master/autotua/templates/jobs.html
@@ -0,0 +1,22 @@
+{# vim: set sw=4 sts=4 et filetype=htmldjango : #}
+{# Copyright: 2008 Gentoo Foundation #}
+{# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com> #}
+{# License: GPL-2 #}
+{# #}
+{# Immortal lh! #}
+{# #}
+
+{% extends "basic.html" %}
+{% block content %}
+<ul>
+{% for job in jobs %}
+ <li>
+ {{ job.name }}
+ <ul>
+ <li><b>Stage:</b> {{ job.stage_url }}</li>
+ <li><b>Jobtage Revision:</b> {{ job.jobtagerev }}</li>
+ </ul>
+ </li>
+{% endfor %}
+</ul>
+{% endblock %}
diff --git a/master/autotua/templates/content.html b/master/autotua/templates/userpage.html
index 6f68c97..6f68c97 100644
--- a/master/autotua/templates/content.html
+++ b/master/autotua/templates/userpage.html
diff --git a/master/autotua/urls.py b/master/autotua/urls.py
index c5ffc08..e3df801 100644
--- a/master/autotua/urls.py
+++ b/master/autotua/urls.py
@@ -12,6 +12,7 @@ from views import *
urlpatterns = patterns('',
(r'^~([a-zA-Z0-9_]+)/$', user_page),
+ (r'^~([a-zA-Z0-9_]+)/jobs/$', jobs_page),
)
# Static media serving for development purposes
diff --git a/master/autotua/views.py b/master/autotua/views.py
index 5b86b16..b295a3d 100644
--- a/master/autotua/views.py
+++ b/master/autotua/views.py
@@ -7,13 +7,23 @@
#
from django.http import HttpResponse
-from django.shortcuts import get_object_or_404, render_to_response
-from master.models import User
+from django.shortcuts import *
+from master.models import User, Job
from django.conf import settings
+import process
def user_page(request, username):
user = get_object_or_404(User, username=username)
details = {'media_prefix': settings.MEDIA_PREFIX}
for i in ('first_name', 'last_name', 'email',):
details[i] = getattr(user, i)
- return render_to_response('content.html', details)
+ return render_to_response('userpage.html', details)
+
+def jobs_page(request, username):
+ user = get_object_or_404(User, username=username)
+ jobs = get_list_or_404(Job, maintainer=user)
+ for job in jobs:
+ job.stage_url = process.generate_stage_url(job)
+ details = { 'media_prefix': settings.MEDIA_PREFIX,
+ 'jobs': jobs }
+ return render_to_response('jobs.html', details)