%global gem_name virt-p2v # RHEL 7 and Fedora 17 onwards use ruby 1.9.1, previous versions use ruby 1.8 %if %{?fedora:0%{fedora} >= 17}%{?rhel:0%{rhel} >= 7} %global rubyabi 1.9.1 %else %global rubyabi 1.8 %endif # Conditionally set required macros for distros without rubygems-devel This can # be removed once https://bugzilla.redhat.com/show_bug.cgi?id=788001 is # resolved. %if %{?fedora:0%{fedora} >= 16}%{?rhel:0%{rhel} >= 7} %global have_rubygems_devel 1 %else %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version} %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version} %global gem_libdir %{gem_instdir}/lib %global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec %global have_rubygems_devel 0 %endif # Define ruby_sitearch if it isn't already defined %if %{?ruby_sitearch:0}%{?!ruby_sitearch:1} %global ruby_sitearch %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]') %endif Name: rubygem-virt-p2v Version: 0.9.0 Release: 1%{?dist}%{?extra_release} Summary: Send a machine's storage and metadata to virt-p2v-server Group: Applications/System License: GPLv2+ and LGPLv2+ URL: http://git.fedorahosted.org/git/virt-v2v.git Source0: https://fedorahosted.org/releases/v/i/virt-v2v/virt-v2v-v%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Backported upstream patches # Naming scheme: <name>-<version>-<local sequence number>-<git commit>.patch # name: virt-v2v # version: the version of virt-v2v the patch was originally rebased to # local seq no: the order the patches should be applied in # git commit: the first 8 characters of the git commit hash # We only build virt-p2v for i686 as we need it to run on the widest possible # set of hardware from a single boot image. ExclusiveArch: i686 BuildRequires: perl(Module::Build) %if %{have_rubygems_devel} BuildRequires: rubygems-devel %else BuildRequires: rubygems %endif BuildRequires: rubygem(rake) BuildRequires: ruby-devel # rblibssh2 dependencies BuildRequires: libssh2-devel Requires: ruby(abi) = %{rubyabi} Requires: rubygems Requires: rubygem(gtk2) Requires: ruby(dbus) Requires: /usr/bin/hwloc-info Requires: NetworkManager Requires: /usr/bin/openvt Provides: rubygem(%{gem_name}) = %{version} %description virt-p2v is a client which connects to a virt-p2v-server and transfer's the host machine's storage and metadata. virt-p2v is intended to be run from a live image, so it is unlikely you want to install it directly. %package doc Summary: Documentation for %{name} Group: Documentation BuildArch: noarch Requires: %{name} = %{version}-%{release} %description doc Documentation for %{name} %package -n virt-p2v-image-builder Summary: Create a virt-p2v bootable image BuildArch: noarch # image builder script requires Requires: /usr/bin/ksflatten Requires: /usr/sbin/setenforce Requires: /usr/bin/livecd-creator # Kickstart nochroot scripts requires Requires: /usr/bin/livecd-iso-to-disk Requires: /usr/bin/livecd-iso-to-pxeboot Requires: /usr/bin/image-minimizer %description -n virt-p2v-image-builder virt-p2v-image-builder is a tool to create a bootable virt-p2v live image. %prep %setup -q -n virt-v2v-v%{version} %build # Need this to pull the version number out %{__perl} Build.PL pushd p2v/client rake gem popd mkdir -p .%{gem_dir} export CONFIGURE_ARGS="--with-cflags='%{optflags}' --with-ldflags='%{optflags}'" gem install --local --install-dir ./%{gem_dir} \ --bindir ./%{_bindir} \ --force -V --rdoc p2v/client/pkg/%{gem_name}-%{version}.gem %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_bindir} \ %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}/ %if 0%{?gem_extdir:1} mkdir -p %{buildroot}%{gem_extdir}/lib/ mv %{buildroot}%{gem_instdir}/lib/rblibssh2.so \ %{buildroot}%{gem_extdir}/lib/ %else mkdir -p %{buildroot}%{ruby_sitearch} mv %{buildroot}%{gem_libdir}/rblibssh2.so \ %{buildroot}%{ruby_sitearch} %endif rm -rf %{buildroot}%{gem_instdir}/ext cp -pa .%{_bindir}/* \ %{buildroot}%{_bindir}/ find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x cp COPYING %{buildroot}/%{gem_instdir} # Install p2v-image-builder %global builderdir %{_datadir}/virt-p2v-image-builder builder=%{buildroot}/%{_bindir}/virt-p2v-image-builder mkdir -p %{buildroot}%{builderdir} cp p2v/image-builder/*.ks %{buildroot}%{builderdir} cp p2v/image-builder/virt-p2v-image-builder $builder # Set the default data directory sed -i -e 's,^DEFAULT_DATADIR=.*,DEFAULT_DATADIR=%{builderdir},' $builder %check pushd p2v/client # No tests yet #rake test popd %clean rm -rf %{buildroot} %files %defattr(-, root, root, -) %{_bindir}/virt-p2v %{_bindir}/virt-p2v-launcher %dir %{gem_instdir} %{gem_instdir}/bin %{gem_libdir} %doc %{gem_instdir}/COPYING %doc %{gem_instdir}/Manifest %doc %{gem_instdir}/Rakefile %doc %{gem_instdir}/%{gem_name}.gemspec %exclude %{gem_cache} %{gem_spec} %if 0%{?gem_extdir:1} %{gem_extdir} %else %{ruby_sitearch}/rblibssh2.so %endif %files doc %defattr(-, root, root, -) %{gem_docdir} %files -n virt-p2v-image-builder %defattr(-, root, root, -) %attr(0755, root, root) %{_bindir}/virt-p2v-image-builder %{builderdir} %changelog * Thu Dec 6 2012 Matthew Booth <mbooth@redhat.com> - 0.9.0-1 - New upstream release 0.9.0 * Wed Oct 10 2012 Matthew Booth <mbooth@redhat.com> - 0.8.9-1 - New upstream release 0.8.9 * Fri Oct 05 2012 VÃt Ondruch <vondruch@redhat.com> - 0.8.8-5 - Fix binary extension placement. - Various RHEL6 and Fedora 16 fixes. * Thu Oct 4 2012 Matthew Booth <mbooth@redhat.com> - 0.8.8-4 - Fix directory locations * Wed Oct 3 2012 Matthew Booth <mbooth@redhat.com> - 0.8.8-3 - Update ruby(abi) dependency to >= 1.9 * Wed Oct 3 2012 Matthew Booth <mbooth@redhat.com> - 0.8.8-1 - New upstream release 0.8.8 * Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Mon Aug 22 2011 Richard Jones <rjones@redhat.com> - 0.8.3-1 - Initial Fedora build.