-
Notifications
You must be signed in to change notification settings - Fork 5
/
virt-v2v.spec.PL
194 lines (144 loc) · 4.94 KB
/
virt-v2v.spec.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# -*- rpm-spec -*-
# Copyright (C) 2006 Daniel Berrange <[email protected]>
#
use strict;
die unless (scalar @ARGV == 1);
my $VERSION;
open PM, 'lib/Sys/VirtConvert.pm';
while (<PM>) {
if (/\$Sys::VirtConvert::VERSION\s*=\s*"(.*)"/) {
$VERSION=$1;
}
}
local $/ = undef;
$_ = <DATA>;
s/\@VERSION\@/$VERSION/g;
open SPEC, ">$ARGV[0]" or die "$!";
print SPEC $_;
close SPEC;
__DATA__
# Automatically generated by virt-v2v.spec.PL
Name: virt-v2v
Version: @VERSION@
Release: 1%{?dist}%{?extra_release}
Summary: Convert a virtual machine to run on KVM
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/%{name}-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
# Unfortunately, despite really being noarch, we have to make virt-v2v arch
# dependent to avoid build failures on architectures where libguestfs isn't
# available.
%if 0%{?rhel} >= 6
ExclusiveArch: x86_64
%else
ExclusiveArch: %{ix86} x86_64
%endif
# Build system direct requirements
BuildRequires: gettext
BuildRequires: perl
BuildRequires: perl(Module::Build)
BuildRequires: perl(ExtUtils::Manifest)
BuildRequires: perl(Test::More)
BuildRequires: perl(Test::Pod)
BuildRequires: perl(Test::Pod::Coverage)
BuildRequires: perl(Module::Find)
# Runtime perl modules also required at build time for use_ok test
BuildRequires: perl(DateTime)
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(XML::Writer)
BuildRequires: perl-Sys-Guestfs >= 1:1.14.0
BuildRequires: perl-hivex >= 1.2.2
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
# Required for the name optional argument to add_drive_opts
Requires: perl-Sys-Guestfs >= 1:1.14.0
# Undocumented from antiquity
Requires: perl-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::SSL)
Requires: perl(Net::HTTPS)
# 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
%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}
%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.
[ -d "%{buildroot}/%{perl_archlib}" ] &&
find %{buildroot}/%{perl_archlib} -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