Merge pull request #41 from dmacvicar/master
[platform/upstream/libsolv.git] / examples / p5solv
index 9bee102..77d580a 100755 (executable)
@@ -64,7 +64,7 @@ sub load {
   my $dorefresh = $self->{autorefresh};
   if ($dorefresh) {
     my @s = stat($self->cachepath());
-    $dorefresh = 0 if @s && ($self->{'metadata_expire'} == -1 || time() - $s[9] < $self->{'metadata_expire'});
+    $dorefresh = 0 if @s && ($self->{metadata_expire} == -1 || time() - $s[9] < $self->{metadata_expire});
   }
   $self->{cookie} = '';
   if (!$dorefresh && $self->usecachedrepo()) {
@@ -493,7 +493,7 @@ sub load_stub {
 
 die("Usage: p5solv COMMAND [ARGS]\n") unless @ARGV;
 my $cmd = shift @ARGV;
-my %cmdabbrev = ( 'li' => 'list', 'in' => 'install', 'rm' => 'erase',
+my %cmdabbrev = ( 'ls' => 'list', 'in' => 'install', 'rm' => 'erase',
                   've' => 'verify', 'se' => 'search' );
 $cmd = $cmdabbrev{$cmd} if $cmdabbrev{$cmd};
 
@@ -516,9 +516,9 @@ if (-d '/etc/zypp/repos.d') {
 }
 for my $reposdir (@reposdirs) {
   next unless -d $reposdir;
-  local *DIR;
-  next unless opendir(DIR, $reposdir);
-  for my $reponame (sort(grep {/\.repo$/} readdir(DIR))) {
+  my $dir;
+  next unless opendir($dir, $reposdir);
+  for my $reponame (sort(grep {/\.repo$/} readdir($dir))) {
     my $cfg = new Config::IniFiles('-file' => "$reposdir/$reponame");
     for my $alias ($cfg->Sections()) {
       my $repoattr = {'alias' => $alias, 'enabled' => 0, 'priority' => 99, 'autorefresh' => 1, 'type' => 'rpm-md', 'metadata_expire' => 900};
@@ -627,9 +627,7 @@ while (1) {
   last unless @problems;
   for my $problem (@problems) {
     print "Problem $problem->{id}/".@problems.":\n";
-    my $r = $problem->findproblemrule();
-    my $ri = $r->info();
-    print $ri->problemstr()."\n";
+    print $problem->str()."\n";
     my @solutions = $problem->solutions();
     for my $solution (@solutions) {
       print "  Solution $solution->{id}:\n";
@@ -707,7 +705,7 @@ while (1) {
   exit(1) if $yn eq 'n' || $yn eq 'q';
 }
 
-my @newpkgs = $trans->newpackages();
+my @newpkgs = $trans->newsolvables();
 my %newpkgsfps;
 if (@newpkgs) {
   my $downloadsize = 0;