Allow patching mkimage-profiles
This commit is contained in:
parent
217e0b240a
commit
e8130b4a17
@ -38,6 +38,10 @@ def parse_args():
|
||||
'--key',
|
||||
help='gpg key to sign',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--patch-mp-prog',
|
||||
help='program to change mkimage-profiles code',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--remote',
|
||||
help='remote to sync images',
|
||||
@ -104,7 +108,7 @@ def main():
|
||||
if args.force_rebuild:
|
||||
config_override['rebuild_after'] = {'days': 0}
|
||||
|
||||
for arg in ['key', 'remote']:
|
||||
for arg in ['key', 'remote', 'patch_mp_prog']:
|
||||
args_to_override(arg)
|
||||
|
||||
cb = cloud_build.CB(
|
||||
|
@ -216,6 +216,9 @@ class CB:
|
||||
msg = f'Could not read config file `{e.filename}`: {e.strerror}'
|
||||
raise Error(msg)
|
||||
|
||||
def get_overrided(key):
|
||||
return cfg.get(key, override.get(key))
|
||||
|
||||
def lazy_get_raises(key):
|
||||
if key in override:
|
||||
return override[key]
|
||||
@ -233,6 +236,12 @@ class CB:
|
||||
|
||||
self._image_repo = cfg.get('image_repo')
|
||||
|
||||
self.patch_mp_prog = get_overrided('patch_mp_prog')
|
||||
if (patch_mp_prog := self.patch_mp_prog) is not None:
|
||||
self.patch_mp_prog = self.expand_path(
|
||||
Path(patch_mp_prog)
|
||||
).absolute().as_posix()
|
||||
|
||||
self.try_build_all = cfg.get('try_build_all', False)
|
||||
|
||||
self.no_delete = cfg.get('no_delete', True)
|
||||
@ -394,6 +403,10 @@ Dir::Etc::preferencesparts "/var/empty";
|
||||
def escape_branch(self, branch: str) -> str:
|
||||
return re.sub(r'\.', '_', branch)
|
||||
|
||||
def patch_mp(self):
|
||||
if (patch_mp_prog := self.patch_mp_prog) is not None:
|
||||
self.call([patch_mp_prog])
|
||||
|
||||
def ensure_mkimage_profiles(self) -> None:
|
||||
"""Checks that mkimage-profiles exists or clones it"""
|
||||
|
||||
@ -418,6 +431,7 @@ Dir::Etc::preferencesparts "/var/empty";
|
||||
|
||||
# create file with proper brandings
|
||||
with self.pushd('mkimage-profiles'):
|
||||
self.patch_mp()
|
||||
with open(f'conf.d/{PROG}.mk', 'w') as f:
|
||||
for image in self.images:
|
||||
target = self.target_by_image(image)
|
||||
|
@ -184,6 +184,7 @@ class Call():
|
||||
'make': make,
|
||||
'gpg2': gpg,
|
||||
'rsync': rsync,
|
||||
'/bin/true': SUBPROCESS_CALL,
|
||||
DEFAULT: error_call,
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ log_level: debug
|
||||
|
||||
external_files: /tmp/cloud-build/external_files
|
||||
|
||||
patch_mp_prog: /bin/true
|
||||
|
||||
bad_arches:
|
||||
- armh
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user