Understand Debian distribution synonyms, and store the chroot under the

code name.
This commit is contained in:
Stefano Rivera 2011-04-24 20:36:27 +02:00
parent dceda81ff2
commit 7212902eb8
2 changed files with 49 additions and 14 deletions

6
debian/changelog vendored
View File

@ -1,4 +1,4 @@
ubuntu-dev-tools (0.123) UNRELEASED; urgency=low
ubuntu-dev-tools (0.124) UNRELEASED; urgency=low
* mk-sbuild:
- Disable daemons with a policy-rc.d script (like pbuilder does)
@ -9,8 +9,10 @@ ubuntu-dev-tools (0.123) UNRELEASED; urgency=low
- Install qemu-user-static instead of qemu-kvm-extras-static.
- Correctly substitute release into security suite name.
- Put schroot configuration in chroot.d/sbuild-$chroot (LP: #736808)
- Understand Debian distribution synonyms, and store the chroot under the
code name.
-- Stefano Rivera <stefanor@debian.org> Sun, 24 Apr 2011 12:45:31 +0200
-- Stefano Rivera <stefanor@debian.org> Sun, 24 Apr 2011 20:35:51 +0200
ubuntu-dev-tools (0.122) unstable; urgency=low

View File

@ -226,24 +226,48 @@ if [ -z "$RELEASE" ]; then
usage
fi
# Determine distribution
if [ -z "$DISTRO" ]; then
if debian-distro-info --all | grep -Fqx "$RELEASE"; then
DISTRO=debian
elif ubuntu-distro-info --all | grep -Fqx "$RELEASE"; then
DISTRO=ubuntu
elif [ "$RELEASE" = "unstable" -o "$RELEASE" = "testing" \
-o "$RELEASE" = "stable" -o "$RELEASE" = "oldstable" ]; then
DISTRO=debian
else
echo "Unable to determine distribution, please provide --distro" >&2
exit 1
# Determine distribution and possible synonyms
synonym=""
if debian-distro-info --all | grep -Fqx "$RELEASE"; then
DISTRO="${DISTRO:-debian}"
if [ "$RELEASE" = $(debian-distro-info --devel) ]; then
synonym=unstable
elif [ "$RELEASE" = $(debian-distro-info --testing) ]; then
synonym=testing
elif [ "$RELEASE" = $(debian-distro-info --stable) ]; then
synonym=stable
elif [ "$RELEASE" = $(debian-distro-info --old) ]; then
synonym=oldstable
fi
elif ubuntu-distro-info --all | grep -Fqx "$RELEASE"; then
DISTRO="${DISTRO:-ubuntu}"
elif [ "$RELEASE" = "unstable" ]; then
DISTRO="${DISTRO:-debian}"
synonym="$RELEASE"
RELEASE=$(debian-distro-info --devel)
elif [ "$RELEASE" = "testing" ]; then
DISTRO="${DISTRO:-debian}"
synonym="$RELEASE"
RELEASE=$(debian-distro-info --testing)
elif [ "$RELEASE" = "stable" ]; then
DISTRO="${DISTRO:-debian}"
synonym="$RELEASE"
RELEASE=$(debian-distro-info --stable)
elif [ "$RELEASE" = "oldstable" ]; then
DISTRO="${DISTRO:-debian}"
synonym="$RELEASE"
RELEASE=$(debian-distro-info --old)
elif [ -z "$DISTRO" ]; then
echo "Unable to determine distribution, please provide --distro" >&2
exit 1
fi
# By default, name the schroot the same as the release
if [ -z "$name" ]; then
name="$RELEASE"
else
# Disable synonym when a custom name is used:
synonym=""
fi
# By default, use the native architecture.
@ -254,6 +278,12 @@ fi
CHROOT_NAME="${name}-${CHROOT_ARCH}"
if [ -z "$synonym" ]; then
CHROOT_SYNONYM=""
else
CHROOT_SYNONYM="${synonym}-${CHROOT_ARCH}"
fi
# Load customizations
if [ -r ~/.mk-sbuild.rc ]; then
. ~/.mk-sbuild.rc
@ -548,6 +578,9 @@ fi
if [ ! -z "$personality" ]; then
echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
fi
if [ ! -z "$CHROOT_SYNONYM" ]; then
echo "aliases=$CHROOT_SYNONYM" >> "$TEMP_SCHROOTCONF"
fi
if [ ! -z "$SCHROOT_CONF_SUFFIX" ]; then
echo "$SCHROOT_CONF_SUFFIX" >> "$TEMP_SCHROOTCONF"
fi