File xen.spec of Package xen

%define git_changeset 2015-04-10 11:36:24 -0400 git:123c779
# norootforbuild
Name:           xen
ExclusiveArch:  %ix86 x86_64
%define xen_build_dir xen-%{version}
#
%define with_hypervisor 0
#
%define xen_install_suffix %{nil}
%ifarch x86_64
%define xen_install_suffix .gz
%endif
#
%ifarch x86_64
%define max_cpus 256
%define pae_enabled n
%define with_hypervisor 1
%else
%define max_cpus 32
%define pae_enabled y
%endif
#
%if %{?suse_version}0
PreReq:         %insserv_prereq %fillup_prereq
%ifarch  %ix86 x86_64
%define with_stubdom 1
%endif
%define with_kmp 1
%define with_fdupes 1
%define with_systemd 0
%if %suse_version > 1220
%define with_systemd 1
%systemd_requires
BuildRequires: systemd-devel
%define with_systemd_modules_load %{_prefix}/lib/modules-load.d
%endif
BuildRequires: LibVNCServer-devel
BuildRequires: SDL-devel
BuildRequires: autoconf
BuildRequires: automake
%ifarch  %ix86 x86_64
BuildRequires: bin86
%endif
BuildRequires: bison
BuildRequires: cmake
BuildRequires: curl-devel
%ifarch  %ix86 x86_64
BuildRequires: dev86
%endif
BuildRequires: flex
%if %{?with_fdupes}0
BuildRequires: fdupes
%endif
BuildRequires: gcc-c++
BuildRequires: gettext-tools
BuildRequires: glib2-devel >= 2.12
BuildRequires: gmp-devel
BuildRequires: graphviz
BuildRequires: libaio-devel
BuildRequires: libbz2-devel
BuildRequires: libjpeg-devel
BuildRequires: libnl3-devel
BuildRequires: libpixman-1-0-devel
BuildRequires: libopenssl-devel
BuildRequires: libuuid-devel
BuildRequires: libxml2-devel
BuildRequires: libyajl-devel
%if %suse_version > 1220
BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pciutils-devel
BuildRequires: python-devel
BuildRequires: transfig
BuildRequires: xz-devel
%if %suse_version > 1110
BuildRequires: acpica
%else
BuildRequires: pmtools
%endif

%ifarch x86_64
BuildRequires:  glibc-32bit
BuildRequires:  glibc-devel-32bit
%endif
%endif
# %{?suse_version}0
#
%if %{?fedora_version}0
%define with_rc_d 1
%define __python /no/python/bytecompiling
%if 1
%ifarch x86_64
#BuildRequires: glibc-devel.i686
BuildRequires: glibc32
%endif
%endif
BuildRequires: SDL-devel
BuildRequires: dev86
BuildRequires: glib2-devel
BuildRequires: iasl
BuildRequires: libaio-devel
BuildRequires: libuuid-devel
BuildRequires: openssl-devel
BuildRequires: pciutils-devel
BuildRequires: pixman-devel
BuildRequires: python-devel
BuildRequires: yajl-devel
%endif
# %{?fedora_version}0
#
%if %{?with_kmp}0
BuildRequires: kernel-source
BuildRequires: kernel-syms
BuildRequires: module-init-tools
BuildRequires:  module-init-tools
%if %suse_version < 1220
BuildRequires:  xorg-x11
%else
BuildRequires:  lndir
%endif
%endif
Version:        4.5.0.66
Release:        %(bash %_sourcedir/get_release_number.sh)
License:        GPL-2.0+
Group:          System/Kernel
Summary:        Xen Virtualization: Hypervisor (aka VMM aka Microkernel)
Source0:        xen-%{version}.tar.xz
Source100: 	qemu-xen-dir-remote.tar.xz
Source101:      qemu-xen-traditional-dir-remote.tar.xz
Source102:      https://git.ipxe.org/ipxe.git/snapshot/ipxe.tar.gz
Source103: 	xenalyze.hg.tar.xz
Source104: 	seabios-dir-remote.tar.xz
%if %{?with_stubdom}0
Source110: 	stubdom.tar.xz
%endif
##
Source1:        xencommons.service
Source2:        README.SUSE
Source3:        boot.xen
Source4:        boot.local.xenU
Source7:        logrotate.conf
Source11:       block-nbd
Source12:       block-iscsi
Source13:       block-npiv-common.sh
Source14:       block-npiv
Source15:       block-npiv-vport
Source18:       init.xen_loop
%if %{?with_kmp}0
Source20:       kmp_filelist
%endif
Source21:       block-dmmd

Patch0:         xen-unstable.xenmisc.hotfix.patch
Patch100:       qemu-xen-traditional.vnc.gnutls.patch
Patch300:       xenalyze.hotfix.patch

Url:            http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define pyver %(python -c "import sys; print sys.version[:3]")
%if %{?with_kmp}0
%suse_kernel_module_package -n xen pv um xen -f kmp_filelist
%endif

%description
Xen is a virtual machine monitor for x86 that supports execution of
multiple guest operating systems with unprecedented levels of
performance and resource isolation.

This package contains the Xen Hypervisor. (tm)

Modern computers are sufficiently powerful to use virtualization to
present the illusion of many smaller virtual machines (VMs), each
running a separate operating system instance. Successful partitioning
of a machine to support the concurrent execution of multiple operating
systems poses several challenges. Firstly, virtual machines must be
isolated from one another: It is not acceptable for the execution of
one to adversely affect the performance of another. This is
particularly true when virtual machines are owned by mutually
untrusting users. Secondly, it is necessary to support a variety of
different operating systems to accommodate the heterogeneity of popular
applications. Thirdly, the performance overhead introduced by
virtualization should be small.

Xen uses a technique called paravirtualization: The guest OS is
modified, mainly to enhance performance.

The Xen hypervisor (microkernel) does not provide device drivers for
your hardware (except for CPU and memory). This job is left to the
kernel that's running in domain 0. Thus the domain 0 kernel is
privileged; it has full hardware access. It's started immediately after
Xen starts up. Other domains have no access to the hardware; instead
they use virtual interfaces that are provided by Xen (with the help of
the domain 0 kernel).

Xen does support booting other Operating Systems; ports of NetBSD
(Christian Limpach), FreeBSD (Kip Macy), and Plan 9 (Ron Minnich)
exist. A port of Windows XP was developed for an earlier version of
Xen, but is not available for release due to license restrictions.

In addition to this package you need to install the kernel-xen and
xen-tools to use Xen. Xen 3 also supports running unmodified guests
using full virtualization, if appropriate hardware is present. Install
xen-tools-ioemu if you want to use this.

[Hypervisor is a trademark of IBM]



Authors:
--------
    Ian Pratt <ian.pratt@cl.cam.ac.uk>
    Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
    Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
    Mark Williamson <mark.williamson@cl.cam.ac.uk>
    Ewan Mellor <ewan@xensource.com>
    ...

%package libs
Summary:        Xen Virtualization: Libraries
Group:          System/Kernel

%description libs
%{name} %{version} %{release}

%package tools
Summary:        Xen Virtualization: Control tools for domain 0
Group:          System/Kernel
Requires:       %{name}-libs = %{version}
Requires:       bridge-utils
Requires:       multipath-tools
Requires:       python
Requires:       python-curses
Provides:       xen-tools-ioemu = %{version}
Obsoletes:      xen-tools-ioemu < %{version}

%description tools
%{name} %{version} %{release}

%package tools-domU
Summary:        Xen Virtualization: Control tools for domain U
Group:          System/Kernel
Conflicts:      %{name}-tools

%description tools-domU
%{name} %{version} %{release}

%package devel
Summary:        Xen Virtualization: Headers and libraries for development
Group:          System/Kernel
Requires:       %{name}-libs = %{version}

%description devel
%{name} %{version} %{release}

%if %{?with_kmp}0

%package KMP
Group:          System/Kernel
Summary:        Xen para-virtual device drivers for fully virtualized guests
Conflicts:      xen

%description KMP
%{name} %{version} %{release}
%endif

