mvfindpkgs.pl

This script is useful to find all the packages in your work area assuming those packages are nested w/in hierarchy. If all your packages are just /vesta-work/$USER/pkgname then this is probably not useful to you.

You can dl it here:

  • [get | view] (2005-08-24 21:22:35, 1.3 KB) [[attachment:mvfindpkgs.pl]]
 All files | Selected Files: delete move to page copy to page

sub prt {
    print "mvfindpkgs.pl: ", @_, "          (\$0=$0)";
}

$w = $ARGV[0] || do{$tmp= `vgetconfig UserInterface DefaultWorkParent`;chop $tmp; $tmp . "/" . $ENV{USER}};
$w =~ m{/$} or $w .= "/";

prt "work dir: $w                         ";

# depth-first traversal of arg dir
sub process_dir {
    my $dir = shift;

    my @dirs = `ls -p $dir/|grep /\$`;

    #prt scalar @dirs, " dirs in $dir";
    
    foreach (@dirs) {

        chomp;

        my $is_co        = 0;
        my $is_scribble  = 0;
        my $is_plain_dir = 0;


        chomp (my $canonical_dir   = `csh -fc 'cd $dir$_;pwd'`);
        chomp (my $w_snapshots_dir = `vattrib -g session-dir $canonical_dir`);
        chomp (my $w_snapshots_ver = `vattrib -g session-ver-arc $canonical_dir`);
        chomp (my $next_ver_num    = `vattrib -g new-version $canonical_dir`);

        if ($w_snapshots_dir eq "") {
            $is_plain_dir = 1;
            process_dir ("$dir$_");
        } elsif ($next_ver_num eq "") {
            $is_scribble = 1;
        } else {
            $is_co = 1;
        }

        $is_co       and prt "checkout: $dir$_            ($w_snapshots_dir/$w_snapshots_ver)";
        $is_scribble and prt "scribble: $dir$_            ($w_snapshots_dir/$w_snapshots_ver)";
                
    }
}

process_dir($w);