summaryrefslogblamecommitdiffstats
path: root/scripts/setlocalversion
blob: 63d91e22ed7ccd18a0cd77852af647112ed216bb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
         








                                                                   
 
         
                                                          
              

 

              
                                        









                                         
 

             

                   
 

                                    
                               




                                      
 
                                       

                                                                       




















                                                                                            
 


                                                                       
                  
 
                                               
                                                                                      

                                          
 

                                   
          
 
                                                   
                                                        


                                                                                    
                                               





                                                                           
                  
 




                                                                    
 

                                         

          
                                       
                                                                                                  

                                                   
 






















                                                



                                        
            
  
 
                                         
                                  



                                                                               
 













                                                           



                                                                



                                                    
  

           
#!/bin/sh
#
# This scripts adds local version information from the version
# control systems git, mercurial (hg) and subversion (svn).
#
# If something goes wrong, send a mail the kernel build mailinglist
# (see MAINTAINERS) and CC Nico Schottelius
# <nico-linuxsetlocalversion -at- schottelius.org>.
#
#

usage() {
	echo "Usage: $0 [--save-scmversion] [srctree]" >&2
	exit 1
}

scm_only=false
srctree=.
if test "$1" = "--save-scmversion"; then
	scm_only=true
	shift
fi
if test $# -gt 0; then
	srctree=$1
	shift
fi
if test $# -gt 0 -o ! -d "$srctree"; then
	usage
fi

scm_version()
{
	local short
	short=false

	cd "$srctree"
	if test -e .scmversion; then
		cat .scmversion
		return
	fi
	if test "$1" = "--short"; then
		short=true
	fi

	# Check for git and a git repo.
	if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
	   head=`git rev-parse --verify --short HEAD 2>/dev/null`; then

		# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
		# it, because this version is defined in the top level Makefile.
		if [ -z "`git describe --exact-match 2>/dev/null`" ]; then

			# If only the short version is requested, don't bother
			# running further git commands
			if $short; then
				echo "+"
				return
			fi
			# If we are past a tagged commit (like
			# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
			if atag="`git describe 2>/dev/null`"; then
				echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'

			# If we don't have a tag at all we print -g{commitish}.
			else
				printf '%s%s' -g $head
			fi
		fi

		# Is this git on svn?
		if git config --get svn-remote.svn.url >/dev/null; then
			printf -- '-svn%s' "`git svn find-rev $head`"
		fi

		# Check for uncommitted changes
		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
			printf '%s' -dirty
		fi

		# All done with git
		return
	fi

	# Check for mercurial and a mercurial repo.
	if test -d .hg && hgid=`hg id 2>/dev/null`; then
		# Do we have an tagged version?  If so, latesttagdistance == 1
		if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
			id=`hg log -r . --template '{latesttag}'`
			printf '%s%s' -hg "$id"
		else
			tag=`printf '%s' "$hgid" | cut -d' ' -f2`
			if [ -z "$tag" -o "$tag" = tip ]; then
				id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
				printf '%s%s' -hg "$id"
			fi
		fi

		# Are there uncommitted changes?
		# These are represented by + after the changeset id.
		case "$hgid" in
			*+|*+\ *) printf '%s' -dirty ;;
		esac

		# All done with mercurial
		return
	fi

	# Check for svn and a svn repo.
	if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
		rev=`echo $rev | awk '{print $NF}'`
		printf -- '-svn%s' "$rev"

		# All done with svn
		return
	fi
}

collect_files()
{
	local file res

	for file; do
		case "$file" in
		*\~*)
			continue
			;;
		esac
		if test -e "$file"; then
			res="$res$(cat "$file")"
		fi
	done
	echo "$res"
}

if $scm_only; then
	if test ! -e .scmversion; then
		res=$(scm_version)
		echo "$res" >.scmversion
	fi
	exit
fi

if test -e include/config/auto.conf; then
	. include/config/auto.conf
else
	echo "Error: kernelrelease not valid - run 'make prepare' to update it"
	exit 1
fi

# localversion* files in the build and source directory
res="$(collect_files localversion*)"
if test ! "$srctree" -ef .; then
	res="$res$(collect_files "$srctree"/localversion*)"
fi

# CONFIG_LOCALVERSION and LOCALVERSION (if set)
res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"

