RPM names do not match their contents

It is kind of urgent for us at the moment

Maybe we can help you find a workaround in the meantime? As you've noted, rpm does not require anything particular about the rpm file name itself.

Can you describe your process for how you take the output of rpm -qa ... and use it to find a special file?

As a workaround: you can rename the file if you wish giving it any name you like. Here's an example that takes an rpm file named "fancy.file" and renames it to name-version-release.arch.rpm:

% file fancy.file
fancy.file: RPM v3.0 bin i386/x86_64

% rpm -qp fancy.file
example-1.0-1.x86_64

% mv -v fancy.file "$(rpm -qp fancy.file).rpm"
renamed 'fancy.file' -> 'example-1.0-1.x86_64.rpm'

% rpm -qp example-1.0-1.x86_64.rpm
example-1.0-1.x86_64

Here's an example automatically naming filebeat however you like based on the package metadata:

% wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.1-x86_64.rpm
...
% mv -v filebeat-7.3.1-x86_64.rpm "$(rpm -qp filebeat-7.3.1-x86_64.rpm).rpm"
renamed 'filebeat-7.3.1-x86_64.rpm' -> 'filebeat-7.3.1-1.x86_64.rpm'

Hope this helps.

1 Like