4

In Linux, RPM package information for a file can be determined using the 'rpm -qf' option. Is anyone aware of a JAVA library which supports these kind of operations?

E.g.:

/bin # rpm -qf grep
grep-2.7-5.7.1
Koottan
  • 87
  • 1
  • 8

2 Answers2

2

I am unaware of any library that provides an easy API to check RPM package info. You can, however, use Java to execute shell commands and interpret their results.

Some more info:

Community
  • 1
  • 1
Lev
  • 100
  • 8
2

There is Redline RPM, which has a Scanner that might do what you want. I've used it to package RPMs via Ant/Maven, but never to read them.

Peter Becker
  • 8,795
  • 7
  • 41
  • 64
  • I had already checked Scanner. As per its API, it checks the contents of a given RPM file. Not the reverse. – Koottan Mar 30 '15 at 06:12
  • 1
    Sorry, I didn't read the question quite right. I think @Lev is right, then -- you'll probably have to spawn a process. A pure Java solution for wouldn't make too much sense given how specific to a sub-family of OS this is. – Peter Becker Mar 30 '15 at 06:17