Using Ubuntu (& Debian) pbuilder with Sun Java¶
If your package needs a version of Java from Sun to build you will get into problems building it with pbuilder as the license question will not be shown (and hence it can not be answered).
Examples of Build Depends that fails without this small patch:
Build-Depends: debhelper (>= 4.0.0), j2sdk1.4 | java2-compiler Build-Depends: debhelper (>= 4.0.0), sun-java6-jdk | java2-compiler
The patch attached to this page (against pbuilder version: 0.161ubuntu2) allows pbuilder to be used.
Note you have to list muliverse as a component in pbuilderrc as well e.g.
COMPONENTS="main universe restricted multiverse"
or for Debian you will need non-free and contrib as well
COMPONENTS="main contrib non-free"
Patches:
¶
--- pbuilder-0.181/pbuilder-satisfydepends-aptitude 2007-11-24 14:35:27.000000000 +0100 +++ pbuilder-0.181.javafix/pbuilder-satisfydepends-aptitude 2009-01-19 16:32:36.000000000 +0100 @@ -85,6 +85,12 @@ $CHROOTEXEC sh -c "cat \"$BUILD_DEP_DEB_CONTROL\"" $CHROOTEXEC sh -c "dpkg-deb -b \"$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy\"" $CHROOTEXEC apt-get -y --force-yes install aptitude + JAVA_FIX=$(echo $DEPENDS | xargs -n1 | tr -d , | egrep "sun-java6-jre|sun-java6-jdk|sun-java6-bin|sun-java5-jre|sun-java5-jdk|sun-java5-bin" | head -n1) + if [ -n "$JAVA_FIX" ]; then + echo "---- $JAVA_FIX license question fix ----" + $CHROOTEXEC apt-get -y install debconf + printf "$JAVA_FIX shared/accepted-sun-dlj-v1-1 boolean true\n" | $CHROOTEXEC debconf-set-selections - + fi $CHROOTEXEC dpkg -i "$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy.deb" || true $CHROOTEXEC aptitude -y --without-recommends -o APT::Install-Recommends=false -o Aptitude::CmdLine::Ignore-Trust-Violations=true -o Aptitude::ProblemResolver::StepScore=100 install pbuilder-satisfydepends-dummy # check whether the aptitude's resolver kept the package
¶
diff -u pbuilder-0.161ubuntu2/pbuilder-satisfydepends pbuilder-0.161ubuntu2.javafix/pbuilder-satisfydepends --- pbuilder-0.161ubuntu2/pbuilder-satisfydepends 2006-11-22 03:57:38.000000000 +0100 +++ pbuilder-0.161ubuntu2.javafix/pbuilder-satisfydepends 2007-07-12 15:20:02.000000000 +0200 @@ -126,6 +126,30 @@ fi fi echo " -> Trying ${CURRENTREALPKGNAME}" + + # Java license question fixes + if [ $CURRENTREALPKGNAME == "j2re1.4" ];then + echo "---- j2re1.4 debconf license question fix ----" + $CHROOTEXEC apt-get -y install debconf + printf "j2re1.4 j2re1.4/stopthread boolean false\nj2re1.4 j2re1.4/license boolean true\n" | $CHROOTEXEC debconf-set-selections - + fi + if [ $CURRENTREALPKGNAME == "j2sdk1.4" ];then + echo "---- j2sdk1.4 debconf license question fix ----" + $CHROOTEXEC apt-get -y install debconf + printf "j2sdk1.4 j2sdk1.4/stopthread boolean false\nj2sdk1.4 j2sdk1.4/license boolean true\n" | $CHROOTEXEC debconf-set-selections - + + # For sdk we need both fixes + echo "---- j2re1.4 debconf license question fix (part of j2sdk1.4 fix)----" + printf "j2re1.4 j2re1.4/stopthread boolean false\nj2re1.4 j2re1.4/license boolean true\n" | $CHROOTEXEC debconf-set-selections - + fi + + case "$CURRENTREALPKGNAME" in + sun-java6-jre|sun-java6-jdk|sun-java6-bin|sun-java5-jre|sun-java5-jdk|sun-java5-bin) + echo "---- $CURRENTREALPKGNAME debconf license question fix ----" + $CHROOTEXEC apt-get -y install debconf + printf "$CURRENTREALPKGNAME shared/accepted-sun-dlj-v1-1 boolean true\n" | $CHROOTEXEC debconf-set-selections - + ;; + esac if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${CURRENTREALPKGNAME} >& /dev/null; then SATISFIED="yes"