# # spec file for package libguestfs # # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2011 Michal Hrusecky # # 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 1 %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 Requires: perl(Data::Dumper) Requires: perl(File::Basename) Requires: perl(File::Temp) Requires: perl(File::Temp) Requires: perl(Getopt::Long) Requires: perl(Locale::TextDomain) Requires: perl(Pod::Usage) Requires: perl(String::ShellQuote) Requires: perl(Sys::Guestfs) Requires: perl(Sys::Guestfs::Lib) Requires: perl(Sys::Guestfs::Lib) Requires: perl(Win::Hivex) Requires: perl(Win::Hivex::Regedit) %if %suse_version >= 1140 BuildRequires: augeas-devel %endif BuildRequires: attr-devel BuildRequires: autoconf BuildRequires: automake BuildRequires: file-devel BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gperf BuildRequires: hivex-devel %if %suse_version >= 1220 BuildRequires: libconfig-devel %endif BuildRequires: libtool BuildRequires: libvirt-devel BuildRequires: ncurses-devel BuildRequires: pcre-devel BuildRequires: pkg-config BuildRequires: readline-devel # perl as included in openSuSE 11.4 has this, but an older version without html_charset # perl as included in openSuSE 12.1 includes 3.16, so require at least this version BuildRequires: perl(Pod::Simple::XHTML) >= 3.16 # %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) BuildRequires: perl(String::ShellQuote) BuildRequires: perl(Win::Hivex) BuildRequires: perl(Win::Hivex::Regedit) 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.37 Release: 0 Patch5: libguestfs-1.13.14-ruby.patch Patch100: 0001-force-virtio_blk-in-old-guest-kernel.patch Source0: %{name}-%{version}.tar.gz Source10: libguestfs.mkinitrd.boot.sh Source11: libguestfs.mkinitrd.setup.sh 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 guestfsd Summary: Provides guestfsd for the appliance Group: System/Filesystems %description guestfsd guestfsd runs within the appliance. It receives commands from the host and performs the requested action by calling the helper binaries. This package is only required for building the appliance. %package doc Summary: Documentation for libguestfs Group: Documentation/Other %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_ocaml} %package -n ocaml-libguestfs Summary: Provides OCaml support for libguestfs Group: System/Filesystems %description -n ocaml-libguestfs Allows OCaml scripts to directly use libguestfs. %package -n ocaml-libguestfs-devel Summary: Provides OCaml support for libguestfs Group: Development/Libraries/Other %description -n ocaml-libguestfs-devel Allows OCaml scripts to directly use libguestfs. %endif # %if %{with_perl} %package -n perl-Sys-Guestfs Summary: Provides Perl support for libguestfs Group: System/Filesystems Provides: libguestfs-perl = %{version} Obsoletes: libguestfs-perl < %{version} Requires: perl = %{perl_version} %description -n perl-Sys-Guestfs Allows Perl scripts to directly use libguestfs. %endif # %if %{with_python} %package -n python-libguestfs Summary: Provides Python support for libguestfs Group: System/Filesystems Provides: libguestfs-python = %{version} Obsoletes: libguestfs-python < %{version} %description -n python-libguestfs Allows Python scripts to directly use libguestfs. %endif # %if %{with_ruby} %package -n rubygem-libguestfs Summary: Ruby bindings for libguestfs Group: System/Filesystems %description -n rubygem-libguestfs Allows Ruby scripts to directly use libguestfs. %endif %package data # kernel-default needs that %if %{?sles_version}0 > 0 BuildRequires: sles-release %endif BuildRequires: btrfsprogs BuildRequires: bzip2 BuildRequires: coreutils BuildRequires: cpio BuildRequires: cryptsetup BuildRequires: diffutils BuildRequires: dosfstools BuildRequires: e2fsprogs BuildRequires: file BuildRequires: findutils BuildRequires: gawk BuildRequires: genisoimage BuildRequires: glibc BuildRequires: grep BuildRequires: gzip BuildRequires: iproute2 BuildRequires: kernel-default BuildRequires: lvm2 BuildRequires: mdadm BuildRequires: mkinitrd BuildRequires: module-init-tools BuildRequires: ntfs-3g BuildRequires: ntfsprogs BuildRequires: parted BuildRequires: rsync BuildRequires: strace BuildRequires: tar BuildRequires: udev BuildRequires: util-linux BuildRequires: xfsprogs BuildRequires: xz BuildRequires: zerofree Summary: Virtual machine needed for libguestfs Group: System/Filesystems %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/Libraries/Other %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 %patch5 -p1 %patch100 -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 # 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir instead of the site dir make \ INSTALLDIRS=vendor \ LD_RUN_PATH= \ %{?jobs:-j%jobs} %install %makeinstall %perl_process_packlist rm -f $RPM_BUILD_ROOT/%{_libdir}/*.{l,}a touch %{name}.lang %find_lang %{name} # ext_cmds="` objcopy -j .guestfsd_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout | tr '\0' '\n' | sort -u `" test -n "$ext_cmds" # > ext_cmds.txt > missing_cmds.txt # guestfs may call mkfs, but it cant tell in advance which filesystems # it must support. Collect a manual list of possible filesystems so that # the commands get included in the initrd. for fs in \ ext2 \ ext3 \ ext4 \ ntfs \ reiserfs \ jfs \ gfs \ gfs2 \ vfat \ msdos \ ufs \ ; do echo mkfs.$fs done >> ext_cmds.txt # for cmd in ls $ext_cmds do if test -n "` PATH=$PATH:/sbin:/usr/sbin type -p $cmd `" then echo "#%%programs: $cmd" >> ext_cmds.txt else echo "# missing: $cmd" >> ext_cmds.txt echo "$cmd" >> missing_cmds.txt fi done head -n 1234 ext_cmds.txt missing_cmds.txt rm -rf mkinitrd cp -av /lib/mkinitrd . for bad in \ setup-dm.sh \ setup-storage.sh \ boot-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 ext_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 # [Bug 778149] mkinitrd does not copy links correctly mkdir mkinitrd/bin_tmp for cmd in ` awk '/^#%%programs:/ { print $2 }' mkinitrd/scripts/boot-guestfs.sh | sort -u ` do cp -v ` PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH}:/sbin:/usr/sbin type -p $cmd ` mkinitrd/bin_tmp/ || : done chmod -v 755 mkinitrd/bin_tmp/* # env PATH=$PWD/mkinitrd/bin_tmp:${PATH} \ bash -x \ /sbin/mkinitrd \ -l $PWD/mkinitrd \ -k vmlinuz.${arch} \ -i initramfs.${arch}.img \ -b $PWD/mkinitrd/boot_tmp \ -m '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_ocaml} %files -n ocaml-libguestfs %defattr(-,root,root) %dir %{_libdir}/ocaml %dir %{_libdir}/ocaml/guestfs %{_libdir}/ocaml/guestfs/META %{_libdir}/ocaml/guestfs/*.cmi %{_libdir}/ocaml/guestfs/*.cma %{_libdir}/ocaml/stublibs %files -n ocaml-libguestfs-devel %defattr(-,root,root) %dir %{_libdir}/ocaml %dir %{_libdir}/ocaml/guestfs %{_libdir}/ocaml/guestfs/*.a %{_libdir}/ocaml/guestfs/*.cmx %{_libdir}/ocaml/guestfs/*.cmxa %{_libdir}/ocaml/guestfs/*.mli %endif # %if %{with_perl} %post -n perl-Sys-Guestfs -p /sbin/ldconfig %postun -n perl-Sys-Guestfs -p /sbin/ldconfig %files -n perl-Sys-Guestfs %defattr(-,root,root) %perl_vendorarch/* %endif # %if %{with_python} %files -n python-libguestfs %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 guestfsd %defattr(-,root,root) %{_sbindir}/guestfsd %files -f %{name}.lang %defattr(-,root,root) %doc AUTHORS COPYING README %{_bindir}/* %config(noreplace) /etc/libguestfs-tools.conf %config(noreplace) /etc/bash_completion.d/guestfish-bash-completion.sh %{_mandir}/man1/* %changelog