LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Redhat Linux rpmbuild issue (https://www.linuxquestions.org/questions/linux-software-2/redhat-linux-rpmbuild-issue-4175463345/)

bowserjr 05-24-2013 01:26 PM

Redhat Linux rpmbuild issue
 
Hello all,
I am trying to build an rpm in my redhat linux server and have been experiencing issues with the build being successful.

I'm running the following version of linux and software tools

Red Hat Enterprise Linux Server release 6.1 (Santiago)
rpm-build-4.8.0-16.el6.x86_64
rpm-libs-4.8.0-16.el6.x86_64
redhat-rpm-config-9.0.3-42.el6.noarch
rpm-4.8.0-16.el6.x86_64

I decided to start off with a simple build of one directory and one file. Here is my spec file.

Name: MikeMntr
Summary: Software tools
Version: 1.0
Release: 1
License:
Vendor:
Packager: Mike Bowser
Group:
Source: mike.tar.gz


%description
Software tools for Mike

%pre
echo "*** Monitoring Tools 1.0-1 installation ***"

%install
tar -zxpf $RPM_SOURCE_DIR/mike.tar.gz -C"/tmp/"

%post
echo "MikeMntr*** successfully installed! ***"
exit

%preun
echo "*** monitoring tools 1.0-1 uninstalling ***"

%postun
echo "*** successfully uninstalled! ***"
exit

%files
/tmp/mikerpm
/tmp/mikerpm/test.txt


The rpmbuild command completes with no issues when I delete the absolute pathways and names under the %files line. When those are listed I have issues. I'm assuming this is a config issue because its trying to find my source files in a different location than I'm storing them but I'm just not sure where to begin looking. Please direct me to another thread if this question has already been answered. As always any help or feedback is appreciated.

$rpmbuild -ba mike.spec
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.qVTWIY
+ umask 022
+ cd /appl/jrpm/rpmbuild/BUILD
+ '[' /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64 '!=' / ']'
+ rm -rf /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64
++ dirname /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64
+ mkdir -p /appl/jrpm/rpmbuild/BUILDROOT
+ mkdir /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64
+ LANG=C
+ export LANG
+ unset DISPLAY
+ tar -zxpf /appl/jrpm/rpmbuild/SOURCES/mike.tar.gz -C/tmp/
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: MikeMntr-1.0-1.x86_64
error: File not found: /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64/tmp/mikerpm
error: File not found: /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64/tmp/mikerpm/test.txt


RPM build errors:
File not found: /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64/tmp/mikerpm
File not found: /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1.0-1.x86_64/tmp/mikerpm/test.txt



Thank you

unSpawn 05-25-2013 03:40 AM

Quote:

Originally Posted by bowserjr (Post 4958325)
Please direct me to another thread if this question has already been answered.

See for example this thread: http://www.linuxquestions.org/questi...pm-4175461744/

bowserjr 05-29-2013 06:15 PM

Linux RPMBuild issue
 
So I looked at that link and understand how the %setup macro works and fixed that, but now my rpmbuild is failing in the install section. I guess I'm not clear on how to get my source file mike.tar.gz into the build directory when I don't know what the pathway will be beforehand. Any help is appreciated.

SPEC FILE
Summary: My first rpm script package
Name: MikeMntr
Version: 1
Release: 1
Source0: mike.tar.gz
License: GPL
Group: MyJunk
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
Make some relevant package description here
%prep
%setup -n mikerpm
%build
%install
tar -zxpf $RPM_BUILD_ROOT/mike.tar.gz -C"/tmp/"
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo " "
echo "This will display after rpm installs the package!"
%files
%dir /tmp/mikerpm
/tmp/mikerpm/test.txt

MY RPMBUILD OUTPUT
$rpmbuild -ba ../SPECS/mike2.spec
Executing(%prep): /bin/sh -e /appl/jrpm/rpmbuild/tmp/rpm-tmp.8z7gtK
+ umask 022
+ cd /appl/jrpm/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /appl/jrpm/rpmbuild/BUILD
+ rm -rf mikerpm
+ /usr/bin/gzip -dc /appl/jrpm/rpmbuild/SOURCES/mike.tar.gz
+ /bin/tar -xvvf -
drwxrwxr-x jrpm/jrpm 0 2013-05-15 13:38 mikerpm/
-rw-rw-r-- jrpm/jrpm 21 2013-05-15 13:38 mikerpm/test.txt
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd mikerpm
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /appl/jrpm/rpmbuild/tmp/rpm-tmp.ErHqWh
+ umask 022
+ cd /appl/jrpm/rpmbuild/BUILD
+ cd mikerpm
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /appl/jrpm/rpmbuild/tmp/rpm-tmp.S5rorP
+ umask 022
+ cd /appl/jrpm/rpmbuild/BUILD
+ '[' /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1-1.x86_64 '!=' / ']'
+ rm -rf /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1-1.x86_64
++ dirname /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1-1.x86_64
+ mkdir -p /appl/jrpm/rpmbuild/BUILDROOT
+ mkdir /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1-1.x86_64
+ cd mikerpm
+ LANG=C
+ export LANG
+ unset DISPLAY
+ tar -zxpf /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1-1.x86_64/mike.tar.gz -C/tmp/
tar (child): /appl/jrpm/rpmbuild/BUILDROOT/MikeMntr-1-1.x86_64/mike.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
error: Bad exit status from /appl/jrpm/rpmbuild/tmp/rpm-tmp.S5rorP (%install)


RPM build errors:
Bad exit status from /appl/jrpm/rpmbuild/tmp/rpm-tmp.S5rorP (%install)

unSpawn 05-30-2013 02:14 PM

Quote:

Originally Posted by bowserjr (Post 4961698)
Code:

%install
tar -zxpf $RPM_BUILD_ROOT/mike.tar.gz -C"/tmp/"


The %setup section already installs %{name}.tar.gz into your %{_buildroot} so usually the %install section will contain 'mkdir', 'make install' and suchlike commands, copying files from /appl/jrpm/rpmbuild/BUILD/%{name}/ to $RPM_BUILD_ROOT and your %{name}.tar.gz doesn't reside in /appl/jrpm/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.%{arch}/ ($RPM_BUILD_ROOT) but in /appl/jrpm/rpmbuild/SOURCES/ (the $RPM_SOURCE_DIR something).


All times are GMT -5. The time now is 04:20 PM.