From 6d92759a74599478f7be8bee2f3161aae29dfb5e Mon Sep 17 00:00:00 2001 From: Alex Jaramillo Date: Fri, 18 Nov 2016 20:44:18 +0000 Subject: [PATCH] Use check function instead of from_url The check function in pkg_integrity will look for a signature (or sha256 if a gem) inside the folder where a package is processed --- autospec/autospec.py | 2 +- autospec/pkg_integrity.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/autospec/autospec.py b/autospec/autospec.py index 9f2d68b..7bbd97b 100644 --- a/autospec/autospec.py +++ b/autospec/autospec.py @@ -225,7 +225,7 @@ def main(): print("\n") if args.integrity == True: - pkg_integrity.from_url(args.url, build.download_path) + pkg_integrity.check(args.url, build.download_path) while 1: build.package() diff --git a/autospec/pkg_integrity.py b/autospec/pkg_integrity.py index b9f3b58..584d575 100644 --- a/autospec/pkg_integrity.py +++ b/autospec/pkg_integrity.py @@ -146,7 +146,7 @@ class GPGVerifier(Verifier): return True else: msg = "Unable to download file {} http code {}" - print_error(msg.format(self.key_url, code)) + self.print_result(False, msg.format(self.key_url, code)) def verify(self): print("Verifying GPG signature\n") @@ -206,6 +206,9 @@ class GEMShaVerifier(Verifier): def verify(self): gemname = os.path.basename(self.package_path).replace('.gem', '') print("Verifying SHA256 checksum\n") + if os.path.exists(self.package_path) is False: + self.print_result(False, 'GEM was not found {}'.format(self.package_path)) + return name, _ = re.split('-\d+\.', gemname) number = gemname.replace(name + '-', '') geminfo = self.get_rubygems_info(name)