Merge lp:~nobuto/ubuntu/quantal/ubuntu-defaults-builder/add-mirror into lp:ubuntu/quantal/ubuntu-defaults-builder

Proposed by Nobuto Murata
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~nobuto/ubuntu/quantal/ubuntu-defaults-builder/add-mirror
Merge into: lp:ubuntu/quantal/ubuntu-defaults-builder
Diff against target: 55 lines (+16/-1)
1 file modified
bin/ubuntu-defaults-image (+16/-1)
To merge this branch: bzr merge lp:~nobuto/ubuntu/quantal/ubuntu-defaults-builder/add-mirror
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Nobuto Murata (community) Needs Resubmitting
Review via email: mp+124952@code.launchpad.net

Description of the change

ubuntu-default-image cannot specify an archive mirror.

default servers below is not so fast for everyone, it takes fair amount of time for build compared to use an archive mirror.
 - http://archive.ubuntu.com/ubuntu
 - http://security.ubuntu.com/ubuntu

This branch adds --mirror and --security-mirror to use an archive mirror during build.

--mirror and --security-mirror are incompatible with --keep-apt and --keep-apt-components. give an error and exit for now if both are specified.

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

I don't understand why --mirror conflicts with --keep-apt? The globs are deliberately set up so that they do not assume a particular mirror. The output you showed in comment 3 looks just fine?

Thanks for working on this!

review: Needs Fixing
158. By Nobuto Murata

just revert last revision.
/var/lib/apt/lists/MIRROR_* seems to be deleted on lb_chroot_archives.

Revision history for this message
Nobuto Murata (nobuto) wrote :

Hi Martin,

I reverted a revision of "keep-apt check".

comment 3 was the output without --keep-apt,
so /var/lib/apt/lists/ftp.jaist.ac.jp_pub_Linux_ubuntu_dists* were removed.
I thought that if --keep-apt is specified, /var/lib/apt/lists/ftp.jaist.ac.jp_pub_Linux_ubuntu_dists* will be in a built image. but the built image has plain sources.list with {archive,security}.ubuntu.com, so /var/lib/apt/lists/ftp.jaist.ac.jp_pub_Linux_ubuntu_dists* will not be used in live-session and will waste space of the built image.

Anyway I found that /var/lib/apt/lists/* will be re-generated on `lb_chroot_archives chroot remove` after config/hooks/90_cleanup.chroot. with or without --keep-apt, /var/lib/apt/lists/ftp.jaist.ac.jp_pub_Linux_ubuntu_dists* will be deleted on `lb_chroot_archives chroot remove`.

review: Needs Resubmitting
Revision history for this message
Nobuto Murata (nobuto) wrote :

An issue "--keep-apt and --keep-apt-components seems not working" is reported as Bug #1053008.

Revision history for this message
Martin Pitt (pitti) wrote :

Ah of course, I understand. So --mirror uses that mirror for constructing the image, but it does _not_ set that mirror as a default apt source in the image itself. I had expected the mirror to also be set for the target system apt, but I guess depending on the use case this may or may not be desired. I guess eventually we want an option to do that as well, but for now I'll merge your r157 which makes them incompatible.

Thanks, and sorry for the confusion!

review: Approve
Revision history for this message
Nobuto Murata (nobuto) wrote :

Martin, thanks for the merge!

Changing target's sources.list is quite easy by passing LB_MIRROR_BINARY and LB_MIRROR_BINARY_SECURITY. Those will be used on live-session, but sources.list of installed target will be re-generated by ubiquity or d-i as far as I understand.

if someone wants a mirror used on everywhere including installed target, more work will be needed like passing preseeded file of a mirror url to ubiquity, I'm afraid.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntu-defaults-image'
2--- bin/ubuntu-defaults-image 2012-09-17 13:39:01 +0000
3+++ bin/ubuntu-defaults-image 2012-09-19 15:40:24 +0000
4@@ -24,6 +24,8 @@
5 PACKAGE=
6 ARCH=
7 COMPONENTS=
8+MIRROR=
9+SECURITY_MIRROR=
10 PPA=
11 FLAVOUR=ubuntu
12 SUITE=$(lsb_release -sc)
13@@ -44,6 +46,10 @@
14 --arch : Architecture [default: $ARCH]
15 --release RELEASE : Ubuntu release the image is based on [default: $SUITE]
16 --components COMPONENTS : List of archive components to enable [default: main,restricted]
17+ --mirror : Ubuntu mirror to be used during build
18+ [default: http://archive.ubuntu.com/ubuntu/]
19+ --security-mirror : Ubuntu security mirror to be used during build
20+ [default: http://security.ubuntu.com/ubuntu/]
21 --ppa USER/PPANAME : Enable additional PPA [default: none]
22 --keep-apt : Do not remove apt indexes from live system
23 --keep-apt-components COMPONENTS :
24@@ -73,7 +79,7 @@
25 echo "$DEB_PPA" > config/archives/ubuntu-defaults.binary.list
26 }
27
28-eval set -- "$(getopt -o '' -l help,locale:,keep-apt,keep-apt-components:,package:,arch:,release:,components:,ppa: -- "$@")" || { help; exit 1; }
29+eval set -- "$(getopt -o '' -l help,locale:,keep-apt,keep-apt-components:,package:,arch:,release:,components:,mirror:,security-mirror:,ppa: -- "$@")" || { help; exit 1; }
30 while :; do
31 case $1 in
32 --help)
33@@ -100,6 +106,14 @@
34 COMPONENTS="$(echo "$2" | sed 's/,/ /g' | tr -s ' ')"
35 shift 2
36 ;;
37+ --mirror)
38+ MIRROR="$2"
39+ shift 2
40+ ;;
41+ --security-mirror)
42+ SECURITY_MIRROR="$2"
43+ shift 2
44+ ;;
45 --ppa)
46 PPA="$2"
47 if ! expr match "$PPA" '^[.[:alnum:]-]\+/[[:alnum:]-]\+$' >/dev/null; then
48@@ -177,6 +191,7 @@
49 rm -f .stage/config
50
51 SUITE="$SUITE" PROJECT="$FLAVOUR" ARCH="$ARCH" LB_ARCHITECTURES="$ARCH" \
52+ LB_MIRROR_BOOTSTRAP="$MIRROR" LB_MIRROR_CHROOT_SECURITY="$SECURITY_MIRROR" \
53 IMAGEFORMAT=squashfs BINARYFORMAT=iso-hybrid lb config
54
55 if [ "$COMPONENTS" ]; then

Subscribers

People subscribed via source and target branches

to all changes: