I have found no solution on-line for the problem I had encountered when building rpm for various Perl Modules. In this post I demonstrate the problem and how I eventually had to fix it.
Given ...
... and given this Makefile ...
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cp perl-Test-Tester.spec perl-Test-Tester.spec_broken
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ vim perl-Test-Tester.spec
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ diff perl-Test-Tester.spec perl-Test-Tester.spec_broken
27,29c27
< make install > %{_topdir}/%{name}.install.out
< chmod +x ../../../process_install_output.sh
< ../../../process_install_output.sh %{_topdir}/%{name}.install.out ../../BUILDROOT/%{name}-%{version}-%{release}.%{_arch}
---
> make install
... doing that solved my problem. :)
Given ...
red@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ rpm -q rpm-build
rpm-build-4.8.0-16.el6.x86_64
... and given this Makefile ...
# Makefile for perl-Test-Tester... and given the SPEC file perl-Test-Tester.spec ...
VER=0.107
RELEASE=1
RPM_NAME=perl-Test-Tester
ARCH=x86_64
TAR_NAME=Test-Tester
TOPDIR := $(shell pwd)
FILES = \
${TOPDIR}/BUILD \
${TOPDIR}/BUILDROOT \
${TOPDIR}/SOURCES \
${TOPDIR}/RPMS \
${RPM_NAME}-${VER}.tar.gz \
${TOPDIR}/SOURCES/${RPM_NAME}-${VER}.tar.gz \
${RPM_NAME}-${VER}-${RELEASE}.${ARCH}.rpm
all : ${FILES}
${TOPDIR}/BUILD :
mkdir -p ${TOPDIR}/BUILD
${TOPDIR}/BUILDROOT :
mkdir -p $@/${RPM_NAME}-${VER}-${RELEASE}.${ARCH}
${TOPDIR}/RPMS :
mkdir -p ${TOPDIR}/RPMS
${TOPDIR}/SOURCES :
mkdir -p ${TOPDIR}/SOURCES
${TAR_NAME}-${VER}.tar.gz :
#wget http://search.cpan.org/CPAN/authors/id/K/KR/KRUSCOE/${TAR_NAME}-${VER}.tar.gz this line is incorrect
cvs update $@
${RPM_NAME}-${VER}.tar.gz : ${TAR_NAME}-${VER}.tar.gz
tar -zxf $<
mv ${TAR_NAME}-${VER}/ ${RPM_NAME}-${VER}
tar -czvf $@ ${RPM_NAME}-${VER}
rm -rf ${RPM_NAME}-${VER}
${TOPDIR}/SOURCES/${RPM_NAME}-${VER}.tar.gz : ${RPM_NAME}-${VER}.tar.gz
cp $< $@
${RPM_NAME}-${VER}-${RELEASE}.${ARCH}.rpm : ${TOPDIR}/SOURCES/${RPM_NAME}-${VER}.tar.gz ${RPM_NAME}.spec
rpmbuild --define "_topdir ${TOPDIR}" -vv -bb ${RPM_NAME}.spec
cp ${TOPDIR}/RPMS/${ARCH}/$@ .
- rpm -i --force -v $@
test -e $@
test: ${RPM_NAME}-${VER}-${RELEASE}.${ARCH}.rpm
rpm -q --filesbypkg -p $<
clean:
rm -rf ${FILES}
Summary: Install pre-complied Perl module Test::Tester... when I execute make the output shows the error ...
#
# Spec file
#
Name: perl-Test-Tester
Version: 0.107
Release: 1
License: Copyright Red Cricket Systems Inc. 2008
Group: None
Source: perl-Test-Tester-0.107.tar.gz
Requires: red-perl
BuildRequires: red-perl
Provides: perl(Test::Tester)
%description
Install pre-complied Perl module Test::Tester for RED
%prep
%global
%setup
%build
/usr/RED/perl/bin/perl Makefile.PL INSTALLDIRS=vendor
make
make test
%install
make install
%post
%clean
%files
%defattr(-,red,cricket)
/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
/apps/REDD/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
/apps/REDD/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
/apps/REDD/red-perl-5.14.1/man/man3/Test::Tester.3
/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
%changelog
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ makeThe problem is that for one reason or another rpmbuild does not want to place the installed files into the BUILDROOT/perl-Test-tester-0.107.x86_64 directory. So to correct this I wrote the shell script ...
rpmbuild --define "_topdir /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester" -vv -bb perl-Test-Tester.spec
error: Macro % has illegal name (%define)
D: opening db environment /var/lib/rpm cdb:mpool:joinenv
D: opening db index /var/lib/rpm/Packages rdonly mode=0x0
D: locked db index /var/lib/rpm/Packages
D: ========== +++ perl-Test-Tester-0.107-1 x86_64/linux 0x0
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening db index /var/lib/rpm/Name rdonly mode=0x0
D: read h# 622 Header sanity check: OK
D: added key gpg-pubkey-fd431d51-4ae0493b to keyring
D: read h# 623 Header sanity check: OK
D: added key gpg-pubkey-2fa658e0-45700c69 to keyring
D: read h# 624 Header sanity check: OK
D: added key gpg-pubkey-665b9872-3fd4f7c5 to keyring
D: Using legacy gpg-pubkey(s) from rpmdb
D: opening db index /var/lib/rpm/Providename rdonly mode=0x0
D: read h# 656 Header SHA1 digest: OK (cac9c305ade60953baec0168c93953daa3dee1f7)
D: Requires: red-perl YES (db provides)
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Name
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.C93SZy
+ umask 022
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ rm -rf perl-Test-Tester-0.107
+ /usr/bin/gzip -dc /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/SOURCES/perl-Test-Tester-0.107.tar.gz
+ /bin/tar -xvvf -
drwxr-xr-x 1000/1000 0 2008-03-01 16:17 perl-Test-Tester-0.107/
-rw-r--r-- 1000/1000 12462 2008-03-01 16:17 perl-Test-Tester-0.107/README
drwxr-xr-x 1000/1000 0 2008-03-01 16:17 perl-Test-Tester-0.107/t/
-rw-r--r-- 1000/1000 488 2005-07-04 18:09 perl-Test-Tester-0.107/t/capture.t
-rw-r--r-- 1000/1000 1775 2005-10-08 05:53 perl-Test-Tester-0.107/t/check_tests.t
-rw-r--r-- 1000/1000 379 2007-08-25 10:21 perl-Test-Tester-0.107/t/depth.t
-rw-r--r-- 1000/1000 4231 2007-08-25 10:11 perl-Test-Tester-0.107/t/run_test.t
-rw-r--r-- 1000/1000 336 2005-07-04 17:43 perl-Test-Tester-0.107/t/SmallTest.pm
drwxr-xr-x 1000/1000 0 2008-03-01 16:17 perl-Test-Tester-0.107/t/fail/
-rw-r--r-- 1000/1000 187 2005-02-12 02:53 perl-Test-Tester-0.107/t/fail/fail.t
-rw-r--r-- 1000/1000 464 2008-03-01 16:17 perl-Test-Tester-0.107/t/auto.t
-rw-r--r-- 1000/1000 127 2004-07-05 18:07 perl-Test-Tester-0.107/t/MyTest.pm
-rw-r--r-- 1000/1000 19 2003-03-04 20:27 perl-Test-Tester-0.107/TODO
-rw-r--r-- 1000/1000 6451 2004-07-11 04:35 perl-Test-Tester-0.107/ARTISTIC
-rw-r--r-- 1000/1000 603 2004-07-05 17:22 perl-Test-Tester-0.107/Makefile.PL
drwxr-xr-x 1000/1000 0 2008-03-01 16:17 perl-Test-Tester-0.107/lib/
drwxr-xr-x 1000/1000 0 2008-03-01 16:17 perl-Test-Tester-0.107/lib/Test/
drwxr-xr-x 1000/1000 0 2008-03-01 16:17 perl-Test-Tester-0.107/lib/Test/Tester/
-rw-r--r-- 1000/1000 372 2005-07-04 17:31 perl-Test-Tester-0.107/lib/Test/Tester/Delegate.pm
-rw-r--r-- 1000/1000 1273 2004-07-11 11:16 perl-Test-Tester-0.107/lib/Test/Tester/CaptureRunner.pm
-rw-r--r-- 1000/1000 4251 2008-03-01 16:13 perl-Test-Tester-0.107/lib/Test/Tester/Capture.pm
-rw-r--r-- 1000/1000 17068 2008-03-01 16:14 perl-Test-Tester-0.107/lib/Test/Tester.pm
-rw-r--r-- 1000/1000 3143 2008-03-01 16:12 perl-Test-Tester-0.107/CHANGES
-rw-r--r-- 1000/1000 349 2008-03-01 16:17 perl-Test-Tester-0.107/META.yml
-rw-r--r-- 1000/1000 307 2005-07-04 18:22 perl-Test-Tester-0.107/MANIFEST
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd perl-Test-Tester-0.107
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.JIXFCg
+ umask 022
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ cd perl-Test-Tester-0.107
+ /usr/RED/perl/bin/perl Makefile.PL INSTALLDIRS=vendor
Checking if your kit is complete...
Looks good
Writing Makefile for Test::Tester
Writing MYMETA.yml
+ make
make[1]: Entering directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
cp lib/Test/Tester.pm blib/lib/Test/Tester.pm
cp lib/Test/Tester/Capture.pm blib/lib/Test/Tester/Capture.pm
cp lib/Test/Tester/CaptureRunner.pm blib/lib/Test/Tester/CaptureRunner.pm
cp lib/Test/Tester/Delegate.pm blib/lib/Test/Tester/Delegate.pm
Manifying blib/man3/Test::Tester::Capture.3
Manifying blib/man3/Test::Tester.3
Manifying blib/man3/Test::Tester::CaptureRunner.3
make[1]: Leaving directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
+ make test
make[1]: Entering directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
PERL_DL_NONLAZY=1 /apps/RED/red-perl-5.14.1/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/auto.t ......... ok
t/capture.t ...... ok
t/check_tests.t .. ok
t/depth.t ........ ok
t/run_test.t ..... ok
All tests successful.
Files=5, Tests=169, 0 wallclock secs ( 0.04 usr 0.00 sys + 0.10 cusr 0.01 csys = 0.15 CPU)
Result: PASS
make[1]: Leaving directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.RidKYZ
+ umask 022
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ cd perl-Test-Tester-0.107
+ make install
make[1]: Entering directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
Manifying blib/man3/Test::Tester::Capture.3
Manifying blib/man3/Test::Tester.3
Manifying blib/man3/Test::Tester::CaptureRunner.3
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
Installing /apps/RED/red-perl-5.14.1/man/man3/Test::Tester.3
Installing /apps/RED/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
Installing /apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
Appending installation info to /apps/RED/red-perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/perllocal.pod
make[1]: Leaving directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: perl-Test-Tester-0.107-1.x86_64
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester.3
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
RPM build errors:
Macro % has illegal name (%define)
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester.3
File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
make: *** [perl-Test-Tester-0.107-1.x86_64.rpm] Error 1
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cat ../process_install_output.shThen I call this script in the %install section of my SPEC file like so ...
#!/bin/sh
#
# $Id: process_install_output.sh,v 1.1.2.1 2011/09/09 19:24:34 redcricket Exp $
#
# This script is used in perl-<Module>.spec files
#
INSTALL_OUTPUT=$1
BUILDROOT=$2
if [ -z "$INSTALL_OUTPUT" ]
then
echo "Usage : $0 <install output file> <rpm build root directory>"
exit 1
fi
if [ -z "$BUILDROOT" ]
then
echo "Usage : $0 <install output file> <rpm build root directory>"
exit 1
fi
cat $INSTALL_OUTPUT
echo "grep "Installing" $INSTALL_OUTPUT"
for installed_file in `grep "Installing" $INSTALL_OUTPUT | cut -d' ' -f2`
do
installed_dir=`dirname $installed_file`
echo "Executing [mkdir -p $BUILDROOT/$installed_dir]"
mkdir -p $BUILDROOT/$installed_dir
echo "Execute [cp -p $installed_file $BUILDROOT/$installed_dir]"
cp -p $installed_file $BUILDROOT/$installed_dir
done
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cp perl-Test-Tester.spec perl-Test-Tester.spec_broken
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ vim perl-Test-Tester.spec
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ diff perl-Test-Tester.spec perl-Test-Tester.spec_broken
27,29c27
< make install > %{_topdir}/%{name}.install.out
< chmod +x ../../../process_install_output.sh
< ../../../process_install_output.sh %{_topdir}/%{name}.install.out ../../BUILDROOT/%{name}-%{version}-%{release}.%{_arch}
---
> make install
... doing that solved my problem. :)
I should being doing this ...
ReplyDeletemake install DESTDIR=$RPM_BUILD_ROOT
... in my %install section instead.