-
Notifications
You must be signed in to change notification settings - Fork 5
/
rubygem-virt-p2v.spec.PL
237 lines (178 loc) · 5.8 KB
/
rubygem-virt-p2v.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# -*- rpm-spec -*-
# Copyright (C) 2006 Daniel Berrange <dan@berrange.com>
#
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 rubygem-virt-p2v.spec.PL
%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: @VERSION@
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