Bug 60942 - Support for file type RPM
Summary: Support for file type RPM
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Raphael Kubo da Costa
Keywords: junior-jobs
: 214047 (view as bug list)
Depends on:
Blocks: 192630
  Show dependency treegraph
Reported: 2003-07-08 21:21 UTC by Paul Bolle
Modified: 2011-11-13 21:30 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.0
Sentry Crash Report:

Adds rpm R/O support to ark if LibArchive >= 2.8.0 (4.94 KB, patch)
2010-11-11 17:42 UTC, George Metaxas
Adds rpm R/O support to ark if LibArchive >= 2.8.0 v2 (3.19 KB, patch)
2010-12-10 08:12 UTC, George Metaxas
Adds rpm R/O support to ark if LibArchive >= 2.8.0 v3 (6.82 KB, patch)
2010-12-22 22:53 UTC, George Metaxas

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Bolle 2003-07-08 21:21:23 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    RedHat RPMs
OS:          Linux

Recently bug 47415 (Basic Debian package (.deb) handling) was resolved. That brought me to request some basic Red Hat Package (.rpm) handling too.

Note that rpm's seems to be more complicated than deb's. Rpm's are based om cpio archives, but cannot be handeld by cpio directly (you need rpm2cpio to do that, and some information - all "meta-data" - is lost when you use that). Since ark doesn't support cpio archives, handling of rpm's might require a non-trivial amount of work.

Anyway, please let me know if you need more information on this wish.
Comment 1 Thiago Macieira 2003-07-09 01:49:33 UTC
RPM Packages weren't made to have its files extracted or added to. They were made to be 
installed only. And that functionality is already present in KPackage (not in Ark). 
Comment 2 Paul Bolle 2003-07-10 00:03:03 UTC
Thanks for commenting on my bug (and on my comment on bug 59020). 
I'm not sure whether rpm's were made to be installed only. (Were deb's made to be 
installed only?) Anyway, adding files to an rpm seems indeed to be a bad idea (deleting a 
file from an rpm doesn't sound to smart, too). 
But "opening" an rpm, viewing its contents (mostly files, but also "meta-data") is another 
story. And there's nothing wrong with extracting files from an rpm too... at least, I do it 
quite often. rpm2cpio seems to have been created for that purpose. Please note that 
Maximum RPM, a great book on rpm's, has got a paragraph called "Extracting one or 
more files from a package file", explaining how to use rpm2cpio for that purpose. 
So I still think it would be nice if Ark would support those actions (opening rpm's, viewing 
of the files "archived" in an rpm, extracting files from an rpm) too. 
Comment 3 Helio Chissini de Castro 2003-07-10 00:30:16 UTC
Well, since MC ( Midnight Commander ) do a task similar to what Paul propose, i think 
that it's not a big deal add extract support to RPM package, but i understand what 
Thiago means about add. 
Even we have the right tools to manipulate RPM packages, we can't mess on the 
package structure, as .DEB, so if RPM handling will be implementes, just extract in 
read only form will be allowed. 
But there still some critical bugs to close before, so need wait some more 
Comment 4 Hugo Costelha 2004-11-23 16:56:14 UTC
*** This bug has been confirmed by popular vote. ***
Comment 5 David Anderson 2005-07-25 21:52:35 UTC
I've had a look at Gnome's "Archive Manager" - it supports read-only access to RPM files. I personally find this useful as it allows me to examine source RPMs without needing to drop to the command line and create temporary files (by running "rpm2cpio blah.src.rpm | cpio -i").

One useful addition for consideration if this is implemented might be to add in some extra files to the view in order to expose any scripts contained in the RPM (i.e. what you get if you do "rpm -qp --scripts /path/to/rpm") - if these appeared in ark as "scripts/preinstall" etc. then that would be very cool.
Comment 6 Raphael Kubo da Costa 2009-11-11 01:37:18 UTC
*** Bug 214047 has been marked as a duplicate of this bug. ***
Comment 7 George Metaxas 2010-11-11 17:42:52 UTC
Created attachment 53324 [details]
Adds rpm R/O support to ark if LibArchive >= 2.8.0

LibArchive added support for RPM in version 2.8.0 onwards. So all is needed is to added the RPM mime type to the appropriate .desktop file. I tested that with the trunk version, and I could extract the files from inside an RPM package. 
I added the mime type to the newly introduced kerfuffle_libarchive_readonly.desktop file. I've also added some code in the cmake files, to check at compile time, the version of LibArchive, and strip the RPM mime type from the .desktop file, if the detected LibArchive version is < 2.8.0.
Comment 8 Raphael Kubo da Costa 2010-11-25 17:54:17 UTC
Sorry for taking an absurd time to respond :)

