[PATCH 4/9] set $MIRRORSITE default by --distribution
Loïc Minier
lool at dooz.org
Fri Jan 22 23:05:55 UTC 2010
On Sun, Jan 17, 2010, Loïc Minier wrote:
> function preload_config () {
> while [ -n "$1" ]; do
> case "$1" in
> + --distribution|-d)
> + DISTRIBUTION="$2";
> + OVERRIDE_APTLINES_WARN=yes
> + shift; shift;
> + ;;
> --profile|-p)
> PROFILE="$2";
> shift; shift;
> @@ -45,7 +50,68 @@ function preload_config () {
>
> preload_config "$@"
>
> +# Some distribution needs to use different distribution as their basis
> +case "$DISTRIBUTION" in
> + expeimental)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="sid"
> + ;;
"experimental"
> + *-backports)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%-backports}"
> + ;;
> + *-proposed-updates)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%-proposed-updates}"
> + ;;
I don't really think that works well with just two vars. Either we
support listing as many dists as one wants, or we just allow passing
templates (such as the APTCONFDIR approach).
With Ubuntu, it's either karmic + karmic-security (for security builds)
or karmic + karmic-security + karmic-updates (for stable updates) or
karmic + karmic-security + karmic-updates + karmic-backports (for
backports).
Also, relying on parts of the name isn't too nice IMO and it makes a
lot of duplication:
> + */updates)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%/updates}"
> + ;;
> + */volatile-sloppy)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%/volatile-sloppy}"
> + ;;
> + */volatile)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%/volatile}"
> + ;;
> + *-proposed)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%-proposed}"
> + ;;
> + *-updates)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%-updates}"
> + ;;
> + *-security)
> + DISTRIBUTION_ORIGINAL="$DISTRIBUTION"
> + DISTRIBUTION="${DISTRIBUTION%%-security}"
> + ;;
> + *)
> + DISTRIBUTION_ORIGINAL=""
> + ;;
> +esac
> . "$PBUILDER_PKGLIBDIR"/pbuilder-loadconfig
> +
> +# Set MIRRORSITE default based on $DISTRIBUTION
> +# before parsing --mirror
> +case "$DISTRIBUTION" in
> + drapper|hardy|interpid|jaunty|karmic|lucid)
> + MIRRORSITE="$UBUNTU_MIRRORSITE"
> + MIRROR_TYPE="UBUNTU"
> + ;;
> + bo|buzz|hamm|potato|rex|sarge|slink|woody)
> + MIRRORSITE="$DEBIAN_OLD_MIRRORSITE"
> + MIRROR_TYPE="DEBIAN_OLD"
> + ;;
> + *)
> + MIRRORSITE="$DEBIAN_MIRRORSITE"
> + MIRROR_TYPE="DEBIAN"
> + ;;
> +esac
That's fine
> @@ -69,6 +135,10 @@ while [ -n "$1" ]; do
> # preloaded
> shift; shift;
> ;;
> + --distribution|-d)
> + # preloaded
> + shift; shift;
> + ;;
Not too nice :-/
> -# handle 'experimental' specially. -- required for raw pbuilder (create/update) only.
> -if [ "$DISTRIBUTION" = "experimental" ]; then
> - DISTRIBUTION="sid"
> - EXPERIMENTAL="true"
> -else
> - EXPERIMENTAL=
> -fi
It's nice to think that we might get rid of this special case; thanks
> --- a/pbuilder-modules
> +++ b/pbuilder-modules
> @@ -371,16 +371,43 @@ EOF
> cat > "$BUILDPLACE"/etc/apt/apt.conf.d/15pbuilder <<EOF
> APT::Install-Recommends "false";
> EOF
> - if [ -n "$EXPERIMENTAL" ]; then
> - log "I: Installing apt-lines and pinning for experimental"
> - if [ -n "$MIRRORSITE" ] ; then
> - echo "deb $MIRRORSITE experimental main" >> "$BUILDPLACE"/etc/apt/sources.list
> - echo "#deb-src $MIRRORSITE experimental main" >> "$BUILDPLACE"/etc/apt/sources.list
> - fi
> - cat >> "$BUILDPLACE"/etc/apt/apt.conf.d/15pbuilder <<EOF
> + case "$DISTRIBUTION" in
> + expeimental)
"experimental"
> + log "I: Installing apt-lines and pinning for experimental"
> + echo "deb $DEBIAN_MIRRORSITE experimental $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $DEBIAN_MIRRORSITE experimental $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + cat >> "$BUILDPLACE"/etc/apt/apt.conf.d/15pbuilder <<EOF
> APT::Default-Release "experimental";
> EOF
> - fi
Lots of duplication here again:
> + etch-backports|lenny-backports)
> + log "I: Installing apt-lines for $DISTRIBUTION_ORIGINAL (Debian)"
> + echo "deb $DEBIAN_BACKPORTS_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $DEBIAN_BACKPORTS_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + ;;
> + *-backports)
> + log "I: Installing apt-lines for $DISTRIBUTION_ORIGINAL (Ubuntu)"
> + echo "deb $UBUNTU_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $UBUNTU_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + *-proposed-updates)
> + log "I: Installing apt-lines for $DISTRIBUTION_ORIGINAL (Debian)"
> + echo "deb $DEBIAN_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $DEBIAN_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + */updates)
> + log "I: Installing apt-lines for $DISTRIBUTION_ORIGINAL (Debian security)"
> + echo "deb $DEBIAN_SECURITY_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $DEBIAN_SECURITY_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + */volatile-sloppy|*/volatile)
> + log "I: Installing apt-lines for $DISTRIBUTION_ORIGINAL (Debian volatile)"
> + echo "deb $DEBIAN_VOLATILE_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $DEBIAN_VOLATILE_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + *-proposed|*-updates|*-security)
> + log "I: Installing apt-lines for $DISTRIBUTION_ORIGINAL (Ubuntu)"
> + echo "deb $UBUNTU_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> + echo "#deb-src $UBUNTU_MIRRORSITE $DISTRIBUTION_ORIGINAL $COMPONENTS" >> "$BUILDPLACE"/etc/apt/sources.list
> +DEBIAN_OLD_MIRRORSITE="http://archive.debian.org/debian"
> +DEBIAN_VOLATILE_MIRRORSITE="http://volatile.debian.org/debian-volatile"
> +DEBIAN_BACKPORTS_MIRRORSITE="http://backports.org/debian"
> +DEBIAN_SECURITY_MIRRORSITE="http://security.debian.org"
> +UBUNTU_MIRRORSITE="http://archive.ubuntu.com/ubuntu"
Ubuntu uses ports.ubuntu.com/ubuntu-ports for port arches (armel, lpia,
ia64, ...); only amd64 and i386 on archive.u.c/u
We can sort that out later.
What would you think of splitting sources.list generation out in a
separate binary as to allow for easy testing in the testsuite?
--
Loïc Minier
More information about the Pbuilder-maint
mailing list