mirror of
https://github.com/truenas/scale-build.git
synced 2025-12-20 02:49:28 +00:00
Validate branch overrides to ensure they are correct/accurate
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
)
|
||||
|
||||
@@ -14,8 +14,6 @@ WANTED_PACKAGES = {
|
||||
'make',
|
||||
'debootstrap',
|
||||
'git',
|
||||
'xorriso',
|
||||
'grub-mkrescue',
|
||||
'mksquashfs',
|
||||
'unzip',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user