Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 02/10] core: get rid of our dummy br2-external tree
Date: Sun, 25 Sep 2016 19:44:01 +0200	[thread overview]
Message-ID: <18da6ec3-871e-4bcf-b6fd-0395dafc50d2@gmail.com> (raw)
In-Reply-To: <313236518c32d7e615a02a6465743f00ed2f3742.1474815151.git.yann.morin.1998@free.fr>

Le 25/09/2016 ? 16:52, Yann E. MORIN a ?crit :
> Now that we generate a kconfig snippet, we can conditionally include the
> BR2_EXTERNAL's Config.in only when BR2_EXTERNAL is supplied by the user,
> which means our empty/dummy Config.in is no longer useful to us.
> 
> As for external.mk, we can also include it only when BR2_EXTERNAL is
> supplied by the user, which means our empty/dummy external.mk is no
> longer of any use to us.
> 
> Ditch both of those files, and:
> 
>   - only generate actual content in the Kconfig snippet when we actually
>     do have a BR2_EXTERNAL provided by the user (i.e. BR2_EXTERNAL is not
>     empty);
> 
>   - add a variable that contains the path to the external.mk provided by
>     the user, or empty if none, and include the path set in that variable
>     (make can 'include' nothing without any problem! ;-) )
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Romain Naour <romain.naour@openwide.fr>
> Cc: Julien CORJON <corjon.j@ecagroup.com>

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> ---
>  Makefile                           | 11 ++++-------
>  support/dummy-external/Config.in   |  0
>  support/dummy-external/external.mk |  0
>  support/scripts/br2-external       | 18 +++++++++++++++---
>  4 files changed, 19 insertions(+), 10 deletions(-)
>  delete mode 100644 support/dummy-external/Config.in
>  delete mode 100644 support/dummy-external/external.mk
> 
> diff --git a/Makefile b/Makefile
> index f44e509..10afcda 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -147,16 +147,11 @@ $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
>  # on the command line, therefore the file is re-created every time make is run.
>  #
>  # When BR2_EXTERNAL is set to an empty value (e.g. explicitly in command
> -# line), the .br-external file is removed and we point to
> -# support/dummy-external. This makes sure we can unconditionally include the
> -# Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
> -# override is necessary so the user can clear BR2_EXTERNAL from the command
> -# line, but the dummy path is still used internally.
> +# line), the .br-external file is removed.
>  
>  BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external
>  -include $(BR2_EXTERNAL_FILE)
>  ifeq ($(BR2_EXTERNAL),)
> -  override BR2_EXTERNAL = support/dummy-external
>    $(shell rm -f $(BR2_EXTERNAL_FILE))
>  else
>    _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
> @@ -165,6 +160,7 @@ else
>    endif
>    override BR2_EXTERNAL := $(_BR2_EXTERNAL)
>    $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
> +  BR2_EXTERNAL_MK = $(BR2_EXTERNAL)/external.mk
>  endif
>  
>  # To make sure that the environment variable overrides the .config option,
> @@ -461,7 +457,8 @@ include boot/common.mk
>  include linux/linux.mk
>  include fs/common.mk
>  
> -include $(BR2_EXTERNAL)/external.mk
> +# Nothing to include if no BR2_EXTERNAL tree in use
> +include $(BR2_EXTERNAL_MK)
>  
>  # Now we are sure we have all the packages scanned and defined. We now
>  # check for each package in the list of enabled packages, that all its
> diff --git a/support/dummy-external/Config.in b/support/dummy-external/Config.in
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/support/dummy-external/external.mk b/support/dummy-external/external.mk
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/support/scripts/br2-external b/support/scripts/br2-external
> index c15c21c..508ddcb 100755
> --- a/support/scripts/br2-external
> +++ b/support/scripts/br2-external
> @@ -19,9 +19,11 @@ main() {
>      # Forget options; keep only positional args
>      shift $((OPTIND-1))
>  
> -    if [ ${#} -ne 1 ]; then
> -        error "need exactly one br2-external tree to be specified\n"
> +    # Accept 0 or 1 br2-external tree.
> +    if [ ${#} -gt 1 ]; then
> +        error "only zero or one br2-external tree allowed.\n"
>      fi
> +
>      br2_ext="${1}"
>  
>      if [ -z "${ofile}" ]; then
> @@ -38,6 +40,11 @@ main() {
>  do_validate() {
>      local br2_ext="${1}"
>  
> +    # No br2-external tree is valid
> +    if [ -z "${br2_ext}" ]; then
> +        return
> +    fi
> +
>      if [ ! -d "${br2_ext}" ]; then
>          error "'%s': no such file or directory\n" "${br2_ext}"
>      fi
> @@ -49,12 +56,17 @@ do_validate() {
>  do_kconfig() {
>      printf '#\n# Automatically generated file; DO NOT EDIT.\n#\n'
>      printf '\n'
> +
> +    if [ -z "${BR2_EXT}" ]; then
> +        printf '# No br2-external tree defined.\n'
> +        return
> +    fi
> +
>      printf 'config BR2_EXTERNAL\n'
>      printf '\tstring\n'
>      printf '\tdefault "%s"\n' "${BR2_EXT}"
>      printf '\n'
>      printf 'menu "User-provided options"\n'
> -    printf '\tdepends on BR2_EXTERNAL != "support/dummy-external"\n'
>      printf '\n'
>      printf 'source "%s/Config.in"\n' "${BR2_EXT}"
>      printf '\n'
> 

  reply	other threads:[~2016-09-25 17:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 14:52 [Buildroot] [PATCH 00/10 v5] br2-external: support multiple trees at once Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 01/10] core: do not hard-code inclusion of br2-external in Kconfig Yann E. MORIN
2016-09-25 17:21   ` Romain Naour
2016-09-25 17:32     ` Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 02/10] core: get rid of our dummy br2-external tree Yann E. MORIN
2016-09-25 17:44   ` Romain Naour [this message]
2016-09-25 14:52 ` [Buildroot] [PATCH 03/10] core: offload handling of BR2_EXTERNAL into the script Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 04/10] core/br2-external: validate even more Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 05/10] core: introduce per br2-external NAME Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 06/10] docs/manual: document the " Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 07/10] docs/manual: add appendix to convert old br2-external trees Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 08/10] core: add support for multiple " Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 09/10] docs/manual: document multi br2-external Yann E. MORIN
2016-09-25 14:52 ` [Buildroot] [PATCH 10/10] core: allow a br2-external tree to override a defconfig Yann E. MORIN
2016-09-27 21:07 ` [Buildroot] [PATCH 00/10 v5] br2-external: support multiple trees at once Arnout Vandecappelle
2016-09-27 21:35   ` Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2016-10-02  9:09 [Buildroot] [PATCH 00/10 v6] " Yann E. MORIN
2016-10-02  9:09 ` [Buildroot] [PATCH 02/10] core: get rid of our dummy br2-external tree Yann E. MORIN

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=18da6ec3-871e-4bcf-b6fd-0395dafc50d2@gmail.com \
    --to=romain.naour@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