LinuxQuestions.org
Review your favorite Linux distribution.
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 11-18-2013, 04:10 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
[RPM-Spec] Script in %prep


Hi,

I wrote a very simple spec. In the %prep section it looks as follow:
Code:
...
%prep
mkdir -p $RPM_BUILD_ROOT/mytest
mkdir -p /tmp/mytest
...
I can build the spec successfully. But after I installed the rpm I couldn't see any directory of '$RPM_BUILD_ROOT/mytest' and '/tmp/mytest'

Besides, where is the '/tmp/mytest' defined? In the RPM-compiler?
 
Old 11-18-2013, 09:58 PM   #2
action_owl
Member
 
Registered: Jan 2009
Location: 127.0.0.1
Distribution: Fedora, CentOS, NetBSD
Posts: 115

Rep: Reputation: 17
The %prep section is where the build environment for the software is created. AFAIK the prep section is only used for applying software patches.

If you want your files to show up on the target machine you will need to install them to the buildroot in the %install section and list them in the %files section.

When starting out building RPMs I found it helpful to study and rebuild existing RPMs. For example, to download the SRPM for phpMyAdmin and inspect the spec file:

Code:
# sudo yum install yum-utils rpmdevtools
# yumdownloader --source phpMyAdmin
# rpmdev-extract phpMyAdmin-3.5.8.2-1.el6.src.rpm
# vim phpMyAdmin-3.5.8.2-1.el6.noarch/phpMyAdmin.spec
 
Old 11-18-2013, 11:45 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
after I installed the rpm I couldn't see any directory of '$RPM_BUILD_ROOT/mytest' and '/tmp/mytest'

Besides, where is the '/tmp/mytest' defined? In the RPM-compiler ?
Don't know what you are trying to do :

"rpms/BUILDROOT" will be created automatically. → An 'rpmbuild' function ?
And "rpms/tmp/" is defined in $HOME/.rpmmacros
#13 http://www.linuxquestions.org/questi...1-a-766486/#13

-
 
Old 11-19-2013, 04:02 AM   #4
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by action_owl View Post
The %prep section is where the build environment for the software is created. AFAIK the prep section is only used for applying software patches.

If you want your files to show up on the target machine you will need to install them to the buildroot in the %install section and list them in the %files section.

When starting out building RPMs I found it helpful to study and rebuild existing RPMs. For example, to download the SRPM for phpMyAdmin and inspect the spec file:

Code:
# sudo yum install yum-utils rpmdevtools
# yumdownloader --source phpMyAdmin
# rpmdev-extract phpMyAdmin-3.5.8.2-1.el6.src.rpm
# vim phpMyAdmin-3.5.8.2-1.el6.noarch/phpMyAdmin.spec

I couldn't find the 'rpmdevtools'. Is this a standard RPM from RH Linux?

And as I run 'yumdownloader --source phpMyAdmin' it failed.

Last edited by thomas2004ch; 11-19-2013 at 04:04 AM.
 
Old 11-19-2013, 08:26 AM   #5
action_owl
Member
 
Registered: Jan 2009
Location: 127.0.0.1
Distribution: Fedora, CentOS, NetBSD
Posts: 115

Rep: Reputation: 17
rpmdevtools is available in CentOS 6, I would think it would be available on RH as well. You can try to locate the package with:

Code:
# yum provides "*bin/rpmdev-extract"
phpMyAdmin was probably not the best example because it's part of EPEL and in order to get the source for EPEL packages you have to enable the repository with the SRPMs. Yo might need to this for other repos as well. For example if you have EPEL installed you can edit "/etc/yum.repos.d/epel.repo" and change "enabled=0" to "enabled=1" in the "[epel-source]" repo.

If you get rpmdevtools installed but can't get yumdownloader to cooperate, you can always manually download the SRPMs, for example:

RHEL: http://ftp.redhat.com/pub/redhat/lin...r/en/os/SRPMS/

CentOS: http://vault.centos.org/6.4/os/Source/SPackages/

Last edited by action_owl; 11-19-2013 at 08:27 AM.
 
Old 11-26-2013, 03:51 AM   #6
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
I am a little bit confused. If the "phpMyAdmin was probably not the best example", maybe you have another better example for me?
 
  


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
LFS RPM SPEC files: Binutils RPM spec for x86 arch nocountryman Linux From Scratch 2 10-25-2010 09:09 AM
[SOLVED] rpm spec file to overwrite my service script yaplej Programming 3 05-06-2010 11:52 AM
RPM SPEC file install script run anti43 Linux - Software 2 05-05-2009 07:17 AM
.spec rpm updating? DjRakso Linux - Newbie 1 04-24-2008 04:16 PM
cannot use rpm -q in rpm spec file? Okashiiken Programming 5 06-29-2007 02:13 AM

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

All times are GMT -5. The time now is 05:07 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
Open Source Consulting | Domain Registration