Skip to content

Commit beead0a

Browse files
authored
[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.
1 parent 8e64284 commit beead0a

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

scripts/prepare_slave_container_buildinfo.sh

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ sudo dpkg -i --force-overwrite $SLAVE_DIR/buildinfo/sonic-build-hooks_*.deb > /d
1010
# Enable the build hooks
1111
symlink_build_hooks
1212

13+
# Enable reproducible mirrors
14+
set_reproducible_mirrors
15+
apt-get update > /dev/null 2>&1
16+
1317
# Build the slave running config
1418
cp -rf $SLAVE_DIR/buildinfo/* /usr/local/share/buildinfo/
1519
. /usr/local/share/buildinfo/scripts/buildinfo_base.sh

scripts/versions_manager.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,20 @@ def overwrite(self, module, for_all_dist=False, for_all_arch=False):
174174
self.components.append(tmp_component)
175175
self.adjust()
176176

177-
def get_config_module(self, default_module, dist, arch):
177+
def get_config_module(self, source_path, dist, arch):
178178
if self.is_individule_version():
179179
return self
180+
default_module_path = VersionModule.get_module_path_by_name(source_path, DEFAULT_MODULE)
181+
default_module = VersionModule()
182+
default_module.load(default_module_path, filter_dist=dist, filter_arch=arch)
180183
module = default_module
181-
if not self.is_aggregatable_module(self.name):
184+
if self.name == 'host-image':
185+
base_module_path = VersionModule.get_module_path_by_name(source_path, 'host-base-image')
186+
base_module = VersionModule()
187+
base_module.load(base_module_path, filter_dist=dist, filter_arch=arch)
188+
module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS)
189+
module.overwrite(base_module, True, True)
190+
elif not self.is_aggregatable_module(self.name):
182191
module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS)
183192
return self._get_config_module(module, dist, arch)
184193

@@ -661,10 +670,7 @@ def generate(self):
661670
os.makedirs(args.target_path)
662671
module = VersionModule()
663672
module.load(module_path, filter_dist=args.distribution, filter_arch=args.architecture)
664-
default_module_path = VersionModule.get_module_path_by_name(args.source_path, DEFAULT_MODULE)
665-
default_module = VersionModule()
666-
default_module.load(default_module_path, filter_dist=args.distribution, filter_arch=args.architecture)
667-
config = module.get_config_module(default_module, args.distribution, args.architecture)
673+
config = module.get_config_module(args.source_path, args.distribution, args.architecture)
668674
config.clean_info(force=True)
669675
config.dump(args.target_path, config=True, priority=args.priority)
670676

0 commit comments

Comments
 (0)