Created
June 22, 2011 17:53
-
-
Save mdekstrand/1040676 to your computer and use it in GitHub Desktop.
Perl script to print RPM packages by size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
# get these with `yum install perl-RPM2 perl-Number-Bytes-Human' | |
use RPM2; | |
use Number::Bytes::Human qw{format_bytes}; | |
my $db = RPM2->open_rpm_db(); | |
my $i = $db->find_all_iter(); | |
while (my $pkg = $i->next) { | |
my $sz = format_bytes($pkg->size); | |
my $n = $pkg->as_nvre; | |
my $arch = $pkg->arch; | |
$arch = 'noarch' unless defined $arch; | |
print "$sz\t$n.$arch\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment