diff options
Diffstat (limited to 'meta-phosphor')
-rw-r--r-- | meta-phosphor/classes/image_types_phosphor.bbclass | 2 | ||||
-rw-r--r-- | meta-phosphor/classes/image_version.bbclass | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass index be3bbdf50a..64fec000ba 100644 --- a/meta-phosphor/classes/image_types_phosphor.bbclass +++ b/meta-phosphor/classes/image_types_phosphor.bbclass @@ -502,11 +502,13 @@ def get_pubkey_path(d): python do_generate_phosphor_manifest() { purpose = d.getVar('VERSION_PURPOSE', True) version = do_get_version(d) + build_id = do_get_buildID(d) target_machine = d.getVar('MACHINE', True) extended_version = (d.getVar('EXTENDED_VERSION', True) or "") with open('MANIFEST', 'w') as fd: fd.write('purpose={}\n'.format(purpose)) fd.write('version={}\n'.format(version.strip('"'))) + fd.write('BuildId={}\n'.format(build_id.strip('"'))) fd.write('ExtendedVersion={}\n'.format(extended_version)) fd.write('KeyType={}\n'.format(get_pubkey_type(d))) fd.write('HashType=RSA-SHA256\n') diff --git a/meta-phosphor/classes/image_version.bbclass b/meta-phosphor/classes/image_version.bbclass index bf3ca9345d..17f324e2e4 100644 --- a/meta-phosphor/classes/image_version.bbclass +++ b/meta-phosphor/classes/image_version.bbclass @@ -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 |