%package doc-html
Summary:        Xen Virtualization: HTML documentation
Group:          Documentation/HTML

%description doc-html
%{name} %{version} %{release}

%prep
%setup -q -c -T -a 0 -a 100 -a 101 -a 103 -a 104
mv -t %xen_build_dir `ls -1 | grep -v %xen_build_dir`
pushd %xen_build_dir
%if %{?with_stubdom}0
tar xfva %{S:110}
%endif
#
mkdir -vp extras
ln -sfvbn ../qemu-xen-dir-remote             tools/qemu-xen-dir-remote
ln -sfvbn ../qemu-xen-traditional-dir-remote tools/qemu-xen-traditional-dir-remote
ln -sfvbn ../../seabios-dir-remote           tools/firmware/seabios-dir-remote
cp -avL --remove-destination %{S:102} tools/firmware/etherboot/ipxe.tar.gz
pushd tools/firmware/etherboot
popd
#
pushd tools/qemu-xen-traditional-dir-remote
%patch100 -p1
popd
#
pushd tools/qemu-xen-dir-remote
popd
#
pushd xenalyze.hg
%patch300 -p1
popd
#
pwd
#
if test -s $RPM_SOURCE_DIR/xen-unstable.xenmisc.hotfix.patch
then
%patch0 -p1
fi
#
popd
echo '%git_changeset' > %xen_build_dir/.scmversion
touch -d "`echo '%git_changeset' | sed 's@[[:blank:]]\+[+-]\?[0-9]\+[[:blank:]]\+git:.*$@@'`" %xen_build_dir/.scmversion
# we control the version info of this package
# to gain control of filename of xen.gz
XEN_VERSION=%{version}
XEN_VERSION=${XEN_VERSION%%%%.*}
XEN_SUBVERSION=%{version}
XEN_SUBVERSION=${XEN_SUBVERSION#*.}
XEN_SUBVERSION=${XEN_SUBVERSION%%%%.*}
XEN_EXTRAVERSION="%version-%release"
XEN_EXTRAVERSION="${XEN_EXTRAVERSION#*.}"
XEN_EXTRAVERSION="${XEN_EXTRAVERSION#*.}"
# remove trailing B_CNT to reduce build-compare noise
XEN_EXTRAVERSION="${XEN_EXTRAVERSION%%.*}"
XEN_FULLVERSION="$XEN_VERSION.$XEN_SUBVERSION.$XEN_EXTRAVERSION"
tee %xen_build_dir/xen/xen-version  <<_EOF_
export XEN_VERSION=$XEN_VERSION
export XEN_SUBVERSION=$XEN_SUBVERSION
export XEN_EXTRAVERSION=$XEN_EXTRAVERSION
export XEN_FULLVERSION=$XEN_FULLVERSION
_EOF_
cp -al %xen_build_dir non-dbg
cp -al %xen_build_dir dbg

%build
tee .env.sh <<_EOF_
export XEN_BUILD_HOST=host
export XEN_BUILD_DATE="`date -ur %xen_build_dir/.scmversion`"
export XEN_BUILD_TIME="`date -ur %xen_build_dir/.scmversion +%T`"
export SMBIOS_REL_DATE="`date -ur %xen_build_dir/.scmversion +%m/%d/%Y`"
export VGABIOS_REL_DATE="`date -ur %xen_build_dir/.scmversion '+%d %b %Y'`"
export EXTRA_CFLAGS_XEN_TOOLS="$RPM_OPT_FLAGS"
export EXTRA_CFLAGS_QEMU_TRADITIONAL="$RPM_OPT_FLAGS"
export EXTRA_CFLAGS_QEMU_XEN="$RPM_OPT_FLAGS"
export WGET=$(type -P false)
export GIT=$(type -P false)
%if 0%{?__debug_package}
debug_symbols=y
%else
debug_symbols=n
%endif
_EOF_
. ./.env.sh
create_build_xen()
{
cat > build_xen.sh <<-EOF
#!/bin/bash
echo "+ running '\$0' '\$*'"
set -ex
time \
make \
	max_phys_cpus=%{max_cpus} \
	pae=%{pae_enabled} \
	DESTDIR=$RPM_BUILD_ROOT \
	%{?_smp_mflags} \
	-k \
	$@ \
	"\$@"
EOF
cat build_xen.sh
}
#
%if 0%{with_hypervisor}
pushd dbg
create_build_xen debug=y debug_symbols=$debug_symbols crash_debug=y
bash build_xen.sh xen
popd
%endif
#
pushd non-dbg
make -C xenalyze.hg CC="gcc -I../xen/include -DMAX_CPUS=%{max_cpus} ${RPM_OPT_FLAGS}" %{?_smp_mflags} -k
%configure \
	--enable-debug \
	--disable-stubdom \
	--disable-xen \
	--docdir=%{_defaultdocdir}/%{name} \
	--disable-ovmf \
	--enable-docs \
	--enable-tools \
%if %{?with_systemd}0
	--enable-systemd \
	--with-systemd=%{_unitdir} \
	--with-systemd-modules-load=%{with_systemd_modules_load} \
%else
	--disable-systemd \
%endif
%if %{?with_stubdom}0
	--enable-stubdom \
	--enable-ioemu-stubdom \
	--disable-c-stubdom \
	--disable-caml-stubdom \
	--disable-vtpm-stubdom \
	--enable-vtpmmgr-stubdom \
%endif
	--with-initddir=%{_initddir}
unset CFLAGS
unset CXXFLAGS
unset FFLAGS
unset LDFLAGS
make %{?_smp_mflags} -k -C tools/include/xen-foreign
make %{?_smp_mflags} \
	debug_symbols=$debug_symbols \
	-k

#
%if %{?with_kmp}0
# pv driver modules
export XL=/usr/src/linux
export XEN=/usr/src/linux/include/xen
mkdir -vp obj
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -r unmodified_drivers/linux-2.6 obj/$flavor
    cd obj/$flavor
    sh mkbuildtree
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
	%{?_smp_mflags} -k \
        M=$PWD
    cd ../..
done
# pv driver modules
%endif
#
%if 0%{with_hypervisor}
create_build_xen debug=n debug_symbols=n crash_debug=n
bash build_xen.sh xen
%endif

%install
. ./%xen_build_dir/xen/xen-version
. ./.env.sh
%if 0%{with_hypervisor}
install_xen()
{
%ifarch x86_64
    local ext=""
    find $RPM_BUILD_ROOT/boot -ls
    if [ -n "$1" ]; then
        ext="-$1"
        mv $RPM_BUILD_ROOT/boot/xen-${XEN_FULLVERSION}%{xen_install_suffix} \
           $RPM_BUILD_ROOT/boot/xen${ext}-${XEN_FULLVERSION}%{xen_install_suffix}
        mv $RPM_BUILD_ROOT/boot/xen-syms-${XEN_FULLVERSION} \
           $RPM_BUILD_ROOT/boot/xen-syms${ext}-${XEN_FULLVERSION}
    fi
    rm $RPM_BUILD_ROOT/boot/xen-$XEN_VERSION.$XEN_SUBVERSION%{xen_install_suffix}
    rm $RPM_BUILD_ROOT/boot/xen-$XEN_VERSION%{xen_install_suffix}
    rm $RPM_BUILD_ROOT/boot/xen%{xen_install_suffix}
    # Do not link to links; grub cannot follow.
    ln -s xen${ext}-${XEN_FULLVERSION}%{xen_install_suffix} $RPM_BUILD_ROOT/boot/xen${ext}-$XEN_VERSION.$XEN_SUBVERSION%{xen_install_suffix}
    ln -s xen${ext}-${XEN_FULLVERSION}%{xen_install_suffix} $RPM_BUILD_ROOT/boot/xen${ext}-$XEN_VERSION%{xen_install_suffix}
    ln -s xen${ext}-${XEN_FULLVERSION}%{xen_install_suffix} $RPM_BUILD_ROOT/boot/xen${ext}%{xen_install_suffix}
    ln -sf xen-syms${ext}-${XEN_FULLVERSION} $RPM_BUILD_ROOT/boot/xen-syms${ext}
    find $RPM_BUILD_ROOT/boot -ls
%endif
:
}
#
pushd dbg
bash build_xen.sh install-xen
install_xen dbg
popd
%endif
#
pushd non-dbg
%if 0%{with_hypervisor}
bash build_xen.sh install-xen
install_xen
%endif
#
echo > ../xen.files.txt
if test -d $RPM_BUILD_ROOT%{_libdir}/efi
then
	echo %{_libdir}/efi >> ../xen.files.txt
fi
# tools
make \
	%{?_smp_mflags} -k \
	DESTDIR=$RPM_BUILD_ROOT \
	SYSCONFIG_DIR=/var/adm/fillup-templates \
	DOCDIR=%{_defaultdocdir}/xen \
	debug_symbols=$debug_symbols \
	install
find $RPM_BUILD_ROOT -ls
for i in $RPM_BUILD_ROOT/var/adm/fillup-templates/*
do
	mv -v $i ${i%/*}/sysconfig.${i##*/}
