All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] core: add rule to dump packages' build order
Date: Fri, 7 Apr 2017 21:44:48 +0200	[thread overview]
Message-ID: <20170407194448.GB3420@scaer> (raw)
In-Reply-To: <20170407192458.GA3420@scaer>

Arnout, All,

On 2017-04-07 21:24 +0200, Yann E. MORIN spake thusly:
> >  So, I can think of no viable alternative, so there is no way to stop this patch :-)
> What about the following (just proof-of-concept):

Hmmm, it seems there was a bad copy-paste failure.

Here it is again:

diff --git a/Makefile b/Makefile
index 919d589..a1540fc 100644
--- a/Makefile
+++ b/Makefile
@@ -759,6 +759,14 @@ show-targets:

 show-build-order: $(patsubst %,%-show-build-order,$(PACKAGES))

+define show-build-order-deps
+	$(foreach p,$($(call UPPERCASE,$(1))_FINAL_ALL_DEPENDENCIES),\
+		$(call show-build-order-deps-deps,$(p))) $(1)
+endef
+
+show-build-order-2:
+	@./toto $(foreach p,$(PACKAGES),$(call show-build-order-deps-deps,$(p)))
+
 graph-build: $(O)/build/build-time.log
 	@install -d $(GRAPHS_DIR)
 	$(foreach o,name build duration,./support/scripts/graph-build-time \
diff --git a/toto b/toto
new file mode 100755
index 0000000..6962083
--- /dev/null
+++ b/toto
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# input on stdin: list of packages, each rpreceded by its
+# direct dependencies; so, packages may be listed more than
+# once, but at least the build order is gurranteed for the
+# first occurence of each package.
+
+# We first output each item of the list on its own line.
+# Then we number those lines.
+# We sort by package name as first key, and on line number
+# as second key.
+# For each package, we keep only the first occurence, which
+# is the one with the lowest line number.
+# We re-sort on the line number.
+# And eventually, we remove the line number and only keep
+# the package name.
+
+# The output is thus the build order.
+
+printf "%s\n" "${@}"
+|cat -n \
+|sort -k 2,2 -k 1,1n \
+|while read n p; do
+    if [ "${p}" != "${prev}" ]; then
+        printf "%d %s\n" "${n}" "${p}"
+        prev="${p}"
+    fi
+done \
+|sort -n \
+|sed -r -e 's/^[[:digit:]]+ //'


-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2017-04-07 19:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-02 13:03 [Buildroot] [PATCH] core: add rule to dump packages' build order Yann E. MORIN
2017-04-03 10:10 ` Arnout Vandecappelle
2017-04-04 18:59   ` Yann E. MORIN
2017-04-07 10:30     ` Arnout Vandecappelle
2017-04-07 10:43       ` Thomas Petazzoni
2017-04-07 11:11         ` Arnout Vandecappelle
2017-04-07 19:24       ` Yann E. MORIN
2017-04-07 19:44         ` Yann E. MORIN [this message]
2017-04-10  9:28         ` Arnout Vandecappelle
2017-04-10 11:44           ` Thomas Petazzoni
2017-04-13 22:18             ` Alexandre Belloni
2017-04-07 10:31 ` Arnout Vandecappelle
2017-04-11  9:23   ` Arnout Vandecappelle
2017-04-13 21:09 ` 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=20170407194448.GB3420@scaer \
    --to=yann.morin.1998@free.fr \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.