Accepting request 227675 from home:bfrogers:branches:Virtualization

Spec file cleanups and git script improvements.

OBS-URL: https://build.opensuse.org/request/show/227675
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=196
This commit is contained in:
Bruce Rogers 2014-03-26 23:48:29 +00:00 committed by Git OBS Bridge
parent a90d1af56a
commit 25cfc8f4ce
5 changed files with 73 additions and 27 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Mar 24 15:45:00 UTC 2014 - brogers@suse.com
- Improve update_git.sh to not change files in OBS if the file
remains unchanged
-------------------------------------------------------------------
Mon Mar 24 09:41:42 UTC 2014 - afaerber@suse.de

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Mar 26 21:09:34 UTC 2014 - brogers@suse.com
- Tiddy up qemu.spec a bit: white space, line length, use macros
as appropriate
- Improve update_git.sh to not change files in OBS if the file
remains unchanged
-------------------------------------------------------------------
Wed Mar 26 14:16:39 UTC 2014 - afaerber@suse.de

View File

@ -131,7 +131,7 @@ BuildRequires: libpng-devel
BuildRequires: libpulse-devel
BuildRequires: libtool
%if 0%{?suse_version} > 1310
BuildRequires: libusb
BuildRequires: libusb-devel
%endif
BuildRequires: libvdeplug3-devel
%if 0%{?suse_version} > 1220
@ -146,7 +146,7 @@ BuildRequires: systemd
%{?systemd_requires}
%define with_systemd 1
%endif
%if 0%{?sles_version} != 11
%if 0%{?sles_version} != 11
BuildRequires: usbredir-devel
%endif
%if 0%{?suse_version} >= 1210
@ -200,7 +200,11 @@ Recommends: qemu-ksm = %{version}
Suggests: qemu-lang
%endif
%define firmware_files {acpi-dsdt.aml bios.bin q35-acpi-dsdt.aml sgabios.bin vgabios.bin vgabios-cirrus.bin vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin optionrom/linuxboot.bin optionrom/multiboot.bin optionrom/kvmvapic.bin pxe-e1000.rom pxe-pcnet.rom pxe-ne2k_pci.rom pxe-rtl8139.rom pxe-eepro100.rom pxe-virtio.rom}
%define built_firmware_files {acpi-dsdt.aml bios.bin bios-256k.bin \
q35-acpi-dsdt.aml sgabios.bin vgabios.bin vgabios-cirrus.bin \
vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin optionrom/linuxboot.bin \
optionrom/multiboot.bin optionrom/kvmvapic.bin pxe-e1000.rom pxe-pcnet.rom \
pxe-ne2k_pci.rom pxe-rtl8139.rom pxe-eepro100.rom pxe-virtio.rom}
%description
QEMU is an extremely well-performing CPU emulator that allows you to
@ -491,7 +495,7 @@ This package provides a service file for starting and stopping KSM.
%if %{build_x86_fw_from_source}
# as a safeguard, delete the firmware files that we intend to build
for i in %firmware_files
for i in %built_firmware_files
do
rm -f pc-bios/$i
done
@ -501,6 +505,7 @@ done
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \
--libdir=%_libdir \
--libexecdir=%_libexecdir \
--localstatedir=%_localstatedir \
--extra-cflags="%{optflags}" \
--disable-strip \
--enable-system --disable-linux-user \
@ -537,7 +542,7 @@ done
%if 0%{?suse_version} > 1310
--enable-libusb \
%endif
%if 0%{?sles_version} != 11
%if 0%{?sles_version} != 11
--enable-usb-redir \
%endif
--enable-vde \
@ -556,10 +561,10 @@ make %{?_smp_mflags} V=1
# Firmware
%if %{build_x86_fw_from_source}
make --no-print-directory -C roms bios
make --no-print-directory -C roms seavgabios
make --no-print-directory -C roms pxerom
make --no-print-directory -C roms sgabios
make -C roms bios
make -C roms seavgabios
make -C roms pxerom
make -C roms sgabios
%endif
%check
@ -577,9 +582,9 @@ cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh
%ifarch %s390x
exec /usr/bin/qemu-system-s390x -machine accel=kvm "$@"
exec %{_bindir}/qemu-system-s390x -machine accel=kvm "$@"
%else
exec /usr/bin/qemu-system-x86_64 -machine accel=kvm "$@"
exec %{_bindir}/qemu-system-x86_64 -machine accel=kvm "$@"
%endif
EOF
chmod 755 %{buildroot}%{_bindir}/qemu-kvm

