def test_audit_no_signature(self): if not Click.find_on_path("debsig-verify"): self.skipTest("this test needs debsig-verify") path = self.make_fake_package(control_fields={"Click-Version": "0.4"}, manifest={ "name": "test-package", "version": "1.0", "framework": "", }) self.debsig_patcher.stop() self.assertRaisesRegex(ClickInstallerAuditError, "Signature verification error", ClickInstaller(self.db).audit, path) self.debsig_patcher.start()
def run(argv): parser = OptionParser("%prog build [options] DIRECTORY") parser.add_option( "-m", "--manifest", metavar="PATH", default="manifest.json", help="read package manifest from PATH (default: manifest.json)") parser.add_option( "--no-validate", action="store_false", default=True, dest="validate", help="Don't run click-reviewers-tools check on resulting .click") parser.add_option( "-I", "--ignore", metavar="file-pattern", action='append', default=[], help="Ignore the given pattern when building the package") options, args = parser.parse_args(argv) if len(args) < 1: parser.error("need directory") directory = args[0] if not os.path.isdir(directory): parser.error('directory "%s" does not exist' % directory) if os.path.isdir(os.path.join(directory, options.manifest)): options.manifest = os.path.join(options.manifest, "manifest.json") if not os.path.exists(os.path.join(directory, options.manifest)): parser.error( 'directory "%s" does not contain manifest file "%s"' % (directory, options.manifest)) builder = ClickBuilder() builder.add_file(directory, "./") for ignore in options.ignore: builder.add_ignore_pattern(ignore) try: path = builder.build(".", manifest_path=options.manifest) except ClickBuildError as e: print(e, file=sys.stderr) return 1 if options.validate and Click.find_on_path('click-review'): print("Now executing: click-review %s" % path) try: subprocess.check_call(['click-review', path]) except subprocess.CalledProcessError: # qtcreator-plugin-ubuntu relies on return code 0 # to establish if a .click package has been built # at all. # # If we want to distinguish between # - click build failed # - click build succeeded, but validation failed # both tools will have to learn this at the same # time. pass print("Successfully built package in '%s'." % path) return 0
def available(cls): return Click.find_on_path("debsig-verify")