1 |
# $Id: Net-OpenVPN-Manage.spec,v 1.3 2013/11/12 21:44:55 vip-ire Exp $ |
2 |
# Authority: vip-ire |
3 |
# Name: Daniel Berteaud |
4 |
|
5 |
%define pkgname Net-OpenVPN-Manage |
6 |
%define filelist %{pkgname}-%{version}-filelist |
7 |
%define NVR %{pkgname}-%{version}-%{release} |
8 |
%define maketest 1 |
9 |
|
10 |
name: perl-Net-OpenVPN-Manage |
11 |
summary: Net-OpenVPN-Manage - Manage an OpenVPN process via it's management port |
12 |
version: 0.02 |
13 |
release: 2%{?dist} |
14 |
license: Artistic |
15 |
group: Applications/CPAN |
16 |
url: http://www.cpan.org |
17 |
buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) |
18 |
buildarch: noarch |
19 |
prefix: %(echo %{_prefix}) |
20 |
source: http://search.cpan.org/dist/M/ME/MEYEAARD/Net-OpenVPN-Manage-0.02.tar.gz |
21 |
|
22 |
BuildRequires: perl(ExtUtils::MakeMaker) |
23 |
|
24 |
%description |
25 |
This module connects to the OpenVPN management interface, executes |
26 |
commands on the interface and returns the results or errors that result. |
27 |
|
28 |
# |
29 |
# This package was generated automatically with the cpan2rpm |
30 |
# utility. To get this software or for more information |
31 |
# please visit: http://perl.arix.com/ |
32 |
# |
33 |
|
34 |
%prep |
35 |
%setup -q -n %{pkgname}-%{version} |
36 |
chmod -R u+w %{_builddir}/%{pkgname}-%{version} |
37 |
|
38 |
%build |
39 |
grep -rsl '^#!.*perl' . | |
40 |
grep -v '.bak$' |xargs --no-run-if-empty \ |
41 |
%__perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' |
42 |
CFLAGS="$RPM_OPT_FLAGS" |
43 |
%{__perl} Makefile.PL `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '` |
44 |
%{__make} |
45 |
%if %maketest |
46 |
%{__make} test |
47 |
%endif |
48 |
|
49 |
%install |
50 |
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} |
51 |
|
52 |
%{makeinstall} INSTALLDIRS=vendor `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '` |
53 |
|
54 |
[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress |
55 |
|
56 |
# SuSE Linux |
57 |
if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ] |
58 |
then |
59 |
%{__mkdir_p} %{buildroot}/var/adm/perl-modules |
60 |
%{__cat} `find %{buildroot} -name "perllocal.pod"` \ |
61 |
| %{__sed} -e s+%{buildroot}++g \ |
62 |
> %{buildroot}/var/adm/perl-modules/%{name} |
63 |
fi |
64 |
|
65 |
# remove special files |
66 |
find %{buildroot} -name "perllocal.pod" \ |
67 |
-o -name ".packlist" \ |
68 |
-o -name "*.bs" \ |
69 |
|xargs -i rm -f {} |
70 |
|
71 |
# no empty directories |
72 |
find %{buildroot}%{_prefix} \ |
73 |
-type d -depth \ |
74 |
-exec rmdir {} \; 2>/dev/null |
75 |
|
76 |
%{__perl} -MFile::Find -le ' |
77 |
find({ wanted => \&wanted, no_chdir => 1}, "%{buildroot}"); |
78 |
print ""; |
79 |
for my $x (sort @dirs, @files) { |
80 |
push @ret, $x unless indirs($x); |
81 |
} |
82 |
print join "\n", sort @ret; |
83 |
|
84 |
sub wanted { |
85 |
return if /auto$/; |
86 |
|
87 |
local $_ = $File::Find::name; |
88 |
my $f = $_; s|^\Q%{buildroot}\E||; |
89 |
return unless length; |
90 |
return $files[@files] = $_ if -f $f; |
91 |
|
92 |
$d = $_; |
93 |
/\Q$d\E/ && return for reverse sort @INC; |
94 |
$d =~ /\Q$_\E/ && return |
95 |
for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|; |
96 |
|
97 |
$dirs[@dirs] = $_; |
98 |
} |
99 |
|
100 |
sub indirs { |
101 |
my $x = shift; |
102 |
$x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs; |
103 |
} |
104 |
' > %filelist |
105 |
|
106 |
[ -z %filelist ] && { |
107 |
echo "ERROR: empty %files listing" |
108 |
exit -1 |
109 |
} |
110 |
|
111 |
%clean |
112 |
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} |
113 |
|
114 |
%files -f %filelist |
115 |
%defattr(-,root,root) |
116 |
|
117 |
%changelog |
118 |
* Tue Nov 12 2013 Daniel Berteaud <daniel@firewall-services.com> 0.02-2 |
119 |
- Fix INSTALLDIRS so libs are found in @INC |
120 |
|
121 |
* Fri Mar 6 2009 root@smedev |
122 |
- Initial build. |