Improve deb-fix-build.

This commit is contained in:
Jelmer Vernooij 2021-03-01 01:20:06 +00:00
parent fb41c93e82
commit 94d98b244d
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8

View file

@ -498,6 +498,9 @@ class SimpleBuildFixer(BuildFixer):
self._problem_cls = problem_cls self._problem_cls = problem_cls
self._fn = fn self._fn = fn
def __repr__(self):
return "%s(%r, %r)" % (type(self).__name__, self._problem_cls, self._fn)
def can_fix(self, problem): def can_fix(self, problem):
return isinstance(problem, self._problem_cls) return isinstance(problem, self._problem_cls)
@ -533,7 +536,7 @@ def build_incrementally(
build_suite, build_suite,
output_directory, output_directory,
build_command, build_command,
build_changelog_entry="Build for debian-janitor apt repository.", build_changelog_entry,
committer=None, committer=None,
max_iterations=DEFAULT_MAX_ITERATIONS, max_iterations=DEFAULT_MAX_ITERATIONS,
subpath="", subpath="",
@ -658,19 +661,30 @@ def main(argv=None):
from breezy.workingtree import WorkingTree from breezy.workingtree import WorkingTree
from .apt import AptManager from .apt import AptManager
from ..session.plain import PlainSession from ..session.plain import PlainSession
import tempfile
import contextlib
apt = AptManager(PlainSession()) apt = AptManager(PlainSession())
tree = WorkingTree.open(".") logging.basicConfig(level=logging.INFO)
build_incrementally(
tree, with contextlib.ExitStack() as es:
apt, if args.output_directory is None:
args.suffix, output_directory = es.enter_context(tempfile.TemporaryDirectory())
args.suite, logging.info('Using output directory %s', output_directory)
args.output_directory, else:
args.build_command, output_directory = args.output_directory
committer=args.committer,
update_changelog=args.update_changelog, tree = WorkingTree.open(".")
) build_incrementally(
tree,
apt,
args.suffix,
args.suite,
output_directory,
args.build_command,
committer=args.committer,
update_changelog=args.update_changelog,
)
if __name__ == "__main__": if __name__ == "__main__":