psss / rpms / libguestfs

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