Root/
1 | #!/bin/sh |
2 | # |
3 | # This scripts adds local version information from the version |
4 | # control systems git, mercurial (hg) and subversion (svn). |
5 | # |
6 | # If something goes wrong, send a mail the kernel build mailinglist |
7 | # (see MAINTAINERS) and CC Nico Schottelius |
8 | # <nico-linuxsetlocalversion -at- schottelius.org>. |
9 | # |
10 | # |
11 | |
12 | usage() { |
13 | echo "Usage: $0 [srctree]" >&2 |
14 | exit 1 |
15 | } |
16 | |
17 | cd "${1:-.}" || usage |
18 | |
19 | # Check for git and a git repo. |
20 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then |
21 | |
22 | # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it, |
23 | # because this version is defined in the top level Makefile. |
24 | if [ -z "`git describe --exact-match 2>/dev/null`" ]; then |
25 | |
26 | # If we are past a tagged commit (like "v2.6.30-rc5-302-g72357d5"), |
27 | # we pretty print it. |
28 | if atag="`git describe 2>/dev/null`"; then |
29 | echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' |
30 | |
31 | # If we don't have a tag at all we print -g{commitish}. |
32 | else |
33 | printf '%s%s' -g $head |
34 | fi |
35 | fi |
36 | |
37 | # Is this git on svn? |
38 | if git config --get svn-remote.svn.url >/dev/null; then |
39 | printf -- '-svn%s' "`git svn find-rev $head`" |
40 | fi |
41 | |
42 | # Update index only on r/w media |
43 | [ -w . ] && git update-index --refresh --unmerged > /dev/null |
44 | |
45 | # Check for uncommitted changes |
46 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ |
47 | | read dummy; then |
48 | printf '%s' -dirty |
49 | fi |
50 | |
51 | # All done with git |
52 | exit |
53 | fi |
54 | |
55 | # Check for mercurial and a mercurial repo. |
56 | if hgid=`hg id 2>/dev/null`; then |
57 | tag=`printf '%s' "$hgid" | cut -d' ' -f2` |
58 | |
59 | # Do we have an untagged version? |
60 | if [ -z "$tag" -o "$tag" = tip ]; then |
61 | id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` |
62 | printf '%s%s' -hg "$id" |
63 | fi |
64 | |
65 | # Are there uncommitted changes? |
66 | # These are represented by + after the changeset id. |
67 | case "$hgid" in |
68 | *+|*+\ *) printf '%s' -dirty ;; |
69 | esac |
70 | |
71 | # All done with mercurial |
72 | exit |
73 | fi |
74 | |
75 | # Check for svn and a svn repo. |
76 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
77 | rev=`echo $rev | awk '{print $NF}'` |
78 | printf -- '-svn%s' "$rev" |
79 | |
80 | # All done with svn |
81 | exit |
82 | fi |
83 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9