Merge with trunk.

This commit is contained in:
Michael Bienia 2010-02-16 14:06:32 +01:00
commit 4da9387f3d
8 changed files with 251 additions and 80 deletions

33
debian/changelog vendored
View File

@ -1,4 +1,34 @@
ubuntu-dev-tools (0.92) UNRELEASED; urgency=low ubuntu-dev-tools (0.93) UNRELEASED; urgency=low
[ Scott Moser ]
* rename mk-sbuild-lv to mk-sbuild, support union-type=aufs
[ Emmet Hikory ]
* Support qemu-arm-static -> qemu-kvm-extras-static transition
* mk-sbuild: automatically install qemu-kvm-extras-static if requested
* mk-sbuild: conditionally install lvm2 only for lvm-snapshot schroots
* mk-sbuild: rationalise architecture variables
* mk-sbuild: Generalise --type support and add "file" SCHROOT_TYPE
* mk-sbuild.1: Document the --type argument
[ Loïc Minier ]
* Demote qemu-kvm-extras-static to a Suggests since most people don't build
for armel.
[ Kees Cook ]
* requestsync: add -C to allow manually adding changelog when missing
(LP: #518574).
* mk-sbuild: clean up and make slight adjustments to new lvm/dir/file logic.
* mk-sbuild.1: update documentation to reflect alternative config file
names for distro and schroot type overrides.
[ Michael Bienia ]
* ubuntutools/requestsync/mail.py: Encode the report to utf-8 before passing
it to gpg for signing (lp: #522316).
-- Michael Bienia <geser@ubuntu.com> Mon, 15 Feb 2010 22:37:59 +0100
ubuntu-dev-tools (0.92) lucid; urgency=low
[ Siegfried-Angel Gevatter Pujals ] [ Siegfried-Angel Gevatter Pujals ]
* bash_completion/pbuilder-dist: * bash_completion/pbuilder-dist:
@ -9,6 +39,7 @@ ubuntu-dev-tools (0.92) UNRELEASED; urgency=low
* mk-sbuild-lv: use --arch=foo rather than --arch foo for debootstrap * mk-sbuild-lv: use --arch=foo rather than --arch foo for debootstrap
* pbuilder-dist: Allow architecture-switching to armel on i386/amd64 * pbuilder-dist: Allow architecture-switching to armel on i386/amd64
* pbuilder-dist: use --arch=foo rather than --arch foo for debootstrap * pbuilder-dist: use --arch=foo rather than --arch foo for debootstrap
* pbuilder-dist: change --mirror logic to use -ports when appropriate
* docs/pbuilder-dist.1: Document architecture-switching for armel * docs/pbuilder-dist.1: Document architecture-switching for armel
* debian/control: add qemu-arm-static to Recommends: * debian/control: add qemu-arm-static to Recommends:

3
debian/control vendored
View File

@ -17,8 +17,9 @@ Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo,
dpkg-dev, python-apt (>= 0.7.9), python-lazr.restfulclient dpkg-dev, python-apt (>= 0.7.9), python-lazr.restfulclient
Recommends: bzr, pbuilder | cowdancer | sbuild, reportbug (>= 3.39ubuntu1), Recommends: bzr, pbuilder | cowdancer | sbuild, reportbug (>= 3.39ubuntu1),
ca-certificates, debootstrap, genisoimage, perl-modules, libwww-perl, ca-certificates, debootstrap, genisoimage, perl-modules, libwww-perl,
libapt-pkg-perl, qemu-arm-static libapt-pkg-perl
Conflicts: devscripts (<< 2.10.7ubuntu5) Conflicts: devscripts (<< 2.10.7ubuntu5)
Suggests: qemu-kvm-extras-static
Replaces: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5)
Description: useful tools for Ubuntu developers Description: useful tools for Ubuntu developers
This is a collection of useful tools that Ubuntu developers use to make their This is a collection of useful tools that Ubuntu developers use to make their

View File

@ -1,18 +1,18 @@
.TH MK\-SBUILD\-LV "1" "27 August 2008" "ubuntu-dev-tools" .TH MK\-SBUILD "1" "09 February 2010" "ubuntu-dev-tools"
.SH NAME .SH NAME
mk\-sbuild\-lv \- creates LVM snapshot chroots via schroot and sbuild mk\-sbuild \- creates chroots via schroot and sbuild
.SH SYNOPSIS .SH SYNOPSIS
\fBmk\-sbuild\-lv\fR [\fB\-\-arch=ARCH\fR] [\fB\-\-name=NAME\fR] \fBmk\-sbuild\fR [\fB\-\-arch=ARCH\fR] [\fB\-\-name=NAME\fR]
[\fB\-\-personality=PERSONALITY\fR] [\fB\-\-debug\fR] [\fB\-\-source\-template=FILE\fR] [\fB\-\-personality=PERSONALITY\fR] [\fB\-\-debug\fR] [\fB\-\-source\-template=FILE\fR]
[\fB\-\-debootstrap\-mirror=URL\fR] <\fBVG\fR> <\fBRelease\fR> [\fB\-\-debootstrap\-mirror=URL\fR] <\fBRelease\fR>
.SH DESCRIPTION .SH DESCRIPTION
\fBmk\-sbuild\-lv\fR creates LVM snapshot chroots via schroot and sbuild. \fBmk\-sbuild\fR creates chroots via schroot and sbuild.
.SH OPTIONS .SH OPTIONS
Listed below are the command line options for mk\-sbuild\-lv: Listed below are the command line options for mk\-sbuild:
.TP .TP
.B \-\-arch=ARCH .B \-\-arch=ARCH
What architecture to select (defaults to the native architecture). What architecture to select (defaults to the native architecture).
@ -30,7 +30,7 @@ Turn on script debugging.
Do not include the \-updates pocket in the installed sources.list. Do not include the \-updates pocket in the installed sources.list.
.TP .TP
.B \-\-source\-template=FILE .B \-\-source\-template=FILE
Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild\-lv.sources). Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild.sources).
.TP .TP
.B \-\-debootstrap\-mirror=URL .B \-\-debootstrap\-mirror=URL
Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia, Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia,
@ -39,6 +39,14 @@ official Ubuntu repositories for the supported architectures).
.B \-\-distro .B \-\-distro
Enable distro-specific logic. Currently known distros: "ubuntu" (default) Enable distro-specific logic. Currently known distros: "ubuntu" (default)
and "debian". and "debian".
.TP
.B \-\-vg
Specify a volume group, and subsequently use a default SCHROOT_TYPE of
"lvm-snapshot" rather than "directory" (via aufs) mounts.
.TP
.B \-\-type
Specify a SCHROOT_TYPE. Supported values are "directory" (default if
\-\-vg not specified), "lvm-snapshot" (default if \-\-vg specified), and "file".
.SH ENVIRONMENT VARIABLES .SH ENVIRONMENT VARIABLES
.TP .TP
@ -53,24 +61,36 @@ Lines to append to schroot entries.
.TP .TP
.B SKIP_UPDATES .B SKIP_UPDATES
Do not include the \-updates pocket in the installed sources.list. Do not include the \-updates pocket in the installed sources.list.
.TP
.B SOURCE_CHROOTS_DIR
use SOURCE_CHROOTS_DIR as home of schroot source directories. (default
/var/lib/schroot/chroots)
.TP
.B SOURCE_CHROOTS_TGZ
use SOURCE_CHROOTS_TGZ as home of schroot source tarballs. (default
/var/lib/schroot/tarballs)
.SH FILES .SH FILES
.TP .TP
.B $HOME/.mk\-sbuild\-lv.rc .B $HOME/.mk\-sbuild.rc
Sourced for environment variables (defined above). Sourced for environment variables (defined above).
.TP .TP
.B $HOME/.mk\-sbuild\-lv.sources .B $HOME/.mk\-sbuild.sources[.$DISTRO]
Can contain a customized sources.list. Can contain a customized sources.list.
It will be read when creating the schroot. It will be read when creating the schroot.
If a file with ".ubuntu" or ".debian" is found (based on the \-\-distro
argument) that file will use used instead.
See sources.list(5) for more details on the format. See sources.list(5) for more details on the format.
.TP .TP
.B $HOME/.mk\-sbuild\-lv.schroot.conf .B $HOME/.mk\-sbuild.schroot.conf[.$SCHROOT_TYPE]
Can contain a customized configuration section to be inserted into Can contain a customized configuration section to be inserted into
/etc/schroot/schroot.conf. /etc/schroot/schroot.conf.
If a file with ".lvm-snapshot", ".directory", or ".file" is found (based on the
values of the \-\-vg and \-\-type arguments) that file will use used instead.
See schroot.conf(5) for more details on the format. See schroot.conf(5) for more details on the format.
.SH USING THE CHROOTS .SH USING THE CHROOTS
.TP .TP
To CHANGE the golden image: \fBschroot \-c ${CHROOT_NAME}\-source \-u root\fR To CHANGE the golden image: \fBsudo schroot \-c ${CHROOT_NAME}\-source \-u root\fR
.TP .TP
To ENTER an image snapshot: \fBschroot \-c ${CHROOT_NAME}\fR To ENTER an image snapshot: \fBschroot \-c ${CHROOT_NAME}\fR
.TP .TP
@ -83,6 +103,6 @@ sbuild\-setup (7), sources.list (5), schroot.conf (5),
https://help.ubuntu.com/community/SbuildLVMHowto https://help.ubuntu.com/community/SbuildLVMHowto
.SH AUTHOR .SH AUTHOR
\fBmk\-sbuild\-lv\fR was written by Kees Cook <kees@ubuntu.com>. \fBmk\-sbuild\fR was written by Kees Cook <kees@ubuntu.com>.
This man page was written by Ryan Kavanagh <ryanakca@kubuntu.org>. This man page was written by Ryan Kavanagh <ryanakca@kubuntu.org>.
Both are released under the GNU General Public License, version 3 or later. Both are released under the GNU General Public License, version 3 or later.

View File

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
# #
# Copyright 2006-2009 (C) Canonical Ltd. # Copyright 2006-2010 (C) Canonical Ltd.
# Author: Kees Cook <kees@ubuntu.com> # Authors:
# Kees Cook <kees@ubuntu.com>
# Emmet Hikory <persia@ubuntu.com>
# Scott Moser <smoser@ubuntu.com>
# #
# ################################################################## # ##################################################################
# #
@ -19,7 +22,8 @@
# #
# ################################################################## # ##################################################################
# #
# This script creates LVM snapshot chroots via schroot and sbuild. # This script creates chroots designed to be used in a snapshot mode
# (either with LVM or aufs) with schroot and sbuild.
# Much love to "man sbuild-setup", https://wiki.ubuntu.com/PbuilderHowto, # Much love to "man sbuild-setup", https://wiki.ubuntu.com/PbuilderHowto,
# and https://help.ubuntu.com/community/SbuildLVMHowto. # and https://help.ubuntu.com/community/SbuildLVMHowto.
# #
@ -36,15 +40,10 @@ if [ -w /etc/passwd ]; then
exit 1 exit 1
fi fi
# Perform once-only things to initially set up for using sbuild+schroot+lvm # Perform once-only things to initially set up for using sbuild+schroot
if [ ! -w /var/lib/sbuild ]; then if [ ! -w /var/lib/sbuild ]; then
# Load all the packages you'll need to do work # Load all the packages you'll need to do work
sudo apt-get install sbuild schroot debootstrap lvm2 sudo apt-get install sbuild schroot debootstrap
# Make sure LVM tools that operate on the snapshots have needed module
if ! sudo dmsetup targets | grep -q ^snapshot; then
sudo modprobe dm_snapshot
echo dm_snapshot | sudo tee -a /etc/modules >/dev/null
fi
# Add self to the sbuild group # Add self to the sbuild group
sudo adduser "$USER" sbuild sudo adduser "$USER" sbuild
@ -98,23 +97,32 @@ fi
# Set up configurable defaults (loaded after option processing) # Set up configurable defaults (loaded after option processing)
LV_SIZE="5G" LV_SIZE="5G"
SNAPSHOT_SIZE="4G" SNAPSHOT_SIZE="4G"
SOURCE_CHROOTS_DIR="/var/lib/schroot/chroots"
SOURCE_CHROOTS_TGZ="/var/lib/schroot/tarballs"
function usage() function usage()
{ {
echo "Usage: $0 [OPTIONS] VG Release" >&2 echo "Usage: $0 [OPTIONS] Release" >&2
echo "Options:" echo "Options:"
echo " --arch=ARCH What architecture to select" echo " --arch=ARCH What architecture to select"
echo " --name=NAME Base name for the schroot (arch is appended)" echo " --name=NAME Base name for the schroot (arch is appended)"
echo " --personality=PERSONALITY What personality to use (defaults to match --arch)" echo " --personality=PERSONALITY What personality to use (defaults to match --arch)"
echo " --vg=VG use LVM snapshots, with group VG"
echo " --debug Turn on script debugging" echo " --debug Turn on script debugging"
echo " --skip-updates Do not include -updates pocket in sources.list" echo " --skip-updates Do not include -updates pocket in sources.list"
echo " --source-template=FILE Use FILE as the sources.list template" echo " --source-template=FILE Use FILE as the sources.list template"
echo " --debootstrap-mirror=URL Use URL as the debootstrap source" echo " --debootstrap-mirror=URL Use URL as the debootstrap source"
echo " --distro=DISTRO Install specific distro (defaults to 'ubuntu')" echo " --distro=DISTRO Install specific distro:"
echo " 'ubuntu'(default), or 'debian'"
echo " --type=SCHROOT_TYPE Define the schroot type:"
echo " 'directory'(default), or 'file'"
echo " 'lvm-snapshot' is selected via --vg"
echo "" echo ""
echo "Configuration (via ~/.mk-sbuild-lv.rc)" echo "Configuration (via ~/.mk-sbuild.rc)"
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})" echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})" echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})"
echo " SOURCE_CHROOTS_DIR Directory to store directory source chroots"
echo " SOURCE_CHROOTS_TGZ Directory to store file source chroots"
echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries" echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries"
echo " SKIP_UPDATES Enable --skip-updates" echo " SKIP_UPDATES Enable --skip-updates"
echo " TEMPLATE_SOURCES A template for sources.list" echo " TEMPLATE_SOURCES A template for sources.list"
@ -126,9 +134,10 @@ function usage()
if [ -z "$1" ]; then if [ -z "$1" ]; then
usage usage
fi fi
OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:,distro:" -- "$@"` OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:,distro:,vg:,type:" -- "$@"`
eval set -- "$OPTS" eval set -- "$OPTS"
VG=""
DISTRO="ubuntu" DISTRO="ubuntu"
name="" name=""
while :; do while :; do
@ -138,9 +147,6 @@ while :; do
shift shift
;; ;;
--arch) --arch)
# By default, use the native architecture.
arch_opt="--arch=$2"
arch_suffix="-$2"
CHROOT_ARCH="$2" CHROOT_ARCH="$2"
if [ "$2" = "i386" ] || [ "$2" = "lpia" ] && [ -z "$personality" ]; if [ "$2" = "i386" ] || [ "$2" = "lpia" ] && [ -z "$personality" ];
then then
@ -176,6 +182,14 @@ while :; do
DISTRO="$2" DISTRO="$2"
shift 2 shift 2
;; ;;
--vg)
VG="$2"
shift 2
;;
--type)
SCHROOT_TYPE="$2"
shift 2
;;
--) --)
shift shift
break break
@ -186,11 +200,9 @@ while :; do
esac esac
done done
# To build the LV, we need to know which volume group to use, and which # To build the chroot, we need to know which release of Ubuntu to debootstrap
# release of Ubuntu to debootstrap RELEASE="$1"
VG="$1" if [ -z "$RELEASE" ]; then
RELEASE="$2"
if [ -z "$VG" ] || [ -z "$RELEASE" ]; then
usage usage
fi fi
@ -199,32 +211,76 @@ if [ -z "$name" ]; then
name="$RELEASE" name="$RELEASE"
fi fi
# Set up some variables for use in the paths and names # By default, use the native architecture.
CHROOT_LV="${name}_chroot${arch_suffix}"
CHROOT_PATH="/dev/$VG/$CHROOT_LV"
CHROOT_NAME="${name}${arch_suffix}"
HOST_ARCH=$(dpkg --print-architecture) HOST_ARCH=$(dpkg --print-architecture)
if [ -z "$CHROOT_ARCH" ]; then if [ -z "$CHROOT_ARCH" ]; then
CHROOT_ARCH=$HOST_ARCH CHROOT_ARCH="$HOST_ARCH"
fi fi
CHROOT_NAME="${name}-${CHROOT_ARCH}"
# Load customizations # Load customizations
if [ -r ~/.mk-sbuild-lv.rc ]; then if [ -r ~/.mk-sbuild.rc ]; then
. ~/.mk-sbuild-lv.rc . ~/.mk-sbuild.rc
fi fi
# Does the specified VG exist? (vgdisplay doesn't set error codes...) if [ -z "$SCHROOT_TYPE" ]; then
if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then # To build the LV, we need to know which volume group to use
exit 1 if [ -n "$VG" ]; then
SCHROOT_TYPE="lvm-snapshot"
else
SCHROOT_TYPE="directory"
fi
fi fi
case "$SCHROOT_TYPE" in
"lvm-snapshot")
# Make sure LVM tools that operate on the snapshots have needed module
if ! sudo dmsetup targets | grep -q ^snapshot; then
sudo modprobe dm_snapshot
echo dm_snapshot | sudo tee -a /etc/modules >/dev/null
fi
# Set up some variables for use in the paths and names
CHROOT_LV="${name}_${CHROOT_ARCH}_chroot"
CHROOT_PATH="/dev/$VG/$CHROOT_LV"
# Install lvm2 if missing
if ! dpkg -l lvm2 >/dev/null 2>&1; then
sudo apt-get install lvm2
fi
# Does the specified VG exist? (vgdisplay doesn't set error codes...)
if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then
echo "Volume group '${VG}' does not appear to exist" >&2
exit 1
fi
;;
"directory")
if [ ! -d "${SOURCE_CHROOTS_DIR}" ]; then
sudo mkdir -p "${SOURCE_CHROOTS_DIR}"
fi
# Set up some variables for use in the paths and names
CHROOT_PATH="${SOURCE_CHROOTS_DIR}/${CHROOT_NAME}"
;;
"file")
if [ ! -d "$SOURCE_CHROOTS_TGZ" ]; then
sudo mkdir -p "$SOURCE_CHROOTS_TGZ"
fi
# Set up some variables for use in the paths and names
CHROOT_PATH="${SOURCE_CHROOTS_TGZ}/${CHROOT_NAME}.tgz"
;;
*)
echo 'unknown source type!?' >&2
exit 1
;;
esac
# Is the specified release known to debootstrap? # Is the specified release known to debootstrap?
variant_opt="--variant=buildd"
if [ ! -r "/usr/share/debootstrap/scripts/$RELEASE" ]; then if [ ! -r "/usr/share/debootstrap/scripts/$RELEASE" ]; then
echo "Specified release not known to debootstrap" >&2 echo "Specified release not known to debootstrap" >&2
exit 1 exit 1
else
variant_opt="--variant=buildd"
fi fi
BUILD_PKGS="build-essential fakeroot devscripts apt-utils" BUILD_PKGS="build-essential fakeroot devscripts apt-utils"
@ -305,30 +361,44 @@ debian)
;; ;;
esac esac
# Allocate the "golden" chroot LV
sudo lvcreate -n "$CHROOT_LV" -L "$LV_SIZE" "$VG"
sudo mkfs -t ext4 "$CHROOT_PATH"
# Mount and debootstrap the chroot
MNT=`mktemp -d -t schroot-XXXXXX`
sudo mount "$CHROOT_PATH" "$MNT"
DEBOOTSTRAP_COMMAND=debootstrap DEBOOTSTRAP_COMMAND=debootstrap
# Use qemu-arm-static / build-arm-chroot for foreign armel chroots # Use qemu-kvm-extras-static / build-arm-chroot for foreign armel chroots
if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then
if [ -f "/usr/bin/build-arm-chroot" ]; then if [ ! -f "/usr/bin/build-arm-chroot" ]; then
DEBOOTSTRAP_COMMAND=build-arm-chroot sudo apt-get install qemu-kvm-extras-static
else
echo Please install qemu-arm-static to use foreign armel chroots
fi fi
DEBOOTSTRAP_COMMAND=build-arm-chroot
fi fi
sudo $DEBOOTSTRAP_COMMAND $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}" case "$SCHROOT_TYPE" in
"lvm-snapshot")
# Allocate the "golden" chroot LV
sudo lvcreate -n "$CHROOT_LV" -L "$LV_SIZE" "$VG"
sudo mkfs -t ext4 "$CHROOT_PATH"
# Mount
MNT=`mktemp -d -t schroot-XXXXXX`
sudo mount "$CHROOT_PATH" "$MNT"
;;
"directory")
MNT="${CHROOT_PATH}"
if [ -d "${MNT}" ]; then
echo "E: ${MNT} already exists; aborting" >&2
exit 1
fi
sudo mkdir -p "${MNT}"
;;
"file")
MNT=`mktemp -d -t schroot-XXXXXX`
esac
# debootstrap the chroot
sudo "$DEBOOTSTRAP_COMMAND" --arch="$CHROOT_ARCH" $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
# Update the package sources # Update the package sources
TEMP_SOURCES=`mktemp -t sources-XXXXXX` TEMP_SOURCES=`mktemp -t sources-XXXXXX`
if [ -z "$TEMPLATE_SOURCES" ]; then if [ -z "$TEMPLATE_SOURCES" ]; then
TEMPLATE_SOURCES=~/.mk-sbuild-lv.sources TEMPLATE_SOURCES=~/.mk-sbuild.sources
fi fi
if [ -r "$TEMPLATE_SOURCES" ]; then if [ -r "$TEMPLATE_SOURCES" ]; then
cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES" cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES"
@ -355,28 +425,47 @@ cat "$TEMP_SOURCES" | sed -e "s|RELEASE|$RELEASE|g" | \
rm -f "$TEMP_SOURCES" rm -f "$TEMP_SOURCES"
# Copy the timezone (comment this out if you want to leave the chroot at UTC) # Copy the timezone (comment this out if you want to leave the chroot at UTC)
sudo cp /etc/localtime /etc/timezone "$MNT"/etc/ sudo cp /etc/localtime /etc/timezone "$MNT"/etc/
# Create an LVM-snapshot-based schroot entry for this LV # Create a schroot entry for this chroot
TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX` TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX`
TEMPLATE_SCHROOTCONF=~/.mk-sbuild-lv.schroot.conf TEMPLATE_SCHROOTCONF=~/.mk-sbuild.schroot.conf
if [ -r "$TEMPLATE_SCHROOTCONF" ]; then TYPED_TEMPLATE_SCHROOTCONF="${TEMPLATE_SCHROOTCONF}.${SCHROOT_TYPE}"
if [ -r "${TYPED_TEMPLATE_SCHROOTCONF}" ]; then
cat "${TYPED_TEMPLATE_SCHROOTCONF}" > "$TEMP_SCHROOTCONF"
elif [ -r "${TEMPLATE_SCHROOT}" ]; then
cat "$TEMPLATE_SCHROOTCONF" > "$TEMP_SCHROOTCONF" cat "$TEMPLATE_SCHROOTCONF" > "$TEMP_SCHROOTCONF"
else else
cat > "$TEMP_SCHROOTCONF" <<EOM # Please do not remove the blank line above [CHROOT_NAME]
# it helps keep the schroot stanzas separated in the main
# /etc/schroot/schroot.conf file.
cat > "$TEMP_SCHROOTCONF" <<EOM
[CHROOT_NAME] [CHROOT_NAME]
type=lvm-snapshot
description=CHROOT_NAME description=CHROOT_NAME
priority=3 priority=3
groups=sbuild,root,admin groups=sbuild,root,admin
root-groups=root,sbuild,admin root-groups=root,sbuild,admin
device=CHROOT_PATH
mount-options=-o noatime
lvm-snapshot-options=--size SNAPSHOT_SIZE
# Uncomment these lines to allow "sbuild" and "admin" users to access # Uncomment these lines to allow "sbuild" and "admin" users to access
# the -source chroots directly (useful for automated updates, etc). # the -source chroots directly (useful for automated updates, etc).
#source-root-users=root,sbuild,admin #source-root-users=root,sbuild,admin
#source-root-groups=root,sbuild,admin #source-root-groups=root,sbuild,admin
type=SCHROOT_TYPE
EOM EOM
case "$SCHROOT_TYPE" in
"lvm-snapshot")
cat >> "$TEMP_SCHROOTCONF" <<EOM
device=CHROOT_PATH
mount-options=-o noatime
lvm-snapshot-options=--size SNAPSHOT_SIZE
EOM
;;
directory|file)
cat >> "${TEMP_SCHROOTCONF}" <<EOM
union-type=aufs
${SCHROOT_TYPE}=CHROOT_PATH
EOM
;;
esac
fi fi
if [ ! -z "$personality" ]; then if [ ! -z "$personality" ]; then
echo "personality=$personality" >> "$TEMP_SCHROOTCONF" echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
@ -388,6 +477,7 @@ cat "$TEMP_SCHROOTCONF" | sed \
-e "s|CHROOT_NAME|$CHROOT_NAME|g" \ -e "s|CHROOT_NAME|$CHROOT_NAME|g" \
-e "s|CHROOT_PATH|$CHROOT_PATH|g" \ -e "s|CHROOT_PATH|$CHROOT_PATH|g" \
-e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \ -e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \
-e "s|SCHROOT_TYPE|$SCHROOT_TYPE|g" \
| \ | \
sudo bash -c "cat >> /etc/schroot/schroot.conf" sudo bash -c "cat >> /etc/schroot/schroot.conf"
rm -f "$TEMP_SCHROOTCONF" rm -f "$TEMP_SCHROOTCONF"
@ -416,9 +506,23 @@ if [ ! -r /dev/stderr ]; then ln -s /proc/self/fd/2 /dev/stderr; fi
apt-get clean apt-get clean
rm /finish.sh rm /finish.sh
EOM EOM
sudo chmod +x "$MNT"/finish.sh sudo chmod a+x "$MNT"/finish.sh
sudo umount "$MNT"
rmdir "$MNT" case "$SCHROOT_TYPE" in
"lvm-snapshot")
sudo umount "$MNT"
rmdir "$MNT"
;;
"directory")
;;
"file")
cd "$MNT"
sudo tar czf "$CHROOT_PATH" .
cd /
sudo rm -r "$MNT"
;;
esac
# Run finalization script on the "golden" copy via schroot. # Run finalization script on the "golden" copy via schroot.
sudo schroot -c "$CHROOT_NAME"-source -u root /finish.sh sudo schroot -c "$CHROOT_NAME"-source -u root /finish.sh

View File

@ -219,7 +219,12 @@ class pbuilder_dist:
if self.extra_components: if self.extra_components:
components += ' contrib non-free' components += ' contrib non-free'
else: else:
arguments.append('--mirror "http://mirrors.kernel.org/ubuntu/"') if self.build_architecture in ('amd64','i386'):
arguments.append('--mirror "http://archive.ubuntu.com/ubuntu/"')
elif self.build_architecture == 'powerpc' and target_distro == 'dapper':
arguments.append('--mirror "http://archive.ubuntu.com/ubuntu/"')
else:
arguments.append('--mirror "http://ports.ubuntu.com/ubuntu-ports/"')
components = 'main restricted' components = 'main restricted'
if self.extra_components: if self.extra_components:
components += ' universe multiverse' components += ' universe multiverse'

View File

@ -61,6 +61,9 @@ if __name__ == '__main__':
optParser.add_option('-s', action = 'store_true', optParser.add_option('-s', action = 'store_true',
dest = 'sponsorship', default = False, dest = 'sponsorship', default = False,
help = 'Force sponsorship') help = 'Force sponsorship')
optParser.add_option('-C', action = 'store_true',
dest = 'missing_changelog_ok', default = False,
help = 'Allow changelog to be manually filled in when missing')
optParser.add_option('-e', action = 'store_true', optParser.add_option('-e', action = 'store_true',
dest = 'ffe', default = False, dest = 'ffe', default = False,
help = 'Use this after FeatureFreeze for non-bug fix syncs, changes ' \ help = 'Use this after FeatureFreeze for non-bug fix syncs, changes ' \
@ -194,11 +197,18 @@ if __name__ == '__main__':
report += 'Changelog entries since current %s version %s:\n\n' % (release, ubuntu_version) report += 'Changelog entries since current %s version %s:\n\n' % (release, ubuntu_version)
changelog = getDebianChangelog(debian_srcpkg, base_version) changelog = getDebianChangelog(debian_srcpkg, base_version)
if not changelog: if not changelog:
print >> sys.stderr, "E: Did not retrieve any changelog entries. Was the package recently uploaded? (check http://packages.debian.org/changelogs/)" if not options.missing_changelog_ok:
sys.exit(1) print >> sys.stderr, "E: Did not retrieve any changelog entries. Do you need to specify '-C'? Was the package recently uploaded? (check http://packages.debian.org/changelogs/)"
sys.exit(1)
else:
need_interaction = True
changelog = "XXX FIXME: add changelog here XXX"
report += changelog report += changelog
(title, report) = edit_report(title, report, changes_required = need_interaction) (title, report) = edit_report(title, report, changes_required = need_interaction)
if 'XXX FIXME' in report:
print >> sys.stderr, "E: changelog boilerplate found in report, please manually add changelog when using '-C'"
sys.exit(1)
# bug status and bug subscriber # bug status and bug subscriber
status = 'confirmed' status = 'confirmed'

View File

@ -29,7 +29,7 @@ setup(name='ubuntu-dev-tools',
'lp-shell', 'lp-shell',
'manage-credentials', 'manage-credentials',
'massfile', 'massfile',
'mk-sbuild-lv', 'mk-sbuild',
'pbuilder-dist', 'pbuilder-dist',
'pbuilder-dist-simple', 'pbuilder-dist-simple',
'pull-debian-debdiff', 'pull-debian-debdiff',

View File

@ -180,7 +180,7 @@ def mailBug(srcpkg, subscribe, status, bugtitle, bugtext, keyid = None):
# sign the mail body # sign the mail body
gpg = subprocess.Popen(gpg_command, stdin = subprocess.PIPE, stdout = subprocess.PIPE) gpg = subprocess.Popen(gpg_command, stdin = subprocess.PIPE, stdout = subprocess.PIPE)
signed_report = gpg.communicate(mailbody)[0] signed_report = gpg.communicate(mailbody.encode('utf-8'))[0]
assert gpg.returncode == 0 assert gpg.returncode == 0
# generate email # generate email