Bug#363088: pbuilder: please add example script for cross-arch support i386/amd64

Loïc Minier lool at dooz.org
Sat Jan 2 13:27:46 UTC 2010


        Hi

On Sat, Jan 05, 2008, Andres Mejia wrote:
> This isn't an example script but an example configuration that could
> be used to allow maintaining multiple pbuilders with different archs
> and distro bases. You would basically set the variables DIST with the
> distribution to use and ARCH with the architecture to use.
> 
> This comes from https://wiki.ubuntu.com/PbuilderHowto
> 
> if [ -n "${DIST}" ] ; then
>         NAME="$DIST"
>         if [ -n "${ARCH}" ] ; then
>                 NAME="$NAME-$ARCH"
>                 DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
>                 export DEBIAN_BUILDARCH="$ARCH"
>         fi
>         BASETGZ="`dirname $BASETGZ`/$NAME-base.tgz"
>         DISTRIBUTION="$DIST"
>         BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
>         APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
> 
>         case "$DIST" in
>                 hardy|gutsy)
>                         # ubuntu specific
>                         MIRRORSITE="http://us.archive.ubuntu.com/ubuntu"
>                         COMPONENTS="main restricted universe multiverse"
>                         ;;
>                 sid|etch)
>                         # debian specific
>                         MIRRORSITE="http://http.us.debian.org/debian/"
>                         COMPONENTS="main contrib non-free"
>                         fi
>                         ;;
>                 "*")
>                         echo "Unknown distribution: $DIST"
>                         exit 1
>                         ;;
>         esac
> fi

 Thanks, I think the mirror selection should be done within pbuilder for
 Debian/Ubuntu and perhaps some other distros.  I'm not sure the mirror
 should be computed on every call though, probably only when creating an
 environment.  Concerning $DIST, I find it a bit unfortunate since
 pbuilder should simply do the right thing if you set DISTRIBUTION
 properly.  Perhaps this should simply be:
    DISTRIBUTION="${DISTRIBUTION:-sid}"
    case $DISTRIBUTION in
      unstable)
        DISTRIBUTION=sid
      ;;
      testing)
        DISTRIBUTION=squeeze
      ;;
      stable)
        DISTRIBUTION=lenny
      ;;
      oldstable)
        DISTRIBUTION=etch
      ;;
    esac
    NAME="$DISTRIBUTION${ARCHITECTURE:+-$ARCHITECTURE}"
    BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"

 I find this fragile:
    BASETGZ="`dirname $BASETGZ`/$NAME-base.tgz"

 That's only needed when mixing e.g. Debian and Ubuntu:
    APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
 and should probably be $NAME-aptcache for consistency.

 Note that passing --arch to debootstrap is now done automatically if
 ARCHITECTURE/--architecture is set.

 Would love if you could rework the patch against tip.

   Thanks!
-- 
Loïc Minier





More information about the Pbuilder-maint mailing list