Bug#810967: pbuilder: adds MIRRORSITE to /etc/pbuilderrc on each upgrade, overwriting local admin config

Thorsten Glaser tg at mirbsd.de
Thu Jan 14 18:48:08 UTC 2016


Mattia Rizzolo dixit:

>Then, reading debian/pbuilder.config only if MIRRORSITE is not set, do
>you confirm that you don't have it set?

I say I *do* have it set. pbuilderrc attached.

bye,
//mirabilos
-- 
This space for rent.
-------------- next part --------------
# $MirOS: contrib/hosted/tg/deb/pbuilderrc,v 1.51 2015/12/01 15:28:42 tg Exp $
#-
# Sample ~/.pbuilderrc for multiple architecture, distribution and
# suite support. For me, works rather well; may just as well break.
#
# Example uses include setting DIST=sid (regular package build),
# DIST=lenny-backports-sloppy/i386 or DIST=sid/amd64 CUSTOM=foo
# (with linux32 or linux64 (possibly --uname-2.6 also), respectively,
# prepended to build for the other architecture, and select chroots
# appropriately). Hint: use this nice wrapper script:
# https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git;a=blob;f=mksh/debian-dev/c;hb=HEAD
#-
# debian.org: sarge etch lenny squeeze wheezy jessie stretch sid
# debian LTS: squeeze
# debian-ports.org: dpo (unstable+unreleased)
# not supported: experimental etch-m68k jessie-kfreebsd
# Debian derivate from Canonical that cannot be named:
#	dapper hardy jaunty karmic lucid maverick natty oneiric
#	precise quantal raring saucy trusty utopic vivid wily xenial
# *-backports: sarge etch lenny squeeze wheezy jessie
#	(plus all Debian derivate from Canonical that cannot be named)
# *-backports-sloppy: lenny squeeze wheezy
# univention: not supported? yet?
#
# NOTE for sarge: bootstrapping includes sarge-backports for
# the use of cowdancer; you MUST change sources.list in its
# base.cow after creating and before updating!
#
# NOTE for all: run cowbuilder --update after --create once.
#
# TODO: using -backports chroots is deprecated in favour of
# adding the backports sources.list.d entries in a hook script.
#
# TODO: changes to the mirrors don?t apply to existing chroots
# as they are read on --create only? move into a sources.list
# update script instead.

export BUILDRESULTUID=1000
export BUILDRESULTGID=1000
export BUILDUSERID=1234
export BUILDUSERNAME=pbuilder
export DEBEMAIL='Thorsten Glaser <tg at mirbsd.de>'

# desirable, unless you *want* to run most time-consuming
# testsuites, which usually fail anyway? (yay for optimism)
#export DEB_BUILD_OPTIONS='nobench nocheck'

setuptofail() {
	# this makes cowbuilder succeed and pbuilder fail
	for i in "${BASH_SOURCE[@]}"; do
		case $i in
		*/pbuilder-loadconfig)
			echo >&2 "E: MirDebian pbuilderrc: aborting"
			echo >&2
			exit 1
			;;
		esac
	done
	export BASEPATH=/var/cache/pbuilder/result
}

# known distributions and distribution-specific things (suites, mirrors, ?)
DISTROS='debian dpo ubuntu'
DISTS_debian='sarge etch lenny squeeze wheezy jessie stretch sid'
DISTS_dpo='dpo'
DISTS_ubuntu='dapper hardy jaunty karmic lucid maverick natty oneiric precise quantal raring saucy trusty utopic vivid wily xenial'
DISTLTS_debian=squeeze
DISTBACKPORTS_debian=sarge:etch:lenny:squeeze:wheezy:jessie
DISTBACKPORTSLOPPY_debian=lenny:squeeze:wheezy
DISTBACKPORTUPDATE_ubuntu=dapper:hardy:jaunty:karmic:lucid:maverick:natty:oneiric:precise:quantal:raring:saucy:trusty:utopic:vivid:wily:xenial
MIRROR_sarge=http://archive.debian.org/debian/
MIRROR_etch=http://archive.debian.org/debian/
MIRROR_lenny=http://archive.debian.org/debian/
MIRROR_squeeze=http://archive.debian.org/debian/
MIRROR_wheezy=http://httpredir.debian.org/debian/
MIRROR_jessie=http://httpredir.debian.org/debian/
MIRROR_stretch=http://httpredir.debian.org/debian/
MIRROR_sid=http://httpredir.debian.org/debian/
MIRROR_unstable=http://ftp.de.debian.org/debian-ports/
MIRROR_unreleased=http://ftp.de.debian.org/debian-ports/
MIRROR_dapper=http://old-releases.ubuntu.com/ubuntu/
MIRROR_hardy=http://old-releases.ubuntu.com/ubuntu/
MIRROR_jaunty=http://old-releases.ubuntu.com/ubuntu/
MIRROR_karmic=http://old-releases.ubuntu.com/ubuntu/
MIRROR_lucid=http://archive.ubuntu.com/ubuntu/
MIRROR_maverick=http://old-releases.ubuntu.com/ubuntu/
MIRROR_natty=http://old-releases.ubuntu.com/ubuntu/
MIRROR_oneiric=http://old-releases.ubuntu.com/ubuntu/
MIRROR_precise=http://archive.ubuntu.com/ubuntu/
MIRROR_quantal=http://old-releases.ubuntu.com/ubuntu/
MIRROR_raring=http://old-releases.ubuntu.com/ubuntu/
MIRROR_saucy=http://old-releases.ubuntu.com/ubuntu/
MIRROR_trusty=http://archive.ubuntu.com/ubuntu/
MIRROR_utopic=http://old-releases.ubuntu.com/ubuntu/
MIRROR_vivid=http://archive.ubuntu.com/ubuntu/
MIRROR_wily=http://archive.ubuntu.com/ubuntu/
MIRROR_xenial=http://archive.ubuntu.com/ubuntu/
MIRRORSECURITY_sarge=http://archive.debian.org/debian-security/
MIRRORSECURITY_etch=http://archive.debian.org/debian-security/
MIRRORSECURITY_lenny=http://archive.debian.org/debian-security/
MIRRORSECURITY_squeeze=http://httpredir.debian.org/debian-security/
MIRRORSECURITY_wheezy=http://httpredir.debian.org/debian-security/
MIRRORSECURITY_jessie=http://httpredir.debian.org/debian-security/
MIRRORSECURITY_stretch=http://httpredir.debian.org/debian-security/
MIRRORSECURITY_sid=NO
MIRRORSECURITY_debian_LTS=http://httpredir.debian.org/debian/
MIRRORBACKPORTS_sarge=http://archive.debian.org/debian-backports/
MIRRORBACKPORTS_etch=http://archive.debian.org/debian-backports/
MIRRORBACKPORTS_lenny=http://archive.debian.org/debian-backports/
MIRRORBACKPORTS_squeeze=http://httpredir.debian.org/debian-backports/
MIRRORBACKPORTS_wheezy=http://httpredir.debian.org/debian/
MIRRORBACKPORTS_jessie=http://httpredir.debian.org/debian/
MIRRORBACKPORTSLOPPY_lenny=http://archive.debian.org/debian-backports/
MIRRORBACKPORTSLOPPY_squeeze=http://httpredir.debian.org/debian-backports/
MIRRORBACKPORTSLOPPY_wheezy=http://httpredir.debian.org/debian/

COMPONENTS_debian=main
COMPONENTS_dpo=main
COMPONENTS_ubuntu='main universe'

# to have a different shell prompt inside the chroot
export debian_chroot="pbuild$$"

# check $DIST for architecture
case $DIST in
*/*)
	build_ARCHITECTURE=$(dpkg --print-architecture)
	host_ARCHITECTURE=$(dpkg-architecture -qDEB_HOST_ARCH \
	    -t$(uname -m)-linux-gnu 2>/dev/null)
	ARCHITECTURE=${DIST##*/}
	tgt_ARCHITECTURE=${ARCHITECTURE/x32/amd64}
	DIST=${DIST%/*}
	if test x"$ARCHITECTURE" = x"$(dpkg-architecture -qDEB_HOST_ARCH \
	    -a"$ARCHITECTURE" 2>/dev/null)"; then
		: $ARCHITECTURE is a valid Debian architecture
	else
		echo >&2 "E: Unknown Debian architecture: '$ARCHITECTURE'"
		setuptofail
		return
	fi
	if test x"$tgt_ARCHITECTURE" = x"$host_ARCHITECTURE"; then
		: uname values match
	else
		echo >&2 "E: Want $tgt_ARCHITECTURE but got $host_ARCHITECTURE"
		echo >&2 "W: Did you forget to prepend linux32 or linux64" \
		    "to cowbuilder?"
		setuptofail
		return
	fi
	if test x"$ARCHITECTURE" = x"$build_ARCHITECTURE"; then
		ARCHSUFFIX=
	else
		ARCHSUFFIX=-$ARCHITECTURE
	fi
	;;
*)
	ARCHITECTURE=$(dpkg --print-architecture)
	ARCHSUFFIX=
	;;
esac

# check $DIST for validity and load settings
export DISTRIBUTION=${DIST%%-*}
distfound=0
for distro in $DISTROS; do
	eval dists=\$DISTS_$distro
	for dist in $dists; do
		test x"$DISTRIBUTION" = x"$dist" || continue
		distfound=1
		DISTRO=$distro
		case $DIST in
		($dist)
			isbackports=no
			;;
		($dist-backports)
			case $distro in
			(debian)
				case :$DISTBACKPORTS_debian: in
				(*:$DISTRIBUTION:*)
					isbackports=yes
					;;
				(*)
					distfound=0
					unset DISTRO
					;;
				esac
				;;
			(ubuntu)
				case :$DISTBACKPORTUPDATE_ubuntu: in
				(*:$DISTRIBUTION:*)
					isbackports=ubuntu
					;;
				(*)
					distfound=0
					unset DISTRO
					;;
				esac
				;;
			(*)
				distfound=0
				unset DISTRO
				;;
			esac
			;;
		($dist-backports-sloppy)
			eval x=\$DISTBACKPORTSLOPPY_$distro
			case :$x: in
			(*:$DISTRIBUTION:*)
				isbackports=sloppy
				;;
			(*)
				distfound=0
				unset DISTRO
				;;
			esac
			;;
		(*)
			distfound=0
			unset DISTRO
			;;
		esac
		break
	done
	test $distfound = 0 || break
done
if test $distfound = 0; then
	echo >&2 "E: Unknown distribution/suite \$DIST: '$DIST'"
	setuptofail
	return
fi

case $DISTRO in
(debian|dpo) export APTCACHE=/var/cache/pbuilder/aptcache-debian/ ;;
(*) export APTCACHE=/var/cache/pbuilder/aptcache-$DISTRO/ ;;
esac
export APTCACHEHARDLINK=yes
export ARCHITECTURE ARCH=$ARCHITECTURE
export AUTO_DEBSIGN=no
export BUILDDIR=/tmp/buildd
export BUILDPLACE=/var/cache/pbuilder/build/
export BUILDRESULT=/var/cache/pbuilder/result-$DIST/
# absolutely never use ccache with pbuilder, it is positively unsafe
export CCACHEDIR=""	# requirement to empty it here!
export BASEPATH=/var/cache/pbuilder/base.cow-$DIST$ARCHSUFFIX${CUSTOM:+-$CUSTOM}/
test -d "$BASEPATH/." || if test -z "$ARCHSUFFIX"; then
	ARCHSUFFIX=-$ARCHITECTURE
	BASEPATH=/var/cache/pbuilder/base.cow-$DIST$ARCHSUFFIX${CUSTOM:+-$CUSTOM}/
fi
export BUILDSOURCEROOTCMD=fakeroot
eval COMPONENTS=\$COMPONENTS_$DISTRO; export COMPONENTS
case $DISTRIBUTION in
(sarge|etch)
	export DEBIAN_ETCH_WORKAROUND=1
	;;
esac
export DEBOOTSTRAP=debootstrap
# add emile, elilo, etc. for n?n-x86 arches
REMOVEPACKAGES='grub grub2 grub-pc grub-legacy lilo tasksel tasksel-data'
case $DISTRO in
(debian)
	x=cowdancer,apt,debian-archive-keyring
	case $DIST:$DISTRIBUTION in
	(*:sarge)
		x=apt
		EXTRAPACKAGES='apt fakeroot'
		;;
	(*:etch|*:lenny|squeeze:*)
		EXTRAPACKAGES='apt debian-archive-keyring fakeroot'
		;;
	(*:squeeze|*:wheezy)
		EXTRAPACKAGES='apt debian-archive-keyring eatmydata fakeroot'
		;;
	(*)
		EXTRAPACKAGES='apt debian-archive-keyring eatmydata fakeroot sysvinit-core'
		;;
	esac
	case $DIST in
	(etch-backports|lenny-backports|lenny-backports-sloppy)
		EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
		;;
	esac
	case $DISTRIBUTION in
	(sarge|etch)
		keyringfile=debian-archive-removed-keys
		;;
	(*)
		keyringfile=debian-archive-keyring
		;;
	esac
	DEBOOTSTRAPOPTS=(
		--arch=$ARCHITECTURE
		--include=$x
		--exclude=ubuntu-keyring
		--components=${COMPONENTS// /,}
		--variant=buildd
		--keyring=/usr/share/keyrings/${keyringfile}.gpg
	)
	case $DISTRIBUTION in
	(sarge)
		REMOVEPACKAGES="$REMOVEPACKAGES insserv"
		;;
	(etch|lenny|squeeze)
		EXTRAPACKAGES="$EXTRAPACKAGES insserv-"
		;;
	esac
	;;
(dpo)
	DISTRIBUTION=unstable
	# Note: debootstrap cannot include packages from unreleased, so this
	# fails if the architecture is not bootstrappable without unreleased
	# (use multistrap or a custom repository then; adjust dist above)
	EXTRAPACKAGES='apt debian-ports-archive-keyring eatmydata fakeroot'
	DEBOOTSTRAPOPTS=(
		--arch=$ARCHITECTURE
		--include=cowdancer,apt,debian-ports-archive-keyring
		--exclude=ubuntu-keyring
		--components=${COMPONENTS// /,}
		--variant=buildd
		--keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg
	)
	;;
(ubuntu)
	case $DIST:$DISTRIBUTION in
	(*:dapper|*:hardy|*:jaunty|*:karmic|*:lucid|maverick:*)
		EXTRAPACKAGES='apt ubuntu-keyring fakeroot'
		;;
	(*)
		EXTRAPACKAGES='apt ubuntu-keyring eatmydata fakeroot'
		;;
	esac
	DEBOOTSTRAPOPTS=(
		--arch=$ARCHITECTURE
		--include=cowdancer,pbuilder,apt,ubuntu-keyring
		--exclude=debian-archive-keyring
		--components=${COMPONENTS// /,}
		--variant=buildd
		--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg
	)
	;;
(*)
	echo >&2 "E: Internal error, unknown distro \$DISTRO: '$DISTRO'"
	setuptofail
	return
	;;
esac
export DEBOOTSTRAPOPTS EXTRAPACKAGES REMOVEPACKAGES
export DEBIAN_FRONTEND=noninteractive
eval MIRRORSITE=\$MIRROR_$DISTRIBUTION; export MIRRORSITE
eval x=\$MIRRORSECURITY_$DISTRIBUTION
case x$x:$DISTRO in
(*:ubuntu)
	: security is same as normal mirrors
	OTHERMIRROR="deb $MIRRORSITE $DISTRIBUTION-security $COMPONENTS"
	;;
(*:dpo)
	: always add unreleased
	OTHERMIRROR="deb $MIRROR_unreleased unreleased $COMPONENTS"
	: debian-ports has no security support
	;;
(xNO:*)
	: Debian unstable, for example, has no security support
	;;
(x:*)
	: No mirror set, possibly dangerous oversight
	echo >&2 "E: Internal error, distro '$DISTRO' has no security mirror"
	setuptofail
	return
	;;
(*:debian)
	OTHERMIRROR="deb $x $DISTRIBUTION/updates $COMPONENTS"
	case :$DISTLTS_debian: in
	(*:$DISTRIBUTION:*)
		OTHERMIRROR="$OTHERMIRROR|deb $MIRRORSECURITY_debian_LTS $DISTRIBUTION-lts $COMPONENTS"
		;;
	esac
	;;
esac
case $isbackports:$DIST in
(yes:*|no:sarge)
	eval x=\$MIRRORBACKPORTS_$DISTRIBUTION
	if test x"$x" = x""; then
		echo >&2 "E: Internal error, $DISTRIBUTION-backports mirror not set"
		setuptofail
		return
	fi
	OTHERMIRROR="$OTHERMIRROR|deb $x $DISTRIBUTION-backports $COMPONENTS"
	;;
(no:*)
	;;
(sloppy:*)
	eval x=\$MIRRORBACKPORTS_$DISTRIBUTION
	if test x"$x" = x""; then
		echo >&2 "E: Internal error, $DISTRIBUTION-backports mirror not set"
		setuptofail
		return
	fi
	OTHERMIRROR="$OTHERMIRROR|deb $x $DISTRIBUTION-backports $COMPONENTS"
	eval x=\$MIRRORBACKPORTSLOPPY_$DISTRIBUTION
	if test x"$x" = x""; then
		echo >&2 "E: Internal error, $DISTRIBUTION-backports-sloppy mirror not set"
		setuptofail
		return
	fi
	OTHERMIRROR="$OTHERMIRROR|deb $x $DISTRIBUTION-backports-sloppy $COMPONENTS"
	;;
(ubuntu:*)
	OTHERMIRROR="$OTHERMIRROR|deb $MIRRORSITE $DISTRIBUTION-updates $COMPONENTS"
	OTHERMIRROR="$OTHERMIRROR|deb $MIRRORSITE $DISTRIBUTION-backports $COMPONENTS"
	;;
(*)
	echo >&2 "E: Internal error, \$isbackports '$isbackports' unknown"
	setuptofail
	return
	;;
esac
export OTHERMIRROR
export PDEBUILD_PBUILDER=cowbuilder
export PKGNAME_LOGFILE_EXTENTION=_${ARCHITECTURE}.build
export PKGNAME_LOGFILE_EXTENSION=$PKGNAME_LOGFILE_EXTENTION
export PKGNAME_LOGFILE=yes
export PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends
#export PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-experimental
#export PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-aptitude
#export PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-classic
case $isbackports:$DISTRIBUTION in
(*:sarge|no:etch)
	PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-classic
	;;
(yes:etch|yes:lenny)
	PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-experimental
	;;
(*:sloppy)
	PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-experimental
	;;
esac
PBUILDERSATISFYDEPENDSOPT=(--check-key)
APTGETOPT=(-oAPT::Get::Purge=true)
export USEDEVFS=no
export USEDEVPTS=yes
export USEPROC=yes
unset ADDITIONAL_BUILDRESULTS

case $DISTRIBUTION in
(sarge|etch|lenny|squeeze|dapper|hardy|jaunty|karmic|lucid|maverick|natty)
	EXTRAPACKAGES="$EXTRAPACKAGES debconf-english"
	;;
(*)
	REMOVEPACKAGES="$REMOVEPACKAGES debconf-i18n"
	;;
esac

unset LANG LANGUAGE LC_ADDRESS LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
    LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
    LC_TELEPHONE LC_TIME
export LC_ALL=C


More information about the Pbuilder-maint mailing list