Factorize
[polysh.git] / release.sh
blob49e43855b20b8441a5f684b751e830200e712ebe
1 #!/bin/bash
3 set -x
4 set -e # Exit on error
6 PACKAGE=$(basename "$PWD")
7 mkdir dist
8 TEMPDIR="$(mktemp -d)"
9 VERSION=$(python -c "from $PACKAGE.version import VERSION; print VERSION")
10 echo "$PACKAGE-$VERSION: $TEMPDIR"
11 mkdir "$TEMPDIR/$PACKAGE-$VERSION"
12 git archive HEAD | (cd "$TEMPDIR/$PACKAGE-$VERSION" && tar vx)
13 DIR="$PWD"
14 cd "$TEMPDIR"
15 rm "$PACKAGE-$VERSION/release.sh"
16 tar czf "$DIR/dist/$PACKAGE-$VERSION.tar.gz" "$PACKAGE-$VERSION"
17 tar cjf "$DIR/dist/$PACKAGE-$VERSION.tar.bz2" "$PACKAGE-$VERSION"
18 cd "$PACKAGE-$VERSION"
19 ./setup.py bdist_rpm
20 mv "dist/$PACKAGE-$VERSION-1."{noarch,src}.rpm "$DIR/dist"
21 rm -fr "$TEMPDIR"