Where is depencies details in RPM?

Where is depencies details in RPM? I downloaded RPM, renamed file extension to .tar.gz, extract it and now in the extracted directory I only see usr/, etc/, etc. directories. Where is details of the RPM?

https://src.fedoraproject.org/

you can also check with:
sudo dnf repoquery --requires --resolve "packagename"

1 Like

Yeah, I know those, but there those details are in .rpm file? If I install local .rpm, how dnf/rpm knows its dependencies?

The dependencies are, as you guessed, stored in the individual rpm file. If you have a local .rpm file you can run

rpm -qp --requires rpmfile.rpm

where you replace “rpmfile.rpm” with the actual name of the local .rpm file. When crating a repository, the dependency information is extracted from all the rpm file in the repository to create a database of dependencies.

1 Like

There is RPM files that contain info of the package and RPM files that not contain any info of the package?

How that database of repository works?

To extract the contents of an rpm use rpm2cpio and pipe thru cpio, it is not a tarball.
The metadata is in a binary rpm header.
You can use various rpm —query options to explore the metadata.

1 Like

But it extracts without errors by .tar.gz?

cpio and tar are related but have important differences.
tar will fail to extra long paths, but cpio will always work, which is why it is used for rpm.

Not sure how the header was skipped, never looked into that.

You where lucky it worked :slight_smile:

1 Like

I tested rpm2cpio example.rpm | cpio -idmv, but result is the same. Only bin, opt, etc and usr directories :frowning: How can I extract metadata?

Please, answer to these:

I think the answer is use rpm --query’ with lots of the documented options.

I may have seen an answer in this thread

That is using dnf to see what other packages are required and will be pulled in. I am not sure how that is shown within the actual rpm, but it clearly shows the dependencies.

such as

rpm -q --changelog packagename
rpm -q --changes packagename
rpm -q --dupes packagename
rpm -q --info packagename
rpm -q --last packagename
rpm -q --xml packagename
rpm -q --conflicts packagename
rpm -q --enhances packagename
rpm -q --obsoletes packagename
rpm -q --provides packagename
rpm -q --recommends packagename
rpm -q --requires packagename
rpm -q --suggests packagename
rpm -q --sup‐plements packagename
rpm -q --configfiles packagename
rpm -q --docfiles packagename
rpm -q --dump packagename
rpm -q --fileclass packagename
rpm -q --filecolor packagename
rpm -q --fileprovide packagename
rpm -q --filerequire packagename
rpm -q --file‐caps packagename
rpm -q --filesbypkg packagename
rpm -q --list packagename
rpm -q --state packagename
rpm -q --noartifact packagename
rpm -q --noghost packagename
rpm -q --noconfig packagename
rpm -q --filetriggers packagename
rpm -q --scripts packagename
rpm -q --triggerscripts packagename

where packagename is the name of a package, or, if you add the -p option, it would be the name of an rpm file.

Run man rpm to get the documentation.

1 Like