pbuilder-apt-config
Osamu Aoki
osamu at debian.org
Sun Jan 31 06:26:28 UTC 2010
Hi,
On Sat, Jan 30, 2010 at 11:12:54PM +0100, Loïc Minier wrote:
> On Sun, Jan 31, 2010, Osamu Aoki wrote:
> > > I finished mirror-map support; take a look, let me know what you think.
> >
> > some $mirror may be replaced by
> > $volatile_mirror
> > $security_mirror
>
> ah -- where specifically?
Let me do that later...
> > > I wonder whether we need a command-line interface to set archive
> > > mirrors too, perhaps --mirror "debian-security
> > > http://mirror/debian-security/" or something like that. Currently,
> > > only a single mirror for --suite mode is supported, or you have to use
> > > --mirror-map (works in both --profile and --suite modes).
> >
> > Use of sed script works but too complicated for this task ...
>
> Ok; changed to use pure shell; it's a bit longer but more readable
> indeed.
I think one important factor is the separation of data from code.
I wonder why you did not start with the following (This patch is against
sligtly old source but enough to identify what I am talking):
-------------
diff --git a/pbuilder-apt-config b/pbuilder-apt-config
index bbfe3d9..208985c 100755
--- a/pbuilder-apt-config
+++ b/pbuilder-apt-config
@@ -81,13 +81,13 @@ builtin_mirror_map() {
case "$archive" in
backports.org)
- echo "http://www.backports.org/backports.org/"
+ echo "$mirror_backports"
;;
debian)
- echo "http://ftp.us.debian.org/debian/"
+ echo "$mirror_debian"
;;
debian-archive)
- echo "http://archive.debian.org/debian/"
+ echo "$mirror_debian_archive"
;;
ppa:*)
people_ppa="${archive#ppa:}"
@@ -98,19 +98,19 @@ builtin_mirror_map() {
*)
people_ppa="$people_ppa/ppa"
esac
- echo "http://ppa.launchpad.net/$people_ppa/ubuntu/"
+ echo "$morror_ppa/$people_ppa/ubuntu/"
;;
ubuntu)
- echo "http://archive.ubuntu.com/ubuntu/"
+ echo "$mirror_ubuntu"
;;
ubuntu-ports)
- echo "http://ports.ubuntu.com/ubuntu-ports/"
+ echo "$mirror_ubuntu_ports"
;;
debian-security)
- echo "http://security.debian.org/"
+ echo "$mirror_debian_security"
;;
debian-volatile)
- echo "http://volatile.debian.org/debian-volatile/"
+ echo "$mirror_debian_volatile"
;;
*)
die "Unknown mirror for archive=$archive"
@@ -197,6 +197,14 @@ suite=""
pockets=""
archive=""
profile=""
+mirror_backports="http://www.backports.org/backports.org/"
+mirror_debian="http://ftp.us.debian.org/debian/"
+mirror_debian_archive="http://archive.debian.org/debian/"
+mirror_ppa="http://ppa.launchpad.net"
+mirror_ubuntu="http://archive.ubuntu.com/ubuntu/"
+mirror_ubuntu_ports="http://ports.ubuntu.com/ubuntu-ports/"
+mirror_debian_security="http://security.debian.org/"
+mirror_debian_volatile="http://volatile.debian.org/debian-volatile/"
while :; do
case "$1" in
-------------
Then we can have simple and easy to read solutions for the followings:
* overriding from coimmand line:
we can have command line option to set each value if we wish.
* overriding via environment variable:
use mirror_ubuntu_ports="${mirror_ubuntu_ports:+http://ports.ubuntu.com/ubuntu-ports/} instead.
* override via configuration file:
source something like /usr/share/pbuilder/archives and optionally
/etc/pbuilder/archives to set these variables.
> > Quite honestly, if I had to use local cache mirror, I may just use
> > --aptconf trick to overwrite /etc/apt/sources.list to any file contents.
>
> One goal of the tool is to be at the receiving end of the profile name.
>
> e.g. if the user passes some --distribution at creation time, we would
> call:
> if ! pbuilder-apt-config --profile $DISTRIBUTION >config 2>/dev/null; then
> pbuilder-apt-config --suite $DISTRIBUTION >config
> fi
Yes.
> Another goal is to support multiple mirrors transparently.
Yes with simple and easy to understand ways to override mirror site
URLs.
> I'm currently thinking we should rip away the MIRROR debconf stuff
> entirely and just default to autoguessing depending on the target of
> the package and of the current distro.
That is one way but I think we can keep it as long as we let it set
something like $debian_mirror or $ubuntu_mirror using some guessing from
URL.
Osamu
More information about the Pbuilder-maint
mailing list