# scm version string if not at a tagged commit
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
	# full scm version string
	res="$res$(scm_version)"
else
	# append a plus sign if the repository is not in a clean
	# annotated or signed tagged state (as git describe only
	# looks at signed or annotated tags - git tag -a/-s) and
	# LOCALVERSION= is not specified
	if test "${LOCALVERSION+set}" != "set"; then
		scm=$(scm_version --short)
		res="$res${scm:++}"
	fi
fi

echo "$res"
8363bb1f08d44c50f3252'>a80a6b85b428 ^
b030a4dd609e ^

1da177e4c3f4
5071f97ec6d7 ^
1da177e4c3f4
5071f97ec6d7 ^

1da177e4c3f4

5071f97ec6d7 ^
3fb0e584a68c ^












5071f97ec6d7 ^









3fe4a975d662 ^
5071f97ec6d7 ^


1da177e4c3f4
5071f97ec6d7 ^

3fe4a975d662 ^
1da177e4c3f4
5071f97ec6d7 ^
1da177e4c3f4
5071f97ec6d7 ^


1da177e4c3f4
5071f97ec6d7 ^
1da177e4c3f4
5071f97ec6d7 ^




b70c39409985 ^
3fe4a975d662 ^
5071f97ec6d7 ^
1da177e4c3f4



abff55cee103 ^

1da177e4c3f4


5071f97ec6d7 ^
3fe4a975d662 ^
5071f97ec6d7 ^
1da177e4c3f4

5071f97ec6d7 ^
1da177e4c3f4
5071f97ec6d7 ^

1da177e4c3f4

5071f97ec6d7 ^
1da177e4c3f4
3fe4a975d662 ^
5071f97ec6d7 ^




02edc6fc4d5f ^
























2dfa4eeab0fc ^

















5071f97ec6d7 ^

2dfa4eeab0fc ^

5071f97ec6d7 ^














3fe4a975d662 ^

5071f97ec6d7 ^
3fe4a975d662 ^


1da177e4c3f4

971316f0503a ^











1da177e4c3f4
d1bc90dd5d03 ^


1da177e4c3f4
7699acd1341c ^
1da177e4c3f4
7699acd1341c ^

1da177e4c3f4
d1bc90dd5d03 ^

1da177e4c3f4
d1bc90dd5d03 ^
971316f0503a ^
d1bc90dd5d03 ^
1da177e4c3f4
1da177e4c3f4

eea1d585917c ^































5071f97ec6d7 ^







d8805e633e05 ^
67347fe4e632 ^
5071f97ec6d7 ^





67347fe4e632 ^
5071f97ec6d7 ^



296e236e96dd ^
5071f97ec6d7 ^


e057e15ff66a ^
5071f97ec6d7 ^
67347fe4e632 ^


5071f97ec6d7 ^









296e236e96dd ^
5071f97ec6d7 ^





















4d7e30d98939 ^
5071f97ec6d7 ^
eea1d585917c ^
4d7e30d98939 ^
5071f97ec6d7 ^











4d7e30d98939 ^
5071f97ec6d7 ^


296e236e96dd ^

5071f97ec6d7 ^







67347fe4e632 ^

5071f97ec6d7 ^







ae10b2b4eb01 ^





1da177e4c3f4
7699acd1341c ^
c7ea76302547 ^
7699acd1341c ^


7699acd1341c ^

1da177e4c3f4

7699acd1341c ^





1da177e4c3f4
7699acd1341c ^
1da177e4c3f4
7699acd1341c ^
684999149002 ^
ae10b2b4eb01 ^
684999149002 ^
1da177e4c3f4
cdac75e6f2fe ^
1da177e4c3f4
c7ea76302547 ^



1da177e4c3f4
eea1d585917c ^
ae10b2b4eb01 ^







1da177e4c3f4
52bd19f7691b ^
7ef9964e6d1b ^
c7ea76302547 ^
1da177e4c3f4

7699acd1341c ^
1da177e4c3f4
7699acd1341c ^

1da177e4c3f4
7699acd1341c ^

5071f97ec6d7 ^
1da177e4c3f4
7699acd1341c ^


d47de16c7221 ^
7699acd1341c ^

25985edcedea ^
7699acd1341c ^

1da177e4c3f4

7699acd1341c ^
1da177e4c3f4
7699acd1341c ^



91cf5ab60ff8 ^
7699acd1341c ^
1da177e4c3f4

7699acd1341c ^

d47de16c7221 ^
7699acd1341c ^
ddf676c38b56 ^

1da177e4c3f4
ddf676c38b56 ^
c80544dc0b87 ^
7699acd1341c ^

91cf5ab60ff8 ^
7699acd1341c ^
ddf676c38b56 ^
1da177e4c3f4
7699acd1341c ^
d47de16c7221 ^
7ef9964e6d1b ^
4d7e30d98939 ^
f0ee9aabb052 ^
7699acd1341c ^
1da177e4c3f4
7699acd1341c ^


1da177e4c3f4
f0ee9aabb052 ^
7699acd1341c ^
7699acd1341c ^
7699acd1341c ^
1da177e4c3f4

450d89ec0a91 ^






296e236e96dd ^

5071f97ec6d7 ^

626cf2366085 ^
5071f97ec6d7 ^
626cf2366085 ^
450d89ec0a91 ^
5071f97ec6d7 ^
450d89ec0a91 ^
5071f97ec6d7 ^
296e236e96dd ^
5071f97ec6d7 ^




eea1d585917c ^
5071f97ec6d7 ^
296e236e96dd ^
5071f97ec6d7 ^




67347fe4e632 ^







5071f97ec6d7 ^

67347fe4e632 ^



5071f97ec6d7 ^

7699acd1341c ^

5071f97ec6d7 ^
7699acd1341c ^
67347fe4e632 ^







1da177e4c3f4
7699acd1341c ^


5071f97ec6d7 ^






67347fe4e632 ^
7699acd1341c ^
296e236e96dd ^
7699acd1341c ^

138d22b58696 ^
a3816ab0e8fe ^
138d22b58696 ^


138d22b58696 ^




a3816ab0e8fe ^



138d22b58696 ^


138d22b58696 ^


7699acd1341c ^

138d22b58696 ^


7699acd1341c ^
6038f373a3dc ^

7699acd1341c ^

b611967de4dc ^
7699acd1341c ^


b611967de4dc ^
7699acd1341c ^
b611967de4dc ^
7699acd1341c ^
ebe06187bf2a ^
b611967de4dc ^

684999149002 ^
7699acd1341c ^
25985edcedea ^
5071f97ec6d7 ^
67647d0fb8bc ^
d47de16c7221 ^
7699acd1341c ^
d47de16c7221 ^
7699acd1341c ^
684999149002 ^

b611967de4dc ^
7699acd1341c ^
ebe06187bf2a ^
7699acd1341c ^
d8805e633e05 ^
7699acd1341c ^
d47de16c7221 ^
b611967de4dc ^
7699acd1341c ^
b611967de4dc ^

53d2be79d598 ^
1da177e4c3f4
7ef9964e6d1b ^


1da177e4c3f4
7ef9964e6d1b ^
7ef9964e6d1b ^



1da177e4c3f4
c7ea76302547 ^
d47de16c7221 ^
1da177e4c3f4



d47de16c7221 ^
7ef9964e6d1b ^
1da177e4c3f4
53d2be79d598 ^
1da177e4c3f4
1da177e4c3f4
7ef9964e6d1b ^



1da177e4c3f4

1da177e4c3f4
c7ea76302547 ^


1da177e4c3f4



1da177e4c3f4



b030a4dd609e ^
1da177e4c3f4

b030a4dd609e ^
1da177e4c3f4




1da177e4c3f4



1da177e4c3f4
1da177e4c3f4


1da177e4c3f4
7699acd1341c ^
bf6a41db7726 ^
7699acd1341c ^
1da177e4c3f4
7699acd1341c ^
1da177e4c3f4
7699acd1341c ^



df0108c5da56 ^
1da177e4c3f4
971316f0503a ^







d80e731ecab4 ^
971316f0503a ^
d80e731ecab4 ^
c7ea76302547 ^
1da177e4c3f4
7699acd1341c ^






d47de16c7221 ^


2dfa4eeab0fc ^








bf6a41db7726 ^
d47de16c7221 ^
bf6a41db7726 ^
d47de16c7221 ^





4d7e30d98939 ^







d47de16c7221 ^


