LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-27-2006, 01:38 PM   #1
wadevondoom
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Rep: Reputation: 0
Need help with RPMBUILD .spec included


Hello all,

I am relatively new at building spec files. I have made several for various in-house sources we have here at the office.

I wanted to package up our customized version of tomcat, complete with the pre-built config files and webapps. I have tarred it all up and I now want to make an rpm out of it. I read trhough Max RPM and some other on-line tutorials and I was able to create such a file...Only issue is that I cannot get it to install in the correct place on the target machine.

I know I am doing something dumb but I can't seem to get it right.

Here is the spec file. I am building it as a regular user (sysadmin). I have set my .rpmmacro file for the proper paths to this users rpmbuild environment. Tomcat is already installed on this machine so I do not want to overwrite this.

Code:
Summary: Jakarta Tomcat
Name: jakarta-tomcat
Version: 5.5.17
Release: 1
Source0: jakarta-tomcat-5.5.17.tar.gz
License: Apache Sofware License
Group: Apache Software Foundation
BuildRoot: /home/sysadmin/rpm/BUILD

Requires:       httpd >= 2.0.47

%description
This is a customized installation of the Tomcat J2EE Servlet Container
This also contains files mod_jk for connectivity to Apache 2.0.53

%prep
mkdir -p $RPM_BUILD_ROOT/opt/%{name}-%{version}
mkdir -p $RPM_BUILD_ROOT/opt/%{name}-%{version}/doc

%setup -q
%build
%install

%clean
rm -rf $RPM_BUILD_ROOT/*

%files
%defattr(-,tomcat,tomcat)
/jakarta-tomcat-5.5.17

I am using this command to build:
rpmbuild -ba jakarta.spec

Like I said I know I am doing something dumb here so anyone who would like to point thsi out, I would greatly appreciate it.

Thanks in advance

Last edited by wadevondoom; 07-27-2006 at 02:33 PM.
 
Old 07-27-2006, 04:14 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Go back to Max RPM, Chapter 13, the section about the %files list. The %files list specifies which files to package, the path for each file in the build system, and the installation path.

See also Appendix E for more information about the %files list, including examples.
 
Old 07-27-2006, 04:48 PM   #3
wadevondoom
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Yeah I read it through. What confuses me about this spec file, and that I don't see mentioned in the book, is:

If I want everything in /opt/jakarta-5.5.17/ packaged and I am using a custom $RPM_BUILD_ROOT then how can I emulate that system inside this subsystem?

To be clearer...should I use ~sysadmin/rpm/BUILD/opt/%{name}-%{version}
or
~sysadmin/rpm/BUILD/%{name}-%{version}

...and if so, in the files section, I understand that the buildroot gets prepended to the files list so when rpmbuild executes the %files section it will use $RPM_BUILD_ROOT/<%files>
I have managed to get it to install into /opt but the rpm created is obviously empty of source since it is about 4k instead of the 7m it should be.

soooooo.....if I want to get it install to /opt should I include /opt int eh buildroot...or should I use rpmbuild -ba --buildroot /opt???

Again I know this is something simple that I should know but its pretty confusing.

For example if I use:
rpmbuild -ba --buildroot /home/sysadmin/rpm/BUILD
jakarta.spec

..it build the file perfectly but when I install it, it installs to / as in /jakarta-tomcat-5.5.17

I have been very close to getting it to work but close is no cigar.

Thanks again for any help.

Regards,

Wade
 
Old 07-27-2006, 06:59 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
You may need to expand on the %build and %install sections. Chapter 11 has more on that.

Here's an example from a .spec file on my system.

%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --sysconfdir=/etc --with-config-file=/etc/aide.conf

%install
rm -rf $RPM_BUILD_ROOT

make prefix=$RPM_BUILD_ROOT%{prefix} install-strip
mkdir -p -m700 $RPM_BUILD_ROOT/var/lib/aide
 
  


Reply


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
Problem with rpmbuild and template.spec file abefroman Linux - Software 0 11-27-2005 12:18 AM
need help using rpmbuild. dr_zayus69 Linux - Software 3 04-24-2005 08:49 AM
rpmbuild linuxdev Linux - General 1 02-18-2004 03:12 PM
rpmbuild linuxdev Linux - Newbie 0 02-11-2004 02:22 PM
rpmbuild -ba php.spec pk21 Linux - General 0 09-16-2003 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:52 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration