From: Henning Schild <henning.schild@siemens.com>
To: Uladzimir Bely <ubely@ilbers.de>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH v2 2/4] buildstats: Fix bbclass to work with ISAR
Date: Tue, 5 Oct 2021 11:19:29 +0200 [thread overview]
Message-ID: <20211005111929.579137e8@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20210927141705.25386-3-ubely@ilbers.de>
We should really try to avoid such forking. It will be hard to
maintain! Maybe try to use inheritance/wrapping instead.
We could have builtstats-isar.py to include the original and prepare
bits like the python path.
Am Mon, 27 Sep 2021 16:17:03 +0200
schrieb Uladzimir Bely <ubely@ilbers.de>:
> 1. rootfs may be empty that causes exception.
> 2. sudo required to calculate rootfs disk usage.
> 3. sys.path modification to make meta/lib available.
>
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
> meta/classes/buildstats.bbclass | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/buildstats.bbclass
> b/meta/classes/buildstats.bbclass index 0de6052..e2db8f6 100644
> --- a/meta/classes/buildstats.bbclass
> +++ b/meta/classes/buildstats.bbclass
> @@ -242,9 +242,9 @@ python run_buildstats () {
> bs = os.path.join(bsdir, "build_stats")
> with open(bs, "a") as f:
> rootfs = d.getVar('IMAGE_ROOTFS')
> - if os.path.isdir(rootfs):
> + if rootfs and os.path.isdir(rootfs):
We could just set that to "" in a central config. In fact that bit
might be relevant for fixing in OE or see why they never encounter
"Null".
> try:
> - rootfs_size = subprocess.check_output(["du",
> "-sh", rootfs],
> + rootfs_size =
> subprocess.check_output(["sudo", "du", "-sh", rootfs],
That "sudo" can probably be smuggled in by an outer class. You
overwrite "subprocess.check_output", mostly call the original or patch
argv when needed.
> stderr=subprocess.STDOUT).decode('utf-8') f.write("Uncompressed
> Rootfs size: %s" % rootfs_size) except subprocess.CalledProcessError
> as err: @@ -270,6 +270,9 @@ addhandler run_buildstats
> run_buildstats[eventmask] = "bb.event.BuildStarted
> bb.event.BuildCompleted bb.event.HeartbeatEvent bb.build.TaskStarted
> bb.build.TaskSucceeded bb.build.TaskFailed" python runqueue_stats () {
> + import sys
> + oe_lib_path = os.path.join(d.getVar('LAYERDIR_core'), 'lib')
> + sys.path.insert(0, oe_lib_path)
This can also be done in an isar specific file and does not need a fork.
Henning
> import buildstats
> from bb import event, runqueue
> # We should not record any samples before the first task has
> started,
next prev parent reply other threads:[~2021-10-05 9:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 14:17 [PATCH v2 0/4] Use buildstats from OE to generate build charts Uladzimir Bely
2021-09-27 14:17 ` [PATCH v2 1/4] buildstats: Borrow buildstats and pybootchartgui from OE Uladzimir Bely
2021-10-05 9:13 ` Henning Schild
2021-09-27 14:17 ` [PATCH v2 2/4] buildstats: Fix bbclass to work with ISAR Uladzimir Bely
2021-10-05 9:19 ` Henning Schild [this message]
2021-09-27 14:17 ` [PATCH v2 3/4] buildstats: Manage buildstats via USER_CLASSES variable Uladzimir Bely
2021-10-05 9:21 ` Henning Schild
2021-09-27 14:17 ` [PATCH v2 4/4] doc: Add buildstats section in user manual Uladzimir Bely
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=20211005111929.579137e8@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=ubely@ilbers.de \
/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