--- Begin Message ---
Package: live-helper
Version: 2.0~a9-1
Severity: normal
Tags: patch
I noticed that live-helper defaults to using a mirror in Germany. It seems like
it would be better to use the same mirror that the user's system is taking its
packages from. Obviously we can't know that in general (well, except for copying
sources.list, but that has its own issues), but in the common case, Debian systems
get their apt sources from a mirror that looks like this:
deb http://http.XX.debian.org/debian(... more stuff)
I suggest just taking the first such line from sources.list and using it to
determine the mirror, and I've attached a patch (admittedly a bit ugly, but it
should illustrate what I mean) that uses grep and sed to acheive this goal.
Daniel
-- Package-specific info:
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages live-helper depends on:
ii debootstrap 1.0.22 Bootstrap a basic Debian system
Versions of packages live-helper recommends:
ii cpio 2.11-1 GNU cpio -- a program to manage ar
ii gettext-base 0.17-10 GNU Internationalization utilities
Versions of packages live-helper suggests:
ii dosfstools 3.0.9-1 utilities for making and checking
ii fakeroot 1.14.4-1 Gives a fake root environment
ii genisoimage 9:1.1.10-1 Creates ISO-9660 CD-ROM filesystem
pn memtest86+ | memtest86 <none> (no description available)
ii mtools 4.0.12-1 Tools for manipulating MSDOS files
ii parted 2.2-3 The GNU Parted disk partition resi
pn squashfs-tools | genext2fs <none> (no description available)
ii sudo 1.7.2p5-1 Provide limited super user privile
ii syslinux 2:3.86+dfsg-1 utilities for the syslinux bootloa
pn uuid-runtime <none> (no description available)
pn win32-loader <none> (no description available)
-- no debconf information
--- defaults.sh.orig 2010-03-12 07:19:52.000000000 -0800
+++ defaults.sh 2010-04-05 20:19:43.325448780 -0700
@@ -7,6 +7,18 @@
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
+# Read /etc/apt/sources.list and grab the first line of the form
+#
+# deb http://http.XX.debian.org/debian/
+#
+# to guess what the user's preferred Debian mirror is.
+infer_main_mirror_from_apt_sources()
+{
+ (egrep -m1 '^\s*deb\s*(http|ftp)://(http|ftp)\.[a-zA-Z_]+\.debian\.org/debian' /etc/apt/sources.list
+ echo http://http.de.debian.org/debian) |
+ sed 's%^\s*deb\s*\(http\|ftp\)://\(http\|ftp\)\.\([a-zA-Z_]\+\)\..*$%http://ftp.\3.debian.org/debian/%'
+}
+
Set_defaults ()
{
## config/common
@@ -284,7 +296,7 @@
then
case "${LH_MODE}" in
debian|debian-release)
- LH_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/"
+ LH_MIRROR_BOOTSTRAP=$(infer_main_mirror_from_apt_sources)
;;
emdebian)
--- End Message ---
--- Begin Message ---
On 04/06/2010 05:21 AM, Daniel Burrows wrote:
I noticed that live-helper defaults to using a mirror in Germany. It seems like
it would be better to use the same mirror that the user's system is taking its
packages from. Obviously we can't know that in general (well, except for copying
sources.list, but that has its own issues),
since there is no general way of knowing what sources.list to use, and
since even what is configured doesn't necessarily is the right one to
use, and we get many people using screwed mirrors all the time already
now, i really don't like to change that.
but in the common case, Debian systems
get their apt sources from a mirror that looks like this:
deb http://http.XX.debian.org/debian(... more stuff)
fwiw, this might be true for XX equal us, but almost all primary mirrors
are http://ftp.xx.
I suggest just taking the first such line from sources.list and using it to
determine the mirror, and I've attached a patch (admittedly a bit ugly, but it
should illustrate what I mean) that uses grep and sed to acheive this goal.
the idea of live-helper is to be able to bootstrap a clean debian (live)
system, regardless how screwed up the host system is, as long as it has
a shell and debootstrap|cdebootstrap. this, of course, also only works
if the archive of the mirror we bootstrap from, is really reliable.
using a default mirror automatically which is, with relatively big
chance, either broken or not the desired one, is very bad and would
extremely burden the support requests and debug time for people with
failing builds.
so it boils down to weighting, for the default case, on the one side the
maybe slower but perfectly working mirror, and on the other side, the
probably faster but unreliable mirror selection - and i clearly am for
the first option here.
however, the real solution here would be to use cdn.debian.net once it
has been turned into an official service. eventhough cdn.debian.net
works quite well which is why we use it for binary mirrors, it's not
reliable enough as a default setting for the bootstrap/chroot mirrors
for the very similar reasons above.
hopefully, DSA will at some point setup cdn.debian.org and keep only
primary or otherwise as reliable known mirrors in the rotation
(cdn.debian.net has from time to time outdated or simply broken mirrors,
but it's not so much of a problem for us since it only ends up in the
image, but is not used during build time of the image). i'm more than
happy to change the defaults once this has been setup, but in the
meanwhile, for our own sake, i'm keeping the default as it is.
Regards,
Daniel
--
Address: Daniel Baumann, Burgunderstrasse 3, CH-4562 Biberist
Email: daniel.baumann@panthera-systems.net
Internet: http://people.panthera-systems.net/~daniel-baumann/
--- End Message ---