From 66619367180957b7008bfecefb46defb19622990 Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Wed, 3 Feb 2010 15:26:40 -0800 Subject: [PATCH 01/14] pbuilder-dist: change --mirror logic to use -ports when appropriate --- debian/changelog | 1 + pbuilder-dist | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d295629..eb9aa52 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ ubuntu-dev-tools (0.92) UNRELEASED; urgency=low * mk-sbuild-lv: use --arch=foo rather than --arch foo for debootstrap * pbuilder-dist: Allow architecture-switching to armel on i386/amd64 * 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 * debian/control: add qemu-arm-static to Recommends: diff --git a/pbuilder-dist b/pbuilder-dist index 601d097..6909764 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -219,7 +219,12 @@ class pbuilder_dist: if self.extra_components: components += ' contrib non-free' 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' if self.extra_components: components += ' universe multiverse' From 803ee6582bee46ebb1640b2fa96367bb29fb6a20 Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Thu, 4 Feb 2010 10:42:53 -0800 Subject: [PATCH 02/14] Oops: upload cleanup --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index eb9aa52..0a8c775 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ubuntu-dev-tools (0.92) UNRELEASED; urgency=low +ubuntu-dev-tools (0.92) lucid; urgency=low [ Siegfried-Angel Gevatter Pujals ] * bash_completion/pbuilder-dist: From 621b743cab94c90b4790dfc2390b453aa5e3f590 Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Fri, 5 Feb 2010 16:46:54 -0800 Subject: [PATCH 03/14] Support qemu-arm-static -> qemu-kvm-extras-static transition --- debian/changelog | 6 ++++++ debian/control | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0a8c775..ce0b721 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ubuntu-dev-tools (0.93) UNRELEASED; urgency=low + + * Support qemu-arm-static -> qemu-kvm-extras-static transition + + -- Emmet Hikory Fri, 05 Feb 2010 16:45:26 -0800 + ubuntu-dev-tools (0.92) lucid; urgency=low [ Siegfried-Angel Gevatter Pujals ] diff --git a/debian/control b/debian/control index ad7766f..1b0aed8 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,7 @@ Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, dpkg-dev, python-apt (>= 0.7.9), python-lazr.restfulclient Recommends: bzr, pbuilder | cowdancer | sbuild, reportbug (>= 3.39ubuntu1), ca-certificates, debootstrap, genisoimage, perl-modules, libwww-perl, - libapt-pkg-perl, qemu-arm-static + libapt-pkg-perl, qemu-kvm-extras-static Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) Description: useful tools for Ubuntu developers From ecdba060650687fe08f61b3be8bba33e8825bd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Sat, 6 Feb 2010 10:33:09 +0100 Subject: [PATCH 04/14] Demote qemu-kvm-extras-static to a Suggests since most people don't build for armel. --- debian/changelog | 5 +++++ debian/control | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ce0b721..da6bb8e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,12 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low + [ Emmet Hikory ] * Support qemu-arm-static -> qemu-kvm-extras-static transition + [ Loïc Minier ] + * Demote qemu-kvm-extras-static to a Suggests since most people don't build + for armel. + -- Emmet Hikory Fri, 05 Feb 2010 16:45:26 -0800 ubuntu-dev-tools (0.92) lucid; urgency=low diff --git a/debian/control b/debian/control index 1b0aed8..fef7f1c 100644 --- a/debian/control +++ b/debian/control @@ -17,8 +17,9 @@ Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, dpkg-dev, python-apt (>= 0.7.9), python-lazr.restfulclient Recommends: bzr, pbuilder | cowdancer | sbuild, reportbug (>= 3.39ubuntu1), ca-certificates, debootstrap, genisoimage, perl-modules, libwww-perl, - libapt-pkg-perl, qemu-kvm-extras-static + libapt-pkg-perl Conflicts: devscripts (<< 2.10.7ubuntu5) +Suggests: qemu-kvm-extras-static Replaces: devscripts (<< 2.10.7ubuntu5) Description: useful tools for Ubuntu developers This is a collection of useful tools that Ubuntu developers use to make their From 233ceb06b9b643a2a20419dea98d7e8ede2b017c Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 8 Feb 2010 10:12:55 -0800 Subject: [PATCH 05/14] requestsync: add -C to allow manually adding changelog when missing. --- debian/changelog | 5 ++++- requestsync | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index da6bb8e..3f27f86 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,10 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * Demote qemu-kvm-extras-static to a Suggests since most people don't build for armel. - -- Emmet Hikory Fri, 05 Feb 2010 16:45:26 -0800 + [ Kees Cook ] + * requestsync: add -C to allow manually adding changelog when missing. + + -- Kees Cook Mon, 08 Feb 2010 10:12:23 -0800 ubuntu-dev-tools (0.92) lucid; urgency=low diff --git a/requestsync b/requestsync index b2f7f2a..a5f44f8 100755 --- a/requestsync +++ b/requestsync @@ -61,6 +61,9 @@ if __name__ == '__main__': optParser.add_option('-s', action = 'store_true', dest = 'sponsorship', default = False, 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', dest = 'ffe', default = False, help = 'Use this after FeatureFreeze for non-bug fix syncs, changes ' \ @@ -194,8 +197,12 @@ if __name__ == '__main__': report += 'Changelog entries since current %s version %s:\n\n' % (release, ubuntu_version) changelog = getDebianChangelog(debian_srcpkg, base_version) if not changelog: - print >> sys.stderr, "E: Did not retrieve any changelog entries. Was the package recently uploaded? (check http://packages.debian.org/changelogs/)" - sys.exit(1) + if not options.missing_changelog_ok: + print >> sys.stderr, "E: Did not retrieve any changelog entries. 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 (title, report) = edit_report(title, report, changes_required = need_interaction) From 07451d8631b336694976f167d98136553ba8fc62 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 8 Feb 2010 11:55:58 -0800 Subject: [PATCH 06/14] requestsync: add -C to allow manually adding changelog when missing (LP: #518574). --- debian/changelog | 3 ++- requestsync | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3f27f86..2a48220 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,8 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low for armel. [ Kees Cook ] - * requestsync: add -C to allow manually adding changelog when missing. + * requestsync: add -C to allow manually adding changelog when missing + (LP: #518574). -- Kees Cook Mon, 08 Feb 2010 10:12:23 -0800 diff --git a/requestsync b/requestsync index a5f44f8..355d434 100755 --- a/requestsync +++ b/requestsync @@ -198,7 +198,7 @@ if __name__ == '__main__': changelog = getDebianChangelog(debian_srcpkg, base_version) if not changelog: if not options.missing_changelog_ok: - print >> sys.stderr, "E: Did not retrieve any changelog entries. Was the package recently uploaded? (check http://packages.debian.org/changelogs/)" + 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 @@ -206,6 +206,9 @@ if __name__ == '__main__': report += changelog (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 status = 'confirmed' From 3997415b8f63c2602a18990c50072ae7a397d7ed Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 8 Feb 2010 20:04:33 -0500 Subject: [PATCH 07/14] add union-type support fot mk-sbuild-lv (rename -> mk-sbuild) --- debian/changelog | 3 + doc/{mk-sbuild-lv.1 => mk-sbuild.1} | 28 +++--- mk-sbuild-lv => mk-sbuild | 127 ++++++++++++++++++++-------- setup.py | 2 +- 4 files changed, 112 insertions(+), 48 deletions(-) rename doc/{mk-sbuild-lv.1 => mk-sbuild.1} (75%) rename mk-sbuild-lv => mk-sbuild (84%) diff --git a/debian/changelog b/debian/changelog index 2a48220..2c8d468 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,8 @@ 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 diff --git a/doc/mk-sbuild-lv.1 b/doc/mk-sbuild.1 similarity index 75% rename from doc/mk-sbuild-lv.1 rename to doc/mk-sbuild.1 index 9c178e4..90fbaca 100644 --- a/doc/mk-sbuild-lv.1 +++ b/doc/mk-sbuild.1 @@ -1,18 +1,18 @@ -.TH MK\-SBUILD\-LV "1" "27 August 2008" "ubuntu-dev-tools" +.TH MK\-SBUILD "1" "08 February 2010" "ubuntu-dev-tools" .SH NAME -mk\-sbuild\-lv \- creates LVM snapshot chroots via schroot and sbuild +mk\-sbuild \- creates chroots via schroot and sbuild .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\-\-debootstrap\-mirror=URL\fR] <\fBVG\fR> <\fBRelease\fR> +[\fB\-\-debootstrap\-mirror=URL\fR] <\fBRelease\fR> .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 -Listed below are the command line options for mk\-sbuild\-lv: +Listed below are the command line options for mk\-sbuild: .TP .B \-\-arch=ARCH 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. .TP .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 .B \-\-debootstrap\-mirror=URL Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia, @@ -39,6 +39,9 @@ official Ubuntu repositories for the supported architectures). .B \-\-distro Enable distro-specific logic. Currently known distros: "ubuntu" (default) and "debian". +.TP +.B \-\-volume-group +Specify a volume group, and subsequently use lvm-snapshot rather than aufs mounts. .SH ENVIRONMENT VARIABLES .TP @@ -53,18 +56,21 @@ Lines to append to schroot entries. .TP .B SKIP_UPDATES 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 /srv/chroots) .SH FILES .TP -.B $HOME/.mk\-sbuild\-lv.rc +.B $HOME/.mk\-sbuild.rc Sourced for environment variables (defined above). .TP -.B $HOME/.mk\-sbuild\-lv.sources +.B $HOME/.mk\-sbuild.sources Can contain a customized sources.list. It will be read when creating the schroot. See sources.list(5) for more details on the format. .TP -.B $HOME/.mk\-sbuild\-lv.schroot.conf +.B $HOME/.mk\-sbuild.schroot.conf Can contain a customized configuration section to be inserted into /etc/schroot/schroot.conf. See schroot.conf(5) for more details on the format. @@ -83,6 +89,6 @@ sbuild\-setup (7), sources.list (5), schroot.conf (5), https://help.ubuntu.com/community/SbuildLVMHowto .SH AUTHOR -\fBmk\-sbuild\-lv\fR was written by Kees Cook . +\fBmk\-sbuild\fR was written by Kees Cook . This man page was written by Ryan Kavanagh . Both are released under the GNU General Public License, version 3 or later. diff --git a/mk-sbuild-lv b/mk-sbuild similarity index 84% rename from mk-sbuild-lv rename to mk-sbuild index 3df0855..e646540 100755 --- a/mk-sbuild-lv +++ b/mk-sbuild @@ -40,11 +40,6 @@ fi if [ ! -w /var/lib/sbuild ]; then # Load all the packages you'll need to do work sudo apt-get install sbuild schroot debootstrap lvm2 - # 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 sudo adduser "$USER" sbuild @@ -98,10 +93,11 @@ fi # Set up configurable defaults (loaded after option processing) LV_SIZE="5G" SNAPSHOT_SIZE="4G" +SOURCE_CHROOTS_DIR=/srv/chroot function usage() { - echo "Usage: $0 [OPTIONS] VG Release" >&2 + echo "Usage: $0 [OPTIONS] Release" >&2 echo "Options:" echo " --arch=ARCH What architecture to select" echo " --name=NAME Base name for the schroot (arch is appended)" @@ -111,8 +107,10 @@ function usage() echo " --source-template=FILE Use FILE as the sources.list template" echo " --debootstrap-mirror=URL Use URL as the debootstrap source" echo " --distro=DISTRO Install specific distro (defaults to 'ubuntu')" + echo " --volume-group=VG use LVM snapshots, with group VG" echo "" - echo "Configuration (via ~/.mk-sbuild-lv.rc)" + echo "Configuration (via ~/.mk-sbuild.rc)" + echo " SOURCE_CHROOTS_DIR directory to put source chroots in" echo " LV_SIZE Size of source LVs (default ${LV_SIZE})" echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})" echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries" @@ -126,9 +124,10 @@ function usage() if [ -z "$1" ]; then usage 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:,volume-group" -- "$@"` eval set -- "$OPTS" +VG="" DISTRO="ubuntu" name="" while :; do @@ -176,6 +175,10 @@ while :; do DISTRO="$2" shift 2 ;; + --volume-group) + VG="$2" + shift 2 + ;; --) shift break @@ -188,9 +191,8 @@ done # To build the LV, we need to know which volume group to use, and which # release of Ubuntu to debootstrap -VG="$1" -RELEASE="$2" -if [ -z "$VG" ] || [ -z "$RELEASE" ]; then +RELEASE="$1" +if [ -z "$RELEASE" ]; then usage fi @@ -199,9 +201,9 @@ if [ -z "$name" ]; then name="$RELEASE" fi -# Set up some variables for use in the paths and names -CHROOT_LV="${name}_chroot${arch_suffix}" -CHROOT_PATH="/dev/$VG/$CHROOT_LV" +SRC_TYPE="union" +SCHROOT_CONF_TYPE="directory" + CHROOT_NAME="${name}${arch_suffix}" HOST_ARCH=$(dpkg --print-architecture) @@ -210,14 +212,35 @@ if [ -z "$CHROOT_ARCH" ]; then fi # Load customizations -if [ -r ~/.mk-sbuild-lv.rc ]; then - . ~/.mk-sbuild-lv.rc +if [ -r ~/.mk-sbuild.rc ]; then + . ~/.mk-sbuild.rc fi -# Does the specified VG exist? (vgdisplay doesn't set error codes...) -if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then - exit 1 -fi +[ -n "${VG}" ] && { SRC_TYPE="lvm"; SCHROOT_CONF_TYPE="lvm-snapshot"; } + +case "$SRC_TYPE" in +"lvm") + # 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_suffix}" + CHROOT_PATH="/dev/$VG/$CHROOT_LV" + # Does the specified VG exist? (vgdisplay doesn't set error codes...) + if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then + exit 1 + fi + ;; +"union") + if [ ! -d "${SOURCE_CHROOTS_DIR}" ]; then + sudo mkdir "${SOURCE_CHROOTS_DIR}" + fi + ;; +*) echo "unknown source type" >&2; exit 1;; +esac # Is the specified release known to debootstrap? if [ ! -r "/usr/share/debootstrap/scripts/$RELEASE" ]; then @@ -305,14 +328,6 @@ debian) ;; 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 # Use qemu-arm-static / build-arm-chroot for foreign armel chroots if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then @@ -323,12 +338,33 @@ if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then fi fi +case "$SRC_TYPE" in +"lvm") + # 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" + ;; +"union") + CHROOT_PATH="${SOURCE_CHROOTS_DIR}/${CHROOT_NAME}" + MNT="${CHROOT_PATH}" + if [ -d "${MNT}" ]; then + echo "${MNT} exists. exiting"; exit 1; + fi + sudo mkdir -p "${MNT}" + ;; +esac + +# debootstrap the chroot sudo $DEBOOTSTRAP_COMMAND $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}" # Update the package sources TEMP_SOURCES=`mktemp -t sources-XXXXXX` if [ -z "$TEMPLATE_SOURCES" ]; then - TEMPLATE_SOURCES=~/.mk-sbuild-lv.sources + TEMPLATE_SOURCES=~/.mk-sbuild.sources fi if [ -r "$TEMPLATE_SOURCES" ]; then cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES" @@ -357,12 +393,16 @@ rm -f "$TEMP_SOURCES" sudo cp /etc/localtime /etc/timezone "$MNT"/etc/ # Create an LVM-snapshot-based schroot entry for this LV TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX` -TEMPLATE_SCHROOTCONF=~/.mk-sbuild-lv.schroot.conf -if [ -r "$TEMPLATE_SCHROOTCONF" ]; then - cat "$TEMPLATE_SCHROOTCONF" > "$TEMP_SCHROOTCONF" -else - cat > "$TEMP_SCHROOTCONF" < "$TEMP_SCHROOTCONF" +elif [ -r "${TYPED_TEMPLATE_SCHROOTCONF}" ]; then + cat "${TYPED_TEMPLATE_SCHROOTCONF}" > "$TEMP_SCHROOTCONF" +else + if [ "${SRC_TYPE}" = "lvm" ]; then + cat > "$TEMP_SCHROOTCONF" < "${TEMP_SCHROOTCONF}" <> "$TEMP_SCHROOTCONF" @@ -417,8 +469,11 @@ apt-get clean rm /finish.sh EOM sudo chmod +x "$MNT"/finish.sh -sudo umount "$MNT" -rmdir "$MNT" + +if [ "$SRC_TYPE" = "lvm" ]; then + sudo umount "$MNT" + rmdir "$MNT" +fi # Run finalization script on the "golden" copy via schroot. sudo schroot -c "$CHROOT_NAME"-source -u root /finish.sh diff --git a/setup.py b/setup.py index fb97517..25007a3 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup(name='ubuntu-dev-tools', 'lp-shell', 'manage-credentials', 'massfile', - 'mk-sbuild-lv', + 'mk-sbuild', 'pbuilder-dist', 'pbuilder-dist-simple', 'pull-debian-debdiff', From 32d0e916d35088b666707409afe5eeee9b18a59d Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Tue, 9 Feb 2010 11:34:20 +0900 Subject: [PATCH 08/14] mk-sbuild: conditionally install lvm2 only for lv-snapshot schroots --- debian/changelog | 3 ++- mk-sbuild | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2c8d468..1f79ad6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low [ Emmet Hikory ] * Support qemu-arm-static -> qemu-kvm-extras-static transition + * mk-sbuild: conditionally install lvm2 only for lv-snapshot schroots [ Loïc Minier ] * Demote qemu-kvm-extras-static to a Suggests since most people don't build @@ -14,7 +15,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * requestsync: add -C to allow manually adding changelog when missing (LP: #518574). - -- Kees Cook Mon, 08 Feb 2010 10:12:23 -0800 + -- Emmet Hikory Tue, 09 Feb 2010 11:32:02 +0900 ubuntu-dev-tools (0.92) lucid; urgency=low diff --git a/mk-sbuild b/mk-sbuild index e646540..2bd6b18 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -1,4 +1,4 @@ -#!/bin/bash +# !/bin/bash # # Copyright 2006-2009 (C) Canonical Ltd. # Author: Kees Cook @@ -36,10 +36,10 @@ if [ -w /etc/passwd ]; then exit 1 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 # 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 # Add self to the sbuild group sudo adduser "$USER" sbuild @@ -340,6 +340,9 @@ fi case "$SRC_TYPE" in "lvm") + # Install lvm2 if missing + dpkg -l lvm2 > /dev/null || sudo apt-get install lvm2 + # Allocate the "golden" chroot LV sudo lvcreate -n "$CHROOT_LV" -L "$LV_SIZE" "$VG" sudo mkfs -t ext4 "$CHROOT_PATH" From c2fa61372186fbf28f20c45571101e1705741de7 Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Tue, 9 Feb 2010 11:40:16 +0900 Subject: [PATCH 09/14] mk-sbuild: rationalise architecture variables --- debian/changelog | 3 ++- mk-sbuild | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1f79ad6..290eb25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low [ Emmet Hikory ] * Support qemu-arm-static -> qemu-kvm-extras-static transition * mk-sbuild: conditionally install lvm2 only for lv-snapshot schroots + * mk-sbuild: rationalise architecture variables [ Loïc Minier ] * Demote qemu-kvm-extras-static to a Suggests since most people don't build @@ -15,7 +16,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * requestsync: add -C to allow manually adding changelog when missing (LP: #518574). - -- Emmet Hikory Tue, 09 Feb 2010 11:32:02 +0900 + -- Emmet Hikory Tue, 09 Feb 2010 11:38:48 +0900 ubuntu-dev-tools (0.92) lucid; urgency=low diff --git a/mk-sbuild b/mk-sbuild index 2bd6b18..904a447 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -137,9 +137,6 @@ while :; do shift ;; --arch) - # By default, use the native architecture. - arch_opt="--arch=$2" - arch_suffix="-$2" CHROOT_ARCH="$2" if [ "$2" = "i386" ] || [ "$2" = "lpia" ] && [ -z "$personality" ]; then @@ -204,13 +201,14 @@ fi SRC_TYPE="union" SCHROOT_CONF_TYPE="directory" -CHROOT_NAME="${name}${arch_suffix}" - +# By default, use the native architecture. HOST_ARCH=$(dpkg --print-architecture) if [ -z "$CHROOT_ARCH" ]; then - CHROOT_ARCH=$HOST_ARCH + CHROOT_ARCH="$HOST_ARCH" fi +CHROOT_NAME="${name}-${CHROOT_ARCH}" + # Load customizations if [ -r ~/.mk-sbuild.rc ]; then . ~/.mk-sbuild.rc @@ -227,7 +225,7 @@ case "$SRC_TYPE" in fi # Set up some variables for use in the paths and names - CHROOT_LV="${name}_chroot${arch_suffix}" + CHROOT_LV="${name}_chroot-${CHROOT_ARCH}" CHROOT_PATH="/dev/$VG/$CHROOT_LV" # Does the specified VG exist? (vgdisplay doesn't set error codes...) if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then @@ -362,7 +360,7 @@ case "$SRC_TYPE" in esac # debootstrap the chroot -sudo $DEBOOTSTRAP_COMMAND $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}" +sudo "$DEBOOTSTRAP_COMMAND" --arch="$CHROOT_ARCH" $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}" # Update the package sources TEMP_SOURCES=`mktemp -t sources-XXXXXX` From 7a5de7c8776b765241acbc4c7f5cd19f7512f1df Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Tue, 9 Feb 2010 12:07:35 +0900 Subject: [PATCH 10/14] mk-sbuild: automatically install qemu-kvm-extras-static if requested --- debian/changelog | 1 + mk-sbuild | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 290eb25..52d7e23 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low [ 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 lv-snapshot schroots * mk-sbuild: rationalise architecture variables diff --git a/mk-sbuild b/mk-sbuild index 904a447..e0a7ced 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -327,13 +327,12 @@ debian) esac 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 [ -f "/usr/bin/build-arm-chroot" ]; then - DEBOOTSTRAP_COMMAND=build-arm-chroot - else - echo Please install qemu-arm-static to use foreign armel chroots + if [ ! -f "/usr/bin/build-arm-chroot" ]; then + sudo apt-get install qemu-kvm-extras-static fi + DEBOOTSTRAP_COMMAND=build-arm-chroot fi case "$SRC_TYPE" in From acf2ebb9243df905501ff3768d3f8e0d304e1ecb Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Tue, 9 Feb 2010 21:29:29 +0900 Subject: [PATCH 11/14] mk-sbuild: Generalise --type support and add "file"|"tarball" type --- debian/changelog | 1 + mk-sbuild | 88 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 68 insertions(+), 21 deletions(-) diff --git a/debian/changelog b/debian/changelog index 52d7e23..eaae468 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * mk-sbuild: automatically install qemu-kvm-extras-static if requested * mk-sbuild: conditionally install lvm2 only for lv-snapshot schroots * mk-sbuild: rationalise architecture variables + * mk-sbuild: Generalise --type support and add "file"|"tarball" type [ Loïc Minier ] * Demote qemu-kvm-extras-static to a Suggests since most people don't build diff --git a/mk-sbuild b/mk-sbuild index e0a7ced..0c0ac34 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -94,6 +94,7 @@ fi LV_SIZE="5G" SNAPSHOT_SIZE="4G" SOURCE_CHROOTS_DIR=/srv/chroot +SOURCE_CHROOTS_TGZ=/var/lib/schroot/tarballs function usage() { @@ -108,9 +109,11 @@ function usage() echo " --debootstrap-mirror=URL Use URL as the debootstrap source" echo " --distro=DISTRO Install specific distro (defaults to 'ubuntu')" echo " --volume-group=VG use LVM snapshots, with group VG" + echo " --type=SCHROOT_TYPE Define the schroot type" echo "" echo "Configuration (via ~/.mk-sbuild.rc)" - echo " SOURCE_CHROOTS_DIR directory to put source chroots in" + echo " SOURCE_CHROOTS_DIR directory to store source chroots" + echo " SOURCE_CHROOTS_TGZ directory to store source chroot tarballs" echo " LV_SIZE Size of source LVs (default ${LV_SIZE})" echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})" echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries" @@ -124,7 +127,7 @@ function usage() if [ -z "$1" ]; then usage fi -OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:,distro:,volume-group" -- "$@"` +OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:,distro:,volume-group:,type:" -- "$@"` eval set -- "$OPTS" VG="" @@ -176,6 +179,10 @@ while :; do VG="$2" shift 2 ;; + --type) + SCHROOT_TYPE="$2" + shift 2 + ;; --) shift break @@ -186,8 +193,7 @@ while :; do esac done -# To build the LV, we need to know which volume group to use, and which -# release of Ubuntu to debootstrap +# To build the chroot, we need to know which release of Ubuntu to debootstrap RELEASE="$1" if [ -z "$RELEASE" ]; then usage @@ -198,9 +204,6 @@ if [ -z "$name" ]; then name="$RELEASE" fi -SRC_TYPE="union" -SCHROOT_CONF_TYPE="directory" - # By default, use the native architecture. HOST_ARCH=$(dpkg --print-architecture) if [ -z "$CHROOT_ARCH" ]; then @@ -214,10 +217,16 @@ if [ -r ~/.mk-sbuild.rc ]; then . ~/.mk-sbuild.rc fi -[ -n "${VG}" ] && { SRC_TYPE="lvm"; SCHROOT_CONF_TYPE="lvm-snapshot"; } +if [ -z "$SCHROOT_TYPE" ]; then + if [ -n "$VG" ]; then + SCHROOT_TYPE=lvm-snapshot + else + SCHROOT_TYPE=directory + fi +fi -case "$SRC_TYPE" in -"lvm") +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 @@ -227,17 +236,27 @@ case "$SRC_TYPE" in # Set up some variables for use in the paths and names CHROOT_LV="${name}_chroot-${CHROOT_ARCH}" CHROOT_PATH="/dev/$VG/$CHROOT_LV" + # 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 ;; -"union") +"directory") if [ ! -d "${SOURCE_CHROOTS_DIR}" ]; then - sudo mkdir "${SOURCE_CHROOTS_DIR}" + sudo mkdir -p "${SOURCE_CHROOTS_DIR}" fi ;; -*) echo "unknown source type" >&2; exit 1;; +"tarball"| "file") + if [ ! -d "$SOURCE_CHROOTS_TGZ" ]; then + sudo mkdir -p "$SOURCE_CHROOTS_TGZ" + fi + ;; +*) + echo "unknown source type" >&2 + exit 1 + ;; esac # Is the specified release known to debootstrap? @@ -335,8 +354,8 @@ if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then DEBOOTSTRAP_COMMAND=build-arm-chroot fi -case "$SRC_TYPE" in -"lvm") +case "$SCHROOT_TYPE" in +"lvm-snapshot") # Install lvm2 if missing dpkg -l lvm2 > /dev/null || sudo apt-get install lvm2 @@ -348,7 +367,7 @@ case "$SRC_TYPE" in MNT=`mktemp -d -t schroot-XXXXXX` sudo mount "$CHROOT_PATH" "$MNT" ;; -"union") +"directory") CHROOT_PATH="${SOURCE_CHROOTS_DIR}/${CHROOT_NAME}" MNT="${CHROOT_PATH}" if [ -d "${MNT}" ]; then @@ -356,6 +375,9 @@ case "$SRC_TYPE" in fi sudo mkdir -p "${MNT}" ;; +"tarball"|"file") + CHROOT_PATH="${SOURCE_CHROOTS_TGZ}/${CHROOT_NAME}.tgz" + MNT=`mktemp -d -t schroot-XXXXXX` esac # debootstrap the chroot @@ -401,7 +423,8 @@ if [ -r "${TEMPLATE_SCHROOT}" ]; then elif [ -r "${TYPED_TEMPLATE_SCHROOTCONF}" ]; then cat "${TYPED_TEMPLATE_SCHROOTCONF}" > "$TEMP_SCHROOTCONF" else - if [ "${SRC_TYPE}" = "lvm" ]; then + case "$SCHROOT_TYPE" in + "lvm-snapshot") cat > "$TEMP_SCHROOTCONF" < "${TEMP_SCHROOTCONF}" < "$TEMP_SCHROOTCONF" << EOM +[CHROOT_NAME] +type=file +union-type=aufs +file=CHROOT_PATH +description=CHROOT_NAME +priority=3 +groups=sbuild,root,admin +root-groups=root,sbuild,admin +EOM + ;; + esac fi if [ ! -z "$personality" ]; then echo "personality=$personality" >> "$TEMP_SCHROOTCONF" @@ -470,10 +507,19 @@ rm /finish.sh EOM sudo chmod +x "$MNT"/finish.sh -if [ "$SRC_TYPE" = "lvm" ]; then +case "$SCHROOT_TYPE" in +"lvm-snapshot") sudo umount "$MNT" rmdir "$MNT" -fi + ;; +"directory") + ;; +"tarball"|"file") + (cd "$MNT" && sudo tar czf "$CHROOT_PATH" .) + sudo rm -r "$MNT" + ;; +esac + # Run finalization script on the "golden" copy via schroot. sudo schroot -c "$CHROOT_NAME"-source -u root /finish.sh From 4c598a92470fb1f8d4048788604d66d06e5c6049 Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Tue, 9 Feb 2010 22:10:58 +0900 Subject: [PATCH 12/14] * mk-sbuild: Generalise --type support and add "file" SCHROOT_TYPE * mk-sbuild.1: Document the --type argument --- debian/changelog | 5 +++-- doc/mk-sbuild.1 | 15 +++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 155c55b..38451b6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,8 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * mk-sbuild: automatically install qemu-kvm-extras-static if requested * mk-sbuild: conditionally install lvm2 only for lv-snapshot schroots * mk-sbuild: rationalise architecture variables - * mk-sbuild: Generalise --type support and add "file"|"tarball" type + * 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 @@ -21,7 +22,7 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * mk-sbuild.1: update documentation to reflect alternative config file names for distro and schroot type overrides. - -- Kees Cook Tue, 09 Feb 2010 00:14:26 -0800 + -- Emmet Hikory Tue, 09 Feb 2010 22:08:56 +0900 ubuntu-dev-tools (0.92) lucid; urgency=low diff --git a/doc/mk-sbuild.1 b/doc/mk-sbuild.1 index 8be08ac..7da0745 100644 --- a/doc/mk-sbuild.1 +++ b/doc/mk-sbuild.1 @@ -41,8 +41,11 @@ Enable distro-specific logic. Currently known distros: "ubuntu" (default) and "debian". .TP .B \-\-vg -Specify a volume group, and subsequently use SCHROOT_TYPE of "lvm-snapshot" -rather than "directory" (via aufs) mounts. +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 .TP @@ -61,6 +64,10 @@ Do not include the \-updates pocket in the installed sources.list. .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 .TP @@ -77,8 +84,8 @@ See sources.list(5) for more details on the format. .B $HOME/.mk\-sbuild.schroot.conf[.$SCHROOT_TYPE] Can contain a customized configuration section to be inserted into /etc/schroot/schroot.conf. -If a file with ".lvm-snapshot" or ".directory" is found (based on the presence -of the \-\-vg argument) that file will use used instead. +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. .SH USING THE CHROOTS .TP From 51160d6eb11ddce8f4d8cc983048b38bdd54e746 Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Wed, 10 Feb 2010 06:08:02 +0900 Subject: [PATCH 13/14] Move conditional lvm2 install prior to first call to lvm2 binaries --- mk-sbuild | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mk-sbuild b/mk-sbuild index 1fbe131..f575b3c 100755 --- a/mk-sbuild +++ b/mk-sbuild @@ -245,6 +245,11 @@ case "$SCHROOT_TYPE" in 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 @@ -367,11 +372,6 @@ fi case "$SCHROOT_TYPE" in "lvm-snapshot") - # Install lvm2 if missing - if ! dpkg -l lvm2 >/dev/null 2>&1; then - sudo apt-get install lvm2 - fi - # Allocate the "golden" chroot LV sudo lvcreate -n "$CHROOT_LV" -L "$LV_SIZE" "$VG" sudo mkfs -t ext4 "$CHROOT_PATH" From cfe30e88e540ca37b21a7737c47e49075c9ea461 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Mon, 15 Feb 2010 22:40:51 +0100 Subject: [PATCH 14/14] ubuntutools/requestsync/mail.py: Encode the report to utf-8 before passing it to gpg for signing (lp: #522316). --- debian/changelog | 6 +++++- ubuntutools/requestsync/mail.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ecf8a1c..df0c434 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,7 +22,11 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low * mk-sbuild.1: update documentation to reflect alternative config file names for distro and schroot type overrides. - -- Kees Cook Tue, 09 Feb 2010 07:10:39 -0800 + [ Michael Bienia ] + * ubuntutools/requestsync/mail.py: Encode the report to utf-8 before passing + it to gpg for signing (lp: #522316). + + -- Michael Bienia Mon, 15 Feb 2010 22:37:59 +0100 ubuntu-dev-tools (0.92) lucid; urgency=low diff --git a/ubuntutools/requestsync/mail.py b/ubuntutools/requestsync/mail.py index 2e2d2b1..15822fd 100644 --- a/ubuntutools/requestsync/mail.py +++ b/ubuntutools/requestsync/mail.py @@ -180,7 +180,7 @@ def mailBug(srcpkg, subscribe, status, bugtitle, bugtext, keyid = None): # sign the mail body 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 # generate email