Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
dpb: wipe all packages in an error state
To:
ports@openbsd.org
Cc:
marc.espie.openbsd@gmail.com
Date:
Sat, 1 Nov 2025 11:09:02 +0100

Download raw body.

Thread
Simple diff to add the external control "wipe-all". This wiped all
packages in an error state.

Is this useful for anyone else?

Index: lib/DPB/External.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/DPB/External.pm,v
diff -u -p -r1.32 External.pm
--- lib/DPB/External.pm	17 Oct 2023 08:03:53 -0000	1.32
+++ lib/DPB/External.pm	1 Nov 2025 10:02:37 -0000
@@ -134,6 +134,24 @@ sub stub_out($self, $fh, $p)
 	}
 }
 
+sub wipe_all($self, $fh)
+{
+	my $state = $self->{state};
+	my $engine = $state->engine;
+	my $errors = $engine->{errors};
+
+	if (@$errors == 0) {
+		$fh->print("No packages in error state\n");
+		return;
+	}
+
+	$fh->print("Wiping all packages in error state:\n");
+
+	for my $v (@$errors) {
+		$self->wipe($fh, $v->fullpkgpath);
+	}
+}
+
 sub wipehost($self, $fh, $h)
 {
 	# kill the stuff that's running
@@ -211,6 +229,8 @@ sub handle_command($self, $line, $fh)
 			    join(" ", @{$state->{bad_paths}}), "\n");
 			delete $state->{bad_paths};
 		}
+	} elsif ($line =~ m/^wipe-all\b/) {
+		$self->wipe_all($fh);
 	} elsif ($line =~ m/^wipe\s+(.*)/) {
 		for my $p (split(/\s+/, $1)) {
 			$self->wipe($fh, $p);
@@ -245,6 +265,7 @@ sub handle_command($self, $line, $fh)
 		    "\tstub <fullpkgpath>...\n",
 		    "\tsummary [<logname>]\n",
 		    "\twipe <fullpkgpath>...\n",
+		    "\twipe-all\n",
 		    "\twipehost <hostname>...\n"
 		);
 	} else {