/[gentoo-alt]/trunk/toolchain-prefix-wrapper/bootstrap
Gentoo

Contents of /trunk/toolchain-prefix-wrapper/bootstrap

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1718 - (show annotations) (download)
Wed Feb 22 19:41:12 2012 UTC (3 years, 2 months ago) by grobian
File size: 2997 byte(s)
bootstrap: deal with top-dir style .svn dir
1 #!/usr/bin/env sh
2 # Copyright 2007-2012 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # Author: Michael Haubenwallner <haubi@gentoo.org>
5
6 set -e
7
8 versioning_done=no
9
10 while [ "x$1" != x ]; do
11 arg=$1
12 shift
13 case "x${arg}" in
14 x--version=*)
15 echo "x${arg}" | sed -e 's,^x--version=,,' > version
16 versioning_done=yes
17 ;;
18 esac
19 done
20 svnurl='$HeadURL$'
21
22 mainversion=`grep 'AC_INIT(toolchain-prefix-wrapper,[0-9\.]*svnversion)' configure.ac | sed -e 's/.*([^,]*,\([^),]*\)\.svnversion\>.*)/\1/'`
23 if [ "x${mainversion}" != x ]; then
24 # configure.ac indicates to define the package-version automagically
25 if [ "x${versioning_done}" != xyes ] && svn info >& /dev/null ; then
26 svnversion=`svn --version 2>/dev/null | head -n 1`
27 case ${svnversion} in
28 *" version 1."[6-7]"."*) revisionrange="20-27" ;;
29 *" version 1."[0-5]"."*) revisionrange="19-26" ;;
30 *) echo "don't know how to work with ${svnversion}" >&2; exit 1 ;;
31 esac
32 # we are in an svn sandbox:
33 # then we need to determine the version out of svn keyword 'HeadURL'.
34 case "${svnurl}" in
35 *'/trunk/'*)
36 # is snapshot from trunk:
37 # version is mainversion + '.' + [last-committed] svn revision
38 svn status -v | cut -c${revisionrange} | sort -rn | { read v ; echo "${mainversion}.${v}" ;} > version
39 versioning_done=yes
40 ;;
41 *'/branches/'*)
42 # is snapshot from branch:
43 # version is branch-number + '.' + [last-committed] svn revision
44 ( echo -n "${svnurl}" \
45 | sed -e "s,-branch/bootstrap \\\$,,; s,.*/,," -e "s,^.*-,,"
46 svn status -v | cut -c${revisionrange} | sort -rn | { read v ; echo ".${v}" ;}
47 ) > version
48 versioning_done=yes
49 ;;
50 esac
51 fi
52 if [ "x${versioning_done}" != xyes ]; then
53 case "${svnurl}" in
54 *'/tags/'*)
55 # is tag: version is tag number
56 ( echo "${svnurl}" \
57 | sed -e "s,/bootstrap \\\$,,; s,.*-,,"
58 ) > version
59 versioning_done=yes
60 ;;
61 *)
62 if [ -r version ]; then
63 # we reuse the 'version' determined during packaging from svn.
64 versioning_done=yes
65 fi
66 ;;
67 esac
68 fi
69 if [ "x${versioning_done}" != xyes ]; then
70 echo "error: no 'version' file and unknown svnurl '${svnurl}'" >&2
71 echo "error: cannot determine package version" >&2
72 exit 1
73 fi
74 else
75 # configure.ac defines the version, keep 'version' empty.
76 : > version
77 fi
78 set +x
79
80 echo "mkdir -p build-aux"
81 mkdir -p build-aux
82 echo "aclocal"
83 aclocal
84 echo "autoheader"
85 autoheader
86 echo "automake --add-missing --copy --foreign"
87 automake --add-missing --copy --foreign
88 echo "autoconf"
89 autoconf
90
91 if [ -s version ]; then
92 version=`cat version`
93 eval `grep '^PACKAGE_VERSION=' configure | head -n 1`
94 if [ "${version}" != "${PACKAGE_VERSION}" ]; then
95 (
96 echo '--- configure'
97 echo '+++ configure'
98 grep "\<${PACKAGE_VERSION}\>" configure \
99 | awk '{print "@@ -1,1 +1,1 @@"; print "-" $0; print "+" $0}' \
100 | sed -e "s|\(^+.*\)\<${PACKAGE_VERSION}\>|\1${version}|"
101 ) | patch --no-backup-if-mismatch configure -
102 fi
103 fi

Properties

Name Value
svn:executable
svn:keywords HeadURL

  ViewVC Help
Powered by ViewVC 1.1.20