# 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:
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
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
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]
import re
import string
-import xreadlines
from util import *
build_req = []
f = open(spec)
- for l in xreadlines.xreadlines(f):
+ for l in f:
l = string.strip(l)
if l == "%changelog": break
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')
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()
# 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())
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):
# 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
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):
# 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:
import re
import types
import string
-import xreadlines
from chroot import *
from util import *
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:
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)
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
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)
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)