public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Peter Kjellerstedt" <peter.kjellerstedt@axis.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Khem Raj <raj.khem@gmail.com>,
	Armin Kuster <akuster808@gmail.com>,
	"Jerome Neanne" <jneanne@baylibre.com>,
	Quentin Schulz <quentin.schulz@streamunlimited.com>,
	"Patches and discussions about the oe-core layer"
	<openembedded-core@lists.openembedded.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [OE-core][RFC PATCH 2/2] image.bbclass: deploy image artifacts in stages
Date: Wed, 1 Apr 2020 02:47:54 +0000	[thread overview]
Message-ID: <c2dc031302264bfcbf0918b3805c804c@XBOX03.axis.com> (raw)
In-Reply-To: <CAMRc=MfSekw0gNRjvmJQ=RT8sUVmyvv5gxuDbLxzHj4h5048gg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1709 bytes --]

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Bartosz Golaszewski
> Sent: den 31 mars 2020 11:43
> To: Richard Purdie <richard.purdie@linuxfoundation.org>
> Cc: Khem Raj <raj.khem@gmail.com>; Armin Kuster <akuster808@gmail.com>;
> Jerome Neanne <jneanne@baylibre.com>; Quentin Schulz
> <quentin.schulz@streamunlimited.com>; Patches and discussions about the
> oe-core layer <openembedded-core@lists.openembedded.org>; Bartosz
> Golaszewski <bgolaszewski@baylibre.com>
> Subject: Re: [OE-core][RFC PATCH 2/2] image.bbclass: deploy image
> artifacts in stages
> 
> pon., 30 mar 2020 o 18:31 Richard Purdie
> <richard.purdie@linuxfoundation.org> napisał(a):

[cut]

> > Also, you used {}.format which I'm torn on since most of the codebase
> > uses the other approach.
> 
> I couldn't find any official guidelines for that. {} is the preferred
> way in Python. Maybe it's time to start slowly converting the bitbake
> codebase?

If we have waited so long to change string formatting, why not wait 
till we require  Python 3.6 and go for f-strings directly? With Tim's 
proposed patch we will soon require Python 3.5 as a minimum, so 3.6 
as a minimum requirement is probably not too long in the future...

Anyway, since I had fun generating it, I have included a graph 
depicting the use of % vs .format() for all Poky releases (and the 
script used to generate it; run it in a pristine clone of Poky for 
an interactive experience). Enjoy. :)

(For the curious, the first use of .format() was introduced to 
bitbake almost exactly 10 years ago in the Laverne release.)

//Peter


[-- Attachment #2: formattingwar.png --]
[-- Type: image/png, Size: 33616 bytes --]

[-- Attachment #3: formattingwar-plot.sh --]
[-- Type: application/octet-stream, Size: 1365 bytes --]

#!/bin/sh

REVS=" \
inky-1.0 \
clyde-2.0 \
blinky-3.0 \
pinky-3.1 \
purple-3.2 \
green-3.3 \
laverne-4.0 \
bernard-5.0 \
edison-6.0 \
denzil-7.0 \
danny-8.0 \
dylan-9.0.0 \
dora-10.0.0 \
daisy-11.0.0 \
dizzy-12.0.0 \
fido-13.0.0 \
jethro-14.0.0 \
krogoth-15.0.0 \
morty-16.0.0 \
pyro-17.0.0 \
rocko-18.0.0 \
sumo-19.0.0 \
thud-20.0.0 \
warrior-21.0.0 \
zeus-22.0.0 \
master \
"

gather_data() {
	local name=$1 rev=$2

	git checkout -f $rev >/dev/null 2>&1
	printf "%s\t%s\t%d\t%d\n" \
		$name \
		$(git show -s --format=%cd --date=format:%Y-%m-%d) \
		$(grep --exclude-dir=.git --exclude='*.patch' -ri '["'\''] % ' | wc -l) \
		$(grep --exclude-dir=.git --exclude='*.patch' -ri '\.format(' | wc -l)
}

[ -f formattingwar.dat ] || {
	for rev in $REVS; do
		release=${rev%-*}
		gather_data $release $rev
	done
} > formattingwar.dat

git checkout master >/dev/null 2>&1

gnuplot <<-EOF
	# Uncomment the following two lines to write the graph to a file.
#	set terminal pngcairo size 800,600
#	set output "formattingwar.png"

	set title "Use of % vs .format()"
	set xtics rotate by 45 right
	set key noenhanced
	set style data linespoints
	set timefmt "%Y-%m-%d"
	set xdata time
	set mouse mouseformat 3
	plot 'formattingwar.dat' using 2:3:xtic(1) title '%', \
	     ''                  using 2:4         title '.format()'

	pause mouse close
EOF

#rm formattingwar.dat

      reply	other threads:[~2020-04-01  2:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 17:28 [OE-core][RFC PATCH 0/2] introduce multi-state image deployment Bartosz Golaszewski
2020-03-23 17:28 ` [OE-core][RFC PATCH 1/2] qemuboot.bbclass: don't redefine IMGDEPLOYDIR Bartosz Golaszewski
2020-04-02 16:46   ` Bartosz Golaszewski
2020-03-23 17:28 ` [OE-core][RFC PATCH 2/2] image.bbclass: deploy image artifacts in stages Bartosz Golaszewski
2020-03-30 16:26   ` Bartosz Golaszewski
2020-03-30 16:31     ` Richard Purdie
2020-03-31  9:43       ` Bartosz Golaszewski
2020-04-01  2:47         ` Peter Kjellerstedt [this message]

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=c2dc031302264bfcbf0918b3805c804c@XBOX03.axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=akuster808@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=jneanne@baylibre.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=quentin.schulz@streamunlimited.com \
    --cc=raj.khem@gmail.com \
    --cc=richard.purdie@linuxfoundation.org \
    /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