]> git.donarmstrong.com Git - neurodebian.git/commitdiff
initial version of scripts for nd_test_bdepends
authorYaroslav Halchenko <debian@onerussian.com>
Tue, 20 Sep 2011 00:57:55 +0000 (20:57 -0400)
committerNeuroDebian Mega-user <neurodebian@head2.hydra.dartmouth.edu>
Tue, 20 Sep 2011 00:57:55 +0000 (20:57 -0400)
tools/nd_execute [new file with mode: 0755]
tools/nd_fetch_bdepends [new file with mode: 0755]
tools/nd_test_bdepends [new file with mode: 0755]

diff --git a/tools/nd_execute b/tools/nd_execute
new file mode 100755 (executable)
index 0000000..959b685
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+if [ -z "$1" ]; then
+cat << EOT
+Script to log into a particular COW and execute some command.
+
+Synopsis
+--------
+
+  nd_execute <family> <codename> <arch> [cowbuilderopts] command
+
+EOT
+exit 1
+fi
+
+family=$1
+dist=$2
+arch=$3
+bmdir=
+#$4
+
+set -e
+
+if [ -z "$family" ]; then
+  echo "You need to provide a distribution family ('debian', 'ubuntu'); prefix with 'nd+' to enable the NeuroDebian repository."
+  exit 1
+fi
+
+if [ -z "$dist" ]; then
+  echo "You need to provide a distribution codename (e.g. 'lenny', 'squeeze')."
+  exit 1
+fi
+
+if [ -z "$arch" ]; then
+  echo "You need to provide an architecture (e.g. 'i386', 'amd64')."
+  exit 1
+fi
+
+. /etc/neurodebian/cmdsettings.sh
+
+shift; shift; shift; # get rid of those from future use of $@
+
+# common options
+opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace"
+
+
+#if [ -n "bmdir" ]; then
+#  options="$opts --bindmounts $bmdir"
+#else
+  options="$opts"
+#fi
+
+cowbuilder --execute \
+             --basepath ${cowbuilderroot}/cow/${family}-${dist}-${arch}.cow \
+             $options \
+             "$@"
diff --git a/tools/nd_fetch_bdepends b/tools/nd_fetch_bdepends
new file mode 100755 (executable)
index 0000000..ebb5d92
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+pkg=$1
+tdir=$2
+
+# provide deb-src by uncommenting
+sed -i -e 's,^#deb-src,deb-src,g' /etc/apt/sources.list
+
+mkdir -p $tdir
+cd $tdir
+apt-get update
+apt-get install -y devscripts dctrl-tools
+build-rdeps $pkg >| build-rdeps.output
+
+# Fetch all the sources
+grep -v -e '^[-A-Z]' -e '^ *$' build-rdeps.output \
+       | tee build-rdeps.list \
+       | while read pkg; do
+       apt-get source --download-only $pkg
+done
diff --git a/tools/nd_test_bdepends b/tools/nd_test_bdepends
new file mode 100755 (executable)
index 0000000..3070cc1
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# no undefined
+set -u
+
+CMD=
+#echo
+
+family=$1
+dist=$2
+arch=$3      # limit to 1 for now
+
+dscfile=$4
+
+pkg=${dscfile%_*}
+
+#? TODO -- should be a parameter as well?
+
+testdir=$PWD/$pkg-$arch.test-bdepends
+bindir=$testdir/bin
+debdir=$testdir/debs
+srcdir=$testdir/srcs
+
+echo "I: Building the new package for $pkg"
+
+mkdir -p $debdir $srcdir $bindir
+$CMD nd_build $family $dist $arch $dscfile --buildresult=$debdir
+
+
+echo "I: Fetching all bdepends for $pkg in $family $dist under $arch"
+# need first to provide the necessary scripts out there
+cp -p `which nd_fetch_bdepends` $bindir
+$CMD nd_execute $family $dist $arch --bindmounts $testdir $bindir/nd_fetch_bdepends $pkg $srcdir
+
+# 3 -- go through all bdepends and build them with old (from repo) and new (built) version