View File

@ -93,7 +93,7 @@ BuildRequires: libpng-devel
BuildRequires: libpulse-devel
BuildRequires: libtool
%if 0%{?suse_version} > 1310
BuildRequires: libusb
BuildRequires: libusb-devel
%endif
BuildRequires: libvdeplug3-devel
%if 0%{?suse_version} > 1220
@ -108,7 +108,7 @@ BuildRequires: systemd
%{?systemd_requires}
%define with_systemd 1
%endif
%if 0%{?sles_version} != 11
%if 0%{?sles_version} != 11
BuildRequires: usbredir-devel
%endif
%if 0%{?suse_version} >= 1210
@ -162,7 +162,11 @@ Recommends: qemu-ksm = %{version}
Suggests: qemu-lang
%endif
%define firmware_files {acpi-dsdt.aml bios.bin q35-acpi-dsdt.aml sgabios.bin vgabios.bin vgabios-cirrus.bin vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin optionrom/linuxboot.bin optionrom/multiboot.bin optionrom/kvmvapic.bin pxe-e1000.rom pxe-pcnet.rom pxe-ne2k_pci.rom pxe-rtl8139.rom pxe-eepro100.rom pxe-virtio.rom}
%define built_firmware_files {acpi-dsdt.aml bios.bin bios-256k.bin \
q35-acpi-dsdt.aml sgabios.bin vgabios.bin vgabios-cirrus.bin \
vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin optionrom/linuxboot.bin \
optionrom/multiboot.bin optionrom/kvmvapic.bin pxe-e1000.rom pxe-pcnet.rom \
pxe-ne2k_pci.rom pxe-rtl8139.rom pxe-eepro100.rom pxe-virtio.rom}
%description
QEMU is an extremely well-performing CPU emulator that allows you to
@ -415,7 +419,7 @@ PATCH_EXEC
%if %{build_x86_fw_from_source}
# as a safeguard, delete the firmware files that we intend to build
for i in %firmware_files
for i in %built_firmware_files
do
rm -f pc-bios/$i
done
@ -425,6 +429,7 @@ done
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \
--libdir=%_libdir \
--libexecdir=%_libexecdir \
--localstatedir=%_localstatedir \
--extra-cflags="%{optflags}" \
--disable-strip \
--enable-system --disable-linux-user \
@ -461,7 +466,7 @@ done
%if 0%{?suse_version} > 1310
--enable-libusb \
%endif
%if 0%{?sles_version} != 11
%if 0%{?sles_version} != 11
--enable-usb-redir \
%endif
--enable-vde \
@ -480,10 +485,10 @@ make %{?_smp_mflags} V=1
# Firmware
%if %{build_x86_fw_from_source}
make --no-print-directory -C roms bios
make --no-print-directory -C roms seavgabios
make --no-print-directory -C roms pxerom
make --no-print-directory -C roms sgabios
make -C roms bios
make -C roms seavgabios
make -C roms pxerom
make -C roms sgabios
%endif
%check
@ -501,9 +506,9 @@ cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh
%ifarch %s390x
exec /usr/bin/qemu-system-s390x -machine accel=kvm "$@"
exec %{_bindir}/qemu-system-s390x -machine accel=kvm "$@"
%else
exec /usr/bin/qemu-system-x86_64 -machine accel=kvm "$@"
exec %{_bindir}/qemu-system-x86_64 -machine accel=kvm "$@"
%endif
EOF
chmod 755 %{buildroot}%{_bindir}/qemu-kvm

View File

@ -16,11 +16,25 @@ GIT_BRANCH=opensuse-2.0
GIT_UPSTREAM_TAG=v2.0.0-rc0
QEMU_TMP=/dev/shm/qemu-tmp
# clean up
restore_file_to_package() {
# If the processed file matches the previous one, move the previous
# one back in place, otherwise add the processed file.
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
osc rm --force 0*
for i in 0*; do
osc mv $i saved.$i
done
fi
rm -f qemu.spec qemu-linux-user.spec
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
@ -41,13 +55,14 @@ 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
# while at it, also remove the signature.
for i in 0*; do
PATCHNAME=${i%.patch}
PATCHNAME=${i: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!
@ -70,5 +85,12 @@ for package in qemu qemu-linux-user; do
fi
done < $package.spec.in > $package.spec
done
osc add 0*
restore_file_to_package qemu.spec
restore_file_to_package qemu-linux-user.spec
# remove any remaining saved files
if [ -e saved.* ]; then
osc rm --force saved.*
fi