From 9328ed90617f1c3d55678db5bb2aaf302c408536 Mon Sep 17 00:00:00 2001
From: Ansgar <ansgar@debian.org>
Date: Sun, 18 Sep 2022 12:24:34 +0200
Subject: [PATCH 1/2] debootstrap: optionally exclude specific dependencies

debootstrap will always install the first alternative of a
dependency. This setting can be used to exclude such a choice, but one
has to be careful that the dependency is satisfied some other way.

This is intended to be used for the "usrmerge | usr-is-merged"
dependency where debootstrap already installs "usr-is-merged" and
should not pull in "usrmerge" as well.

Note that this patch changes the output of "debootstrap --print-debs"
slightly: required packages are separated by space instead of newline
as was already the case for base packages.
---
 debootstrap | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/debootstrap b/debootstrap
index 5ed9086..c86c34c 100755
--- a/debootstrap
+++ b/debootstrap
@@ -41,6 +41,7 @@ EXTRACTOR_OVERRIDE=""
 UNPACK_TARBALL=""
 ADDITIONAL=""
 EXCLUDE=""
+EXCLUDE_DEPENDENCY=""
 VERBOSE=""
 CERTIFICATE=""
 CHECKCERTIF=""
@@ -723,9 +724,10 @@ if am_doing_phase finddebs; then
 
 		info RESOLVEREQ "Resolving dependencies of required packages..."
 		required=$(resolve_deps "$requiredX")
+		required=$(without "$required" "$EXCLUDE_DEPENDENCY")
 		info RESOLVEBASE "Resolving dependencies of base packages..."
 		base=$(resolve_deps "$baseX")
-		base=$(without "$base" "$required")
+		base=$(without "$base" "$required $EXCLUDE_DEPENDENCY")
 
 		if [ "$LOG_EXTRA_DEPS" = true ]; then
 			baseN=$(without "$baseX" "$requiredX")
-- 
GitLab


From 540caed28882ef72e50e3ab45d115d2f7a5c6e5c Mon Sep 17 00:00:00 2001
From: Ansgar <ansgar@debian.org>
Date: Sun, 18 Sep 2022 12:27:06 +0200
Subject: [PATCH 2/2] debian-common: exclude usrmerge when installing
 usr-is-merged

---
 scripts/debian-common | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/debian-common b/scripts/debian-common
index 197ecbf..9942f2d 100644
--- a/scripts/debian-common
+++ b/scripts/debian-common
@@ -52,6 +52,7 @@ work_out_debs () {
 			;;
 		*)
 			required="$required usr-is-merged"
+			EXCLUDE_DEPENDENCY="$EXCLUDE_DEPENDENCY usrmerge"
 			;;
 	esac
 }
-- 
GitLab

