diff options
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | debian2dsc.sh | 127 | ||||
-rwxr-xr-x | tag.pl | 42 | ||||
-rwxr-xr-x | upgrade.sh | 73 | ||||
-rwxr-xr-x | upload.sh | 40 | ||||
-rwxr-xr-x | what-to-build.pl | 38 | ||||
-rwxr-xr-x | what-to-upgrade.pl | 64 |
7 files changed, 5 insertions, 390 deletions
@@ -62,14 +62,13 @@ the Debian source package name: In the full debian version, `:` and `~` are replaced by `_`. -Scripts in this repository --------------------------- +Debian Haskell Tools +-------------------- - * `./what-to-build.pl`. +We provide tools for a number of repeated tasks, such as tagging, upgrading, knowing what to build and what to upgrade, etc. They are provided in the `pkg-haskell-tools` package, available in sid, or at ssh://git.debian.org/git/pkg-haskell/pkg-haskell-tools.git (git://anonscm.debian.org/pkg-haskell/pkg-haskell-tools.git for non-Debian-developers). - This script expects to be run with any number of directories as arguments, - and defaults to `p/*/`. It prints the name of those directories that contain a - package that is to be released (i.e. marked for upload, but not yet tagged). +All tools are under the `dht` prefix, and it has a manpage (man dht) or at +<file:///usr/share/doc/pkg-haskell-tools/dht.html>. Useful general tools diff --git a/debian2dsc.sh b/debian2dsc.sh deleted file mode 100755 index 8daf67302..000000000 --- a/debian2dsc.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "-o" ] -then - shift - dest="$1" - shift -else - dest="." -fi - -until [ -z "$1" ] -do - case "$1" in - *) - DIRS="$DIRS $1" - ;; - esac - shift -done - -if [ -z "$DIRS" ] -then - cat <<__END__ -Usage: $0 [-o output/] [dir ...] - -Expects directories containing the contents of the debian/ directory of a -Debian source package (i.e. control, changelog, watch, ...). Uses the watch -file to retrieve the upstream tarball (unless it already exists in the local -directory), creates a debian.tar.xz tarball from the given directory (ignoring -the ususal suspects like _darcs and *~) and creates a corresponding .dsc file; -all without unpacking the upstream tarball. -__END__ - exit 1 -fi - -for DIR in $DIRS -do - if [ ! -e $DIR/control -o ! -e $DIR/changelog ] - then - echo "Did not find $DIR/control or $DIR/changelog." - echo "Is the repository in the debian/-only format?" - exit 1 - fi - - VERSION=`dpkg-parsechangelog -l$DIR/changelog -c1 -SVersion` - PACKAGE=`dpkg-parsechangelog -l$DIR/changelog -c1 -SSource` - UPSTREAM=`echo $VERSION | cut -d- -f1` # this could be improved - if echo $UPSTREAM | fgrep -q : ; then - UPSTREAM=`echo $UPSTREAM | cut -d: -f2-` - VERSION=`echo $VERSION | cut -d: -f2-` - fi - TARBALL_GZ=$dest/${PACKAGE}_$UPSTREAM.orig.tar.gz - TARBALL_BZ2=$dest/${PACKAGE}_$UPSTREAM.orig.tar.bz2 - TARBALL_XZ=$dest/${PACKAGE}_$UPSTREAM.orig.tar.xz - # see 375138 for why this doesn't work as well as it could. Fall back to apt-get source - # as a last resort. - [ ! -e $TARBALL_GZ -a ! -e $TARBALL_BZ2 -a ! -e $TARBALL_XZ ] && \ - ( uscan \ - --rename \ - --force-download \ - --package "$PACKAGE" \ - --download \ - --watchfile $DIR/watch \ - --copyright-file $DIR/copyright \ - --download-version "$UPSTREAM" \ - --upstream-version "$UPSTREAM" \ - --destdir "$dest" \ - --rename || - ( cd $dest ; apt-get source "$PACKAGE" --tar-only ) ) - - if [ ! -e $TARBALL_GZ -a ! -e $TARBALL_BZ2 -a ! -e $TARBALL_XZ ] - then - echo "Couldn't download tarball with uscan or apt-get source. See above for errors" - exit 1 - fi - - TARBALL="" - - if [ -e $TARBALL_GZ ] - then - TARBALL="$TARBALL_GZ" - else - if [ -e $TARBALL_XZ ] - then - TARBALL="$TARBALL_XZ" - else - if [ -e $TARBALL_BZ2 ] - then - TARBALL="$TARBALL_BZ2" - else - echo "Unreachable code" - exit 1 - fi - fi - fi - - DEBIAN_TARBALL=$dest/${PACKAGE}_${VERSION}.debian.tar.xz - # -I line taken from "man dpkg-source" - tar --create \ - --xz \ - --transform s,^.,debian, \ - --force-local \ - --file $DEBIAN_TARBALL \ - --directory $DIR \ - "--exclude=*.a" "--exclude=*.la" "--exclude=*.o" "--exclude=*.so" "--exclude=.*.sw?" "--exclude=*/*~" "--exclude=,,*" "--exclude=.[#~]*" "--exclude=.arch-ids" "--exclude=.arch-inventory" "--exclude=.be" "--exclude=.bzr" "--exclude=.bzr.backup" "--exclude=.bzr.tags" "--exclude=.bzrignore" "--exclude=.cvsignore" "--exclude=.deps" "--exclude=.git" "--exclude=.gitattributes" "--exclude=.gitignore" "--exclude=.gitmodules" "--exclude=.hg" "--exclude=.hgignore" "--exclude=.hgsigs" "--exclude=.hgtags" "--exclude=.shelf" "--exclude=.svn" "--exclude=CVS" "--exclude=DEADJOE" "--exclude=RCS" "--exclude=_MTN" "--exclude=_darcs" "--exclude={arch}" \ - . - - # dpkg-source insists on cluttering the current directory - dpkg-source \ - -c$DIR/control -l$DIR/changelog \ - --format="3.0 (custom)" --target-format="3.0 (quilt)" \ - -b / \ - $DEBIAN_TARBALL \ - $TARBALL - - DSC=${PACKAGE}_${VERSION}.dsc - if [ -e $DSC ] - then - mv $DSC "$dest/$DSC" - echo "Successfully created $DSC." - else - echo "Failed to create $DSC." - fi -done diff --git a/tag.pl b/tag.pl deleted file mode 100755 index 2877b75c1..000000000 --- a/tag.pl +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl - -# TODO: -# * Check for uncommited changes before - -use strict; -use warnings; - -my @dirs = @ARGV; - -unless (@dirs) { - @dirs = glob 'p/*/'; -} - -my @to_build; - -for my $dir (@dirs) { - my $changelog = "$dir/debian/changelog"; - next unless -r $changelog; - open CHANGELOG, '<', $changelog or die @!; - my $firstline = <CHANGELOG>; - if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) ([\w-]+);/) { - my ($source, $version, $suite) = ($1, $2, $3); - my $tag = sprintf "%s_v%s", $source, $version; - $tag =~ tr/:~/_/; - my $msg = sprintf "Tagging %s version %s, targetted for %s", $source, $version, $suite; - if ($suite eq "UNRELEASED") { - printf STDERR "Cannot tag UNRELEASED package %s-%s", $source, $version; - } else { - my $rev = `git log -n 1 --pretty=format:%h -- $dir`; - my $ret = system(qw/git tag -a -m/, $msg, $tag, $rev); - die (sprintf "Failed to tag %s: %d\n", $tag, $?>>8) if $ret != 0; - printf "Added tag %s (revision %s)\n", $tag, $rev; - } - } else { - printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline; - next - } -} - - - diff --git a/upgrade.sh b/upgrade.sh deleted file mode 100755 index 23f5fd106..000000000 --- a/upgrade.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -set -e - -if [ ! -d debian ] -then - echo "No debian/ directory found!" - echo "Run me in the packaging directory." - exit 1 -fi - -if [ "$1" = "-D" ] -then - dist="$2" - shift - shift -else - dist=unstable -fi - - -cabal_name="$(cat debian/watch | grep http | cut -d/ -f5)" -package="$(grep-dctrl -n -s Source . < debian/control)" -old_version=`dpkg-parsechangelog -ldebian/changelog -c1 | grep-dctrl -n -s Version .` -old_version=`echo $old_version | cut -d- -f1` # this could be improved -if echo $old_version | fgrep -q : ; then - old_version=`echo $old_version | cut -d: -f2-` - epoch=`echo $old_version | cut -d: -f1`: -else - epoch='' -fi - -version=$(grep "^$cabal_name " ../../../package-plan/packages.txt|cut -d\ -f2) - -if [ -z "$version" ] -then - echo "could not detect version to upgrade to." - exit 1 -fi - -if [ "$version" = "$old_version" ] -then - echo "No new version to upgrade to." - exit 1 -fi - -debchange --changelog debian/changelog --newversion="$epoch$version-1" 'New upstream release' -origtargz -u - -if grep -q '^DEB_ENABLE_TESTS = yes' debian/rules -then - test="" -else - test="--no-tests" -fi - -cabal-debian --official --upgrade $test -find debian/ -name '*~' -delete - -dch -D $dist -r '' - -git commit . -q -m "$cabal_name: Upgrading from $old_version to $version" - -echo "Upgraded $cabal_name to $version" -echo "Please check git show HEAD for sanity." -echo "Please check http://hdiff.luite.com/cgit/$cabal_name/diff/?id=$version&id2=$old_version for interesting changes." -if test -d debian/patches -then - echo "Please refresh the patches" -fi - - - diff --git a/upload.sh b/upload.sh deleted file mode 100755 index 1f22fb545..000000000 --- a/upload.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -if [ -z "$1" -o "$1" = "--help" ] -then - echo "Usage: $0 foo.changes" - echo - echo "Signs the .changes file and the corresponding .dsc file in a temporary" - echo "location (to avoid touching the original files), uploads them to the archive" - echo "using \"dput ssh-upload\" and tags them in the repository and pushes the tag." - echo - echo "Checks that the distribution is not UNRELEASED and that the tag does" - echo "not exist already (by tagging first)." - echo - exit 1 -fi - -changes="$@" - -root="$(realpath --relative-to=$PWD "$(git rev-parse --show-toplevel)")" -tmpdir=$root/uploads - -if [ -e $tmpdir ] -then - echo "$tmpdir exists, please remove" - exit 1 -fi -trap 'rm -rf "$tmpdir"' EXIT -mkdir $tmpdir - -for c in $changes -do - src="$(grep ^Source "$c"|grep-dctrl -s Source -n '' )" - $root/tag.pl $root/p/$src - dcmd cp -v "$c" "$tmpdir" - debsign "$tmpdir"/"$(basename "$c")" - dput ssh-upload "$tmpdir"/"$(basename "$c")" -done -git push --tags diff --git a/what-to-build.pl b/what-to-build.pl deleted file mode 100755 index 147c493a1..000000000 --- a/what-to-build.pl +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -my @dirs = @ARGV; - -unless (@dirs) { - @dirs = glob 'p/*/'; -} - -my @to_build; - -my %tags; -open TAGS, '-|', 'git tag -l' or die @!; -while (<TAGS>) { chomp; $tags{$_}++ }; -close TAGS or die @!; - -for my $dir (@dirs) { - my $changelog = "$dir/debian/changelog"; - next unless -r $changelog; - open CHANGELOG, '<', $changelog or die @!; - my $firstline = <CHANGELOG>; - if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) (\w+);/) { - my ($source, $version, $suite) = ($1, $2, $3); - my $tag = sprintf "%s_v%s", $source, $version; - $tag =~ tr/:~/_/; - next if ($suite eq "UNRELEASED"); - next if ($tags{$tag}); - printf "%s\n", $dir; - } else { - printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline; - next - } -} - - - diff --git a/what-to-upgrade.pl b/what-to-upgrade.pl deleted file mode 100755 index f4a74b6c6..000000000 --- a/what-to-upgrade.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use File::Slurp; - -my @dirs = @ARGV; - -unless (@dirs) { - @dirs = glob 'p/*/'; -} - -my %plan; -open PLAN, '<', '../package-plan/packages.txt' or die @!; -while (<PLAN>) { - chomp; - next if /^#/; - next if /^\s*$/; - unless (m/^(.*?) (.*?)(?: ([^#]*))?(?:#.*)?$/) { - print "Ignoring unparseable line $.: $_\n"; - } - my ($pkg,$version,$attribs) = ($1,$2,$3); - $plan{$pkg} = $version; -} -close PLAN or die @!; - -for my $dir (@dirs) { - my $changelog = "$dir/debian/changelog"; - my $watchfile = "$dir/debian/watch"; - next unless -r $changelog; - next unless -r $watchfile; - - open CHANGELOG, '<', $changelog or die @!; - my $firstline = <CHANGELOG>; - if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) (\w+);/) { - my ($source, $version, $suite) = ($1, $2, $3); - my ($cabal_version) = ($version =~ m/^(?:.*:)?(.*?)(?:\+dfsg\d*)?-.*?$/); - - my $watch = read_file($watchfile) or die @!; - unless ($watch =~ m!http://hackage.haskell.org/package/(.*)/distro-monitor!) { - #printf STDERR "Cannot parse watchfile %s\n", $watchfile; - # ignore packages with non-standard watch files - next - } - my $cabal_package = $1; - - unless (exists $plan{$cabal_package}) { - printf STDERR "W: package %s not in the package plan\n", - $dir, $cabal_package; - next - } - - if ($cabal_version ne $plan{$cabal_package}) { - printf "%s\n", $dir; - } - } else { - printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline; - next - } -} - - - |