diff options
author | jmbills <jason.m.bills@intel.com> | 2022-01-18 21:55:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 21:55:05 +0300 |
commit | 7cf0c1cd0ce835d1833509b7b911e8a97380278b (patch) | |
tree | 0b45c3beaa9874facc4ed1a2395a31e42be0135d /meta-phosphor/classes/image_version.bbclass | |
parent | 4dac5fcd49b5e2de1074f1363775ec0f19041072 (diff) | |
parent | 1fc0d70f658da30091bcd49f9bf29aecd6b99ba7 (diff) | |
download | openbmc-1-0.86.tar.xz |
Merge pull request #76 from Intel-BMC/update1-0.86
Update
Diffstat (limited to 'meta-phosphor/classes/image_version.bbclass')
-rw-r--r-- | meta-phosphor/classes/image_version.bbclass | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/meta-phosphor/classes/image_version.bbclass b/meta-phosphor/classes/image_version.bbclass index 56ebe665c..17f324e2e 100644 --- a/meta-phosphor/classes/image_version.bbclass +++ b/meta-phosphor/classes/image_version.bbclass @@ -7,7 +7,7 @@ def do_get_version(d): import io path = d.getVar('STAGING_DIR_TARGET', True) + d.getVar('sysconfdir', True) path = os.path.join(path, 'os-release') - parser = configparser.SafeConfigParser(strict=False) + parser = configparser.ConfigParser(strict=False) parser.optionxform = str version = '' try: @@ -26,3 +26,21 @@ def do_get_versionID(d): version = version.strip('"') version_id = (hashlib.sha512(version.encode('utf-8')).hexdigest())[:8] return version_id + +def do_get_buildID(d): + import configparser + import io + path = d.getVar('STAGING_DIR_TARGET', True) + d.getVar('sysconfdir', True) + path = os.path.join(path, 'os-release') + parser = configparser.ConfigParser(strict=False) + parser.optionxform = str + build_id = '' + try: + with open(path, 'r') as fd: + buf = '[root]\n' + fd.read() + fd = io.StringIO(buf) + parser.readfp(fd) + build_id = parser['root']['BUILD_ID'] + except: + pass + return build_id |