]> TLD Linux GIT Repositories - tld-builder.git/blobdiff - TLD_Builder/rpm_builder.py
- more python3 fixes, dropped python2 support
[tld-builder.git] / TLD_Builder / rpm_builder.py
index 74c7faa776255abed312b0673c72a23dd23585c3..e33a7e1ff325a55557ec5607b479d022c8d61a73 100644 (file)
@@ -51,7 +51,7 @@ def pick_request(q):
             return cmp(r1.time, r2.time)
         else:
             return pri_diff
-    q.requests.sort(mycmp)
+    q.requests.sort(key=util.cmp_to_key(mycmp))
     ret = q.requests[0]
     return ret
 
@@ -85,7 +85,7 @@ def check_skip_build(r, b):
     return False
 
 def fetch_src(r, b):
-    src_url = config.control_url + "/srpms/" + r.id + "/" + urllib.quote(b.src_rpm)
+    src_url = config.control_url + "/srpms/" + r.id + "/" + urllib.parse.quote(b.src_rpm)
     b.log_line("fetching %s" % src_url)
     start = time.time()
     good = False
@@ -126,7 +126,7 @@ def fetch_src(r, b):
                     print("error.reason exception %s" % e)
                 raise
 
-    o = chroot.popen("cat > %s" % b.src_rpm, mode = "w")
+    o = chroot.popen("cat > %s" % b.src_rpm, mode = "wb")
 
     try:
         bytes = util.sendfile(f, o)
@@ -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),
+                        (' '.join(b.files), rpm_cache_dir, rpm_cache_dir),
                      logfile = b.logfile, user = "root"
             )
         else:
@@ -338,7 +338,7 @@ def check_load():
     do_exit = 0
     try:
         f = open("/proc/loadavg")
-        if float(string.split(f.readline())[2]) > config.max_load:
+        if float(f.readline().split()[2]) > config.max_load:
             do_exit = 1
     except:
         pass