Merge lp:~mwhudson/live-build/x-build-linaro into lp:~linaro-maintainers/live-build/trunk

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 17
Proposed branch: lp:~mwhudson/live-build/x-build-linaro
Merge into: lp:~linaro-maintainers/live-build/trunk
Diff against target: 189 lines (+60/-36)
3 files modified
functions/architecture.sh (+43/-24)
scripts/build/bootstrap_cache (+1/-1)
scripts/build/bootstrap_debootstrap (+16/-11)
To merge this branch: bzr merge lp:~mwhudson/live-build/x-build-linaro
Reviewer Review Type Date Requested Status
Linaro Maintainers Pending
Review via email: mp+42803@code.launchpad.net

Description of the change

Hi,

This branch changes live-build to use qemu-debootstrap when cross building. I've talked about most of the changes to Loic and Steve at some point, I think. We'll probably use this in the linaro offspring install until some panda's turn up.

There isn't interest in this upstream at the moment (apparently "live-build 3.0" will only support multistrap, which noone seems to think is a particularly good idea, but...), so I'm not too worried about the fact that the functions in functions/architecture.sh are still a bit unclear.

Cheers,
mwh

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Hi,

The code looks fine to me, and the changes aren't intrusive, so I'm happy with this.

166 - ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}"
167 + ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" ${LH_DEBOOTSTRAP_SCRIPT:+"$LH_DEBOOTSTRAP_SCRIPT"}

That doesn't use $DEBOOTSTRAP, is that intentional?

Thanks,

James

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

On Mon, 06 Dec 2010 20:42:54 -0000, James Westby <email address hidden> wrote:
> Hi,
>
> The code looks fine to me, and the changes aren't intrusive, so I'm happy with this.
>
> 166 - ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}"
> 167 + ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" ${LH_DEBOOTSTRAP_SCRIPT:+"$LH_DEBOOTSTRAP_SCRIPT"}
>
> That doesn't use $DEBOOTSTRAP, is that intentional?

Yes, qemu-debootstrap doesn't really support --download-only. I guess
this is a bug, but given what it does "qemu-debootstrap --download-only"
doesn't really make a whole lot of sense. I guess I should include this
as a comment in the source :-)

Cheers,
mwh

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'functions/architecture.sh'
2--- functions/architecture.sh 2010-10-22 02:20:39 +0000
3+++ functions/architecture.sh 2010-12-05 23:39:57 +0000
4@@ -7,7 +7,38 @@
5 # This is free software, and you are welcome to redistribute it
6 # under certain conditions; see COPYING for details.
7
8-Check_architecture ()
9+Native_arches ()
10+{
11+ if [ -x /usr/bin/dpkg ]
12+ then
13+ HOST="$(dpkg --print-architecture)"
14+ else
15+ HOST="$(uname -m)"
16+ fi
17+
18+ case "${HOST}" in
19+ amd64|i386|x86_64)
20+ CROSS="amd64 i386"
21+ ;;
22+
23+ powerpc|ppc64)
24+ CROSS="powerpc ppc64"
25+ ;;
26+
27+ *)
28+ CROSS="${HOST}"
29+ ;;
30+ esac
31+
32+ echo $CROSS
33+}
34+
35+Native_building ()
36+{
37+ Host_architecture `Native_arches`
38+}
39+
40+Host_architecture ()
41 {
42 ARCHITECTURES="${@}"
43 VALID="false"
44@@ -23,35 +54,23 @@
45
46 if [ "${VALID}" = "false" ]
47 then
48+ return 1
49+ else
50+ return 0
51+ fi
52+}
53+
54+Check_architecture ()
55+{
56+ Host_architecture "${@}" || {
57 Echo_warning "skipping %s, foreign architecture." "${0}"
58 exit 0
59- fi
60+ }
61 }
62
63 Check_crossarchitecture ()
64 {
65- if [ -x /usr/bin/dpkg ]
66- then
67- HOST="$(dpkg --print-architecture)"
68- else
69- HOST="$(uname -m)"
70- fi
71-
72- case "${HOST}" in
73- amd64|i386|x86_64)
74- CROSS="amd64 i386"
75- ;;
76-
77- powerpc|ppc64)
78- CROSS="powerpc ppc64"
79- ;;
80-
81- *)
82- CROSS="${HOST}"
83- ;;
84- esac
85-
86- Check_architecture "${CROSS}"
87+ Check_architecture `Native_arches`
88 }
89
90 Check_multiarchitecture ()
91
92=== modified file 'scripts/build/bootstrap_cache'
93--- scripts/build/bootstrap_cache 2010-07-24 17:22:56 +0000
94+++ scripts/build/bootstrap_cache 2010-12-05 23:39:57 +0000
95@@ -24,7 +24,7 @@
96 Set_defaults
97
98 # Check architecture
99-Check_crossarchitecture
100+#Check_crossarchitecture
101
102 Echo_message "Begin caching bootstrap stage..."
103
104
105=== modified file 'scripts/build/bootstrap_debootstrap'
106--- scripts/build/bootstrap_debootstrap 2010-07-24 17:22:56 +0000
107+++ scripts/build/bootstrap_debootstrap 2010-12-05 23:39:57 +0000
108@@ -29,12 +29,17 @@
109 fi
110
111 # Check architecture
112-Check_crossarchitecture
113+if Native_building
114+then
115+ Check_package /usr/sbin/debootstrap debootstrap
116+ DEBOOTSTRAP=debootstrap
117+else
118+ Check_package /usr/bin/qemu-debootstrap qemu-kvm-extras-static
119+ DEBOOTSTRAP=qemu-debootstrap
120+fi
121
122 Echo_message "Begin bootstrapping system..."
123
124-Check_package /usr/sbin/debootstrap debootstrap
125-
126 # Ensure that a system is built as root
127 lh testroot
128
129@@ -60,7 +65,7 @@
130 if [ "${LH_ARCHIVE_AREAS}" != "main" ]
131 then
132 # Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas
133- DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components $(echo ${LH_ARCHIVE_AREAS} | sed -e 's| |,|g')"
134+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components=$(echo ${LH_ARCHIVE_AREAS} | sed -e 's| |,|g')"
135 fi
136
137 if [ -n "${LH_BOOTSTRAP_CONFIG}" ]
138@@ -75,12 +80,12 @@
139
140 if [ -n "${LH_BOOTSTRAP_INCLUDE}" ]
141 then
142- DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=$(echo ${LH_BOOTSTRAP_INCLUDE} | sed 's| *|,|g')"
143+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=$(echo ${LH_BOOTSTRAP_INCLUDE} | sed 's| *|,|g')"
144 fi
145
146 if [ -n "${LH_BOOTSTRAP_EXCLUDE}" ]
147 then
148- DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LH_BOOTSTRAP_EXCLUDE} | sed 's| *|,|g')"
149+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LH_BOOTSTRAP_EXCLUDE} | sed 's| *|,|g')"
150 fi
151
152 if [ "${LH_USE_FAKEROOT}" != "true" ]
153@@ -112,7 +117,7 @@
154 DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --verbose"
155 fi
156
157-if [ -x "/usr/sbin/debootstrap" ]
158+if [ -x `which $DEBOOTSTRAP` ]
159 then
160 if [ "${LH_CACHE_PACKAGES}" = "true" ]
161 then
162@@ -123,7 +128,7 @@
163 fi
164
165 Echo_breakage "Running debootstrap (download-only)... "
166- ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}"
167+ ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" ${LH_DEBOOTSTRAP_SCRIPT:+"$LH_DEBOOTSTRAP_SCRIPT"}
168
169 if [ -n "${LH_ROOT_COMMAND}" ]
170 then
171@@ -138,8 +143,8 @@
172 cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap
173 fi
174
175- Echo_breakage "Running debootstrap... "
176- ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}"
177+ Echo_breakage "Running $DEBOOTSTRAP... "
178+ ${LH_ROOT_COMMAND} $DEBOOTSTRAP ${DEBOOTSTRAP_OPTIONS} "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" ${LH_DEBOOTSTRAP_SCRIPT:+"$LH_DEBOOTSTRAP_SCRIPT"}
179
180 if [ -n "${LH_ROOT_COMMAND}" ]
181 then
182@@ -152,6 +157,6 @@
183 # Creating stage file
184 Create_stagefile .stage/bootstrap
185 else
186- Echo_error "Can't process file /usr/bin/debootstrap (FIXME)"
187+ Echo_error "Can't process file $DEBOOTSTRAP (FIXME)"
188 exit 1
189 fi

Subscribers

People subscribed via source and target branches