Merge ~paelzer/ubuntu/+source/qemu:bug-1847361-miss-old-so-on-upgrade-UBUNTU into ubuntu/+source/qemu:ubuntu/focal-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: ad0f21064f29657820c35ae301180758afc3ee9e
Merge reported by: Christian Ehrhardt 
Merged at revision: ad0f21064f29657820c35ae301180758afc3ee9e
Proposed branch: ~paelzer/ubuntu/+source/qemu:bug-1847361-miss-old-so-on-upgrade-UBUNTU
Merge into: ubuntu/+source/qemu:ubuntu/focal-devel
Diff against target: 483 lines (+392/-0)
9 files modified
debian/changelog (+14/-0)
debian/patches/series (+2/-0)
debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch (+125/-0)
debian/patches/ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch (+61/-0)
debian/qemu-block-extra.postrm.in (+43/-0)
debian/qemu-block-extra.prerm.in (+45/-0)
debian/qemu-system-gui.postrm.in (+44/-0)
debian/qemu-system-gui.prerm.in (+46/-0)
debian/rules (+12/-0)
Reviewer Review Type Date Requested Status
Rafael David Tinoco (community) Approve
Ubuntu Security Team Pending
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+380467@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

I'll review this one

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

New builds in the PPA following the upstream discussion.
No "major" changes thou, never the less I'll force push the updates to be available here as well.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

From the build log:
base build:
module support yes
alt path mod load yes

static/xen/microvm build:
module support no
alt path mod load no

This is just as I wanted it and shows that it works to build in both cases.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

STATUS: +1 (approved)

# checklist for fixes
----------------------------
 [.] changelog entry correct, targeted to correct codename
 [.] update-maintainer has been run previously
 ----
 [.] changes forwarded upstream/debian (if appropriate)
 [.] patches match what was proposed upstream
 ----
 [.] patches correctly included in debian/patches/series?
 [.] patches have correct DEP3 metadata
 ----
 [.] verified dpkg-buildpackage -S and -b
 [-] autopkgtest against PPA or built package passes
     - relying in upgrade test for this change only
 ----
 [!] testcase provided
     - checking temporary created library dirs ant contents
 [.] was able to reproduce
 [.] fix solved provided testcase
----------------------------
[.] = ok
[x] = not ok
[?] = question
[!] = note
[-] = n/a

# relevant stdout:

(c)rafaeldtinoco@qemudevel:.../Debian_1_4.2-3ubuntu2$ ls -lahtr
total 1.3M
drwxr-xr-x 3 root root 60 Mar 10 20:54 ..
drwxr-xr-x 2 root root 160 Mar 10 20:54 .
-rw-r--r-- 1 root root 591K Mar 10 23:28 ui-gtk.so
-rw-r--r-- 1 root root 73K Mar 10 23:28 audio-pa.so
-rw-r--r-- 1 root root 181K Mar 10 23:28 block-iscsi.so
-rw-r--r-- 1 root root 151K Mar 10 23:28 block-curl.so
-rw-r--r-- 1 root root 155K Mar 10 23:28 block-ssh.so
-rw-r--r-- 1 root root 122K Mar 10 23:28 block-rbd.so
(c)rafaeldtinoco@qemudevel:.../Debian_1_4.2-3ubuntu2$ pwd
/var/run/qemu/Debian_1_4.2-3ubuntu2

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for this pre-check.
Lets see how the upstream discussion evolves the next few days.

4683e8d... by Christian Ehrhardt 

changelog MEGRE

Signed-off-by: Christian Ehrhardt <email address hidden>

dbe2005... by Christian Ehrhardt 

d/rules: generate maintainer scripts matching package version

Signed-off-by: Christian Ehrhardt <email address hidden>

7d44fb3... by Christian Ehrhardt 

d/rules: enable --enable-module-upgrades where --enable-modules is set

Signed-off-by: Christian Ehrhardt <email address hidden>

2212796... by Christian Ehrhardt 

