scripts/autobuild-run: create host-distro file
PATCH 1/1 scripts/autobuild-run: create host-distro file
Sometime autobuilder failures occure only on a specific distribution. To ease the research for the maintainer/developers add a file with that information to the result archive.
The distribution information comes from '/etc/os-release' and the PRETTY_NAME value is used from This file. This seems to be present on the most common distros:
Debian: https://manpages.debian.org/testing/manpages-de/os-release.5.de.html
Ubuntu: http://manpages.ubuntu.com/manpages/bionic/man5/os-release.5.html
Red Red: https://www.freedesktop.org/software/systemd/man/os-release.html
Open-Suse: https://en.opensuse.org/SDB:Find_openSUSE_version
--- scripts/autobuild-run | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
scripts/autobuild-run +22 -0
@@ -699,6 +699,28 @@ class Builder: with open(os.path.join(self.resultdir, "submitter"), "w+") as submitterf: submitterf.write(self.submitter) + def get_host_distro_info(): + """Get the host os distribution info. + + Try to get the host os release description from '/etc/os-release'. + """ + try: + with open("/etc/os-release") as releasef: + regexp = re.compile(r'PRETTY_NAME="(.*)"') + for line in releasef.readlines(): + m = regexp.search(line) + if m: + return m.group(1) + except IOError: + pass + + return "unknown" + + host_distro_info = get_host_distro_info() + + with open(os.path.join(self.resultdir, "host-distro"), "w+") as distrof: + distrof.write(host_distro_info) + # Yes, shutil.make_archive() would be nice, but it doesn't exist # in Python 2.6. ret = subprocess.call(["tar", "cjf", "results.tar.bz2", "results"],
Signature · 1 line
2.20.1
PATCH 1/1 scripts/autobuild-run: create host-distro file
Heiko, All,
On 2020-09-11 14:55 +0200, Heiko Thiery spake thusly:
Quoted 1 line
Sometime autobuilder failures occure only on a specific distribution. To
*occur
Quoted 5 lines
ease the research for the maintainer/developers add a file with that information to the result archive.
The distribution information comes from '
/etc/os-release' and thePRETTY_NAMEvalue is used from This file. This seems to be present on
*this (lower-case)
I think it would be easier to just copy the file.
Also, /etc/os-release may not exist, in which case we should look to the preferred locaiton, /usr/lib/os-release, something along the lines of:
def get_os_release_path():
for p in ['/etc/os-release', '/usr/lib/os-release']:
if os.path.exists(p):
return p
return None
def save_host_distro_info():
[blurb]
host_distro = os.path.join(self.resultdir, "host-distro") os_release = get_os_release_path()
if os_release is None:
with open(host_distro, "w") as f:
f.write('Unknown')
else:
shutil.copyfile(so_release, host_distro)
Otherwise, if you have a good argument against the copy and to keep only PRETTY_NAME, see below...
Quoted 3 lines
the most common distros:
Debian: https://manpages.debian.org/testing/manpages-de/os-release.5.de.html
Could you find an english version, please? My german (the very little I ever had) is a bit rusted... ;-]
I guess we would use that one, instead:
https://manpages.debian.org/buster/systemd/os-release.5.en.html
Quoted 15 lines
Ubuntu: http://manpages.ubuntu.com/manpages/bionic/man5/os-release.5.html
Red Red: https://www.freedesktop.org/software/systemd/man/os-release.html
Open-Suse: https://en.opensuse.org/SDB:Find_openSUSE_versionSigned-off-by Heiko Thiery <[email protected]>--- scripts/autobuild-run | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)scripts/autobuild-run +0
-0@@ -699,6 +699,28 @@ class Builder: with open(os.path.join(self.resultdir, "submitter"), "w+") as submitterf:
scripts/autobuild-run class Builder: · line 709
Quoted 10 lines
scripts/autobuild-run +8
-0submitterf.write(self.submitter) + def get_host_distro_info(): + """Get the host os distribution info. + + Try to get the host os release description from '/etc/os-release'. + """ + try: + with open("/etc/os-release") as releasef: + regexp = re.compile(r'PRETTY_NAME="(.*)"')
You should probably anchor PRETTY_NAME at the beginning of the line,
Regards,
Yann E. MORIN.
Quoted 20 lines
scripts/autobuild-run +14
-0+ for line in releasef.readlines(): + m = regexp.search(line) + if m: + return m.group(1) + except IOError: + pass + + return "unknown" + + host_distro_info = get_host_distro_info() + + with open(os.path.join(self.resultdir, "host-distro"), "w+") as distrof: + distrof.write(host_distro_info) + # Yes, shutil.make_archive() would be nice, but it doesn't exist # in Python 2.6. ret = subprocess.call(["tar", "cjf", "results.tar.bz2", "results"],Signature · 1 line
2.20.1
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 scripts/autobuild-run: create host-distro file
Hi Yann, All,
Am Sa., 12. Sept. 2020 um 00:06 Uhr schrieb Yann E. MORIN <[email protected]>:
Quoted 8 lines
Heiko, All,
On 2020-09-11 14:55 +0200, Heiko Thiery spake thusly:
Quoted 1 line
Sometime autobuilder failures occure only on a specific distribution. To
*occur
Quoted 8 lines
Quoted 5 lines
ease the research for the maintainer/developers add a file with that information to the result archive.
The distribution information comes from '
/etc/os-release' and thePRETTY_NAMEvalue is used from This file. This seems to be present on*this (lower-case)
I can fix the misspellings. ;-/
Quoted 1 line
I think it would be easier to just copy the file.
You mean simply copy the os-release file?
Quoted 20 lines
Also,
/etc/os-releasemay not exist, in which case we should look to the preferred locaiton,/usr/lib/os-release, something along the lines of:def
get_os_release_path():
for p in ['/etc/os-release', '/usr/lib/os-release']:
ifos.path.exists(p):
return p
return Nonedef
save_host_distro_info():
[blurb]
host_distro=os.path.join(self.resultdir, "host-distro")os_release=get_os_release_path()
ifos_releaseis None:
withopen(host_distro, "w")as f:
f.write('Unknown')
else:
shutil.copyfile(so_release, host_distro)
Quoted 2 lines
Otherwise, if you have a good argument against the copy and to keep only
PRETTY_NAME, see below...
Unfortunately I don't have a good argument for that ;-) Maybe we could add this information to the autobuilder result list. Then it would be human readable.
Quoted 6 lines
Quoted 3 lines
the most common distros:
Debian: https://manpages.debian.org/testing/manpages-de/os-release.5.de.html
Could you find an english version, please? My german (the very little I ever had) is a bit rusted... ;-]
Ups .. a good time to start improving it ;-)
Quoted 20 lines
I guess we would use that one, instead:
https://manpages.debian.org/buster/systemd/os-release.5.en.htmlQuoted 17 lines
Ubuntu: http://manpages.ubuntu.com/manpages/bionic/man5/os-release.5.html
Red Red: https://www.freedesktop.org/software/systemd/man/os-release.html
Open-Suse: https://en.opensuse.org/SDB:Find_openSUSE_versionSigned-off-by Heiko Thiery <[email protected]>--- scripts/autobuild-run | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)scripts/autobuild-run +0
-0@@ -699,6 +699,28 @@ class Builder: with open(os.path.join(self.resultdir, "submitter"), "w+") as submitterf: submitterf.write(self.submitter)
Quoted 10 lines
scripts/autobuild-run class Builder: · line 709
Quoted 8 lines
scripts/autobuild-run +8
-0+ def get_host_distro_info(): + """Get the host os distribution info. + + Try to get the host os release description from '/etc/os-release'. + """ + try: + with open("/etc/os-release") as releasef: + regexp = re.compile(r'PRETTY_NAME="(.*)"')You should probably anchor
PRETTY_NAMEat the beginning of the line,
Can I do when not copying the whole file.
Quoted 13 lines
Regards,
Yann E. MORIN.Quoted 9 lines
scripts/autobuild-run +9
-0+ for line in releasef.readlines(): + m = regexp.search(line) + if m: + return m.group(1) + except IOError: + pass + + return "unknown" +
Quoted 8 lines
scripts/autobuild-run class Builder: · line 726
Quoted 8 lines
scripts/autobuild-run +5
-0+ host_distro_info = get_host_distro_info() + + with open(os.path.join(self.resultdir, "host-distro"), "w+") as distrof: + distrof.write(host_distro_info) + # Yes, shutil.make_archive() would be nice, but it doesn't exist # in Python 2.6. ret = subprocess.call(["tar", "cjf", "results.tar.bz2", "results"],
Thanks for the review.
Signature · 1 line
Heiko