track firmware separately, since those will appear as uptodate for us
authorespie <espie@openbsd.org>
Sat, 7 Oct 2023 09:10:03 +0000 (09:10 +0000)
committerespie <espie@openbsd.org>
Sat, 7 Oct 2023 09:10:03 +0000 (09:10 +0000)
usr.sbin/pkg_add/OpenBSD/Tracker.pm
usr.sbin/pkg_add/OpenBSD/Update.pm

index 4f25a8d..4075193 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Tracker.pm,v 1.31 2023/06/13 09:07:17 espie Exp $
+# $OpenBSD: Tracker.pm,v 1.32 2023/10/07 09:10:03 espie Exp $
 #
 # Copyright (c) 2009 Marc Espie <espie@openbsd.org>
 #
@@ -101,6 +101,9 @@ sub add_set($self, $set)
        for my $n ($set->kept) {
                delete $self->{to_update}{$n->pkgname};
                $self->{uptodate}{$n->pkgname} = 1;
+               if ($n->{is_firmware}) {
+                       $self->{firmware}{$n->pkgname} = 1;
+               }
        }
        $self->known($set);
        $self->handle_set($set);
@@ -134,6 +137,9 @@ sub uptodate($self, $set)
        $self->remove_set($set);
        for my $n ($set->older, $set->kept) {
                $self->{uptodate}{$n->pkgname} = 1;
+               if ($n->{is_firmware}) {
+                       $self->{firmware}{$n->pkgname} = 1;
+               }
        }
 }
 
@@ -198,6 +204,15 @@ sub cant_list($self)
        return keys %{$self->{cant_update}};
 }
 
+sub did_something($self)
+{
+       for my $k (keys %{$self->{uptodate}}) {
+               next if $self->{firmware}{$k};
+               return 1;
+       }
+       return 0;
+}
+
 sub cant_install_list($self)
 {
        return keys %{$self->{cant_install}};
index 0ac0bc1..1ba2277 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Update.pm,v 1.170 2023/06/13 09:07:17 espie Exp $
+# $OpenBSD: Update.pm,v 1.171 2023/10/07 09:10:03 espie Exp $
 #
 # Copyright (c) 2004-2014 Marc Espie <espie@openbsd.org>
 #
@@ -117,6 +117,7 @@ sub process_handle($self, $set, $h, $state)
 
        if ($plist->has('firmware') && !$state->defines('FW_UPDATE')) {
                $set->move_kept($h);
+               $h->{is_firmware} = 1;
                return 0;
        }