diff options
author | Roger Leigh <rleigh@debian.org> | 2009-08-01 14:53:58 +0100 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2009-08-01 14:53:58 +0100 |
commit | dd3f92d076b8bed1b7e0d93d24923c750d9206bf (patch) | |
tree | 3e4f43ae35239c42f0a61453a2e4bdf90854713c | |
parent | fd1dd4f9e5b972f054d230e1875efe6bac1e0945 (diff) | |
download | schroot-dd3f92d076b8bed1b7e0d93d24923c750d9206bf.tar.gz |
build: Add git tagging code
-rwxr-xr-x | bootstrap | 21 | ||||
-rw-r--r-- | configure.ac | 39 | ||||
-rwxr-xr-x | debian/git-tag-debian | 17 | ||||
-rwxr-xr-x | scripts/git-tag-release | 14 | ||||
-rwxr-xr-x | scripts/git-version | 17 |
5 files changed, 68 insertions, 40 deletions
@@ -1,21 +1,16 @@ #!/bin/sh -if [ -d m4 ]; then - : -else - mkdir m4 -fi -if [ -d scripts ]; then - : -else - mkdir scripts -fi -sed -e "s/@RELEASE_DATE@/`date '+%d %b %Y'`/" -e "s/@RELEASE_UDATE@/`date '+%s'`/" scripts/schroot_release.m4.in > m4/schroot_release.m4 + +set -e + +# Generate version information from git release tag + +./scripts/git-version > VERSION # To satisfy automake touch ChangeLog +# Bootstrap autotools autoreconf --verbose --force --install -rm -rf autom4te.cache/ +rm -rf autom4te.cache rm -f config.h.in~ - diff --git a/configure.ac b/configure.ac index 32565953..75a647aa 100644 --- a/configure.ac +++ b/configure.ac @@ -37,21 +37,21 @@ dnl SBUILD_BINARY_AGE = 0; dnl dnl For more detailed information, see the libtool info documentation. dnl -pushdef([SBUILD_NAME], [schroot]) -pushdef([SBUILD_MAJOR_VERSION], [1]) -pushdef([SBUILD_MINOR_VERSION], [3]) -pushdef([SBUILD_MICRO_VERSION], [0]) -pushdef([SBUILD_EXTRA_VERSION], []) +dnl m4 magic from Eric Blake <ebb9@byu.net>, prior to automake inclusion +m4_define([sbuild_m4_chomp], +[m4_format([[%.*s]], m4_bregexp(m4_translit([$1], [ +]]m4_dquote(_m4_defn([m4_cr_all]))[, [/]]m4_format([%255s], [])[), + [/*$]), [$1])]) +m4_define([sbuild_m4_esyscmd_s], +[sbuild_m4_chomp(m4_esyscmd([$1]))]) +AC_PREREQ(2.59) +dnl Quoting the first argument results in a bizarrely corrupted package tarname +AC_INIT(sbuild_m4_esyscmd_s([sed -ne '/^Package:/{s/Package:[[:space:]][[:space:]]*//p;q}' VERSION]), + [sbuild_m4_esyscmd_s([sed -ne '/^Version:/{s/Version:[[:space:]][[:space:]]*//p;q}' VERSION])], + [buildd-tools-devel@lists.alioth.debian.org]) pushdef([SBUILD_CURRENT_INTERFACE], [1]) pushdef([SBUILD_INTERFACE_AGE], [0]) pushdef([SBUILD_BINARY_AGE], [0]) -pushdef([SBUILD_VERSION], SBUILD_MAJOR_VERSION.SBUILD_MINOR_VERSION.SBUILD_MICRO_VERSION[]SBUILD_EXTRA_VERSION) -dnl -dnl The minimum version of autoconf required. -AC_PREREQ(2.59) -dnl Initialise autoconf with the package name, version and -dnl bug-reporting address. -AC_INIT(SBUILD_NAME, SBUILD_VERSION, [buildd-tools-devel@lists.alioth.debian.org]) dnl For safety, check we are in the right directory by dnl checking for a known unique file. AC_CONFIG_SRCDIR([sbuild/sbuild-session.cc]) @@ -80,31 +80,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ]) -[SBUILD_MAJOR_VERSION]=SBUILD_MAJOR_VERSION -[SBUILD_MINOR_VERSION]=SBUILD_MINOR_VERSION -[SBUILD_MICRO_VERSION]=SBUILD_MICRO_VERSION -[SBUILD_EXTRA_VERSION]=SBUILD_EXTRA_VERSION [SBUILD_CURRENT_INTERFACE]=SBUILD_CURRENT_INTERFACE [SBUILD_INTERFACE_AGE]=SBUILD_INTERFACE_AGE [SBUILD_BINARY_AGE]=SBUILD_BINARY_AGE -[SBUILD_VERSION]=SBUILD_VERSION -popdef([SBUILD_MAJOR_VERSION]) -popdef([SBUILD_MINOR_VERSION]) -popdef([SBUILD_MICRO_VERSION]) -popdef([SBUILD_EXTRA_VERSION]) popdef([SBUILD_CURRENT_INTERFACE]) popdef([SBUILD_INTERFACE_AGE]) popdef([SBUILD_BINARY_AGE]) -popdef([SBUILD_NAME]) -popdef([SBUILD_VERSION]) -AC_SUBST([SBUILD_MAJOR_VERSION]) -AC_SUBST([SBUILD_MINOR_VERSION]) -AC_SUBST([SBUILD_MICRO_VERSION]) AC_SUBST([SBUILD_CURRENT_INTERFACE]) AC_SUBST([SBUILD_INTERFACE_AGE]) AC_SUBST([SBUILD_BINARY_AGE]) -AC_SUBST([SBUILD_VERSION]) dnl Initialise automake stuff. AM_INIT_AUTOMAKE([1.9 gnu check-news dist-bzip2 no-dist-gzip tar-pax]) diff --git a/debian/git-tag-debian b/debian/git-tag-debian new file mode 100755 index 00000000..366dc56b --- /dev/null +++ b/debian/git-tag-debian @@ -0,0 +1,17 @@ +#!/bin/sh + +DEBSOURCE="$(dpkg-parsechangelog | sed -ne '/^Source:/{s/Source:[[:space:]][[:space:]]*//p;q}')" +DEBVERSION="$(dpkg-parsechangelog | sed -ne '/^Version:/{s/Version:[[:space:]][[:space:]]*//p;q}')" +DEBDIST="$(dpkg-parsechangelog | sed -ne '/^Distribution:/{s/Distribution:[[:space:]][[:space:]]*//p;q}')" +DEBURGENCY="$(dpkg-parsechangelog | sed -ne '/^Urgency:/{s/Urgency:[[:space:]][[:space:]]*//p;q}')" + +if [ -z "$DEBSOURCE" ] || [ -z "$DEBVERSION" ] || \ + [ -z "$DEBDIST" ] || [ -z "$DEBURGENCY" ]; then + echo "Error parsing source, version, distribution and urgency from debian/changelog" + exit 1 +fi + +echo "Tagging ${DEBSOURCE}-${DEBVERSION} (dist=${DEBDIST}, urgency=${DEBURGENCY}) as 'debian/${DEBSOURCE}-${DEBVERSION}'" + +git tag -s "debian/${DEBSOURCE}-${DEBVERSION}" -m "${DEBSOURCE}-${DEBVERSION} (dist=${DEBDIST}, urgency=${DEBURGENCY})" + diff --git a/scripts/git-tag-release b/scripts/git-tag-release new file mode 100755 index 00000000..fb8a5e88 --- /dev/null +++ b/scripts/git-tag-release @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +PACKAGE="$(sed -ne '/^Welcome to /{s/Welcome to[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:]]*\)[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:].-]*\)\..*/\1/p;q}' < NEWS)" +VERSION="$(sed -ne '/^Welcome to /{s/Welcome to[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:]]*\)[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:].-]*\)\..*/\2/p;q}' < NEWS)" + +if [ -z "$PACKAGE" ] || [ -z "$VERSION" ]; then + echo "Error parsing package name and version from NEWS" + exit 1 +fi + +echo "Tagging ${PACKAGE} version ${VERSION} as 'release/${PACKAGE}-${VERSION}'" +git tag -s "release/${PACKAGE}-${VERSION}" -m "${PACKAGE} version ${VERSION}" diff --git a/scripts/git-version b/scripts/git-version new file mode 100755 index 00000000..88bf11bd --- /dev/null +++ b/scripts/git-version @@ -0,0 +1,17 @@ +#!/bin/sh + +TAG="$(git describe --abbrev=0 --match='release/*')" +PKGVER="${TAG#release/}" +PACKAGE="$(echo "$PKGVER" | sed -e 's/^\(.*\)-\(.*\)$/\1/')" +VERSION="$(echo "$PKGVER" | sed -e 's/^\(.*\)-\(.*\)$/\2/')" +COMMIT="$(git rev-parse "$TAG^{}")" +COMMIT_DATE="$(git log -1 --date=iso "$COMMIT" --pretty="format:%ad")" + +RELEASE_DATE="$(date --date="$COMMIT_DATE" '+%d %b %Y')" +RELEASE_BY="$(git show "$TAG" | sed -ne '/^Tagger:/{s/Tagger:[[:space:]][[:space:]]*//p;q}')" + +echo "Package: $PACKAGE" +echo "Version: $VERSION" +echo "Release-Date: $RELEASE_DATE" +echo "Released-By: $RELEASE_BY" +echo "Git-Tag: $TAG" |