From 3d74b6ace72291a548580983ad0cdf4be60cd3a0 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 5 Apr 2010 07:05:01 -0500 Subject: [PATCH] debian/rules: add target to build source tarball MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- usbboot/debian/README.source | 4 +++- usbboot/debian/changelog | 20 +++++++++++--------- usbboot/debian/get-orig-source.sh | 30 ++++++++++++++++++++++++++++++ usbboot/debian/rules | 7 +++++++ 4 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 usbboot/debian/get-orig-source.sh diff --git a/usbboot/debian/README.source b/usbboot/debian/README.source index 26fb252..d06590f 100644 --- a/usbboot/debian/README.source +++ b/usbboot/debian/README.source @@ -1,6 +1,8 @@ This Debian package is developed in a Git repository (see the Vcs-Git field of debian/control). To build from a git checkout: + debian/rules get-orig-source REPO=.. BRANCH=remotes/origin/master + mv xburst-tools_*.tar.gz .. debian/autogen.sh debuild @@ -18,4 +20,4 @@ To build a released version of this package, no special instructions apply. “dpkg-buildpackage” or “apt-get -b source xburst-tools” should work as usual. - -- Jonathan Nieder Sun, 04 Apr 2010 22:08:28 -0500 + -- Jonathan Nieder Mon, 05 Apr 2010 06:21:12 -0500 diff --git a/usbboot/debian/changelog b/usbboot/debian/changelog index a122665..18f0e45 100644 --- a/usbboot/debian/changelog +++ b/usbboot/debian/changelog @@ -1,18 +1,20 @@ xburst-tools (0.0+201002-1.1) local; urgency=low - * debian/rules: rewrite as a minimal rules file using dh - + Build-Depends: debhelper (>= 7.4.10), for the --parallel option. - * Standards-Version: 3.8.4 - * Build-Conflicts: automake1.4 - * add a Vcs-Git field to debian/control and remove the outdated watch - file + * debian/rules: + - rewrite as a minimal rules file using dh + - add a get-orig-source target + - install firmware built at packaging time to avoid requiring a + mipsel cross-compiler on buildds * debian/README.source: add instructions for re-building the firmware * debian/autogen.sh: new script - * debian/rules: install firmware built at packaging time, to avoid - requiring a mipsel cross-compiler on buildds + * Build-Depends: debhelper (>= 7.4.10), for the --parallel option. + * Build-Conflicts: automake1.4 + * debian/control: add information about the source repository + * remove the outdated watch file + * Standards-Version: 3.8.4 * use dpkg source format 3.0 (quilt) - -- Jonathan Nieder Mon, 05 Apr 2010 05:27:05 -0500 + -- Jonathan Nieder Mon, 05 Apr 2010 06:24:04 -0500 xburst-tools (0.0+201002-1) unstable; urgency=low diff --git a/usbboot/debian/get-orig-source.sh b/usbboot/debian/get-orig-source.sh new file mode 100644 index 0000000..86c1dce --- /dev/null +++ b/usbboot/debian/get-orig-source.sh @@ -0,0 +1,30 @@ +#!/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" diff --git a/usbboot/debian/rules b/usbboot/debian/rules index 8190b0b..d5bf44d 100755 --- a/usbboot/debian/rules +++ b/usbboot/debian/rules @@ -47,3 +47,10 @@ firmware: configure ./configure --enable-firmware $(MAKE) -C src ../xburst_stage1/xburst_stage1.bin \ ../xburst_stage2/xburst_stage2.bin + +REPO = git://projects.qi-hardware.com/xburst-tools.git +BRANCH = master +debiandir_SQ = $(subst ','\'',$(dir $(lastword $(MAKEFILE_LIST)))) +get-orig-source: + REPO='$(REPO)' BRANCH='$(BRANCH)' \ + sh '$(debiandir_SQ)'get-orig-source.sh