Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] uboot-tools: Allow users to use uboot's sources
Date: Sun, 26 Jan 2014 22:43:11 +0100	[thread overview]
Message-ID: <52E5816F.9080102@lucaceresoli.net> (raw)
In-Reply-To: <CAGduivwtd5SeEOSi6NNCegk7L7oem0+dF9eqkvoGtYk1_xODVw@mail.gmail.com>

Hi Maxime,

Maxime Hadjinlian wrote:
> On Sun, Jan 26, 2014 at 4:59 PM, Luca Ceresoli <luca@lucaceresoli.net> wrote:
>> Hi Maxime,
> Hi Luca
>>
>>
>> Maxime Hadjinlian wrote:
>>>
>>> If the user has specified a custom U-Boot repository, he may also want
>>> to use it for U-Boot tools.
>>>
>>> This could be usefull in two identified use case:
>>>     - User want the same version for U-Boot tools and U-Boot
>>>     - User has modified U-Boot tools in his U-Boot repository
>>>
>>> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
>>
>>
>> I ACK the idea, but there are a few changes I would make to your patch,
>> see below.

...

>>> b/package/uboot-tools/uboot-tools.mk
>>> index 398ce8b..367d067 100644
>>> --- a/package/uboot-tools/uboot-tools.mk
>>> +++ b/package/uboot-tools/uboot-tools.mk
>>> @@ -10,6 +10,15 @@ UBOOT_TOOLS_SITE    = ftp://ftp.denx.de/pub/u-boot
>>>    UBOOT_TOOLS_LICENSE = GPLv2+
>>>    UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
>>>
>>> +ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_UBOOT_SOURCE),y)
>>> +       UBOOT_TOOLS_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_VERSION))
>>> +       UBOOT_TOOLS_SOURCE  = $(UBOOT_SOURCE)
>>> +       UBOOT_TOOLS_SITE    = $(UBOOT_SITE)
>>
>>
>> You are overriding the previously-defined options. I find an
>> if/then/else construct much cleaner:
>>
>> ifneq ($(BR2_PACKAGE_UBOOT_TOOLS_UBOOT_SOURCE),y)
>> ...use upstream sources... (current code)
>> else
>> ...use sources for the uboot package...
>> endif
>>
> I'd like to have a few more opinions on that, after seeing the code in
> the form if/then/else, I find it awkward as it would be (as far as I
> know) the only package, where you don't find the SOURCE/SITE variable
> defined at the top of the file.
> So I am not sure about this.

Very few packages define their SOURCE/SITE variables conditionally:
linux, boot/ubot, boot/barebox, maybe a few more. These all are key
components for every embedded Linux system and are often used in a
modified form on real products, so they deserve this additional
flexibility.

All of them have an ifeq / else ifeq / [else ifeq /...] else / endif
construct in their .mk files to handle the various possibilities.
I suggest you take one of them as an example.

Going a step ahead, to be more uniform with these packages, you may use
a choice construct to allow choosing between two alternatives.
Example (modified version of the code in barebox.mk):

choice
         prompt "version"
         help
           Select the specific uboot-tools version you want to use

config BR2_PACKAGE_UBOOT_TOOLS_LATEST_VERSION
         bool "Use a recent upstream version"

config BR2_PACKAGE_UBOOT_TOOLS_USE_UBOOT_VERSION
         bool "Use the same sources of the uboot package"

endchoice

This has the advantage that adding a third possibility would be
simply a matter of adding another choice, without having to rework
the whole thing and having to take care of backward compatibility.

But this may be overengineering for the relatively simple uboot-tools
package.

-- 
Luca

  reply	other threads:[~2014-01-26 21:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-26  0:35 [Buildroot] [PATCH] uboot-tools: Allow users to use uboot's sources Maxime Hadjinlian
2014-01-26 15:59 ` Luca Ceresoli
2014-01-26 16:31   ` Maxime Hadjinlian
2014-01-26 21:43     ` Luca Ceresoli [this message]
2014-01-27 17:34       ` Arnout Vandecappelle
2014-01-27 22:26         ` Luca Ceresoli
2014-01-28  6:02         ` Thomas De Schampheleire
2014-01-28  8:17           ` Maxime Hadjinlian
2014-01-28 10:55           ` Luca Ceresoli
2014-01-28 16:58           ` Arnout Vandecappelle
2014-01-28 22:10           ` Thomas Petazzoni
2014-01-27 17:45 ` Arnout Vandecappelle

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=52E5816F.9080102@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --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