text
stringlengths 0
834k
|
|---|
}
|
my %status;
|
for my $area (@areas) {
|
my %s = $area->verify(
|
package => $opt{package},
|
badfile_cb => sub {
|
my $what = shift;
|
my $file = shift;
|
print ""$file: "";
|
if ($what eq ""wrong_mode"") {
|
printf ""wrong mode %03o expected %03o\n"", @_;
|
}
|
else {
|
print ""$what\n"";
|
}
|
},
|
file_cb => !$opt{verbose} ? undef : sub {
|
my($file, $md5, $mode) = @_;
|
printf ""V %s %s %03o\n"", $file, $md5, $mode;
|
},
|
);
|
while (my($k,$v) = each %s) {
|
$status{$k} += $v;
|
}
|
}
|
for my $v (qw(verified missing modified)) {
|
next if $v ne ""verified"" && !$status{$v};
|
my $s = $status{$v} == 1 ? """" : ""s"";
|
print ""$status{$v} file$s $v.\n"";
|
}
|
}
|
sub uri_hide_passwd {
|
my $url = shift;
|
return $url unless $url =~ /\@/;
|
$url = URI->new($url);
|
if (my $ui = $url->userinfo) {
|
if ($ui =~ s/:.*/:***/) {
|
$url->userinfo($ui);
|
}
|
}
|
return $url->as_string;
|
}
|
sub repo_by_name {
|
my $name = shift;
|
return unless eval {require PPM::Repositories};
|
unless (defined &PPM::Repositories::get) {
|
my $repo = $PPM::Repositories::Repositories{$name};
|
return($name,$repo->{location});
|
}
|
my %repo = PPM::Repositories::get($name);
|
return unless keys %repo;
|
my($url,$url_noarch) = ($repo{packlist}, $repo{packlist_noarch});
|
$url ||= $url_noarch;
|
undef $url_noarch if $url_noarch && $url_noarch eq $url;
|
return($name,$url,$url_noarch);
|
}
|
sub do_repo {
|
my $cmd = shift(@ARGV) || ""list"";
|
AGAIN:
|
if ($cmd eq ""list"") {
|
$USAGE = ""repo list [--csv [ <sep> ]] [--no-header]"";
|
my $show_header = 1;
|
my $csv;
|
if (@ARGV) {
|
require Getopt::Long;
|
Getopt::Long::GetOptions(
|
'header!' => \$show_header,
|
'csv:s' => \$csv,
|
) || usage();
|
usage() if @ARGV;
|
}
|
require ActiveState::Table;
|
my $tab = ActiveState::Table->new;
|
$tab->add_field(""id"");
|
$tab->add_field(""pkgs"");
|
$tab->add_field(""name"");
|
my $count = 0;
|
for my $repo_id ($ppm->repos) {
|
my $repo = $ppm->repo($repo_id);
|
$tab->add_row({
|
id => $repo_id,
|
pkgs => $repo->{enabled} ? $repo->{pkgs} : ""n/a"",
|
name => $repo->{name},
|
});
|
$count++ if $repo->{enabled};
|
}
|
if (defined($csv)) {
|
$csv = "","" if $csv eq """";
|
print $tab->as_csv(null => """", field_separator => $csv, show_header => $show_header);
|
}
|
else {
|
print $tab->as_box(null => """", show_trailer => 0, show_header => $show_header, align => {id => ""right"", pkgs => ""right""}, box_chars => $BOX_CHARS, max_width => terminal_width());
|
my $s = ($count == 1) ? ""y"" : ""ies"";
|
$count ||= ""no"";
|
print "" ($count enabled repositor$s)\n"";
|
}
|
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.