From b343d2d76c1ae44da372472cfbeb80f7e917e6ef Mon Sep 17 00:00:00 2001 From: Wookey Date: Wed, 26 Mar 2014 17:43:39 +0000 Subject: Create new repo with scripts, key and readme for making cross-chroots for linaro CI --- README | 42 +++++++++++++++++ configchrootforarch | 24 ++++++++++ linarorepo.key | 18 ++++++++ make-packaged-crosschroot | 97 +++++++++++++++++++++++++++++++++++++++ package-existing-installed-chroot | 13 ++++++ 5 files changed, 194 insertions(+) create mode 100644 README create mode 100755 configchrootforarch create mode 100644 linarorepo.key create mode 100755 make-packaged-crosschroot create mode 100755 package-existing-installed-chroot diff --git a/README b/README new file mode 100644 index 0000000..9c7781e --- /dev/null +++ b/README @@ -0,0 +1,42 @@ +This dir contains the bits for updating the raring-crosschroot package +used in the CI infra. + +That crosschroot is made by debootstrapping plain raring, then: +installing build-essential in the chroot +installing the configchrootforarch script into /usr/local/bin +installing sbuild from linaro-overlay (which uses that script when +given suitable option) +adding /etc/apt/source.list.d/linaro-overlay.list file with deb and +deb-src lines for repo.l.o linaro-overlay +modify apt sources to specify which arches comes from ports.u.c and which +from archive.u.c +setting APT::Install-Suggests "0";and APT::Install-Recommends "0"; in +/etc/apt/apt.conf.d/30norecommends + +No need to add keys - they are supplied by copying, by the build +system scripts + +All this is packed up into a package containing +etc/schroot/chroot.d/raring-amd64-sbuild +srv/chroots/raring-cross-buildd.tgz + +for now we just copy /srv/chroots/raring-cross-buildd.tgz as the 'golden' rootfs into +raring-crosschroot/srv/chroots/raring-cross-buildd.tgz +This is not robust and should do the above every time. + +bump version number in make-crosschroot-package script, then run it +(as sudo) to get +raring-crosschroot_ver_all.deb + +The script: +1 copies /srv/chroots/-cross-buildd.tgz into +-crosschroot/srv/chroots/-cross-buildd.tgz +2 makes sure everything is owned by root. +3 packs up into tarball +4 converts to deb with alien + +manually import the deb into the repo with: + reprepro includedeb precise ~buildd/repobits/crosschroots/raring-crosschroot.deb + + +Wookey 2013-10-25 \ No newline at end of file diff --git a/configchrootforarch b/configchrootforarch new file mode 100755 index 0000000..3748fcd --- /dev/null +++ b/configchrootforarch @@ -0,0 +1,24 @@ +#!/bin/sh + +# configure chroot for architecture being built +# currently that means install arm64 repo and buildflags, for other arches leave as-is. + +filestore=/etc/sbuild/files + +if [ "$1" = "" ]; then + echo "$0 needs a parameter e.g. arm64" + exit 1 +fi + +case $1 in + (arm64) + cp ${filestore}/buildflags.conf /etc/dpkg/ + cp ${filestore}/arm64-repo.list /etc/apt/sources.list.d/ + ;; + (*) + rm -f /etc/dpkg/buildflags.conf /etc/apt/sources.list.d/arm64-repo.list + ;; +esac + + + diff --git a/linarorepo.key b/linarorepo.key new file mode 100644 index 0000000..31f1900 --- /dev/null +++ b/linarorepo.key @@ -0,0 +1,18 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.12 (GNU/Linux) + +mQENBFFKYd4BCAD1znxWHazOdG+F4BSPXdT3OrX3bwScw7ZVpyY9v4kNJwpr/PSj +BICrpFPY0OkX7TjvtFAGTJF8YA0hnq5GFA2YVCRd1Xplz0zeS/ktMDEYEBA1B4Mk +1wzX1Kp7LyJEntYBtd9g0Ge3f8Z4DCOTG15RnEONYXtbqdZ6xHGwDJtxyzU+ZPaH +RfxGDdHlIKmCaV4W17zXoJOW7KIR1NwakfgBBUgPVH+i1iuIvtniKe6mAvAUDfmN +DOMaMgofzIshKkq1wncwBmW81eW9Mg+JzTZaa0XAah1anbdCMoCS91txG2O3Gj1z +OF1tY0WXYL9oPeBxDoN+KgKPyehKiSRwQ+0XABEBAAG0E0xpbmFybyByZXBvc2l0 +b3JpZXOJATgEEwECACIFAlFKYd4CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheA +AAoJEOE9iPfjwdVsqAoH/RGrCKW1b9jImsxVUqrBfHPekiFk44JiG04f46qY7u/l +ZiWgsayBcE9JInUQF7GWYVamgj55263mOZfsezxEtxr+KWz0ny6miyQH+51XpI74 +8+6ljExfnYR/Fdkiplcc+Fr5oGWBZXNmTedo0nYWl3aVsjCgl7/wMt/hwbx3J/aA +66/CmG2IMAEwbXdedrk+hiTNBjBaaKnkiqCX7fOstE1Ie0q7ro6d0nhkZezxVK1a +GSOsIE2xtTOPlVp9k3YmxVVisZIRjIcEJu6YnuBI2G4MaOh6RJTQpw9Hprr58Z6v +vzJBYZzXnLMl7RrXEw0NIYmPcEM6m5cphUlDpRBd8Tg= +=dkH9 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/make-packaged-crosschroot b/make-packaged-crosschroot new file mode 100755 index 0000000..aaace45 --- /dev/null +++ b/make-packaged-crosschroot @@ -0,0 +1,97 @@ +#!/bin/bash +#deb version number + +suite=saucy +chroot=`mktemp -u --tmpdir=/srv` +version=0.7.2 + +set -e + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +if test -f ${suite}-crosschroot_${version}-2_all.deb; then + echo "${suite}-crosschroot-${version}-2.deb already exists - perhaps you wanted to bump version?" + read -r -p "Continue and regenerate existing version? [y/N] " a + if [[ "$a" = "y" || "$a" = "Y" ]]; then + : + else + exit 0 + fi +fi + +if test -z ${chroot}; then + echo "tmpdir nonexistent - bailing" + exit 1 +fi + +# create the sbuild chroot for target suite +echo "Doing debootstrap" +debootstrap --variant=buildd ${suite} ${chroot} + +# and add our little modifications to that chroot +cp configchrootforarch ${chroot}/usr/local/bin/ + +# set up apt sources and turn off recommends + +echo "Configuring apt" +cat <<-EOF > ${chroot}/etc/apt/sources.list.d/linaro-overlay.list + deb http://repo.linaro.org/ubuntu/linaro-overlay ${suite} main + deb-src http://repo.linaro.org/ubuntu/linaro-overlay ${suite} main +EOF + +cat <<-EOF > ${chroot}/etc/apt/sources.list + deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${suite} main universe + deb [arch=armhf,arm64] http://ports.ubuntu.com/ ${suite} main universe + deb-src http://archive.ubuntu.com/ubuntu/ ${suite} main universe + deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${suite}-updates main universe + deb [arch=armhf,arm64] http://ports.ubuntu.com/ ${suite}-updates main universe + deb-src http://archive.ubuntu.com/ubuntu/ ${suite}-updates main universe +EOF + +cat <<-EOF > ${chroot}/etc/apt/apt.conf.d/30norecommends + APT::Install-Suggests "0"; + APT::Install-Recommends "0"; +EOF +#and set up an apt key for the linaro archive +echo "Installing apt key" +cp linarorepo.key ${chroot}/ +chroot ${chroot} apt-key add linarorepo.key +rm ${chroot}/linarorepo.key + +# now pack that up into filesystem structure suitable for use by schroot/sbuild +mkdir -p ${suite}-crosschroot/srv/chroots +mkdir -p ${suite}-crosschroot/etc/schroot/chroot.d +echo "Tarring up chroot" +tar -C ${chroot} -czf ${suite}-crosschroot/srv/chroots/${suite}-cross-buildd.tgz . +#tidy up debootstrapped chroot +if test -z ${chroot}; then + echo "tmpdir nonexistent - avoiding deleting /" +else + rm -rf ${chroot} +fi + + +#add schroot config file for the chroot tarball +cat <<-EOF > ${suite}-crosschroot/etc/schroot/chroot.d/${suite}-amd64-sbuild + [${suite}-amd64-sbuild] + type=file + description=Ubuntu ${suite}/amd64 autobuilder + file=/srv/chroots/${suite}-cross-buildd.tgz + groups=root,sbuild,ubuntu + root-groups=root,sbuild,ubuntu +EOF + + +#now pack all that up in a deb using alien + +set +e + +echo "Packaging result" +rm -rf saucy-crosschroot-${version} +(cd ${suite}-crosschroot; chown -R root: *) +tar -C ${suite}-crosschroot -czvf ${suite}-crosschroot.tgz . +fakeroot alien --version ${version} ${suite}-crosschroot.tgz + diff --git a/package-existing-installed-chroot b/package-existing-installed-chroot new file mode 100755 index 0000000..a4816f6 --- /dev/null +++ b/package-existing-installed-chroot @@ -0,0 +1,13 @@ +#!/bin/sh + +BASEPATH=~/repobits/crosschroots + +for chroot in saucy +do +cp /srv/chroots/${chroot}-cross-buildd.tgz ${BASEPATH}/${chroot}-crosschroot/srv/chroots/ +(cd ${BASEPATH}/${chroot}-crosschroot; chown -R root: *) +tar -C ${BASEPATH}/${chroot}-crosschroot -czvf ${chroot}-crosschroot.tgz . +fakeroot alien --version 0.7 ${chroot}-crosschroot.tgz +done + + \ No newline at end of file -- cgit v1.2.3