Hi,

I am using PORTSDIR_PATH for local ports (aka mystuff), and I usually
ran pkg_outdated to check if I need to rebuild these packages (due to
dependencies).

Currently, it isn't possible out-of-box: pkg_outdated checks only for
"official" ports. I would like to extend it a bit to check also others
ports available thought PORTSDIR_PATH.

The following diff does that by avoid checking if the directory
"$portsdir/$dir" exists, but rely on make output to determine if the
port is accessible for futher investigation.

Comments or OK ?

Thanks.
-- 
Sebastien Marie


Index: pkg_outdated
===================================================================
RCS file: /cvs/ports/infrastructure/bin/pkg_outdated,v
retrieving revision 1.4
diff -u -p -r1.4 pkg_outdated
--- pkg_outdated        12 Dec 2018 16:32:59 -0000      1.4
+++ pkg_outdated        10 Mar 2019 11:19:16 -0000
@@ -45,11 +45,8 @@ sub collect_installed
                            $name);
                        return;
                }
-                       
-               my $subdir = $plist->{extrainfo}->{subdir};
-               $subdir =~ s/mystuff\///;
-               $subdir =~ s/\/usr\/ports\///;
 
+               my $subdir = $plist->{extrainfo}->{subdir};
                $pkg->{$subdir}->{name}      = $name;
                $pkg->{$subdir}->{stem}      = $stem;
                $pkg->{$subdir}->{version}   = $version;
@@ -80,11 +77,7 @@ sub collect_port_versions
        my @subdirs = ();
        for my $subdir (keys %$pkg) {
                my ($dir) = split(/,/, $subdir);
-               if (-d "$portsdir/$dir") {
-                       push(@subdirs, $subdir);
-               } else {
-                       push(@$notfound, $subdir);
-               }
+               push(@subdirs, $subdir);
        }
 
        my $cmd = "cd $portsdir && SUBDIR=\"".join(' ', @subdirs)
@@ -106,6 +99,12 @@ sub collect_port_versions
                        $count++;
                        $state->progress->show($count, $total);
                        next;
+               } elsif (/^>>\s+Broken dependency\:\s+(\S+)/) {
+                       $subdir = $1;
+                       push(@$notfound, $subdir);
+                       $count++;
+                       $state->progress->show($count, $total);
+                       next;
                }
                next unless $_ or $subdir;
                next if defined $error->{$subdir};
@@ -237,8 +236,7 @@ if ($opt_q) {
 }
 
 if (@notfound > 0) {
-       $state->errsay("\nPorts that can't be found in the official "
-           . "ports tree:");
+       $state->errsay("\nPorts that can't be found in the ports tree:");
        for (sort @notfound) {
                $state->errsay("#1", $_);
        }

Reply via email to