From: Arkadiusz Miƛkiewicz Date: Sat, 5 Dec 2015 09:36:03 +0000 (+0100) Subject: Process log from end and stop at first 'Processing files' occurence. Fixes case when... X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=7a454cb55b6be6275ee008d1ec6000462817d38c;p=projects%2Fpld-builder.new.git Process log from end and stop at first 'Processing files' occurence. Fixes case when it incorrectly found 'Wote: xyz' (and tried to copy to ftp) files from %build or %install section (for example python3 builds own small rpm packages in distutils test). --- diff --git a/PLD_Builder/util.py b/PLD_Builder/util.py index 9051878..b623115 100644 --- a/PLD_Builder/util.py +++ b/PLD_Builder/util.py @@ -52,8 +52,11 @@ def clean_tmp(dir): def collect_files(log, basedir = "/home"): f = open(log, 'r') 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))