mirror of
https://github.com/truenas/scale-build.git
synced 2025-12-24 13:00:20 +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
|
* squashfs-tools
|
||||||
* unzip
|
* 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
|
## Usage
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,15 @@ def checkout_sources():
|
|||||||
# but need to test building of a series of repos with the same experimental branch
|
# but need to test building of a series of repos with the same experimental branch
|
||||||
#
|
#
|
||||||
if TRY_BRANCH_OVERRIDE:
|
if TRY_BRANCH_OVERRIDE:
|
||||||
retries = 2
|
while True:
|
||||||
while retries:
|
|
||||||
try:
|
try:
|
||||||
if branch_exists_in_repository(package.origin, TRY_BRANCH_OVERRIDE):
|
if branch_exists_in_repository(package.origin, TRY_BRANCH_OVERRIDE):
|
||||||
gh_override = TRY_BRANCH_OVERRIDE
|
gh_override = TRY_BRANCH_OVERRIDE
|
||||||
except CallError:
|
except CallError:
|
||||||
retries -= 1
|
logger.debug(
|
||||||
|
'Failed to determine if %r branch exists for %r. Trying again',
|
||||||
|
TRY_BRANCH_OVERRIDE, package.origin
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ import sys
|
|||||||
|
|
||||||
from .checkout import checkout_sources
|
from .checkout import checkout_sources
|
||||||
from .clean import complete_cleanup
|
from .clean import complete_cleanup
|
||||||
|
from .config import BRANCH_OVERRIDES
|
||||||
from .epoch import check_epoch
|
from .epoch import check_epoch
|
||||||
|
from .exceptions import CallError
|
||||||
from .iso import build_iso
|
from .iso import build_iso
|
||||||
from .package import build_packages
|
from .package import build_packages
|
||||||
from .preflight import preflight_check
|
from .preflight import preflight_check
|
||||||
from .update_image import build_update_image
|
from .update_image import build_update_image
|
||||||
|
from .utils.manifest import get_manifest
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -25,6 +28,16 @@ def setup_logging():
|
|||||||
logger.addHandler(handler)
|
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():
|
def main():
|
||||||
setup_logging()
|
setup_logging()
|
||||||
preflight_check()
|
preflight_check()
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class BuildPackageMixin:
|
|||||||
exception_msg=exception_message, env={
|
exception_msg=exception_message, env={
|
||||||
**os.environ,
|
**os.environ,
|
||||||
**APT_ENV,
|
**APT_ENV,
|
||||||
'CONFIG_DEBUG_INFO': 'N', # Build kernel with debug symbols
|
'CONFIG_DEBUG_INFO': 'Y', # Build kernel with debug symbols
|
||||||
'CONFIG_LOCALVERSION': '+truenas',
|
'CONFIG_LOCALVERSION': '+truenas',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ WANTED_PACKAGES = {
|
|||||||
'make',
|
'make',
|
||||||
'debootstrap',
|
'debootstrap',
|
||||||
'git',
|
'git',
|
||||||
'xorriso',
|
|
||||||
'grub-mkrescue',
|
|
||||||
'mksquashfs',
|
'mksquashfs',
|
||||||
'unzip',
|
'unzip',
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user