psss / rpms / libguestfs

Forked from rpms/libguestfs 5 years ago
Clone
e8b9539
# Enable to build w/o network.
e8b9539
%global buildnonet 1
e8b9539
e8b9539
Summary:     Access and modify virtual machine disk images
e8b9539
Name:        libguestfs
3ed2a95
Version:     1.0.23
e76964d
Release:     3%{?dist}
e8b9539
License:     LGPLv2+
e8b9539
Group:       Development/Libraries
e8b9539
URL:         http://et.redhat.com/~rjones/libguestfs/
e8b9539
Source0:     http://et.redhat.com/~rjones/libguestfs/files/%{name}-%{version}.tar.gz
e8b9539
BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root
e8b9539
e8b9539
# Currently fails on non-x86 because of this error:
e8b9539
# "qemu: linux kernel too old to load a ram disk"
e8b9539
ExclusiveArch: %{ix86} x86_64
e8b9539
e8b9539
# Basic build requirements:
e8b9539
BuildRequires: /usr/bin/pod2man
e8b9539
BuildRequires: /usr/bin/pod2text
3ed2a95
BuildRequires: febootstrap >= 2.0
e8b9539
BuildRequires: augeas-devel >= 0.5.0
e8b9539
BuildRequires: readline-devel
e76964d
#BuildRequires: qemu >= 0.10-7
e8b9539
BuildRequires: createrepo
e8b9539
e8b9539
# This is only needed for RHEL 5 because readline-devel doesn't
e8b9539
# properly depend on it, but doesn't do any harm on other platforms:
e8b9539
BuildRequires: ncurses-devel
e8b9539
e8b9539
# Build requirements for the appliance:
e8b9539
# (see 'make-initramfs.sh.in' in the source)
e76964d
BuildRequires: kernel, bash, coreutils, lvm2
e8b9539
BuildRequires: MAKEDEV, net-tools, augeas-libs, file
e8b9539
BuildRequires: module-init-tools, procps, strace, iputils
e8b9539
BuildRequires: grub, dosfstools, ntfsprogs
e76964d
# ntfs-3g util-linux-ng
e8b9539
e8b9539
# These are only required if you want to build the bindings for
e8b9539
# different languages:
e8b9539
BuildRequires: ocaml
e8b9539
BuildRequires: ocaml-findlib-devel
e76964d
#BuildRequires: perl-devel
e76964d
#BuildRequires: perl-Test-Simple
e8b9539
BuildRequires: perl-Test-Pod
e8b9539
BuildRequires: perl-Test-Pod-Coverage
e76964d
#BuildRequires: perl-ExtUtils-MakeMaker
e8b9539
BuildRequires: python-devel
e8b9539
BuildRequires: ruby-devel
e8b9539
BuildRequires: rubygem-rake
e8b9539
BuildRequires: java >= 1.5.0
e8b9539
BuildRequires: jpackage-utils
e8b9539
BuildRequires: java-devel
e8b9539
e8b9539
# For virt-inspector:
e76964d
#BuildRequires: perl-Sys-Virt
e8b9539
e8b9539
# Runtime requires:
e8b9539
Requires:    qemu >= 0.10-7
e8b9539
e8b9539
e8b9539
%description
e8b9539
Libguestfs is a library for accessing and modifying guest disk images.
e8b9539
Amongst the things this is good for: making batch configuration
e8b9539
changes to guests, getting disk used/free statistics (see also:
e8b9539
virt-df), migrating between virtualization systems (see also:
e8b9539
virt-p2v), performing partial backups, performing partial guest
e8b9539
clones, cloning guests and changing registry/UUID/hostname info, and
e8b9539
much else besides.
e8b9539
e8b9539
Libguestfs uses Linux kernel and qemu code, and can access any type of
e8b9539
guest filesystem that Linux and qemu can, including but not limited
e8b9539
to: ext2/3/4, btrfs, FAT and NTFS, LVM, many different disk partition
e8b9539
schemes, qcow, qcow2, vmdk.
e8b9539
e8b9539
Libguestfs provides ways to enumerate guest storage (eg. partitions,
e8b9539
LVs, what filesystem is in each LV, etc.).  It can also run commands
e8b9539
in the context of the guest.  Also you can access filesystems over FTP.
e8b9539
e8b9539
Libguestfs is a library that can be linked with C and C++ management
e8b9539
programs.
e8b9539
e8b9539
See also the 'guestfish' package for shell scripting and command line
e8b9539
access.
e8b9539
e8b9539
For Perl bindings, see 'perl-libguestfs'.
e8b9539
e8b9539
For OCaml bindings, see 'ocaml-libguestfs-devel'.
e8b9539
e8b9539
For Python bindings, see 'python-libguestfs'.
e8b9539
e8b9539
For Ruby bindings, see 'ruby-libguestfs'.
e8b9539
e8b9539
For Java bindings, see 'libguestfs-java-devel'.
e8b9539
e8b9539
e8b9539
%package devel
e8b9539
Summary:     Development tools and libraries for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    pkgconfig
e8b9539
e8b9539
e8b9539
%description devel
e8b9539
%{name}-devel contains development tools and libraries
e8b9539
for %{name}.
e8b9539
e8b9539
e8b9539
%package -n guestfish
e8b9539
Summary:     Shell for accessing and modifying virtual machine disk images
e8b9539
Group:       Development/Tools
e8b9539
License:     GPLv2+
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    /usr/bin/pod2text
e8b9539
e8b9539
e8b9539
%description -n guestfish
e8b9539
Guestfish is the Filesystem Interactive SHell, for accessing and
e8b9539
modifying virtual machine disk images from the command line and shell
e8b9539
scripts.
e8b9539
e8b9539
e76964d
#%package -n virt-inspector
e76964d
#Summary:     Display OS version, kernel, drivers, etc in a virtual machine
e76964d
#Group:       Development/Tools
e76964d
#License:     GPLv2+
e76964d
#Requires:    %{name} = %{version}-%{release}
e76964d
#Requires:    guestfish
e76964d
#Requires:    perl-Sys-Virt
e76964d
#
e76964d
#
e76964d
#%description -n virt-inspector
e76964d
#Virt-inspector examines a virtual machine and tries to determine the
e76964d
#version of the OS, the kernel version, what drivers are installed,
e76964d
#whether the virtual machine is fully virtualized (FV) or
e76964d
#para-virtualized (PV), what applications are installed and more.
e8b9539
e8b9539
e8b9539
%package -n ocaml-%{name}
e8b9539
Summary:     OCaml bindings for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
e8b9539
e8b9539
%description -n ocaml-%{name}
e8b9539
ocaml-%{name} contains OCaml bindings for %{name}.
e8b9539
e8b9539
This is for toplevel and scripting access only.  To compile OCaml
e8b9539
programs which use %{name} you will also need ocaml-%{name}-devel.
e8b9539
e8b9539
e8b9539
%package -n ocaml-%{name}-devel
e8b9539
Summary:     OCaml bindings for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    ocaml-%{name} = %{version}-%{release}
e8b9539
e8b9539
e8b9539
%description -n ocaml-%{name}-devel
e8b9539
ocaml-%{name}-devel contains development libraries
e8b9539
required to use the OCaml bindings for %{name}.
e8b9539
e8b9539
e8b9539
%package -n perl-%{name}
e8b9539
Summary:     Perl bindings for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
e8b9539
e8b9539
e8b9539
%description -n perl-%{name}
e8b9539
perl-%{name} contains Perl bindings for %{name}.
e8b9539
e8b9539
e8b9539
%package -n python-%{name}
e8b9539
Summary:     Python bindings for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
e8b9539
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
e8b9539
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
e8b9539
e8b9539
%description -n python-%{name}
e8b9539
python-%{name} contains Python bindings for %{name}.
e8b9539
e8b9539
e8b9539
%package -n ruby-%{name}
e8b9539
Summary:     Ruby bindings for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    ruby(abi) = 1.8
e8b9539
Provides:    ruby(guestfs) = %{version}
e8b9539
e8b9539
%{!?ruby_sitelib: %define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
e8b9539
%{!?ruby_sitearch: %define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
e8b9539
e8b9539
%description -n ruby-%{name}
e8b9539
ruby-%{name} contains Ruby bindings for %{name}.
e8b9539
e8b9539
e8b9539
%package java
e8b9539
Summary:     Java bindings for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    java >= 1.5.0
e8b9539
Requires:    jpackage-utils
e8b9539
e8b9539
%description java
e8b9539
%{name}-java contains Java bindings for %{name}.
e8b9539
e8b9539
If you want to develop software in Java which uses %{name}, then
e8b9539
you will also need %{name}-java-devel.
e8b9539
e8b9539
e8b9539
%package java-devel
e8b9539
Summary:     Java development package for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    %{name}-java = %{version}-%{release}
e8b9539
e8b9539
%description java-devel
e8b9539
%{name}-java-devel contains the tools for developing Java software
e8b9539
using %{name}.
e8b9539
e8b9539
See also %{name}-javadoc.
e8b9539
e8b9539
e8b9539
%package javadoc
e8b9539
Summary:     Java documentation for %{name}
e8b9539
Group:       Development/Libraries
e8b9539
Requires:    %{name} = %{version}-%{release}
e8b9539
Requires:    %{name}-java = %{version}-%{release}
e8b9539
Requires:    jpackage-utils
e8b9539
e8b9539
%description javadoc
e8b9539
%{name}-javadoc contains the Java documentation for %{name}.
e8b9539
e8b9539
e8b9539
%prep
e8b9539
%setup -q
e8b9539
e8b9539
mkdir -p daemon/m4
e8b9539
e8b9539
e8b9539
%build
e8b9539
%if %{buildnonet}
e8b9539
mkdir repo
e8b9539
find /var/cache/yum/build -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
e8b9539
createrepo repo
da2643d
%define extra --with-mirror=file://$(pwd)/repo --with-repo=epel-5 --with-updates=none
e8b9539
%else
e8b9539
%define extra %nil
e8b9539
%endif
e8b9539
da2643d
vmchannel_test=no \
e8b9539
./configure \
e8b9539
  --prefix=%{_prefix} --libdir=%{_libdir} \
e8b9539
  --mandir=%{_mandir} \
e8b9539
  --with-java-home=%{java_home} \
e8b9539
  --with-qemu="qemu-kvm qemu-system-%{_build_arch} qemu" \
e8b9539
  --enable-debug-command \
e8b9539
  %{extra}
e8b9539
e8b9539
# This ensures that /usr/sbin/chroot is on the path.  Not needed
e8b9539
# except for RHEL 5, it shouldn't do any harm on other platforms.
e8b9539
export PATH=/usr/sbin:$PATH
e8b9539
e8b9539
# 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir
e8b9539
# not the site dir.
e8b9539
make INSTALLDIRS=vendor %{?_smp_mflags}
e8b9539
e8b9539
e8b9539
%install
e8b9539
rm -rf $RPM_BUILD_ROOT
e8b9539
e8b9539
make DESTDIR=$RPM_BUILD_ROOT install
e8b9539
e8b9539
rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.a
e8b9539
rm $RPM_BUILD_ROOT%{_libdir}/libguestfs.la
e8b9539
e8b9539
# Clean up the examples/ directory which will get installed in %doc.
e8b9539
# Note we can't delete the original examples/Makefile because that
e8b9539
# will be needed by the check section later in the RPM build.
e8b9539
cp -a examples ex
e8b9539
pushd ex
e8b9539
make clean
e8b9539
rm Makefile*
e8b9539
rm -rf .deps .libs
e8b9539
popd
e8b9539
e8b9539
# Same for ocaml/examples.
e8b9539
cp -a ocaml/examples ocaml/ex
e8b9539
pushd ocaml/ex
e8b9539
make clean
e8b9539
rm Makefile*
e8b9539
popd
e8b9539
e8b9539
find $RPM_BUILD_ROOT -name perllocal.pod -delete
e8b9539
find $RPM_BUILD_ROOT -name .packlist -delete
e8b9539
find $RPM_BUILD_ROOT -name '*.bs' -delete
e8b9539
e8b9539
rm $RPM_BUILD_ROOT%{python_sitearch}/libguestfsmod.a
e8b9539
rm $RPM_BUILD_ROOT%{python_sitearch}/libguestfsmod.la
e8b9539
e8b9539
if [ "$RPM_BUILD_ROOT%{python_sitearch}" != "$RPM_BUILD_ROOT%{python_sitelib}" ]; then
e8b9539
   mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
e8b9539
   mv $RPM_BUILD_ROOT%{python_sitearch}/guestfs.py* \
e8b9539
     $RPM_BUILD_ROOT%{python_sitelib}/
e8b9539
fi
e8b9539
e8b9539
# Install ruby bindings by hand.
e8b9539
mkdir -p $RPM_BUILD_ROOT%{ruby_sitelib}
e8b9539
mkdir -p $RPM_BUILD_ROOT%{ruby_sitearch}
e8b9539
install -p -m0644 ruby/lib/guestfs.rb $RPM_BUILD_ROOT%{ruby_sitelib}
e8b9539
install -p -m0755 ruby/ext/guestfs/_guestfs.so $RPM_BUILD_ROOT%{ruby_sitearch}
e8b9539
e8b9539
# Remove static-linked Java bindings.
e8b9539
rm $RPM_BUILD_ROOT%{_libdir}/libguestfs_jni.a
e8b9539
rm $RPM_BUILD_ROOT%{_libdir}/libguestfs_jni.la
e8b9539
e8b9539
# Generator shouldn't be executable when we distribute it.
e8b9539
chmod -x src/generator.ml
e8b9539
e8b9539
e8b9539
%clean
e8b9539
rm -rf $RPM_BUILD_ROOT
e8b9539
e8b9539
e8b9539
%post -p /sbin/ldconfig
e8b9539
e8b9539
%postun -p /sbin/ldconfig
e8b9539
e8b9539
e8b9539
%files
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc COPYING
e8b9539
%{_libdir}/guestfs/
e8b9539
%{_libdir}/libguestfs.so.*
e8b9539
e8b9539
e8b9539
%files devel
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc ChangeLog HACKING TODO README ex html/guestfs.3.html html/pod.css
e8b9539
%doc src/generator.ml
e8b9539
%{_libdir}/libguestfs.so
e8b9539
%{_mandir}/man3/guestfs.3*
e8b9539
%{_includedir}/guestfs.h
e8b9539
%{_includedir}/guestfs-actions.h
e8b9539
%{_includedir}/guestfs-structs.h
e8b9539
%{_libdir}/pkgconfig/libguestfs.pc
e8b9539
e8b9539
e8b9539
%files -n guestfish
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc html/guestfish.1.html html/pod.css recipes/
e8b9539
%{_bindir}/guestfish
e8b9539
%{_mandir}/man1/guestfish.1*
e8b9539
e8b9539
e76964d
#%files -n virt-inspector
e76964d
#%defattr(-,root,root,-)
e76964d
#%{_bindir}/virt-inspector
e76964d
#%{_mandir}/man1/virt-inspector.1*
e8b9539
e8b9539
e8b9539
%files -n ocaml-%{name}
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc README
e8b9539
%{_libdir}/ocaml/guestfs
e8b9539
%exclude %{_libdir}/ocaml/guestfs/*.a
e8b9539
%exclude %{_libdir}/ocaml/guestfs/*.cmxa
e8b9539
%exclude %{_libdir}/ocaml/guestfs/*.cmx
e8b9539
%exclude %{_libdir}/ocaml/guestfs/*.mli
e8b9539
%{_libdir}/ocaml/stublibs/*.so
e8b9539
%{_libdir}/ocaml/stublibs/*.so.owner
e8b9539
e8b9539
e8b9539
%files -n ocaml-%{name}-devel
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc ocaml/ex
e8b9539
%{_libdir}/ocaml/guestfs/*.a
e8b9539
%{_libdir}/ocaml/guestfs/*.cmxa
e8b9539
%{_libdir}/ocaml/guestfs/*.cmx
e8b9539
%{_libdir}/ocaml/guestfs/*.mli
e8b9539
e8b9539
e8b9539
%files -n perl-%{name}
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc perl/examples
e8b9539
%{perl_vendorarch}/*
e8b9539
%{_mandir}/man3/Sys::Guestfs.3pm*
e8b9539
e8b9539
e8b9539
%files -n python-%{name}
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc README
e8b9539
%{python_sitearch}/*
e8b9539
%{python_sitelib}/*.py
e76964d
#%{python_sitelib}/*.pyc
e76964d
#%{python_sitelib}/*.pyo
e8b9539
e8b9539
e8b9539
%files -n ruby-%{name}
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc README
e8b9539
%{ruby_sitelib}/guestfs.rb
e8b9539
%{ruby_sitearch}/_guestfs.so
e8b9539
e8b9539
e8b9539
%files java
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc README
e8b9539
%{_libdir}/libguestfs_jni*.so.*
e8b9539
%{_datadir}/java/*.jar
e8b9539
e8b9539
e8b9539
%files java-devel
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc README
e8b9539
%{_libdir}/libguestfs_jni*.so
e8b9539
e8b9539
e8b9539
%files javadoc
e8b9539
%defattr(-,root,root,-)
e8b9539
%doc README
e8b9539
%{_datadir}/javadoc/%{name}-java-%{version}
e8b9539
e8b9539
e8b9539
%changelog
e76964d
* Mon May 11 2009 Richard Jones <rjones@redhat.com> - 1.0.23-3
3ed2a95
- New upstream version 1.0.23.
da2643d
- Disable vmchannel test.
da2643d
- Disable updates repo.
e76964d
- Fix specfile for EPEL build.
3ed2a95
e8b9539
* Fri May  8 2009 Richard Jones <rjones@redhat.com> - 1.0.21-2
e8b9539
- New upstream version 1.0.21.
e8b9539
e8b9539
* Thu May  7 2009 Richard Jones <rjones@redhat.com> - 1.0.20-2
e8b9539
- New upstream version 1.0.20.
e8b9539
e8b9539
* Thu May  7 2009 Richard Jones <rjones@redhat.com> - 1.0.19-1
e8b9539
- New upstream version 1.0.19.
e8b9539
e8b9539
* Tue Apr 28 2009 Richard Jones <rjones@redhat.com> - 1.0.15-1
e8b9539
- New upstream version 1.0.15.
e8b9539
e8b9539
* Fri Apr 24 2009 Richard Jones <rjones@redhat.com> - 1.0.12-1
e8b9539
- New upstream version 1.0.12.
e8b9539
e8b9539
* Wed Apr 22 2009 Richard Jones <rjones@redhat.com> - 1.0.6-1
e8b9539
- New upstream version 1.0.6.
e8b9539
e8b9539
* Mon Apr 20 2009 Richard Jones <rjones@redhat.com> - 1.0.2-1
e8b9539
- New upstream version 1.0.2.
e8b9539
e8b9539
* Thu Apr 16 2009 Richard Jones <rjones@redhat.com> - 0.9.9-12
e8b9539
- Multiple fixes to get it to scratch build in Koji.
e8b9539
e8b9539
* Sat Apr  4 2009 Richard Jones <rjones@redhat.com> - 0.9.9-1
e8b9539
- Initial build.