diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2010-07-06 13:45:24 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-07-06 13:45:24 -0400 |
commit | a2262d8a231e92742651859a10c9a4430a5e899a (patch) | |
tree | b5a823e3f6a3f60e1dd995f113caf0b350228d84 /scripts | |
parent | ef06f55a5c936a395f3ee2e1237bbebdb4396c65 (diff) | |
parent | 815c4163b6c8ebf8152f42b0a5fd015cfdcedc78 (diff) |
Merge branch 'master' into for-linus
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/modpost.c | 2 | ||||
-rw-r--r-- | scripts/package/Makefile | 2 | ||||
-rwxr-xr-x | scripts/setlocalversion | 179 |
3 files changed, 134 insertions, 49 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3318692e4e76..f8779006986d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1342,7 +1342,7 @@ static unsigned int *reloc_location(struct elf_info *elf, | |||
1342 | int section = sechdr->sh_info; | 1342 | int section = sechdr->sh_info; |
1343 | 1343 | ||
1344 | return (void *)elf->hdr + sechdrs[section].sh_offset + | 1344 | return (void *)elf->hdr + sechdrs[section].sh_offset + |
1345 | (r->r_offset - sechdrs[section].sh_addr); | 1345 | r->r_offset - sechdrs[section].sh_addr; |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) | 1348 | static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 62fcc3a7f4d3..3a681ef25306 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -44,7 +44,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE | |||
44 | fi | 44 | fi |
45 | $(MAKE) clean | 45 | $(MAKE) clean |
46 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 46 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
47 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | 47 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --scm-only > $(objtree)/.scmversion |
48 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. | 48 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. |
49 | $(PREV) rm $(KERNELPATH) | 49 | $(PREV) rm $(KERNELPATH) |
50 | rm -f $(objtree)/.scmversion | 50 | rm -f $(objtree)/.scmversion |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 46989b88d734..d6a866ed1835 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -10,73 +10,158 @@ | |||
10 | # | 10 | # |
11 | 11 | ||
12 | usage() { | 12 | usage() { |
13 | echo "Usage: $0 [srctree]" >&2 | 13 | echo "Usage: $0 [--scm-only] [srctree]" >&2 |
14 | exit 1 | 14 | exit 1 |
15 | } | 15 | } |
16 | 16 | ||
17 | cd "${1:-.}" || usage | 17 | scm_only=false |
18 | srctree=. | ||
19 | if test "$1" = "--scm-only"; then | ||
20 | scm_only=true | ||
21 | shift | ||
22 | fi | ||
23 | if test $# -gt 0; then | ||
24 | srctree=$1 | ||
25 | shift | ||
26 | fi | ||
27 | if test $# -gt 0 -o ! -d "$srctree"; then | ||
28 | usage | ||
29 | fi | ||
18 | 30 | ||
19 | # Check for git and a git repo. | 31 | scm_version() |
20 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | 32 | { |
33 | local short=false | ||
21 | 34 | ||
22 | # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it, | 35 | cd "$srctree" |
23 | # because this version is defined in the top level Makefile. | 36 | if test -e .scmversion; then |
24 | if [ -z "`git describe --exact-match 2>/dev/null`" ]; then | 37 | cat "$_" |
38 | return | ||
39 | fi | ||
40 | if test "$1" = "--short"; then | ||
41 | short=true | ||
42 | fi | ||
25 | 43 | ||
26 | # If we are past a tagged commit (like "v2.6.30-rc5-302-g72357d5"), | 44 | # Check for git and a git repo. |
27 | # we pretty print it. | 45 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then |
28 | if atag="`git describe 2>/dev/null`"; then | 46 | |
29 | echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | 47 | # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore |
48 | # it, because this version is defined in the top level Makefile. | ||
49 | if [ -z "`git describe --exact-match 2>/dev/null`" ]; then | ||
50 | |||
51 | # If only the short version is requested, don't bother | ||
52 | # running further git commands | ||
53 | if $short; then | ||
54 | echo "+" | ||
55 | return | ||
56 | fi | ||
57 | # If we are past a tagged commit (like | ||
58 | # "v2.6.30-rc5-302-g72357d5"), we pretty print it. | ||
59 | if atag="`git describe 2>/dev/null`"; then | ||
60 | echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | ||
61 | |||
62 | # If we don't have a tag at all we print -g{commitish}. | ||
63 | else | ||
64 | printf '%s%s' -g $head | ||
65 | fi | ||
66 | fi | ||
30 | 67 | ||
31 | # If we don't have a tag at all we print -g{commitish}. | 68 | # Is this git on svn? |
32 | else | 69 | if git config --get svn-remote.svn.url >/dev/null; then |
33 | printf '%s%s' -g $head | 70 | printf -- '-svn%s' "`git svn find-rev $head`" |
34 | fi | 71 | fi |
35 | fi | ||
36 | 72 | ||
37 | # Is this git on svn? | 73 | # Update index only on r/w media |
38 | if git config --get svn-remote.svn.url >/dev/null; then | 74 | [ -w . ] && git update-index --refresh --unmerged > /dev/null |
39 | printf -- '-svn%s' "`git svn find-rev $head`" | ||
40 | fi | ||
41 | 75 | ||
42 | # Update index only on r/w media | 76 | # Check for uncommitted changes |
43 | [ -w . ] && git update-index --refresh --unmerged > /dev/null | 77 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ |
78 | | read dummy; then | ||
79 | printf '%s' -dirty | ||
80 | fi | ||
44 | 81 | ||
45 | # Check for uncommitted changes | 82 | # All done with git |
46 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | 83 | return |
47 | | read dummy; then | ||
48 | printf '%s' -dirty | ||
49 | fi | 84 | fi |
50 | 85 | ||
51 | # All done with git | 86 | # Check for mercurial and a mercurial repo. |
52 | exit | 87 | if hgid=`hg id 2>/dev/null`; then |
53 | fi | 88 | tag=`printf '%s' "$hgid" | cut -d' ' -f2` |
89 | |||
90 | # Do we have an untagged version? | ||
91 | if [ -z "$tag" -o "$tag" = tip ]; then | ||
92 | id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` | ||
93 | printf '%s%s' -hg "$id" | ||
94 | fi | ||
54 | 95 | ||
55 | # Check for mercurial and a mercurial repo. | 96 | # Are there uncommitted changes? |
56 | if hgid=`hg id 2>/dev/null`; then | 97 | # These are represented by + after the changeset id. |
57 | tag=`printf '%s' "$hgid" | cut -d' ' -f2` | 98 | case "$hgid" in |
99 | *+|*+\ *) printf '%s' -dirty ;; | ||
100 | esac | ||
58 | 101 | ||
59 | # Do we have an untagged version? | 102 | # All done with mercurial |
60 | if [ -z "$tag" -o "$tag" = tip ]; then | 103 | return |
61 | id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` | ||
62 | printf '%s%s' -hg "$id" | ||
63 | fi | 104 | fi |
64 | 105 | ||
65 | # Are there uncommitted changes? | 106 | # Check for svn and a svn repo. |
66 | # These are represented by + after the changeset id. | 107 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
67 | case "$hgid" in | 108 | rev=`echo $rev | awk '{print $NF}'` |
68 | *+|*+\ *) printf '%s' -dirty ;; | 109 | printf -- '-svn%s' "$rev" |
69 | esac | ||
70 | 110 | ||
71 | # All done with mercurial | 111 | # All done with svn |
112 | return | ||
113 | fi | ||
114 | } | ||
115 | |||
116 | collect_files() | ||
117 | { | ||
118 | local file res | ||
119 | |||
120 | for file; do | ||
121 | case "$file" in | ||
122 | *\~*) | ||
123 | continue | ||
124 | ;; | ||
125 | esac | ||
126 | if test -e "$file"; then | ||
127 | res="$res$(cat "$file")" | ||
128 | fi | ||
129 | done | ||
130 | echo "$res" | ||
131 | } | ||
132 | |||
133 | if $scm_only; then | ||
134 | scm_version | ||
72 | exit | 135 | exit |
73 | fi | 136 | fi |
74 | 137 | ||
75 | # Check for svn and a svn repo. | 138 | if test -e include/config/auto.conf; then |
76 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then | 139 | source "$_" |
77 | rev=`echo $rev | awk '{print $NF}'` | 140 | else |
78 | printf -- '-svn%s' "$rev" | 141 | echo "Error: kernelrelease not valid - run 'make prepare' to update it" |
142 | exit 1 | ||
143 | fi | ||
79 | 144 | ||
80 | # All done with svn | 145 | # localversion* files in the build and source directory |
81 | exit | 146 | res="$(collect_files localversion*)" |
147 | if test ! "$srctree" -ef .; then | ||
148 | res="$res$(collect_files "$srctree"/localversion*)" | ||
149 | fi | ||
150 | |||
151 | # CONFIG_LOCALVERSION and LOCALVERSION (if set) | ||
152 | res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" | ||
153 | |||
154 | # scm version string if not at a tagged commit | ||
155 | if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then | ||
156 | # full scm version string | ||
157 | res="$res$(scm_version)" | ||
158 | else | ||
159 | # apped a plus sign if the repository is not in a clean tagged | ||
160 | # state and LOCALVERSION= is not specified | ||
161 | if test "${LOCALVERSION+set}" != "set"; then | ||
162 | scm=$(scm_version --short) | ||
163 | res="$res${scm:++}" | ||
164 | fi | ||
82 | fi | 165 | fi |
166 | |||
167 | echo "$res" | ||