[opensuse] Extracting a single file from an RPM
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover. How can I recover/extract a single file from an RPM file? I do not want to 'install' the whole RPM as it would clobber files of the same name, most of which have been changed over time. One of the files in the RPM file contains information I need to recover. Thanks for any suggestions Richard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Richard <ricreig@gmail.com> [04-13-09 23:49]:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
Easiest for a non-command-line junkie, use mc, open the rpm and save the particular file. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon April 13 2009 11:55:48 pm Patrick Shanahan wrote:
* Richard <ricreig@gmail.com> [04-13-09 23:49]:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
Easiest for a non-command-line junkie, use mc, open the rpm and save the particular file.
Thankyou Patrick, That almost works. Apparantly the *.src files are all gzipped and I can't find how to separate the pieces. MC is very powerful and I didn't know about the 'dive-in' feature for RPM's. For regular archives, it looks like it is just doing a 'cd <directorypath>' and if a RPM stored files separately, what MC does would be fine. I don't see any separate files, just /info, HEADER install.sh and update.sh which are 39 byte executables. I can't locate where the actual files are contained. I'm using the version of mc found in openSuSE v11.0. mc ver 4.4.2 I found a app 'rpm2cpio2' that on some RPMs, seem to list the install scripts, but on others, it is all binary. I don't mind using a CLI if I can find what the magic words are :) Richard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2009-04-14 at 05:46 -0400, Richard wrote:
That almost works. Apparantly the *.src files are all gzipped and I can't find how to separate the pieces. MC is very powerful and I didn't know about the 'dive-in' feature for RPM's. For regular archives, it looks like it is just doing a 'cd <directorypath>' and if a RPM stored files separately, what MC does would be fine. I don't see any separate files, just /info, HEADER install.sh and update.sh which are 39 byte executables. I can't locate where the actual files are contained.
Just hit enter on the gzipped part inside (for source rpms). Or the cpio part for binaries. Ie, mc can open archives inside archives inside archives inside ar... - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknkb0gACgkQtTMYHG2NR9WkQgCfbE98UZCs+SRfaAGHPyvjp3mn gxsAoIpJobmZ6iuKBtLuUFdApSgrr/iP =iHlr -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue April 14 2009 7:11:01 am Carlos E. R. wrote:
On Tuesday, 2009-04-14 at 05:46 -0400, Richard wrote:
That almost works. Apparantly the *.src files are all gzipped and I can't find how to separate the pieces. MC is very powerful and I didn't know about the 'dive-in' feature for RPM's. For regular archives, it looks like it is just doing a 'cd <directorypath>' and if a RPM stored files separately, what MC does would be fine. I don't see any separate files, just /info, HEADER install.sh and update.sh which are 39 byte executables. I can't locate where the actual files are contained.
Just hit enter on the gzipped part inside (for source rpms). Or the cpio part for binaries.
Ie, mc can open archives inside archives inside archives inside ar...
-- Cheers, Carlos E. R.
The RPM in question is hosed and had no cpio or gzipped file in the 'directory' as displayed by MC yet the file was huge, way larger than suggested by the mc 'directory'. However, for other RPMS that I used your suggestion on, both src and package RPMs, and they work as you describe. I just happened to choose a buggered rpm where something in the 'directory' structure must have been comprimised and nothing was pointing to the 'guts' of the RPM. Oh well, maybe I can find another copy in a backup archive on one of my other systems that isn't damaaged. If not, I'll see if I can plagerize some code that is similar. One question though comes to mind with MC. Is it possible to INSERT a file into a RPM, eg, say it is a src rpm and I want to remove/edit a something.c source file and reinsert it back into the rpm without going to the trouble of having to extract all files, modify specs (possibly) and doing a rpmbuild? Thanks again for your help. -- Richard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 14 April 2009 04:06:32 pm Richard wrote:
One question though comes to mind with MC. � Is it possible to INSERT a file into a RPM, eg, say it is a src rpm and I want to remove/edit a something.c source file and reinsert it back into the rpm without going to the trouble of having to extract all files, modify specs (possibly) and doing a rpmbuild?
Not yet. I recently discovered that I can edit (F4) gzipped files. That was impossible for years. I discovered that by accident editing one compressed gz file opened with Enter, and realizing after it was saved what I did. -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2009-04-14 at 16:47 -0500, Rajko M. wrote:
On Tuesday 14 April 2009 04:06:32 pm Richard wrote:
One question though comes to mind with MC. ? Is it possible to INSERT a file into a RPM, eg, say it is a src rpm and I want to remove/edit a something.c source file and reinsert it back into the rpm without going to the trouble of having to extract all files, modify specs (possibly) and doing a rpmbuild?
Not yet.
I recently discovered that I can edit (F4) gzipped files. That was impossible for years. I discovered that by accident editing one compressed gz file opened with Enter, and realizing after it was saved what I did.
I think you can add files to an archive, or remove them. [...] No, I tried adding a file to tgz and failed. Removing also failed, says "Function not implemented (38)" Editing also fails. [...] Ah! editing works on a .zip. cpying too. removing also works. Curious... - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknlD2IACgkQtTMYHG2NR9VFQgCZAdW604958Il3Zto/qF+odb5j ltkAoIy2TignCVbS3fIx+Em1e3CgzOG3 =ULuL -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2009-04-14 at 17:06 -0400, Richard wrote:
The RPM in question is hosed and had no cpio or gzipped file in the 'directory' as displayed by MC yet the file was huge, way larger than suggested by the mc 'directory'.
Try opening the rpm archive with mc, then hit F9, go to command menu, select "show directory sizes". It will think for a moment, then show how many kilobytes has every directory listed on the active panel, and thus, you should see where the bytes have gone to. Maybe they are in hiding, if you say the archive is big...
One question though comes to mind with MC. Is it possible to INSERT a file into a RPM,
Dunno, try. And then you tell us, it is an interesting question :-) - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknlEWgACgkQtTMYHG2NR9UfvACggTnppIiep+jpMdLcYKcqzozQ 8A8AoIFUhUUXHkIgK1j4uDBLVdatXWCJ =Yr59 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Richard <ricreig@gmail.com> [04-14-09 01:48]:
That almost works. Apparantly the *.src files are all gzipped and I can't find how to separate the pieces.
so you need two steps. First save the gzipped file, the open the gzipped file in mc and extract the particular file. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2009-04-14 at 08:52 -0400, Patrick Shanahan wrote:
* Richard <> [04-14-09 01:48]:
That almost works. Apparantly the *.src files are all gzipped and I can't find how to separate the pieces.
so you need two steps. First save the gzipped file, the open the gzipped file in mc and extract the particular file.
mc can open directly gzipped files, even inside an rpm or other type or archive. If they are text, F3 will display them. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknkiH8ACgkQtTMYHG2NR9XmdACfX7fNAdk/UWnpmuESOKUwGKK+ yuQAnRiWoxeSWSe0lF9TQUkD3PbPbLne =Nn9P -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue April 14 2009 8:52:31 am Patrick Shanahan wrote:
* Richard <ricreig@gmail.com> [04-14-09 01:48]:
That almost works. Apparantly the *.src files are all gzipped and I can't find how to separate the pieces.
so you need two steps. First save the gzipped file, the open the gzipped file in mc and extract the particular file.
The RPM was buggered....for other RPMs, MC worked fine without having to do that but MC didn't see the gzipped portion of the RPM as a file so didn't display it. I had to use rpm2cpio to see the fact the RPM had a lot of 'binary' in it on my terminal. On a regular source file RPM, MC works fine if it is 'intact'. Thanks Richard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Richard wrote:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
I do not want to 'install' the whole RPM as it would clobber files of the same name, most of which have been changed over time. One of the files in the RPM file contains information I need to recover.
Thanks for any suggestions
Richard
http://www.linux-noob.com/forums/index.php?showtopic=355 -- Best Regards, Mukul Singh -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 14 April 2009 02:47:52 am Richard wrote:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
I do not want to 'install' the whole RPM as it would clobber files of the same name, most of which have been changed over time. One of the files in the RPM file contains information I need to recover.
Thanks for any suggestions
Simple to use, lesser commands to remember: http://en.opensuse.org/Midnight_Commander and http://en.opensuse.org/Midnight_Commander/Tips -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue April 14 2009 12:10:44 am Rajko M. wrote:
On Tuesday 14 April 2009 02:47:52 am Richard wrote:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
I do not want to 'install' the whole RPM as it would clobber files of the same name, most of which have been changed over time. One of the files in the RPM file contains information I need to recover.
Thanks for any suggestions
Simple to use, lesser commands to remember:
http://en.opensuse.org/Midnight_Commander and http://en.opensuse.org/Midnight_Commander/Tips
-- Regards, Rajko
Thanks...Patrick and Rajko. I think the specific RPM file I have may be corrupt because your suggestions do work on other RPM's I tried. I really appreciate the tips. Richard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 14 April 2009 05:15:30 am Richard wrote: ...
Thanks...Patrick and Rajko.
I think the specific RPM file I have may be corrupt because your suggestions do work on other RPM's I tried.
You are welcome. Midnight Commander has a lot of magic in its config files and all user has to remember, besides to read bottom line, is Enter for 90% of tasks. That is what I call user friendly. -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, Apr 14, 2009 at 08:47, Richard <ricreig@gmail.com> wrote:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
I do not want to 'install' the whole RPM as it would clobber files of the same name, most of which have been changed over time. One of the files in the RPM file contains information I need to recover.
Set up a different build root and install the src.rpm. Use tar to extract the exact files you want. -- Registered Linux User # 125653 (http://counter.li.org) Now accepting personal mail for GMail invites. George Carlin - "Frisbeetarianism is the belief that when you die, your soul goes up on the roof and gets stu... - http://www.brainyquote.com/quotes/authors/g/george_carlin.html -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Richard wrote:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
rpm2cpio | cpio -i --no-absolute-filenames "filename" /Per -- Per Jessen, Zürich (20.1°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue April 14 2009 1:47:19 pm Per Jessen wrote:
Richard wrote:
I have a RPM file built with rpmbuild which contained sourcefiles for the application. Due to a disk crash, I lost the original sources. I still have a copy of the project.src.rpm which contains a file that I need to recover.
How can I recover/extract a single file from an RPM file?
rpm2cpio | cpio -i --no-absolute-filenames "filename"
/Per
Thankyou for that tip....I think the RPM is corrupt but I'll see if it is still in my Trash and restore it and give your tip a try. MC works fine for all the other rpms I tried, it is just that *this* one had something in it I needed to recover. I'm hoping a backup exists on one of my other file servers thata is intact. Richard -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (7)
-
Carlos E. R.
-
Mukul Singh
-
ne...
-
Patrick Shanahan
-
Per Jessen
-
Rajko M.
-
Richard