SHA256
1
0
forked from pool/libguestfs
libguestfs/libguestfs.spec

469 lines
14 KiB
RPMSpec

#
# spec file for package libguestfs
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Michal Hrusecky <mhrusecky@novell.com>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define with_ocaml 1
%define with_python 1
%define with_perl 1
%define with_ruby 0
%define with_fuse 1
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
Name: libguestfs
ExclusiveArch: %ix86 x86_64
Requires: kvm >= 1.1
%if %{?sles_version}0 > 0
BuildRequires: sles-release
%endif
%if %suse_version >= 1140
BuildRequires: augeas-devel
%endif
BuildRequires: attr-devel
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: file-devel
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: genisoimage
BuildRequires: gperf
BuildRequires: hivex-devel
BuildRequires: kernel-default
BuildRequires: lvm2
%if %suse_version >= 1220
BuildRequires: libconfig-devel
%endif
BuildRequires: libtool
BuildRequires: libvirt-devel
BuildRequires: mdadm
BuildRequires: mkinitrd
BuildRequires: ncurses-devel
BuildRequires: parted
BuildRequires: pcre-devel
BuildRequires: pkg-config
BuildRequires: readline-devel
BuildRequires: util-linux
BuildRequires: xfsprogs
BuildRequires: btrfsprogs
BuildRequires: zerofree
BuildRequires: ntfsprogs
BuildRequires: ntfs-3g
BuildRequires: rsync
BuildRequires: cryptsetup
%if %suse_version < 1210
# perl as included in openSuSE 11.4 has this, but an older version without html_charset
# Without the version the requires is ignored for some reason
BuildRequires: perl(Pod::Simple::XHTML) = 3.23
%endif
#
%if %{with_fuse}
BuildRequires: fuse-devel
%define _configure_fuse --enable-fuse
%else
%define _configure_fuse --disable-fuse
%endif
#
%if %{with_ocaml}
BuildRequires: ocaml
BuildRequires: ocaml-findlib
%define _configure_ocaml --enable-ocaml
%else
%define _configure_ocaml --disable-ocaml
%endif
#
%if %{with_perl}
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(Locale::TextDomain)
BuildRequires: perl(Pod::Usage)
%if 0
BuildRequires: perl(String::ShellQuote)
BuildRequires: perl(Win::Hivex)
BuildRequires: perl(Win::Hivex::Regedit)
%endif
BuildRequires: perl(Sys::Virt)
%{perl_requires}
%define _configure_perl --enable-perl
%else
%define _configure_perl --disable-perl
%endif
#
%if %{with_python}
%define pyver %(python -c "import sys; print sys.version[:3]")
BuildRequires: python
BuildRequires: python-devel
%define _configure_python --enable-python
%else
%define _configure_python --disable-python
%endif
#
%if %{with_ruby}
BuildRequires: ruby
BuildRequires: ruby-devel
BuildRequires: rubygem-rake
%define _configure_ruby --enable-ruby
%else
%define _configure_ruby --disable-ruby
%endif
#
Url: http://libguestfs.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Tools for accessing and modifying virtual machine disk images
License: LGPL-2.1
Group: System/Filesystems
Version: 1.19.36
Release: 0
Patch1: 0001-daemon-Remove-e2prog-hack-only-needed-for-RHEL-5.patch
Patch2: 0002-daemon-collect-list-of-called-external-commands.patch
Patch5: libguestfs-1.13.14-ruby.patch
Patch100: libguestfs.perl.install_vendor.patch
Patch101: libguestfs.perl.no-rpath.patch
Source0: %{name}-%{version}.tar.gz
Source10: libguestfs.mkinitrd.boot.sh
Source11: libguestfs.mkinitrd.setup.sh
Source42: mkinitrd.patch
Recommends: %{name}-data
%description
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%package doc
Summary: Documentation for libguestfs
Group: Documentation
%description doc
Documentation for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
#
%if %{with_perl}
%package perl
Summary: Allows Perl scripts to directly use libguestfs
Group: System/Filesystems
Requires: perl = %{perl_version}
%description perl
Provides Perl support for libguestfs.
%endif
#
%if %{with_python}
%package python
Summary: Allows Python scripts to directly use libguestfs
Group: System/Filesystems
%description python
Provides Python support for libguestfs.
%endif
#
%if %{with_ruby}
%package -n rubygem-libguestfs
Summary: Ruby bindings for libguestfs
Group: System/Filesystems
%description -n rubygem-libguestfs
Ruby bindings for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%endif
%package data
Summary: Virtual machine needed for libguestfs
Group: System/Filesystems
Version: 15
Release: 0
Requires: %{name}
%description data
libguestfs needs for it's run virtual machine image. This package provides such
an image.
%package devel
Summary: Development files for libguestfs
Group: Development/System
%description devel
Development files for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%package -n libguestfs0
Summary: libguestfs library
Group: System/Filesystems
%description -n libguestfs0
Library for libguestfs.
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
disk images. You can use this for viewing and editing files inside guests,
scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V,
performing partial backups, cloning VMs, and much else besides.
libguestfs can access nearly any type of filesystem including: all known types
of Linux filesystem (ext2/3/4, XFS, btrfs etc), any Windows filesystem (VFAT
and NTFS), any Mac OS X and BSD filesystems, LVM2 volume management, MBR and
GPT disk partitions, raw disks, qcow2, VirtualBox VDI, VMWare VMDK, CD and DVD
ISOs, SD cards, and dozens more. libguestfs doesn't need root permissions.
All this functionality is available through a convenient shell called
guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
virtual machines.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch100 -p1
%patch101 -p1
%build
# disable qemu test.
# If the package is built within kvm the configure test will fail because it starts kvm within kvm
# With QEMU in environment qemu and kvm packages are not needed at build time.
export vmchannel_test=no
export QEMU=/usr/bin/qemu-kvm
# for configure macro below
CFLAGS="$RPM_OPT_FLAGS -Wno-unused"
CXXFLAGS="$RPM_OPT_FLAGS -Wno-unused"
autoreconf -fi
%configure \
--help || :
#sed -i '1 s@^.*@#!/bin/sh -x@' configure
%configure \
--enable-daemon \
--enable-install-daemon \
--with-qemu=$QEMU \
--without-java \
--disable-appliance \
--disable-haskell \
--disable-php \
%{_configure_fuse} \
%{_configure_ocaml} \
%{_configure_perl} \
%{_configure_python} \
%{_configure_ruby} \
--disable-rpath \
--disable-static
make %{?jobs:-j%jobs}
%install
%makeinstall
find $RPM_BUILD_ROOT \( -name "*.pod" -o -name ".packlist" \) -print0 | xargs -0 --no-run-if-empty rm -fv
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.{l,}a
touch %{name}.lang
%find_lang %{name}
#
cmds="`
objcopy -j .guestfsd_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout |
tr '\0' '\n' |
sort -u
`"
> cmds.txt
> missing_cmds.txt
for cmd in ls $cmds
do
if test -n "` PATH=$PATH:/sbin:/usr/sbin type -p $cmd `"
then
echo "#%%programs: $cmd" >> cmds.txt
else
echo "# missing: $cmd" >> cmds.txt
echo "$cmd" >> missing_cmds.txt
fi
done
head -n 1234 cmds.txt missing_cmds.txt
rm -rf mkinitrd
cp -av /lib/mkinitrd .
if patch -p0 --dry-run < %{S:42}
then
patch -p0 < %{S:42}
fi
for bad in \
setup-dm.sh \
setup-storage.sh
do
rm mkinitrd/scripts/${bad}
done
cp -avL %{S:10} mkinitrd/scripts/boot-guestfs.sh
cp -avL %{S:11} mkinitrd/scripts/setup-guestfs.sh
chmod 755 mkinitrd/scripts/*guestfs.sh
sed -i~ '
/^#@GUESTFS_EXT_CMDS@/ {
s@^.*@@
r cmds.txt
}
/@GUESTFS_MISSING_CMDS@/ {
s@^.*@missing_commands="@
r missing_cmds.txt
a \
"
}
' mkinitrd/scripts/boot-guestfs.sh
diff -u mkinitrd/scripts/boot-guestfs.sh~ mkinitrd/scripts/boot-guestfs.sh || :
/sbin/mkinitrd_setup \
-s $PWD/mkinitrd/scripts \
-i $PWD/mkinitrd
mkdir mkinitrd/boot_tmp
kver=`/sbin/get_kernel_version /boot/vmlinuz`
arch=`arch`
%ifarch %ix86
arch=i686 #?
%endif
cp -avL /boot/vmlinuz mkinitrd/boot_tmp/vmlinuz.${arch}
cp -avL /boot/System.map-${kver} mkinitrd/boot_tmp
env PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH} \
bash -x \
/sbin/mkinitrd \
-l $PWD/mkinitrd \
-k vmlinuz.${arch} \
-i initramfs.${arch}.img \
-b $PWD/mkinitrd/boot_tmp \
-m 'dm-mod loop' \
-B
#
mkdir -vp $RPM_BUILD_ROOT%{_libdir}/guestfs
cp -avLt $RPM_BUILD_ROOT%{_libdir}/guestfs/ \
mkinitrd/boot_tmp/initramfs.${arch}.img \
mkinitrd/boot_tmp/vmlinuz.${arch}
%clean
rm -rf $RPM_BUILD_ROOT
%post -n libguestfs0 -p /sbin/ldconfig
%postun -n libguestfs0 -p /sbin/ldconfig
%files doc
%defattr(-,root,root)
%{_datadir}/doc/libguestfs
%files data
%defattr(-,root,root)
%{_libdir}/guestfs
#
%if %{with_perl}
%post perl -p /sbin/ldconfig
%postun perl -p /sbin/ldconfig
%files perl
%defattr(-,root,root)
%perl_vendorarch/*
%endif
#
%if %{with_python}
%files python
%defattr(-,root,root)
%{_libdir}/python%{pyver}/site-packages/*
%endif
#
%if %{with_ruby}
%files -n rubygem-libguestfs
%defattr(-,root,root)
%{_libdir}/ruby
%endif
%files -n libguestfs0
%defattr(-,root,root)
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%{_includedir}/guestfs.h
%{_mandir}/man3/*
%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING README
%{_sbindir}/*
%{_bindir}/*
%config(noreplace) /etc/libguestfs-tools.conf
%config(noreplace) /etc/bash_completion.d/guestfish-bash-completion.sh
%{_mandir}/man1/*
%if %{with_ocaml}
%{_libdir}/ocaml
%endif
%changelog