dscTobi
dscTobi

Reputation: 157

How to determine the OS version for which was compiled rpm?

How can i determine the Linux version (distribution) for which was compiled rpm packet?

Upvotes: 2

Views: 3887

Answers (3)

Steve Shipway
Steve Shipway

Reputation: 4072

You can use rpm -q to get the OS data from the OS tag in the RPM, but you need to specify a queryformat as it is not in the normal -i output. You can use -p to refer to a specific RPM file for the testing.

$ rpm -q -p myfiletotest.rpm --queryformat '%10{NAME} %10{OS} %10{VERSION} %10{RELEASE} %10{ARCH}\n' mypackage linux 2.2.10 1_14.el6 x86_64

The OS name is the second field in this output. The RPM does not distinguish between releases of the OS though; you will only see 'linux', 'aix', 'darwin', and so on - not 'centos-6'.

Upvotes: 1

Jeff Sheffield
Jeff Sheffield

Reputation: 6316

I believe this is what you are after.

$ rpm -q gnome-speech --queryformat '%10{NAME} %20{VENDOR} %20{RELEASE} %20{ARCH}\n'
    gnome-speech Red Hat, Inc.                1.fc6                 i386

$ rpm -q hwdata --queryformat '%10{NAME} %20{VENDOR} %20{RELEASE} %20{ARCH}\n'
    hwdata       Red Hat, Inc.                1.el5               noarch

There are lots of nifty bits you can go after with queryformat, see this guide for a reference.
General reference on rpm-philosophy-multi-architecture.

Upvotes: 2

Sastrija
Sastrija

Reputation: 3384

There is no such ways to determine the OS name and version from the content of the file.

Normally a RPM file name contains all these details. According to the RPM file naming convention the file name must be like :

name-version-release.architecture.rpm

Please check this link for details.

Upvotes: 1

Related Questions