diff --git a/lib/worker_multibuild.py b/lib/worker_multibuild.py index 71877f3..7936aaa 100644 --- a/lib/worker_multibuild.py +++ b/lib/worker_multibuild.py @@ -76,19 +76,19 @@ def _get_dockerfile_contents(jobname, os_codename='bionic'): res = "" with open(join(path + jobname), "r") as file: contents = file.read() - # accept any line containing FROM or RUN keywords - # re.match(r"(?m)^(FROM|RUN).*$", contents) - - for i in range(len(contents)): - if re.match(r"(?m)^(FROM|RUN).*$", contents[i]): - res += contents[i] - j = i - while True: - if "\\" in contents[j]: - res += contents[j+1] - j = j + 1 - else: - break + # accept any line containing FROM and RUN keywords + res = "" + inside_allowed_command = False + for line in contents: + if re.match(r"(?m)^(FROM|RUN).*$", line): + inside_allowed_command = True + if inside_allowed_command: + res += line + l = line.strip() + if l.endswith("\\") or l.endswith("\\\n"): + continue + else: + inside_allowed_command = False return res + dockerfile_extra_contents[os_codename] diff --git a/multibuild.py b/multibuild.py index 7687624..07b66e3 100644 --- a/multibuild.py +++ b/multibuild.py @@ -41,7 +41,7 @@ def add_parent_step(build_factory): build_factory.addStep(steps.ShellCommand( name="download worker", - command=["sudo", "wget", "-O", "https://git.bitmessage.org/Bitmessage/buildbot_multibuild/raw/branch/master/lib/worker_multibuild.py", "worker_multibuild.py"] + command=["sudo", "wget", "-O", "https://git.bitmessage.org/Bitmessage/buildbot_multibuild/raw/branch/master/lib/worker_multibuild.py", ".local/bin/worker_multibuild.py"] )) # build_factory.addStep(