I'd take a different approach to the CMake magic:

 * Although FindLibArchive.cmake currently defines HAVE_LIBARCHIVE_FOO_SUPPORT, they're defined in a different way in comparison to HAVE_LIBARCHIVE_RPM_READONLY_SUPPORT -- the former definitions depend on whether specific symbols are found in the library, whereas the latter depends only on the library version. I'd export the library version variable and add the rpm check in the appropriate Ark CMakeLists.txt

 * sed and cp are not portable commands, and we should not rely on them. Instead, I was thinking of adding something like @rpm-mimetype@ to a kerfuffle_libarchive_readonly.desktop.in file, and then call CMake's configure_file() to add the appropriate value when RPM support is present.
Comment 9 Raphael Kubo da Costa 2010-11-25 17:59:59 UTC
Oh, and VERSION_LESS/VERSION_GREATER fit better than STRLESS/STRGREATER for version comparisons.
Comment 10 Raphael Kubo da Costa 2010-12-08 02:14:17 UTC
Changing the default assignee for currently open Ark bug reports to me.
Comment 11 George Metaxas 2010-12-10 08:12:51 UTC
Created attachment 54380 [details]
Adds rpm R/O support to ark if LibArchive >= 2.8.0 v2

Followed your advice and created the above patch. Used configure_file to add RPM support if the version requirement is met. The LibArchive version is exported from the FindLibArchive.cmake file.
Comment 12 Raphael Kubo da Costa 2010-12-22 15:48:26 UTC
The new patch looks almost OK.

+#  LibArchive_VERSION - the libarchive version

We should change the other variables to LibArchive_FOO too, as the file is called FindLibArchive.cmake, not FindLIBARCHIVE. However, that should be taken care of in a separate patch. Could you please follow the naming convention here?


This and the rest of the block should be enclosed by an if (LibArchive_INCLUDE_DIR) block.

+set(LibArchive_RPM_SUPPORT_MIN_VERSION "2.8.0")

Style nitpick: this could go right above the block that uses this variable.

+	    ${CMAKE_CURRENT_SOURCE_DIR}/kerfuffle_libarchive_readonly.desktop
+            ${CMAKE_CURRENT_BINARY_DIR}/kerfuffle_libarchive_readonly.desktop

Since the .desktop file in Ark's source now needs to be preprocessed, it should now be called kerfuffle_libarchive_readonly.desktop.cmake -- I've talked to the i18n guys, and it seems to be easy to make Scripty extract the translations from .desktop.cmake files too.

Plus, you now need to install the desktop file from the cmake binary dir, not the original one.

Now that the 4.6 has been created, we can finally add your next patch to trunk :)
Comment 13 George Metaxas 2010-12-22 22:53:39 UTC
Created attachment 55173 [details]
Adds rpm R/O support to ark if LibArchive >= 2.8.0 v3

Updated the patch according to your latest recommendations.
Comment 14 Raphael Kubo da Costa 2010-12-25 18:34:12 UTC
SVN commit 1209188 by rkcosta:

Close our oldest open wishlist item: RPM support.

After about 7,5 years, Ark finally has RPM support, thanks to
libarchive. Note libarchive >= 2.8.0 is required.

Thanks a lot to George Metaxas <gmetal31 AT gmail com> for the patch!

BUG: 60942
FIXED-IN: 4.7.0

 M  +13 -1     ark/plugins/libarchive/CMakeLists.txt  
 D             ark/plugins/libarchive/kerfuffle_libarchive_readonly.desktop  
 A             ark/plugins/libarchive/kerfuffle_libarchive_readonly.desktop.cmake   ark/plugins/libarchive/kerfuffle_libarchive_readonly.desktop#1209180
 M  +11 -0     cmake/modules/FindLibArchive.cmake  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1209188
Comment 15 Gilboa Davara 2010-12-25 18:58:51 UTC
Comment 16 Lukas Middendorf 2011-11-13 16:59:55 UTC
What happened to this? RPM support does not seem to be present in KDE 4.7.3 with libarchive 2.8.5 on Fedora 16.
Comment 17 Raphael Kubo da Costa 2011-11-13 20:57:50 UTC
It depends on your distro's libarchive having support for rpm archives -- Ark just checks if it has the symbol `archive_read_support_compression_rpm` defined. Please double-check with Fedora if their libarchive has rpm support.
Comment 18 Raphael Kubo da Costa 2011-11-13 21:16:07 UTC
Sorry, I was looking at the current code in master. The code checking for rpm support in in 4.7 looks wrong indeed.
Comment 19 Raphael Kubo da Costa 2011-11-13 21:30:11 UTC
Git commit a1b71a5073f7a0e268d0249904f3836ad28930fb by Raphael Kubo da Costa.
Committed on 13/11/2011 at 22:27.
Pushed by rkcosta into branch 'KDE/4.7'.

Use the RPM support detection code from f8a2d09 in master.

*sigh* It looks like in the conversion from svn to git the changes to
FindLibArchive.cmake in SVN r1209188 which defined LIBARCHIVE_VERSION
were did not make it to git.

This means the version check always failed and Ark always thought
libarchive did not have RPM support...

CCBUG: 60942

M  +7    -5    cmake/modules/FindLibArchive.cmake
M  +3    -0    plugins/CMakeLists.txt
M  +2    -5    plugins/libarchive/CMakeLists.txt