From 4dfde414c41128d3b10627cb250834128a37d094 Mon Sep 17 00:00:00 2001 From: Xiangfu Date: Mon, 13 Aug 2012 11:10:39 +0800 Subject: [PATCH] files for debian package --- debian/autogen.sh | 10 +++ debian/changelog | 6 ++ debian/changelog.upstream.awk | 113 ++++++++++++++++++++++++++++++++++ debian/clean.sh | 108 ++++++++++++++++++++++++++++++++ debian/compat | 1 + debian/control | 19 ++++++ debian/copyright | 33 ++++++++++ debian/dirs | 1 + debian/fpgatools.manpages | 1 + debian/get-orig-source.sh | 30 +++++++++ debian/rules | 47 ++++++++++++++ debian/source/format | 1 + debian/watch | 1 + 13 files changed, 371 insertions(+) create mode 100755 debian/autogen.sh create mode 100644 debian/changelog create mode 100644 debian/changelog.upstream.awk create mode 100644 debian/clean.sh create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/fpgatools.manpages create mode 100644 debian/get-orig-source.sh create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/watch diff --git a/debian/autogen.sh b/debian/autogen.sh new file mode 100755 index 0000000..1239e0a --- /dev/null +++ b/debian/autogen.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Generate debian/changelog.upstream. +# +# Uses debian/changelog and the git revision log. +# + +set -e + +dpkg-parsechangelog --format rfc822 --all | + awk -f debian/changelog.upstream.awk diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..37ce738 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +fpgatools (0.0+201208) UNRELEASED; urgency=low + + * Takoen from commit 884c036 + * Initial release. (Closes: #XXXXXX) + + -- Xiangfu Liu Tue, 14 Aug 2012 10:03:41 +0800 diff --git a/debian/changelog.upstream.awk b/debian/changelog.upstream.awk new file mode 100644 index 0000000..6755ede --- /dev/null +++ b/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/debian/clean.sh b/debian/clean.sh new file mode 100644 index 0000000..1b17a8b --- /dev/null +++ b/debian/clean.sh @@ -0,0 +1,108 @@ +#!/bin/sh +# Clean up after a failed build. +# +# Requires access to .gitignore files excluding _all_ modified files. +# +# Requires a working /dev/fd (with more than just /dev/fd/0 and 1) +# or gawk. + +set -e + +splitgitignore='#!/usr/bin/awk +!/^#/ && !/^$/ { + glob = /[[*?]/; + directory = /\/$/; + sub(/\/$/, ""); + anchored = /\//; + sub(/^\//, ""); + + output = "nonexistent/nonsense"; + if (anchored) { + if (!directory && !glob) + output = "/dev/fd/1"; + else if (directory && !glob) + output = "/dev/fd/3"; + else if (!directory && glob) + output = "/dev/fd/4"; + else if (directory && glob) + output = "/dev/fd/5"; + } else { + if (!directory) + output = "/dev/fd/6"; + else + output = "/dev/fd/7"; + } + print >> output; +} +' + +offlimits="-type d -name '.*' -prune -o -type d -name debian -prune" + +remove_file_globs() { + while read glob + do + eval "rm -f $glob" + done +} + +remove_directory_globs() { + while read glob + do + eval "rm -fr $glob" + done +} + +remove_file_findpatterns() { + while read pat + do + find . $offlimits -o \ + '(' -name "$pat" -execdir rm -f '{}' + ')' + done +} + +remove_directory_findpatterns() { + while read pat + do + find . $offlimits -o \ + '(' -type d -name "$pat" -execdir rm -fr '{}' + ')' + done +} + +find . $offlimits -o '(' -name .gitignore -print ')' | +while read file +do + ( + cd "$(dirname "$file")" + # Dispatch using pipes. Yuck. + { { { { { + awk "$splitgitignore" | + { + # anchored files (globless) + xargs -d '\n' rm -f + } + } 3>&1 >&2 | + { + # anchored directories (globless) + xargs -d '\n' rm -fr + } + } 4>&1 >&2 | + { + # anchored files + remove_file_globs + } + } 5>&1 >&2 | + { + # anchored directories + remove_directory_globs + } + } 6>&1 >&2 | + { + # unanchored files + remove_file_findpatterns + } + } 7>&1 >&2 | + { + remove_directory_findpatterns + } >&2 + ) < "$file" +done diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..0941984 --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: fpgatools +Section: electronics +Priority: extra +Maintainer: Xiangfu Liu +Build-Depends: debhelper (>= 7.4.10), pkg-config, + libxml2-dev +Standards-Version: 3.9.3 +Homepage: https://github.com/Wolfgang-Spraul/fpgatools + +Package: fpgatools +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: tools for create fpga bitstream + small independent command line utilities, no GUI + plain C, no C++ + simple Makefiles + text-based file formats + no documentation - read the sources + automatic test suite diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..96a1f37 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +This work was packaged for Debian by: + + Xiangfu Liu on Tue, 14 Aug 2012 10:57:14 +0800 + +It was downloaded from: + + https://github.com/Wolfgang-Spraul/fpgatools + +Upstream Author: + + Wolfgang Spraul + +Copyright: + + Copyright 2012 by Wolfgang Spraul + +License: + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + For more information, please refer to + +The Debian packaging is: + + Copyright (C) 2012 Xiangfu Liu and is released + into the public domain. + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/debian/fpgatools.manpages b/debian/fpgatools.manpages new file mode 100644 index 0000000..6ee83b0 --- /dev/null +++ b/debian/fpgatools.manpages @@ -0,0 +1 @@ +fpgatools.1 diff --git a/debian/get-orig-source.sh b/debian/get-orig-source.sh new file mode 100644 index 0000000..5f26767 --- /dev/null +++ b/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 | + gzip -n -9 >"fpgatools_$upstream_version.orig.tar.gz" diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e76776d --- /dev/null +++ b/debian/rules @@ -0,0 +1,47 @@ +#!/usr/bin/make -f +# This file is in the public domain. +# You may freely use, modify, distribute, and relicense it. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export PREFIX=/usr + +build clean install binary-arch binary-indep binary: + +dh --parallel $(opt_no_act) $@ + +override_dh_auto_clean: + $(MAKE) clean + sh debian/clean.sh + +override_dh_installchangelogs: + dpkg-parsechangelog --format rfc822 --all | \ + awk -f debian/changelog.upstream.awk + dh_installchangelogs debian/changelog.upstream + +opt_optimize = CFLAGS="-g -O2" +opt_no_act = +opt_quiet = + +ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) + opt_optimize = CFLAGS="-g -O0" +endif + +ifneq (,$(findstring n,$(MAKEFLAGS))) + opt_no_act = --no-act +endif + +ifneq (,$(filter quiet,$(DEB_BUILD_OPTIONS))) + opt_quiet = --quiet + MAKEFLAGS += --quiet +endif + +REPO = git://github.com/Wolfgang-Spraul/fpgatools.git +BRANCH = master +debiandir_SQ = $(subst ','\'',$(dir $(lastword $(MAKEFILE_LIST)))) +get-orig-source: + REPO='$(REPO)' BRANCH='$(BRANCH)' \ + sh '$(debiandir_SQ)'get-orig-source.sh + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..6544de6 --- /dev/null +++ b/debian/watch @@ -0,0 +1 @@ +# We track fpgatools git revisions, thus no need for a watch file.