Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [V2 1/2] graph-depends: display virtual package with italic style
Date: Wed, 7 Jan 2015 22:10:12 +0100	[thread overview]
Message-ID: <20150107211012.GD4249@free.fr> (raw)
In-Reply-To: <1420295353-8065-1-git-send-email-francois.perrad@gadz.org>

Fran?ois, All,

On 2015-01-03 15:29 +0100, Francois Perrad spake thusly:
> virtual packages are found by their version,
> so we retrieve the version of all packages
> 
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/pkg-generic.mk        |  3 +++
>  support/scripts/graph-depends | 30 +++++++++++++++++++++++++++++-
>  2 files changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index 9643a30..87d8dd8 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -565,6 +565,9 @@ $(1)-rsync:		$$($(2)_TARGET_RSYNC)
>  $(1)-source:		$$($(2)_TARGET_RSYNC_SOURCE)
>  endif
>  
> +$(1)-show-version:
> +			@echo $$($(2)_VERSION)
> +
>  $(1)-show-depends:
>  			@echo $$($(2)_FINAL_DEPENDENCIES)
>  
> diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
> index 1ecfeda..28fe2f0 100755
> --- a/support/scripts/graph-depends
> +++ b/support/scripts/graph-depends
> @@ -76,6 +76,28 @@ host_colour = colours[2]
>  
>  allpkgs = []
>  
> +# Execute the "make <pkg>-show-version" command to get the version of a given
> +# list of packages, and return the version formatted as a Python dictionary.
> +def get_version(pkgs):
> +    sys.stderr.write("Getting version for %s\n" % pkgs)
> +    cmd = ["make", "-s", "--no-print-directory" ]
> +    for pkg in pkgs:
> +        cmd.append("%s-show-version" % pkg)
> +    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
> +    output = p.communicate()[0]
> +    if p.returncode != 0:
> +        sys.stderr.write("Error getting version %s\n" % pkgs)
> +        sys.exit(1)
> +    output = output.split("\n")
> +    if len(output) != len(pkgs) + 1:
> +        sys.stderr.write("Error getting version\n")
> +        sys.exit(1)
> +    version = {}
> +    for i in range(0, len(pkgs)):
> +        pkg = pkgs[i]
> +        version[pkg] = output[i]
> +    return version
> +
>  # Execute the "make show-targets" command to get the list of the main
>  # Buildroot TARGETS and return it formatted as a Python list. This
>  # list is used as the starting point for full dependency graphs
> @@ -257,6 +279,8 @@ def remove_extra_deps(deps):
>      return deps
>  
>  dict_deps = remove_extra_deps(dict_deps)
> +dict_version = get_version([pkg for pkg in allpkgs
> +                                if pkg != "all" and not pkg.startswith("root")])
>  
>  # Print the attributes of a node: label and fill-color
>  def print_attrs(pkg):
> @@ -274,7 +298,11 @@ def print_attrs(pkg):
>              color = host_colour
>          else:
>              color = target_colour
> -    print("%s [label = \"%s\"]" % (name, label))
> +    version = dict_version.get(pkg)
> +    if version == "virtual":
> +        print("%s [label = <<I>%s</I>>]" % (name, label))
> +    else:
> +        print("%s [label = \"%s\"]" % (name, label))
>      print("%s [color=%s,style=filled]" % (name, color))
>  
>  # Print the dependency graph of a package
> -- 
> 2.1.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

  parent reply	other threads:[~2015-01-07 21:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-03 14:29 [Buildroot] [V2 1/2] graph-depends: display virtual package with italic style Francois Perrad
2015-01-03 14:29 ` [Buildroot] [V2 2/2] graph-depends: add an option --stop-on-virtual Francois Perrad
2015-03-08 21:18   ` Thomas Petazzoni
2015-03-09 19:32     ` François Perrad
2015-03-09 20:15       ` Thomas Petazzoni
2015-03-14 16:26         ` Yann E. MORIN
2015-03-14 17:00           ` Thomas Petazzoni
2015-01-07 21:10 ` Yann E. MORIN [this message]
2015-03-02 16:20 ` [Buildroot] [V2 1/2] graph-depends: display virtual package with italic style Luca Ceresoli
2015-03-08 21:17 ` 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=20150107211012.GD4249@free.fr \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox