LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2012, 03:46 AM   #1
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Rep: Reputation: 12
how to exract rpm files and rebuild it again?


Hello,
I want to extract one .rpm file and want to add one .txt file and then I want to rebuld it .

will it work or not .
I got some thing like

rpm2cpio command but is that the only way to extract .Kindly tell me is there any other efficient way to do this and also tell me how to rebuld this again into .rpm file.

Thanks
 
Old 02-02-2012, 03:53 AM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Using:

Quote:
# rpm2cpio mypackage.rpm | cpio -vid
you can extract the contents of rpm.
 
1 members found this post helpful.
Old 02-02-2012, 04:05 AM   #3
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Original Poster
Rep: Reputation: 12
Thanks,

Now I got the contents of rpm I have added one file to it and now i want to rebuild it again .
Kindly tell me the command to do so.

Thanks
 
Old 02-02-2012, 05:28 AM   #4
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
This is the thing which you need to do once before building rpms:

Install the core development tools using YUM. As root:

Quote:
# yum groupinstall "Development Tools"
Next, create the building environment for your user. Fortunately, Fedora includes some neat utilities that greatly simplify this procedure. First, use YUM to install them (as root):

Quote:
# yum install rpmdevtools
Then, create the directory structure in your home directory by issuing the command (as a user):

Quote:
$ rpmdev-setuptree
That’s it.

Now, provided that you have a SPEC file for your program, you can build the binary RPM package by issuing the command:

Quote:
$ rpmbuild -bb --clean myprogram.spec
If you need to build the package for a different architecture, you can set the --target option, like in the example below:

Quote:
$ rpmbuild -bb --clean --target i686 myprogram.spec

Last edited by Satyaveer Arya; 02-02-2012 at 05:30 AM.
 
1 members found this post helpful.
Old 02-03-2012, 05:23 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,919

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by Satyaveer Arya View Post
Using:
Code:
# rpm2cpio mypackage.rpm | cpio -vid
you can extract the contents of rpm.
Right...that's what the OP stated in their first post.
Quote:
Originally Posted by pradiptart
Now I got the contents of rpm I have added one file to it and now i want to rebuild it again .
Kindly tell me the command to do so.
You need to create a .SPEC file, so you can use the rpmbuild command. You can find details here:
http://www.rpm.org/max-rpm/s1-rpm-bu...spec-file.html
http://www.ibm.com/developerworks/library/l-rpm1/
http://rpm5.org/docs/rpm-guide.html
 
Old 02-07-2012, 01:32 AM   #6
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,175

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
Quote:
Originally Posted by pradiptart View Post
Now I got the contents of rpm I have added one file to it and now i want to rebuild it again .
Kindly tell me the command to do so.
You want rpmrebuild.
 
1 members found this post helpful.
  


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
Cannot rebuild RPM packages with rpmrebuild because of missing files d1s4st3r Red Hat 4 05-01-2010 04:13 AM
no --rebuild in rpm? bkcreddy17 Linux - Software 2 04-10-2008 04:11 AM
rpm rebuild Xris718 Linux - General 2 05-06-2005 02:34 PM
Help on RPM --rebuild ztopher Linux - Software 3 03-28-2003 07:46 AM
RPM rebuild? GT I.N.C Linux - Software 4 10-20-2002 02:10 PM


All times are GMT -5. The time now is 11:58 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