[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#879151: debian-ports support when setting up sources.list



X-Debbugs-CC: Samuel Thibault <sthibault@debian.org>

Hi,

here is a revised proposal of a patch for this bug report. 
It is supposed that the relevant part [2] of the patch proposal [1] 
for bug #964248 is applied.

I hope it will help to find a solution.

Regards,
JH Chatenet

[1] : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964248#52

[2] : here is an excerpt of the patch proposal for bug #964248. It
defines a debconf variable 'base-installer/no_unreleased', which is 
used in this patch proposal.

------------8<--------------------------8<-----------------------
diff -Naur a/base-installer-1.195/debian/bootstrap-base.templates b/base-installer-1.195/debian/bootstrap-base.templates
--- a/base-installer-1.195/debian/bootstrap-base.templates	2019-11-17 22:17:31.000000000 +0100
+++ b/base-installer-1.195/debian/bootstrap-base.templates	2020-08-04 12:17:13.288662639 +0200
@@ -452,3 +452,10 @@
 Type: string
 Description: for internal use; can be preseeded
  Force use of a specific debootstrap script
+
+Template: base-installer/no_unreleased
+Type: boolean
+Default: false
+Description: for internal use; can be preseeded
+ Do not consider packages from the unreleased distribution.
+
------------8<--------------------------8<-----------------------

And here is the patch proposal :

# Setting up 'sources.list' in debian-installer requires to accommodate the
# peculiarities of architectures from the Debian-Ports repository.
#
# The Debian-Ports archive contains both suites 'unstable' and 'unreleased'.
# There are no source indices nor 'contrib' nor 'non-free' components.
# The sources are found on the regular debian mirror 'deb.debian.org'.
# Architecture independent packages from 'contrib' and 'non-free' may
# be found on the same mirror.

diff -Naur a/apt-setup-0.158/debian/control b/apt-setup-0.158/debian/control
--- a/apt-setup-0.158/debian/control	2020-07-05 21:34:06.000000000 +0200
+++ b/apt-setup-0.158/debian/control	2020-08-04 13:49:32.664130919 +0200
@@ -18,7 +18,7 @@
 Package: apt-mirror-setup
 Package-Type: udeb
 Architecture: all
-Depends: choose-mirror-bin, base-installer (>= 1.195), ${misc:Depends}
+Depends: choose-mirror-bin, ${misc:Depends}
 Description: set up a mirror in sources.list
 
 Package: apt-cdrom-setup
diff -Naur a/apt-setup-0.158/generators/50mirror b/apt-setup-0.158/generators/50mirror
--- a/apt-setup-0.158/generators/50mirror	2020-07-05 21:34:06.000000000 +0200
+++ b/apt-setup-0.158/generators/50mirror	2020-08-04 14:02:38.600028164 +0200
@@ -2,7 +2,6 @@
 set -e
 
 . /usr/share/debconf/confmodule
-. /usr/lib/base-installer/library.sh
 
 file="$1"
 
@@ -26,12 +25,11 @@
 	fi
 }
 
-# For architectures in the Debian-Ports archive, sources.list has to include
-# an additional entry for the "unreleased" suite.
-unset use_unreleased
-if is_ports_architecture "$(chroot /target /usr/bin/dpkg --print-architecture)"; then
+# Settings for architectures in the Debian-Ports archive
+is_ports_architecture=
+if [ -r /usr/lib/choose-mirror/port_architecture ]; then
 	log "Debian-Ports architecture detected"
-	use_unreleased=yes
+	is_ports_architecture=$(cat /usr/lib/choose-mirror/port_architecture)
 fi
 
 # Ask if a mirror should be used if the base system can be installed from CD
@@ -246,11 +244,48 @@
 		;;
 	esac
 
-	echo "deb $protocol://$hostname$directory $codename $dists" > $file
-	if [ -n "${use_unreleased}" ]; then
-		echo "deb $protocol://$hostname$directory unreleased main" >> $file
+	# architectures in the Debian-Ports archive
+	if [ "$codename" = "sid" ] && [ "$is_ports_architecture" = "1" ]; then
+
+		# 'main' is the only component in the Debian-Ports archive
+		echo "deb $protocol://$hostname$directory $codename main" > $file
+
+		# Did the user decline to consider the 'unreleased' suite ?
+		# (e.g. if installing from a custom mirror without 'unreleased')
+		if ! db_get base-installer/no_unreleased || [ "$RET" != true ]; then
+			# sources.list has to include an additional entry for the 'unreleased' suite.
+			echo "deb $protocol://$hostname$directory unreleased main" >> $file
+		else
+			log "As requested the 'unreleased' distribution is skipped"
+		fi
+
+		# There are no 'non-free' nor 'contrib' components in the Debian-Ports archive.
+		# However some arch-independant packages may be useful (e.g. firmwares).
+		# We hardcode a default location on the regular debian mirrors as a fallback.
+
+		dists_non_free_contrib=
+
+		for dist in $dists; do
+			case "$dist" in
+				"non-free"|"contrib")
+					dists_non_free_contrib="$dists_non_free_contrib $dist"
+					;;
+				*)
+					;;
+			esac
+		done
+
+		dists_non_free_contrib="${dists_non_free_contrib# }"
+
+		if [ -n "$dists_non_free_contrib" ]; then
+			echo "# the 'debian-ports' archive does not support 'non-free' nor 'contrib' yet" >> $file
+			echo "deb [ arch=all ] $protocol://deb.debian.org/debian $codename $dists_non_free_contrib" >> $file
+		fi
+
+	else # released architectures
+		echo "deb $protocol://$hostname$directory $codename $dists" > $file
 	fi
-	
+
 	if apt-setup-verify --from $PROGRESS_FROM --to $PROGRESS_TO $file; then
 		done=1
 	else
@@ -273,8 +308,15 @@
 	deb_src="# deb-src"
 fi
 
-echo "$deb_src $protocol://$hostname$directory $codename $dists" >> $file
-if [ -n "${use_unreleased}" ]; then
-	echo "# 'unreleased' does not support sources yet" >> $file
-	echo "# $deb_src $protocol://$hostname$directory unreleased main" >> $file
+# architectures in the Debian-Ports archive
+if [ "$codename" = "sid" ] && [ "$is_ports_architecture" = "1" ]; then
+
+	# There are no sources (yet !) in the Debian-Ports archive.
+	# We hardcode a default location on the regular debian mirrors as a fallback.
+
+	echo "# the 'debian-ports' archive does not support sources yet" >> $file
+	echo "$deb_src $protocol://deb.debian.org/debian $codename $dists" >> $file
+
+else # released architectures
+	echo "$deb_src $protocol://$hostname$directory $codename $dists" >> $file
 fi


Reply to: