import log
from acl import acl
from config import config
+from subprocess import call
__all__ = ['parse_request', 'parse_requests']
def escape(s):
return xml.sax.saxutils.escape(s)
-# return timestamp with timezone information
-# so we could parse it in javascript
-def tzdate(t):
- # as strftime %z is unofficial, and does not work, need to make it numeric ourselves
-# date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(t))
- date = time.strftime("%a %b %d %Y %H:%M:%S", time.localtime(t))
- # NOTE: the altzone is showing CURRENT timezone, not what the "t" reflects
- # NOTE: when DST is off timezone gets it right, altzone not
- if time.daylight:
- tzoffset = time.altzone
- else:
- tzoffset = time.timezone
- tz = '%+05d' % (-tzoffset / 3600 * 100)
- return date + ' ' + tz
-
def is_blank(e):
return e.nodeType == Element.TEXT_NODE and string.strip(e.nodeValue) == ""
% {
'no': self.no,
'id': '<a href="srpms/%(id)s">%(id)s</a>' % {'id': self.id},
- 'time': escape(tzdate(self.time)),
+ 'time': escape(time.strftime("%a %b %d %Y %H:%M:%S %z", time.localtime(self.time))),
'requester': escape(self.requester),
'priority': self.priority,
'max_jobs': self.max_jobs,
if self.is_command():
desc = "SH: <pre>%s</pre> flags: [%s]" % (self.command, ' '.join(self.command_flags))
else:
- package_url = "http://git.pld-linux.org/gitweb.cgi?p=packages/%(package)s.git;f=%(spec)s;h=%(branch)s;a=shortlog" % {
+ cmd = "/usr/bin/git ls-remote --heads git://git.tld-linux.org/packages/%s" % (self.spec[:-5])
+ r = call(cmd, shell=True)
+ if r == 0:
+ dist = "tld"
+ else:
+ dist = "pld"
+ package_url = "http://git.%(dist)s-linux.org/?p=packages/%(package)s.git;a=blob;f=%(spec)s;hb=%(branch)s" % {
+ 'dist': dist,
'spec': self.spec,
'branch': self.branch,
'package': self.spec[:-5],
bld = lin_ar.split('-')
tree_name = '-'.join(bld[:-1])
tree_arch = '-'.join(bld[-1:])
- link_pre = "<a href=\"http://buildlogs.pld-linux.org/index.php?dist=%s&arch=%s&ok=%d&name=%s&id=%s&action=tail\">" \
- % (urllib.quote(tree_name), urllib.quote(tree_arch), is_ok, urllib.quote(bl_name), urllib.quote(rid))
+ link_pre = "<a href=\"http://buildlogs.tld-linux.org/index.php?dist=%s&arch=%s&name=%s&id=%s&action=download\">" \
+ % (urllib.quote(tree_name), urllib.quote(tree_arch), urllib.quote(bl_name), urllib.quote(rid))
link_post = "</a>"
def ftime(s):
return r
def default_target(self, arch):
- self.target.append("%s-pld-linux" % arch)
+ self.target.append("%s-tld-linux" % arch)
def write_to(self, f):
f.write("""