Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] support/scripts/setlocalversion: fix detection of hg revision when _not_ on branch 'default'
@ 2019-01-30 20:15 Thomas De Schampheleire
  2019-01-30 20:15 ` [Buildroot] [PATCH 2/2] support/scripts/setlocalversion: ignore user settings for Mercurial Thomas De Schampheleire
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas De Schampheleire @ 2019-01-30 20:15 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

When Buildroot is stored in a Mercurial repository on a branch other than
'default' ('master' in git terms), setlocalversion (used to populate
/etc/os-release) will incorrectly think that this is a tagged version and
will NOT print out the revision hash.

This is due to the fact that the output of 'hg id' is assumed to be
    "<revision> <tags-if-any>"
but when on a branch it actually is:
    "<revision> (<branch>) <tags-if-any>"

To let setlocalversion receive the output it expects, explicitly ask 'hg id'
to retrieve only the revision hash and any tags, ommitting any branch
information.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 support/scripts/setlocalversion | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/setlocalversion b/support/scripts/setlocalversion
index 33cd605bf3..45f4283bb1 100755
--- a/support/scripts/setlocalversion
+++ b/support/scripts/setlocalversion
@@ -53,7 +53,7 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
 fi
 
 # Check for mercurial and a mercurial repo.
-if hgid=`hg id 2>/dev/null`; then
+if hgid=`hg id --id --tags 2>/dev/null`; then
 	tag=`printf '%s' "$hgid" | cut -d' ' -f2 --only-delimited`
 
 	# Do we have an untagged version?
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-18 16:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-30 20:15 [Buildroot] [PATCH 1/2] support/scripts/setlocalversion: fix detection of hg revision when _not_ on branch 'default' Thomas De Schampheleire
2019-01-30 20:15 ` [Buildroot] [PATCH 2/2] support/scripts/setlocalversion: ignore user settings for Mercurial Thomas De Schampheleire
2019-02-18 16:13   ` Peter Korsgaard
2019-02-04 20:24 ` [Buildroot] [PATCH 1/2] support/scripts/setlocalversion: fix detection of hg revision when _not_ on branch 'default' Thomas Petazzoni
2019-02-18 16:13 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox