Merge lp:~smoser/maas-images/trunk.proposed-non-intel into lp:maas-images

Proposed by Scott Moser
Status: Merged
Merged at revision: 402
Proposed branch: lp:~smoser/maas-images/trunk.proposed-non-intel
Merge into: lp:maas-images
Diff against target: 91 lines (+21/-10)
2 files modified
bin/kpack-from-image (+17/-6)
bin/maas-cloudimg2ephemeral (+4/-4)
To merge this branch: bzr merge lp:~smoser/maas-images/trunk.proposed-non-intel
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+349206@code.launchpad.net

Commit message

Fix --proposed in kpack-from-image for arch other than i386 and amd64.

kpack-from-image always use archive.ubuntu.com for the ubuntu mirror
instead of ports.ubuntu.com for arch other than intel.

The change here does 3 things:
a.) change variable names in maas-cloudimg2ephemeral to be consistent
    with those used in kpack-from-image
a.) read UBUNTU_MIRROR and UBUNTU_MIRROR_PORTS from environment in both
    kpack-from-image and maas-cloudimg2ephemeral.
c.) pass UBUNTU_MIRROR and UBUNTU_MIRROR_PORTS through sudo call
    in kpack-from-image.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm!

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

@Scott, if you think this is related to the above, does it make sense to close the bug ? Since I have a feeling that this will fix it ?

Revision history for this message
Scott Moser (smoser) wrote :

@Andreas, I marked the bug as invalid. It reported the stack trace, which occurs only on xenial. We're not going to fix that. there was a bug with --proposed and non-intel, that is fixed here.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/kpack-from-image'
2--- bin/kpack-from-image 2018-04-06 04:19:17 +0000
3+++ bin/kpack-from-image 2018-07-09 18:38:41 +0000
4@@ -3,6 +3,9 @@
5 VERBOSITY=0
6 TEMP_D=""
7 COPY_TYPES="auto overlay qcow2 cp none"
8+UBUNTU_MIRROR=${UBUNTU_MIRROR:-"http://archive.ubuntu.com/ubuntu/"}
9+UBUNTU_MIRROR_PORTS=${UBUNTU_MIRROR_PORTS:-"http://ports.ubuntu.com/ubuntu-ports/"}
10+PROPOSED_ARCHIVE_FILE="/etc/apt/sources.list.d/proposed.list"
11 command -v unshare-pidns >/dev/null 2>&1 || PATH="${0%/*}:$PATH"
12
13 error() { echo "$@" 1>&2; }
14@@ -281,9 +284,9 @@
15 # installs all packages (arguments), writes kernel
16 # and initramfs and 'verflav' to /tmp/
17 VERBOSITY=${CHROOTED_VERBOSITY:-${VERBOSITY}}
18- local pkgs="" kpkg="" copymods zzgrub emd="" out pkg rel
19+ local pkgs="" kpkg="" copymods zzgrub emd="" out pkg rel arch
20 local skip_update=${KPACK_SKIP_APT_UPDATE:-false}
21- local proposed=${PROPOSED:-false} proposed_lfile=""
22+ local proposed=${PROPOSED:-false} proposed_lfile="${PROPOSED_ARCHIVE_FILE}"
23 local verflav initrd kernel
24 export LANG=C
25 kpkg="$1"
26@@ -295,12 +298,18 @@
27 local stamp="$outd/stamp"
28 touch "$stamp"
29
30- # add proposed if necessary
31 rel=$(lsb_release -sc) ||
32 { error "failed to read release"; return 1; }
33+ arch=$(dpkg --print-architecture) ||
34+ { error "failed to get architecture from dpkg"; return 1; }
35+
36+ # add proposed if necessary
37 if $proposed; then
38- local mirror=${UBUNTU_MIRROR:-http://archive.ubuntu.com/ubuntu/}
39- proposed_lfile="/etc/apt/sources.list.d/proposed.list"
40+ local mirror=""
41+ case "$arch" in
42+ i?86|amd64) mirror="${UBUNTU_MIRROR}";;
43+ *) mirror="${UBUNTU_MIRROR_PORTS}";;
44+ esac
45 debug 1 "adding proposed ($mirror) to $proposed_lfile"
46 echo "deb $mirror ${rel}-proposed main universe multiverse" \
47 > "$proposed_lfile"
48@@ -385,7 +394,7 @@
49 unreplace_newaliases / ||
50 { error "failed to un-replace newaliases"; return 1; }
51
52- [ -z "$proposed_lfile" ] || rm -f "$proposed_lfile"
53+ $proposed && rm -f "$proposed_lfile"
54
55 # here we look at all kernel files in /boot and get the package that
56 # owns it. if the package is the kernel that was supplied, then we
57@@ -536,6 +545,8 @@
58 sudo \
59 "KPACK_SKIP_APT_UPDATE=${KPACK_SKIP_APT_UPDATE:-false}" \
60 "http_proxy=$http_proxy" PACKAGES="$kpkg" \
61+ UBUNTU_MIRROR=${UBUNTU_MIRROR} \
62+ UBUNTU_MIRROR_PORTS=${UBUNTU_MIRROR_PORTS} \
63 "$mic" --sys --proc $overlay_flags \
64 --system-resolvconf "$myimg" -- "$0" "kernel_from_mp" $vflags \
65 _MOUNTPOINT_ "--chown-to=$chown_to" \
66
67=== modified file 'bin/maas-cloudimg2ephemeral'
68--- bin/maas-cloudimg2ephemeral 2018-02-12 22:10:35 +0000
69+++ bin/maas-cloudimg2ephemeral 2018-07-09 18:38:41 +0000
70@@ -36,8 +36,8 @@
71 IMAGES_PPA_FILE="/etc/apt/sources.list.d/maas-ephemeral-images.list"
72 IMAGES_PPA_URL="http://ppa.launchpad.net/maas-maintainers/maas-ephemeral-images/ubuntu"
73
74-ARCHIVE_MIRROR="http://archive.ubuntu.com/ubuntu/"
75-ARCHIVE_MIRROR_PORTS="http://ports.ubuntu.com/ubuntu-ports/"
76+UBUNTU_MIRROR=${UBUNTU_MIRROR:-"http://archive.ubuntu.com/ubuntu/"}
77+UBUNTU_MIRROR_PORTS=${UBUNTU_MIRROR_PORTS:-"http://ports.ubuntu.com/ubuntu-ports/"}
78 PROPOSED_ARCHIVE_FILE="/etc/apt/sources.list.d/proposed.list"
79
80 VERBOSITY=0
81@@ -299,8 +299,8 @@
82 if $proposed; then
83 local mirror=""
84 case "$arch" in
85- i?86|amd64) mirror="$ARCHIVE_MIRROR";;
86- *) mirror="$ARCHIVE_MIRROR_PORTS";;
87+ i?86|amd64) mirror="${UBUNTU_MIRROR}";;
88+ *) mirror="${UBUNTU_MIRROR_PORTS}";;
89 esac
90 log_change true "$change [$arch $mirror]"
91 debug 1 "enabling proposed for $release [$arch $mirror]"

Subscribers

People subscribed via source and target branches