# # 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_tools 1 %define with_ocaml_bindings 1 %define with_lua_bindings 1 %define with_python_bindings 1 %define with_perl_bindings 1 %define with_ruby_bindings 1 %define with_fuse 1 %define with_hivex 1 %define with_zerofree 1 # disable certain features for a SLES11 build %if %suse_version == 1110 %if "%_project" == "Virtualization" # leave features enabled in OBS main repo %else %define with_ocaml_bindings 0 %define with_lua_bindings 0 %define with_perl_bindings 0 %define with_python_bindings 0 %define with_ruby_bindings 0 %define with_hivex 0 %define with_zerofree 0 %endif %endif # # The following defines are overridden in the individual subpackages %define _configure_fuse --disable-fuse %define _configure_lua --disable-lua %define _configure_ocaml --disable-ocaml %define _configure_perl --disable-perl %define _configure_python --disable-python %define _configure_ruby --disable-ruby # %define guestfs_docdir %{_defaultdocdir}/%{name} # Name: libguestfs ExclusiveArch: %ix86 x86_64 BuildRequires: libacl-devel BuildRequires: autoconf BuildRequires: automake BuildRequires: aaa_base BuildRequires: attr-devel BuildRequires: augeas-devel BuildRequires: autoconf BuildRequires: automake BuildRequires: file-devel BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gperf BuildRequires: libcap-devel %if %suse_version >= 1220 BuildRequires: libconfig-devel %endif BuildRequires: libtool BuildRequires: libvirt-devel >= 0.10.2 BuildRequires: ncurses-devel BuildRequires: perl-macros BuildRequires: pcre-devel BuildRequires: pkg-config BuildRequires: readline-devel # %if %{with_ocaml_bindings} %define with_ocaml_tools 1 %endif %if %{with_ocaml_tools} # Required to build tools, its independent from bindings BuildRequires: ocaml BuildRequires: ocaml-findlib %define _configure_ocaml --enable-ocaml %endif # %if %{with_fuse} BuildRequires: fuse-devel %define _configure_fuse --enable-fuse %endif # %if %{with_hivex} BuildRequires: hivex-devel %endif # Url: http://libguestfs.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: Compatibility package for guestfs-tools License: GPL-2 Group: System/Filesystems Version: 1.20.0 Release: 0 Patch795503: 0001-daemon-copy-entire-lvm-directory.patch Patch5: libguestfs-1.13.14-ruby.patch Patch1000: 1000-force-virtio_blk-in-old-guest-kernel.patch Source0: %{name}-%{version}.tar.gz Source789653: Pod-Simple-3.23.tar.gz Source10: libguestfs.mkinitrd.boot.sh Source11: libguestfs.mkinitrd.setup.sh Source1220: libguestfs.mkinitrd.1220.patch Source1210: libguestfs.mkinitrd.1210.patch Source1110: libguestfs.mkinitrd.1110.patch Requires: guestfs-tools %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 -n guestfs-tools Summary: Tools for accessing and modifying virtual machine disk images Group: System/Filesystems Provides: %{name} = %{version} Obsoletes: %{name} < %{version} Requires: kvm >= 1.1 %if %{with_perl_bindings} Requires: perl(Data::Dumper) Requires: perl(File::Basename) 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) %if %{with_hivex} Requires: perl(Win::Hivex) Requires: perl(Win::Hivex::Regedit) %endif %endif %{perl_requires} Recommends: guestfs-data Conflicts: guestfs-data < %{version} Conflicts: libguestfs0 < %{version} %description -n guestfs-tools 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 guestfsd Summary: Daemon for the libguestfs appliance Group: System/Filesystems %description -n guestfsd guestfsd runs within the libguestfs 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. # %if %{with_ocaml_bindings} %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_bindings} %package -n perl-Sys-Guestfs Summary: Provides Perl support for libguestfs Group: System/Filesystems BuildRequires: perl BuildRequires: perl(Data::Dumper) BuildRequires: perl(Getopt::Long) BuildRequires: perl(Locale::TextDomain) BuildRequires: perl(Pod::Usage) BuildRequires: perl(String::ShellQuote) BuildRequires: perl(Sys::Virt) %if %{with_hivex} BuildRequires: perl(Win::Hivex) BuildRequires: perl(Win::Hivex::Regedit) %endif %define _configure_perl --enable-perl # Provides: libguestfs-perl = %{version} Obsoletes: libguestfs-perl < %{version} Requires: perl(File::Temp) Requires: perl(Locale::TextDomain) %perl_requires %description -n perl-Sys-Guestfs Allows Perl scripts to directly use libguestfs. %endif # %if %{with_lua_bindings} %package -n lua-libguestfs Summary: Provides Lua support for libguestfs Group: System/Filesystems BuildRequires: lua-devel %define _configure_lua --enable-lua # %description -n lua-libguestfs Allows lua scripts to directly use libguestfs. %endif # %if %{with_python_bindings} %package -n python-libguestfs Summary: Provides Python support for libguestfs Group: System/Filesystems %define pyver %(python -c "import sys; print sys.version[:3]") BuildRequires: python BuildRequires: python-devel %define _configure_python --enable-python # Provides: libguestfs-python = %{version} Obsoletes: libguestfs-python < %{version} %description -n python-libguestfs Allows Python scripts to directly use libguestfs. %endif # %if %{with_ruby_bindings} %package -n rubygem-libguestfs Summary: Ruby bindings for libguestfs Group: System/Filesystems BuildRequires: ruby BuildRequires: ruby-devel BuildRequires: rubygem-rake %define _configure_ruby --enable-ruby # %description -n rubygem-libguestfs Allows Ruby scripts to directly use libguestfs. %endif %package -n guestfs-data # kernel-default needs that %if %{?sles_version}0 > 0 BuildRequires: sles-release %endif BuildRequires: augeas-lenses BuildRequires: btrfsprogs BuildRequires: bzip2 BuildRequires: coreutils BuildRequires: cpio BuildRequires: cryptsetup BuildRequires: diffutils BuildRequires: dosfstools BuildRequires: e2fsprogs # ext4 in the sles11 kernel-binary.rpm packages operates only in read-only mode. # The generated initrd operates inside the temporary guest on image files. # For that reason it needs to make modifications to any kind of filesystems. # Make use of an ext4 driver with write support. But: # This package exists only in the internal buildservice, so require it only there. %if %suse_version == 1110 %if "%_project" == "Virtualization" # package does not exist in OBS main repo %else BuildRequires: ext4-writeable-kmp-default %endif %endif BuildRequires: file BuildRequires: findutils BuildRequires: gawk BuildRequires: genisoimage BuildRequires: glibc BuildRequires: grep BuildRequires: gzip BuildRequires: iproute2 BuildRequires: jfsutils BuildRequires: kernel-default BuildRequires: lvm2 BuildRequires: mdadm BuildRequires: mkinitrd BuildRequires: module-init-tools BuildRequires: ntfs-3g BuildRequires: ntfsprogs BuildRequires: parted BuildRequires: reiserfs BuildRequires: rsync BuildRequires: strace BuildRequires: tar BuildRequires: terminfo-base BuildRequires: udev BuildRequires: util-linux BuildRequires: xfsprogs BuildRequires: xz %if %{with_zerofree} BuildRequires: zerofree %endif Summary: Virtual machine needed for libguestfs Group: System/Filesystems Provides: libguestfs-data = %{version} Obsoletes: libguestfs-data < %{version} %description -n guestfs-data libguestfs needs for it's run a virtual machine image. This package provides such an image, an initrd and a kernel. %package devel Summary: Development files for libguestfs Group: Development/Libraries/Other Requires: libguestfs0 = %{version} %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 License: LGPL-2.1 Summary: Runtime library of libguestfs 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 -a 789653 %patch795503 -p1 %patch5 -p1 %patch1000 -p1 %build # [Bug 789653] sles11 perl obsoletes perl-Pod-Simple unconditionally export PERLLIB=`echo $PWD/Pod-Simple-*/lib` # 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" # If the kernel happens to have no virtio-scsi force virtio-blk usage in the tools # This is true for kernel.rpm included in 12.1 and older if /sbin/modinfo -k `env PATH=/sbin:/usr/sbin:$PATH get_kernel_version /boot/vmlinuz` virtio-scsi then : use virtio-scsi, which is the default in libguestfs else CFLAGS="$CFLAGS -DGUESTFS_QEMU_NO_VIRTIO_BLK" CXXFLAGS="$CXXFLAGS -DGUESTFS_QEMU_NO_VIRTIO_BLK" fi am_version="`automake --version | awk '/^automake \(GNU automake\) / { print $4 }'`" if test -n "${am_version}" then case "${am_version}" in 1.10) ;; 1.10.*) ;; *) autoreconf -fi ;; esac fi # %configure \ --help || : #sed -i '1 s@^.*@#!/bin/sh -x@' configure %configure \ --docdir=%{guestfs_docdir} \ --enable-daemon \ --enable-install-daemon \ --with-qemu=$QEMU \ --without-java \ --disable-appliance \ --disable-haskell \ --disable-php \ %{_configure_fuse} \ %{_configure_lua} \ %{_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 #remove ocaml bindings files if they are disable via rpm macro %if !%{with_ocaml_bindings} rm -rfv $RPM_BUILD_ROOT%{_libdir}/ocaml %endif rm -rfv $RPM_BUILD_ROOT%{guestfs_docdir} find $RPM_BUILD_ROOT -type f \( \ -name "virt-list-filesystems" -o -name "virt-list-filesystems.*" -o \ -name "virt-list-partitions" -o -name "virt-list-partitions.*" -o \ -name "virt-tar" -o -name "virt-tar.*" \ \) -print -delete %if %{with_perl_bindings} # Delete empty perl bootstrap files find $RPM_BUILD_ROOT -name "*.bs" -size 0c -print -delete # Delete unused perl script without executable permissions find $RPM_BUILD_ROOT%perl_vendorarch/ -name bindtests.pl -print -delete %perl_process_packlist %perl_gen_filelist # the macro above packages everything, here only the perl files are desrired grep "%perl_vendorarch/" %{name}.files | tee t mv t %{name}.files %endif # find $RPM_BUILD_ROOT -name "*.la" -print -delete rm -fv $RPM_BUILD_ROOT/%{_libdir}/*.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. ext_cmds="$ext_cmds sparsify strace ` for fs in \ ext2 \ ext3 \ ext4 \ fuse \ ntfs \ ntfs-3g \ reiserfs \ jfs \ gfs \ gfs2 \ vfat \ msdos \ ufs \ ; do if test -x /sbin/mount.$fs || test -x /usr/sbin/mount.$fs then echo mount.$fs fi echo mkfs.$fs echo fsck.$fs done ` " # 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 || : # %if %suse_version < 1230 patched= for p in \ %{S:1220} \ %{S:1210} \ %{S:1110} \ ; do if patch --dry-run -p1 < $p then patch -p1 < $p patched=$p break elif patch --dry-run -R -p1 < $p then patched=$p break fi done test -n "$patched" %endif /sbin/mkinitrd_setup \ -s $PWD/mkinitrd/scripts \ -i $PWD/mkinitrd mkdir mkinitrd/boot_tmp kver=`env PATH=/sbin:/usr/sbin:$PATH get_kernel_version /boot/vmlinuz` arch=`arch` %ifarch %ix86 arch=i586 %endif cp -avL /boot/vmlinuz mkinitrd/boot_tmp/vmlinuz.${arch} cp -avL /boot/System.map-${kver} mkinitrd/boot_tmp %if 0 # [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/* %endif # additional_modules=" " 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 "$additional_modules" \ -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 -n guestfs-data %defattr(-,root,root) %{_libdir}/guestfs %if %{with_ocaml_bindings} %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_lua_bindings} %files -n lua-libguestfs %defattr(-,root,root) %{_libdir}/lua %endif # %if %{with_perl_bindings} %post -n perl-Sys-Guestfs -p /sbin/ldconfig %postun -n perl-Sys-Guestfs -p /sbin/ldconfig %files -n perl-Sys-Guestfs -f %{name}.files %defattr(-,root,root) %endif # %if %{with_python_bindings} %files -n python-libguestfs %defattr(-,root,root) %{_libdir}/python%{pyver}/site-packages/* %endif # %if %{with_ruby_bindings} %files -n rubygem-libguestfs %defattr(-,root,root) %{_libdir}/ruby %endif %files -n libguestfs0 %defattr(-,root,root) %doc COPYING.LIB %{_libdir}/*.so.* %files devel %defattr(-,root,root) %{_libdir}/*.so %{_libdir}/pkgconfig/* %{_includedir}/guestfs.h %{_mandir}/man3/* %files -n guestfsd %defattr(-,root,root) %{_sbindir}/guestfsd %{_mandir}/man8/* %files -n guestfs-tools -f %{name}.lang %defattr(-,root,root) %doc COPYING %{_bindir}/* %config(noreplace) /etc/libguestfs-tools.conf %config(noreplace) /etc/bash_completion.d/guestfish-bash-completion.sh %{_mandir}/man1/* %changelog