Skip to content

Can't get license from RPM file #7

@ice799

Description

@ice799

Hi:

I am unable to use the [] method to get the license string from RPM packages with licenses. For example: strace-4.8-4.3.x86_64.rpm (which you can get here: ftp://rpmfind.net/linux/opensuse/factory/repo/oss/suse/x86_64/strace-4.8-4.3.x86_64.rpm)

[joe@mawu:/tmp]% md5sum strace-4.8-4.3.x86_64.rpm
MD5 (strace-4.8-4.3.x86_64.rpm) = 63fc4a8049b7833d65255487b64256ac
[joe@mawu:/tmp]% irb  
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'rpm'
=> true
irb(main):003:0> pkg = RPM::Package.open("strace-4.8-4.3.x86_64.rpm")
warning: strace-4.8-4.3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 3dbdc284: NOKEY
=> #<RPM::Package:0x007f8f8c071bd8 @hdr=#<FFI::AutoPointer address=0x007f8f8b95be80>>
irb(main):004:0> pkg[:arch]
=> "x86_64"
irb(main):005:0> pkg[:name]
=> "strace"
irb(main):006:0> pkg[:license]
=> nil

Yet if I use rpm on the command line and queryformat:

[joe@mawu:/tmp]% rpm -q -p ./strace-4.8-4.3.x86_64.rpm --queryformat "%{LICENSE}\n"
warning: ./strace-4.8-4.3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 3dbdc284: NOKEY
BSD-3-Clause

Same for other RPMs.

I am using rpm version: RPM version 4.9.1.1

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions