]> TLD Linux GIT Repositories - tld-builder.git/commitdiff
- PLD merge, fully (re)TLDized
authorMarcin Krol <hawk@tld-linux.org>
Wed, 27 Jul 2016 22:47:38 +0000 (22:47 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Wed, 27 Jul 2016 22:47:38 +0000 (22:47 +0000)
63 files changed:
.gitignore [new file with mode: 0644]
Makefile
PLD_Builder/request_handler_server.py [deleted file]
TLD_Builder/__init__.py [moved from PLD_Builder/__init__.py with 100% similarity]
TLD_Builder/acl.py [moved from PLD_Builder/acl.py with 95% similarity]
TLD_Builder/bqueue.py [moved from PLD_Builder/bqueue.py with 89% similarity]
TLD_Builder/build.py [moved from PLD_Builder/build.py with 96% similarity]
TLD_Builder/buildlogs.py [moved from PLD_Builder/buildlogs.py with 100% similarity]
TLD_Builder/chroot.py [moved from PLD_Builder/chroot.py with 100% similarity]
TLD_Builder/cia-foot.xml [moved from PLD_Builder/cia-foot.xml with 100% similarity]
TLD_Builder/cia-head.xml [moved from PLD_Builder/cia-head.xml with 81% similarity]
TLD_Builder/config.py [moved from PLD_Builder/config.py with 83% similarity]
TLD_Builder/deps.py [moved from PLD_Builder/deps.py with 100% similarity]
TLD_Builder/file_sender.py [moved from PLD_Builder/file_sender.py with 99% similarity]
TLD_Builder/ftp.py [moved from PLD_Builder/ftp.py with 100% similarity]
TLD_Builder/get_br.py [moved from PLD_Builder/get_br.py with 100% similarity]
TLD_Builder/gpg.py [moved from PLD_Builder/gpg.py with 96% similarity]
TLD_Builder/install.py [moved from PLD_Builder/install.py with 90% similarity]
TLD_Builder/load_balancer.py [moved from PLD_Builder/load_balancer.py with 100% similarity]
TLD_Builder/lock.py [moved from PLD_Builder/lock.py with 100% similarity]
TLD_Builder/log.py [moved from PLD_Builder/log.py with 100% similarity]
TLD_Builder/loop.py [moved from PLD_Builder/loop.py with 99% similarity]
TLD_Builder/mailer.py [moved from PLD_Builder/mailer.py with 90% similarity]
TLD_Builder/maintainer.py [moved from PLD_Builder/maintainer.py with 99% similarity]
TLD_Builder/notify.py [moved from PLD_Builder/notify.py with 100% similarity]
TLD_Builder/notifyq.py [moved from PLD_Builder/notifyq.py with 100% similarity]
TLD_Builder/path.py [moved from PLD_Builder/path.py with 90% similarity]
TLD_Builder/pipeutil.py [moved from PLD_Builder/pipeutil.py with 100% similarity]
TLD_Builder/poldek.py [moved from PLD_Builder/poldek.py with 100% similarity]
TLD_Builder/report.py [moved from PLD_Builder/report.py with 74% similarity]
TLD_Builder/request.py [moved from PLD_Builder/request.py with 75% similarity]
TLD_Builder/request_fetcher.py [moved from PLD_Builder/request_fetcher.py with 94% similarity]
TLD_Builder/request_handler.py [moved from PLD_Builder/request_handler.py with 86% similarity]
TLD_Builder/request_handler_server [moved from PLD_Builder/request_handler_server with 60% similarity]
TLD_Builder/request_handler_server.py [new file with mode: 0644]
TLD_Builder/rpm_builder.py [moved from PLD_Builder/rpm_builder.py with 84% similarity]
TLD_Builder/srpm_builder.py [moved from PLD_Builder/srpm_builder.py with 90% similarity]
TLD_Builder/status.py [moved from PLD_Builder/status.py with 100% similarity]
TLD_Builder/stopwatch.py [moved from PLD_Builder/stopwatch.py with 100% similarity]
TLD_Builder/util.py [moved from PLD_Builder/util.py with 86% similarity]
TLD_Builder/wrap.py [moved from PLD_Builder/wrap.py with 97% similarity]
admin/fresh-queue.sh
admin/install-chroot.sh
bin/file-sender.sh
bin/load-balancer.sh
bin/maintainer.sh
bin/request-fetcher.sh
bin/request-handler.sh
bin/rpm-builder.sh
bin/src-builder.sh
client/make-request.sh
client/smtpwrapper.py
config/acl.conf
config/builder.conf
doc/README
doc/README.bin-builder
etc/crontab
etc/pld-builder.sysconfig [deleted file]
etc/poldek.conf
etc/procmailrc
etc/rpm.macros
etc/tld-builder.init [moved from etc/pld-builder.init with 70% similarity, mode: 0755]
xml/queue.xslt

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..25ac96d
--- /dev/null
@@ -0,0 +1,9 @@
+config/acl.conf
+config/builder.conf
+config/rsync-passwords
+config/*.tar
+*.pyc
+lock
+log
+spool
+www
index e82dc21c54c8686db4997cb197de6c1ebfb697eb..dc98a49a836a4aa8984ef778ff90dc607c87ee6b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,21 @@
-PACKAGE                := pld-builder
-VERSION                := 0.5
+PACKAGE                := tld-builder
+VERSION                := 0.6
 SNAP           := $(shell date +%Y%m%d)
 
-# for make dist
-CVSROOT                := :pserver:cvs@cvs.pld-linux.org:/cvsroot
-CVSMODULE      := pld-builder.new
-CVSTAG         := HEAD
+all: compile
 
-all:
+compile:
        python -c "import compileall; compileall.compile_dir('.')"
 
 clean:
        find -name '*.pyc' | xargs rm -f
+       rm -f *.tar.bz2
 
-dist:
-       rm -rf $(PACKAGE)-$(VERSION).$(SNAP)
-       mkdir -p $(PACKAGE)-$(VERSION).$(SNAP)
-       cvs -d $(CVSROOT) export -d $(PACKAGE)-$(VERSION).$(SNAP) -r $(CVSTAG) $(CVSMODULE)
-       tar -cjf $(PACKAGE)-$(VERSION).$(SNAP).tar.bz2 $(PACKAGE)-$(VERSION).$(SNAP)
-       rm -rf $(PACKAGE)-$(VERSION).$(SNAP)
-       test -x ./dropin && ./dropin $(PACKAGE)-$(VERSION).$(SNAP).tar.bz2
+dist: $(PACKAGE)-$(VERSION).$(SNAP).tar.bz2
+       test ! -x ./dropin || ./dropin $<
+
+%.tar.bz2: %.tar
+       bzip2 -9 $<
+
+%.tar:
+       git archive --prefix=$(patsubst %.tar,%,$@)/ HEAD -o $@
diff --git a/PLD_Builder/request_handler_server.py b/PLD_Builder/request_handler_server.py
deleted file mode 100644 (file)
index 5c591f0..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/usr/bin/python
-
-import socket
-import string
-import cgi
-import time
-import log
-import sys
-import traceback
-import os
-from config import config, init_conf
-
-from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
-
-import request_handler
-import path
-
-class MyHandler(BaseHTTPRequestHandler):
-
-       def do_GET(self):
-               self.send_error(401);
-
-       def do_POST(self):
-               global rootnode
-               try:
-                       length = int(self.headers.getheader('content-length'))
-                       ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
-                       if ctype != 'application/x-www-form-urlencoded':
-                               log.error("request_handler_server: [%s]: 401 Unauthorized" % self.client_address[0])
-                               self.send_error(401)
-                               self.end_headers()
-                               return
-
-                       query = self.rfile.read(length)
-
-                       filename = self.headers.getheader('x-filename')
-
-                       if not request_handler.handle_request_main(query, filename = filename):
-                               error = log.last_log();
-                               log.error("request_handler_server: [%s]: handle_request_main(..., %s) failed" % (self.client_address[0], filename))
-                               self.send_error(500, "%s: request failed. %s" % (filename, error))
-                               self.end_headers()
-                               return
-
-                       self.send_response(200)
-                       self.end_headers()
-
-               except Exception, e:
-                       self.send_error(500, "%s: %s" % (filename, e))
-                       self.end_headers()
-                       log.error("request_handler_server: [%s]: exception: %s\n%s" % (self.client_address[0], e, traceback.format_exc()))
-                       raise
-                       pass
-
-def write_css():
-       css_file = path.www_dir + "/style.css"
-       # skip if file exists and code is not newer
-       if os.path.exists(css_file) and os.stat(__file__).st_mtime < os.stat(css_file).st_mtime:
-               return
-
-       # css from www.pld-linux.org wiki theme, using css usage firebug plugin to cleanup
-       css = """
-html {
-       background-color: white;
-       color: #5e5e5e;
-       font-family: Tahoma, Arial, Lucida Grande, sans-serif;
-       font-size: 0.75em;
-       line-height: 1.25em;
-}
-
-a {
-       text-decoration: underline;
-       color: #006;
-}
-
-a:hover {
-       color: #006;
-}
-
-pre {
-       background: #FFF8EB;
-       border: 1pt solid #FFE2AB;
-       font-family: courier, monospace;
-       padding: 0.5em;
-       white-space: pre-wrap;
-       word-wrap: break-word;
-}
-
-@media screen, projection {
-       html {
-               background-color: #f3efe3;
-       }
-
-       body {
-               position: relative;
-       }
-
-       div {
-               background-color: white;
-               margin: 10px 0px;
-               padding: 2px;
-       }
-       div > a {
-               font-weight: bold;
-               color: #5e5e5e;
-       }
-       div > a:hover {
-               color: #5e5e5e;
-       }
-       div.upgrade {
-               background-color: #e4f1cf;
-       }
-       div:target {
-               background-color: #ffffcc;
-               color: black;
-       }
-}
-@media print {
-       a {
-               background-color: inherit;
-               color: inherit;
-       }
-}
-
-@media projection {
-       html { line-height: 1.8em; }
-       body, b, a, p { font-size: 22pt; }
-}
-"""
-       old_umask = os.umask(0022)
-       f = open(css_file, "w")
-       f.write(css)
-       f.close()
-       os.umask(old_umask)
-
-def write_js():
-       js_file = path.www_dir + "/script.js"
-       # skip if file exists and code is not newer
-       if os.path.exists(js_file) and os.stat(__file__).st_mtime < os.stat(js_file).st_mtime:
-               return
-
-       js = """
-// update date stamps to reflect viewers timezone
-function update_tz(t) {
-       var el, off, dt,
-               collection = document.getElementsByTagName('span');
-       for (off in collection) {
-               el = collection[off];
-               if (el.id == 'tz') {
-                       dt = new Date(el.innerHTML).toString();
-                       // strip timezone name, it is usually wrong when not initialized
-                       // from TZ env, but reverse calculated from os data
-                       dt = dt.replace(/\s+\(.+\)/, "");
-                       // strip "GMT"
-                       dt = dt.replace(/GMT/, "");
-                       el.innerHTML = dt;
-               }
-       }
-}
-window.onload = update_tz;
-"""
-       old_umask = os.umask(0022)
-       f = open(js_file, "w")
-       f.write(js)
-       f.close()
-       os.umask(old_umask)
-
-def main():
-       write_css();
-       write_js();
-       socket.setdefaulttimeout(30)
-       try:
-               init_conf()
-               host = ""
-               port = config.request_handler_server_port
-
-               try:
-                       server = HTTPServer((host, port), MyHandler)
-               except Exception, e:
-                       log.notice("request_handler_server: can't start server on [%s:%d]: %s" % (host, port, e))
-                       print >> sys.stderr, "ERROR: Can't start server on [%s:%d]: %s" % (host, port, e)
-                       sys.exit(1)
-
-               log.notice('request_handler_server: started on [%s:%d]...' % (host, port))
-               server.serve_forever()
-       except KeyboardInterrupt:
-               log.notice('request_handler_server: ^C received, shutting down server')
-               server.socket.close()
-
-if __name__ == '__main__':
-       main()
-
similarity index 95%
rename from PLD_Builder/acl.py
rename to TLD_Builder/acl.py
index a769d0694570dc3e85d6503f28deaef09055b086..5f0621974187df32d6db3bb5d81b0329fecc438b 100644 (file)
@@ -18,6 +18,7 @@ class User:
         self.privs = []
         self.gpg_emails = []
         self.mailto = ""
+        self.change_requester = False
 
         if p.has_option(login, "gpg_emails"):
             self.gpg_emails = string.split(p.get(login, "gpg_emails"))
@@ -30,6 +31,9 @@ class User:
             if len(self.gpg_emails) > 0:
                 self.mailto = self.gpg_emails[0]
 
+        if p.has_option(login, "change_requester"):
+            self.change_requester = True
+
         if p.has_option(login, "privs"):
             for p in string.split(p.get(login, "privs")):
                 l = string.split(p, ":")
@@ -124,6 +128,9 @@ class ACL_Conf:
                 return self.users[e]
         return None
 
+    def user_by_login(self, l):
+        return self.users[l]
+
     def user(self, l):
         if not self.users.has_key(l):
             log.panic("no such user: %s" % l)
similarity index 89%
rename from PLD_Builder/bqueue.py
rename to TLD_Builder/bqueue.py
index 2a4d759aeba3bf4c950ff2b73562a5662facd6dc..f95f0f394816a4a4a1749333544af9ff10b4c9c7 100644 (file)
@@ -9,7 +9,7 @@ import fcntl
 import string
 import tempfile
 
-# PLD_Builder:
+# TLD_Builder:
 import gpg
 import request
 import util
@@ -40,18 +40,25 @@ class B_Queue:
         f.write("""
 <html>
     <head>
-    <link rel="Shortcut Icon" href="http://www.tld-linux.org/favicon.ico"/>
+    <link rel="Shortcut Icon" href="//www.tld-linux.org/favicon.ico"/>
         <title>TLD builder queue</title>
         <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="style.css">
+        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+        <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.4.3/jquery.timeago.min.js"></script>
         <script type="text/javascript" src="script.js"></script>
     </head>
-<body>\n"""
+<body>
+<div id="header">
+    <div id="requesters-filter">Filter by requesters:<br></div>
+</div>
+<div id="content">
+"""
         )
         self.requests.reverse()
         for r in self.requests:
             r.dump_html(f)
         self.requests.reverse()
-        f.write("</body></html>\n")
+        f.write("</div></body></html>\n")
         f.flush()
         os.fsync(f.fileno())
         f.close()
similarity index 96%
rename from PLD_Builder/build.py
rename to TLD_Builder/build.py
index e996731bcc5159e30d91be8f1489259513d5da88..31689e74dad8bc7af77731b4f0cb0153ba9e5c5b 100644 (file)
@@ -46,7 +46,7 @@ def run_command(batch):
     else:
         user = "root"
         if "as-builder" in batch.command_flags:
-            user = "builder"
+            user = None
         return chroot.run(command, logfile = batch.logfile, user = user)
 
 def build_all(r, build_fnc):
@@ -82,7 +82,7 @@ def build_all(r, build_fnc):
                     log.notice("running %s OK" % batch.command)
                     notify.add_batch(batch, "OK")
                 batch.build_time = stopwatch.stop()
-                report.add_pld_builder_info(batch)
+                report.add_tld_builder_info(batch)
                 buildlogs.add(batch.logfile, failed = batch.build_failed, id=r.id)
             else:
                 log.notice("not running command, not for me.")
@@ -106,7 +106,7 @@ def build_all(r, build_fnc):
                 log.notice("building %s OK" % (batch.spec))
                 notify.add_batch(batch, "OK")
             batch.build_time = stopwatch.stop()
-            report.add_pld_builder_info(batch)
+            report.add_tld_builder_info(batch)
             buildlogs.add(batch.logfile, failed = batch.build_failed, id=r.id)
         else:
             batch.build_failed = 1
similarity index 100%
rename from PLD_Builder/chroot.py
rename to TLD_Builder/chroot.py
similarity index 81%
rename from PLD_Builder/cia-head.xml
rename to TLD_Builder/cia-head.xml
index fefeda5d74120cee5f5343a42c12f5d9700503c7..afad52afa7702bce879557c954210309bbfa5905 100644 (file)
@@ -2,7 +2,7 @@
     <generator>
         <name>TLD Linux Builder client for CIA</name>
        <version>0.001</version>
-       <url>http://git.tld-linux.org/?p=pld-builder.new.git;a=blob;f=PLD_Builder/report.py</url>
+       <url>http://git.tld-linux.org/?p=tld-builder.new.git;a=blob;f=TLD_Builder/report.py</url>
     </generator>
     <source>
         <project>tld</project>
similarity index 83%
rename from PLD_Builder/config.py
rename to TLD_Builder/config.py
index 2e78cd870c556829eac05e463d282a3d16d45e3c..5e3bd9e106786427e97623bebedba60646ce9384 100644 (file)
@@ -37,8 +37,10 @@ class Builder_Conf:
 
     def read(self, builder):
         p = ConfigParser.ConfigParser()
-        def get(o, d = None):
-            if p.has_option(builder, o):
+        def get(o, d = None, sec=None):
+            if p.has_option(sec, o):
+                return string.strip(p.get(sec, o))
+            elif p.has_option(builder, o):
                 return string.strip(p.get(builder, o))
             elif p.has_option("all", o):
                 return string.strip(p.get("all", o))
@@ -70,7 +72,12 @@ class Builder_Conf:
         self.max_keep_time = int(get("max_keep_time", 168))*60*60
         self.bot_email = get("bot_email", "")
         self.control_url = get("control_url")
-        self.request_handler_server_port = int(get("request_handler_server_port", 1234))
+        self.request_handler_server_port = int(get("port", d=1234, sec="request-server"))
+        self.request_handler_server_ssl = get("ssl", d="False", sec="request-server")
+        if self.request_handler_server_ssl:
+            self.request_handler_server_ssl_port = int(get("port", d=1235, sec="request-server"))
+            self.request_handler_server_ssl_key = get("ssl_key", d="", sec="request-server")
+            self.request_handler_server_ssl_cert = get("ssl_cert", d="", sec="request-server")
         self.builder_list = get("builder_list", "")
         self.gen_upinfo = get("gen_upinfo", "yes")
         if self.gen_upinfo == 'no':
@@ -90,6 +97,7 @@ class Builder_Conf:
         self.arch = get("arch")
         self.chroot = get("chroot")
         self.buildlogs_url = get("buildlogs_url", "/dev/null")
+        self.buildlogs = get("buildlogs", "http://buildlogs.tld-linux.org/")
         self.ftp_url = get("ftp_url")
         self.notify_url = get("notify_url")
         self.test_ftp_url = get("test_ftp_url", "/dev/null")
similarity index 100%
rename from PLD_Builder/deps.py
rename to TLD_Builder/deps.py
similarity index 99%
rename from PLD_Builder/file_sender.py
rename to TLD_Builder/file_sender.py
index 1df7ea1d38af973b3a56164ce1304000b4405546..0f652db518a511ece93a2c317df2e4fc8e3a2cf0 100644 (file)
@@ -119,7 +119,7 @@ def send_file(src, target):
         m = re.match('ssh\+rsync://([^@:]+@[^/:]+)(:|)(.*)', target)
         if m:
             return not rsync_ssh_file(src, m.group(1) + ":" + m.group(3))
-        m = re.match('http://.*', target)
+        m = re.match('(http|https)://.*', target)
         if m:
             return not post_file(src, target)
         log.alert("unsupported protocol: %s" % target)
similarity index 100%
rename from PLD_Builder/ftp.py
rename to TLD_Builder/ftp.py
similarity index 100%
rename from PLD_Builder/get_br.py
rename to TLD_Builder/get_br.py
similarity index 96%
rename from PLD_Builder/gpg.py
rename to TLD_Builder/gpg.py
index 5c5dbecfc08853b55023abc74224358d1febb11b..aeb8ebd4e524a3cf1da1fe35002a17544a792d02 100644 (file)
@@ -78,6 +78,7 @@ def sign(buf):
     d_stdout = None
     d_stderr = None
     cmd = ['/usr/bin/gpg', '--batch', '--no-tty', '--clearsign']
+    # TODO: check for gpg return code!
     gpg_run = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
     try:
         d_stdout, d_stderr = gpg_run.communicate(buf.encode('utf-8'))
@@ -85,4 +86,7 @@ def sign(buf):
         log.error("gnupg signing failed, does gpg binary exist? : %s" % e)
         raise
 
+    if len(d_stderr):
+        log.error("gpg: %s" % d_stderr)
+
     return d_stdout
similarity index 90%
rename from PLD_Builder/install.py
rename to TLD_Builder/install.py
index 91cc889bc83ab254108278e037edf4dd6ae92409..0131e19403aac55f52815d8b348a1f6fb7259dfc 100644 (file)
@@ -13,6 +13,7 @@ hold = [
     'poldek',
     'rpm-build',
     'pdksh',
+    'mksh',
     'coreutils'
 ]
 
@@ -100,12 +101,11 @@ def uninstall(conflicting, b):
 
 def uninstall_self_conflict(b):
     b.log_line("checking BuildConflict-ing packages")
-    packagename = b.spec[:-5]
-    tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s/tmp" % packagename
-    f = chroot.popen("set -e; TMPDIR=%(tmpdir)s rpmbuild -bp --nobuild --short-circuit --define 'prep exit 0' %(rpmdefs)s rpm/packages/%(package)s/%(spec)s 2>&1" % {
-        'tmpdir': tmpdir,
+    f = chroot.popen("set -e; TMPDIR=%(tmpdir)s " \
+        "rpmbuild -bp --nobuild --short-circuit --define 'prep exit 0' %(rpmdefs)s %(topdir)s/%(spec)s 2>&1" % {
+        'tmpdir': b.tmpdir(),
         'rpmdefs' : b.rpmbuild_opts(),
-        'package' : packagename,
+        'topdir' : b.get_topdir(),
         'spec': b.spec,
     })
     # java-sun >= 1.5 conflicts with soprano-2.1.67-1.src
@@ -128,13 +128,11 @@ def install_br(r, b):
         # ignore internal rpm dependencies, see lib/rpmns.c for list
         ignore_br = re.compile(r'^\s*(rpmlib|cpuinfo|getconf|uname|soname|user|group|mounted|diskspace|digest|gnupg|macro|envvar|running|sanitycheck|vcheck|signature|verify|exists|executable|readable|writable)\(.*')
 
-        packagename = b.spec[:-5]
-        tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s/tmp" % packagename
-        chroot.run("install -m 700 -d %s" % tmpdir)
-        cmd = "set -e; TMPDIR=%(tmpdir)s rpmbuild --nobuild %(rpmdefs)s rpm/packages/%(package)s/%(spec)s 2>&1" % {
+        tmpdir = b.tmpdir()
+        cmd = "set -e; TMPDIR=%(tmpdir)s rpmbuild --nobuild %(rpmdefs)s %(topdir)s/%(spec)s 2>&1" % {
             'tmpdir': tmpdir,
+            'topdir' : b.get_topdir(),
             'rpmdefs' : b.rpmbuild_opts(),
-            'package' : packagename,
             'spec': b.spec,
         }
         f = chroot.popen(cmd)
@@ -163,7 +161,7 @@ def install_br(r, b):
     chroot.run("poldek --up --upa", user = "root", logfile = b.logfile)
     # check conflicts in BRed packages
     b.log_line("checking conflicting packages in BRed packages")
-    f = chroot.popen("poldek --test --test --noask --caplookup -Q -v --upgrade %s" % br, user = "root")
+    f = chroot.popen("poldek --test --test --noask --caplookup -Q -v %s --upgrade %s" % (b.ignores(), br), user = "root")
     # phonon-devel-4.3.1-1.i686 conflicts with qt4-phonon-devel-4.5.0-6.i686
     # jdbc-stdext >= 2.0 is required by installed java-struts-1.3.10-1.noarch
     # jmx is needed by (installed) java-commons-modeler-2.0-1.noarch
@@ -193,7 +191,7 @@ def install_br(r, b):
     br = string.strip(nbr)
 
     b.log_line("installing BR: %s" % br)
-    res = chroot.run("poldek --noask --caplookup -Q -v --upgrade %s" % br,
+    res = chroot.run("set -x; poldek --noask --caplookup -Q -v %s --upgrade %s" % (b.ignores(), br),
             user = "root",
             logfile = b.logfile)
     if res != 0:
similarity index 100%
rename from PLD_Builder/lock.py
rename to TLD_Builder/lock.py
similarity index 100%
rename from PLD_Builder/log.py
rename to TLD_Builder/log.py
similarity index 99%
rename from PLD_Builder/loop.py
rename to TLD_Builder/loop.py
index bc5be9a1bcfe076beab8a9c5f99544280da16fe0..5ec5306c298c9d1c66e5c9f4b9b2be7cdfb70091 100644 (file)
@@ -28,4 +28,3 @@ def run_loop(fnc, secs = 5, max = 60):
         took = time.time() - last
         if took < secs:
             time.sleep(secs - took)
-
similarity index 90%
rename from PLD_Builder/mailer.py
rename to TLD_Builder/mailer.py
index e0b3ae601567a063e2025ac4f519d84ab72ee409..f1459faf5c50f4e3cf377deda135e9e08d9d8f85 100644 (file)
@@ -32,6 +32,10 @@ class Message:
         if subject != None:
             self.set_header("Subject", subject)
 
+    def remove_header(self, n):
+        if n in self.headers:
+            del self.headers[n]
+
     def write_line(self, l):
         self.body.write(recode("%s\n" % l))
 
@@ -59,11 +63,11 @@ class Message:
 
     def set_std_headers(self):
         self.headers["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
-        self.headers["Message-ID"] = "<pld-builder.%f.%d@%s>" \
+        self.headers["Message-ID"] = "<tld-builder.%f.%d@%s>" \
                 % (time.time(), os.getpid(), os.uname()[1])
-        self.headers["From"] = "PLD %s builder <%s>" \
+        self.headers["From"] = "TLD %s builder <%s>" \
                 % (config.builder, config.email)
-        self.headers["X-PLD-Builder"] = config.builder
+        self.headers["X-TLD-Builder"] = config.builder
 
     def write_to(self, f):
         for k, v in self.headers.items():
similarity index 99%
rename from PLD_Builder/maintainer.py
rename to TLD_Builder/maintainer.py
index 0ef66083efa64f8a96c2ab1c64e2e97778732080..5ba3deb8669b3055aecc151706f70edcd78cbfe6 100644 (file)
@@ -77,4 +77,3 @@ if __name__ == '__main__':
             continue
         else:
             handle_bin()
-
similarity index 100%
rename from PLD_Builder/notify.py
rename to TLD_Builder/notify.py
similarity index 90%
rename from PLD_Builder/path.py
rename to TLD_Builder/path.py
index 1558ab9f30a064aa8561e13a944857a13f6f4742..24776d7b5c5ef1c483c570b045653c5b178a4f0d 100644 (file)
@@ -4,7 +4,7 @@ import os
 
 root_dir = os.getenv('BUILDERPATH')
 if root_dir is None:
-    root_dir = os.path.expanduser('~/pld-builder.new')
+    root_dir = os.path.expanduser('~/tld-builder.new')
 conf_dir = root_dir + "/config"
 spool_dir = root_dir + "/spool"
 lock_dir = root_dir + "/lock"
@@ -13,6 +13,7 @@ www_dir = root_dir + "/www"
 acl_conf = conf_dir + "/acl.conf"
 builder_conf = conf_dir + "/builder.conf"
 rsync_password_file = conf_dir + "/rsync-passwords"
+blacklist_file = conf_dir + "/package-blacklist"
 
 # spool/
 queue_file = spool_dir + "/queue"
similarity index 100%
rename from PLD_Builder/poldek.py
rename to TLD_Builder/poldek.py
similarity index 74%
rename from PLD_Builder/report.py
rename to TLD_Builder/report.py
index a0fe7be98a2cca1872ae70532d6230fda606e060..c6e629427af3900fc764bdbc5556561b64201b75 100644 (file)
@@ -18,26 +18,26 @@ def unpackaged_files(b):
             copy_mode = 1
             out.append(l)
         elif copy_mode:
-            if l[0] != ' ':
+            if l[0] != ' ' and l[0] != '\t':
                 copy_mode = 0
             else:
                 out.append(l)
     return out
 
-def add_pld_builder_info(b):
+def add_tld_builder_info(b):
     l = open(b.logfile, "a")
-    l.write("Begin-PLD-Builder-Info\n")
+    l.write("Begin-TLD-Builder-Info\n")
     l.write("Build-Time: %s\n\n" % b.build_time)
     st = ftp.status()
     if st != "":
         l.write("Files queued for ftp:\n%s\n" % st)
     ftp.clear_status()
     l.writelines(unpackaged_files(b))
-    l.write("End-PLD-Builder-Info\n")
+    l.write("End-TLD-Builder-Info\n")
 
 def info_from_log(b, target):
-    beg = "Begin-PLD-Builder-Info\n"
-    end = "End-PLD-Builder-Info\n"
+    beg = "Begin-TLD-Builder-Info\n"
+    end = "End-TLD-Builder-Info\n"
     f = open(b.logfile)
     copy_mode = 0
     need_header = 1
@@ -72,15 +72,8 @@ def send_report(r, is_src = False):
     subject += ' '.join((s_failed, s_ok)).strip()
 
     m = mailer.Message()
-    m.set_headers(to = r.requester_email,
-                  cc = config.builder_list,
-                  subject = subject[0:100])
-    if is_src:
-        m.set_header("Message-ID", "<%s@pld.src.builder>" % r.id)
-    else:
-        m.set_header("References", "<%s@pld.src.builder>" % r.id)
-        m.set_header("In-Reply-To", "<%s@pld.src.builder>" % r.id)
 
+    m.write("Request by: %s\n\n" % r.requester_email)
     for b in r.batches:
         if b.build_failed and b.logfile == None:
             info = b.skip_reason
@@ -100,6 +93,25 @@ def send_report(r, is_src = False):
             m.append_log(b.logfile)
             m.write("\n\n")
 
+    m.set_headers(to = r.requester_email,
+                  subject = subject[0:100])
+    if is_src:
+        m.set_header("Message-ID", "<req-%s@tld.src.builder>" % r.id)
+    else:
+        m.set_header("References", "<req-%s@tld.src.builder>" % r.id)
+        m.set_header("In-Reply-To", "<req-%s@tld.src.builder>" % r.id)
+    m.send()
+
+    m.remove_header("To")
+    m.remove_header("Cc")
+    m.set_header("To", config.builder_list)
+    # reset Message-ID
+    m.set_std_headers()
+    if is_src:
+        m.set_header("Message-ID", "<%s@tld.src.builder>" % r.id)
+    else:
+        m.set_header("References", "<%s@tld.src.builder>" % r.id)
+        m.set_header("In-Reply-To", "<%s@tld.src.builder>" % r.id)
     m.send()
 
 def send_cia_report(r, is_src = False):
@@ -112,12 +124,12 @@ def send_cia_report(r, is_src = False):
 
     m.set_headers(to = config.bot_email,
                   subject = subject)
-    m.set_header("Message-ID", "<%s@pld.src.builder>" % r.id)
+    m.set_header("Message-ID", "<%s@tld.src.builder>" % r.id)
     m.set_header("X-mailer", "$Id$")
-    m.set_header("X-builder", "PLD")
+    m.set_header("X-builder", "TLD")
 
     # get header of xml message from file
-    f = open(path.root_dir + '/PLD_Builder/cia-head.xml')
+    f = open(path.root_dir + '/TLD_Builder/cia-head.xml')
     m.write(f.read())
     f.close()
 
@@ -131,7 +143,7 @@ def send_cia_report(r, is_src = False):
         m.write('</package>\n')
 
     # get footer of xml message from file
-    f = open(path.root_dir + '/PLD_Builder/cia-foot.xml')
+    f = open(path.root_dir + '/TLD_Builder/cia-foot.xml')
     m.write(f.read())
     f.close()
 
similarity index 75%
rename from PLD_Builder/request.py
rename to TLD_Builder/request.py
index 93963944788084c154805f6e26dce76060cfe880..27bc426364538a683cf287a487d8e84dcd4bffc8 100644 (file)
@@ -1,6 +1,7 @@
 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
 
 from xml.dom.minidom import *
+from datetime import datetime
 import string
 import time
 import xml.sax.saxutils
@@ -8,6 +9,8 @@ import fnmatch
 import os
 import urllib
 import cgi
+import pytz
+import tempfile
 
 import util
 import log
@@ -36,6 +39,12 @@ def attr(e, a, default = None):
 def escape(s):
     return xml.sax.saxutils.escape(s)
 
+# return date in iso8601 format
+def iso8601(ts, timezone='UTC'):
+    tz = pytz.timezone(timezone)
+    dt = datetime.fromtimestamp(ts, tz)
+    return dt.isoformat()
+
 def is_blank(e):
     return e.nodeType == Element.TEXT_NODE and string.strip(e.nodeValue) == ""
 
@@ -96,22 +105,25 @@ class Group:
 
     def dump_html(self, f):
         f.write(
-            "<div id=\"%(no)d\" class=\"%(flags)s\">\n"
-            "<a href=\"#%(no)d\">%(no)d</a>. <span id=\"tz\">%(time)s</span> from <b>%(requester)s</b> "
+            "<div id=\"%(no)d\" class=\"request %(flags)s\">\n"
+            "<a href=\"#%(no)d\">%(no)d</a>. "
+            "<time class=\"timeago\" datetime=\"%(datetime)s\">%(time)s</time> "
+            "from <b class=requester>%(requester)s</b> "
             "<small>%(id)s, prio=%(priority)d, jobs=%(max_jobs)d, %(flags)s</small>\n"
         % {
             'no': self.no,
             'id': '<a href="srpms/%(id)s">%(id)s</a>' % {'id': self.id},
             'time': escape(time.strftime("%a %b %d %Y %H:%M:%S %z", time.localtime(self.time))),
+            'datetime': escape(iso8601(self.time)),
             'requester': escape(self.requester),
             'priority': self.priority,
             'max_jobs': self.max_jobs,
             'flags': string.join(self.flags)
         })
-        f.write("<ul>\n")
+        f.write("<ol>\n")
         for b in self.batches:
             b.dump_html(f, self.id)
-        f.write("</ul>\n")
+        f.write("</ol>\n")
         f.write("</div>\n")
 
     def write_to(self, f):
@@ -143,6 +155,7 @@ class Batch:
         self.builders_status_time = {}
         self.builders_status_buildtime = {}
         self.kernel = ""
+        self.defines = {}
         self.target = []
         self.branch = ""
         self.src_rpm = ""
@@ -155,6 +168,17 @@ class Batch:
         self.b_id = attr(e, "id")
         self.depends_on = string.split(attr(e, "depends-on"))
         self.upgraded = True
+
+        self.parse_xml(e)
+
+        self.__topdir = None
+
+    def get_topdir(self):
+        if not self.__topdir:
+            self.__topdir = tempfile.mkdtemp(prefix='B.', dir='/tmp')
+        return self.__topdir
+
+    def parse_xml(self, e):
         for c in e.childNodes:
             if is_blank(c): continue
 
@@ -174,6 +198,9 @@ class Batch:
                 self.info = text(c)
             elif c.nodeName == "kernel":
                 self.kernel = text(c)
+            elif c.nodeName == "define":
+                define = attr(c, "name")
+                self.defines[define] = text(c)
             elif c.nodeName == "target":
                 self.target.append(text(c))
             elif c.nodeName == "skip":
@@ -193,6 +220,21 @@ class Batch:
             else:
                 log.panic("xml: evil batch child (%s)" % c.nodeName)
 
+    def get_package_name(self):
+        if len(self.spec) <= 5:
+            return None
+        return self.spec[:-5]
+
+    def tmpdir(self):
+        """
+        return tmpdir for this batch job building
+        """
+        # it's better to have TMPDIR and BUILD dir on same partition:
+        # + /usr/bin/bzip2 -dc /home/services/builder/rpm/packages/kernel/patch-2.6.27.61.bz2
+        # patch: **** Can't rename file /tmp/B.a1b1d3/poKWwRlp to drivers/scsi/hosts.c : No such file or directory
+        path = os.path.join(self.get_topdir(), 'BUILD', 'tmp')
+        return path
+
     def is_done(self):
         ok = 1
         for b in self.builders:
@@ -205,6 +247,7 @@ class Batch:
         f.write("  batch: %s/%s\n" % (self.src_rpm, self.spec))
         f.write("    info: %s\n" % self.info)
         f.write("    kernel: %s\n" % self.kernel)
+        f.write("    defines: %s\n" % self.defines_string())
         f.write("    target: %s\n" % self.target_string())
         f.write("    branch: %s\n" % self.branch)
         f.write("    bconds: %s\n" % self.bconds_string())
@@ -221,23 +264,23 @@ class Batch:
         if self.is_command():
             desc = "SH: <pre>%s</pre> flags: [%s]" % (self.command, ' '.join(self.command_flags))
         else:
-            cmd = "/usr/bin/git ls-remote --heads git://git.tld-linux.org/packages/%s 1>/dev/null 2>&1" % (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],
+           cmd = "/usr/bin/git ls-remote --heads git://git.tld-linux.org/packages/%s 1>/dev/null 2>&1" % (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': urllib.quote(self.spec),
+                'branch': urllib.quote(self.branch),
+                'package': urllib.quote(self.spec[:-5]),
             }
-            desc = "%(src_rpm)s (<a href=\"%(package_url)s\">%(spec)s -r %(branch)s</a>%(bconds)s)" % {
+            desc = "%(src_rpm)s (<a href=\"%(package_url)s\">%(spec)s -r %(branch)s</a>%(rpmopts)s)" % {
                 'src_rpm': self.src_rpm,
                 'spec': self.spec,
                 'branch': self.branch,
-                'bconds': self.bconds_string() + self.kernel_string() + self.target_string(),
+                'rpmopts': self.bconds_string() + self.kernel_string() + self.target_string() + self.defines_string(),
                 'package_url': package_url,
             }
         f.write("%s <small>[" % desc)
@@ -269,8 +312,8 @@ class Batch:
                 bld = lin_ar.split('-')
                 tree_name = '-'.join(bld[:-1])
                 tree_arch = '-'.join(bld[-1:])
-                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_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):
@@ -298,13 +341,62 @@ class Batch:
         """
             return all rpmbuild options related to this build
         """
-        bconds = self.bconds_string() + self.kernel_string() + self.target_string()
+        rpmopts = self.bconds_string() + self.kernel_string() + self.target_string() + self.defines_string()
         rpmdefs = \
-            "--define '_topdir %(echo $HOME/rpm)' " \
-            "--define '_specdir %{_topdir}/packages/%{name}' "  \
+            "--define '_topdir %s' " % self.get_topdir() + \
+            "--define '_specdir %{_topdir}' "  \
             "--define '_sourcedir %{_specdir}' " \
-            "--define '_builddir %{_topdir}/BUILD/%{name}' "
-        return rpmdefs + bconds
+            "--define '_rpmdir %{_topdir}/RPMS' " \
+            "--define '_builddir %{_topdir}/BUILD' "
+        return rpmdefs + rpmopts
+
+    def php_ignores(self):
+        # transform php package name (52) to version (5.2)
+        def php_name_to_ver(v):
+            return '.'.join(list(v))
+
+        # transform php version (5.2) to package name (52)
+        def php_ver_to_name(v):
+            return v.replace('.', '')
+
+        # available php versions in distro
+        php_versions = ['4', '5.2', '5.3', '5.4', '5.5', '5.6', '7.0']
+
+        # current version if -D php_suffix is present
+        php_version = php_name_to_ver(self.defines['php_suffix'])
+
+        # remove current php version
+        try:
+            php_versions.remove(php_version)
+        except ValueError:
+            log.notice("Attempt to remove inexistent key '%s' from %s" % (php_version, php_versions))
+            pass
+
+        # map them to poldek ignores
+        # always ignore hhvm
+        res = ['hhvm-*']
+        for v in map(php_ver_to_name, php_versions):
+            res.append("php%s-*" % v)
+
+        return res
+
+    # build ignore package list
+    # currently only php ignore is filled based on build context
+    def ignores(self):
+        ignores = []
+
+        # add php version based ignores
+        if self.defines.has_key('php_suffix'):
+            ignores.extend(self.php_ignores())
+
+        # return empty string if the list is empty
+        if len(ignores) == 0:
+            return ""
+
+        def add_ignore(s):
+            return "--ignore=%s" % s
+
+        return " ".join(map(add_ignore, ignores))
 
     def kernel_string(self):
         r = ""
@@ -326,6 +418,18 @@ class Batch:
             r = r + " --without " + b
         return r
 
+    def defines_string(self):
+        r = ""
+        for key,value in self.defines.items():
+            r += " --define '%s %s'" % (key, value)
+        return r
+
+    def defines_xml(self):
+        r = ""
+        for key,value in self.defines.items():
+            r += "<define name='%s'>%s</define>\n" % (escape(key), escape(value))
+        return r
+
     def default_target(self, arch):
         self.target.append("%s-tld-linux" % arch)
 
@@ -349,6 +453,8 @@ class Batch:
             f.write("           <target>%s</target>\n" % escape(b))
         for b in self.bconds_without:
             f.write("           <without>%s</without>\n" % escape(b))
+        if self.defines:
+            f.write("           %s\n" % self.defines_xml())
         for b in self.builders:
             if self.builders_status_buildtime.has_key(b):
                 t = self.builders_status_buildtime[b]
similarity index 94%
rename from PLD_Builder/request_fetcher.py
rename to TLD_Builder/request_fetcher.py
index a677a71302fca94a2be12d85fa20a1464bff5534..9877cde771572ba4e7a23ca73fa2e2251a639ee2 100644 (file)
@@ -18,6 +18,7 @@ import gpg
 import request
 import loop
 import socket
+import struct
 from acl import acl
 from bqueue import B_Queue
 from config import config, init_conf
@@ -74,7 +75,12 @@ def fetch_queue(control_url):
     f.close()
     sio.seek(0)
     f = gzip.GzipFile(fileobj = sio)
-    (signers, body) = gpg.verify_sig(f.read())
+    try:
+        fdata = f.read()
+    except struct.error, e:
+        log.alert("corrupted fetched queue.gz file")
+        sys.exit(1)
+    (signers, body) = gpg.verify_sig(fdata)
     u = acl.user_by_email(signers)
     if u == None:
         log.alert("queue.gz not signed with signature of valid user: %s" % signers)
similarity index 86%
rename from PLD_Builder/request_handler.py
rename to TLD_Builder/request_handler.py
index 2c38e83069b7863046a11ba95908617ba93f1994..033cf39d8760b4c605db7a478a04be9beaedbd4e 100644 (file)
@@ -16,9 +16,11 @@ import util
 import wrap
 import status
 from acl import acl
+from blacklist import blacklist
 from lock import lock
 from bqueue import B_Queue
 from config import config, init_conf
+from mailer import Message
 
 def check_double_id(id):
     id_nl = id + "\n"
@@ -45,7 +47,8 @@ def handle_group(r, user):
         else:
             spec = "None.spec"
         log.error("%s: %s" % (spec, msg))
-        m = user.message_to()
+        m = Message()
+        m.set_headers(to = r.requester_email, cc = config.builder_list)
         m.set_headers(subject = "building %s failed" % spec)
         m.write_line(msg)
         m.send()
@@ -55,6 +58,15 @@ def handle_group(r, user):
         lockf.close()
         return
 
+    try:
+        if (user.change_requester and r.requester):
+            user = acl.user_by_login(r.requester)
+    except KeyError:
+        r.requester += '/' + user.get_login()
+    else:
+        r.requester = user.get_login()
+        r.requester_email = user.mail_to()
+
     for batch in r.batches:
 
         if not user.can_do("src", config.builder, batch.branch):
@@ -112,10 +124,21 @@ def handle_group(r, user):
                                 % (user.get_login(), pkg, bld, batch.branch))
                     lockf.close()
                     return
+            if not "test-build" in r.flags and not user.can_do("ready", bld, batch.branch):
+                fail_mail("user %s is not allowed to send ready builds (ready:%s:%s)" \
+                     % (user.get_login(), bld, batch.branch))
+                lockf.close()
+                return
+
+            pkg = batch.spec
+            if pkg.endswith(".spec"):
+                pkg = pkg[:-5]
+            if not "test-build" in r.flags and blacklist.package(pkg):
+                fail_mail("package '%s' is blacklisted, only test-builds allowed" % pkg)
+                lockf.close()
+                return
 
     r.priority = user.check_priority(r.priority,config.builder)
-    r.requester = user.get_login()
-    r.requester_email = user.mail_to()
     r.time = time.time()
     log.notice("queued %s from %s" % (r.id, user.get_login()))
     q = B_Queue(path.queue_file)
@@ -190,6 +213,7 @@ def handle_request(req, filename = None):
 
 def handle_request_main(req, filename = None):
     acl.try_reload()
+    blacklist.try_reload()
     init_conf("src")
     status.push("handling email request")
     ret = handle_request(req, filename = filename)
similarity index 60%
rename from PLD_Builder/request_handler_server
rename to TLD_Builder/request_handler_server
index 4abb47dcbaab47bd9e6ecc775a49feaf2f155123..0c1f2658a5dbbee0e3276fe8ca8a644224e18382 100755 (executable)
@@ -24,16 +24,17 @@ if [ $daemon = 0 -a $attach = 0 ]; then
 fi
 
 if [ "$daemon" = 1 ]; then
-       echo "Starting request_handler_server"
+       echo "Starting request_handler_server(s)"
        rm -f $sock
        cd $(dirname $sock)
-       exec dtach -n $(basename $sock) -r none python request_handler_server.py
+       tmux -S $sock new-session -d -s "request_handler_server" -n "http" "python request_handler_server.py" && \
+               exec tmux -S $sock new-window -d -t "request_handler_server" -n "https" "python request_handler_server.py ssl"
        exit 1
 fi
 
 # attach to session
 if [ "$attach" = 1 ]; then
-       echo "Attaching to request_handler_server"
-       exec dtach -a $sock
+       echo "Attaching to request_handler_server(s)"
+       exec tmux -S $sock attach
        exit 1
 fi
diff --git a/TLD_Builder/request_handler_server.py b/TLD_Builder/request_handler_server.py
new file mode 100644 (file)
index 0000000..ece2f96
--- /dev/null
@@ -0,0 +1,119 @@
+#!/usr/bin/python
+
+import socket
+import string
+import cgi
+import time
+import log
+import ssl
+import sys
+import traceback
+import os
+from config import config, init_conf
+
+from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+
+import request_handler
+import path
+
+class MyHandler(BaseHTTPRequestHandler):
+
+    def do_GET(self):
+        self.send_error(401);
+
+    def do_POST(self):
+        global rootnode
+        try:
+            length = int(self.headers.getheader('content-length'))
+            filename = self.headers.getheader('x-filename')
+            if not length:
+                log.error("request_handler_server: [%s]: 401 Unauthorized" % self.client_address[0])
+                self.send_error(401)
+                self.end_headers()
+                return
+
+            query = self.rfile.read(length)
+
+            if not request_handler.handle_request_main(query, filename = filename):
+                error = log.last_log();
+                log.error("request_handler_server: [%s]: handle_request_main(..., %s) failed" % (self.client_address[0], filename))
+                self.send_error(500, "%s: request failed. %s" % (filename, error))
+                self.end_headers()
+                return
+
+            self.send_response(200)
+            self.end_headers()
+
+        except Exception, e:
+            self.send_error(500, "%s: %s" % (filename, e))
+            self.end_headers()
+            log.error("request_handler_server: [%s]: exception: %s\n%s" % (self.client_address[0], e, traceback.format_exc()))
+            raise
+            pass
+
+def write_css():
+    css_src = os.path.join(os.path.dirname(__file__), 'style.css')
+    css_file = path.www_dir + "/style.css"
+    # skip if file exists and code is not newer
+    if os.path.exists(css_file) and os.stat(css_src).st_mtime < os.stat(css_file).st_mtime:
+        return
+
+    old_umask = os.umask(0022)
+    r = open(css_src, 'r')
+    f = open(css_file, "w")
+    f.write(r.read())
+    f.close()
+    r.close()
+    os.umask(old_umask)
+
+def write_js():
+    js_src = os.path.join(os.path.dirname(__file__), 'script.js')
+    js_file = path.www_dir + '/script.js'
+    # skip if file exists and code is not newer
+    if os.path.exists(js_file) and os.stat(js_src).st_mtime < os.stat(js_file).st_mtime:
+        return
+
+    old_umask = os.umask(0022)
+    r = open(js_src, 'r')
+    f = open(js_file, 'w')
+    f.write(r.read())
+    f.close()
+    r.close()
+    os.umask(old_umask)
+
+def main(srv_ssl=False):
+    write_css();
+    write_js();
+    socket.setdefaulttimeout(30)
+    try:
+        init_conf()
+        host = ""
+        port = config.request_handler_server_port
+        if srv_ssl:
+            port = config.request_handler_server_ssl_port
+
+        try:
+            server = HTTPServer((host, port), MyHandler)
+            if srv_ssl:
+                server.socket = ssl.wrap_socket (server.socket,
+                                keyfile = config.request_handler_server_ssl_key,
+                                certfile = config.request_handler_server_ssl_cert,
+                                ca_certs = "/etc/certs/ca-certificates.crt",
+                                server_side=True)
+        except Exception, e:
+            log.notice("request_handler_server: can't start server on [%s:%d], ssl=%s: %s" % (host, port, str(srv_ssl), e))
+            print >> sys.stderr, "ERROR: Can't start server on [%s:%d], ssl=%s: %s" % (host, port, str(srv_ssl), e)
+            sys.exit(1)
+
+        log.notice('request_handler_server: started on [%s:%d], ssl=%s...' % (host, port, str(srv_ssl)))
+        server.serve_forever()
+    except KeyboardInterrupt:
+        log.notice('request_handler_server: ^C received, shutting down server')
+        server.socket.close()
+
+if __name__ == '__main__':
+    srv_ssl = False
+    if len(sys.argv) == 2 and sys.argv[1] == "ssl":
+        srv_ssl = True
+
+    main(srv_ssl)
similarity index 84%
rename from PLD_Builder/rpm_builder.py
rename to TLD_Builder/rpm_builder.py
index e42c085fee48f830bf81c25cee82d547a39753ba..12cc265ca49fd24c70796cbaf10db6fa7a1bf948 100644 (file)
@@ -106,17 +106,22 @@ def fetch_src(r, b):
                 b.log_line(msg)
                 return False
         except urllib2.URLError, error:
-            # see errno.h
-            try:
-                errno = error.errno
-            except AttributeError:
-                # python 2.4
-                errno = error.reason[0]
+            errno = 0
+            if isinstance(error.args[0], IOError):
+                errno = error.args[0].errno
 
             if errno in [-3, 60, 61, 110, 111]:
                 b.log_line("unable to connect to %s... trying again" % (src_url))
                 continue
             else:
+                try:
+                    print "error.errno: %s" % str(error.errno)
+                except Exception, e:
+                    print "error.errno: exception %s" % e
+                try:
+                    print "error.reason %s" % str(error.reason)
+                except Exception, e:
+                    print "error.reason exception %s" % e
                 raise
 
     o = chroot.popen("cat > %s" % b.src_rpm, mode = "w")
@@ -135,7 +140,7 @@ def fetch_src(r, b):
     else:
         b.log_line("fetched %d bytes, %.1f K/s" % (bytes, bytes / 1024.0 / t))
 
-def prepare_env():
+def prepare_env(logfile = None):
     chroot.run("""
         test ! -f /proc/uptime && mount /proc 2>/dev/null
         test ! -c /dev/full && rm -f /dev/full && mknod -m 666 /dev/full c 1 7
@@ -145,7 +150,7 @@ def prepare_env():
         test ! -c /dev/zero && rm -f /dev/zero && mknod -m 666 /dev/zero c 1 5
 
         # need entry for "/" in mtab, for diskspace() to work in rpm
-        [ -z $(awk '$2 == "/" {print $1}' /etc/mtab) ] && mount -f -t rootfs rootfs /
+        [ -z $(awk '$2 == "/" {print $1; exit}' /etc/mtab) ] && mount -f -t rootfs rootfs /
 
         # make neccessary files readable for builder user
         # TODO: see if they really aren't readable for builder
@@ -156,16 +161,16 @@ def prepare_env():
 
         # try to limit network access for builder account
         /bin/setfacl -m u:builder:--- /etc/resolv.conf
-    """, 'root')
+    """, 'root', logfile = logfile)
 
 def build_rpm(r, b):
-    if len(b.spec) <= 5:
+    packagename = b.get_package_name()
+    if not packagename:
         # should not really get here
         b.log_line("error: No .spec not given of malformed: '%s'" % b.spec)
         res = "FAIL_INTERNAL"
         return res
 
-    packagename = b.spec[:-5]
     status.push("building %s (%s)" % (b.spec, packagename))
     b.log_line("request from: %s" % r.requester)
 
@@ -178,38 +183,33 @@ def build_rpm(r, b):
     fetch_src(r, b)
     b.log_line("installing srpm: %s" % b.src_rpm)
     res = chroot.run("""
-        # b.id %(bid)s
         set -ex;
-        install -d rpm/packages/%(package)s rpm/BUILD/%(package)s;
-        rpm -Uhv %(rpmdefs)s %(src_rpm)s;
+        install -d %(topdir)s/{BUILD,RPMS};
+        LC_ALL=en_US.UTF-8 rpm -qp --changelog %(src_rpm)s;
+        rpm -Uhv --nodeps %(rpmdefs)s %(src_rpm)s;
         rm -f %(src_rpm)s;
     """ % {
-        'bid' : b.b_id,
-        'package' : packagename,
+        'topdir' : b.get_topdir(),
         'rpmdefs' : b.rpmbuild_opts(),
         'src_rpm' : b.src_rpm
     }, logfile = b.logfile)
     b.files = []
 
-    # it's better to have TMPDIR and BUILD dir on same partition:
-    # + /usr/bin/bzip2 -dc /home/services/builder/rpm/packages/kernel/patch-2.6.27.61.bz2
-    # patch: **** Can't rename file /tmp/B.a1b1d3/poKWwRlp to drivers/scsi/hosts.c : No such file or directory
-    tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s/tmp" % packagename
+    tmpdir = b.tmpdir()
     if res:
         b.log_line("error: installing src rpm failed")
         res = "FAIL_SRPM_INSTALL"
     else:
         prepare_env()
-        chroot.run("install -m 700 -d %s" % tmpdir)
-
+        chroot.run("set -x; install -m 700 -d %s" % tmpdir, logfile=b.logfile)
         b.default_target(config.arch)
         # check for build arch before filling BR
         cmd = "set -ex; TMPDIR=%(tmpdir)s exec nice -n %(nice)s " \
-            "rpmbuild -bp --short-circuit --nodeps %(rpmdefs)s --define 'prep exit 0' rpm/packages/%(package)s/%(spec)s" % {
+            "rpmbuild -bp --short-circuit --nodeps %(rpmdefs)s --define 'prep exit 0' %(topdir)s/%(spec)s" % {
             'tmpdir': tmpdir,
             'nice' : config.nice,
+            'topdir' : b.get_topdir(),
             'rpmdefs' : b.rpmbuild_opts(),
-            'package' : packagename,
             'spec': b.spec,
         }
         res = chroot.run(cmd, logfile = b.logfile)
@@ -227,12 +227,12 @@ def build_rpm(r, b):
                 if r.max_jobs > 0:
                     max_jobs = max(min(config.max_jobs, r.max_jobs), 1)
                 cmd = "set -ex; : build-id: %(r_id)s; TMPDIR=%(tmpdir)s exec nice -n %(nice)s " \
-                    "rpmbuild -bb --define '_smp_mflags -j%(max_jobs)d' %(rpmdefs)s rpm/packages/%(package)s/%(spec)s" % {
+                    "rpmbuild -bb --define '_smp_mflags -j%(max_jobs)d' --define '_make_opts -Otarget' --define '_tld_builder 1' %(rpmdefs)s %(topdir)s/%(spec)s" % {
                     'r_id' : r.id,
                     'tmpdir': tmpdir,
                     'nice' : config.nice,
                     'rpmdefs' : b.rpmbuild_opts(),
-                    'package' : packagename,
+                    'topdir' : b.get_topdir(),
                     'max_jobs' : max_jobs,
                     'spec': b.spec,
                 }
@@ -243,7 +243,7 @@ def build_rpm(r, b):
                 b.log_line("ended at: %s, done in %s" % (time.asctime(), datetime.timedelta(0, end_time - begin_time)))
                 if res:
                     res = "FAIL"
-                files = util.collect_files(b.logfile)
+                files = util.collect_files(b.logfile, basedir = b.get_topdir())
                 if len(files) > 0:
                     r.chroot_files.extend(files)
                 else:
@@ -255,14 +255,14 @@ def build_rpm(r, b):
                         res = "FAIL_%s" % last_section.upper()
                 b.files = files
 
+    # cleanup tmp and build files
     chroot.run("""
         set -ex;
-        rpmbuild %(rpmdefs)s --nodeps --nobuild --clean --rmspec --rmsource rpm/packages/%(package)s/%(spec)s
-        rm -rf %(tmpdir)s;
-        chmod -R u+rwX rpm/BUILD/%(package)s;
-        rm -rf rpm/BUILD/%(package)s;
-    """ %
-        {'tmpdir' : tmpdir, 'spec': b.spec, 'package' : packagename, 'rpmdefs' : b.rpmbuild_opts()}, logfile = b.logfile)
+        chmod -R u+rwX %(topdir)s/BUILD;
+        rm -rf %(topdir)s/{tmp,BUILD}
+    """ % {
+        'topdir' : b.get_topdir(),
+    }, logfile = b.logfile)
 
     def ll(l):
         util.append_to(b.logfile, l)
@@ -279,18 +279,26 @@ def build_rpm(r, b):
             )
         else:
             ll("test-build: not copying to " + rpm_cache_dir)
-        ll("Begin-PLD-Builder-Info")
+        ll("Begin-TLD-Builder-Info")
         if "upgrade" in r.flags:
             b.upgraded = install.upgrade_from_batch(r, b)
         else:
             ll("not upgrading")
-        ll("End-PLD-Builder-Info")
+        ll("End-TLD-Builder-Info")
 
     for f in b.files:
         local = r.tmp_dir + os.path.basename(f)
         chroot.cp(f, outfile = local, rm = True)
         ftp.add(local)
 
+    # cleanup all remains from this build
+    chroot.run("""
+        set -ex;
+        rm -rf %(topdir)s;
+    """ % {
+        'topdir' : b.get_topdir(),
+    }, logfile = b.logfile)
+
     def uploadinfo(b):
         c="file:SRPMS:%s\n" % b.src_rpm
         for f in b.files:
@@ -367,6 +375,14 @@ def main_for(builder):
         f.close()
         l.close()
     else:
+        # be able to avoid locking with very low priority
+        if req.priority > -1000:
+            # don't kill server
+            check_load()
+            # allow only one build in given builder at once
+            if not lock.lock("building-high-priority-rpm-for-%s" % config.builder, non_block = 1):
+                return
+
         msg = "HIGH PRIORITY: "
 
     msg += "handling request %s (%d) for %s from %s, priority %s" \
similarity index 90%
rename from PLD_Builder/srpm_builder.py
rename to TLD_Builder/srpm_builder.py
index 42e3b6bff84bc1daccefda688b30fcbf5e0a7585..39ac93d623e786601432b497a28de559e53b995d 100644 (file)
@@ -90,7 +90,7 @@ def transfer_file(r, b):
         ftp.add(fname, "uploadinfo")
 
 def build_srpm(r, b):
-    if len(b.spec) == 0:
+    if len(b.spec) <= len('.spec'):
         # should not really get here
         util.append_to(b.logfile, "error: No .spec given but build src.rpm wanted")
         return "FAIL"
@@ -98,14 +98,14 @@ def build_srpm(r, b):
     status.push("building %s" % b.spec)
 
     b.src_rpm = ""
-    builder_opts = "-nu -nm --nodeps --http"
-    if ("test-build" in r.flags) or b.branch and b.branch.startswith(config.tag_prefixes[0]):
-                    tag_test=""
+    builder_opts = "-nu -nm --nodeps --http --define \'_tld_builder 1\'"
+    if ("test-build" in r.flags):
+        tag_test=""
     else:
-                    tag_test=" -Tp %s -tt" % (config.tag_prefixes[0],)
-    cmd = ("cd rpm/packages; nice -n %s ./builder %s -bs %s -r %s %s %s %s 2>&1" %
+        tag_test=" -Tp %s -tt" % (config.tag_prefixes[0],)
+    cmd = ("cd rpm/packages; nice -n %s ./builder %s -bs %s -r %s %s %s %s %s 2>&1" %
              (config.nice, builder_opts, b.bconds_string(), b.branch,
-              tag_test, b.kernel_string(), b.spec))
+              tag_test, b.kernel_string(), b.defines_string(), b.spec))
     util.append_to(b.logfile, "request from: %s" % r.requester)
     util.append_to(b.logfile, "started at: %s" % time.asctime())
     util.append_to(b.logfile, "building SRPM using: %s\n" % cmd)
@@ -126,8 +126,8 @@ def build_srpm(r, b):
     if res == 0 and not "test-build" in r.flags:
         for pref in config.tag_prefixes:
             util.append_to(b.logfile, "Tagging with prefix: %s" % pref)
-            res = chroot.run("cd rpm/packages; ./builder -r %s -Tp %s -Tv --pkgrev %s" % \
-                        (b.branch, pref, b.spec), logfile = b.logfile)
+           res = chroot.run("cd rpm/packages; ./builder -bs -r %s -Tp %s -Tv --pkgrev %s" % \
+                        (b.bconds_string(), b.branch, pref, b.defines_string(), b.spec), logfile = b.logfile)
     if res == 0:
         transfer_file(r, b)
 
similarity index 100%
rename from PLD_Builder/status.py
rename to TLD_Builder/status.py
similarity index 86%
rename from PLD_Builder/util.py
rename to TLD_Builder/util.py
index 316a8f19f1461a377da5a5054dc23abdf7f8e312..b623115d7f2e407e3fe30d69e66a97bfe4a7b32f 100644 (file)
@@ -49,11 +49,14 @@ def clean_tmp(dir):
     # FIXME: use python
     os.system("rm -f %s/* 2>/dev/null; rmdir %s 2>/dev/null" % (dir, dir))
 
-def collect_files(log):
+def collect_files(log, basedir = "/home"):
     f = open(log, 'r')
-    rx = re.compile(r"^Wrote: (/home.*\.rpm)$")
+    rx = re.compile(r"^Wrote: (%s.*\.rpm)$" % basedir)
+    proc = re.compile(r"^Processing (files):.*$")
     files = []
-    for l in f.xreadlines():
+    for l in reversed(list(f.xreadlines())):
+        if proc.match(l):
+            break
         m = rx.search(l)
         if m:
             files.append(m.group(1))
similarity index 97%
rename from PLD_Builder/wrap.py
rename to TLD_Builder/wrap.py
index b9809a3709f438e31684a6aad852e0c6378fcb96..0c9df39281cf6d9f724f9d308ba2b573a762e2ff 100644 (file)
@@ -27,7 +27,7 @@ except:
 To: %s
 Cc: %s, %s
 Date: %s
-X-PLD-Builder: fatal error report
+X-TLD-Builder: fatal error report
 
 %s
 
index 5d80086a38e873d4df4d5b06662b1af506ba2524..c971c5060c360c59609ac841995cf2b2052cd947 100755 (executable)
@@ -2,9 +2,9 @@
 
 umask 077
 
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/tld-builder.new/"
 export BUILDERPATH
 
 if [ -d "$BUILDERPATH" ]; then
index f8ec492fef06698c2f3ebb8ed7fb7c763209b4ea..306780dfcc578cc16adaafaff075b8c83756abea 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-DIST="th"
-DISTTAG="PLD 3.0 (Th)"
+DIST="ti"
+DISTTAG="TLD Linux"
 
 die () {
   echo "$0: $*" 1>&2
@@ -21,9 +21,9 @@ EOF
 }
 
 default_config () {
-  builder_pkgs="rpm-build poldek pwdutils net-tools which rpm-perlprov rpm-php-pearprov rpm-pythonprov bash vim"
+  builder_pkgs="rpm-build poldek pwdutils net-tools which rpm-perlprov rpm-php-pearprov rpm-pythonprov bash vim util-linux"
   builder_uid=`id -u`
-  dist_url="ftp://ftp.$DIST.pld-linux.org"
+  dist_url="ftp://ftp.tld-linux.org"
 
   case "$chroot_type" in
   src )
@@ -67,13 +67,13 @@ EOF
 [source]
 name=main
 type=pndir
-path=$dist_url/dists/$DIST/PLD/$arch/RPMS/
+path=$dist_url/TLD/stable/main/$arch/RPMS/
 pri=6
 
 [source]
 name=main
 type=pndir
-path=$dist_url/dists/$DIST/PLD/noarch/RPMS/
+path=$dist_url/TLD/stable/main/noarch/RPMS/
 pri=6
 
 EOF
@@ -104,13 +104,13 @@ set -x
 rm -rf rpm
 mkdir rpm
 cd rpm
-git clone $git_server/rpm-build-tools rpm-build-tools
+git clone $git_server/packages/rpm-build-tools rpm-build-tools
 ./rpm-build-tools/builder.sh --init-rpm-dir
-echo "%packager       PLD bug tracking system ( http://bugs.pld-linux.org/ )">~/.rpmmacros
-echo "%vendor         PLD">>~/.rpmmacros
+echo "%packager       TLD bug tracking system ( http://bugs.tld-linux.org/ )">~/.rpmmacros
+echo "%vendor         TLD">>~/.rpmmacros
 echo "%distribution   $DISTTAG">>~/.rpmmacros
 git config --global user.name $git_user
-git config --global user.email ${git_user}@pld-linux.org
+git config --global user.email ${git_user}@tld-linux.org
 EOF
   chb "sh" < install-specs
   rm install-specs
@@ -124,8 +124,8 @@ rm -rf rpm
 mkdir rpm
 cd rpm
 mkdir SPECS SOURCES SRPMS RPMS BUILD
-echo "%packager       PLD bug tracking system ( http://bugs.pld-linux.org/ )">~/.rpmmacros
-echo "%vendor         PLD">>~/.rpmmacros
+echo "%packager       TLD bug tracking system ( http://bugs.tld-linux.org/ )">~/.rpmmacros
+echo "%vendor         TLD">>~/.rpmmacros
 echo "%distribution   $DISTTAG">>~/.rpmmacros
 EOF
   chb "sh" < install-bt
@@ -151,7 +151,7 @@ cachedir = $chroot_dir/spools/poldek
 keep_downloads = no
 EOF
 
-cat > install-$chroot_name.sh <<EOF
+cat > install-$chroot_type.sh <<EOF
 #!/bin/sh
 set -x
 cd $PWD
@@ -159,16 +159,16 @@ rm -rf $chroot_dir
 mkdir -p $chroot_dir/spools/poldek
 mkdir $chroot_dir/dev
 mknod $chroot_dir/dev/null -m 666 c 1 3
-rpm --root $chroot_dir --initdb
+rpm --root $chroot_dir -qa
 poldek --conf poldek.conf --root $chroot_dir --ask -i\
        $builder_pkgs $builder_arch_pkgs
 EOF
-chmod 755 install-$chroot_name.sh
+chmod 755 install-$chroot_type.sh
 
 echo "About to remove '$chroot_dir' and install it again, using"
-echo "install-$chroot_name.sh:"
+echo "install-$chroot_type.sh:"
 echo 
-cat install-$chroot_name.sh
+cat install-$chroot_type.sh
 echo 
 cat <<EOF
 what to do?
@@ -182,7 +182,7 @@ case "$ans" in
   r )
     ;;
   s )
-    sudo ./install-$chroot_name.sh
+    sudo ./install-$chroot_type.sh
     ;;
   * )
     echo "bye"
@@ -200,7 +200,7 @@ cachedir = /spools/poldek
 keep_downloads = no
 EOF
 
-chr "useradd -u "$builder_uid" -c 'PLD $chroot_name builder' -d /home/users/builder -m -g users -s /bin/sh builder"
+chr "useradd -u "$builder_uid" -c 'TLD $chroot_type builder' -d /home/users/builder -m -g users -s /bin/sh builder"
 chr "cat > /etc/resolv.conf" < /etc/resolv.conf
 chr "cat > /etc/mtab" < /dev/null
 chr "mkdir -p /spools/ready/" < /dev/null
index 5babb4ca21e00f337fa7510d7d5c587250a6fb3b..3f75f49acee7fd3816ae32cf4055e681338fc584 100755 (executable)
@@ -3,10 +3,13 @@
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
 
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 cd $BUILDERPATH
-exec python PLD_Builder/file_sender.py
+exec python TLD_Builder/file_sender.py
index 055306af57848d6c38271692a9985a54b36857ae..269b9fa7878f65296e4b87aab067f1da4d56d0a3 100755 (executable)
@@ -3,10 +3,13 @@
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
 
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 cd $BUILDERPATH
-exec python PLD_Builder/load_balancer.py
+exec python TLD_Builder/load_balancer.py
index e490b02d23d77565b044ae7428e8ceed555bdb18..7eecd213afa01b2321eb0dd1fb325adfeaa7b214 100755 (executable)
@@ -3,10 +3,13 @@
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
 
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 cd $BUILDERPATH
-exec python PLD_Builder/maintainer.py
+exec python TLD_Builder/maintainer.py
index 1b446f7e891c65d869d248fcbbecc31973fe428b..6efc48b2b9928f566f586adf05a31ae7e49d2676 100755 (executable)
@@ -3,10 +3,13 @@
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
 
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 cd $BUILDERPATH
-exec python PLD_Builder/request_fetcher.py
+exec python TLD_Builder/request_fetcher.py
index 8c2ab85f17c32f612eb6c01d4d79ec9c1253d50f..e0aa6e2530ea61b708ca3d534e82e6cdebc421f7 100755 (executable)
@@ -2,15 +2,18 @@
 
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 if lockfile -r3 $HOME/.builder_request_handler.lock 2>/dev/null; then
        trap "rm -f $HOME/.builder_request_handler.lock" 1 2 3 13 15
        cd $BUILDERPATH
-       python PLD_Builder/request_handler.py
+       python TLD_Builder/request_handler.py
        rm -f $HOME/.builder_request_handler.lock
 else
        return 1
index 7e678e2c66d548018b3966ec9229e6419ebaf80a..5f52b1cafa599ba1fee5a5b273ee5daab49dabd6 100755 (executable)
@@ -2,10 +2,13 @@
 
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 cd $BUILDERPATH
-exec python PLD_Builder/rpm_builder.py $1
+exec python TLD_Builder/rpm_builder.py $1
index c17e36be4911a59c30c94c79289ae36958f4176b..8114070679816ecb1466f4dda7ebf1b5194d4db5 100755 (executable)
@@ -2,10 +2,13 @@
 
 umask 022
 export LC_CTYPE=en_US.iso-8859-1
-CONFIG=$HOME/.pldbuilderrc
+CONFIG=$HOME/.tldbuilderrc
 [ -f "$CONFIG" ] && . $CONFIG
-[ -n "$BUILDERPATH" ] || BUILDERPATH="$HOME/pld-builder.new/"
+if [ -z "$BUILDERPATH" ]; then
+       dir=$(dirname "$0")
+       BUILDERPATH="$(cd "$dir"/..; pwd)"
+fi
 export BUILDERPATH
 
 cd $BUILDERPATH
-exec python PLD_Builder/srpm_builder.py
+exec python TLD_Builder/srpm_builder.py
index d73c08ab19df1ae1b7db69cd5fa97d0554141745..a14bd7c5ffadd4308f3f7a125f7f5e4f3d094988 100755 (executable)
@@ -1,4 +1,6 @@
 #!/bin/sh
+# vim:noet:ts=4:sw=4
+VERSION=1.89
 
 # prevent "*" from being expanded in builders var
 set -f
@@ -16,6 +18,8 @@ url=
 no_depend=no
 verbose=no
 autotag=no
+requester_override=
+relup=no
 
 if [ -x /usr/bin/python ]; then
        send_mode="python"
@@ -34,14 +38,14 @@ if [ ! -f "$USER_CFG" ]; then
        echo "Creating config file $USER_CFG. You *must* edit it."
        cat > $USER_CFG <<EOF
 priority=2
-requester=deviloper@pld-linux.org
-default_key=deviloper@pld-linux.org
+requester=deviloper@tld-linux.org
+default_key=deviloper@tld-linux.org
 send_mode="$send_mode"
 url="$url"
-mailer="/usr/sbin/sendmail -t"
+mailer="/usr/lib/sendmail -t"
 gpg_opts=""
-dist=th
-url="http://src.th.pld-linux.org:1234/"
+dist=ti
+url="http://kraz.tld-linux.org:1231/"
 
 # defaults:
 f_upgrade=yes
@@ -61,6 +65,8 @@ fi
 specs=
 df_fetch=no
 upgrade_macros=no
+upgrade_scripts=no
+cr=$(printf "\r")
 
 # Set colors
 c_star=$(tput setaf 2)
@@ -82,20 +88,26 @@ send_request() {
        # switch to mail mode, if no url set
        [ -z "$url" ] && send_mode="mail"
 
+       if [ -n "$wait" ]; then
+               msg "Waiting $wait seconds before sending request"
+               sleep $wait
+               msg "Wait has ended, proceeding!"
+       fi
+
        case "$send_mode" in
        "mail")
                msg "Sending using mail mode"
                cat - | $mailer
                ;;
        *)
-               msg "Sending using http mode to $url"
+               msg "Sending using HTTP mode to $url"
                cat - | python -c '
 import sys, socket, urllib2
 
 try:
         data = sys.stdin.read()
         url = sys.argv[1]
-        socket.setdefaulttimeout(10)
+        socket.setdefaulttimeout(30)
         req = urllib2.Request(url, data)
         f = urllib2.urlopen(req)
         f.close()
@@ -108,6 +120,12 @@ print >> sys.stdout, "Request queued via HTTP."
        esac
 }
 
+# htmlspecialchars: escape <, > and &
+hsc() {
+       local input=$1
+       echo -E "$input" | sed -e 's,&,\&amp;,g;s,<,\&lt;,g;s,>,\&gt;,g'
+}
+
 # simple df_fetcher, based on packages/fetchsrc_request
 # TODO: tcp (smtp) mode
 # TODO: adjust for ~/.requestrc config
@@ -115,7 +133,7 @@ df_fetch() {
        local specs="$@"
 
        # Sending by
-       local MAILER='/usr/sbin/sendmail'
+       local MAILER='/usr/lib/sendmail'
        # MAILER='/usr/bin/msmtp'
        # Sending via
        local VIA="SENDMAIL"
@@ -126,23 +144,24 @@ df_fetch() {
        # VIA_ARGS='-a gmail'
        #
        # DISTFILES EMAIL
-       local DMAIL="distfiles@pld-linux.org"
+       local DMAIL="df@tld-linux.org"
 
        local HOST=$(hostname -f)
        local LOGIN=${requester%@*}
 
+       local SPEC BRANCH
        for spec in $specs; do
-               local SPEC=$(echo "$spec" | sed -e 's|:.*||')
-               local BRANCH=$(echo "$spec" | sed -e 's|.*:||')
+               SPEC=$(echo "$spec" | sed -e 's|:.*||')
+               SPEC=${SPEC%.spec}
+               BRANCH=$(echo "$spec" | sed -e 's|.*:||')
                echo >&2 "Distfiles Request: $SPEC:$BRANCH via $MAILER ${VIA_ARGS:+ ($VIA_ARGS)}"
                cat <<-EOF | "$MAILER" -t -i $VIA_ARGS
                        To: $DMAIL
                        From: $LOGIN <$LOGIN@$HOST>
                        Subject: fetchsrc_request notify
-                       X-CVS-Module: SPECS
                        X-distfiles-request: yes
                        X-Login: $LOGIN
-                       X-Spec: $SPEC
+                       X-Package: $SPEC
                        X-Branch: $BRANCH
                        X-Flags: force-reply
 
@@ -160,19 +179,21 @@ autotag() {
                s=${s%:*}
                # ensure package ends with .spec
                s=${s%.spec}.spec
-               out=$(cvs status -v $s | awk "!/Sticky/&&/auto-$dist-/{if (!a++) print \$1}")
+               git fetch --tags
+               out=$(git for-each-ref --count=1 --sort=-authordate refs/tags/auto/$dist \
+                       --format='%(refname:short)')
                echo "$s:$out"
        done
 }
 
 # get autotag for specs
-# WARNING: This may checkout some files from CVS
+# WARNING: This may checkout some files from VCS
 get_autotag() {
        local pkg spec rpmdir
 
        rpmdir=$(rpm -E %_topdir)
-       cd $rpmdir
        for pkg in "$@"; do
+               cd $rpmdir
                # strip branches
                pkg=${pkg%:*}
                # strip .spec extension
@@ -185,11 +206,17 @@ get_autotag() {
                        # just print it out, to fallback to base pkg name
                        echo "$pkg"
                else
-                       autotag $pkg/$pkg.spec
+                       cd $pkg
+                       autotag $pkg.spec
                fi
        done
 }
 
+relup() {
+       local script=$(dirname $(rpm -E %_topdir))/rpm-build-tools/relup.sh
+       $script -u -i "$@"
+}
+
 usage() {
        cat <<EOF
 Usage: make-request.sh [OPTION] ... [SPECFILE] ....
@@ -210,8 +237,10 @@ Mandatory arguments to long options are mandatory for short options too.
             set alt_kernel to VALUE
       --target VALUE
             set --target to VALUE
+      -D "NAME VALUE"|--define "NAME VALUE"
+            define macro named NAME with value VALUE
       -s BUILD_ID, --skip BUILD_ID[,BUILD_ID][,BUILD_ID]
-            mark build ids on src builder to be skipped
+            mark build ids on src builder to be skipped (instructs srcbuilder to create 'skipme' file)
       --branch VALUE
             specify default branch for specs in request
       -t, --test-build
@@ -222,6 +251,10 @@ Mandatory arguments to long options are mandatory for short options too.
             (and later moved by release manager staff to ready/ and main ftp tree)
       -u, --upgrade
             Forces package upgrade (for use with -c or -q, not -t)
+      --relup
+            Bump package release, see also --relup
+      -m, --message
+            Set commit message for relup
       -n, --no-upgrade
             Disables package upgrade (for use with -r)
       -ni, --no-install-br
@@ -251,14 +284,24 @@ Mandatory arguments to long options are mandatory for short options too.
             Updates builders infrastructure (outside chroot)
       --update-macros
             Updates rpm-build-macros on src builder
+      --update-scripts
+            Updates ~/rpm/rpm-build-tools on builder
+      --requester username
+            Override the requester
       -q
             shortcut for --command rpm -q ARGS
       -g, --gpg-opts "opts"
             Pass additional options to gpg binary
       -p, --priority VALUE
             sets request priority (default 2)
+      -w SECONDS
+            Wait SECONDS before sending actual request. Note: gpg passphrase is still asked immediately.
+            This may be useful if you just commited package and want to send it
+            for test build after distfiles has fetched the file.
       -h, --help
             Displays this help message
+      -v
+            Verbose. Print some more debug on screen
 EOF
        exit 0
 }
@@ -266,20 +309,10 @@ EOF
 # validate distro, set $dist
 set_dist() {
        case "$1" in
-       ac)
-               ;;
-       ac-java|ac-xen)
-               ;;
        ti)
                ;;
        ti-dev)
                ;;
-       th)
-               ;;
-       th-java)
-               ;;
-       aidath)
-               ;;
        *)
                die "dist \`$1' not known"
                ;;
@@ -288,7 +321,7 @@ set_dist() {
        dist=$1
 }
 
-while [ $# -gt 0 ] ; do
+while [ $# -gt 0 ]; do
        case "$1" in
                -d | --dist | --distro)
                        set_dist $2
@@ -311,6 +344,15 @@ while [ $# -gt 0 ] ; do
                        autotag=yes
                        ;;
 
+               -m)
+                       shift
+                       message=$1
+                       ;;
+
+               --relup)
+                       relup=yes
+                       ;;
+
                --with)
                        with="$with $(echo "$2" | tr ',' ' ')"
                        shift
@@ -336,6 +378,13 @@ while [ $# -gt 0 ] ; do
                        shift
                        ;;
 
+               -D|--define)
+                       value=${2#* }
+                       name=${2%% *}
+                       define="$define$cr$name=$value"
+                       shift
+                       ;;
+
                -s|--skip)
                        skip="$2"
                        shift
@@ -380,6 +429,11 @@ while [ $# -gt 0 ] ; do
                        jobs="${1#-j}"
                        ;;
 
+               -w)
+                       wait="$2"
+                       shift
+                       ;;
+
                -v)
                        verbose=yes
                        ;;
@@ -445,6 +499,10 @@ while [ $# -gt 0 ] ; do
                        upgrade_macros="yes"
                        ;;
 
+               --update-scripts)
+                       upgrade_scripts='yes'
+                       ;;
+
                -df | --distfiles-fetch | --distfiles-fetch-request)
                        df_fetch=yes
                        ;;
@@ -458,6 +516,11 @@ while [ $# -gt 0 ] ; do
                        usage
                        ;;
 
+               --requester)
+                       requester_override="$2"
+                       shift
+                       ;;
+
                -*)
                        die "unknown knob: $1"
                        ;;
@@ -470,24 +533,6 @@ while [ $# -gt 0 ] ; do
 done
 
 case "$dist" in
-ac)
-       builder_email="builder-ac@pld-linux.org"
-       default_builders="ac-*"
-       default_branch="AC-branch"
-       url="http://ep09.pld-linux.org:1289/"
-       control_url="http://ep09.pld-linux.org/~buildsrc"
-       ;;
-ac-java) # fake "dist" for java available ac architectures
-       builder_email="builder-ac@pld-linux.org"
-       default_builders="ac-i586 ac-i686 ac-athlon ac-amd64"
-       default_branch="AC-branch"
-       url="http://ep09.pld-linux.org:1289/"
-       ;;
-ac-xen) # fake "dist" for xen-enabled architectures
-       builder_email="builder-ac@pld-linux.org"
-       default_builders="ac-i686 ac-athlon ac-amd64"
-       default_branch="AC-branch"
-       ;;
 ti)
        builder_email="builderti@kraz.tld-linux.org"
        default_builders="ti-*"
@@ -500,21 +545,6 @@ ti-dev)
        url="http://kraz.tld-linux.org:1232/"
        control_url="http://kraz.tld-linux.org/~buildertidev"
        ;;
-th)
-       builder_email="builderth@pld-linux.org"
-       default_builders="th-*"
-       url="http://src.th.pld-linux.org:1234/"
-       control_url="http://src.th.pld-linux.org"
-       ;;
-th-java) # fake "dist" for java available th architectures
-       builder_email="builderth@pld-linux.org"
-       default_builders="th-x86_64 th-athlon th-i686"
-       url="http://src.th.pld-linux.org:1234/"
-       ;;
-aidath)
-       builder_email="builderaidath@ep09.pld-linux.org"
-       default_builders="aidath-*"
-       ;;
 *)
        die "dist \`$dist' not known"
        ;;
@@ -587,21 +617,21 @@ specs=`for s in $specs; do
                # skip marker - pass it along
                echo $s
                ;;
-       *.spec:*) # spec with branch
-               echo $s
-               ;;
-       *.spec) # spec without branch
-               echo $(basename $s):$branch
-               ;;
        *:*) # package name with branch
-               echo $s | sed -e 's/:/.spec:/'
+               _specfile=$(basename ${s%:*})
+               echo ${_specfile%.spec}.spec:${s##*:}
                ;;
        *) # just package name
-               echo $(basename $s).spec:$branch
+               echo $(basename ${s%.spec}).spec:$branch
                ;;
        esac
 done`
 
+if [ "$relup" = "yes" ]; then
+       msg "Auto relup enabled"
+       relup ${message:+-m "$message"} $specs
+fi
+
 if [ "$autotag" = "yes" ]; then
        msg "Auto autotag build enabled"
        specs=$(get_autotag $specs)
@@ -619,8 +649,16 @@ if [ "$upgrade_macros" = "yes" ]; then
        build_mode=test
 fi
 
+if [ "$upgrade_scripts" = "yes" ]; then
+       command="cd ~/rpm/rpm-build-tools && git pull"
+       command_flags=as-builder
+       builders="$dist-src"
+       f_upgrade=no
+       build_mode=test
+fi
+
 if [[ "$requester" != *@* ]] ; then
-       requester="$requester@pld-linux.org"
+       requester="$requester@tld-linux.org"
 fi
 
 if [ -z "$builders" ] ; then
@@ -676,12 +714,16 @@ gen_req() {
                msg "Build mode: $(tput setaf 3)$build_mode$c_norm"
        fi
 
+       if [ -n "$requester_override" ] ; then
+               echo "  <requester>$requester_override</requester>"
+       fi
+
        msg "Queue-ID: $id"
        echo
 
        # job to depend on
        local depend=
-       local b i=1
+       local b i=1 val
        local name branch builders_xml
 
        for b in $builders; do
@@ -694,7 +736,7 @@ gen_req() {
                echo -E >&2 "* Command: $command"
                echo "  <batch id='$bid' depends-on=''>"
                echo "           <command flags='$command_flags'>"
-               echo -E "$command" | sed -e 's,&,\&amp;,g;s,<,\&lt;,g;s,>,\&gt;,g'
+               hsc "$command"
                echo "</command>"
                echo "           <info></info>"
                echo "$builders_xml"
@@ -725,6 +767,17 @@ gen_req() {
                echo "           <branch>$branch</branch>"
                echo "           ${kernel:+<kernel>$kernel</kernel>}"
                echo "           ${target:+<target>$target</target>}"
+
+               oIFS=$IFS; IFS=$cr
+               for b in $define; do
+                       [ -z "$b" ] && continue
+                       value=${b#*=}
+                       b=${b%%=*}
+                       echo "           <define name='$(hsc $b)'>$(hsc "$value")</define>"
+                       msg "- define $b=$value"
+               done
+               IFS=$oIFS
+
                echo "           <info></info>"
                echo
                for b in $with; do
@@ -750,7 +803,7 @@ gen_req() {
                echo -E >&2 "* Post-Command: $post_command"
                echo "  <batch id='$bid' depends-on='$depend'>"
                echo "           <command flags='$command_flags'>"
-               echo -E "$post_command" | sed -e 's,&,\&amp;,g;s,<,\&lt;,g;s,>,\&gt;,g'
+               hsc "$post_command"
                echo "</command>"
                echo "           <info></info>"
                echo "$builders_xml"
@@ -776,8 +829,8 @@ gen_email () {
        To: $builder_email
        Subject: build request
        Message-Id: <$id@$(hostname)>
-       X-New-PLD-Builder: request
-       X-Requester-Version: \$Id$
+       X-New-TLD-Builder: request
+       X-Requester-Version: $VERSION
 
        EOF
 
index ad4ff7b212959fd5baa9a76d12e90a1766db3b45..2827f65488ada12d6f41e5132167f4ec85b7fd55 100755 (executable)
@@ -11,6 +11,6 @@ msg = sys.stdin.read()
 
 server = smtplib.SMTP(smtp_host)
 # server.set_debuglevel(1)
-server.sendmail("matkor@pld-linux.org","builder-ac@pld-linux.org", msg) # Adresses should be taken from .requestrc
+server.sendmail("ti-admins@tld-linux.org","builder-src@tld-linux.org", msg) # Adresses should be taken from .requestrc
 server.quit()
 
index 81256cc3043c15cd313953ab7a9729b21ce375db..a24a6bd044b4cfc546a6054cb5e9f870b0cf14c3 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Access Control Lists for PLD builder
+# Access Control Lists for TLD builder
 #
 # Format:
 # 
@@ -36,7 +36,7 @@
 # sense). Lowest priority allowe will be 3.
 #
 # [foo]
-# gpg_emails = foo@pld-linux.org Foo.Bar@blah.com
+# gpg_emails = foo@tld-linux.org Foo.Bar@blah.com
 # mailto foo-builder@blah.com
 # privs = src:src !binary:security-* binary:* 3:*
 #
@@ -50,6 +50,6 @@ gpg_emails = srpms_builder@roke.freak
 privs = sign_queue:* notify:*
 
 [malekith]
-gpg_emails = malekith@pld-linux.org
+gpg_emails = malekith@tld-linux.org
 mailto = malekith@roke.freak
 privs = src:roke-src binary:roke-*:AC-branch
index 98d3b8f985363302e521f375d4748b81cc65cb31..aefdabf9eb9fa92db10442b48f1c2e35e7fe2199 100644 (file)
@@ -1,19 +1,19 @@
 [all]
 # Builder email (put in From: field when this builder is sending mails).
-email = builder-th@pld-linux.org
+email = builder-src@tld-linux.org
 
 # Admin's email (she gets mails about errors and such).
-admin_email = th-admin@pld-linux.org
+admin_email = ti-admins@tld-linux.org
 
 # To be placed in Cc: of status and error reports (a mailing list usually).
 builder_list =
 
 # List of binary builders. This thing must be present on both src and bin 
 # builders.
-binary_builders = th-athlon
+binary_builders = ti-i686 ti-x86_64
 
 # Name of the src builder (this field is ignored on binary builders).
-src_builder = th-src
+src_builder = ti-src
 
 # Logs always go to spool/log, if you want syslog in addition,
 # specify facility here (user or local0-7 is the best choice probably).
@@ -28,14 +28,14 @@ sudo_chroot_wrapper =
 max_keep_time = 168
 
 # TCP port number for request_handler_server.py. ignored on bin builders
-request_handler_server_port = 1234
+request_handler_server_port = 1231
 
-# Send '*.uploadinfo' files along with built rpms (used by pld-ftp-admin), but
+# Send '*.uploadinfo' files along with built rpms (used by tld-ftp-admin), but
 # probably not usefull for small, 'personal' builders. [yes/no]
 gen_upinfo = yes
 
 # CIA bot (see cia.navi.cx).
-#bot_email = cia@pld-linux.org
+#bot_email = cia@tld-linux.org
 
 # ------ Binary builders config:
 # How many jobs can be run at once (how many concurrent builds).
@@ -51,39 +51,26 @@ max_jobs = 1
 #nice = 0
 
 # Where to look for queue.gz and counter (published through www by src builder).
-control_url = http://src.th.pld-linux.org/
+control_url = http://kraz.tld-linux.org/~builderti/
 
 # Src builder's email for sending status notifications (build ok/failed).
-#notify_email = builder-th-src@pld-linux.org
+#notify_email = builder-src@tld-linux.org
 
 # Where to cache rpm's from binary builders locally
 rpm_cache_dir = /spools/ready
 
 # ------ SRC builder config:
 # List of name-version-release tag prefixes.
-#tag_prefixes = auto- auto-ac- auto-th-
-tag_prefixes = auto-th-
+tag_prefixes = auto/ti/
 
 # ------ Configs for particular builders:
 
-[th-src]
+[ti-src]
 arch = i686
-chroot = /home/pld/builderth/chroots/chroot-src/
-buildlogs_url = rsync://blogs-th@buildlogs.pld-linux.org/pld-buildlogs-th-SRPMS/
-ftp_url = scp://pldth@ep09.pld-linux.org:ftp/.incoming/SRPMS/
-notify_url = http://src.th.pld-linux.org:1234/
-test_ftp_url = scp://pldth@ep09.pld-linux.org:ftp/.test-builds/SRPMS/
-rpmqa_url = scp://pldth@ep09.pld-linux.org:ftp/.stat/builder/th/
+chroot = /home/tld/builderti/chroots/chroot-src/
+buildlogs_url = rsync://buildlogs-ti@buildlogs.tld-linux.org/buildlogs-ti-src/
+ftp_url = scp://ftpti@kraz.tld-linux.org:ftp/.incoming/SRPMS/
+notify_url = http://kraz.tld-linux.org:1231/
+test_ftp_url = scp://ftpti@kraz.tld-linux.org:ftp/.test-builds/SRPMS/RPMS/
+rpmqa_url = scp://ftpti@kraz.tld-linux.org:ftp/.stat/builder/ti/
 rpmqa_filename = rpmqa-SRPMS.txt
-
-[th-athlon]
-arch = athlon
-chroot = /home/users/builderth/chroot-athlon/
-buildlogs_url = /dev/null
-notify_url = http://src.th.pld-linux.org:1234/
-ftp_url = scp://pldth@ep09.pld-linux.org:ftp/.incoming/athlon/
-test_ftp_url = /dev/null
-rpmqa_url = /dev/null
-rpmqa_filename = nothing
-
-
index cc9fb47ab454bb7ab1af1c00ffc84b358391fd1b..07ab39821edc5ea5a59103551a7d3591b690efa5 100644 (file)
@@ -2,7 +2,7 @@ Roadmap:
 
   Makefile -- nothing interesting.
 
-  PLD_Builder/ -- all python stuff live here.
+  TLD_Builder/ -- all python stuff live here.
 
   admin/ -- scripts for chroot admin.
 
index 89a7b775ce33acd2ba34f489443b588571a121b8..2699cbcaba32459fa92c4d5521084e9de231f9bf 100644 (file)
@@ -2,7 +2,7 @@ new bin builder setup
 
 packages and chroot
 ~~~~~~~~~~~~~~~~~~~
-1. install pld-builder from th repoeistory on target host
+1. install pld-builder from th repoistory on target host
 
 2. create chroot /srv/chroot
 (you can symlink to real dest for the sake of copy-paste from here)
@@ -47,6 +47,7 @@ gpg keys
 1. import src builder key to bin builder so it can download queue.gz
 
 src-builder$ gpg --export builder-th-src@pld-linux.org --armor > th-src.asc
+bin-builder$ su - builder
 bin-builder$ gpg --import < th-src.asc
 
 2. generate new key for bin builder and import it to src builder so it can
index 89fd9d2637d8953f44de628b1e1862ac9ebe992d..a7ed0e5081ad4623cc49c9b591c3132aad8c93a7 100644 (file)
@@ -2,8 +2,8 @@ SHELL=/bin/sh
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
 
-#* * * * * builder exec nice -n 19 /usr/share/pld-builder/bin/request-fetcher.sh
-#* * * * * builder exec nice -n 19 /usr/share/pld-builder/bin/load-balancer.sh
-#* * * * * builder exec nice -n 19 /usr/share/pld-builder/bin/file-sender.sh
+#* * * * * builder exec nice -n 19 /usr/share/tld-builder/bin/request-fetcher.sh
+#* * * * * builder exec nice -n 19 /usr/share/tld-builder/bin/load-balancer.sh
+#* * * * * builder exec nice -n 19 /usr/share/tld-builder/bin/file-sender.sh
 
-#0 0 * * * root chroot /srv/chroot nice -n 19 tmpwatch -m 240 /var/cache/pld-builder/ready
+#0 0 * * * root chroot /srv/chroot nice -n 19 tmpwatch -m 240 /var/cache/tld-builder/ready
diff --git a/etc/pld-builder.sysconfig b/etc/pld-builder.sysconfig
deleted file mode 100644 (file)
index 8702c2f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# define chroots whose /proc to mount on startup
-
-#CHROOTS=/srv/builders/pld/{ac/{athlon,i586},actw/{athlon,i586},th/{athlon,i486}}
index 19111d38824cd92a49f8c01af2a8813995300eb2..818d2b58f7edf530fa82651db04f2324c6ab0f3b 100644 (file)
@@ -3,5 +3,5 @@
 name   = ready
 pri    = -1
 type   = dir
-path   = /var/cache/pld-builder/ready/
+path   = /var/cache/tld-builder/ready/
 autoup = no
index ce50ac0579c76813a37936167e137c57a8c67315..3f8c3871e1d557f52743d7dd7b65b86ba1bb51f6 100644 (file)
@@ -4,8 +4,8 @@ LOGFILE=procmail.log
 #mail.copy
 
 :0
-* ^X-New-PLD-Builder:
-| /usr/share/pld-builder/bin/request-handler.sh
+* ^X-New-TLD-Builder:
+| /usr/share/tld-builder/bin/request-handler.sh
 
 :0
 * ^FROM_MAILER
index 0639204fb047f406d144cfc116cb736a78250c5d..de5f098866c412b9232dc05c48ff64eb48dc404f 100644 (file)
@@ -1,4 +1,4 @@
-# rpm macros for pld builder chroot
+# rpm macros for tld builder chroot
 
 # A colon separated list of desired locales to be installed;
 # "all" means install all locale specific files.
old mode 100644 (file)
new mode 100755 (executable)
similarity index 70%
rename from etc/pld-builder.init
rename to etc/tld-builder.init
index 8672b25..c184b28
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# pld-builder  perform adminstrator's tasks for PLD Linux Builder
+# tld-builder  perform adminstrator's tasks for TLD Linux Builder
 #
 # chkconfig:   345 99 01
 #
-# description: perform adminstrator's tasks for PLD Linux Builder
+# description: perform adminstrator's tasks for TLD Linux Builder
 #
 # $Id$
 
@@ -15,7 +15,7 @@
 CHROOTS=
 
 # Get service config - may override defaults
-[ -f /etc/sysconfig/pld-builder ] && . /etc/sysconfig/pld-builder
+[ -f /etc/sysconfig/tld-builder ] && . /etc/sysconfig/tld-builder
 
 mount_chroots() {
        # mount /proc in chroots
@@ -59,8 +59,8 @@ chroots_status() {
 
 start() {
        # Check if the service is already running?
-       if [ -f /var/lock/subsys/pld-builder ]; then
-               msg_already_running "PLD Linux Builder"
+       if [ -f /var/lock/subsys/tld-builder ]; then
+               msg_already_running "TLD Linux Builder"
                return
        fi
 
@@ -68,30 +68,30 @@ start() {
                # no chroots configured. return and be silent
                return
        fi
-       msg_starting "PLD Linux Builder"
+       msg_starting "TLD Linux Builder"
        busy; echo
        mount_chroots
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pld-builder
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tld-builder
 }
 
 stop() {
-       if [ ! -f /var/lock/subsys/pld-builder ]; then
-               msg_not_running "PLD Linux Builder"
+       if [ ! -f /var/lock/subsys/tld-builder ]; then
+               msg_not_running "TLD Linux Builder"
                return
        fi
 
        # Stop daemons.
-       msg_stopping "PLD Linux Builder"
+       msg_stopping "TLD Linux Builder"
        busy; echo
        umount_chroots
-       rm -f /var/lock/subsys/pld-builder >/dev/null 2>&1
+       rm -f /var/lock/subsys/tld-builder >/dev/null 2>&1
        RETVAL=0
 }
 
 condrestart() {
-       if [ ! -f /var/lock/subsys/pld-builder ]; then
-               msg_not_running "PLD Linux Builder"
+       if [ ! -f /var/lock/subsys/tld-builder ]; then
+               msg_not_running "TLD Linux Builder"
                RETVAL=$1
                return
        fi
index 82d1dc63d80136959b0bd7c9d1a1a67363321895..d8d578baee4295c747d811086b3c802b995e2865 100644 (file)
@@ -5,7 +5,7 @@
                        2) proper dates with http://www.djkaty.com/drupal/xsl-date-time -->
 
 <xsl:template match="/queue">
-<html><head><title>PLD builder queue</title></head><body>
+<html><head><title>TLD builder queue</title></head><body>
 <xsl:for-each select="group">
        <xsl:sort select="@no" order="descending"/>
        <p><b><xsl:value-of select="@no"/></b>. <xsl:value-of select="time"/> from <xsl:value-of select="requester"/><xsl:text> </xsl:text><small><xsl:value-of select="@id"/>, <xsl:value-of select="priority"/>, <xsl:value-of select="@flags"/></small><br/>