From 49054bcb324c0bdd5916ad360bf500db9d9be508 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Thu, 14 Jan 2021 15:37:48 -0600 Subject: phosphor-ipmi-config: Handle an empty commit number The VERSION_ID may not have a commit number for the cases a tag is created, ex: 2.10.1. Since the code is expecting a commit number of 1-4 digits, use a '0' if no commit number exists. Tested: Created a tag 2.10.99 which sets VERSION_ID=2.10.99. Without this change, build fails with: "Exception: IndexError: list index out of range" With this change there are no build errors. Change-Id: I3b56ebc1844ec6748b92cca3484f9aa1f4d983f8 Signed-off-by: Adriana Kobylak --- meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend index e3e5002bb..7898a1039 100644 --- a/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend +++ b/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend @@ -22,14 +22,18 @@ python do_patch_ibm-ac-server() { from shutil import copyfile version_id = do_get_version(d) - # count from the commit version + # count from the commit version, minimum of one digit count = re.findall("-(\d{1,4})-", version_id) + if count: + commit = count[0] + else: + commit = "0" release = re.findall("-r(\d{1,4})", version_id) if release: - auxVer = count[0] + "{0:0>4}".format(release[0]) + auxVer = commit + "{0:0>4}".format(release[0]) else: - auxVer = count[0] + "0000" + auxVer = commit + "0000" workdir = d.getVar('WORKDIR', True) file = os.path.join(workdir, 'dev_id.json') -- cgit v1.2.3