d/p/ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch: avoid unnecessary IOTLB transactions (LP: #1866207)

Signed-off-by: Christian Ehrhardt <email address hidden>

9eea3bd... by Christian Ehrhardt 

cahngelog: avoid unnecessary IOTLB transactions (LP: #1866207)

Signed-off-by: Christian Ehrhardt <email address hidden>

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Another set of pre-builds and checks is good

To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/qemu
 * [new tag] upload/1%4.2-3ubuntu2 -> upload/1%4.2-3ubuntu2

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading qemu_4.2-3ubuntu2.dsc: done.
  Uploading qemu_4.2-3ubuntu2.debian.tar.xz: done.
  Uploading qemu_4.2-3ubuntu2_source.buildinfo: done.
  Uploading qemu_4.2-3ubuntu2_source.changes: done.
Successfully uploaded packages.

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 89089bb..d73be7f 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,17 @@
6+qemu (1:4.2-3ubuntu2) focal; urgency=medium
7+
8+ * allow qemu to load old modules post upgrade (LP: #1847361)
9+ - d/p/ubuntu/lp-1847361-modules-load-upgrade.patch: to fallback module
10+ load to a versioned path
11+ - d/qemu-block-extra.*.in, d/qemu-system-gui.*.in: save shared objects on
12+ upgrade
13+ - d/rules: generate maintainer scripts matching package version on build
14+ - d/rules: enable --enable-module-upgrades where --enable-modules is set
15+ * d/p/ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch:
16+ avoid unnecessary IOTLB transactions (LP: #1866207)
17+
18+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 02 Mar 2020 15:21:27 +0100
19+
20 qemu (1:4.2-3ubuntu1) focal; urgency=medium
21
22 * Merge with Debian testing, remaining changes:
23diff --git a/debian/patches/series b/debian/patches/series
24index c9fce99..2371880 100644
25--- a/debian/patches/series
26+++ b/debian/patches/series
27@@ -13,3 +13,5 @@ ubuntu/lp-1857033-i386-Add-macro-for-stibp.patch
28 ubuntu/lp-1857033-i386-Add-new-CPU-model-Cooperlake.patch
29 lp-1859527-virtio-blk-fix-out-of-bounds-access-to-bitmap-in-not.patch
30 ubuntu/vhost-user-gpu-Drop-trailing-json-comma.patch
31+ubuntu/lp-1847361-modules-load-upgrade.patch
32+ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch
33diff --git a/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch
34new file mode 100644
35index 0000000..056f2e0
36--- /dev/null
37+++ b/debian/patches/ubuntu/lp-1847361-modules-load-upgrade.patch
38@@ -0,0 +1,125 @@
39+From ab7e28b0905b1e2daeb5d582cf0f0ce33ea47317 Mon Sep 17 00:00:00 2001
40+From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
41+Date: Mon, 2 Mar 2020 15:12:53 +0100
42+Subject: [PATCH] modules: load modules from versioned /var/run dir
43+
44+On upgrades the old .so files usually are replaced. But on the other
45+hand since a qemu process represents a guest instance it is usually kept
46+around.
47+
48+That makes late addition of dynamic features e.g. 'hot-attach of a ceph
49+disk' fail by trying to load a new version of e.f. block-rbd.so into an
50+old still running qemu binary.
51+
52+This adds a fallback to also load modules from a versioned directory in the
53+temporary /var/run path. That way qemu is providing a way for packaging
54+to store modules of an upgraded qemu package as needed until the next reboot.
55+
56+Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1847361
57+Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
58+
59+Forwarded: yes, https://lists.nongnu.org/archive/html/qemu-devel/2020-03/msg01593.html
60+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1847361
61+Last-Update: 2020-03-02
62+
63+---
64+ configure | 15 +++++++++++++++
65+ util/module.c | 14 ++++++++++++++
66+ 2 files changed, 29 insertions(+)
67+
68+--- a/configure
69++++ b/configure
70+@@ -404,6 +404,7 @@ EXESUF=""
71+ DSOSUF=".so"
72+ LDFLAGS_SHARED="-shared"
73+ modules="no"
74++module_upgrades="no"
75+ prefix="/usr/local"
76+ mandir="\${prefix}/share/man"
77+ datadir="\${prefix}/share"
78+@@ -995,6 +996,10 @@ for opt do
79+ --disable-modules)
80+ modules="no"
81+ ;;
82++ --disable-module-upgrades) module_upgrades="no"
83++ ;;
84++ --enable-module-upgrades) module_upgrades="yes"
85++ ;;
86+ --cpu=*)
87+ ;;
88+ --target-list=*) target_list="$optarg"
89+@@ -1735,6 +1740,7 @@ disabled with --disable-FEATURE, default
90+ guest-agent-msi build guest agent Windows MSI installation package
91+ pie Position Independent Executables
92+ modules modules support (non-Windows)
93++ module-upgrades try to load modules from alternate paths for upgrades
94+ debug-tcg TCG debugging (default is disabled)
95+ debug-info debugging information
96+ sparse sparse checker
97+@@ -1995,6 +2001,11 @@ if test "$modules" = "yes" && test "$min
98+ error_exit "Modules are not available for Windows"
99+ fi
100+
101++# module_upgrades is only reasonable if modules are enabled
102++if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
103++ error_exit "Can't enable module-upgrades as Modules are not enabled"
104++fi
105++
106+ # Static linking is not possible with modules or PIE
107+ if test "$static" = "yes" ; then
108+ if test "$modules" = "yes" ; then
109+@@ -6457,6 +6468,7 @@ if test "$slirp" != "no" ; then
110+ echo "smbd $smbd"
111+ fi
112+ echo "module support $modules"
113++echo "alt path mod load $module_upgrades"
114+ echo "host CPU $cpu"
115+ echo "host big endian $bigendian"
116+ echo "target list $target_list"
117+@@ -6814,6 +6826,9 @@ if test "$modules" = "yes"; then
118+ echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
119+ echo "CONFIG_MODULES=y" >> $config_host_mak
120+ fi
121++if test "$module_upgrades" = "yes"; then
122++ echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
123++fi
124+ if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
125+ echo "CONFIG_X11=y" >> $config_host_mak
126+ echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
127+--- a/util/module.c
128++++ b/util/module.c
129+@@ -19,6 +19,9 @@
130+ #endif
131+ #include "qemu/queue.h"
132+ #include "qemu/module.h"
133++#ifdef CONFIG_MODULE_UPGRADES
134++#include "qemu-version.h"
135++#endif
136+
137+ typedef struct ModuleEntry
138+ {
139+@@ -163,6 +166,9 @@ bool module_load_one(const char *prefix,
140+ #ifdef CONFIG_MODULES
141+ char *fname = NULL;
142+ char *exec_dir;
143++#ifdef CONFIG_MODULE_UPGRADES
144++ char *version_dir;
145++#endif
146+ const char *search_dir;
147+ char *dirs[4];
148+ char *module_name;
149+@@ -194,6 +200,14 @@ bool module_load_one(const char *prefix,
150+ dirs[n_dirs++] = g_strdup_printf("%s", CONFIG_QEMU_MODDIR);
151+ dirs[n_dirs++] = g_strdup_printf("%s/..", exec_dir ? : "");
152+ dirs[n_dirs++] = g_strdup_printf("%s", exec_dir ? : "");
153++
154++#ifdef CONFIG_MODULE_UPGRADES
155++ version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
156++ G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
157++ '_');
158++ dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
159++#endif
160++
161+ assert(n_dirs <= ARRAY_SIZE(dirs));
162+
163+ g_free(exec_dir);
164diff --git a/debian/patches/ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch b/debian/patches/ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch
165new file mode 100644
166index 0000000..6ef5d49
167--- /dev/null
168+++ b/debian/patches/ubuntu/lp-1847361-vhost-correctly-turn-on-VIRTIO_F_IOMMU_PLATFORM.patch
169@@ -0,0 +1,61 @@
170+From f7ef7e6e3ba6e994e070cc609eb154339d1c4a11 Mon Sep 17 00:00:00 2001
171+From: Jason Wang <jasowang@redhat.com>
172+Date: Mon, 2 Mar 2020 12:24:54 +0800
173+Subject: [PATCH] vhost: correctly turn on VIRTIO_F_IOMMU_PLATFORM
174+
175+We turn on device IOTLB via VIRTIO_F_IOMMU_PLATFORM unconditionally on
176+platform without IOMMU support. This can lead unnecessary IOTLB
177+transactions which will damage the performance.
178+
179+Fixing this by check whether the device is backed by IOMMU and disable
180+device IOTLB.
181+
182+Reported-by: Halil Pasic <pasic@linux.ibm.com>
183+Tested-by: Halil Pasic <pasic@linux.ibm.com>
184+Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
185+Signed-off-by: Jason Wang <jasowang@redhat.com>
186+Message-Id: <20200302042454.24814-1-jasowang@redhat.com>
187+Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
188+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
189+
190+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=f7ef7e6e3ba6e994e070cc609eb154339d1c4a11
191+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1847361
192+Last-Update: 2020-03-13
193+
194+---
195+ hw/virtio/vhost.c | 12 +++++++++++-
196+ 1 file changed, 11 insertions(+), 1 deletion(-)
197+
198+diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
199+index 0d226dae10..01ebe12f28 100644
200+--- a/hw/virtio/vhost.c
201++++ b/hw/virtio/vhost.c
202+@@ -290,7 +290,14 @@ static int vhost_dev_has_iommu(struct vhost_dev *dev)
203+ {
204+ VirtIODevice *vdev = dev->vdev;
205+
206+- return virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);
207++ /*
208++ * For vhost, VIRTIO_F_IOMMU_PLATFORM means the backend support
209++ * incremental memory mapping API via IOTLB API. For platform that
210++ * does not have IOMMU, there's no need to enable this feature
211++ * which may cause unnecessary IOTLB miss/update trnasactions.
212++ */
213++ return vdev->dma_as != &address_space_memory &&
214++ virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);
215+ }
216+
217+ static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr,
218+@@ -765,6 +772,9 @@ static int vhost_dev_set_features(struct vhost_dev *dev,
219+ if (enable_log) {
220+ features |= 0x1ULL << VHOST_F_LOG_ALL;
221+ }
222++ if (!vhost_dev_has_iommu(dev)) {
223++ features &= ~(0x1ULL << VIRTIO_F_IOMMU_PLATFORM);
224++ }
225+ r = dev->vhost_ops->vhost_set_features(dev, features);
226+ if (r < 0) {
227+ VHOST_OPS_DEBUG("vhost_set_features failed");
228+--
229+2.25.1
230+
231diff --git a/debian/qemu-block-extra.postrm.in b/debian/qemu-block-extra.postrm.in
232new file mode 100644
233index 0000000..ef2126a
234--- /dev/null
235+++ b/debian/qemu-block-extra.postrm.in
236@@ -0,0 +1,43 @@
237+#!/bin/sh
238+# postrm script for brrr
239+#
240+# see: dh_installdeb(1)
241+
242+set -e
243+
244+# summary of how this script can be called:
245+# * <postrm> `remove'
246+# * <postrm> `purge'
247+# * <old-postrm> `upgrade' <new-version>
248+# * <new-postrm> `failed-upgrade' <old-version>
249+# * <new-postrm> `abort-install'
250+# * <new-postrm> `abort-install' <old-version>
251+# * <new-postrm> `abort-upgrade' <old-version>
252+# * <disappearer's-postrm> `disappear' <overwriter>
253+# <overwriter-version>
254+# for details, see https://www.debian.org/doc/debian-policy/ or
255+# the debian-policy package
256+
257+
258+case "$1" in
259+ purge|remove)
260+ # remove .so files for still running qemu instances in /var/run
261+ # for details see bug LP: #1847361
262+ rm -f /var/run/qemu/@PKGVERSION@/block-*.so
263+ ;;
264+
265+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
266+ ;;
267+
268+ *)
269+ echo "postrm called with unknown argument \`$1'" >&2
270+ exit 1
271+ ;;
272+esac
273+
274+# dh_installdeb will replace this with shell code automatically
275+# generated by other debhelper scripts.
276+
277+#DEBHELPER#
278+
279+exit 0
280diff --git a/debian/qemu-block-extra.prerm.in b/debian/qemu-block-extra.prerm.in
281new file mode 100644
282index 0000000..dee25a8
283--- /dev/null
284+++ b/debian/qemu-block-extra.prerm.in
285@@ -0,0 +1,45 @@
286+#!/bin/sh
287+# prerm script for qemu-block-extra
288+#
289+# see: dh_installdeb(1)
290+
291+set -e
292+
293+# summary of how this script can be called:
294+# * <prerm> `remove'
295+# * <old-prerm> `upgrade' <new-version>
296+# * <new-prerm> `failed-upgrade' <old-version>
297+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
298+# * <deconfigured's-prerm> `deconfigure' `in-favour'
299+# <package-being-installed> <version> `removing'
300+# <conflicting-package> <version>
301+# for details, see https://www.debian.org/doc/debian-policy/ or
302+# the debian-policy package
303+
304+
305+case "$1" in
306+ remove)
307+ ;;
308+
309+ upgrade|deconfigure)
310+ # retain .so files for still running qemu instances in /var/run
311+ # for details see bug LP: #1847361
312+ mkdir -p /var/run/qemu/@PKGVERSION@
313+ cp /usr/lib/@ARCH@/qemu/block-*.so /var/run/qemu/@PKGVERSION@/
314+ ;;
315+
316+ failed-upgrade)
317+ ;;
318+
319+ *)
320+ echo "prerm called with unknown argument \`$1'" >&2
321+ exit 1
322+ ;;
323+esac
324+
325+# dh_installdeb will replace this with shell code automatically
326+# generated by other debhelper scripts.
327+
328+#DEBHELPER#
329+
330+exit 0
331diff --git a/debian/qemu-system-gui.postrm.in b/debian/qemu-system-gui.postrm.in
332new file mode 100644
333index 0000000..48c740a
334--- /dev/null
335+++ b/debian/qemu-system-gui.postrm.in
336@@ -0,0 +1,44 @@
337+#!/bin/sh
338+# postrm script for brrr
339+#
340+# see: dh_installdeb(1)
341+
342+set -e
343+
344+# summary of how this script can be called:
345+# * <postrm> `remove'
346+# * <postrm> `purge'
347+# * <old-postrm> `upgrade' <new-version>
348+# * <new-postrm> `failed-upgrade' <old-version>
349+# * <new-postrm> `abort-install'
350+# * <new-postrm> `abort-install' <old-version>
351+# * <new-postrm> `abort-upgrade' <old-version>
352+# * <disappearer's-postrm> `disappear' <overwriter>
353+# <overwriter-version>
354+# for details, see https://www.debian.org/doc/debian-policy/ or
355+# the debian-policy package
356+
357+
358+case "$1" in
359+ purge|remove)
360+ # remove .so files for still running qemu instances in /var/run
361+ # for details see bug LP: #1847361
362+ rm -f /var/run/qemu/@PKGVERSION@/ui-gtk.so
363+ rm -f /var/run/qemu/@PKGVERSION@/audio-*.so
364+ ;;
365+
366+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
367+ ;;
368+
369+ *)
370+ echo "postrm called with unknown argument \`$1'" >&2
371+ exit 1
372+ ;;
373+esac
374+
375+# dh_installdeb will replace this with shell code automatically
376+# generated by other debhelper scripts.
377+
378+#DEBHELPER#
379+
380+exit 0
381diff --git a/debian/qemu-system-gui.prerm.in b/debian/qemu-system-gui.prerm.in
382new file mode 100644
383index 0000000..3624362
384--- /dev/null
385+++ b/debian/qemu-system-gui.prerm.in
386@@ -0,0 +1,46 @@
387+#!/bin/sh
388+# prerm script for qemu-system-gui
389+#
390+# see: dh_installdeb(1)
391+
392+set -e
393+
394+# summary of how this script can be called:
395+# * <prerm> `remove'
396+# * <old-prerm> `upgrade' <new-version>
397+# * <new-prerm> `failed-upgrade' <old-version>
398+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
399+# * <deconfigured's-prerm> `deconfigure' `in-favour'
400+# <package-being-installed> <version> `removing'
401+# <conflicting-package> <version>
402+# for details, see https://www.debian.org/doc/debian-policy/ or
403+# the debian-policy package
404+
405+
406+case "$1" in
407+ remove)
408+ ;;
409+
410+ upgrade|deconfigure)
411+ # retain .so files for still running qemu instances in /var/run
412+ # for details see bug LP: #1847361
413+ mkdir -p /var/run/qemu/@PKGVERSION@
414+ cp /usr/lib/@ARCH@/qemu/ui-gtk.so /var/run/qemu/@PKGVERSION@/
415+ cp /usr/lib/@ARCH@/qemu/audio-*.so /var/run/qemu/@PKGVERSION@/
416+ ;;
417+
418+ failed-upgrade)
419+ ;;
420+
421+ *)
422+ echo "prerm called with unknown argument \`$1'" >&2
423+ exit 1
424+ ;;
425+esac
426+
427+# dh_installdeb will replace this with shell code automatically
428+# generated by other debhelper scripts.
429+
430+#DEBHELPER#
431+
432+exit 0
433diff --git a/debian/rules b/debian/rules
434index 1604d33..58ed6ea 100755
435--- a/debian/rules
436+++ b/debian/rules
437@@ -15,6 +15,9 @@ else
438 VENDOR := DEBIAN
439 endif
440
441+AUTOGENERATED:= qemu-block-extra.prerm qemu-block-extra.postrm qemu-system-gui.prerm qemu-system-gui.postrm
442+PKGVERSION := $(shell printf "Debian ${DEB_VERSION}" | tr --complement '[:alnum:]+-.~' '_')
443+
444 # support parallel build using DEB_BUILD_OPTIONS=parallel=N
445 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
446 MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
447@@ -103,6 +106,12 @@ endif # enable_linux_user
448 b/configure-stamp: configure
449 dh_testdir
450
451+ for f in ${AUTOGENERATED} ; do \
452+ sed -e 's%@ARCH@%${DEB_HOST_MULTIARCH}%g' \
453+ -e 's%@PKGVERSION@%${PKGVERSION}%g' \
454+ < debian/$$f.in > debian/$$f ; \
455+ done
456+
457 # system build
458 rm -rf b/qemu; mkdir -p b/qemu
459 cd b/qemu && \
460@@ -111,6 +120,7 @@ b/configure-stamp: configure
461 --${enable_linux_user}-linux-user \
462 --disable-xen \
463 --enable-modules \
464+ --enable-module-upgrades \
465 $(shell sh debian/extract-config-opts \
466 $(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH) debian/control) \
467 $(QEMU_CONFIGURE_OPTIONS) || \
468@@ -137,6 +147,7 @@ ifneq ($(filter $(DEB_HOST_ARCH),amd64 i386),)
469 --enable-xen \
470 --target-list="aarch64-softmmu arm-softmmu i386-softmmu x86_64-softmmu"
471 --enable-modules \
472+ --enable-module-upgrades \
473 $(shell sh debian/extract-config-opts \
474 $(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH) debian/control) \
475 $(QEMU_CONFIGURE_OPTIONS) || \
476@@ -489,6 +500,7 @@ clean: debian/control
477 rm -rf b
478 find scripts/ -name '*.pyc' -delete || :
479 rm -f debian/qemu-user.1
480+ rm -f $(patsubst %, debian/%, ${AUTOGENERATED})
481 dh_clean
482
483 .PHONY: build clean binary-arch binary-indep binary build-arch build-indep build

Subscribers

People subscribed via source and target branches