debrepack: Fixed debver inconsistent issue

When python yaml module loads meta_data.yaml into a dict
with 'yaml.full_load', it discards trailing zeros in the
'debver' that has two digits before the decimal point,
and followed by a trailing zero after the decimal point.
For example, if the 'debver' in meta_data.yaml is '23.10',
the version in debrepack is '23.1' which will cause build
failure.

Test Plan:
Pass: The fix should not impact the normal build
      build-pkgs -a

Pass: Add new package 'mlnx-ofed-kernel_23.10' with 'debver'
      in meta_data.yaml is '23.10':
      build-pkgs -c -p mlnx-ofed-kernel

Closes-bug: 2060436

Change-Id: I33042f1d15440e72ad8a4b33061390f7dbb9bb64
Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
[Cherry pick from https://review.opendev.org/c/starlingx/root/+/915251]
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
This commit is contained in:
Haiqing Bai 2024-04-08 15:16:09 +08:00 committed by Jiping Ma
parent f534e17eb0
commit 4b7b091d44
1 changed files with 2 additions and 0 deletions

View File

@ -237,6 +237,8 @@ class Parser():
if "debver" not in self.meta_data:
self.logger.error("No debver defined in meta_data.yaml")
raise Exception("No debver defined in meta_data.yaml")
self.meta_data['debver'] = str(self.meta_data['debver']).rstrip("@")
self.logger.info("debver in meta_data %s" % self.meta_data["debver"])
if "debname" in self.meta_data:
self.pkginfo["debname"] = self.meta_data["debname"]