aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Minier <lool@dooz.org>2010-01-25 17:32:00 +0100
committerLoïc Minier <lool@dooz.org>2010-01-25 17:32:00 +0100
commitc31448846df8326741195e0aaf1659b94c95aade (patch)
tree424170c2360531251cf692d3e1970a472aa0c56b
parent05cbe6d5ca5f7c15cbe32f08c7c2cee014790661 (diff)
downloadpbuilder-c31448846df8326741195e0aaf1659b94c95aade.tar
pbuilder-c31448846df8326741195e0aaf1659b94c95aade.tar.gz
Add support for debootstrap-mirror and -suite
-rwxr-xr-xpbuilder-apt-config43
-rwxr-xr-xtest_pbuilder-apt-config18
2 files changed, 60 insertions, 1 deletions
diff --git a/pbuilder-apt-config b/pbuilder-apt-config
index 2da6937..307e0ad 100755
--- a/pbuilder-apt-config
+++ b/pbuilder-apt-config
@@ -8,6 +8,7 @@ self="$(basename "$0")"
# TODO
# - support setting --mirror-map (for --profile)
# - Debian security entries?
+# - oldstable
log() {
echo "$@" >&2
@@ -106,6 +107,9 @@ output_sources() {
}
sources=""
+debootstrap_suite=""
+debootstrap_mirror=""
+
add_output_sources() {
local output="$(output_sources "$@")"
@@ -113,6 +117,33 @@ add_output_sources() {
}$output"
}
+set_debootstrap_suite() {
+ local archive="$1"
+ local suite="$2"
+
+ case "$archive" in
+ debian)
+ case "$suite" in
+ unstable)
+ debootstrap_suite="sid"
+ ;;
+ testing)
+ debootstrap_suite="squeeze"
+ ;;
+ stable)
+ debootstrap_suite="lenny"
+ ;;
+ *)
+ debootstrap_suite="$suite"
+ ;;
+ esac
+ ;;
+ *)
+ debootstrap_suite="$suite"
+ ;;
+ esac
+}
+
getopt_output="`getopt -o "" -l help,with-sources::,arch:,components:,mirror:,suite:,pockets:,profile: -n "$self" -s sh -- "$@"`"
eval set -- "$getopt_output"
@@ -249,7 +280,7 @@ if [ -n "$profile" ]; then
;;
esac
;;
- ubuntu)
+ ubuntu|ubuntu-ports)
if [ "$base_dist" != "${profile%%-*}" ]; then
die "Unknown Ubuntu based profile=$profile"
fi
@@ -282,6 +313,8 @@ if [ -n "$profile" ]; then
die "Unknown profile for base_archive=$base_archive"
;;
esac
+ set_debootstrap_suite "$base_archive" "$base_dist"
+ debootstrap_mirror="$base_mirror"
fi
if [ -n "$suite" ]; then
@@ -295,6 +328,12 @@ if [ -n "$suite" ]; then
for pocket in $pockets; do
add_output_sources "$with_sources" "$mirror" "$suite-$pocket" "$components"
done
+ # NB: archive might be empty; best effort to try to guess it
+ if [ -z "$archive" ]; then
+ archive="`guess_dist_arch_archive "$suite" "$arch"`" 2>/dev/null || true
+ fi
+ set_debootstrap_suite "$archive" "$suite"
+ debootstrap_mirror="$mirror"
fi
command="$1"
@@ -303,8 +342,10 @@ case $1 in
echo "$sources"
;;
debootstrap-mirror)
+ echo "$debootstrap_mirror"
;;
debootstrap-suite)
+ echo "$debootstrap_suite"
;;
*)
usage
diff --git a/test_pbuilder-apt-config b/test_pbuilder-apt-config
index e2bec03..a9a6392 100755
--- a/test_pbuilder-apt-config
+++ b/test_pbuilder-apt-config
@@ -8,6 +8,14 @@ run_suite_mode() {
./pbuilder-apt-config --with-sources=no --mirror mirror --suite suite --components component apt-sources "$@"
}
+debootstrap_suite() {
+ ./pbuilder-apt-config --with-sources=no --mirror mirror --components component debootstrap-suite "$@"
+}
+
+debootstrap_mirror() {
+ ./pbuilder-apt-config --with-sources=no --components component debootstrap-mirror "$@"
+}
+
test_components() {
run_suite_mode --components comp1
run_suite_mode --components comp1,comp2,comp3
@@ -107,4 +115,14 @@ expect_output "deb mirror suite component
#deb-src mirror suite component" run_suite_mode --with-sources=disabled
expect_output "deb mirror suite component" run_suite_mode --with-sources=no
+expect_output "suite" debootstrap_suite --suite suite
+expect_output "sid" debootstrap_suite --suite sid
+expect_output "sid" debootstrap_suite --suite unstable
+expect_output "mirror" debootstrap_mirror --suite suite --mirror mirror
+
+expect_output "sid" debootstrap_suite --profile sid
+expect_output "sid" debootstrap_suite --profile unstable
+expect_output "http://archive.ubuntu.com/ubuntu/" debootstrap_mirror --profile lucid
+expect_output "http://ports.ubuntu.com/ubuntu-ports/" debootstrap_mirror --profile lucid --arch armel
+
testlib_summary