source: trunk/debathena/third/schroot/scripts/git-version @ 24167

Revision 24167, 963 bytes checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3PACKAGE="$(sed -ne '/^Welcome to /{s/Welcome to[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:]]*\)[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:].-]*\)\..*/\1/p;q}' < NEWS)"
4VERSION="$(sed -ne '/^Welcome to /{s/Welcome to[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:]]*\)[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:].-]*\)\..*/\2/p;q}' < NEWS)"
5
6TAG="release/${PACKAGE}-${VERSION}"
7COMMIT="$(git rev-parse "$TAG^{}")" 2>/dev/null || COMMIT=""
8
9if [ -n "$COMMIT" ]; then
10    COMMIT_DATE="$(git log -1 --date=iso "$COMMIT" --pretty="format:%ad")"
11
12    RELEASE_DATE="$(date --date="$COMMIT_DATE" '+%d %b %Y')"
13    RELEASE_BY="$(git show "$TAG" | sed -ne '/^Tagger:/{s/Tagger:[[:space:]][[:space:]]*//p;q}')"
14else
15    RELEASE_DATE="$(date '+%d %b %Y')"
16    RELEASE_BY="Unreleased"
17fi
18
19echo "Package: $PACKAGE"
20echo "Version: $VERSION"
21echo "Release-Date: $RELEASE_DATE"
22echo "Released-By: $RELEASE_BY"
23
24if [ -n "$COMMIT" ]; then
25    echo "Git-Tag: $TAG"
26fi
Note: See TracBrowser for help on using the repository browser.