]> TLD Linux GIT Repositories - tld-builder.git/commitdiff
- more python 3.x fixes
authorMarcin Krol <hawk@tld-linux.org>
Mon, 22 Mar 2021 01:53:47 +0000 (02:53 +0100)
committerMarcin Krol <hawk@tld-linux.org>
Mon, 22 Mar 2021 01:53:47 +0000 (02:53 +0100)
TLD_Builder/build.py
TLD_Builder/file_sender.py
TLD_Builder/gpg.py
TLD_Builder/install.py
TLD_Builder/request.py
TLD_Builder/request_handler.py
TLD_Builder/rpm_builder.py

index bd13bee497a7ba47e7ac56e720a65e083d218614..558541143227742a0f7c3fa91a3907ab508e77a9 100644 (file)
@@ -117,4 +117,4 @@ def build_all(r, build_fnc):
             notify.add_batch(batch, "SKIP")
 
     buildlogs.flush()
-    chroot.run("rm -f %s" % string.join(r.chroot_files))
+    chroot.run("rm -f %s" % r.chroot_files.join())
index 77a9848bc2d97c214d0764e261eddb9ecfc48e01..d60b59ecbbe3bca3022a4055c6a41af85cbbdc0f 100644 (file)
@@ -197,7 +197,7 @@ def flush_queue(dir):
                 emails[d['Requester']] = 1
         e = emails.keys()
         m = mailer.Message()
-        m.set_headers(to = string.join(e, ", "),
+        m.set_headers(to = e.join(", "),
                       subject = "[%s] builder queue problem" % config.builder)
         m.write("there were problems sending files from queue %s:\n" % dir)
         m.write("problems:\n")
index edb8dff81e3ad76839764813253072d09e5e7b7e..92e9b6a3b07a2e3987f3d0abbc83152f1ee52d6c 100644 (file)
@@ -27,7 +27,7 @@ def get_keys(buf):
     cmd = ['/usr/bin/gpg', '--batch', '--no-tty', '--decrypt']
     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'))
+        d_stdout, d_stderr = gpg_run.communicate(buf.decode().encode('utf-8'))
     except OSError as e:
         log.error("gnupg run, does gpg binary exist? : %s" % e)
         raise
@@ -59,7 +59,7 @@ def verify_sig(buf):
     cmd = ['/usr/bin/gpg', '--batch', '--no-tty', '--decrypt']
     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'))
+        d_stdout, d_stderr = gpg_run.communicate(buf.decode().encode('utf-8'))
     except OSError as e:
         log.error("gnupg run failed, does gpg binary exist? : %s" % e)
         raise
@@ -85,7 +85,7 @@ def sign(buf):
     # 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'))
+        d_stdout, d_stderr = gpg_run.communicate(buf.decode().encode('utf-8'))
     except OSError as e:
         log.error("gnupg signing failed, does gpg binary exist? : %s" % e)
         raise
index 21f80a44ef793d3aa1eed06bd27d251323b23e3a..3ee53e7f058c4c6a03667851e2147711a7138804 100644 (file)
@@ -53,7 +53,7 @@ def close_killset(killset):
     return errors
 
 def upgrade_from_batch(r, b):
-    f = chroot.popen("rpm --test -F %s 2>&1" % string.join(b.files), user = "root")
+    f = chroot.popen("rpm --test -F %s 2>&1" % b.files.join(), user = "root")
     killset = {}
     rx = re.compile(r' \(installed\) (?P<name>[^\s]+)-[^-]+-[^-]+$')
     for l in f:
@@ -66,7 +66,7 @@ def upgrade_from_batch(r, b):
             util.append_to(b.logfile, err)
             log.notice("cannot upgrade rpms")
             return False
-        k = string.join(killset.keys())
+        k = killset.keys().join()
         if True:
             b.log_line("upgrade requires removal of %s" % k)
             res = chroot.run("rpm -e %s" % k, logfile = b.logfile, user = "root")
@@ -80,7 +80,7 @@ def upgrade_from_batch(r, b):
             return False
     b.log_line("upgrading packages")
     logbuf = StringIO.StringIO()
-    res = chroot.run("rpm -Fvh %s" % string.join(b.files), user = "root", logfile = b.logfile)
+    res = chroot.run("rpm -Fvh %s" % b.files.join(), user = "root", logfile = b.logfile)
     if res != 0:
         b.log_line("package upgrade failed")
         logbuf.close()
index 2e1e7c3d094e951bfe44401bd331e9bbfb68ebb1..efedbb96fb23fc59f3c3f8b55a5b6aaa9f77b512 100644 (file)
@@ -110,7 +110,7 @@ class Group:
     def dump(self, f):
         f.write("group: %d (id=%s pri=%d)\n" % (self.no, self.id, self.priority))
         f.write("  from: %s\n" % self.requester)
-        f.write("  flags: %s\n" % string.join(self.flags))
+        f.write("  flags: %s\n" % self.flags.join())
         f.write("  time: %s\n" % time.asctime(time.localtime(self.time)))
         for b in self.batches:
             b.dump(f)
@@ -148,7 +148,7 @@ class Group:
             'requester': escape(self.requester),
             'priority': self.priority,
             'max_jobs': self.max_jobs,
-            'flags': string.join(self.flags)
+            'flags': self.flags.join()
         })
         f.write("<ol>\n")
         for b in self.batches:
@@ -162,7 +162,7 @@ class Group:
          <requester email='%s'>%s</requester>
          <time>%d</time>
          <priority>%d</priority>
-         <maxjobs>%d</maxjobs>\n""" % (self.id, self.no, string.join(self.flags),
+         <maxjobs>%d</maxjobs>\n""" % (self.id, self.no, self.flags.join(),
                     escape(self.requester_email), escape(self.requester),
                     self.time, self.priority, self.max_jobs))
         for b in self.batches:
@@ -294,7 +294,7 @@ class Batch:
         builders = []
         for b in self.builders:
             builders.append("%s:%s" % (b, self.builders_status[b]))
-        f.write("    builders: %s\n" % string.join(builders))
+        f.write("    builders: %s\n" % builders.join())
 
     def is_command(self):
         return self.command != ""
@@ -401,7 +401,7 @@ class Batch:
                     'tooltip' : cgi.escape(tooltip, True),
             }
             + link_post)
-        f.write("%s]</small></li>\n" % string.join(builders))
+        f.write("%s]</small></li>\n" % builders.join())
 
     def rpmbuild_opts(self):
         """
@@ -501,7 +501,7 @@ class Batch:
            <spec>%s</spec>
            <branch>%s</branch>
            <info>%s</info>\n""" % (self.b_id,
-                 string.join(list(map(lambda b: b.b_id, self.depends_on))),
+                 list(map(lambda b: b.b_id, self.depends_on)).join(),
                  escape(self.src_rpm),
                  escape(' '.join(self.command_flags)), escape(self.command),
                  escape(self.spec), escape(self.branch), escape(self.info)))
index e3c5ca1f6df7912510a1d04cecad42d65d5d777e..b6c67a57f3b6d7802b9e5ad01d1cb7cb1015187f 100644 (file)
@@ -104,7 +104,7 @@ def handle_group(r, user):
             batch.builders_status_time[bld] = time.time()
             if bld not in config.binary_builders and bld != config.builder:
                 fail_mail("I (src rpm builder '%s') do not handle binary builder '%s', only '%s'" % \
-                        (config.builder, bld, string.join(config.binary_builders)))
+                        (config.builder, bld, config.binary_builders.join()))
                 lockf.close()
                 return
             if batch.is_command():
index 7da282c1d6098bf31450c40a793ae75d14bec5bd..4c4bf1f7271cf363cdc07618022f9aecd61ecb5b 100644 (file)
@@ -283,7 +283,7 @@ def build_rpm(r, b):
             b.log_line("copy rpm files to cache_dir: %s" % rpm_cache_dir)
             chroot.run(
                     "cp -f %s %s && poldek --mo=nodiff --mkidxz -s %s/" % \
-                        (string.join(b.files), rpm_cache_dir, rpm_cache_dir),
+                        (b.files.join(), rpm_cache_dir, rpm_cache_dir),
                      logfile = b.logfile, user = "root"
             )
         else: