- subprocess.check_call(cmd, stdout=sys.stderr, stderr=sys.stderr,
- env={'LC_ALL': 'C.UTF-8'}, timeout=600)
-
-def diff(diffdir_org, diffdir, builddir, output):
+ try:
+ res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True,
+ env={'LC_ALL': 'C.UTF-8'}, timeout=600)
+ except subprocess.CalledProcessError as err:
+ logging.error("unpacking exited with status code %d." % err.returncode)
+ logging.error("STDOUT:")
+ if err.stdout:
+ for line in err.stdout.decode('utf-8').split("\n"):
+ logging.error(line)
+ logging.error("STDERR:")
+ if err.stderr:
+ for line in err.stderr.decode('utf-8').split("\n"):
+ logging.error(line)
+ raise
+ else:
+ logging.debug("unpacking exited with status code %d." % res.returncode)
+ logging.debug("STDOUT/STDERR:")
+ if res.stdout:
+ for line in res.stdout.decode('utf-8').split("\n"):
+ logging.debug(line)
+
+
+def patch_comment_get(patch):
+ patch_comment = ""
+ with open(patch, 'rt') as f:
+ for line in f:
+ if line.startswith('diff ') or line.startswith('--- '):
+ break
+ patch_comment += line
+ return patch_comment
+
+def diff(diffdir_org, diffdir, builddir, patch_comment, output):