1da177e4c3f4
7699acd1341c ^
4d7e30d98939 ^
5071f97ec6d7 ^
eea1d585917c ^
4d7e30d98939 ^
7699acd1341c ^
7699acd1341c ^



df0108c5da56 ^
b6a515c8a0f6 ^















4a6e9e2ce822 ^
df0108c5da56 ^
7699acd1341c ^


d47de16c7221 ^
c7ea76302547 ^
1da177e4c3f4
7699acd1341c ^

5071f97ec6d7 ^
7699acd1341c ^
df0108c5da56 ^


7699acd1341c ^

1da177e4c3f4







b030a4dd609e ^
1da177e4c3f4

e94b1766097d ^
1da177e4c3f4


df0108c5da56 ^



1da177e4c3f4

296e236e96dd ^
1da177e4c3f4

296e236e96dd ^
1da177e4c3f4

1da177e4c3f4








b030a4dd609e ^
1da177e4c3f4








a80a6b85b428 ^

28d82dc1c4ed ^
















93dc6107a76d ^



28d82dc1c4ed ^



















ae10b2b4eb01 ^


28d82dc1c4ed ^




















ae10b2b4eb01 ^
28d82dc1c4ed ^














28d82dc1c4ed ^




28d82dc1c4ed ^









4d7e30d98939 ^


eea1d585917c ^
4d7e30d98939 ^







eea1d585917c ^


4d7e30d98939 ^
eea1d585917c ^
4d7e30d98939 ^



eea1d585917c ^

4d7e30d98939 ^
eea1d585917c ^

d6d67e7231c9 ^
eea1d585917c ^







4d7e30d98939 ^

c7ea76302547 ^


1da177e4c3f4
67347fe4e632 ^
1da177e4c3f4


52bd19f7691b ^
1da177e4c3f4


52bd19f7691b ^

7ef9964e6d1b ^
e94b1766097d ^
7ef9964e6d1b ^
1da177e4c3f4

1da177e4c3f4

1da177e4c3f4

b030a4dd609e ^
1da177e4c3f4
1da177e4c3f4
d47de16c7221 ^
4d7e30d98939 ^




eea1d585917c ^
4d7e30d98939 ^
1da177e4c3f4







c7ea76302547 ^


1da177e4c3f4
450d89ec0a91 ^
1da177e4c3f4





7ef9964e6d1b ^
1da177e4c3f4
7699acd1341c ^
1da177e4c3f4

684999149002 ^
ae10b2b4eb01 ^
684999149002 ^
1da177e4c3f4
c7ea76302547 ^



1da177e4c3f4

28d82dc1c4ed ^

67347fe4e632 ^
28d82dc1c4ed ^

c7ea76302547 ^


1da177e4c3f4
b030a4dd609e ^
1da177e4c3f4
eea1d585917c ^
1da177e4c3f4


4a6e9e2ce822 ^
1da177e4c3f4



c7ea76302547 ^
1da177e4c3f4
52bd19f7691b ^
7ef9964e6d1b ^
1da177e4c3f4

5071f97ec6d7 ^
1da177e4c3f4
1da177e4c3f4

28d82dc1c4ed ^

ae10b2b4eb01 ^
28d82dc1c4ed ^



7699acd1341c ^
1da177e4c3f4



67647d0fb8bc ^


1da177e4c3f4
c7ea76302547 ^
b030a4dd609e ^
6192bd536f96 ^
c7ea76302547 ^
1da177e4c3f4
eea1d585917c ^
4d7e30d98939 ^

b030a4dd609e ^
7ef9964e6d1b ^
1da177e4c3f4


1da177e4c3f4

c7ea76302547 ^
1da177e4c3f4




626cf2366085 ^


1da177e4c3f4

e057e15ff66a ^


1da177e4c3f4
128dd1759d96 ^
e057e15ff66a ^
4d7e30d98939 ^
eea1d585917c ^
4d7e30d98939 ^
eea1d585917c ^
4d7e30d98939 ^

1da177e4c3f4

128dd1759d96 ^



















1da177e4c3f4


450d89ec0a91 ^
1da177e4c3f4
1da177e4c3f4
c7ea76302547 ^
67647d0fb8bc ^
1da177e4c3f4
c7ea76302547 ^
e057e15ff66a ^
c7ea76302547 ^

