summaryrefslogtreecommitdiff
path: root/backport_r-base.sh
blob: 63a821e09d8021d9827ef7024013dfb98620f4c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash

# Script to automate backporting r-base for CRAN

# Author: Johannes Ranke <jranke@uni-bremen.de>

# Developed in parallel with Vincent Goulet <vincent.goulet@act.ulaval.ca>
# On Debian I used to run this script as root. On Ubuntu I now run it with 
# sudo -E sh backport_r-base.sh

# Preconditions: - shell variables DIST and ARCH
#                - sid sources in /etc/apt/sources/list
#                - cdbs installed (and maybe more)

export DEBEMAIL="jranke@uni-bremen.de"
export DEBFULLNAME="Johannes Ranke"
echo Distribution is $DIST
echo Architecture is $ARCH

if [ -d r-base-* ]
then
    rm -rf `ls -d r-base-*`
fi

apt-get update
apt-get source r-base

# Change any ~ in the name of the build directory for a - to avoid a
# bug in texi2dvi. Thanks Vincent
if [ -d r-base-*~* ]
then
    dir=`ls -d r-base-*~*`
    mv $dir `echo $dir | sed y/~/-/`
fi

cd r-base-*

# Old version
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"

# Reverts for lenny and etch:

    # 1. Starting with Debian packages for R 2.9.2 there is a build dependency
    # on debhelper >= 7.2.3, which is not in lenny nor etch This also means we
    # have to reinclude debian/r-doc-{info,html}.{postinst,prerm}, thanks Dirk
    # for pointing this out.

	sed -i '/^Build-Depends/s/debhelper (>= 7.2.3)/debhelper/' debian/control
	dch -a "debian/control: revert Build-Depends: to 'debhelper' since $DIST has a version < 7.2.3"
	sed -i 's/dh_prep/dh_clean/g' debian/rules
	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'" 

    # 2. Starting with Debian packages for R 2.9.2-2 there is an install
    # dependency on 'dpkg (>= 1.15.4) | install-info'. Neither package is in
    # Debian releases etch nor lenny. This also requires to reinclude
    # debian/r-doc-{info,html}.{postinst,prerm}, just like for the fix above.

    sed -i '/^Depends/s/dpkg (>= 1.15.4) | install-info/dpkg | install-info/' debian/control
    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"

    # 3. liblzma is not available in Debian distributions before squeeze

    sed -i '/^Build-Depends/s/, liblzma-dev//' debian/control
    dch -a "debian/control: Remove dependency to liblzma-dev as it is not available in ${DISTRIB_DESCRIPTION}. As a consequence, the version provided in the R sources is used"

# Reverts for etch only:
if [ $DIST = "etch" ]
then
	# 1. Starting with Debian packages for R 2.6.1-2, the build dependency
	#    to 'refblas3-dev|atlas3-base-dev' is changed to 'libblas-dev' to
	#    use the new gfortran-built BLAS libraries. From R 2.7.0, the
	#    dependency is on 'libblas-dev | libatlas-base-dev' for
	#    r-base-dev.

	sed -i '/^Build-Depends/s/libblas-dev/refblas3-dev|atlas3-base-dev/' debian/control
	sed -i '/^Depends/s/libblas-dev | libatlas-base-dev/refblas3-dev|atlas3-base-dev/' debian/control
	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"

	# 2. Starting with Debian packages for R 2.6.2, new build dependency
	#    on liblapack-dev to switch back to using Debian's Lapack rather
	#    than the version supplied by R. From R 2.7.0, the dependency is
	#    on 'liblapack-dev (>= 3.1.1)' for r-base and 'liblapack-dev |
	#    libatlas-base-dev' for r-base-dev.

	sed -i '/^Build-Depends/s/liblapack-dev (>= 3.1.1), //' debian/control
	sed -i '/^Depends/s/liblapack-dev | libatlas-base-dev, //' debian/control
	    dch -a "debian/control: revert Build-Depends: and Depends: fields since we use the Lapack supplied with R"
	    sed -i '/^lapack/{
	s/lapack/\#lapack/
	a\
	# jr 24 Apr 2008 Set to =no for Debian etch
	a\lapack                = --with-lapack=no
	}'  debian/rules
	    dch -a "debian/rules: Accordingly, do not configure --with-lapack"

	# 3. Requirement for tk8.4 >= 8.4.16-2 introduced in r-base 2.6.0-4 to
	#    circumvent a breakage with 8.4.16-1. The version in etch is 8.4.12-1etch2.

	rm debian/shlibs.local
	dch -a "delete debian/shlibs.local since the dependency on tk8.4 is not an issue for Debian etch"

	# 4. The TeX distribution in etch is tetex

	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
	dch -a "debian/control: revert Build-Depends: to 'tetex-bin, tetex-extra' since etch does not have texlive"

	# 5. xauth is part of xbase-clients in etch

	sed -i '/^Build-Depends/s/xauth/xbase-clients/' debian/control
	dch -a "debian/control: replace xauth by xbase-clients in Build-Depends:"

	# 6. Tcl and TK are 8.4 on Debian etch

	sed -i '/^Build-Depends/s/ tcl8.5-dev/tcl8.4-dev/' debian/control
	sed -i '/^Build-Depends/s/ tk8.5-dev/tk8.4-dev/' debian/control
	dch -a "debian/control: revert build dependence for tcl/tk to 8.4"

	# 7. Openjdk is not in etch

	sed -i '/^Build-Depends/s/, openjdk-6-jdk \[!arm !hppa !kfreebsd-i386 !kfreebsd-amd64 !hurd-i386\]//' debian/control
	dch -a "debian/control: Remove build dependence on openjdk"

  # 8. Debhelper in etch is 5.0.42

	echo 5 > debian/compat
	dch -a "debian/compat: revert 'debhelper' compatibility level to 5"

	# 9. R 2.9.0 wants ucf >= 3.0 which is not available in etch (2.0020)

	sed -i 's/ucf (>= 3.0)/ucf/' debian/control
	dch -a "debian/control: revert Depends: of r-base-core to 'ucf' since the version in etch is < 3.0"
fi

#pbuilder update
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
if [ $? -ne 0 ]; then
    exit 
fi

cd ..

Contact - Imprint