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 <anoo@us.ibm.com>
diff --git a/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
index e3e5002..7898a10 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 @@
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')