lib/oe/lsb.py: Stop parsing /etc/SuSE-release
PATCH 1/1 lib/oe/lsb.py: Stop parsing /etc/SuSE-release
/etc/SuSE-release should not be parsed to obtain release info
Here is the quote from /etc/SuSE-release:/etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
All recent OpenSUSE versions already have /etc/os-release and oe.lsb/release_dict_file function already parses it.
Current implementation of release_dict_file returns different values when parsing /etc/SuSE-release and /etc/os-release. This is one more advantage of getting rid of parsing /etc/SuSE-release.
--- meta/lib/oe/lsb.py | 8 -------- 1 file changed, 8 deletions(-)
meta/lib/oe/lsb.py +0 -8
@@ -37,14 +37,6 @@ def release_dict_file(): if match: data['DISTRIB_ID'] = match.group(1) data['DISTRIB_RELEASE'] = match.group(2) - elif os.path.exists('/etc/SuSE-release'): - data = {} - data['DISTRIB_ID'] = 'SUSE LINUX' - with open('/etc/SuSE-release') as f: - for line in f: - if line.startswith('VERSION = '): - data['DISTRIB_RELEASE'] = line[10:].rstrip() - break elif os.path.exists('/etc/os-release'): data = {} with open('/etc/os-release') as f:
Signature · 1 line
2.1.4
Hi Ed,
Quoted 6 lines · On Friday 20 March 2015 13:22:50 Ed Bartosh wrote:
/etc/SuSE-releaseshould not be parsed to obtain release infoHere is the quote from
/etc/SuSE-release:/etc/SuSE-releaseis deprecated and will be removed in the future, use/etc/os-releaseinstead
Quoted 6 lines
All recent OpenSUSE versions already have
/etc/os-releaseand oe.lsb/release_dict_file function already parses it.Current implementation of
release_dict_filereturns different values when parsing/etc/SuSE-releaseand/etc/os-release. This is one more advantage of getting rid of parsing/etc/SuSE-release.
How long ago did OpenSuSE start including /etc/os-release? My concern is if someone did happen to run on an older OpenSuSE release and then submit a bug report with an attached log, we'd rather see the actual version rather than "Unknown". If that's a possible scenario, we might want to just swap the blocks around so that /etc/os-release is looked for first.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 16 lines · Paul Eggleton
Hi Ed,
Quoted 6 lines · On Friday 20 March 2015 13:22:50 Ed Bartosh wrote:
/etc/SuSE-releaseshould not be parsed to obtain release infoHere is the quote from
/etc/SuSE-release:/etc/SuSE-releaseis deprecated and will be removed in the future, use/etc/os-releaseinsteadQuoted 6 lines
All recent OpenSUSE versions already have
/etc/os-releaseand oe.lsb/release_dict_file function already parses it.Current implementation of
release_dict_filereturns different values when parsing/etc/SuSE-releaseand/etc/os-release. This is one more advantage of getting rid of parsing/etc/SuSE-release.
Quoted 6 lines
How long ago did OpenSuSE start including
/etc/os-release? My concern is if someone did happen to run on an older OpenSuSE release and then submit a bug report with an attached log, we'd rather see the actual version rather than "Unknown". If that's a possible scenario, we might want to just swap the blocks around so that/etc/os-releaseis looked for first.
I've checked opensuse versions starting from 12.3, which was released 2 years ago and became OOL in Jan 2015. If you think it's not enough I can check 12.2 and 12.1 or swap the blocks as you've suggested.
Regards,
Ed
PATCH 1/1 lib/oe/lsb.py: Prioritize parsing of /etc/os-release
Moved parsing of /etc/os-release before parsing of /etc/SuSE-release as /etc/SuSE-release is deprecated in recent releases of OpenSuSE.
Here is the quote from /etc/SuSE-release:/etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
--- meta/lib/oe/lsb.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
meta/lib/oe/lsb.py +9 -8
@@ -37,14 +37,6 @@ def release_dict_file(): if match: data['DISTRIB_ID'] = match.group(1) data['DISTRIB_RELEASE'] = match.group(2) - elif os.path.exists('/etc/SuSE-release'): - data = {} - data['DISTRIB_ID'] = 'SUSE LINUX' - with open('/etc/SuSE-release') as f: - for line in f: - if line.startswith('VERSION = '): - data['DISTRIB_RELEASE'] = line[10:].rstrip() - break elif os.path.exists('/etc/os-release'): data = {} with open('/etc/os-release') as f:
@@ -53,6 +45,15 @@ def release_dict_file(): data['DISTRIB_ID'] = line[5:].rstrip().strip('"') if line.startswith('VERSION_ID='): data['DISTRIB_RELEASE'] = line[11:].rstrip().strip('"') + elif os.path.exists('/etc/SuSE-release'): + data = {} + data['DISTRIB_ID'] = 'SUSE LINUX' + with open('/etc/SuSE-release') as f: + for line in f: + if line.startswith('VERSION = '): + data['DISTRIB_RELEASE'] = line[10:].rstrip() + break + except IOError: return None return data
Signature · 1 line
2.1.4