From 1cd094b531ff2a9f1d6acb4b781c118d12b51343 Mon Sep 17 00:00:00 2001 From: ranke Date: Sat, 12 Dec 2015 10:38:15 +0000 Subject: New and simplified organisation of backporting scripts Now backports for different distributions (squeeze, wheezy, jessie) can be started from the same working directory. Also, single package builds can be done without editing a script. git-svn-id: svn+ssh://stiller/home/schatz/reps/r-backports@111 f247ebf9-aa24-0410-a698-f940e971ad2b --- backport | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100755 backport (limited to 'backport') diff --git a/backport b/backport new file mode 100755 index 0000000..4941aa0 --- /dev/null +++ b/backport @@ -0,0 +1,115 @@ +#!/bin/bash + +# Script to automate backporting for CRAN +# Creates a source package and binary packages for the following architecture +ARCH=i386 +export ARCH + +# R version against which the software is compiled +Rversion=3.2.3 +reposversion="cran3" + +# Where the buildresults should be stored +rcrandir=/home/jranke/svn/website/www/ranke/r-cran + +# Author: Johannes Ranke + +# Preconditions: +# - up to date R version specified above, for packages depending on R +# - sudo and pbuilder configuration (see README) +# - sid sources in /etc/apt/sources/list +# - cdbs installed (and maybe more) +# - shell variables DEBEMAIL and DEBFULLNAME + +usage() +{ +echo "Usage: ./backport [options] sourcepackage squeeze|wheezy|jessie" +echo "Options:" +echo " -n Skip apt-get update/upgrade and pbuilder update" +} + +update=true +while getopts ":n" flag; do + case $flag in + n) + update=false + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac + shift $((OPTIND-1)) +done + +# Check for number of arguments +if [ $# -lt 2 ]; then usage; exit 1; fi +pkg=$1 +DIST=$2 + +# Validate distribution argument +if [ $DIST != "squeeze" ] && [ $DIST != "wheezy" ] && [ $DIST != "jessie" ]; then usage; exit 1; fi +export DIST + +# Set required r-base-dev version for packages build-depending on R +rbasedev="r-base-dev (>= $Rversion)" + +# Remove previously extracted sources +if [ -d $pkg-* ] +then + sudo rm -rf `ls -d $pkg-*` +fi + +# Get current source from unstable +if [ "$update" = true ] +then + sudo apt-get update + sudo apt-get upgrade +fi +sudo apt-get source $pkg + +# Copy sources to $DIST directory to enable parallel builds +mkdir -p $DIST +cp -r $pkg-* $DIST + +# Go to package building directory +cd $DIST/$pkg-* + +# Determine the version of the Debian package +oldversion=`dpkg-parsechangelog | grep ^Version | cut -f2 -d " "` +cranversion=$oldversion"~"$DIST"cran.0" + +echo Old version is $oldversion +echo CRAN version is $cranversion + +# Add new version to changelog +dch -v "${cranversion}" --force-distribution -D $DIST-cran -b "Backport from Debian unstable to Debian $DIST" + +# Adapt build dependency on r-base-dev if present +if grep -q "^Build-Depends.*r-base-dev" debian/control +then + echo "Lowering Build-Depends to $rbasedev" + ssed -i -R "/^Build-Depends/s/r-base-dev \(>= .*?\)/$rbasedev/" debian/control + ssed -i -R "/^Build-Depends-Indep/s/r-base-dev \(>= .*?\)/$rbasedev/" debian/control + + dch -a "debian/control: adapt build dependencies on r-base-dev to current backport" +fi + +# Check for a script doing modifications required for backporting +script=../$pkg-reverts.sh + +if [ -f $script ]; then source $script; fi + +if [ "$update" = true ] +then + sudo -E pbuilder update +fi +sudo -E pdebuild --debbuildopts '-sa' \ + --buildresult $rcrandir/$DIST-cran3/ \ + -- --distribution $DIST --basetgz /var/cache/pbuilder/$DIST-$ARCH-base.tgz \ + --aptcache /var/cache/pbuilder/$DIST-$ARCH/aptcache \ + --buildplace /var/cache/pbuilder/$DIST-$ARCH/build +if [ $? -ne 0 ]; then + exit +fi + +cd .. -- cgit v1.2.1