| 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 |
rm -rf r-base* r-base-core* r-mathlib* |
# 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 # needs real root privileges |
apt-get update |
| 26 |
apt-get source -t unstable r-base |
apt-get source -t unstable r-base |
| 27 |
|
|
| 28 |
|
# 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 |
|
|
| 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 lenny and etch: |
| 49 |
|
|
| 50 |
|
# 1. Starting with Debian packages for R 2.9.2 there is a build dependency |
| 51 |
|
# on debhelper >= 7.2.3, which is not in lenny nor etch This also means we |
| 52 |
|
# have to reinclude debian/r-doc-{info,html}.{postinst,prerm}, thanks Dirk |
| 53 |
|
# for pointing this out. |
| 54 |
|
|
| 55 |
|
sed -i '/^Build-Depends/s/debhelper (>= 7.2.3)/debhelper/' debian/control |
| 56 |
|
dch -a "debian/control: revert Build-Depends: to 'debhelper' since $DIST has a version < 7.2.3" |
| 57 |
|
sed -i 's/dh_prep/dh_clean/g' debian/rules |
| 58 |
|
dch -a "debian/rules: revert dh_prep calls to dh_clean calls since the latter is not present in this release's version of 'debhelper'" |
| 59 |
|
|
| 60 |
|
# 2. Starting with Debian packages for R 2.9.2-2 there is an install |
| 61 |
|
# dependency on 'dpkg (>= 1.15.4) | install-info'. Neither package is in |
| 62 |
|
# Debian releases etch nor lenny. This also requires to reinclude |
| 63 |
|
# debian/r-doc-{info,html}.{postinst,prerm}, just like for the fix above. |
| 64 |
|
|
| 65 |
|
sed -i '/^Depends/s/dpkg (>= 1.15.4) | install-info/dpkg | install-info/' debian/control |
| 66 |
|
dch -a "debian/control: revert Depends: to 'dpkg | install-info' for r-doc-info since ${DISTRIB_DESCRIPTION} has a version of dpkg < 1.15.4 and no separate package install-info" |
| 67 |
|
|
| 68 |
|
# Reverts for etch only: |
| 69 |
|
if [ $DIST = "etch" ] |
| 70 |
|
then |
| 71 |
|
# 1. Starting with Debian packages for R 2.6.1-2, the build dependency |
| 72 |
|
# to 'refblas3-dev|atlas3-base-dev' is changed to 'libblas-dev' to |
| 73 |
|
# use the new gfortran-built BLAS libraries. From R 2.7.0, the |
| 74 |
|
# dependency is on 'libblas-dev | libatlas-base-dev' for |
| 75 |
|
# r-base-dev. |
| 76 |
|
|
| 77 |
|
sed -i '/^Build-Depends/s/libblas-dev/refblas3-dev|atlas3-base-dev/' debian/control |
| 78 |
|
sed -i '/^Depends/s/libblas-dev | libatlas-base-dev/refblas3-dev|atlas3-base-dev/' debian/control |
| 79 |
|
dch -a "debian/control: revert Build-Depends: to 'refblas3-dev|atlas3-base-dev' and Depends: to 'refblas3-dev|atlas3-base-dev' since etch does not have the new gfortran-built BLAS libraries" |
| 80 |
|
|
| 81 |
|
# 2. Starting with Debian packages for R 2.6.2, new build dependency |
| 82 |
|
# on liblapack-dev to switch back to using Debian's Lapack rather |
| 83 |
|
# than the version supplied by R. From R 2.7.0, the dependency is |
| 84 |
|
# on 'liblapack-dev (>= 3.1.1)' for r-base and 'liblapack-dev | |
| 85 |
|
# libatlas-base-dev' for r-base-dev. |
| 86 |
|
|
| 87 |
|
sed -i '/^Build-Depends/s/liblapack-dev (>= 3.1.1), //' debian/control |
| 88 |
|
sed -i '/^Depends/s/liblapack-dev | libatlas-base-dev, //' debian/control |
| 89 |
|
dch -a "debian/control: revert Build-Depends: and Depends: fields since we use the Lapack supplied with R" |
| 90 |
|
sed -i '/^lapack/{ |
| 91 |
|
s/lapack/\#lapack/ |
| 92 |
|
a\ |
| 93 |
|
# jr 24 Apr 2008 Set to =no for Debian etch |
| 94 |
|
a\lapack = --with-lapack=no |
| 95 |
|
}' debian/rules |
| 96 |
|
dch -a "debian/rules: Accordingly, do not configure --with-lapack" |
| 97 |
|
|
| 98 |
|
# 3. Requirement for tk8.4 >= 8.4.16-2 introduced in r-base 2.6.0-4 to |
| 99 |
|
# circumvent a breakage with 8.4.16-1. The version in etch is 8.4.12-1etch2. |
| 100 |
|
|
| 101 |
# Reverts for lenny: |
rm debian/shlibs.local |
| 102 |
# |
dch -a "delete debian/shlibs.local since the dependency on tk8.4 is not an issue for Debian etch" |
| 103 |
|
|
| 104 |
# Build package showing all messages and separating output to build and error logs |
# 4. The TeX distribution in etch is tetex |
| 105 |
(dpkg-buildpackage -tc | tee ../build_log_r-base_i386) 3>&1 1>&2 2>&3 | tee ../build_errors_r-base_i386 |
|
| 106 |
|
sed -i '/^Build-Depends/s/texlive-base, texlive-latex-base, texlive-generic-recommended, texlive-fonts-recommended, texlive-extra-utils, texlive-latex-recommended, texlive-latex-extra, texinfo, texi2html/tetex-bin, tetex-extra/' debian/control |
| 107 |
|
dch -a "debian/control: revert Build-Depends: to 'tetex-bin, tetex-extra' since etch does not have texlive" |
| 108 |
|
|
| 109 |
|
# 5. xauth is part of xbase-clients in etch |
| 110 |
|
|
| 111 |
|
sed -i '/^Build-Depends/s/xauth/xbase-clients/' debian/control |
| 112 |
|
dch -a "debian/control: replace xauth by xbase-clients in Build-Depends:" |
| 113 |
|
|
| 114 |
|
# 6. Tcl and TK are 8.4 on Debian etch |
| 115 |
|
|
| 116 |
|
sed -i '/^Build-Depends/s/ tcl8.5-dev/tcl8.4-dev/' debian/control |
| 117 |
|
sed -i '/^Build-Depends/s/ tk8.5-dev/tk8.4-dev/' debian/control |
| 118 |
|
dch -a "debian/control: revert build dependence for tcl/tk to 8.4" |
| 119 |
|
|
| 120 |
|
# 7. Openjdk is not in etch |
| 121 |
|
|
| 122 |
|
sed -i '/^Build-Depends/s/, openjdk-6-jdk \[!arm !hppa !kfreebsd-i386 !kfreebsd-amd64 !hurd-i386\]//' debian/control |
| 123 |
|
dch -a "debian/control: Remove build dependence on openjdk" |
| 124 |
|
|
| 125 |
|
# 8. Debhelper in etch is 5.0.42 |
| 126 |
|
|
| 127 |
|
echo 5 > debian/compat |
| 128 |
|
dch -a "debian/compat: revert 'debhelper' compatibility level to 5" |
| 129 |
|
|
| 130 |
|
# 9. R 2.9.0 wants ucf >= 3.0 which is not available in etch (2.0020) |
| 131 |
|
|
| 132 |
|
sed -i 's/ucf (>= 3.0)/ucf/' debian/control |
| 133 |
|
dch -a "debian/control: revert Depends: of r-base-core to 'ucf' since the version in etch is < 3.0" |
| 134 |
|
fi |
| 135 |
|
|
| 136 |
|
pbuilder update |
| 137 |
|
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 |
| 138 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 139 |
exit 1 |
exit |
| 140 |
fi |
fi |
| 141 |
|
|
| 142 |
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 |
|