From: Michael Hanke Date: Tue, 1 Sep 2009 19:05:45 +0000 (-0400) Subject: Add the cowbuilder tools to the repos. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9192b13ef4779cabc0881c944487930213751282;p=neurodebian.git Add the cowbuilder tools to the repos. --- diff --git a/tools/nd_adddist b/tools/nd_adddist new file mode 100755 index 0000000..f0d8f6f --- /dev/null +++ b/tools/nd_adddist @@ -0,0 +1,24 @@ +#!/bin/bash + +. /home/cowbuilder/bin/nd_cmdsettings.sh + +# common options +opts="--distribution $dist --debootstrap debootstrap --aptcache $aptcache" + + +for a in i386 amd64; do + echo "Building $a base path..." + if [ "${family:0:3}" = "nd+" ]; then + echo "Including NeuroDebian repository..." + cowbuilder --create --basepath /home/cowbuilder/cow/${family}-${dist}-${a}.cow $opts \ + --components "$components" \ + --mirror "$mirror" \ + --debootstrapopts --arch --debootstrapopts $a \ + --othermirror "deb http://neuro.debian.net/debian $dist main contrib non-free" + else + cowbuilder --create --basepath /home/cowbuilder/cow/${family}-${dist}-${a}.cow $opts \ + --components "$components" \ + --mirror "$mirror" \ + --debootstrapopts --arch --debootstrapopts $a + fi +done diff --git a/tools/nd_build b/tools/nd_build new file mode 100755 index 0000000..6bd6d88 --- /dev/null +++ b/tools/nd_build @@ -0,0 +1,72 @@ +#!/bin/bash + +if [ -z "$1" ]; then +cat << EOT +Script to build a source package in one of the available cowbuilders. + +Synopsis +-------- + + nd_build [arch] [cowbuilder options] + + +Examples +-------- + +Build for a single specific arch: + + nd_build nd+debian lenny i386 someting.dsc + + +Build for all archs (will just build once for arch 'all'): + + nd_build ubuntu jaunty something.dsc + + +Build the same way but don't put results in current dir: + + nd_build debian sid something.dsc --buildresult to-upload/ + +EOT +exit 1 +fi + +. /home/cowbuilder/bin/nd_cmdsettings.sh + +# common options +opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace" + +if [ -z "$3" ]; then + echo "You need to provide a .dsc file" + exit 1 +fi + +if [ ! "$3" = "${3%*.dsc}" ]; then + dscfile=$3 + # must already be the dsc file, hence no arch info given + if [ "$(grep '^Architecture' $dscfile | awk '{ print $2 }')" = "all" ]; then + echo "Arch 'all' package detected -- using amd64 system to build it" + arch="amd64" + else + arch="i386 amd64" + fi + shift; shift; shift +else + # must be arch given and dsc as 4th + arch=$3 + dscfile=$4 + if [ -z "$dscfile" ]; then + echo "You need to provide a .dsc file" + exit 1 + fi + shift; shift; shift; shift +fi + +for a in $arch; do + echo "Building for $family $dist $a ..." + cowbuilder --build $dscfile \ + --basepath ${cowbuilderroot}/cow/${family}-${dist}-${a}.cow \ + --buildresult . \ + $opts \ + $* +done diff --git a/tools/nd_build4debianmain b/tools/nd_build4debianmain new file mode 100755 index 0000000..065cfa6 --- /dev/null +++ b/tools/nd_build4debianmain @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ -z "$1" ]; then +cat << EOT +Script to build a source package for Debian Sid. The cowbuilder will be updated +before the actual building takes place. + +Synopsis +-------- + + nd_build [cowbuilder options] +EOT +exit 1 +fi + +# common options +dscfile=$1 +shift; + +nd_updatedist debian sid amd64 +nd_build debian sid amd64 $dscfile $* diff --git a/tools/nd_cmdsettings.sh b/tools/nd_cmdsettings.sh new file mode 100755 index 0000000..9fe51fa --- /dev/null +++ b/tools/nd_cmdsettings.sh @@ -0,0 +1,30 @@ +family=$1 +dist=$2 + +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 + +# basic settings +cowbuilderroot="/home/cowbuilder" +buildplace="${cowbuilderroot}/build" + +# default is debian +aptcache="${cowbuilderroot}/debian_aptcache" +components="main contrib non-free" +mirror="http://debian.lcs.mit.edu/debian" + +# overwrite necessary bits for ubuntu +if [ "$family" = "ubuntu" ]; then + aptcache="${cowbuilderroot}/ubuntu_aptcache" + components="main universe" + mirror="http://ubuntu.media.mit.edu/ubuntu" +fi + +if [ ! -d $aptcache ]; then mkdir $aptcache; fi diff --git a/tools/nd_gitbuild b/tools/nd_gitbuild new file mode 100755 index 0000000..f891e5f --- /dev/null +++ b/tools/nd_gitbuild @@ -0,0 +1,27 @@ +#!/bin/bash + +. /home/cowbuilder/bin/nd_cmdsettings.sh + +# common options +opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace" + +if [ -n "$3" ]; then + arch=$3 +else + if [ "$(grep '^Architecture' debian/control | awk '{ print $2 }')" = "all" ]; then + echo "Arch 'all' package detected -- using amd64 system to build it" + arch="amd64" + else + arch="i386 amd64" + fi +fi + + +for a in $arch; do + echo "Building for $family $dist $a ..." + pdebuild --pbuilder cowbuilder --debbuildopts "-us -uc -i" \ + --buildresult .. \ + -- \ + --basepath ${cowbuilderroot}/cow/${family}-${dist}-${a}.cow \ + $opts +done diff --git a/tools/nd_updatedist b/tools/nd_updatedist new file mode 100755 index 0000000..fc2dedd --- /dev/null +++ b/tools/nd_updatedist @@ -0,0 +1,17 @@ +#!/bin/bash + +. /home/cowbuilder/bin/nd_cmdsettings.sh + +# common options +opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace" + +if [ -n "$3" ]; then + arch=$3 +else + arch="i386 amd64" +fi + +for a in $arch; do + echo "Updating arch $a..." + cowbuilder --update --basepath /home/cowbuilder/cow/${family}-${dist}-${a}.cow $opts +done