done
%if %{?with_systemd}0
mkdir -vp $RPM_BUILD_ROOT%_presetdir
cat > $RPM_BUILD_ROOT%_presetdir/00-%{name}.preset <<EOF
enable xencommons.service
enable xendomains.service
EOF
cp -bavL %{S:1} $RPM_BUILD_ROOT%{_unitdir}
rm -rfv $RPM_BUILD_ROOT%{_initddir}
%endif
# Stubdom
rm -v -f $RPM_BUILD_ROOT/usr/sbin/{qcow-create,img2qcow,qcow2raw}
cp -avL xenalyze.hg/dump-raw $RPM_BUILD_ROOT/%{_bindir}/xenalyze.dump-raw
cp -avL xenalyze.hg/xenalyze $RPM_BUILD_ROOT/%{_bindir}
%if %{?with_kmp}0
# pv driver modules
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
-k \
        M=$PWD/obj/$flavor
done
%endif


mkdir -vp $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/misc
for name in COPYING %SOURCE2 %SOURCE3 %SOURCE4; do
    install -m 644 $name $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}
done
for name in crashdb.txt ; do
    install -m 644 docs/misc/$name $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/misc/
done
# init scripts
mkdir -vp $RPM_BUILD_ROOT/etc/modprobe.d
install -m644 %SOURCE18 $RPM_BUILD_ROOT/etc/modprobe.d/xen_loop.conf
# example config
mkdir -vp $RPM_BUILD_ROOT/etc/xen/{vm,examples,scripts}
mv -v $RPM_BUILD_ROOT/etc/xen/x?example* $RPM_BUILD_ROOT/etc/xen/examples
rm -v -f $RPM_BUILD_ROOT/etc/xen/examples/*nbd
install -m644 tools/xentrace/formats $RPM_BUILD_ROOT/etc/xen/examples/xentrace_formats.txt
# scripts
rm -v -f $RPM_BUILD_ROOT/etc/xen/scripts/block-*nbd
install -m755 %SOURCE11 %SOURCE12 %SOURCE14 %SOURCE15 %SOURCE21 $RPM_BUILD_ROOT/etc/xen/scripts/
install -m644 %SOURCE13 $RPM_BUILD_ROOT/etc/xen/scripts/
# logrotate
install -m644 -D %SOURCE7 $RPM_BUILD_ROOT/etc/logrotate.d/xen
# directories
mkdir -vp $RPM_BUILD_ROOT/var/lib/xenstored
mkdir -vp $RPM_BUILD_ROOT/var/lib/xen/images
mkdir -vp $RPM_BUILD_ROOT/var/lib/xen/jobs
mkdir -vp $RPM_BUILD_ROOT/var/lib/xen/save
mkdir -vp $RPM_BUILD_ROOT/var/lib/xen/dump
mkdir -vp $RPM_BUILD_ROOT/var/log/xen
ln -s /var/lib/xen/images $RPM_BUILD_ROOT/etc/xen/images
# udev support
mkdir -vp $RPM_BUILD_ROOT/etc/udev/rules.d
mv $RPM_BUILD_ROOT/etc/udev/rules.d/xen-backend.rules $RPM_BUILD_ROOT/etc/udev/rules.d/40-xen.rules
popd
find $RPM_BUILD_ROOT/usr/share/doc/ -type f -name .deps -print -delete
# Remove non-x86 firmware files
find $RPM_BUILD_ROOT%{_datadir} -xdev \( \
	-name "*.dtb" -o \
	-name "*ppc*" -o \
	-name "*e500*" -o \
	-name "*sparc*" -o \
	-name "*slof*" -o \
	-name "*rtas*" -o \
	-name "*s390*" -o \
	-name "palcode-clipper" \) \
	-print0 | sort -z | xargs -0 --no-run-if-empty --verbose rm -fv
# Clean up unpackaged files
rm -v -rf $RPM_BUILD_ROOT/usr/local
rm -v -rf $RPM_BUILD_ROOT%{_datadir}/doc/xen/qemu/
rm -v -f  $RPM_BUILD_ROOT%{_datadir}/doc/qemu/qemu-*
rm -v -rf $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/ps
rm -v -rf $RPM_BUILD_ROOT%{_datadir}/xen/man
rm -v -f  $RPM_BUILD_ROOT/usr/sbin/netfix
rm -v -f  $RPM_BUILD_ROOT/%{_libdir}/python%{pyver}/site-packages/*.egg-info
rm -v -rf $RPM_BUILD_ROOT/html
rm -v -rf $RPM_BUILD_ROOT%{_datadir}/doc/xen/README.xenmon
rm -v -rf $RPM_BUILD_ROOT%{_datadir}/doc/xen/README.blktap
rm -v -f  $RPM_BUILD_ROOT%{_datadir}/xen/create.dtd
rm -v -f  $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
rm -v -f  $RPM_BUILD_ROOT/%{_bindir}/qemu-img-xen
rm -v -f  $RPM_BUILD_ROOT/%{_bindir}/qemu-nbd-xen
rm -v -f  $RPM_BUILD_ROOT/usr/etc/qemu/target*.conf
rm -v -f  $RPM_BUILD_ROOT/usr/libexec/qemu-bridge-helper
# FATE feature for remus rejected
rm -v -f  $RPM_BUILD_ROOT/%{_bindir}/remus
rm -v -rf $RPM_BUILD_ROOT/%{_libdir}/python%{pyver}/site-packages/xen/remus

find \
$RPM_BUILD_ROOT%{_libdir}/python%{pyver}/site-packages/xen/* \
$RPM_BUILD_ROOT%{_libdir}/python%{pyver}/site-packages/grub/* \
	| sed -e "
s@^$RPM_BUILD_ROOT@@
/\.py$/ {
s@^.*@%config &@
p
d
}
/\.pyc$/ {
p
d
}
/\.pyo$/ {
p
d
}
/\.so$/ {
p
d
}
s@^.*@%dir &@
" | tee xen-tools.python.files.txt

%if %{?with_fdupes}0
if test "`type -p fdupes`" != ""
then
%fdupes $RPM_BUILD_ROOT/usr/share
fi
%endif

%clean
: %buildroot preserved

%if 0%{with_hypervisor}
%files -f xen.files.txt
%defattr(-,root,root)
/boot/*
%endif

%files libs
%defattr(-,root,root)
%{_libdir}/fs/
%{_libdir}/*.so.*

%files tools -f xen-tools.python.files.txt
%defattr(-,root,root)
/usr/bin/xen[!-]*
/usr/bin/p*
/usr/sbin/*
%{_libexecdir}/xen
%{_mandir}/man*/*.gz
/var/adm/fillup-templates/*
%dir /var/lib/xen
%dir %attr(700,root,root) /var/lib/xen/images
%dir %attr(700,root,root) /var/lib/xen/save
%dir %attr(700,root,root) /var/lib/xen/dump
%dir %attr(700,root,root) /var/lib/xen/xenpaging
%dir /var/lib/xenstored
%dir /var/log/xen
/etc/bash_completion.d
%if %{?with_systemd}0
%config %{_unitdir}
%config %{with_systemd_modules_load}
%config %_presetdir
%else
%if %{?with_rc_d}0
%config /etc/rc.d
%endif
%config %{_initddir}/*
%endif
%config /etc/logrotate.d/xen
%dir %attr(700,root,root) /etc/xen
/etc/xen/auto
%config /etc/xen/examples
/etc/xen/images
/etc/xen/scripts
/etc/xen/README*
%config /etc/xen/cpupool
%config /etc/xen/vm
%config(noreplace) /etc/xen/xl.conf
%config /etc/modprobe.d/xen_loop.conf
%dir /etc/modprobe.d
%dir /etc/udev
%dir /etc/udev/rules.d
/etc/udev/rules.d/40-xen.rules
%dir %{_defaultdocdir}/%{name}
%{_defaultdocdir}/%{name}/COPYING
%{_defaultdocdir}/%{name}/README.*
%{_defaultdocdir}/%{name}/boot.*
%{_defaultdocdir}/%{name}/misc
%dir %{_libdir}/python%{pyver}/site-packages/xen
%dir %{_libdir}/python%{pyver}/site-packages/grub
%{_datadir}/xen
%{_datadir}/qemu-xen
%{_libdir}/python%{pyver}/site-packages/fsimage.so

%files tools-domU
%defattr(-,root,root)
/usr/bin/xen-detect

%files devel
%defattr(-,root,root)
%{_libdir}/*.a
%{_libdir}/*.so
/usr/include/*

%files doc-html
%defattr(-,root,root)
%{_defaultdocdir}/%{name}/html

%post
set -x
: start post xen %version-%release
if [ -x /sbin/update-bootloader ]; then
    if /sbin/update-bootloader --refresh
    then
        : good
    fi
fi
: end post xen %version-%release

%postun
set -x
: start postun xen %version-%release
if [ -x /sbin/update-bootloader ]; then
    if /sbin/update-bootloader --refresh
    then
        : good
    fi
fi
: end postun xen %version-%release

%pre tools
set -x
: start pre %version-%release
%if %{?with_systemd}0
%service_add_pre xencommons.service
%service_add_pre xendomains.service
%endif
: end pre %version-%release

%post tools
set -x
: start post %version-%release
%if %{?with_systemd}0
%{fillup_only -n xencommons xencommons}
%{fillup_only -n xendomains xendomains}
%service_add_post xencommons.service
%service_add_post xendomains.service
%else
%{fillup_and_insserv -y -n xencommons xencommons}
%{fillup_and_insserv -y -n xendomains xendomains}
%endif
if [ -f /usr/bin/qemu-img ]; then
    if [ -f /usr/bin/qemu-img-xen ]; then
        rm /usr/bin/qemu-img-xen
    fi
    ln -s /usr/bin/qemu-img /usr/bin/qemu-img-xen
fi
if [ -f /usr/bin/qemu-nbd ]; then
    if [ -f /usr/bin/qemu-nbd-xen ]; then
        rm /usr/bin/qemu-nbd-xen
    fi
    ln -s /usr/bin/qemu-nbd /usr/bin/qemu-nbd-xen
fi
: end post %version-%release

%preun tools
set -x
: start preun %version-%release
%if %{?with_systemd}0
%service_del_preun xencommons.service
%service_del_preun xendomains.service
%else
%{stop_on_removal xendomains xencommons}
%endif
: end preun %version-%release

%postun tools
set -x
: start postun %version-%release
%if %{?with_systemd}0
%service_del_postun xencommons.service
%service_del_postun xendomains.service
%else
%{insserv_cleanup}
%endif
if [ -f /usr/bin/qemu-img-xen ]; then
    rm /usr/bin/qemu-img-xen
fi
if [ -f /usr/bin/qemu-nbd-xen ]; then
    rm /usr/bin/qemu-nbd-xen
fi
: end postun %version-%release

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig
openSUSE Build Service is sponsored by