diff --git a/usbboot/debian/.gitignore b/usbboot/debian/.gitignore index 5495e03..5f5e5ec 100644 --- a/usbboot/debian/.gitignore +++ b/usbboot/debian/.gitignore @@ -1,5 +1,6 @@ /xburst_stage1.bin /xburst_stage2.bin +/changelog.upstream /files diff --git a/usbboot/debian/autogen.sh b/usbboot/debian/autogen.sh index 7a0016a..1556b17 100755 --- a/usbboot/debian/autogen.sh +++ b/usbboot/debian/autogen.sh @@ -1,10 +1,16 @@ #!/bin/sh -# Generate debian/xburst_stage1.bin and debian/xburst_stage2.bin +# Generate debian/xburst_stage1.bin, debian/xburst_stage2.bin, +# and debian/changelog.upstream. +# +# Uses debian/changelog and the git revision log. # # Requires a mipsel-openwrt-linux- toolchain on the $PATH. set -e +dpkg-parsechangelog --format rfc822 --all | + awk -f debian/changelog.upstream.awk + debian/rules firmware cp -f xburst_stage1/xburst_stage1.bin debian/ cp -f xburst_stage2/xburst_stage2.bin debian/ diff --git a/usbboot/debian/changelog b/usbboot/debian/changelog index e2fab9b..bf07e3f 100644 --- a/usbboot/debian/changelog +++ b/usbboot/debian/changelog @@ -1,6 +1,6 @@ xburst-tools (0.0+201004-0.1) local; urgency=low - * New snapshot, taken from commit 89f0356. + * New snapshot, taken from commit 89f0356 * debian/rules: - rewrite as a minimal rules file using dh - add a get-orig-source target @@ -15,10 +15,11 @@ xburst-tools (0.0+201004-0.1) local; urgency=low * Standards-Version: 3.8.4 * use dpkg source format 3.0 (quilt) - -- Jonathan Nieder Mon, 05 Apr 2010 07:12:09 -0500 + -- Jonathan Nieder Mon, 05 Apr 2010 08:50:37 -0500 xburst-tools (0.0+201002-1) unstable; urgency=low + * from commit d8105c6d * work with software usbboot * don't wrtie cc data if page is empty * use autoconf-provided variables instead of absolute @@ -28,6 +29,6 @@ xburst-tools (0.0+201002-1) unstable; urgency=low xburst-tools (0.0+200906-1) unstable; urgency=low - * Initial release (Closes: #535429). + * Initial release, from commit 710c10c1 (Closes: #535429). -- Xiangfu Liu Tue, 30 Jun 2009 14:28:36 +0800 diff --git a/usbboot/debian/changelog.upstream.awk b/usbboot/debian/changelog.upstream.awk new file mode 100644 index 0000000..820627e --- /dev/null +++ b/usbboot/debian/changelog.upstream.awk @@ -0,0 +1,113 @@ +#!/bin/awk -f +# Generate debian/changelog.upstream from debian/changelog and +# the git revision log. Inspired by Gerrit Pape’s +# debian/changelog.upstream.sh, from the git-core Debian package. +# +# Requires a working /dev/stderr. +# +# Usage: +# dpkg-parsechangelog --format rfc822 --all | +# awk -f debian/changelog.upstream.awk + +# If argument matches /^Version: /, return remaining text. +# Result is nonempty if and only if argument matches. +function version_line(line) { + if (line ~ /^Version: /) { + sub(/^Version: /, "", line); + return line; + } + return ""; +} + +# If argument matches /^\*.* from commit /, return remaining text. +# Result is nonempty if and only if argument matches. +function commit_id_line(line) { + if (line ~ / from commit /) { + sub(/^.* from commit /, "", line); + sub(/[(][Cc]loses.*/, "", line); + sub(/[^0-9a-f]*$/, "", line); + return line; + } + return ""; +} + +# Read standard input, scanning for a changelog entry of the +# form “* New snapshot, taken from commit .” +# Result is . +# Result is empty and writes a message to standard error if no such entry is +# found before the next Version: line with a different upstream +# version (or EOF). +# Argument is the upstream version sought. +function read_commit_id(upstream, line,version,corresponding_upstream,commit) { + while (getline line) { + version = version_line(line); + corresponding_upstream = version; + sub(/-[^-]*$/, "", corresponding_upstream); + if (version != "" && corresponding_upstream != upstream) + break; + + commit = commit_id_line(line); + if (commit != "") + return commit; + } + + print "No commit id for " upstream >> "/dev/stderr"; + return ""; +} + +BEGIN { + last = "none"; + last_cid = "none"; + cl = "debian/changelog.upstream"; +} + +# Add a list of all revisions up to last to debian/changelog.upstream +# and set last = new_cid. +# new is a user-readable name for the commit new_cide. +function add_version(new,new_cid, limiter,versionline,command,line) { + if (last == "none") { + printf "" > cl; + last = new; + last_cid = new_cid; + return 0; + } + + if (new == "none") { + versionline = "Version " last; + limiter = ""; + } else { + versionline = "Version " last "; changes since " new ":"; + limiter = new_cid ".."; + } + print versionline >> cl; + gsub(/./, "-", versionline); + print versionline >> cl; + + print "" >> cl; + command = "git shortlog \"" limiter last_cid "\" -- ."; + while(command | getline line) + print line >> cl; + + if (new != "none") + print "" >> cl; + last = new; + last_cid = new_cid; +} + +{ + version = version_line($0); + if (version != "") { + # strip Debian revision + upstream_version = version; + sub(/-[^-]*$/, "", upstream_version); + + commit = read_commit_id(upstream_version); + if (commit == "") + exit 1; + add_version(upstream_version, commit); + } +} + +END { + add_version("none", "none"); +} diff --git a/usbboot/debian/rules b/usbboot/debian/rules index d5bf44d..1989c81 100755 --- a/usbboot/debian/rules +++ b/usbboot/debian/rules @@ -23,6 +23,9 @@ override_dh_auto_install: dh_install debian/xburst_stage1.bin usr/share/xburst-tools/ dh_install debian/xburst_stage2.bin usr/share/xburst-tools/ +override_dh_installchangelogs: + dh_installchangelogs debian/changelog.upstream + opt_optimize = CFLAGS="-g -O2" opt_no_act = opt_quiet =