Pass BRANDIG to make command instead of file

This commit is contained in:
Mikhail Gordeev 2022-05-27 01:55:49 +03:00
parent 4c87afca39
commit 605d7a6a82

View File

@ -432,10 +432,6 @@ Dir::Etc::preferencesparts "/var/empty";
prerequisites_s = ' '.join(prerequisites) prerequisites_s = ' '.join(prerequisites)
recipes = [] recipes = []
branding = self.branding(image, branch)
if branding:
branding = f'\n\t@$(call set,BRANDING,{branding})'
recipes.append(branding)
for package in self.packages(image, branch): for package in self.packages(image, branch):
recipes.append( recipes.append(
@ -589,11 +585,14 @@ Dir::Etc::preferencesparts "/var/empty";
return items return items
def branding(self, image: str, branch: str) -> str: def branding(self, image: str, branch: str) -> Optional[str]:
if (image_branding := self._images[image].get('branding')) is not None: if (image_branding := self._images[image].get('branding')) is not None:
return image_branding if image_branding.lower() == 'none':
return None
else:
return image_branding
return self._branches[branch].get('branding', '') return self._branches[branch].get('branding')
def packages(self, image: str, branch: str) -> List[str]: def packages(self, image: str, branch: str) -> List[str]:
image_packages = self._images[image].get('packages', []) image_packages = self._images[image].get('packages', [])
@ -639,6 +638,7 @@ Dir::Etc::preferencesparts "/var/empty";
def build_tarball( def build_tarball(
self, self,
target: str, target: str,
branding: Optional[str],
branch: str, branch: str,
arch: str, arch: str,
kind: str, kind: str,
@ -664,6 +664,8 @@ Dir::Etc::preferencesparts "/var/empty";
f'IMAGE_OUTDIR={self.out_dir}', f'IMAGE_OUTDIR={self.out_dir}',
f'IMAGE_OUTFILE={tarball_name}', f'IMAGE_OUTFILE={tarball_name}',
] ]
if branding is not None:
cmd.append(f'BRANDING={branding}')
if image_repo is not None: if image_repo is not None:
cmd.append(f'REPO={image_repo}') cmd.append(f'REPO={image_repo}')
if size is not None: if size is not None:
@ -755,6 +757,7 @@ Dir::Etc::preferencesparts "/var/empty";
continue continue
self.ensure_scripts(image) self.ensure_scripts(image)
target = self.target_by_image(image) target = self.target_by_image(image)
branding = self.branding(image, branch)
for arch in self.arches_by_branch(branch): for arch in self.arches_by_branch(branch):
if self.skip_arch(image, arch): if self.skip_arch(image, arch):
continue continue
@ -762,7 +765,7 @@ Dir::Etc::preferencesparts "/var/empty";
for kind in self.kinds_by_image(image): for kind in self.kinds_by_image(image):
size = self.size_by_image(image) size = self.size_by_image(image)
tarball = self.build_tarball( tarball = self.build_tarball(
target, branch, arch, kind, size target, branding, branch, arch, kind, size
) )
if tarball is None: if tarball is None:
continue continue