All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2 v8] core: don't build host-cmake if it is available on the build host
Date: Wed, 14 Sep 2016 09:40:45 +0200	[thread overview]
Message-ID: <d2bfdabb-a72b-32b4-1d88-a13263dcbfb0@lucaceresoli.net> (raw)
In-Reply-To: <968743de-1d56-53cd-c707-3ac7f923dcb7@mind.be>

Dear Arnout, Yann,

On 14/09/2016 00:45, Arnout Vandecappelle wrote:
> 
> 
> On 13-09-16 23:34, Yann E. MORIN wrote:
>> Luca, All,
>>
>> On 2016-09-13 23:05 +0200, Luca Ceresoli spake thusly:
>>> On 12/09/2016 23:59, Yann E. MORIN wrote:
>>>> From: Luca Ceresoli <luca@lucaceresoli.net>
>>>> Currently all cmake packages depend on host-cmake. Unfortunately
>>>> host-cmake takes a long time to configure and build: almost 7 minutes
>>>> on a dual-core i5 with SSD. The time does not change even with ccache
>>>> enabled.
>> [--SNIP--]
>>>> diff --git a/support/dependencies/check-host-cmake.sh b/support/dependencies/check-host-cmake.sh
>>>> new file mode 100755
>>>> index 0000000..9b63b06
>>>> --- /dev/null
>>>> +++ b/support/dependencies/check-host-cmake.sh
>>>> @@ -0,0 +1,39 @@
>>>> +#!/bin/sh
>>>> +
>>>> +candidate="${1}"
>>>> +version_min="${2}"
>>>> +
>>>> +major_min="${version_min%.*}"
>>>> +minor_min="${version_min#*.}"
>>>> +
>>>> +cmake=`which ${candidate}`
>>>> +if [ ! -x "${cmake}" ]; then
>>>> +    # echo nothing: no suitable cmake found
>>>> +    exit 1
>>>> +fi
>>>> +
>>>> +# Extract version X.Y from versions in the form X.Y or X.Y.Z
>>>> +# with X, Y and Z numbers with one or more digits each, e.g.
>>>> +#   3.2     -> 3.2
>>>> +#   3.2.3   -> 3.2
>>>> +#   3.2.42  -> 3.2
>>>> +#   3.10    -> 3.10
>>>> +#   3.10.4  -> 3.10
>>>> +#   3.10.42 -> 3.10
>>>> +version="$(${cmake} --version \
>>>> +           |sed -r -e '/.* ([[:digit:]]+\.[[:digit:]]+).*$/!d;' \
>>>> +                   -e 's//\1/'
>>>> +          )"
>>>> +major="${version%.*}"
>>>> +minor="${version#*.}"
>>>
>>> You removed the 'head -n1' in the pipe.
>>
>> Indeed, but look at the sed script (which is not that complicated): all
>> lines that do not match the pattern are ignored.
>>
>>         |sed -r -e '/.* ([[:digit:]]+\.[[:digit:]]+).*$/!d;' \
>>                                                Here ----^
>>
>> "!d" means "if no match, delete line".
>>
>> Then the next expression is only aplied on matching lines, and "\1"
>> refers to the ()-match, which is the version string.
> 
>  You snipped away Luca's example: if there are two lines that contain something
> that looks like a version number, then you get two versions out of this script.
> So repeating Luca's example:
> 
>   cmake version 3.5.1
> 
>   Linked against libfoobar 7.6.5
> 
> will give you
> 
> version="3.5
> 7.6"

You're right. Yann and I clarified this yesterday night on IRC.

OTOH we also agreed that:

 1. the script in v8 works with all cmake versions we are aware of,
    including 2.8.* and 3.5.1
 2. adding 'head -n1', or any other change to the script, can guard
    against any possible future change in the output of 'cmake
    --version' that we just can't predict.

Thus you can consider my comment as "if I wrote it, I'd have put a head
-n1", which is a matter of personal taste and not a request to Yann to
change the code. Should cmake change its output in the future, we'll
handle it when it happens.

-- 
Luca

  reply	other threads:[~2016-09-14  7:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 21:59 [Buildroot] [PATCH 0/2 v8] core/pkg-cmake: do not build host-cmake if not needed (branch yem/host-cmake) Yann E. MORIN
2016-09-12 21:59 ` [Buildroot] [PATCH 1/2 v8] core: don't build host-cmake if it is available on the build host Yann E. MORIN
2016-09-13 21:05   ` Luca Ceresoli
2016-09-13 21:34     ` Yann E. MORIN
2016-09-13 22:45       ` Arnout Vandecappelle
2016-09-14  7:40         ` Luca Ceresoli [this message]
2016-09-17 14:13   ` Thomas Petazzoni
2016-09-12 21:59 ` [Buildroot] [PATCH 2/2 v8] core/pkg-cmake: ensure no package needs a cmake newer than we do Yann E. MORIN
2016-09-17 14:19   ` 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=d2bfdabb-a72b-32b4-1d88-a13263dcbfb0@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 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.