[Build]: Fix host image debian package version issue (#10358)

Why I did it
Fix host image debian package version issue.
The package dependencies may have issue, when some of debian packages of the base image are upgraded. For example, libc is installed in base image, but if the mirror has new version, when running "apt-get upgrade", the package will be upgraded unexpected. To avoid such issue, need to add the versions when building the host image.

How I did it
The package versions of host-image should contain host-base-image.
This commit is contained in:
xumia 2022-03-29 12:34:46 +08:00 committed by GitHub
parent 8e642848c2
commit beead0a6cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -10,6 +10,10 @@ sudo dpkg -i --force-overwrite $SLAVE_DIR/buildinfo/sonic-build-hooks_*.deb > /d
# Enable the build hooks
symlink_build_hooks
# Enable reproducible mirrors
set_reproducible_mirrors
apt-get update > /dev/null 2>&1
# Build the slave running config
cp -rf $SLAVE_DIR/buildinfo/* /usr/local/share/buildinfo/
. /usr/local/share/buildinfo/scripts/buildinfo_base.sh

View File

@ -174,11 +174,20 @@ class VersionModule:
self.components.append(tmp_component)
self.adjust()
def get_config_module(self, default_module, dist, arch):
def get_config_module(self, source_path, dist, arch):
if self.is_individule_version():
return self
default_module_path = VersionModule.get_module_path_by_name(source_path, DEFAULT_MODULE)
default_module = VersionModule()
default_module.load(default_module_path, filter_dist=dist, filter_arch=arch)
module = default_module
if not self.is_aggregatable_module(self.name):
if self.name == 'host-image':
base_module_path = VersionModule.get_module_path_by_name(source_path, 'host-base-image')
base_module = VersionModule()
base_module.load(base_module_path, filter_dist=dist, filter_arch=arch)
module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS)
module.overwrite(base_module, True, True)
elif not self.is_aggregatable_module(self.name):
module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS)
return self._get_config_module(module, dist, arch)
@ -661,10 +670,7 @@ class VersionManagerCommands:
os.makedirs(args.target_path)
module = VersionModule()
module.load(module_path, filter_dist=args.distribution, filter_arch=args.architecture)
default_module_path = VersionModule.get_module_path_by_name(args.source_path, DEFAULT_MODULE)
default_module = VersionModule()
default_module.load(default_module_path, filter_dist=args.distribution, filter_arch=args.architecture)
config = module.get_config_module(default_module, args.distribution, args.architecture)
config = module.get_config_module(args.source_path, args.distribution, args.architecture)
config.clean_info(force=True)
config.dump(args.target_path, config=True, priority=args.priority)