Support extra repositories flag.

This commit is contained in:
Jelmer Vernooij 2021-04-03 00:38:37 +01:00
parent 90f740fd4a
commit c20a26999a
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8
2 changed files with 11 additions and 2 deletions

View file

@ -175,6 +175,7 @@ def build(
distribution=None, distribution=None,
subpath="", subpath="",
source_date_epoch=None, source_date_epoch=None,
extra_repositories=None,
): ):
args = [ args = [
sys.executable, sys.executable,
@ -193,6 +194,8 @@ def build(
env["DISTRIBUTION"] = distribution env["DISTRIBUTION"] = distribution
if source_date_epoch is not None: if source_date_epoch is not None:
env["SOURCE_DATE_EPOCH"] = "%d" % source_date_epoch env["SOURCE_DATE_EPOCH"] = "%d" % source_date_epoch
for repo in extra_repositories or []:
build_command += " --extra-repository=" + shlex.quote(repo)
logging.info("Building debian packages, running %r.", build_command) logging.info("Building debian packages, running %r.", build_command)
try: try:
subprocess.check_call( subprocess.check_call(
@ -209,6 +212,7 @@ def build_once(
build_command, build_command,
subpath="", subpath="",
source_date_epoch=None, source_date_epoch=None,
extra_repositories=None
): ):
build_log_path = os.path.join(output_directory, "build.log") build_log_path = os.path.join(output_directory, "build.log")
try: try:
@ -221,6 +225,7 @@ def build_once(
distribution=build_suite, distribution=build_suite,
subpath=subpath, subpath=subpath,
source_date_epoch=source_date_epoch, source_date_epoch=source_date_epoch,
extra_repositories=extra_repositories,
) )
except BuildFailedError as e: except BuildFailedError as e:
with open(build_log_path, "rb") as f: with open(build_log_path, "rb") as f:
@ -260,7 +265,8 @@ def attempt_build(
build_changelog_entry=None, build_changelog_entry=None,
subpath="", subpath="",
source_date_epoch=None, source_date_epoch=None,
run_gbp_dch=False run_gbp_dch=False,
extra_repositories=None
): ):
"""Attempt a build, with a custom distribution set. """Attempt a build, with a custom distribution set.
@ -288,4 +294,5 @@ def attempt_build(
build_command, build_command,
subpath, subpath,
source_date_epoch=source_date_epoch, source_date_epoch=source_date_epoch,
extra_repositories=extra_repositories,
) )

View file

@ -523,6 +523,7 @@ def build_incrementally(
subpath="", subpath="",
source_date_epoch=None, source_date_epoch=None,
update_changelog=True, update_changelog=True,
extra_repositories=None,
fixers=None fixers=None
): ):
fixed_errors = [] fixed_errors = []
@ -542,7 +543,8 @@ def build_incrementally(
build_changelog_entry, build_changelog_entry,
subpath=subpath, subpath=subpath,
source_date_epoch=source_date_epoch, source_date_epoch=source_date_epoch,
run_gbp_dch=(update_changelog is False) run_gbp_dch=(update_changelog is False),
extra_repositories=extra_repositories,
) )
except UnidentifiedDebianBuildError: except UnidentifiedDebianBuildError:
logging.warning("Build failed with unidentified error. Giving up.") logging.warning("Build failed with unidentified error. Giving up.")