File virt-v2v.spec of Package virt-v2v

#
# spec file for package virt-v2v
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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/
#


Name:           virt-v2v
Version:        0.9.1
Release:        1%{?dist}%{?extra_release}
Summary:        Convert a virtual machine to run on KVM
License:        GPL-2.0+ and LGPL-2.1+
Group:          System/Management

Url:            http://git.fedorahosted.org/git/virt-v2v.git
Source0:        %{name}-v%{version}.tar.gz
Source1:        %{name}-rpmlintrc
Patch0:         add_suse_capabilities.patch
Patch1:         add_suse_converter.patch
Patch2:         remove_ide_iface.patch
Patch3:         fix_redhat_dup_grub_entries.patch
Patch4:         add_verbose_messaging.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# 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

# Build system direct requirements
BuildRequires:  gettext
BuildRequires:  perl
BuildRequires:  perl(ExtUtils::Manifest)
BuildRequires:  perl(Module::Build)
BuildRequires:  perl(Module::Find)
BuildRequires:  perl(Test::More)
BuildRequires:  perl(Test::Pod)
BuildRequires:  perl(Test::Pod::Coverage)

# Runtime perl modules also required at build time for use_ok test
BuildRequires:  perl(Archive::Extract)
BuildRequires:  perl(DateTime)
BuildRequires:  perl(Digest::SHA1)
BuildRequires:  perl(IO::String)
BuildRequires:  perl(Locale::TextDomain)
BuildRequires:  perl(Module::Pluggable)
BuildRequires:  perl(Net::HTTPS)
BuildRequires:  perl(Net::SSL)
BuildRequires:  perl(Sys::Guestfs)
BuildRequires:  perl(Sys::Virt)
BuildRequires:  perl(Term::ProgressBar)
BuildRequires:  perl(URI)
BuildRequires:  perl(XML::DOM)
BuildRequires:  perl(XML::DOM::XPath)

BuildRequires:  perl-Sys-Guestfs >= 1.14.0
BuildRequires:  perl-Win-Hivex >= 1.2.2

Requires:       perl-base
# Required for the name optional argument to add_drive_opts
Requires:       perl-Sys-Guestfs >= 1.14.0

# Undocumented from antiquity
Requires:       perl-Win-Hivex >= 1.2.2

# Required for passing flags to get_xml_description
Requires:       perl(Sys::Virt) >= 0.2.4

# Net::SSL and Net::HTTPS are loaded with require rather than use, which
# rpmbuild doesn't seem to discover automatically.
Requires:       perl(Net::HTTPS)
Requires:       perl(Net::SSL)

# Need >= 0.8.1 for rpc fix talking to RHEL 5 libvirt
Requires:       libvirt >= 0.8.1

# For GuestOS transfer image
Requires:       /usr/bin/mkisofs

# For guest image inspection
Requires:       /usr/bin/qemu-img

# For ssh transfers
Requires:       /usr/bin/ssh

#Additional requirements to run on openSUSE 12.3
Requires:       guestfs-tools >= 1.22
Requires:       perl-DateTime >= 0.72
Requires:       perl-Term-ProgressBar >= 2.10
Requires:       perl-XML-DOM >= 1.44
Requires:       perl-XML-DOM-XPath >= 0.14
Requires:       perl-XML-XPathEngine >= 0.13

%description
virt-v2v is a tool for converting and importing virtual machines to
libvirt-managed KVM, or Red Hat Enterprise Virtualization. It can import a
variety of guest operating systems from libvirt-managed hosts and VMware ESX.


%prep
%setup -q -n %{name}-v%{version}

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

%build
%{__perl} Build.PL
./Build

# perl doesn't need debuginfo
%define debug_package %{nil}

%install
rm -rf %{buildroot}
./Build install \
    --destdir %{buildroot} \
    --installdirs vendor \
    --install_path locale=%{_datadir}/locale \
    --install_path confdoc=%{_mandir}/man5

# Create lib directory, used for holding software to be installed in guests
statedir=%{buildroot}%{_localstatedir}/lib/virt-v2v
mkdir -p $statedir/software

# Copy Windows dependencies into place
windir=$statedir/software/windows
mkdir -p $windir

cp windows/rhsrvany.exe windows/firstboot.bat $windir/

mkdir -p %{buildroot}%{_sysconfdir}
cp v2v/virt-v2v.conf %{buildroot}%{_sysconfdir}/
cp v2v/virt-v2v.db $statedir/

%find_lang %{name}

# Not clear why this is being created as there is nothing arch-specific in
# virt-v2v. It isn't packaged, though, so we need to delete it.
find %{buildroot} -name .packlist -type f | xargs rm

%check
./Build test

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root,-)

%doc TODO.txt
%doc META.yml
%doc ChangeLog
%doc COPYING COPYING.LIB

# For noarch packages: vendorlib
%{perl_vendorlib}/*

# Man pages
%{_mandir}/man1/*.1*
%{_mandir}/man3/*.3*
%{_mandir}/man5/*.5*

# Executables
%attr(0755,root,root) %{_bindir}/virt-v2v
%attr(0755,root,root) %{_bindir}/virt-p2v-server

%dir %{_localstatedir}/lib/virt-v2v

%config(noreplace) %{_sysconfdir}/virt-v2v.conf
%config %{_localstatedir}/lib/virt-v2v/virt-v2v.db
%config(noreplace) %{_localstatedir}/lib/virt-v2v/software

%changelog
openSUSE Build Service is sponsored by