2014-08-03

Read & Write RPM Files from F#

Redline RPM is a Java library that can be used to read and write RPM packages. The library and its dependencies can be converted to run on .NET by using the IKVM.NET Compiler. Type Extensions in F# like property extensions are really useful for this interop scenario.

Backstory

I'd like it to be easier to install Mono and F# binaries on Linux, especially Ubuntu, since that is what Travis CI uses. It would be great if creating the Linux packages could be done using F#. I'd like to see development build feeds of both Mono and F# made available via a service like Bintray. It can host rpm and deb package feeds. I don't yet understand why in the Mono downloads, the last Linux build was 3.2.3 and it is only rpm. I'm sure as I dig into this a bit more, the answer will become clearer, but hopefully I can help improve the situation. Visual F#'s recent tweet provided a bit of inspiration.

Java libraries from F#

Here are the references from the F# project. The IKVM references are from the latest IKVM NuGet package. I just removed some I thought would be unnecessary.

The redline.dll and its dependencies are created from the Java jar files using the IKVM Compiler. ikvmc options are listed here. The matching ikvmc is in the ikvmbin-7.4.5196.0.zip linked from the weblog.ikvm.net post.

I used Gradle to figure out the dependency tree and download the jar files.

F# for Reading and Writing RPM Files

Here is code that will will create a test rpm file just like the Java edition, read that file, and also read the mon-devel-3.2.3-9.x86_64.rpm. The output for reading the mono rpm is here.