Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] setlocalversion: fix detection of hg revision for untagged versions
Date: Wed, 26 Apr 2017 15:13:30 +0200	[thread overview]
Message-ID: <87r30fmhvp.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20170426124311.11449-1-patrickdepinguin@gmail.com> (Thomas De Schampheleire's message of "Wed, 26 Apr 2017 14:43:11 +0200")

>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin@gmail.com> writes:

 > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
 > By default, cut prints the entire line if the specified delimiter is not
 > present at all:

 >     $ printf "foo bar" | cut -d' ' -f2
 >     bar
 >     $ printf "foobar" | cut -d' ' -f2
 >     foobar

 > In setlocalversion, cut is presented with the output of 'hg id' which has
 > the format:

 >     "<revision> <tags-if-any>"

 > If the current revision is not tagged, the output of 'hg id' does not
 > contain the delimiter (space), cut prints the entire string, and
 > setlocalversion thinks the version is the tag.
 > As setlocalversion does not print anything for tagged versions, there is no
 > output overall, and no correct indication of the mercurial revision.

 > Fix by passing the extra cut option '--only-delimited', which suppresses
 > output if no delimiter is found.

 > This problem likely went unnoticed for so long, because the tag 'tip' (i.e.
 > most recent revision of the branch) is treated specially: in this case the
 > mercurial revision _is_ printed, i.e. the situation is treated as
 > 'untagged'.
 > The problem is only seen when you are _not_ at the most recent revision in
 > your branch.

setlocalversion comes from the kernel. Do you have the same problem
there?

I see this particular line changed back in 2010 in the kernel repo:


commit 8558f59edf935cf5ee5ffc29a9e9458fd9a71be1
Author: Michal Marek <mmarek@suse.cz>
Date:   Mon Aug 16 17:09:52 2010 +0200

    setlocalversion: Ignote SCMs above the linux source tree

    Dan McGee <dpmcgee@gmail.com> writes:
    > Note that when in git, you get the appended "+" sign. If
    > LOCALVERSION_AUTO is set, you will get something like
    > "eee-gb01b08c-dirty" (whereas the copy of the tree in /tmp still
    > returns "eee"). It doesn't matter whether the working tree is dirty or
    > clean.
    >
    > Is there a way to disable this? I'm building from a clean tarball that
    > just happens to be unpacked inside a git repository. One would think
    > setting LOCALVERSION_AUTO to false would do it, but no such luck...

    Fix this by checking if the kernel source tree is the root of the git or
    hg repository. No fix for svn: If the kernel source is not tracked in
    the svn repository, it works as expected, otherwise determining the
    'repository root' is not really a defined task.

    Reported-and-tested-by: Dan McGee <dpmcgee@gmail.com>
    Signed-off-by: Michal Marek <mmarek@suse.cz>


Perhaps synching with the kernel would be a better way forward than
adding local modifications?

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2017-04-26 13:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 12:43 [Buildroot] [PATCH 1/1] setlocalversion: fix detection of hg revision for untagged versions Thomas De Schampheleire
2017-04-26 13:13 ` Peter Korsgaard [this message]
2017-04-26 13:56   ` Thomas De Schampheleire
2017-06-13 19:04     ` Thomas De Schampheleire
2017-07-03  9:40       ` Peter Korsgaard
2017-07-04 15:36         ` Peter Korsgaard

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=87r30fmhvp.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.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