LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 01-06-2011, 05:03 PM   #1
dilzniksan
LQ Newbie
 
Registered: Jan 2010
Posts: 20

Rep: Reputation: 0
Trouble Understanding %files in spec file


This question is somewhat basic; I am attempting to compile and install an Apache so module via rpm. This as much is accomplished when the rpm is built but when the rpm itself is installed, nothing occurs because I have incorrectly ennumerated the %files section of the spec file.

My question is, how are the files supposed to be listed in the %files section so that they are copied to their proper location? It seems that all the files are processed with $RPM_BUILD_ROOT appended to their location?

Here is the relevant portion of my spec file.

Code:
%description

%prep
%setup -q -n mod_authz_svn_eecs
%{__mkdir_p} -m 755 $RPM_BUILD_ROOT
%install
apxs -i -c mod_authz_svn_eecs.c	
cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so $RPM_BUILD_ROOT/mod_authz_svn_eecs.so


%files
%{_libdir}/httpd/modules/mod_authz_svn_eecs.so
%clean

%post

%changelog
Here are the errors that result from rpmbuild
Code:
chmod 755 /usr/lib/httpd/modules/mod_authz_svn_eecs.so
+ cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/mod_authz_svn_eecs.so
+ /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: mod_authz_svn_eecs-0-0.i686
error: File not found: /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/usr/lib/mod_authz_svn_eecs.so


RPM build errors:
    File not found: /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/usr/lib/mod_authz_svn_eecs.so

Last edited by dilzniksan; 01-06-2011 at 05:29 PM. Reason: more description
 
Old 01-06-2011, 09:17 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Quote:
Originally Posted by dilzniksan View Post
This question is somewhat basic; I am attempting to compile and install an Apache so module via rpm. This as much is accomplished when the rpm is built but when the rpm itself is installed, nothing occurs because I have incorrectly ennumerated the %files section of the spec file.

My question is, how are the files supposed to be listed in the %files section so that they are copied to their proper location? It seems that all the files are processed with $RPM_BUILD_ROOT appended to their location?

Here is the relevant portion of my spec file.

Code:
%description

%prep
%setup -q -n mod_authz_svn_eecs
%{__mkdir_p} -m 755 $RPM_BUILD_ROOT
%install
apxs -i -c mod_authz_svn_eecs.c	
cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so $RPM_BUILD_ROOT/mod_authz_svn_eecs.so


%files
%{_libdir}/httpd/modules/mod_authz_svn_eecs.so
%clean

%post

%changelog
Here are the errors that result from rpmbuild
Code:
chmod 755 /usr/lib/httpd/modules/mod_authz_svn_eecs.so
+ cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/mod_authz_svn_eecs.so
+ /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: mod_authz_svn_eecs-0-0.i686
error: File not found: /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/usr/lib/mod_authz_svn_eecs.so


RPM build errors:
    File not found: /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/usr/lib/mod_authz_svn_eecs.so
I am not sure, but it seems that the line

Code:
cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so $RPM_BUILD_ROOT/mod_authz_svn_eecs.so
probably should be
Code:
cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so $RPM_BUILD_ROOT/usr/lib/mod_authz_svn_eecs.so
so as to avoid
Quote:
File not found: /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386/usr/lib/mod_authz_svn_eecs.so
 
Old 01-07-2011, 11:21 AM   #3
dilzniksan
LQ Newbie
 
Registered: Jan 2010
Posts: 20

Original Poster
Rep: Reputation: 0
Fixed spec file, still questions

I altered the spec file so that the .so file is properly copied to the %files directory.
Code:
Summary:       
%prep
%setup -q -n mod_authz_svn_eecs
%{__mkdir_p} -m 755 $RPM_BUILD_ROOT%{_libdir}/httpd/modules/
%install
apxs -i -c mod_authz_svn_eecs.c
cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so $RPM_BUILD_ROOT%{_libdir}/httpd/modules/mod_authz_svn_eecs.so

%files
%{_libdir}/httpd/modules/mod_authz_svn_eecs.so
%clean
%post
%changelog
Rpmbuild generates the following:

Code:
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/test/rpmbuild/BUILDROOT/mod_authz_svn_eecs-0-0.i386
error: Installed (but unpackaged) file(s) found:
   /mod_authz_svn_eecs.so


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /mod_authz_svn_eecs.so
mod_authz_svn_eecs.so is being copied to the root ?!? I am very confused as to how %files installs files.
 
Old 01-07-2011, 06:15 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Odd. %{_libdir} should expand to %{_exec_prefix}/%{_lib}, %{_exec_prefix} should expand to %{_prefix} which is '%define _prefix /usr' if you 'rpmbuild --showrc|egrep "^-.*(_prefix|_exec_prefix|libdir)"'. Another way would be to use auto-fill which should make your %files section look like this:
Code:
%files -f %{_tmppath}/%{name}_contents.txt
before that add this to the end of your %install your section:
Code:
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
and check http://docs.fedoraproject.org/drafts...n/ch09s05.html for more nfo.
 
Old 01-10-2011, 02:49 PM   #5
dilzniksan
LQ Newbie
 
Registered: Jan 2010
Posts: 20

Original Poster
Rep: Reputation: 0
working spec file

I went ahead and cleaned out all the temporary files from previous builds (which was probably why that errant file was being copied to root) and altered the spec file one last time, the cp in the %install section copies the file to the directory. This spec file works.

Code:
%prep
%setup -q -n mod_authz_svn_eecs
patch -i mod_authz_svn.patch -o mod_authz_svn_eecs.c
%{__mkdir_p} -m 755 $RPM_BUILD_ROOT%{_libdir}/httpd/modules

%install
apxs -i -c mod_authz_svn_eecs.c	
cp /usr/lib/httpd/modules/mod_authz_svn_eecs.so $RPM_BUILD_ROOT%{_libdir}/httpd/modules/


%files
%{_libdir}/httpd/modules/mod_authz_svn_eecs.so
%clean

%post

%changelog
 
  


Reply



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
.spec file: creating an RPM: Files don't appear in designated paths CPUFreak91 Linux - Software 18 08-03-2006 09:43 AM
writing spec file for RPM to move files Help Me Linux - Newbie 2 05-08-2006 12:58 PM
creating the file list for the .spec files ingerul Linux - Software 0 11-01-2004 03:06 AM
%file attribute for RPM SPEC files Brian of Gep Linux - Software 3 06-18-2004 04:51 AM
%file attribute for RPM SPEC files Brian of Gep Fedora 0 06-15-2004 07:12 PM

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

All times are GMT -5. The time now is 11:42 PM.

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
Open Source Consulting | Domain Registration