1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-01 14:14:38 +02:00
xburst-tools/usbboot/debian/get-orig-source.sh
Jonathan Nieder 3d74b6ace7 debian/rules: add target to build source tarball
Document how to use ‘git archive’ to build a tarball from the
usbboot subdirectory of the source repository.

Repeated invocations of the get-orig-source target to fetch the
same commit will produce byte-for-byte identical results.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2010-04-06 09:29:21 +08:00

31 lines
779 B
Bash

#!/bin/sh
# Build a tarball from the latest upstream version, with a nice
# version number.
#
# Requires git 1.6.6 or later, GNU date, and gzip.
set -e
: ${REPO=$(git rev-parse --git-dir)}
: ${BRANCH=remotes/origin/master}
mkdir debian-orig-source
trap 'rm -fr debian-orig-source || exit 1' EXIT
git init -q debian-orig-source
GIT_DIR=$(pwd)/debian-orig-source/.git
export GIT_DIR
# Fetch latest upstream version.
git fetch -q "$REPO" "$BRANCH"
# Determine version number.
release=0.0
date=$(date --utc --date="$(git log -1 --pretty=format:%cD FETCH_HEAD)" "+%Y%m")
upstream_version="${release}+${date}"
# Generate tarball.
echo "packaging $(git rev-parse --short FETCH_HEAD)"
git archive FETCH_HEAD -- usbboot |
gzip -n -9 > "xburst-tools_$upstream_version.orig.tar.gz"