Accepting request 239452 from home:a_faerber:branches:Virtualization

Make block-curl.so available independent of qemu package, for the benefit of Xen (bnc#882008), and update Git script

OBS-URL: https://build.opensuse.org/request/show/239452
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=215
This commit is contained in:
Andreas Färber 2014-07-03 13:15:40 +00:00 committed by Git OBS Bridge
parent 5645dec724
commit 492abd0d82
7 changed files with 254 additions and 88 deletions

View File

@ -0,0 +1,41 @@
From 212b80fa19390023a809068c5d282e2994bd98bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Fri, 20 Jun 2014 16:46:50 +0200
Subject: [PATCH] module: Simplify module_load()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The file path is not used for error reporting, so we can free it
directly after use.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
util/module.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/util/module.c b/util/module.c
index 214effb..9fd3030 100644
--- a/util/module.c
+++ b/util/module.c
@@ -202,18 +202,16 @@ static void module_load(module_init_type type)
for (i = 0; i < ARRAY_SIZE(dirs); i++) {
fname = g_strdup_printf("%s/%s%s", dirs[i], *mp, HOST_DSOSUF);
ret = module_load_file(fname);
+ g_free(fname);
+ fname = NULL;
/* Try loading until loaded a module file */
if (!ret) {
break;
}
- g_free(fname);
- fname = NULL;
}
if (ret == -ENOENT) {
fprintf(stderr, "Can't find module: %s\n", *mp);
}
-
- g_free(fname);
}
for (i = 0; i < ARRAY_SIZE(dirs); i++) {

View File

@ -0,0 +1,38 @@
From 14cd25c73de420d01acd3f0691e1d663dcf3eca9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Fri, 20 Jun 2014 17:54:51 +0200
Subject: [PATCH] module: Don't complain when a module is absent
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The current implementation depends on a configure-time generated list of
block modules. When any of them is absent, module_load() emits a warning.
This is suboptimal because extracting code to modules was mainly done to
allow separate packaging of modules with intrusive dependencies. Absence
of optional packages then leads to absence of modules and an error
message, which users may recognize as new and report as error.
Cc: Fam Zheng <famz@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
util/module.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/util/module.c b/util/module.c
index 9fd3030..4bd4a94 100644
--- a/util/module.c
+++ b/util/module.c
@@ -209,9 +209,6 @@ static void module_load(module_init_type type)
break;
}
}
- if (ret == -ENOENT) {
- fprintf(stderr, "Can't find module: %s\n", *mp);
- }
}
for (i = 0; i < ARRAY_SIZE(dirs); i++) {

View File

@ -95,6 +95,8 @@ Patch0067: 0067-openpic-avoid-buffer-overrun-on-inc.patch
Patch0068: 0068-virtio-net-out-of-bounds-buffer-wri.patch
Patch0069: 0069-virtio-validate-config_len-on-load.patch
Patch0070: 0070-virtio-allow-mapping-up-to-max-queu.patch
Patch0071: 0071-module-Simplify-module_load.patch
Patch0072: 0072-module-Don-t-complain-when-a-module.patch
# Please do not add patches manually here, run update_git.sh.
# this is to make lint happy
Source300: rpmlintrc
@ -218,6 +220,8 @@ run cross-architecture builds.
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%build
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Jun 23 21:42:31 UTC 2014 - afaerber@suse.de
- Move block-curl.so to new qemu-block-curl package, avoiding a
dependency of qemu-tools on qemu for Xen (bnc#882008)
* Avoid the reported error message about missing modules
0071-module-Simplify-module_load.patch
0072-module-Don-t-complain-when-a-module.patch
- Improve update_git.sh performance (backport from SLE12)
-------------------------------------------------------------------
Mon Jun 2 13:26:13 UTC 2014 - brogers@suse.com

View File

@ -124,6 +124,8 @@ Patch0067: 0067-openpic-avoid-buffer-overrun-on-inc.patch
Patch0068: 0068-virtio-net-out-of-bounds-buffer-wri.patch
Patch0069: 0069-virtio-validate-config_len-on-load.patch
Patch0070: 0070-virtio-allow-mapping-up-to-max-queu.patch
Patch0071: 0071-module-Simplify-module_load.patch
Patch0072: 0072-module-Don-t-complain-when-a-module.patch
# Please do not add patches manually here, run update_git.sh.
# roms/ipxe patches
@ -221,6 +223,7 @@ BuildRequires: spice-protocol-devel
Requires: /usr/sbin/groupadd
Requires: pwdutils
Requires: timezone
Recommends: qemu-block-curl
Recommends: qemu-tools
Recommends: qemu-x86
%ifarch ppc ppc64 ppc64le
@ -368,6 +371,26 @@ as PC and PowerMac systems.
This sub-package contains translations.
%package block-curl
Summary: Universal CPU emulator -- cURL block support
Group: System/Emulators/PC
Provides: qemu:%_libdir/%name/block-curl.so
# Needs to match {qemu-system-*,qemu-img} >= 2.0.0, but is optional.
Conflicts: qemu < %version
Conflicts: qemu > %version
Conflicts: qemu-tools < %version
Conflicts: qemu-tools > %version
%description block-curl
QEMU is an extremely well-performing CPU emulator that allows you to
choose between simulating an entire system and running userspace
binaries for different architectures under your native operating
system. It currently emulates x86, ARM, PowerPC and SPARC CPUs as well
as PC and PowerMac systems.
This sub-package contains a module for accessing network-based image files
over a network connection from qemu-img tool and QEMU system emulation.
%package tools
Summary: Universal CPU emulator -- Tools
Group: System/Emulators/PC
@ -375,6 +398,7 @@ Provides: qemu:%_libexecdir/qemu-bridge-helper
Obsoletes: libcacard <= 0.1.2
Provides: libcacard
PreReq: permissions
Recommends: qemu-block-curl
%description tools
QEMU is an extremely well-performing CPU emulator that allows you to
@ -573,6 +597,8 @@ This package provides a service file for starting and stopping KSM.
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%patch1000 -p1
%patch1001 -p1
@ -740,7 +766,6 @@ fi
%files
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-curl.so
%doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html qemu-tech.html
%doc %_mandir/man1/qemu.1.gz
%_datadir/%name
@ -864,6 +889,11 @@ fi
%_mandir/man1/qemu-kvm.1.gz
%endif
%files block-curl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-curl.so
%files lang -f %name.lang
%defattr(-, root, root)

View File

@ -152,6 +152,7 @@ BuildRequires: spice-protocol-devel
Requires: /usr/sbin/groupadd
Requires: pwdutils
Requires: timezone
Recommends: qemu-block-curl
Recommends: qemu-tools
Recommends: qemu-x86
%ifarch ppc ppc64 ppc64le
@ -299,6 +300,26 @@ as PC and PowerMac systems.
This sub-package contains translations.
%package block-curl
Summary: Universal CPU emulator -- cURL block support
Group: System/Emulators/PC
Provides: qemu:%_libdir/%name/block-curl.so
# Needs to match {qemu-system-*,qemu-img} >= 2.0.0, but is optional.
Conflicts: qemu < %version
Conflicts: qemu > %version
Conflicts: qemu-tools < %version
Conflicts: qemu-tools > %version
%description block-curl
QEMU is an extremely well-performing CPU emulator that allows you to
choose between simulating an entire system and running userspace
binaries for different architectures under your native operating
system. It currently emulates x86, ARM, PowerPC and SPARC CPUs as well
as PC and PowerMac systems.
This sub-package contains a module for accessing network-based image files
over a network connection from qemu-img tool and QEMU system emulation.
%package tools
Summary: Universal CPU emulator -- Tools
Group: System/Emulators/PC
@ -306,6 +327,7 @@ Provides: qemu:%_libexecdir/qemu-bridge-helper
Obsoletes: libcacard <= 0.1.2
Provides: libcacard
PreReq: permissions
Recommends: qemu-block-curl
%description tools
QEMU is an extremely well-performing CPU emulator that allows you to
@ -602,7 +624,6 @@ fi
%files
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-curl.so
%doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html qemu-tech.html
%doc %_mandir/man1/qemu.1.gz
%_datadir/%name
@ -726,6 +747,11 @@ fi
%_mandir/man1/qemu-kvm.1.gz
%endif
%files block-curl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-curl.so
%files lang -f %name.lang
%defattr(-, root, root)

View File

@ -1,8 +1,7 @@
#!/bin/bash -e
#
# While updating versions of QEMU to 1.0 I got fed up with the
# quilt workflow and just put up a git tree that contains all
# the commits on top of a stable tarball.
# Instead of a quilt workflow, we use a git tree that contains
# all the commits on top of a stable tarball.
#
# When updating this package, just either update the git tree
# below (use rebase!) or change the tree path and use your own
@ -14,92 +13,110 @@ GIT_TREE=git://github.com/openSUSE/qemu.git
GIT_LOCAL_TREE=~/git/qemu-opensuse
GIT_BRANCH=opensuse-2.0
GIT_UPSTREAM_TAG=v2.0.0
QEMU_TMP=/dev/shm/qemu-tmp
GIT_DIR=/dev/shm/qemu-factory-git-dir
CMP_DIR=/dev/shm/qemu-factory-cmp-dir
restore_file_to_package() {
# If the processed file matches the previous one, move the previous
# one back in place, otherwise add the processed file.
rm -rf $GIT_DIR
rm -rf $CMP_DIR
if cmp -s "$1" saved."$1"; then
osc mv --force saved."$1" "$1"
else
osc add "$1"
fi
}
# save files in case they remain unchanged
if [ -e 0001-* ]; then
for i in 0*; do
osc mv $i saved.$i
done
fi
osc mv qemu.spec saved.qemu.spec
osc mv qemu-linux-user.spec saved.qemu-linux-user.spec
# fetch all patches
rm -rf $QEMU_TMP
OSCDIR="$(pwd)"
if [ -d "$GIT_LOCAL_TREE" ]; then
git clone -ls $GIT_LOCAL_TREE $QEMU_TMP
cd $QEMU_TMP
else
git clone $GIT_TREE $QEMU_TMP
cd $QEMU_TMP
git remote add upstream git://git.qemu.org/qemu.git
git remote update
fi
git checkout $GIT_BRANCH
git format-patch -N $GIT_UPSTREAM_TAG -o "$OSCDIR"
QEMU_VERSION=`cat VERSION`
cd "$OSCDIR"
rm -rf $QEMU_TMP
# cut off file name after 40 bytes, so we work around git version differences
# while at it, also remove the signature.
for i in 0*; do
PATCHNAME=${i%.patch}
PATCHNAME=${PATCHNAME:0:40}.patch
head -n $(expr $(wc -l $i | cut -d ' ' -f 1) - 3) $i > "$PATCHNAME.tmp"
rm "$i"
mv "$PATCHNAME.tmp" "$PATCHNAME"
restore_file_to_package "$PATCHNAME"
done
# we have all patches as files now - generate the spec files!
for package in qemu qemu-linux-user; do
while IFS= read -r line; do
if [ "$line" = "PATCH_FILES" ]; then
for i in 0*; do
NUM=${i%%-*}
echo -e "Patch$NUM: $i"
done
elif [ "$line" = "PATCH_EXEC" ]; then
for i in 0*; do
NUM=${i%%-*}
echo "%patch$NUM -p1"
done
elif [ "$line" = "QEMU_VERSION" ]; then
echo "Version: $QEMU_VERSION"
elif [[ "$line" =~ ^Source: ]]; then
QEMU_TARBALL=qemu-`echo "$line" | cut -d '-' -f 2-`
VERSION_FILE=${QEMU_TARBALL%.tar.bz2}/roms/seabios/.version
SEABIOS_VERSION=`tar jxfO "$QEMU_TARBALL" "$VERSION_FILE"`
SEABIOS_VERSION=`echo $SEABIOS_VERSION | cut -d '-' -f 2`
echo "$line"
elif [ "$line" = "SEABIOS_VERSION" ]; then
echo "Version: $SEABIOS_VERSION"
else
echo "$line"
echo "Processing $GIT_BRANCH branch of local git tree, using tag:" \
"$GIT_UPSTREAM_TAG"
if ! (cd $GIT_LOCAL_TREE && git show-branch $GIT_BRANCH &>/dev/null); then
echo "Error: Branch $GIT_BRANCH not found - please create a remote" \
"tracking branch of origin/$GIT_BRANCH"
exit
fi
done < $package.spec.in > $package.spec
done
restore_file_to_package qemu.spec
restore_file_to_package qemu-linux-user.spec
# remove any remaining saved files
files=(saved.*)
if [ -e "${files[0]}" ]; then
osc rm --force saved.*
git clone -ls $GIT_LOCAL_TREE $GIT_DIR -b $GIT_BRANCH
if ! (cd $GIT_LOCAL_TREE && git remote show upstream &>/dev/null); then
echo "Remote for upstream git tree not found. Next time add remote" \
"named upstream for git://git.qemu.org/qemu.git and update"
(cd $GIT_DIR && git remote add upstream git://git.qemu-project.org/qemu.git)
(cd $GIT_DIR && git remote update)
fi
else
echo "Processing $GIT_BRANCH branch of remote git tree, using tag:" \
"$GIT_UPSTREAM_TAG"
echo "(For much fast processing, consider establishing a local git tree" \
"at $GIT_LOCAL_TREE)"
git clone $GIT_TREE $GIT_DIR -b $GIT_BRANCH
(cd $GIT_DIR && git remote add upstream git://git.qemu-project.org/qemu.git)
(cd $GIT_DIR && git remote update)
fi
(cd $GIT_DIR && git format-patch -N $GIT_UPSTREAM_TAG --suffix= -o $CMP_DIR >/dev/null)
QEMU_VERSION=`cat $GIT_DIR/VERSION`
echo "QEMU version: $QEMU_VERSION"
rm -rf $GIT_DIR
(
CHANGED_COUNT=0
UNCHANGED_COUNT=0
DELETED_COUNT=0
ADDED_COUNT=0
shopt -s nullglob
# Process patches to eliminate useless differences: limit file names to 40 chars
# before extension and remove git signature. ('30' below gets us past dir prefix)
for i in $CMP_DIR/*; do
head -n -3 $i > $CMP_DIR/${i:30:40}.patch
rm $i
done
for i in 0???-*.patch; do
if [ -e $CMP_DIR/$i ]; then
if cmp -s $CMP_DIR/$i $i; then
rm $CMP_DIR/$i
let UNCHANGED_COUNT+=1
else
mv $CMP_DIR/$i .
let CHANGED_COUNT+=1
fi
else
osc rm --force $i
let DELETED_COUNT+=1
fi
done
for i in $CMP_DIR/*; do
mv $i .
osc add ${i##*/}
let ADDED_COUNT+=1
done
for package in qemu qemu-linux-user; do
while IFS= read -r line; do
if [ "$line" = "PATCH_FILES" ]; then
for i in 0???-*.patch; do
NUM=${i%%-*}
echo -e "Patch$NUM: $i"
done
elif [ "$line" = "PATCH_EXEC" ]; then
for i in 0???-*.patch; do
NUM=${i%%-*}
echo "%patch$NUM -p1"
done
elif [ "$line" = "QEMU_VERSION" ]; then
echo "Version: $QEMU_VERSION"
elif [[ "$line" =~ ^Source: ]]; then
QEMU_TARBALL=qemu-`echo "$line" | cut -d '-' -f 2-`
VERSION_FILE=${QEMU_TARBALL%.tar.bz2}/roms/seabios/.version
SEABIOS_VERSION=`tar jxfO "$QEMU_TARBALL" "$VERSION_FILE"`
SEABIOS_VERSION=`echo $SEABIOS_VERSION | cut -d '-' -f 2`
echo "$line"
elif [ "$line" = "SEABIOS_VERSION" ]; then
echo "Version: $SEABIOS_VERSION"
else
echo "$line"
fi
done < $package.spec.in > $package.spec
done
echo "git patch summary"
echo " unchanged: $UNCHANGED_COUNT"
echo " changed: $CHANGED_COUNT"
echo " deleted: $DELETED_COUNT"
echo " added: $ADDED_COUNT"
)
rm -rf $CMP_DIR