move readmes detection to find_extractible, so that only changed/new readmes
authorespie <espie@openbsd.org>
Tue, 4 Sep 2018 14:46:12 +0000 (14:46 +0000)
committerespie <espie@openbsd.org>
Tue, 4 Sep 2018 14:46:12 +0000 (14:46 +0000)
are recorded.

Be more specific and list those readmes in alphabetic order at end.

usr.sbin/pkg_add/OpenBSD/Add.pm
usr.sbin/pkg_add/OpenBSD/PackingElement.pm

index 2bfb909..2e58b3f 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.176 2018/06/22 13:58:55 espie Exp $
+# $OpenBSD: Add.pm,v 1.177 2018/09/04 14:46:12 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -150,6 +150,11 @@ sub perform_extraction
                            $file->name);
                }
                delete $wanted->{$file->name};
+               my $fullname = $e->fullname;
+               if ($fullname =~ m,^$state->{localbase}/share/doc/pkg-readmes/,) {
+                       push(@{$state->{readmes}}, $fullname);
+       }
+
                $e->prepare_to_extract($state, $file);
                $e->extract($state, $file);
                $p->advance($e);
@@ -541,10 +546,6 @@ sub install
        $self->SUPER::install($state);
        my $fullname = $self->fullname;
        my $destdir = $state->{destdir};
-       if ($fullname =~ m,^$state->{localbase}/share/doc/pkg-readmes/,) {
-               $state->{readmes}++;
-       }
-
        if ($state->{not}) {
                $state->say("moving tempfile -> #1",
                    $destdir.$fullname) if $state->verbose >= 5;
index df84aef..6355162 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.267 2018/08/03 06:49:26 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.268 2018/09/04 14:46:12 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -183,8 +183,11 @@ sub finish
        my ($class, $state) = @_;
        OpenBSD::PackingElement::Fontdir->finish($state);
        OpenBSD::PackingElement::RcScript->report($state);
-       if ($state->{readmes}) {
-               $state->say("Look in #1/share/doc/pkg-readmes for extra documentation.", $state->{localbase});
+       if (defined $state->{readmes}) {
+               $state->say("New and changed readme(s):");
+               for my $file (sort @{$state->{readmes}}) {
+                       $state->say("\t#1", $file);
+               }
        }
 }