[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 3 commits: schroot-create: use mmdebstrap instead of debootstrap

Holger Levsen gitlab at salsa.debian.org
Wed Jan 15 11:53:21 GMT 2020



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
ade2875a by Holger Levsen at 2020-01-15T12:51:27+01:00
schroot-create: use mmdebstrap instead of debootstrap

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
b98c01de by Holger Levsen at 2020-01-15T12:51:47+01:00
schroot-create: add explaining comments

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
956933c4 by Holger Levsen at 2020-01-15T12:53:02+01:00
schroot-create: remove some whitespaces

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- bin/schroot-create.sh


Changes:

=====================================
bin/schroot-create.sh
=====================================
@@ -1,7 +1,7 @@
 #!/bin/bash
 # vim: set noexpandtab:
 
-# Copyright © 2012-2019 Holger Levsen <holger at layer-acht.org>
+# Copyright © 2012-2020 Holger Levsen <holger at layer-acht.org>
 #           ©      2013 Antonio Terceiro <terceiro at debian.org>
 #           ©      2014 Joachim Breitner <nomeata at debian.org>
 #           © 2015-2018 Mattia Rizzolo <mattia at debian.org>
@@ -96,26 +96,27 @@ robust_chroot_apt() {
 }
 
 bootstrap() {
-	mkdir -p "$SCHROOT_TARGET/etc/dpkg/dpkg.cfg.d"
-	echo force-unsafe-io > "$SCHROOT_TARGET/etc/dpkg/dpkg.cfg.d/02dpkg-unsafe-io"
-
 	echo "Bootstraping $SUITE into $SCHROOT_TARGET now."
-	sudo debootstrap $SUITE $SCHROOT_TARGET $MIRROR | tee $TMPLOG
+	sudo mmdebstrap $SUITE $SCHROOT_TARGET $MIRROR | tee $TMPLOG
 	local rt="${PIPESTATUS[0]}"
 	local RESULT=$(egrep "E: (Couldn't download packages|Invalid Release signature)" $TMPLOG || true)
 	if [ ! -z "$RESULT" ] || [ "$rt" -ne 0 ]; then
-		echo "$(date -u) - initial debootstrap failed, sleeping 5min before retrying..."
+		echo "$(date -u) - initial bootstrap failed, sleeping 5min before retrying..."
 		sudo rm -rf --one-file-system $SCHROOT_TARGET
 		sleep 5m
-		sudo debootstrap $SUITE $SCHROOT_TARGET $MIRROR || ( echo "$(date -u ) - 2nd debootstrap failed, giving up..." ; exit 1 )
+		sudo mmdebstrap $SUITE $SCHROOT_TARGET $MIRROR || ( echo "$(date -u ) - 2nd bootstrap failed, giving up..." ; exit 1 )
 	fi
 	rm -f $TMPLOG
 
-	echo -e '#!/bin/sh\nexit 101'              | sudo tee   $SCHROOT_TARGET/usr/sbin/policy-rc.d >/dev/null
+	# configure policy-rc.d to not start services
+	echo -e '#!/bin/sh\nexit 101' | sudo tee $SCHROOT_TARGET/usr/sbin/policy-rc.d >/dev/null
 	sudo chmod +x $SCHROOT_TARGET/usr/sbin/policy-rc.d
+	# configure proxy
 	if [ ! -z "$http_proxy" ] ; then
-		echo "Acquire::http::Proxy \"$http_proxy\";" | sudo tee    $SCHROOT_TARGET/etc/apt/apt.conf.d/80proxy >/dev/null
+		echo "Acquire::http::Proxy \"$http_proxy\";" | sudo tee $SCHROOT_TARGET/etc/apt/apt.conf.d/80proxy >/dev/null
 	fi
+	# configure dpkg to be faster
+	echo force-unsafe-io | sudo tee "$SCHROOT_TARGET/etc/dpkg/dpkg.cfg.d/02dpkg-unsafe-io"
 
 	# configure the APT sources
 	sudo tee "$SCHROOT_TARGET/etc/apt/sources.list" > /dev/null <<-__END__
@@ -124,7 +125,7 @@ bootstrap() {
 	deb-src $MIRROR $SUITE main
 	__END__
 	for i in $(seq 0 7) ; do
-		[ -z "${EXTRA_SOURCES[$i]}" ] || echo "${EXTRA_SOURCES[$i]}"                     | sudo tee -a $SCHROOT_TARGET/etc/apt/sources.list >/dev/null
+		[ -z "${EXTRA_SOURCES[$i]}" ] || echo "${EXTRA_SOURCES[$i]}" | sudo tee -a $SCHROOT_TARGET/etc/apt/sources.list >/dev/null
 	done
 
 	# Misc configuration for a building-aimed chroot
@@ -168,13 +169,13 @@ bootstrap() {
 		# try to use diffoscope from experimental if available
 		if ([ "$SUITE" != "unstable" ] && [ "$SUITE" != "experimental" ]) && [ "$1" = "diffoscope" ] ; then
 			# always try to use diffoscope from unstable on stretch/buster
-			echo "deb $MIRROR unstable main"        | sudo tee -a $SCHROOT_TARGET/etc/apt/sources.list > /dev/null
+			echo "deb $MIRROR unstable main" | sudo tee -a $SCHROOT_TARGET/etc/apt/sources.list > /dev/null
 			robust_chroot_apt update
 			# install diffoscope from unstable without re-adding all recommends...
 			sudo chroot $SCHROOT_TARGET apt-get install -y -t unstable --no-install-recommends diffoscope || echo "Warning: diffoscope from unstable is uninstallable at the moment."
 		fi
 		if [ "$SUITE" != "experimental" ] && [ "$1" = "diffoscope" ] ; then
-			echo "deb $MIRROR experimental main"        | sudo tee -a $SCHROOT_TARGET/etc/apt/sources.list > /dev/null
+			echo "deb $MIRROR experimental main" | sudo tee -a $SCHROOT_TARGET/etc/apt/sources.list > /dev/null
 			robust_chroot_apt update
 			# install diffoscope from experimental without re-adding all recommends...
 			sudo chroot $SCHROOT_TARGET apt-get install -y -t experimental --no-install-recommends diffoscope || echo "Warning: diffoscope from experimental is uninstallable at the moment."



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/13ff75d694f9576bb08a30cf141599f11917acb8...956933c44fda9af27922108be6d243b626d7d83a

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/13ff75d694f9576bb08a30cf141599f11917acb8...956933c44fda9af27922108be6d243b626d7d83a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20200115/a4e8e6f4/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list