Created
November 19, 2011 11:10
-
-
Save XooR/1378729 to your computer and use it in GitHub Desktop.
yum updates...
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 | |
# To list versions before and after update | |
# it doesn't work yet, it doesn't prints all packages | |
# only some of them, need some fixing | |
use strict; | |
use warnings; | |
sub extract_name_version { | |
my ($input_ref) = @_; | |
my $ret_hash; | |
for my $update_line (@$input_ref) { | |
#xmlrpc.x86_64 2.0.1-3jpp.1 installed | |
my $el_hash; | |
my ($name, $version, $repo) | |
= $update_line =~ /^(\w\S+)\s+(\d\S+)\s+(\w\S+)$/; | |
next | |
if not defined $name; | |
$ret_hash->{$name}{version} = $version; | |
} | |
return $ret_hash; | |
} | |
my @updates_lines = `yum list updates`; | |
my @installed_lines = `yum list installed`; | |
my $updated_version_for = extract_name_version(\@updates_lines); | |
my $installed_version_for = extract_name_version(\@installed_lines); | |
for my $name (keys %$updated_version_for) { | |
print $name, "\t", $installed_version_for->{$name}{version}, "\t",$updated_version_for->{$name}{version}, "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment