LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 07-26-2011, 03:54 PM   #1
mjovanov
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Rep: Reputation: Disabled
A Basic Question on rpmbuild


Hi, I am trying to create a binary rpm using the rpmbuild utility. Specifically, the software I am packaging is a vendor product provided in the form of a tar archive and a korn shell installer. I've managed to create a spec file that will invoke the installer script and copy all the files into virtual build dir (${RPM_BUILD_ROOT}). Now in the %files stanza, it appears I need to list all the files/dirs. My question is: is there an easy way to do this? I looked at different macros and examples, but most are assuming building from source and using standard Red Hat install dir structure (/usr/lib, /usr/bin etc.)/
Any help or suggestions would be greatly appreciated!
 
Old 07-26-2011, 05:43 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
I'm usually lazy so I skip the %files section and attempt to build the package, rpmbuild will then give you a list of installed but unpackaged files. Look through the list for common directories, if the directory is app specific then include it like so:

/opt/<myapp>

If there are config files under /etc then add:

/etc/*

If there are README's and so on in the root of the tarball then use:

%doc README ...

If there are man pages then use:

%{mandir}/man1/*

..and so on until there are no files left unpackaged.

Also, please install rpmlint and run it against your package or spec file, it's output can be very helpful.

cheers

Last edited by kbp; 07-26-2011 at 05:50 PM.
 
1 members found this post helpful.
Old 07-26-2011, 06:08 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,120
Blog Entries: 54

Rep: Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788Reputation: 2788
Quote:
Originally Posted by mjovanov View Post
Now in the %files stanza, it appears I need to list all the files/dirs. My question is: is there an easy way to do this?
See http://docs.fedoraproject.org/drafts...n/ch09s05.html ? As in:
Code:
%install
# doStuff
find $RPM_BUILD_ROOT -not -type d -printf "%%%attr(%%m,root,root) %%p\n" | sed -e "s|$RPM_BUILD_ROOT||g" > %{_tmppath}/%{name}_contents.txt
# (..)
%files -f %{_tmppath}/%{name}_contents.txt
 
1 members found this post helpful.
Old 07-27-2011, 09:03 AM   #4
mjovanov
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
What a great tip, thanks to both!
 
Old 07-29-2011, 09:41 AM   #5
mjovanov
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
As a quick follow-up: with the help of unSpawn and kbp, I was able to build a binary rpm. Having read the docs, I understand that rpmbuild performs automatic dependency checking (I was able to turn it off using the 'AutoReqProv: no' flag). But with the auto dependency checking, when I try to test the rpm, it fails with all kinds of dependencies, even on a machine on which it is already installed! How can that be? Is it because the dependencies were presumably installed without using RPM?

[mjovanov@eset-tan SPECS]$ rpm --test -Uvh ../RPMS/x86_64/apache_custom.x86_64.rpm
error: Failed dependencies:
/usr/local/bin/python is needed by apache_custom.x86_64
libclntsh.so.10.1()(64bit) is needed by apache_custom.x86_64
libclntsh.so.9.0()(64bit) is needed by apache_custom.x86_64
libcomn_r64.so()(64bit) is needed by apache_custom.x86_64
libcs_r64.so()(64bit) is needed by apache_custom.x86_64
libct_r64.so()(64bit) is needed by apache_custom.x86_64
libhpodbc_l64.so.2()(64bit) is needed by apache_custom.x86_64
libifcli.so()(64bit) is needed by apache_custom.x86_64
libifgls.so()(64bit) is needed by apache_custom.x86_64
libifglx.so()(64bit) is needed by apache_custom.x86_64
libimqb23gl.so()(64bit) is needed by apache_custom.x86_64
libimqc23gl.so()(64bit) is needed by apache_custom.x86_64
libimqs23gl.so()(64bit) is needed by apache_custom.x86_64
libintl_r64.so()(64bit) is needed by apache_custom.x86_64
libmqcxa64.so()(64bit) is needed by apache_custom.x86_64
libmqmxa64.so()(64bit) is needed by apache_custom.x86_64
libodbc.so()(64bit) is needed by apache_custom.x86_64
libodbc.so(VERS_3.52)(64bit) is needed by apache_custom.x86_64
libodbcinst.so()(64bit) is needed by apache_custom.x86_64
libodbcinst.so(VERS_3.52)(64bit) is needed by apache_custom.x86_64
libpxicu.so()(64bit) is needed by apache_custom.x86_64
libreadline.so.4()(64bit) is needed by apache_custom.x86_64
libsybcomn_r64.so()(64bit) is needed by apache_custom.x86_64
libsybcs_r64.so()(64bit) is needed by apache_custom.x86_64
libsybct_r64.so()(64bit) is needed by apache_custom.x86_64
libsybintl_r64.so()(64bit) is needed by apache_custom.x86_64
libsybtcl_r64.so()(64bit) is needed by apache_custom.x86_64
libsybunic64.so()(64bit) is needed by apache_custom.x86_64
libtelapi.so()(64bit) is needed by apache_custom.x86_64
libwtc9.so()(64bit) is needed by apache_custom.x86_64
[p002197@eset-tan SPECS]$
 
Old 07-30-2011, 12:48 AM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
If you disable the auto dependency generation you'll need to add your own 'Requires: ...'. I rarely turn it off

Last edited by kbp; 07-30-2011 at 12:50 AM.
 
  


Reply

Tags
rpmbuild


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rpmbuild - build section question jcalcote Suse/Novell 3 03-12-2005 06:10 AM
rpmbuild question prubino Linux - Software 1 01-14-2005 11:01 AM
rpmbuild newbie question newellrp1 Linux - Software 2 11-07-2004 10:47 AM
rpmbuild question Thetargos Linux - Software 6 06-18-2003 11:18 PM


All times are GMT -5. The time now is 03:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration