LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to exract rpm files and rebuild it again? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-exract-rpm-files-and-rebuild-it-again-927104/)

pradiptart 02-02-2012 02:46 AM

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

Satyaveer Arya 02-02-2012 02:53 AM

Using:

Quote:

# rpm2cpio mypackage.rpm | cpio -vid
you can extract the contents of rpm.

pradiptart 02-02-2012 03:05 AM

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

Satyaveer Arya 02-02-2012 04:28 AM

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

TB0ne 02-03-2012 04:23 PM

Quote:

Originally Posted by Satyaveer Arya (Post 4591442)
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

ruario 02-07-2012 12:32 AM

Quote:

Originally Posted by pradiptart (Post 4591453)
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.


All times are GMT -5. The time now is 11:22 AM.