From f0aa57ba24853d4f69012cf8af0f254c9096e46b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 19 Jun 2011 19:02:05 +0100 Subject: Add simple dependency mechanism, and ignore lintian exit code. --- unperish | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/unperish b/unperish index 2ca50dc..44ba511 100755 --- a/unperish +++ b/unperish @@ -62,8 +62,14 @@ class Unperish(cliapp.Application): self.read_meta() self.create_build_area() - cmd_methods = self._subcommands() + self.already = set() for arg in args: + self.run_subcommand(arg) + + def run_subcommand(self, subcommand): + if subcommand not in self.already: + self.already.add(subcommand) + try: with open(self.join(self.dirname, 'debian', 'control')) as f: self.debian_control = debian.deb822.Deb822(f) @@ -76,14 +82,15 @@ class Unperish(cliapp.Application): except IOError: pass - method = self._normalize_cmd(arg) + cmd_methods = self._subcommands() + method = self._normalize_cmd(subcommand) if method in cmd_methods: if self.settings['verbose']: - self.output.write('command: %s\n' % arg) + self.output.write('command: %s\n' % subcommand) if not self.settings['no-act']: getattr(self, method)([]) else: - raise cliapp.AppException('unknown command %s' % arg) + raise cliapp.AppException('unknown command %s' % subcommand) def create_build_area(self): if not os.path.exists(self.settings['build-area']): @@ -150,16 +157,21 @@ class Unperish(cliapp.Application): def cmd_dch(self, args): '''Add a debian/changelog entry for new upload target.''' + self.run_subcommand('export') if self.settings['upload-target']: self.add_debian_changelog_entry() def cmd_dsc(self, args): '''Create Debian source package (.dsc) in build area.''' + self.run_subcommand('export') + self.run_subcommand('dch') + self.run_subcommand('debian-tarball') self.runcmd(['dpkg-source', '-b', self.dirname], cwd=self.settings['build-area']) def cmd_deb(self, args): '''Build Debian binary packages (.deb) in build area.''' + self.run_subcommand('dsc') pat = '%s_%s.dsc' % (self.debian_source_package, self.debian_version) dsc = glob.glob(self.join(pat))[0] argv = ['sudo', @@ -184,7 +196,7 @@ class Unperish(cliapp.Application): if not files: files = find_them(['.deb', '.dsc']) - out = self.runcmd(['lintian', '-i'] + files, + out = self.runcmd(['lintian', '-i'] + files, ignore_fail=True, cwd=self.settings['build-area']) self.output.write(out) -- cgit v1.2.1