From 9e7d96f50df440f1ce1432e44f774799d4e5c0c0 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 29 Jul 2009 09:49:51 +0000 Subject: Cope with pre-dependencies of included packages that aren't in Priority: required (closes: #487908). r59820 --- debian/changelog | 7 +++++++ debootstrap.8 | 5 ----- functions | 40 ++++++++++++++++++++++++++++++++++++++++ scripts/debian/sid | 13 +++++++++++++ scripts/ubuntu/gutsy | 13 +++++++++++++ 5 files changed, 73 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7b00511..17a9ec2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +debootstrap (1.0.16) UNRELEASED; urgency=low + + * Cope with pre-dependencies of included packages that aren't in Priority: + required (closes: #487908). + + -- Colin Watson Wed, 29 Jul 2009 10:46:56 +0100 + debootstrap (1.0.15) unstable; urgency=low * On Linux, clear out /etc/mtab on exit if it's not a symlink. Should fix diff --git a/debootstrap.8 b/debootstrap.8 index c1995cc..d909b34 100644 --- a/debootstrap.8 +++ b/debootstrap.8 @@ -47,11 +47,6 @@ See also \-\-foreign. .IP "\fB\-\-include=alpha,beta\fP" Comma separated list of packages which will be added to download and extract lists. -Beware that including packages that declare a Pre\-Depends relationship on -any package that is not in the "required" set (i.e. "Priority: required"), -or that depend directly or indirectly on packages that do so, will not work; -you will need to install such packages separately after \fBdebootstrap\fP -has completed. .IP .IP "\fB\-\-exclude=alpha,beta\fP" Comma separated list of packages which will be removed from download and diff --git a/functions b/functions index 989fb6e..0312157 100644 --- a/functions +++ b/functions @@ -997,6 +997,24 @@ while () { local p="$4" shift; shift; shift; shift pkgdetails_field 0 "$f" "$m" "$@" < "$p" + elif [ "$1" = "STANZAS" ]; then + local pkgdest="$2"; shift; shift + perl -e ' +my $accum = ""; +while () { + $accum .= $_; + $in = 1 if (/^Package: (.*)$/ && grep {$_ eq $1} @ARGV); + if ($in and /^$/) { + print $accum; + if (substr($accum, -1) != "\n") { + print "\n\n"; + } elsif (substr($accum, -2, 1) != "\n") { + print "\n"; + } + $in = 0; + } + $accum = "" if /^$/; +}' <"$pkgdest" "$@" fi } elif [ -e "/usr/lib/debootstrap/pkgdetails" ]; then @@ -1032,6 +1050,28 @@ resolve_deps () { echo $ALLPKGS } +setup_available () { + local m1="${MIRRORS%% *}" + + for c in $COMPONENTS; do + local path="dists/$SUITE/$c/binary-$ARCH/Packages" + local pkgdest="$TARGET/$($DLDEST pkg "$SUITE" "$c" "$ARCH" "$m1" "$path")" + # XXX: What if a package is in more than one component? + # -- cjwatson 2009-07-29 + "$PKGDETAILS" STANZAS "$pkgdest" "$@" + done >"$TARGET/var/lib/dpkg/available" + + for pkg; do + echo "$pkg install" | sudo dpkg --admindir "$TARGET/var/lib/dpkg" --set-selections + done +} + +get_next_predep () { + local stanza="$(dpkg --admindir "$TARGET/var/lib/dpkg" --predep-package)" || return 1 + [ "$stanza" ] || return 1 + echo "$stanza" | grep '^Package:' | sed 's/^Package://; s/^ *//' +} + ################################################################### helpers # Return zero if it is possible to create devices and execute programs in diff --git a/scripts/debian/sid b/scripts/debian/sid index 239b0c4..59e70fd 100644 --- a/scripts/debian/sid +++ b/scripts/debian/sid @@ -168,6 +168,19 @@ echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/ info UNPACKBASE "Unpacking the base system..." + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | diff --git a/scripts/ubuntu/gutsy b/scripts/ubuntu/gutsy index caca1f8..2331622 100644 --- a/scripts/ubuntu/gutsy +++ b/scripts/ubuntu/gutsy @@ -166,6 +166,19 @@ echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/ info UNPACKBASE "Unpacking the base system..." + setup_available $required $base + done_predeps= + while predep=$(get_next_predep); do + # We have to resolve dependencies of pre-dependencies manually because + # dpkg --predep-package doesn't handle this. + predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") + # XXX: progress is tricky due to how dpkg_progress works + # -- cjwatson 2009-07-29 + p; smallyes '' | in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) + base=$(without "$base" "$predep") + done_predeps="$done_predeps $predep" + done + smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | -- cgit v0.12