file.write(f"{hash} {f_path.relative_to(self._ctx.pkg_dir)}\n")
sign_cmd = self._ctx.sign_cmd
- logger.info("Signing {} file with external command".format(self.CHECKSUM_FILE))
- signed_sum_path = str(sum_path) + '.sign'
- if subprocess.call([sign_cmd, sum_path, signed_sum_path]) != 0:
- logger.warning("Subprocess call to signing command failed!")
+ if sign_cmd is not None:
+ logger.info("Signing {} file with external command".format(self.CHECKSUM_FILE))
+ signed_sum_path = str(sum_path) + '.sign'
+ process = subprocess.Popen([sign_cmd, sum_path, signed_sum_path],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ stdout, stderr = process.communicate()
+ if process.returncode != 0:
+ logger.error("{} error {}:".format(sign_cmd, process.returncode))
+ logger.error("stdout: {}\nstderr: {}".format(stdout.decode('utf8'), stderr.decode('utf8')))
+ raise Exception("Subprocess call to signing command failed!")
def _zip_pkg(self) -> Path:
out_name = self._ctx.out_dir / self._ctx.cfg.name
line = u"{} {}\n".format(hash ,os.path.relpath(f_path, start=str(self._ctx.pkg_dir)))
file.write(line)
sign_cmd = self._ctx.sign_cmd
- logger.info("Signing {} file with external command".format(self.CHECKSUM_FILE))
- signed_sum_path = sum_path + '.sign'
- if subprocess.call([sign_cmd, sum_path, signed_sum_path]) != 0:
- logger.warning("Subprocess call to signing command failed!")
+ if sign_cmd is not None:
+ logger.info("Signing {} file with external command".format(self.CHECKSUM_FILE))
+ signed_sum_path = sum_path + '.sign'
+ process = subprocess.Popen([sign_cmd, sum_path, signed_sum_path],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ stdout, stderr = process.communicate()
+ if process.returncode != 0:
+ logger.error("{} error {}:".format(sign_cmd, process.returncode))
+ logger.error("stdout: {}\nstderr: {}".format(stdout.decode('utf8'), stderr.decode('utf8')))
+ raise Exception("Subprocess call to signing command failed!")
def _zip_pkg(self):
out_name = os.path.join(self._ctx.out_dir, self._ctx.cfg.name)