]> git.pld-linux.org Git - projects/pld-builder.new.git/commitdiff
Fix iterators assumptions that are no longer valid in python3
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 17 Jan 2021 18:52:41 +0000 (19:52 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Sun, 17 Jan 2021 18:52:41 +0000 (19:52 +0100)
PLD_Builder/build.py
PLD_Builder/chroot.py
PLD_Builder/file_sender.py
PLD_Builder/get_br.py
PLD_Builder/install.py
PLD_Builder/load_balancer.py
PLD_Builder/mailer.py
PLD_Builder/poldek.py
PLD_Builder/report.py
PLD_Builder/request_handler.py
PLD_Builder/util.py

index a7c281b2f78a42fd186dfd66a0da28b9a61d2722..bf38ff4b820f01fd07e519a18780fb4d00d232bb 100644 (file)
@@ -36,7 +36,7 @@ def run_command(batch):
         # TODO: the append here by shell hack should be solved in python
         c = "(%s) >> %s 2>&1" % (command, batch.logfile)
         f = os.popen(c)
-        for l in f.xreadlines():
+        for l in f:
             pass
         r = f.close()
         if r == None:
index f099d018ebe5dff07ab8834f55b2d9b5e8a40e02..a489ac3cd01206a68c01e7eb09ab7420652c3893 100644 (file)
@@ -49,7 +49,7 @@ def run(cmd, user = "builder", logfile = None, logstdout = None):
 
 def cp(file, outfile, user="builder", rm=False):
     m = md5()
-    m.update(str(random.sample(xrange(100000), 500)))
+    m.update(str(random.sample(range(100000), 500)))
     digest = m.hexdigest()
 
     marker_start = "--- FILE BEGIN DIGEST %s ---" % digest
index 4e90e5acb34f221cf2045bcc7292451de94fb961..44fdd8b1d1d5848e0c2457e001f419dfa8e35793 100644 (file)
@@ -24,7 +24,7 @@ def read_name_val(file):
     f = open(file)
     r = {'_file': file[:-5], '_desc': file}
     rx = re.compile(r"^([^:]+)\s*:(.*)$")
-    for l in f.xreadlines():
+    for l in f:
         if l == "END\n":
             f.close()
             return r
@@ -60,7 +60,7 @@ def rsync_file(src, target, host):
 
     p = open(path.rsync_password_file, "r")
     password = ""
-    for l in p.xreadlines():
+    for l in p:
         l = string.split(l)
         if len(l) >= 2 and l[0] == host:
             password = l[1]
index 246586671ef9a02bcf0ea4d187407939be98e68b..933548c172d60c81a6c5034172fefcef0fd9f58b 100644 (file)
@@ -4,7 +4,6 @@ from __future__ import print_function
 
 import re
 import string
-import xreadlines
 from util import *
 
 
@@ -63,7 +62,7 @@ def get_build_requires(spec, bconds_with, bconds_without):
     build_req = []
 
     f = open(spec)
-    for l in xreadlines.xreadlines(f):
+    for l in f:
         l = string.strip(l)
         if l == "%changelog": break
 
index ddb5bea839f20d6be73390c7d64a8d382a541a50..da3ba05d72073ff3f4c2b4c862a6be83796abebe 100644 (file)
@@ -34,7 +34,7 @@ def close_killset(killset):
             f = chroot.popen("poldek --noask --test --test --erase %s" % p, user = "root")
             crucial = 0
             e = []
-            for l in f.xreadlines():
+            for l in f:
                 m = rx.search(l)
                 if m:
                     pkg = m.group('name')
@@ -55,7 +55,7 @@ def upgrade_from_batch(r, b):
     f = chroot.popen("rpm --test -F %s 2>&1" % string.join(b.files), user = "root")
     killset = {}
     rx = re.compile(r' \(installed\) (?P<name>[^\s]+)-[^-]+-[^-]+$')
-    for l in f.xreadlines():
+    for l in f:
         m = rx.search(l)
         if m: killset[m.group('name')] = 1
     f.close()
@@ -115,7 +115,7 @@ def uninstall_self_conflict(b):
     # java-sun conflicts with soprano-2.1.67-1.src
     rx = re.compile(r"\s+(?P<name>[\w-]+)\s+.*conflicts with [^\s]+-[^-]+-[^-]+\.src($| .*)")
     conflicting = {}
-    for l in f.xreadlines():
+    for l in f:
         m = rx.search(l)
         if m:
             b.log_line("rpmbuild: %s" % l.rstrip())
@@ -142,7 +142,7 @@ def install_br(r, b):
         rx = re.compile(r"^\s*(?P<name>[^\s]+) .*is needed by")
         needed = {}
         b.log_line("checking BR")
-        for l in f.xreadlines():
+        for l in f:
             b.log_line("rpm: %s" % l.rstrip())
             m = rx.search(l)
             if m and not ignore_br.match(l):
@@ -170,7 +170,7 @@ def install_br(r, b):
     # jmx is needed by (installed) java-commons-modeler-2.0-1.noarch
     rx = re.compile(r".*(conflicts with|is required by|is needed by)( installed| \(installed\)|) (?P<name>[^\s]+)-[^-]+-[^-]+($| .*)")
     conflicting = {}
-    for l in f.xreadlines():
+    for l in f:
         b.log_line("poldek: %s" % l.rstrip())
         m = rx.search(l)
         if m: conflicting[m.group('name')] = 1
index 2e182c89f8204f2ca9d3cc08440eaf415bc541d9..a530f816f24b9ace40850ef833e3cb67e3670bf7 100644 (file)
@@ -29,7 +29,7 @@ def builders_order():
     f = open(path.got_lock_file, "r+")
     line_no = 0
 
-    for l in f.xreadlines():
+    for l in f:
         line_no += 1
         b = string.strip(l)
         if bs.has_key(b):
index 7e260b803980092516a4dc2a67774b07e426a340..4e771dc227c5289ce44403b29f778093ff704813 100644 (file)
@@ -51,11 +51,11 @@ class Message:
             # just head and tail
             f = open(log)
             line_cnt = 0
-            for l in f.xreadlines():
+            for l in f:
                 line_cnt += 1
             f.seek(0)
             line = 0
-            for l in f.xreadlines():
+            for l in f:
                 if line < 100 or line > line_cnt - 100:
                     self.body.write(recode(l))
                 if line == line_cnt - 100:
index 9b23a899344053679e2b6fc021edc3a0049b925b..df9df9ba6bddb2925ba7fc8e0c3385d3f441522e 100644 (file)
@@ -3,7 +3,6 @@
 import re
 import types
 import string
-import xreadlines
 
 from chroot import *
 from util import *
@@ -55,7 +54,7 @@ def get_poldek_requires():
     cur_pkg = None
 
     f = chr_popen("poldek -v -v --verify --unique-pkg-names")
-    for l in xreadlines.xreadlines(f):
+    for l in f:
         m = name_rx.match(l)
         if m:
             if cur_pkg:
index c35af0e1310c565782f1608a63434681ed0c4317..0190f9f6fb149ce340a4434ba38b5bcc42545502 100644 (file)
@@ -13,7 +13,7 @@ def unpackaged_files(b):
     f = open(b.logfile)
     copy_mode = 0
     out = []
-    for l in f.xreadlines():
+    for l in f:
         if l == msg:
             copy_mode = 1
             out.append(l)
@@ -41,7 +41,7 @@ def info_from_log(b, target):
     f = open(b.logfile)
     copy_mode = 0
     need_header = 1
-    for l in f.xreadlines():
+    for l in f:
         if l == beg:
             if need_header:
                 need_header = 0
index d84b4cc0f91789d4e65a2ad15e69ed1fe09b43a0..2307607f26d469564713393e6cb8d3e1e0c7d180 100644 (file)
@@ -30,7 +30,7 @@ def check_double_id(id):
     id_nl = id + "\n"
 
     ids = open(path.processed_ids_file)
-    for i in ids.xreadlines():
+    for i in ids:
         if i == id_nl:
             # FIXME: security email here?
             log.alert("request %s already processed" % id)
index 86f6776f355d7c3452b8593f3b62ca93d31fb652..b4c859944cd447ff4a201336e28e7ae98717f3f3 100644 (file)
@@ -54,7 +54,7 @@ def collect_files(log, basedir = "/home"):
     rx = re.compile(r"^Wrote: (%s.*\.rpm)$" % basedir)
     proc = re.compile(r"^Processing files:.*$")
     files = []
-    for l in reversed(list(f.xreadlines())):
+    for l in reversed(list(f)):
         if proc.match(l):
             break
         m = rx.search(l)
This page took 0.499807 seconds and 4 git commands to generate.