RPM::Info
#!/usr/bin/perl -w use RPM::Info; my $rpm = new RPM::Info(); my @rpms = (); my %filelist; my %info; my $dir = ""; my $info = ""; my @rpmreq = (); my $seek = "gimp-1.2.3-360"; print "\nVer : ".$rpm->getRpmVer(); if ($rpm->getRpms(\@rpms, "gnome") == 0) { foreach (@rpms) { print "\nRPM:-> $_"; } } if ($rpm->getRpmFiles(\%filelist, $seek) == 0) { foreach $dir (keys(%filelist)) { print "\n\n\nDir : $dir"; foreach (@{$filelist{$dir}{'files'}}) { print "\nFile : $_"; } } } if ($rpm->getRpmInfo(\%info, $seek) == 0) { print "\n\nINFOS:"; foreach $info (keys(%info)) { print "\n$info : $info{$info}"; } } if ($rpm->getRpmRequirements(\@rpmreq, $seek) == 0) { print "\n\nREQUIREMENTS:"; foreach (@rpmreq) { print "\n$_"; } } if ($rpm->getRpmInfoRaw(\@rpms, "perl") == 0) { foreach (@rpms) { print "\nRPM:-> $_"; } } if ($rpm->getRpmDependents(\@rpms, "perl") == 0) { foreach (@rpms) { print "\nRPM:-> $_"; } }
The RPM::Info module allows to get informations about installed RPM's: it fetches: name, version, requirements, all files / directories containing to a RPM, information like vendor, distributor etc.
Andreas Mahnke
creates a new object of the class
searches for all installed rpm's containing the search pattern and saves them in an Array if no search pattern is refered, all installed rpm's are saved returns 0 on succes - 1 on failure
searches for all files and directories which belong to the refered rpm - name and saves them in a Hash of Hashes returns 0 on succes - 1 on failure
gets the version of rpm and returns it
gets Infos about the specified rpm and saves them into a Hash of Hashes returns 0 on succes - 1 on failure
gets all the requirements of the specified rpm and saves them into an array returns 0 on succes - 1 on failure
gets Infos about the specified rpm and saves the output line-by-line in an array returns 0 on succes - 1 on failure
gets all the rpm names that depend on the specified rpm and saves them into an array returns 0 on succes - 1 on failure
To install RPM::Info, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPM::Info
CPAN shell
perl -MCPAN -e shell install RPM::Info
For more information on module installation, please visit the detailed CPAN module installation guide.