[Pkg-haskell-commits] darcs: tools: Add scripts for mass building packages
Joachim Breitner
mail at joachim-breitner.de
Sat Oct 13 21:46:52 UTC 2012
Sat Oct 13 21:36:53 UTC 2012 Joachim Breitner <mail at joachim-breitner.de>
* Add scripts for mass building packages
Ignore-this: fb18f30b386d17100ab68654e4258144
A ./mass-build.sh
M ./mass-change.sh -3 +3
A ./mass-release.sh
Sat Oct 13 21:36:53 UTC 2012 Joachim Breitner <mail at joachim-breitner.de>
* Add scripts for mass building packages
Ignore-this: fb18f30b386d17100ab68654e4258144
diff -rN -u old-tools//mass-build.sh new-tools//mass-build.sh
--- old-tools//mass-build.sh 1970-01-01 00:00:00.000000000 +0000
+++ new-tools//mass-build.sh 2012-10-13 21:46:52.110630237 +0000
@@ -0,0 +1,141 @@
+#!/bin/bash
+
+schroot=$1
+shift
+
+result=$1
+shift
+
+if [ -z "$schroot" -o -z "$result" -o "$schroot" = '--help' ]
+then
+ echo "Usage: $0 <results/> dirs..."
+ echo
+ echo "Check each directory whether it is marked for release (distribution set) but"
+ echo "not tagged with the latest version. Those packages will be built with sbuild"
+ echo "inside the given chroot. The result will be stored in the second directory"
+ echo "passed. Also, all packages in this directory are made available as a repository"
+ echo "inside the chroot."
+ echo "If the build is sucessful, it runs \"debcommit -r\" in the repository to create"
+ echo "the correct tag."
+ echo
+ echo "Until http://bugs.debian.org/608840 is fixed you have to ensure that results/"
+ echo "is set up as an apt source in the source schroot. This script will however"
+ echo "keep Packages and Sources up-to-date. For this to work the schroot should have"
+ echo " Apt::Get::AllowUnauthenticated 1;"
+ echo "set, e.g. in a file named /etc/apt/apt.conf.d/unauthenticated."
+ exit
+fi
+
+set -e
+
+tobuild=""
+nottobuild=""
+released=""
+
+DEBIAN2DSC=debian2dsc
+if ! which $DEBIAN2DSC >/dev/null
+then
+ pushd $(dirname $0) >/dev/null
+ DEBIAN2DSC=$PWD/debian2dsc.sh
+ popd >/dev/null
+fi
+if ! which $DEBIAN2DSC >/dev/null
+then
+ echo "Could not find debian2dsc ($DEBIAN2DSC)."
+ exit 1
+fi
+
+while [ -n "$1" ]
+do
+ dir=$1
+ shift
+
+ if ! pushd "$dir" >/dev/null
+ then
+ echo "Failed to switch to \"$dir\""
+ continue
+ fi
+
+ if [ ! -e changelog ]
+ then
+ echo "No changelog file found, skipping $dir"
+ popd >/dev/null
+ continue
+ fi
+
+ dist=$(dpkg-parsechangelog -lchangelog -c1 |grep-dctrl -n -s Distribution .)
+ version=$(dpkg-parsechangelog -lchangelog -c1 |grep-dctrl -n -s Version .)
+ if [ $dist = "UNRELEASED" ]
+ then
+ nottobuild="$nottobuild $dir"
+ else
+ if darcs show tags | fgrep -x -q "$version"
+ then
+ released="$released $dir"
+ else
+ tobuild="$nottobuild $dir"
+ fi
+ fi
+ popd >/dev/null
+done
+
+for dir in $tobuild
+do
+ if ! pushd "$dir" >/dev/null
+ then
+ echo "Failed to switch to \"$dir\""
+ continue
+ fi
+ repodir=$PWD
+ popd >/dev/null
+
+ pushd $result
+
+ dpkg-scanpackages . > Packages
+ dpkg-scansources . > Sources
+
+ PACKAGE=`dpkg-parsechangelog -l$repodir/changelog -c1 | grep-dctrl -n -s Source .`
+ VERSION=`dpkg-parsechangelog -l$repodir/changelog -c1 | grep-dctrl -n -s Version .`
+ DISTRIBUTION=$(dpkg-parsechangelog -l$repodir/changelog -c1 |grep-dctrl -n -s Distribution .)
+ DSC=${PACKAGE}_${VERSION}.dsc
+ $DEBIAN2DSC $repodir
+
+# Does not work, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608840
+# cat > setup.sh <<__END__
+##!/bin/bash
+#echo deb file://$PWD ./ > /etc/apt/sources.list.d/mass-build.list'
+#echo deb-src file://$PWD ./ > /etc/apt/sources.list.d/mass-build.list'
+#__END__
+# chmod +x setup.sh
+
+ if sbuild --dist "$DISTRIBUTION" \
+ --chroot="$schroot" \
+ --build-dep-resolver=aptitude \
+ --arch-all \
+ --source \
+ "$DSC"
+# --chroot-setup-commands=$PWD/setup.sh \
+ then
+ rm -f setup.sh
+ buildok="$buildok $dir"
+ popd >/dev/null
+ pushd $dir >/dev/null
+ debcommit -r
+ popd >/dev/null
+ else
+ rm -f setup.sh
+ buildfailed="$buildfailed $dir"
+ popd >/dev/null
+ fi
+done
+
+
+echo "Summary:"
+echo "Packages not to build:"
+echo $nottobuild
+echo "Packages already released:"
+echo $released
+echo "Packages successfully build:"
+echo $buildok
+echo "Packages failed to build:"
+echo $buildfailed
diff -rN -u old-tools//mass-change.sh new-tools//mass-change.sh
--- old-tools//mass-change.sh 2012-10-13 21:46:52.075741967 +0000
+++ new-tools//mass-change.sh 2012-10-13 21:46:52.094723126 +0000
@@ -10,8 +10,8 @@
echo "Usage: $0 <message> '<action>' dirs..."
echo
echo "Runs <action> in each given directory; commits with <message> if"
- echo "<action> had an effect. Pulls before. Does not push, so you can"
- echo "fix your mess afterwards."
+ echo "<action> had an effect. Does not push, so you can fix your mess"
+ echo "afterwards."
exit
fi
@@ -34,7 +34,7 @@
fi
echo "Processing $dir"
- darcs pull -a -v
+ # darcs pull -a -v
eval "$action"
if ! darcs whatsnew -s
diff -rN -u old-tools//mass-release.sh new-tools//mass-release.sh
--- old-tools//mass-release.sh 1970-01-01 00:00:00.000000000 +0000
+++ new-tools//mass-release.sh 2012-10-13 21:46:52.094723126 +0000
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+if [ "$1" = "-D" ]
+then
+ dist="$2"
+ shift
+ shift
+fi
+
+if [ -z "$1" -o "$1" = '--help' ]
+then
+ echo "Usage: $0 [-D distribution] dirs..."
+ echo
+ echo "Calls debchange -r on all repos that are not already released"
+ echo "(i.e. distribution is UNRELEASED)."
+ exit
+fi
+
+set -e
+
+while [ -n "$1" ]
+do
+ dir=$1
+ shift
+
+ if ! pushd "$dir" >/dev/null
+ then
+ echo "Failed to switch to \"$dir\""
+ continue
+ fi
+
+ if [ ! -e changelog ]
+ then
+ echo "No changelog file found, skipping $dir"
+ popd >/dev/null
+ continue
+ fi
+
+ currentdist=$(dpkg-parsechangelog -lchangelog -c1 |grep-dctrl -n -s Distribution .)
+ if [ "$currentdist" = "UNRELEASED" ]
+ then
+ echo "Releasing $dir"
+ if [ -n "$dist" ]
+ then
+ debchange --changelog=changelog -r '' -D $currentdist
+ else
+ debchange --changelog=changelog -r ''
+ fi
+ else
+ echo "Skipping $dir, already released."
+ fi
+ popd >/dev/null
+done
More information about the Pkg-haskell-commits
mailing list