summaryrefslogtreecommitdiffstats
path: root/support/scripts/setlocalversion
Commit message (Collapse)AuthorAgeFilesLines
* support/scripts/setlocalversion: ignore user settings for MercurialThomas De Schampheleire2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | setlocalversion will use 'hg id' to determine whether or not the current revision is tagged. If there is no tag, the Mercurial revision is printed, otherwise nothing is printed. The problem is that the user may have custom configuration settings (in their ~/.hgrc file or similar) that changes the output of 'hg id' in a way that the script does not expect. In such cases, the Mercurial revision may not be printed or printed incorrectly. It is good practice to ignore the user environment when calling Mercurial commands from a well-defined script, by setting the environment variable HGRCPATH to the empty string. See also 'hg help environment'. In the particular case of Nokia, a custom extension adds dynamic tags in the repository, i.e. tags that are stored in a file external to the repository and only visible when the extension is active. These tags should not influence the behavior of setlocalversion as they are not official Buildroot tags, i.e. even if a revision is tagged, the Mercurial revision should still be printed. Note that this still does not solve the problem where an organization adds _real_ tags in their Buildroot repository. For example, there might be a moving tag 'last-validated' or tags indicating in which product release that Buildroot revision was used. In these cases, setlocalversion will still not behave as expected, i.e. show the Mercurial revision. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* support/scripts/setlocalversion: fix detection of hg revision when _not_ on ↵Thomas De Schampheleire2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | branch 'default' 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> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* setlocalversion: fix detection of hg revision for untagged versionsThomas De Schampheleire2017-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* setlocalversion: sync with Linux kernel version (2.6.34)Peter Korsgaard2013-09-041-15/+25
| | | | | | | | | | | | | | | Brings a number of fixes, and most importantly no longer tries to figure out if the tree contains uncommitted changes when using svn, as that can be very slow. This only syncs with setlocalversion as of 2.6.34 as later kernel versions aren't directly compatible with our use cases since 09155120c (kbuild: Clean up and speed up the localversion logic). We still have one delta from the kernel version (setlocalversion: fix i18n issue with svn), as that has only later been fixed in the kernel version. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* setlocalversion: fix i18n issue with svnFrederik Pasch2012-01-161-2/+2
| | | | | | | Closes #4700 Signed-off-by: Frederik Pasch <fpasch@googlemail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* support: move scripts/ to a new support/ directoryThomas Petazzoni2011-09-171-0/+72
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
OpenPOWER on IntegriCloud