LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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, 05:10 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

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, 10: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-19-2013, 12:45 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,322

Rep: Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581Reputation: 3581
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, 05:02 AM   #4
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

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 05:04 AM.
 
Old 11-19-2013, 09: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 09:27 AM.
 
Old 11-26-2013, 04:51 AM   #6
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

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


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

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

All times are GMT -5. The time now is 04:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration