From 8b3f2c1f68efe1d8029e3694b74e1778155ba1f0 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 23 Apr 2021 04:18:33 +0500 Subject: [PATCH] Validate branch overrides to ensure they are correct/accurate --- README.md | 2 +- scale_build/checkout.py | 8 +++++--- scale_build/main.py | 13 +++++++++++++ scale_build/packages/build.py | 2 +- scale_build/preflight.py | 2 -- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e1f47f3..e1d3bab 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ In addition to the host, you will want to pre-install the following packages: * squashfs-tools * unzip -``` % sudo apt install build-essential debootstrap git grub-pc-bin squashfs-tools unzip xorriso``` +``` % sudo apt install build-essential debootstrap git grub-pc-bin squashfs-tools unzip``` ## Usage diff --git a/scale_build/checkout.py b/scale_build/checkout.py index 5ae4988..944bf36 100644 --- a/scale_build/checkout.py +++ b/scale_build/checkout.py @@ -24,13 +24,15 @@ def checkout_sources(): # but need to test building of a series of repos with the same experimental branch # if TRY_BRANCH_OVERRIDE: - retries = 2 - while retries: + while True: try: if branch_exists_in_repository(package.origin, TRY_BRANCH_OVERRIDE): gh_override = TRY_BRANCH_OVERRIDE except CallError: - retries -= 1 + logger.debug( + 'Failed to determine if %r branch exists for %r. Trying again', + TRY_BRANCH_OVERRIDE, package.origin + ) else: break diff --git a/scale_build/main.py b/scale_build/main.py index fe1d52b..91e85fe 100644 --- a/scale_build/main.py +++ b/scale_build/main.py @@ -5,11 +5,14 @@ import sys from .checkout import checkout_sources from .clean import complete_cleanup +from .config import BRANCH_OVERRIDES from .epoch import check_epoch +from .exceptions import CallError from .iso import build_iso from .package import build_packages from .preflight import preflight_check from .update_image import build_update_image +from .utils.manifest import get_manifest logger = logging.getLogger(__name__) @@ -25,6 +28,16 @@ def setup_logging(): logger.addHandler(handler) +def validate_config(): + manifest = get_manifest() + packages = [p['name'] for p in manifest['sources']] + invalid_overrides = [o for o in BRANCH_OVERRIDES if o not in packages] + if invalid_overrides: + raise CallError( + f'Invalid branch override(s) provided: {", ".join(invalid_overrides)!r} sources not configured in manifest' + ) + + def main(): setup_logging() preflight_check() diff --git a/scale_build/packages/build.py b/scale_build/packages/build.py index 4acecb2..dc0843d 100644 --- a/scale_build/packages/build.py +++ b/scale_build/packages/build.py @@ -19,7 +19,7 @@ class BuildPackageMixin: exception_msg=exception_message, env={ **os.environ, **APT_ENV, - 'CONFIG_DEBUG_INFO': 'N', # Build kernel with debug symbols + 'CONFIG_DEBUG_INFO': 'Y', # Build kernel with debug symbols 'CONFIG_LOCALVERSION': '+truenas', } ) diff --git a/scale_build/preflight.py b/scale_build/preflight.py index e34b459..9d4ecea 100644 --- a/scale_build/preflight.py +++ b/scale_build/preflight.py @@ -14,8 +14,6 @@ WANTED_PACKAGES = { 'make', 'debootstrap', 'git', - 'xorriso', - 'grub-mkrescue', 'mksquashfs', 'unzip', }