Merge ~ddstreet/ubuntu/+source/qemu:lp1887535-b into ubuntu/+source/qemu:ubuntu/bionic-devel

Proposed by Dan Streetman
Status: Needs review
Proposed branch: ~ddstreet/ubuntu/+source/qemu:lp1887535-b
Merge into: ubuntu/+source/qemu:ubuntu/bionic-devel
Diff against target: 313 lines (+280/-0)
4 files modified
debian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch (+269/-0)
debian/rules (+1/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  Pending
Review via email: mp+397989@code.launchpad.net
To post a comment you must log in.

Unmerged commits

6832da4... by Dan Streetman

update changelog

79d049c... by Dan Streetman

Backport configure param --with-git-submodules and set to 'ignore'

As we don't want to update to the latest git submodules since we need a
stable reproducable build, and the submodules are included in the
deb package source, this prevents updating or validating the git submodules.

This allows having a consistent build with or without a local .git directory.

LP: #1887535

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 9982d4d..32848ba 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+qemu (1:2.11+dfsg-1ubuntu7.36) UNRELEASED; urgency=medium
7+
8+ * d/p/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch,
9+ d/rules:
10+ Backport --with-git-submodules param so building from git repo
11+ doesn't fail (LP: #1887535)
12+
13+ -- Dan Streetman <ddstreet@canonical.com> Fri, 12 Feb 2021 06:45:08 -0500
14+
15 qemu (1:2.11+dfsg-1ubuntu7.35) bionic-security; urgency=medium
16
17 * SECURITY UPDATE: heap overread in iscsi_aio_ioctl_cb
18diff --git a/debian/patches/series b/debian/patches/series
19index d9e7d97..8073f61 100644
20--- a/debian/patches/series
21+++ b/debian/patches/series
22@@ -192,3 +192,4 @@ CVE-2020-28916.patch
23 CVE-2020-29443-1.patch
24 CVE-2020-29443-2.patch
25 CVE-2021-20181.patch
26+ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
27diff --git a/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch b/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
28new file mode 100644
29index 0000000..bb42051
30--- /dev/null
31+++ b/debian/patches/ubuntu/lp-1887535-configure-replace-enable-disable-git-update-with-wit.patch
32@@ -0,0 +1,269 @@
33+From 7d7dbf9dc15be6e1465c756c2c5ae7f1ab104fc8 Mon Sep 17 00:00:00 2001
34+From: Dan Streetman <ddstreet@canonical.com>
35+Date: Tue, 19 Jan 2021 12:20:46 -0500
36+Subject: [PATCH] configure: replace --enable/disable-git-update with
37+ --with-git-submodules
38+MIME-Version: 1.0
39+Content-Type: text/plain; charset=UTF-8
40+Content-Transfer-Encoding: 8bit
41+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1887535
42+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=7d7dbf9dc15be6e1465c756c2c5ae7f1ab104fc8
43+
44+Replace the --enable-git-update and --disable-git-update configure params
45+with the param --with-git-submodules=(update|validate|ignore) to
46+allow 3 options for building from a git repo.
47+
48+This is needed because downstream packagers, e.g. Debian, Ubuntu, etc,
49+also keep the source code in git, but do not want to enable the
50+'git_update' mode; with the current code, that's not possible even
51+if the downstream package specifies --disable-git-update.
52+
53+The previous parameters are deprecated but still available; the
54+--enable-git-update parameter maps to --with-git-submodules=update and
55+--disable-git-update parameter maps to --with-git-submodules=validate.
56+
57+The configure script behavior is slightly modified, where previously
58+the dtc, capstone, and slirp submodules were not validated when
59+--disable-git-update was specified (but were updated with git-update
60+enabled), now they are validated when using --with-git-submodules=validate
61+and are only ignored when using --with-git-submodules=ignore.
62+
63+Signed-off-by: Dan Streetman <ddstreet@canonical.com>
64+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
65+---
66+ Makefile | 24 ++-----------------
67+ configure | 51 ++++++++++++++++++++++++++++++----------
68+ scripts/git-submodule.sh | 34 ++++++++++++++++++++-------
69+ 3 files changed, 66 insertions(+), 43 deletions(-)
70+
71+--- a/Makefile
72++++ b/Makefile
73+@@ -14,33 +14,11 @@ ifneq ($(wildcard config-host.mak),)
74+ all:
75+ include config-host.mak
76+
77+-git-submodule-update:
78+-
79+ .PHONY: git-submodule-update
80+-
81+-git_module_status := $(shell \
82+- cd '$(SRC_PATH)' && \
83+- GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
84+- echo $$?; \
85+-)
86+-
87+-ifeq (1,$(git_module_status))
88+-ifeq (no,$(GIT_UPDATE))
89+-git-submodule-update:
90+- $(call quiet-command, \
91+- echo && \
92+- echo "GIT submodule checkout is out of date. Please run" && \
93+- echo " scripts/git-submodule.sh update $(GIT_SUBMODULES)" && \
94+- echo "from the source directory checkout $(SRC_PATH)" && \
95+- echo && \
96+- exit 1)
97+-else
98+ git-submodule-update:
99+ $(call quiet-command, \
100+- (cd $(SRC_PATH) && GIT="$(GIT)" ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
101+- "GIT","$(GIT_SUBMODULES)")
102+-endif
103+-endif
104++ (GIT="$(GIT)" "$(SRC_PATH)/scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)), \
105++ "GIT","$(GIT_SUBMODULES)")
106+
107+ .git-submodule-status: git-submodule-update config-host.mak
108+
109+--- a/configure
110++++ b/configure
111+@@ -267,10 +267,10 @@ stack_protector=""
112+
113+ if test -e "$source_path/.git"
114+ then
115+- git_update=yes
116++ git_submodules_action="update"
117+ git_submodules="ui/keycodemapdb"
118+ else
119+- git_update=no
120++ git_submodules_action="ignore"
121+ git_submodules=""
122+ fi
123+ git="git"
124+@@ -1314,9 +1314,16 @@ for opt do
125+ ;;
126+ --with-git=*) git="$optarg"
127+ ;;
128+- --enable-git-update) git_update=yes
129++ --enable-git-update)
130++ git_submodules_action="update"
131++ echo "--enable-git-update deprecated, use --with-git-submodules=update"
132++ ;;
133++ --disable-git-update)
134++ git_submodules_action="validate"
135++ echo "--disable-git-update deprecated, use --with-git-submodules=validate"
136+ ;;
137+- --disable-git-update) git_update=no
138++ --with-git-submodules=*)
139++ git_submodules_action="$optarg"
140+ ;;
141+ *)
142+ echo "ERROR: unknown option $opt"
143+@@ -1334,6 +1341,21 @@ if test "$vhost_user" = ""; then
144+ fi
145+ fi
146+
147++case $git_submodules_action in
148++ update|validate)
149++ if test ! -e "$source_path/.git"; then
150++ echo "ERROR: cannot $git_submodules_action git submodules without .git"
151++ exit 1
152++ fi
153++ ;;
154++ ignore)
155++ ;;
156++ *)
157++ echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'"
158++ exit 1
159++ ;;
160++esac
161++
162+ case "$cpu" in
163+ ppc)
164+ CPU_CFLAGS="-m32"
165+@@ -1442,6 +1464,10 @@ Advanced options (experts only):
166+ --install=INSTALL use specified install [$install]
167+ --python=PYTHON use specified python [$python]
168+ --smbd=SMBD use specified smbd [$smbd]
169++ --with-git=GIT use specified git [$git]
170++ --with-git-submodules=update update git submodules (default if .git dir exists)
171++ --with-git-submodules=validate fail if git submodules are not up to date
172++ --with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
173+ --static enable static build [$static]
174+ --mandir=PATH install man pages in PATH
175+ --datadir=PATH install firmware in PATH$confsuffix
176+@@ -1601,7 +1627,7 @@ fi
177+ # Consult white-list to determine whether to enable werror
178+ # by default. Only enable by default for git builds
179+ if test -z "$werror" ; then
180+- if test -d "$source_path/.git" -a \
181++ if test $git_submodules_action != 'ignore' -a \
182+ \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
183+ werror="yes"
184+ else
185+@@ -3667,10 +3693,10 @@ EOF
186+ fdt=yes
187+ else
188+ # have GIT checkout, so activate dtc submodule
189+- if test -e "${source_path}/.git" ; then
190++ if test $git_submodules_action != 'ignore' ; then
191+ git_submodules="${git_submodules} dtc"
192+ fi
193+- if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
194++ if test -d "${source_path}/dtc/libfdt" || test $git_submodules_action != 'ignore' ; then
195+ fdt=yes
196+ dtc_internal="yes"
197+ mkdir -p dtc
198+@@ -4461,7 +4487,7 @@ case "$capstone" in
199+ "" | yes)
200+ if $pkg_config capstone; then
201+ capstone=system
202+- elif test -e "${source_path}/.git" ; then
203++ elif test $git_submodules_action != 'ignore' ; then
204+ capstone=git
205+ elif test -e "${source_path}/capstone/Makefile" ; then
206+ capstone=internal
207+@@ -5629,7 +5655,7 @@ echo "qemu_localedir=$qemu_localedir" >>
208+ echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
209+ echo "GIT=$git" >> $config_host_mak
210+ echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
211+-echo "GIT_UPDATE=$git_update" >> $config_host_mak
212++echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
213+
214+ echo "ARCH=$ARCH" >> $config_host_mak
215+
216+--- a/scripts/git-submodule.sh
217++++ b/scripts/git-submodule.sh
218+@@ -9,9 +9,14 @@ command=$1
219+ shift
220+ maybe_modules="$@"
221+
222++# if --with-git-submodules=ignore, do nothing
223++test "$command" = "ignore" && exit 0
224++
225+ test -z "$GIT" && GIT=git
226+
227+-error() {
228++cd "$(dirname "$0")/.."
229++
230++update_error() {
231+ echo "$0: $*"
232+ echo
233+ echo "Unable to automatically checkout GIT submodules '$modules'."
234+@@ -24,7 +29,7 @@ error() {
235+ echo "Alternatively you may disable automatic GIT submodule checkout"
236+ echo "with:"
237+ echo
238+- echo " $ ./configure --disable-git-update'"
239++ echo " $ ./configure --with-git-submodules=validate"
240+ echo
241+ echo "and then manually update submodules prior to running make, with:"
242+ echo
243+@@ -33,6 +38,19 @@ error() {
244+ exit 1
245+ }
246+
247++validate_error() {
248++ if test "$1" = "validate"; then
249++ echo "GIT submodules checkout is out of date, and submodules"
250++ echo "configured for validate only. Please run"
251++ echo " scripts/git-submodule.sh update $maybe_modules"
252++ echo "from the source directory or call configure with"
253++ echo " --with-git-submodules=update"
254++ echo "To disable GIT submodules validation, use"
255++ echo " --with-git-submodules=ignore"
256++ fi
257++ exit 1
258++}
259++
260+ modules=""
261+ for m in $maybe_modules
262+ do
263+@@ -52,17 +70,18 @@ then
264+ fi
265+
266+ case "$command" in
267+-status)
268++status|validate)
269+ if test -z "$maybe_modules"
270+ then
271+- test -s ${substat} && exit 1 || exit 0
272++ test -s ${substat} && validate_error "$command" || exit 0
273+ fi
274+
275+- test -f "$substat" || exit 1
276+- CURSTATUS=`$GIT submodule status $modules`
277+- OLDSTATUS=`cat $substat`
278+- test "$CURSTATUS" = "$OLDSTATUS"
279+- exit $?
280++ test -f "$substat" || validate_error "$command"
281++ CURSTATUS=$($GIT submodule status $modules)
282++ OLDSTATUS=$(cat $substat)
283++ if test "$CURSTATUS" != "$OLDSTATUS"; then
284++ validate_error "$command"
285++ fi
286+ ;;
287+ update)
288+ if test -z "$maybe_modules"
289+@@ -72,10 +91,10 @@ update)
290+ fi
291+
292+ $GIT submodule update --init $modules 1>/dev/null
293+- test $? -ne 0 && error "failed to update modules"
294++ test $? -ne 0 && update_error "failed to update modules"
295+
296+ $GIT submodule status $modules > "${substat}"
297+- test $? -ne 0 && error "failed to save git submodule status" >&2
298++ test $? -ne 0 && update_error "failed to save git submodule status" >&2
299+ ;;
300+ esac
301+
302diff --git a/debian/rules b/debian/rules
303index 366d686..33a4954 100755
304--- a/debian/rules
305+++ b/debian/rules
306@@ -48,6 +48,7 @@ common_configure_opts = \
307 --disable-strip \
308 --interp-prefix=/etc/qemu-binfmt/%M \
309 --localstatedir=/var \
310+ --with-git-submodules=ignore \
311
312 # Cross compiling support
313 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))

Subscribers

People subscribed via source and target branches