]> TLD Linux GIT Repositories - tld-builder.git/blobdiff - PLD_Builder/request.py
- TLDize
[tld-builder.git] / PLD_Builder / request.py
index 0731df8e8694b9297cc98a9ec6dde5d8e19586da..d4a35dd839dcd1c9d46874325fe7d39ade620fc7 100644 (file)
@@ -13,6 +13,7 @@ import util
 import log
 from acl import acl
 from config import config
+from subprocess import call
 
 __all__ = ['parse_request', 'parse_requests']
 
@@ -35,21 +36,6 @@ def attr(e, a, default = None):
 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) == ""
 
@@ -116,7 +102,7 @@ class Group:
         % {
             '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,
@@ -235,7 +221,14 @@ class Batch:
         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],
@@ -276,8 +269,8 @@ class Batch:
                 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):
@@ -334,7 +327,7 @@ class Batch:
         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("""