eea1d585917c ^
c7ea76302547 ^


4a6e9e2ce822 ^
c7ea76302547 ^

7699acd1341c ^
e057e15ff66a ^
7699acd1341c ^
1da177e4c3f4
7699acd1341c ^

5071f97ec6d7 ^
1da177e4c3f4
7699acd1341c ^
1da177e4c3f4

296e236e96dd ^

1da177e4c3f4
5071f97ec6d7 ^

296e236e96dd ^
5071f97ec6d7 ^

eea1d585917c ^
626cf2366085 ^


1da177e4c3f4
296e236e96dd ^
5071f97ec6d7 ^


296e236e96dd ^
5071f97ec6d7 ^


d47de16c7221 ^
4d7e30d98939 ^








eea1d585917c ^






d47de16c7221 ^
1da177e4c3f4
450d89ec0a91 ^
5071f97ec6d7 ^
296e236e96dd ^
5071f97ec6d7 ^



296e236e96dd ^

5071f97ec6d7 ^
d03058828257 ^

eea1d585917c ^
296e236e96dd ^
d03058828257 ^
296e236e96dd ^
5071f97ec6d7 ^
296e236e96dd ^







25985edcedea ^
296e236e96dd ^





eea1d585917c ^
296e236e96dd ^


5071f97ec6d7 ^


d47de16c7221 ^
296e236e96dd ^

5071f97ec6d7 ^

1da177e4c3f4
5071f97ec6d7 ^

6192bd536f96 ^
67347fe4e632 ^
1da177e4c3f4

766b9f928bd5 ^
0781b909b558 ^
766b9f928bd5 ^
0781b909b558 ^



766b9f928bd5 ^

0781b909b558 ^

f4d93ad74c18 ^
















1da177e4c3f4


f4d93ad74c18 ^
1da177e4c3f4
da8b44d5a9f8 ^
1da177e4c3f4
95aac7b1cd22 ^


766b9f928bd5 ^
0781b909b558 ^
95aac7b1cd22 ^

766b9f928bd5 ^
95aac7b1cd22 ^
f4d93ad74c18 ^



95aac7b1cd22 ^
f4d93ad74c18 ^

95aac7b1cd22 ^
1da177e4c3f4
f4d93ad74c18 ^
c7ea76302547 ^
1da177e4c3f4
3fb0e584a68c ^
1da177e4c3f4





a93d2f174420 ^
1da177e4c3f4







3fb0e584a68c ^
1da177e4c3f4





c7ea76302547 ^
c511851de162 ^
95aac7b1cd22 ^

c7ea76302547 ^
1da177e4c3f4
1da177e4c3f4
4d5755b14766 ^

1da177e4c3f4
f4d93ad74c18 ^
1da177e4c3f4
3fb0e584a68c ^
1da177e4c3f4
c7ea76302547 ^
1da177e4c3f4






95aac7b1cd22 ^
f4d93ad74c18 ^
1da177e4c3f4



22bacca48a17 ^



















28d82dc1c4ed ^
22bacca48a17 ^


d8805e633e05 ^
28d82dc1c4ed ^

22bacca48a17 ^


28d82dc1c4ed ^


22bacca48a17 ^
28d82dc1c4ed ^

22bacca48a17 ^

28d82dc1c4ed ^











22bacca48a17 ^



















28d82dc1c4ed ^



22bacca48a17 ^
28d82dc1c4ed ^



















22bacca48a17 ^

7699acd1341c ^
523723bb5032 ^
7699acd1341c ^
5a8a82b1d306 ^
7699acd1341c ^
28d82dc1c4ed ^
bb57c3edcd2f ^
28d82dc1c4ed ^
7699acd1341c ^
e38b36f32515 ^


296e236e96dd ^

7699acd1341c ^
bb57c3edcd2f ^
7699acd1341c ^
9fe5ad9c8cef ^
bb57c3edcd2f ^

7699acd1341c ^

2030a42cecd4 ^
7699acd1341c ^
28d82dc1c4ed ^





628ff7c1d8d8 ^
28d82dc1c4ed ^



28d82dc1c4ed ^
98022748f6c7 ^
28d82dc1c4ed ^





bb57c3edcd2f ^
7699acd1341c ^