Validate branch overrides to ensure they are correct/accurate

This commit is contained in:
Waqar Ahmed
2021-04-23 04:18:33 +05:00
committed by Waqar Ahmed
parent 72517b7283
commit 8b3f2c1f68
5 changed files with 20 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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',
}
)

View File

@@ -14,8 +14,6 @@ WANTED_PACKAGES = {
'make',
'debootstrap',
'git',
'xorriso',
'grub-mkrescue',
'mksquashfs',
'unzip',
}