LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-13-2009, 04:24 PM   #1
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
Modifying SRPMs


Hello,

I was wondering if anyone had a good tutorial or "howto" regarding modifying SRPMs.

I searched on google and I found tons of stuff about building RPMs from scratch and that's not what I'm looking for (don't really care about building .spec files right now...)

Basically this is what I'm looking for...

Say package-example.rpm doesn't have --with-perl compiled in it. I would like to download package-example.src.rpm and use the rpmbuild command to add that option.

Does anyone know of a good tutorial for something like that?

Thanks

-C
 
Old 01-13-2009, 05:18 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Extract .src.rpm (see 'rpm2cpio') into tarball, patches (if any) and .spec file. Modify %configure line in .spec file, save, run rpmbuild on the new .spec file. Should be about it.

Last edited by unSpawn; 01-13-2009 at 05:21 PM.
 
Old 01-13-2009, 06:03 PM   #3
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Original Poster
Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by unSpawn View Post
Extract .src.rpm (see 'rpm2cpio') into tarball, patches (if any) and .spec file. Modify %configure line in .spec file, save, run rpmbuild on the new .spec file. Should be about it.
Ok, cool. Seems pretty straight forward.

I'll run some some tests and will post if I have trouble.

-C
 
Old 01-13-2009, 06:26 PM   #4
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Original Poster
Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by unSpawn View Post
Extract .src.rpm (see 'rpm2cpio') into tarball, patches (if any) and .spec file. Modify %configure line in .spec file, save, run rpmbuild on the new .spec file. Should be about it.
Quick question...

If I installed the src rpm....

example:
Code:
root@host# rpm -ivh package-example.src.rpm
Wouldn't that bypass the rpm2cpio step? Couldn't I just edit the spec file under /usr/src/redhat?

thanks,

-C
 
Old 01-14-2009, 03:11 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Quote:
Originally Posted by custangro View Post
If I installed the src rpm.... (..) Wouldn't that bypass the rpm2cpio step?
Sure, but please make it a habit to build packages as unprivileged user. Building as root is: potentially unsafe (foreign code executed locally), potentially dangerous (use the wrong $RPM_BUILD_ROOT and see %clean "clean" your system pretty good), unnecessary (what *really* requires root rights anyway?).


Quote:
Originally Posted by custangro View Post
Couldn't I just edit the spec file under /usr/src/redhat?
Sure.
 
Old 01-14-2009, 05:15 PM   #6
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Original Poster
Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by unSpawn View Post
Sure, but please make it a habit to build packages as unprivileged user. Building as root is: potentially unsafe (foreign code executed locally), potentially dangerous (use the wrong $RPM_BUILD_ROOT and see %clean "clean" your system pretty good), unnecessary (what *really* requires root rights anyway?).



Sure.
Thanks, I didn't know that about building packages as root. Should I make a pseudo user for this?

-C
 
Old 01-15-2009, 12:11 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,285
Blog Entries: 54

Rep: Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854Reputation: 2854
Quote:
Originally Posted by custangro View Post
Should I make a pseudo user for this?
No, you could use any unprivileged user that's allowed a login. Just copy over the directory structure: 'mkdir -p ~/redhat/{BUILD,SOURCES,RPMS,SPECS,SRPMS,tmp}' (you don't need ~/redhat/tmp but I like to confine all movement to ~/redhat/) and add a basic ~/.rpmmacros replacing $HOME with the actual value:
Code:
%_topdir        $HOME/share/src/redhat
%_tmppath       %{_topdir}/tmp
%fname          %{name}-%{version}.%{release}
%_builddir      %{_topdir}/BUILD
%_rpmdir        %{_topdir}/RPMS
%_sourcedir     %{_topdir}/SOURCES
%_specdir       %{_topdir}/SPECS
%_srcrpmdir     %{_topdir}/SRPMS
and you're all set (OK, you could add an ~/.rpmrc as well but you are probably not going to tweak %arch build flags).
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Srpms carmat06 Fedora - Installation 1 10-08-2005 12:41 AM
what is SRPMS TigerLinux Linux - Newbie 1 10-02-2005 10:25 AM
Why SRPMs hhegab Linux - General 5 09-24-2005 06:49 AM
srpms andy18 Linux - Newbie 1 07-15-2004 10:40 PM
How to use SRPMS velska Red Hat 6 09-23-2003 03:19 PM


All times are GMT -5. The time now is 03:30 AM.

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