On Tuesday, December 21, 2010 01:07:06 Mohit Anchlia wrote:
> I created a rpm for the files in DESTDIR but when I tried to install I see:
> 
> rpm -ivh mod-perl-2.0.4-rpm.rpm
> error: Failed dependencies:
>         perl(Apache2::FunctionTable) is needed by mod-perl-2.0.4-1.noarch
>         perl(Apache2: StructureTable) is needed by mod-perl-2.0.4-1.noarch
>         perl(Apache::TestConfigParse) is needed by mod-perl-2.0.4-1.noarch
>         perl(Apache::TestConfigPerl) is needed by mod-perl-2.0.4-1.noarch
>         perl(BSD::Resource) is needed by mod-perl-2.0.4-1.noarch
>         perl(Data::Flow) is needed by mod-perl-2.0.4-1.noarch
>         perl(Module::Build) >= 0.18 is needed by mod-perl-2.0.4-1.noarch
> 
> Then I looked inside the source directory and it looks like for eg
> StructureTable is not in DESTDIR. And also when I installed with
> --nodeps and tested my code it seems to work fine. I am confused if
> the above are needed or not?

Enclosed you'll find a SPEC file that works for me. It uses perl and apache in 
/opt. Note that the install_vendor target works only if 2 conditions are met. 
Firstly, modperl trunk is used and, secondly, perl is compiled with a vendor 
path. I build RPM packages for various opensuse/sles versions. For Redhat or 
Centos your mileage may vary.

As for the error message above, Apache2::{Function,Structure}Table are modules 
used only for building modperl. They are normally not installed. 

Apache::Test... are part of Apache::Test and are needed if you want to test AT 
based modules. They are normally installed together with modperl. So, perhaps 
your %files entry is incomplete. There is an option in the RPM system that if 
set makes rpmbuild fail if there are files DESTDIR that are not covered by 
%files. On suse this (perhaps _unpackaged_files_terminate_build) is set by 
default.

BSD::Resource is not needed. modperl uses it it its test suite. But the test 
is simply skipped if it's not available. Module::Build is part of perl core 
since 5.10.0. modperl does not use it, AFAIK. Data::Flow is not installed on 
any of my build machines. So, somehow your dependencies are wrong. Do you use 
"Autoreqprov"? If yes it does not work. Otherwise check your "Requires" 
definitions.

See also: http://www.rpm.org/max-rpm/index.html

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
Name:         optperl-mod_perl
License:      Apache
Group:        Development/Libraries/Perl
Requires:     opt-perl opt-apache-prefork
BuildRequires: opt-perl perl(Chatbot::Eliza) perl(BSD::Resource)
BuildRequires: opt-apache-prefork opt-apache-prefork-devel
Autoreqprov:  on
Summary:      modperl
Version:      2.0.5threading6
Release:      8
Source:       mod_perl-%{version}.tar.gz
Patch0:       AT.patch
BuildRoot:      %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
Vendor:         Torsten Förtsch <tors...@foertsch.name>

# to be used with:
#   mkfifo ~/FIFO && RPM_NAME_TO=~/FIFO rpmbuild --nobuild SPEC &
#   read RPM_NAME <~/FIFO
%([ "$RPM_NAME_TO" ] &&
  echo >"$RPM_NAME_TO" \
    "%{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm")

%define perl /opt/perl/bin/perl
%define perllib %(%perl -MConfig -le 'print $Config{vendorlibexp}')
%define perlarch %(%perl -MConfig -le 'print $Config{vendorarchexp}')
%define perlarchlib %(%perl -MConfig -le 'print $Config{archlibexp}')
%define perlman1 %(%perl -MConfig -le 'print $Config{vendorman1direxp}')
%define perlman3 %(%perl -MConfig -le 'print $Config{vendorman3direxp}')
%define perlbin %(%perl -MConfig -le 'print $Config{vendorscriptexp}')

%define apxs /opt/apache-prefork/sbin/apxs
%define sysconfdir %(%apxs -q sysconfdir)
%define libexecdir %(%apxs -q libexecdir)

%description
modperl

%prep
%setup -q -n mod_perl-%{version}
cd Apache-Test
%patch0 -p0
cd ..
# ---------------------------------------------------------------------------

%build
export APACHE_TEST_NO_STICKY_PREFERENCES=1
%perl Makefile.PL MP_APXS=%{apxs} MP_TRACE=0 MP_DEBUG=0
make %{?jobs:-j%jobs} && make test
# ---------------------------------------------------------------------------

%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
make DESTDIR=$RPM_BUILD_ROOT install_vendor
find $RPM_BUILD_ROOT%{perlman1} $RPM_BUILD_ROOT%{perlman3} -type f -print0 |
  xargs -0i^ %{_gzipbin} -9 ^ || true
rm -rf $RPM_BUILD_ROOT%{perlarchlib}

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;

%files
%defattr(-, root, root)
%{perllib}
%{perlbin}
/opt/apache-prefork
%doc %{perlman3}

%post
if [ -f %{sysconfdir}/original/httpd.conf -a \
    \! -f %{sysconfdir}/original/httpd-modperl.conf ]; then
    ED=%{libexecdir} %perl -pe '
      if( !$attn and /LoadModule/ ) {
        $attn=1;
      } elsif( $attn==1 and /^\s*$/ ) {
        print "LoadModule perl_module $ENV{ED}/mod_perl.so\n";
        $attn++;
      }
    ' <%{sysconfdir}/original/httpd.conf \
      >%{sysconfdir}/original/httpd-modperl.conf
fi
:

%preun
[ "$1" -eq 0 ] && rm %{sysconfdir}/original/httpd-modperl.conf 2>/dev/null || :

Reply via email to