summaryrefslogtreecommitdiff
path: root/scripts/setlocalversion
AgeCommit message (Collapse)Author
2014-01-03Fix detectition of kernel git repository in setlocalversion script [take #2]Franck Bui-Huu
setlocalversion script was testing the presence of .git directory in order to find out if git is used as SCM to track the current kernel project. However in some cases, .git is not a directory but can be a file: when the kernel is a git submodule part of a git super project for example. This patch just fixes this by using 'git rev-parse --show-cdup' to check that the current directory is the kernel git topdir. This has the advantage to not test and rely on git internal infrastructure directly. Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-06-23scripts/setlocalversion on write-protected source treeChristian Kujau
I just stumbled across another[0] issue when scripts/setlocalversion operates on a write-protected source tree. Back then[0] the source tree was on an read-only NFS share, so "test -w" was introduced before "git update-index" was run. This time, the source tree is on read/write NFS share, but the permissions are world-readable and only a specific user (or root) can write. Thus, "test -w ." returns "0" and then runs "git update-index", producing the following message (on a dirty tree): fatal: Unable to create '/usr/local/src/linux-git/.git/index.lock': Permission denied While it says "fatal", compilation continues just fine. However, I don't think a kernel compilation should alter the source tree (or the .git directory) in any way and I don't see how removing "git update-index" could do any harm. The Mercurial and SVN routines in scripts/setlocalversion don't have any tree-modifying commands, AFAICS. So, maybe the patch below would be acceptable. [0] https://patchwork.kernel.org/patch/29718/ Signed-off-by: Christian Kujau <lists@nerdbynature.de> Cc: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-02-22kbuild: Unset language specific variables in setlocalversion scriptChristophe Leroy
This patch allows the use of setlocalversion script regardless of the language parameters. Otherwise, the `svn info 2>/dev/null | grep '^Last Changed Rev'` returns nothing because for instance, in French the text 'Last Changed Rev' is replaced by 'Révision de la dernière modification' Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-03-26setlocalversion: Use "grep -q" instead of piping output to "read dummy"Roland Dreier
In some circumstances (eg when running a build in an emacs shell buffer), I get a spew of messages like grep: writing output: Broken pipe from setlocalversion, because the "read" subshell apparently exits as soon as it reads one line and gives EPIPE to grep. It's not clear to me why this way of writing the check was used instead of just using grep -q to suppress output, but unless there is some deep reason I don't know, this way looks cleaner to me anyway, and gets rid of the ugly message spew. (I double checked at http://pubs.opengroup.org/onlinepubs/009604499/utilities/grep.html and "grep -q" is specified in POSIX / SuS, so hopefully even people cross-compiling the kernel on some bizarre host OS can't complain about this change) Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-01-14setlocalversion: update mercurial tag parsingMike Crowe
The tag output of hg doesn't quite match what setlocalversion currently expects, so update it to handle the latest format. Signed-off-by: Mike Crowe <mcrowe@zipitwireless.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-10-28Merge branch 'kbuild' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: initramfs: Fix build break on symbol-prefixed archs initramfs: fix initramfs size calculation initramfs: generalize initramfs_data.xxx.S variants scripts/kallsyms: Enable error messages while hush up unnecessary warnings scripts/setlocalversion: update comment kbuild: Use a single clean rule for kernel and external modules kbuild: Do not run make clean in $(srctree) scripts/mod/modpost.c: fix commentary accordingly to last changes kbuild: Really don't clean bounds.h and asm-offsets.h
2010-09-06scripts/setlocalversion: update commentMichael Prokop
A tagged repository state isn't enough, git describe only looks at signed or annotated tags (git tag -a/-s). This documentation update makes sure the comment matches the current behaviour. Signed-off-by: Michael Prokop <mika@grml.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-21setlocalversion: Ignote SCMs above the linux source treeMichal Marek
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>
2010-08-12setlocalversion: fix version for untaged nontip mercurial revsMilton Miller
The manpage for cut says it will return all lines without the delimiter unless -s is specified. When I backed up my mecurial tree to generate modules, I found that the scm part of localversion was turning up blank. Signed-off-by: Milton Miller <miltonm@bga.com> Cc: Michal Marek <mmarek@suse.cz> Cc: "Michał Górny" <gentoo@mgorny.alt.pl> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-21kbuild: Fix make rpmMichal Marek
make rpm was broken by commit 0915512: make clean set -e; cd ..; ln -sf /usr/src/iwlwifi-2.6 kernel-2.6.35rc4wl /bin/sh /usr/src/iwlwifi-2.6/scripts/setlocalversion --scm-only > /usr/src/iwlwifi-2.6/.scmversion cat: .scmversion: input file is output file make[1]: *** [rpm] Error 1 Reported-and-tested-by: "Zheng, Jiajia" <jiajia.zheng@intel.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-20kbuild: Make the setlocalversion script POSIX-compliantMichał Górny
The 'source' builtin is a bash alias to the '.' (dot) builtin. While the former is supported only by bash, the latter is specified in POSIX and works fine with all POSIX-compliant shells I am aware of. The '$_' special parameter is specific to bash. It is partially supported in dash too but it always evaluates to the current script path (which causes the script to enter a loop recursively re-executing itself). This is why I have replaced the two occurences of '$_' with the explicit parameter. The 'local' builtin is another example of bash-specific code. Although it is supported by all POSIX-compliant shells I am aware of, it is not part of POSIX specification and thus the code should not rely on it assigning a specific value to the local variable. Moreover, the 'posh' shell has a limited version of 'local' builtin not supporting direct variable assignments. Thus, I have broken one of the 'local' declarations down into a (non-POSIX) 'local' declaration and a plain (POSIX-compliant) variable assignment. Signed-off-by: Michał Górny <gentoo@mgorny.alt.pl> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-18kbuild: Clean up and speed up the localversion logicMichal Marek
Now that we run scripts/setlocalversion during every build, it makes sense to move all the localversion logic there. This cleans up the toplevel Makefile and also makes sure that the script is called only once in 'make prepare' (previously, it would be called every time due to a variable expansion in an ifneq statement). No user-visible change is intended, unless one runs the setlocalversion script directly. Reported-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: David Rientjes <rientjes@google.com> Cc: Greg Thelen <gthelen@google.com> Cc: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-06-14kbuild: fix delay in setlocalversion on readonly sourceNico Schottelius
Do not update index on read only media. Idea published by Christian Kujau <lists@nerdbynature.de>. Cc: Nico Schottelius <nico@ikn.schottelius.org> Cc: Christian Kujau <lists@nerdbynature.de>
2009-05-19Fix scripts/setlocalversion with tagged git commitNico Schottelius
Produce correct output for - tagged commit (v2.6.30-rc6) - past tagged commit (v2.6.30-rc5-299-g7c7327d) - no tag Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-05-01kbuild: fix scripts/setlocalversion with gitNico Schottelius
When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion. This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev. Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-04-11kbuild: use git svn instead of git-svn in setlocalversionPeter Korsgaard
Use the correct git <subcmd> syntax instead of the deprecated git-<subcmd>. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-02-15kbuild,setlocalversion: shorten the make time when using svnMike Frysinger
Don't bother doing `svn st` as it takes a retarded amount of time when the source is cold Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03setlocalversion: add git-svn supportPeter Korsgaard
Print svn revision in addition to git info on git-svn repos. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03setlocalversion: print correct subversion revisionPeter Korsgaard
Output svn revision of latest change, instead of repo revision as thats what we're interested in (especially when working on a branch/tag). Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-10-29kbuild: tag with git revision when git describe is missingTrent Piepho
setlocalversion used to use an abbreviated git commit sha1 to generate the tag. This was changed in commit d882421f4e08ddf0a94245cdbe516db260aa6f41 "kbuild: change CONFIG_LOCALVERSION_AUTO to use a git-describe-ish format" to use git describe to come up with a tag. Which is nice, but git describe sometimes can't describe the revision. Commit 56b2f0706d82535fd8d85503f2dcc0be40c8e55d ("setlocalversion: do not describe if there is nothing to describe") addressed this, but there is still no tag generated. So, generate a plain abbreviated sha1 tag like setlocalversion used to when git describe comes up short. Signed-off-by: Trent Piepho <tpiepho@freescale.com> CC: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-10-29kbuild: setlocalversion: dont include svn change countMike Frysinger
The number of pending changes is pretty useless, so encoding it into the version is just annoying by the constant shuffle in corresponding modules. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-07-25setlocalversion: do not describe if there is nothing to describeSebastian Siewior
Jan Engelhardt wrote: > Just a note that when you run git-describe, you should probably quiten it. > > fatal: cannot describe 'bd7364a0fd5a4a2878fe4a224be1b142a4e6698e' > > This happens when tags are not present, which can happen if Linus's tree > is sent upwards again, IOW: > > machine1$ git-clone torvalds/linux-2.6.git > machine1$ git push elsewhere master > > machine2$ git-clone elsewhere:/linux > machine2$ git-describe HEAD > fatal: cannot describe that Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc> Acked-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-03kbuild: add svn revision information to setlocalversionBryan Wu
follow git and mercurial style, include uncommitted changes detect Cc: Frans Pop <elendil@planet.nl> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kbuild: fix false positive -dirty tag caused by make-kpkgTheodore Ts'o
make-kpkg modifies scripts/package/Makefile and deletes scripts/package/builddeb as part of its build process. Ignore these changes so the tree isn't marked as -dirty, when it is just an artifact of make-kpkg. (make-kpkg clean restores the files to their original state, and these helper scripts won't affect the final compiled kernel in any way.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kbuild: fix scripts/setlocalversion to avoid erroneous -dirty tagTheodore Ts'o
If git's index file is out of date, and some files have been touched such that their timestamp doesn't what is in the index, "git diff-index HEAD" may show that a particular file is dirty, when in fact it really isn't. Running "git update-index" will update the index to avoid these false positives. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kbuild: change CONFIG_LOCALVERSION_AUTO to use a git-describe-ish formatTheodore Ts'o
Change the automatic local version to have the form -nnnnn-gSHA1SUMID, where 'nnnnn' is the number of commits since the last tag (i.e., 2.6.21-rc7). This makes it much more likely that the package names created for the kernel will look "newer" to a package manager. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kbuild: support mercurial in setlocalversionAron Griffis
This represents mercurial changesets similarly to git. For untagged revisions, append the changeset id. If there are uncommitted changes, append -dirty. For example, -hgc60016ba6237-dirty Signed-off-by: Aron Griffis <aron@hp.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-16kbuild: append -dirty for updated but uncommited changesUwe Zeisberger
Compare the working copy with the last commit, instead of the index. Signed-off-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de> Acked-by: Ryan Anderson <ryan@michonline.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-16kbuild: append git revision for all untagged commitsUwe Zeisberger
adds revision suffix for untagged commits that are reachable from a tag I'm bisecting and don't get the -g...... suffix. The reason is, that git name-rev --tags HEAD returns e.g. HEAD tags/v2.6.17-rc1^0~1067 which is currently good enough for setlocalversion to skip the suffix. This introduces a dependecy to grep -E, which should be fine. Signed-off-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de> Acked-By: Ryan Anderson <ryan@michonline.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-01-08kbuild: In setlocalversion change -git_dirty to just -dirtyRyan Anderson
When building Debian packages directly from the git tree, the appended "git_dirty" is a problem due to the underscore. In order to cause the least problems, change that just to "dirty". Signed-off-by: Ryan Anderson <ryan@michonline.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-01-06kbuild: Use git in scripts/setlocalversionRene Scharfe
Currently scripts/setlocalversion is a Perl script that tries to figure out the current git commit ID of a repo without using git. It also imports Digest::MD5 without using it and generally is too big for the small task it does. :] And it always reports a git ID, even when the HEAD is tagged -- this is a bug. This patch replaces it with a Bourne Shell script that uses git commands to do the same. I can't come up with a scenario where someone would use a git repo and refuse to install git core at the same time, so I think it's reasonable to assume git is available. The new script also reports uncommitted changes by adding -git_dirty to the version string. Obviously you can't see from that _what_ has been changed from the last commit, so it's more of a reminder that you forgot to commit something. The script is easily extensible: simply add a check for Mercurial (or whatever) below the git check. Note: the script doesn't print a newline char anymore. That's only because it was easier to implement it that way, not a feature (or bug). 'make kernelrelease' doesn't care. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Acked-by: Ryan Anderson <ryan@michonline.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-08-10[PATCH] kbuild: automatically append a short string to the version based ↵Ryan Anderson
upon the git commit If CONFIG_AUTO_LOCALVERSION is set, the user is using a git-based tree, and the current HEAD is not referred to by any tags in .git/refs/tags/, append -g and the first 8 characters of the commit to the version string. This makes it easier to use git-bisect, and/or to do a daily build, without trampling on your older, working builds, or accidentally setting up conflicting sets of modules. Signed-off-by: Ryan Anderson <ryan@michonline.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>