summaryrefslogblamecommitdiff
path: root/backport_r-base.sh
blob: 61d6b87c2e59e3f5b6878e1fbda6effdefe8649b (plain) (tree)
1
2
3
4
5
6
7
8
9




                                                
 
                                                                          

                                                                           


                                                       
                                                  










                                      
              
                     














                                                                    


                                 
                              
                                                                                                             
 





                                
 



                                                                              



                                                                                                       
                                                                                                                                    






                                                                                            
                                                                                                                                                                    
 


                                                                        
                                                                                                                                                              

  
               
                                                                                                                                                                                                                                                                                  




                     
#!/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 squeeze and lenny:
# None at present

# Reverts for lenny only:
if [ $DIST = "lenny" ]
then

    # 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 lennys 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 lenny 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 lenny. As a consequence, the version provided in the R sources is used"
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