| 1 |
#!/bin/bash |
#!/bin/bash |
| 2 |
|
|
| 3 |
# Script to automate building of r-base and for Debian stable |
# Script to automate backporting r-base for CRAN |
|
# This script should be run as root, in one way or another. |
|
| 4 |
|
|
| 5 |
# Author: Vincent Goulet <vincent.goulet@act.ulaval.ca> |
# Author: Johannes Ranke <jranke@uni-bremen.de> |
|
# Modified for backporting to Debian stable by |
|
|
# Johannes Ranke <jranke@uni-bremen.de> |
|
| 6 |
|
|
| 7 |
export DEBEMAIL="Johannes Ranke <jranke@uni-bremen.de>" |
# Developed in parallel with Vincent Goulet <vincent.goulet@act.ulaval.ca> |
| 8 |
|
# On Debian I used to run this script as root. On Ubuntu I now run it with |
| 9 |
|
# sudo -E sh backport_r-base.sh |
| 10 |
|
|
| 11 |
|
# Preconditions: - shell variables DIST and ARCH |
| 12 |
|
# - sid sources in /etc/apt/sources/list |
| 13 |
|
# - cdbs installed (and maybe more) |
| 14 |
|
|
| 15 |
|
export DEBEMAIL="jranke@uni-bremen.de" |
| 16 |
|
export DEBFULLNAME="Johannes Ranke" |
| 17 |
|
echo Distribution is $DIST |
| 18 |
|
echo Architecture is $ARCH |
| 19 |
|
|
| 20 |
|
if [ -d r-base-* ] |
| 21 |
|
then |
| 22 |
|
rm -rf `ls -d r-base-*` |
| 23 |
|
fi |
| 24 |
|
|
| 25 |
|
apt-get update |
| 26 |
|
apt-get source r-base |
| 27 |
|
|
| 28 |
rm -rf r-base* r-base-core* r-mathlib* |
# Change any ~ in the name of the build directory for a - to avoid a |
| 29 |
|
# bug in texi2dvi. Thanks Vincent |
| 30 |
|
if [ -d r-base-*~* ] |
| 31 |
|
then |
| 32 |
|
dir=`ls -d r-base-*~*` |
| 33 |
|
mv $dir `echo $dir | sed y/~/-/` |
| 34 |
|
fi |
| 35 |
|
|
|
#apt-get update # needs real root privileges |
|
|
apt-get source -t unstable r-base |
|
| 36 |
cd r-base-* |
cd r-base-* |
| 37 |
|
|
| 38 |
# Old version |
# Old version |
| 39 |
oldversion=`dpkg-parsechangelog | grep ^Version | cut -f2 -d " "` |
oldversion=`dpkg-parsechangelog | grep ^Version | cut -f2 -d " "` |
| 40 |
cranversion=$oldversion"~lennycran.0" |
cranversion=$oldversion"~"$DIST"cran.0" |
| 41 |
|
|
| 42 |
|
echo Old version is $oldversion |
| 43 |
|
echo CRAN version is $cranversion |
| 44 |
|
|
| 45 |
# Add new version to changelog |
# Add new version to changelog |
| 46 |
dch -v "${cranversion}" -D lenny-cran -b "Backport from Debian unstable to Debian lenny" |
dch -v "${cranversion}" --force-distribution -D $DIST-cran -b "Backport from Debian unstable to Debian $DIST" |
| 47 |
|
|
| 48 |
|
# Reverts for squeeze and lenny: |
| 49 |
|
# None at present |
| 50 |
|
|
| 51 |
|
# Reverts for lenny only: |
| 52 |
|
if [ $DIST = "lenny" ] |
| 53 |
|
then |
| 54 |
|
|
| 55 |
|
# 1. Starting with Debian packages for R 2.9.2 there is a build dependency |
| 56 |
|
# on debhelper >= 7.2.3, which is not in lenny nor etch This also means we |
| 57 |
|
# have to reinclude debian/r-doc-{info,html}.{postinst,prerm}, thanks Dirk |
| 58 |
|
# for pointing this out. |
| 59 |
|
|
| 60 |
# Reverts for lenny: |
sed -i '/^Build-Depends/s/debhelper (>= 7.2.3)/debhelper/' debian/control |
| 61 |
# |
dch -a "debian/control: revert Build-Depends: to 'debhelper' since $DIST has a version < 7.2.3" |
| 62 |
|
sed -i 's/dh_prep/dh_clean/g' debian/rules |
| 63 |
|
dch -a "debian/rules: revert dh_prep calls to dh_clean calls since the latter is not present lennys version of 'debhelper'" |
| 64 |
|
|
| 65 |
# Build package showing all messages and separating output to build and error logs |
# 2. Starting with Debian packages for R 2.9.2-2 there is an install |
| 66 |
(dpkg-buildpackage -tc | tee ../build_log_r-base_i386) 3>&1 1>&2 2>&3 | tee ../build_errors_r-base_i386 |
# dependency on 'dpkg (>= 1.15.4) | install-info'. Neither package is in |
| 67 |
|
# Debian releases etch nor lenny. This also requires to reinclude |
| 68 |
|
# debian/r-doc-{info,html}.{postinst,prerm}, just like for the fix above. |
| 69 |
|
|
| 70 |
|
sed -i '/^Depends/s/dpkg (>= 1.15.4) | install-info/dpkg | install-info/' debian/control |
| 71 |
|
dch -a "debian/control: revert Depends: to 'dpkg | install-info' for r-doc-info since lenny has a version of dpkg < 1.15.4 and no separate package install-info" |
| 72 |
|
|
| 73 |
|
# 3. liblzma is not available in Debian distributions before squeeze |
| 74 |
|
|
| 75 |
|
sed -i '/^Build-Depends/s/, liblzma-dev//' debian/control |
| 76 |
|
dch -a "debian/control: Remove dependency to liblzma-dev as it is not available in lenny. As a consequence, the version provided in the R sources is used" |
| 77 |
|
fi |
| 78 |
|
|
| 79 |
|
pbuilder update |
| 80 |
|
pdebuild --debbuildopts '-sa' --buildresult /home/ranke/svn/website/www/ranke/r-cran/$DIST-cran/ -- --distribution $DIST --basetgz /var/cache/pbuilder/$DIST-$ARCH-base.tgz --aptcache /var/cache/pbuilder/$DIST-$ARCH/aptcache --buildplace /var/cache/pbuilder/$DIST-$ARCH/build |
| 81 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 82 |
exit 1 |
exit |
| 83 |
fi |
fi |
| 84 |
|
|
| 85 |
cd .. |
cd .. |
|
|
|
|
# Create diff to Debian unstable |
|
|
interdiff -z *.diff.gz > interdiff_to_debian_sid |
|
|
|
|
|
# Sign logs and interdiff |
|
|
for i in interdiff_to_debian_sid build_log_r-base_i386 build_errors_r-base_i386 |
|
|
do |
|
|
gpg --clearsign $i |
|
|
mv $i.asc $i |
|
|
done |
|