So while this patch *does* make portgen complain about uppercase comments, what it really does is provide a way to complain about things at the end of the output instead of mixed into the middle.
I do wonder if it would be better to capture the output and make the whole thing quieter, but even then it might be nice to have some things printed at the bottom. One nice thing is that it puts the complaints at the bottom even after recursing into unported dependencies. I also wonder how useful it is because nearly every port I tried complains about it, so not sure if it would be better in portcheck(1) or just relaxing that requirement. I'm not set on the name, but the functionality seems pretty nice and I'm sure I'll find more things that should show up at the end of the process. Comments, suggestions, better names? Index: lib/OpenBSD/PortGen/Port.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port.pm,v retrieving revision 1.5 diff -u -p -r1.5 Port.pm --- lib/OpenBSD/PortGen/Port.pm 21 Apr 2019 03:47:40 -0000 1.5 +++ lib/OpenBSD/PortGen/Port.pm 9 May 2019 02:26:51 -0000 @@ -108,7 +108,10 @@ sub set_comment $comment =~ s/\n/ /g; $self->{full_comment} = $comment if length $comment > 60; - $self->{COMMENT} = $self->_format_comment($comment); + $comment = $self->_format_comment($comment); + $self->complain( "Comment starts with an uppercase letter" ) + if $comment =~ /^[[:upper:]]/; + $self->{COMMENT} = $comment; } sub set_distname @@ -344,6 +347,8 @@ sub make_port my $portdir = $self->make_portdir($portname); chdir $portdir or die "couldn't chdir to $portdir: $!"; + $self->{name} = $portname; + $self->fill_in_makefile( $di, $vi ); $self->write_makefile(); @@ -398,6 +403,35 @@ sub port } return $self->make_port( $di, $vi ); +} + +sub complain +{ + my ( $self, @complaints ) = @_; + + push @{ $self->{_complaints} }, map { ref $_ ? $_ : { + name => $self->{name}, + complaint => $_, + } } @complaints; + + return 1; +} + +sub complaints +{ + my ($self) = @_; + my $complaints = delete $self->{_complaints}; + return @{ $complaints || [] }; +} + +sub DESTROY +{ + my ($self) = @_; + + for ( $self->complaints ) { + my $n = $_->{name} ? "[$_->{name}] " : ''; + print "$n$_->{complaint}\n"; + } } 1; Index: lib/OpenBSD/PortGen/Port/CPAN.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/CPAN.pm,v retrieving revision 1.4 diff -u -p -r1.4 CPAN.pm --- lib/OpenBSD/PortGen/Port/CPAN.pm 20 Jul 2017 20:42:41 -0000 1.4 +++ lib/OpenBSD/PortGen/Port/CPAN.pm 9 May 2019 02:26:51 -0000 @@ -149,6 +149,7 @@ sub get_deps my $o = OpenBSD::PortGen::Port::CPAN->new(); $o->port($module); + $self->complain( $o->complaints ); } } } Index: lib/OpenBSD/PortGen/Port/PyPI.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm,v retrieving revision 1.5 diff -u -p -r1.5 PyPI.pm --- lib/OpenBSD/PortGen/Port/PyPI.pm 8 May 2019 14:55:20 -0000 1.5 +++ lib/OpenBSD/PortGen/Port/PyPI.pm 9 May 2019 02:26:51 -0000 @@ -175,6 +176,7 @@ sub get_deps if ( $port =~ m{^pypi/} ) { my $o = OpenBSD::PortGen::Port::PyPI->new(); $o->port($name); + $self->complain( $o->complaints ); } } Index: lib/OpenBSD/PortGen/Port/Ruby.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/Ruby.pm,v retrieving revision 1.2 diff -u -p -r1.2 Ruby.pm --- lib/OpenBSD/PortGen/Port/Ruby.pm 21 Apr 2019 03:47:40 -0000 1.2 +++ lib/OpenBSD/PortGen/Port/Ruby.pm 9 May 2019 02:26:51 -0000 @@ -121,6 +121,7 @@ sub get_deps if ( $port =~ m{^ruby/} ) { my $o = OpenBSD::PortGen::Port::Ruby->new(); $o->port($name); + $self->complain( $o->complaints ); } }