From cb221772870057fe4cd3cb427b9a373fd105a19e Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 27 Apr 2018 16:07:44 +0100 Subject: [PATCH] Add a buildd subproject. --- debian/changelog | 6 ++ live-build/auto/build | 9 +++ live-build/auto/config | 56 +++++++++++++++++++ live-build/buildd/hooks/apt.chroot | 14 +++++ live-build/buildd/hooks/fstab.chroot | 5 ++ live-build/buildd/hooks/kernel-img.chroot | 5 ++ .../buildd/hooks/pkgbinarymangler.chroot | 10 ++++ live-build/buildd/hooks/policy-rc.d.chroot | 20 +++++++ live-build/buildd/hooks/user.chroot | 9 +++ .../buildd/includes.chroot/etc/hostname | 1 + live-build/buildd/includes.chroot/etc/hosts | 9 +++ live-build/buildd/preseed/debconf.preseed | 2 + live-build/buildd/preseed/man-db.preseed | 3 + live-build/buildd/preseed/sun-java6.preseed | 3 + 14 files changed, 152 insertions(+) create mode 100644 live-build/buildd/hooks/apt.chroot create mode 100644 live-build/buildd/hooks/fstab.chroot create mode 100644 live-build/buildd/hooks/kernel-img.chroot create mode 100644 live-build/buildd/hooks/pkgbinarymangler.chroot create mode 100644 live-build/buildd/hooks/policy-rc.d.chroot create mode 100644 live-build/buildd/hooks/user.chroot create mode 100644 live-build/buildd/includes.chroot/etc/hostname create mode 100644 live-build/buildd/includes.chroot/etc/hosts create mode 100644 live-build/buildd/preseed/debconf.preseed create mode 100644 live-build/buildd/preseed/man-db.preseed create mode 100644 live-build/buildd/preseed/sun-java6.preseed diff --git a/debian/changelog b/debian/changelog index 817e0429..523937c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.525+lp1) UNRELEASED; urgency=medium + + * Add a buildd subproject. + + -- Colin Watson Thu, 26 Apr 2018 14:22:27 +0100 + livecd-rootfs (2.525) bionic; urgency=medium * Don't fail to build CPC images if /lib/modules already exists in the diff --git a/live-build/auto/build b/live-build/auto/build index 01dcc182..735dd2e9 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -460,6 +460,15 @@ if [ -e "binary/$INITFS/filesystem.dir" ]; then chmod 644 "$PREFIX.rootfs.tar.gz" elif [ -e binary-tar.tar.gz ]; then cp -a binary-tar.tar.gz "$PREFIX.rootfs.tar.gz" +elif [ "$SUBPROJECT" = buildd ]; then + # A few things (launchpad-buildd, sbuild-launchpad-chroot) rely on + # the top-level directory being "chroot-autobuild", so we have to do + # this ourselves. + # gzip was chosen for fastest decompression speed: it decompresses + # buildd chroots about twice as fast as xz and about five times as + # fast as bzip2. + tar --transform 's,^binary,chroot-autobuild,' \ + -czf "$PREFIX.rootfs.tar.gz" binary fi if [ "$PROJECT:${SUBPROJECT:-}" = "ubuntu-core:system-image" ]; then diff --git a/live-build/auto/config b/live-build/auto/config index e07aeb85..4fd845ff 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -668,6 +668,56 @@ case $PROJECT in ;; esac +case $SUBPROJECT in + buildd) + OPTS="${OPTS:+$OPTS }--archive-areas main" + COMPONENTS='main restricted universe multiverse' + KERNEL_FLAVOURS=none + OPTS="${OPTS:+$OPTS }--apt-recommends false" + OPTS="${OPTS:+$OPTS }--apt-secure false" + OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none" + INITRAMFS_COMPRESSION=none + OPTS="${OPTS:+$OPTS }--mirror-binary ${MIRROR}" + # XXX cjwatson 2018-04-27: We need to work out how to make + # this conditional so that we can do things like building + # buildd chroots with -updates. This probably involves + # either extending the PROPOSED hack or fixing the strange + # way that SUITE is in fact a series; in either case it's + # likely to involve work both here and in launchpad-buildd. + OPTS="${OPTS:+$OPTS }--security false --volatile false" + OPTS="${OPTS:+$OPTS }--binary-images none" + + add_package install adduser + add_package install policyrcd-script-zg2 + add_package install pkgbinarymangler + add_package install ca-certificates + add_package install gpg + add_package install gpg-agent + case $SUITE in + precise|trusty|xenial) + # no longer needed in >= artful + add_package install pkg-create-dbgsym + # no longer needed in >= bionic + add_package install apt-transport-https + # no longer needed in >= CC + add_package install tzdata + ;; + artful) + # no longer needed in >= bionic + add_package install apt-transport-https + # no longer needed in >= CC + add_package install tzdata + ;; + bionic) + # no longer needed in >= CC + add_package install tzdata + ;; + esac + add_package install fakeroot + add_package install build-essential + ;; +esac + # we'll expand the base seed given here according to the STRUCTURE file, and # then look in all of the seeds found to see which snaps are seeded case $PROJECT:${SUBPROJECT:-} in @@ -977,6 +1027,12 @@ EOF ;; esac +case $SUBPROJECT in + buildd) + cp -af /usr/share/livecd-rootfs/live-build/buildd/* config/ + ;; +esac + if [ "$EXTRA_PPAS" ]; then rm -f config/archives/extra-ppas.list.chroot \ config/archives/extra-ppas.pref.chroot \ diff --git a/live-build/buildd/hooks/apt.chroot b/live-build/buildd/hooks/apt.chroot new file mode 100644 index 00000000..6f0d828d --- /dev/null +++ b/live-build/buildd/hooks/apt.chroot @@ -0,0 +1,14 @@ +#! /bin/sh +set -e + +# Configure APT. +cat >/etc/apt/apt.conf.d/99buildd </etc/apt/preferences.d/backports </etc/fstab diff --git a/live-build/buildd/hooks/kernel-img.chroot b/live-build/buildd/hooks/kernel-img.chroot new file mode 100644 index 00000000..3517b443 --- /dev/null +++ b/live-build/buildd/hooks/kernel-img.chroot @@ -0,0 +1,5 @@ +#! /bin/sh +set -e + +# At one point, kernel builds needed this. +echo do_initrd = Yes >>/etc/kernel-img.conf diff --git a/live-build/buildd/hooks/pkgbinarymangler.chroot b/live-build/buildd/hooks/pkgbinarymangler.chroot new file mode 100644 index 00000000..ab901957 --- /dev/null +++ b/live-build/buildd/hooks/pkgbinarymangler.chroot @@ -0,0 +1,10 @@ +#! /bin/sh +set -e + +# Configure pkgbinarymangler. +sed -i /^enable/s/false/true/ \ + /etc/pkgbinarymangler/maintainermangler.conf \ + /etc/pkgbinarymangler/striptranslations.conf || true +sed -i /^invalid_current/s/ignore/fail/ \ + /etc/pkgbinarymangler/maintainermangler.conf \ + /etc/pkgbinarymangler/striptranslations.conf || true diff --git a/live-build/buildd/hooks/policy-rc.d.chroot b/live-build/buildd/hooks/policy-rc.d.chroot new file mode 100644 index 00000000..4f8980ec --- /dev/null +++ b/live-build/buildd/hooks/policy-rc.d.chroot @@ -0,0 +1,20 @@ +#! /bin/sh +set -e + +# Configure policy-rc.d. +cat >/usr/local/sbin/policy-rc.d <<'EOF' +#!/bin/sh + +# policy-rc.d script for chroots. +# Copyright (c) 2007 Peter Palfrader +# License: MIT, if you want one. + +while true; do + case "$1" in + -*) shift ;; + makedev) exit 0;; + *) echo "Not running services in chroot."; exit 101 ;; + esac +done +EOF +chmod 755 /usr/local/sbin/policy-rc.d diff --git a/live-build/buildd/hooks/user.chroot b/live-build/buildd/hooks/user.chroot new file mode 100644 index 00000000..86000bf2 --- /dev/null +++ b/live-build/buildd/hooks/user.chroot @@ -0,0 +1,9 @@ +#! /bin/sh +set -e + +# Create the buildd user and group. +addgroup --gid 2501 buildd +adduser --system --disabled-password --gecos 'Build Daemon user' \ + --ingroup buildd --uid 2001 --shell /bin/bash buildd +mkdir -p /build/buildd +chown buildd:buildd /build/buildd diff --git a/live-build/buildd/includes.chroot/etc/hostname b/live-build/buildd/includes.chroot/etc/hostname new file mode 100644 index 00000000..e420fe4d --- /dev/null +++ b/live-build/buildd/includes.chroot/etc/hostname @@ -0,0 +1 @@ +INVALID diff --git a/live-build/buildd/includes.chroot/etc/hosts b/live-build/buildd/includes.chroot/etc/hosts new file mode 100644 index 00000000..7a0cb5d4 --- /dev/null +++ b/live-build/buildd/includes.chroot/etc/hosts @@ -0,0 +1,9 @@ +127.0.0.1 localhost.localdomain localhost + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts diff --git a/live-build/buildd/preseed/debconf.preseed b/live-build/buildd/preseed/debconf.preseed new file mode 100644 index 00000000..4e8c607b --- /dev/null +++ b/live-build/buildd/preseed/debconf.preseed @@ -0,0 +1,2 @@ +# We never want debconf interaction. +debconf debconf/frontend select Noninteractive diff --git a/live-build/buildd/preseed/man-db.preseed b/live-build/buildd/preseed/man-db.preseed new file mode 100644 index 00000000..7281ae4d --- /dev/null +++ b/live-build/buildd/preseed/man-db.preseed @@ -0,0 +1,3 @@ +# Avoid unnecessary manual page database builds (see +# https://bugs.debian.org/554914). +man-db man-db/auto-update boolean false diff --git a/live-build/buildd/preseed/sun-java6.preseed b/live-build/buildd/preseed/sun-java6.preseed new file mode 100644 index 00000000..53011956 --- /dev/null +++ b/live-build/buildd/preseed/sun-java6.preseed @@ -0,0 +1,3 @@ +# Pre-accept interactive EULA prompts. +sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true +sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true