Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
58bf722
package indexing: try to avoid partial updates
rjbs Apr 29, 2023
28e994f
PAUSE::Indexer::Context: a (currently zero-value) object for context
rjbs Apr 29, 2023
ab04f14
Indexer context: move indexing warnings to context
rjbs Apr 29, 2023
ab8fc21
Indexer context: move alerts to context
rjbs Apr 29, 2023
9748c83
indexer: make more dist indexing steps check for skip
rjbs Apr 29, 2023
9919b1a
indexer: add Abort and Errors to control indexing
rjbs Apr 29, 2023
0764741
indexer: a big refactor to change how we abort indexing
rjbs Apr 30, 2023
b560b92
indexer constants: remove a bunch of dead constants
rjbs Apr 29, 2023
c07e05b
indexer context: call a method instead of copypasting
rjbs Apr 30, 2023
ab073d7
indexer: improve the no_distname_permissions error
rjbs Apr 30, 2023
c5bc5cb
indexer: restructure the try/catch for dist indexing
rjbs Apr 30, 2023
ffad32d
indexer: drop old warning code, use the new code
rjbs Apr 30, 2023
7d0a373
no_index rules: simplify code while refactoring
rjbs Apr 30, 2023
2ce1194
indexer: turn Abort into Abort::Dist
rjbs Apr 30, 2023
5582ebb
indexer: gather packages, then index them
rjbs Apr 30, 2023
326321e
indexer: introduce an Abort::Package catch loop
rjbs Apr 30, 2023
902a38a
indexer: factor our part of the package indexer
rjbs Apr 30, 2023
885185e
indexer: try to use "return early" instead of $ok more
rjbs Apr 30, 2023
4442ed2
indexer context: add package-level indexing status
rjbs May 3, 2023
e3df668
indexer: clean up a weirdly-formatted comment
rjbs May 3, 2023
45acfaf
indexer: use ->abort_indexing_package
rjbs May 3, 2023
95342eb
replace use of index_status with context in reporting
rjbs May 3, 2023
a5ab382
indexer: reintroduce parameters to package-level errors
rjbs May 3, 2023
93f8503
indexer: improve what we provide as overall status
rjbs May 3, 2023
fd9ba66
indexer: word wrap the "nothing updated" text
rjbs May 3, 2023
2201709
PAUSE::Indexer::Errors: make sure Carp is loaded, we use it!
rjbs May 7, 2024
88b19f8
PAUSE::Package: pass older_isa_regular_perl along
rjbs May 8, 2024
a8aa32b
PAUSE::Indexer::Context: make alert and error methods look the same
rjbs May 8, 2024
b2ea13b
PAUSE::Indexer::Context: log package errors when setting them
rjbs May 11, 2024
f34d5f3
PAUSE::package: remove dead, commented-out code
rjbs May 11, 2024
392927d
Mock::Dist: remove this unused code
rjbs May 12, 2024
c917a49
PAUSE::Indexer::Errors: fix keys from $old
rjbs Jun 22, 2024
31078cc
PAUSE::Indexer::Context: make add_dist_error only accept refs
rjbs Jun 22, 2024
ac0c14d
PAUSE::Indexer::Context: pass hashrefs to abort_indexing_dist
rjbs Jun 22, 2024
44ec3c2
PAUSE::dist: do not include private errors in report
rjbs Jun 22, 2024
997d106
PAUSE::DBError: use block-style package
rjbs Jun 22, 2024
68fdf4b
PAUSE.pm: move email sending into PAUSE.pm
rjbs Jun 22, 2024
8da4d10
PAUSE.pm: add "write mail to mbox" facility
rjbs Jun 22, 2024
552967f
indexer: add tests for "nothing to index" email
rjbs Jun 22, 2024
6645fc5
indexer: be more precise in "nothing to index" email text
rjbs Jun 22, 2024
e5139a4
PAUSE::pmfile: keep packages that pass all no_index rules
rjbs Oct 11, 2026
b2387da
PAUSE::package: abort a bad package name with a real package error
rjbs Oct 11, 2026
7f9fd25
indexer: only call ->isa on abort exceptions that are objects
rjbs Oct 11, 2026
43d7f68
indexer: reject distribution_type "script" dists with a report
rjbs Oct 11, 2026
35557ea
indexer: don't send failure reports for trial releases
rjbs Oct 11, 2026
fefdde2
PAUSE::package: drop dead args to __do_regular_perl_update
rjbs Oct 11, 2026
0b32e36
PAUSE::Indexer::Errors: name the right error when arguments are missing
rjbs Oct 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions lib/PAUSE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use File::Basename ();
use Compress::Zlib ();
use Cwd ();
use DBI ();
use Email::Sender::Simple ();
use Exporter;
use Fcntl qw(:flock);
my $HAVE_RECENTFILE = eval {require File::Rsync::Mirror::Recentfile; 1;};
Expand Down Expand Up @@ -562,16 +563,38 @@ sub may_overwrite_file {
return;
}

package PAUSE::DBError;
sub sendmail {
my ($self, $email) = @_;

sub new {
my ($class, $msg) = @_;
return bless \$msg, $class;
if ($ENV{PAUSE_TEST_MAIL_MBOX}) {
# This is here for extra testing. If you set this to a filename, every
# email will be written to this mbox. Make sure it's an *absolute* path,
# because the tests change directory. -- rjbs, 2024-06-22

require Email::Sender::Transport::Mbox;
state $mbox = Email::Sender::Transport::Mbox->new({
filename => $ENV{PAUSE_TEST_MAIL_MBOX},
});

$mbox->send_email(Email::Abstract->new($email), {
from => 'test-system',
to => 'test-system',
});
}

Email::Sender::Simple->send($email);
}

use overload (
'""' => sub { ${$_[0]} }
);
package PAUSE::DBError {
sub new {
my ($class, $msg) = @_;
return bless \$msg, $class;
}

use overload (
'""' => sub { ${$_[0]} }
);
}

1;

Expand Down
16 changes: 16 additions & 0 deletions lib/PAUSE/Indexer/Abort/Dist.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package PAUSE::Indexer::Abort::Dist;
use v5.12.0;
use Moo;

has public => (
is => 'ro',
default => 0,
);

has message => (
is => 'ro',
required => 1,
);

no Moo;
1;
16 changes: 16 additions & 0 deletions lib/PAUSE/Indexer/Abort/Package.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package PAUSE::Indexer::Abort::Package;
use v5.12.0;
use Moo;

has public => (
is => 'ro',
default => 0,
);

has message => (
is => 'ro',
required => 1,
);

no Moo;
1;
174 changes: 174 additions & 0 deletions lib/PAUSE/Indexer/Context.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
package PAUSE::Indexer::Context;
use v5.12.0;
use Moo;

use PAUSE::Indexer::Abort::Dist;
use PAUSE::Indexer::Abort::Package;
use PAUSE::Indexer::Errors;
use PAUSE::Logger '$Logger';

has package_warnings => (
is => 'bare',
reader => '_package_warnings',
default => sub { {} },
);

sub add_package_warning {
my ($self, $package_obj, $warning) = @_;

my $package = $package_obj->{PACKAGE};
my $pmfile = $package_obj->pmfile->{PMFILE};

my $key = "$package\0$pmfile";

my $list = ($self->_package_warnings->{$key} //= []);
push @$list, {
package => $package,
pmfile => $pmfile,
text => $warning,
};

$Logger->log([
"adding package warning to %s: %s",
$package_obj->{PACKAGE},
$list->[-1],
]);

return;
}

has package_status => (
is => 'bare',
reader => '_package_status',
default => sub { {} },
);

sub _set_package_error {
my ($self, $package_obj, $status) = @_;

$self->_package_status->{ $package_obj->{PACKAGE} } = {
is_success => 0,
filename => $package_obj->{PP}{infile},
version => $package_obj->{PP}{version},
header => $status->{header},
body => $status->{body},
package => $package_obj->{PACKAGE},
};

$Logger->log([
"set error status for %s to %s",
$package_obj->{PACKAGE},
$status,
]);

return;
}

sub record_package_indexing {
my ($self, $package_obj) = @_;

$self->_package_status->{ $package_obj->{PACKAGE} } = {
is_success => 1,
filename => $package_obj->{PP}{infile},
version => $package_obj->{PP}{version},
header => "Indexed successfully",
body => "The package was indexed successfully.",
package => $package_obj->{PACKAGE},
};

$Logger->log([
"set OK status for %s",
$package_obj->{PACKAGE},
]);

return;
}

sub package_statuses {
my ($self) = @_;

my %stash = $self->_package_status->%*;
return @stash{ sort keys %stash };
}

sub abort_indexing_package {
my ($self, $package_obj, $error) = @_;

$Logger->log("abort indexing $package_obj->{PACKAGE}");
Comment thread
rjbs marked this conversation as resolved.

$self->_set_package_error($package_obj, $error);

die PAUSE::Indexer::Abort::Package->new({
message => $error->{header},
public => 1,
});
}

sub warnings_for_all_packages {
my ($self) = @_;

return map {; @$_ } values $self->_package_warnings->%*;
}

sub warnings_for_package {
my ($self, $package_name) = @_;

return grep {; $_->{package} eq $package_name }
$self->warnings_for_all_packages;
}

has alerts => (
is => 'bare',
reader => '_alerts',
default => sub { [] },
);

sub add_alert {
my ($self, $alert) = @_;
$alert =~ s/\v+\z//;

push $self->_alerts->@*, $alert;
return;
}

sub all_alerts {
my ($self) = @_;
return $self->_alerts->@*;
}

has dist_errors => (
is => 'bare',
reader => '_dist_errors',
default => sub { [] },
);

sub add_dist_error {
my ($self, $error) = @_;

$Logger->log_fatal([ "add_dist_error got bogus input: %s", $error ])
unless ref $error and $error->{header};

$Logger->log([ "adding dist error: %s", $error->{header} ]);
push $self->_dist_errors->@*, $error;

return;
}

sub all_dist_errors {
my ($self) = @_;
return $self->_dist_errors->@*;
}

Comment thread
rjbs marked this conversation as resolved.
sub abort_indexing_dist {
my ($self, $error) = @_;
Comment thread
rjbs marked this conversation as resolved.

$self->add_dist_error($error);

die PAUSE::Indexer::Abort::Dist->new({
message => $error->{header},
public => $error->{public},
});
}

no Moo;
1;
Loading
Loading