Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Thiery <heiko.thiery@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH buildroot-test v2] scripts/autobuild-run: create host-distro file
Date: Mon, 14 Sep 2020 22:41:02 +0200	[thread overview]
Message-ID: <20200914204101.16172-1-heiko.thiery@gmail.com> (raw)

Sometimes autobuilder failures occur only on a specific distribution. To
ease the research for the maintainer/developers add the host distribution
information to the result archive.

The distribution information comes from '/etc/os-release' (or
'/usr/lib/os-release') that seems to be present on the most common distros:

Debian: https://manpages.debian.org/buster/systemd/os-release.5.en.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

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
v2:
 - implement comments from Yann
 - copy the whole file (os-release) as host-distro to the result archive
 - reword the commit log

---
 scripts/autobuild-run | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index f657d49..d4644d6 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -699,6 +699,23 @@ class Builder:
         with open(os.path.join(self.resultdir, "submitter"), "w+") as submitterf:
             submitterf.write(self.submitter)
 
+        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():
+            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(os_release, host_distro)
+
+        save_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"],
-- 
2.20.1

             reply	other threads:[~2020-09-14 20:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 20:41 Heiko Thiery [this message]
2020-09-14 20:52 ` [Buildroot] [PATCH buildroot-test v2] scripts/autobuild-run: create host-distro file Yann E. MORIN
2020-10-01 13:17   ` Heiko Thiery
2020-10-25 14:57 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200914204101.16172-1-heiko.thiery@gmail.com \
    --to=heiko.thiery@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox