pass -X paths thru:

- the grabber passes them to PortBuilder
... which builds a hash of pkgnames
... and the port uninstall job excludes these from the list of ports to
junk.

Note this only works with -current pkg_delete, as I had to tell it to
ignore non-existent pkgnames in that context
This commit is contained in:
espie 2013-01-07 10:59:41 +00:00
parent d8408ea93f
commit d0f75703ed
3 changed files with 30 additions and 6 deletions

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Grabber.pm,v 1.25 2013/01/04 19:34:10 espie Exp $
# $OpenBSD: Grabber.pm,v 1.26 2013/01/07 10:59:41 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -29,6 +29,7 @@ sub new
my $o = bless {
loglist => DPB::Util->make_hot($state->logger->open("vars")),
engine => $state->engine,
builder => $state->builder,
state => $state,
keep_going => 1,
errors => 0,
@ -62,9 +63,14 @@ sub finish
delete $v->{info};
$self->{engine}->add_fatal($v, $v->{broken});
delete $v->{broken};
} elsif ($v->{wantbuild}) {
delete $v->{wantbuild};
$self->{engine}->new_path($v);
} else {
if ($v->{wantbuild}) {
delete $v->{wantbuild};
$self->{engine}->new_path($v);
}
if ($v->{dontjunk}) {
$self->{builder}->dontjunk($v);
}
}
}
$self->{engine}->flush;
@ -135,6 +141,9 @@ sub complete_subdirs
delete $v->{wantbuild};
$self->{engine}->new_path($v);
}
if (defined $v->{dontjunk}) {
$self->{builder}->dontjunk($v);
}
next;
}
next if defined $v->{category};

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Port.pm,v 1.59 2013/01/05 23:38:08 espie Exp $
# $OpenBSD: Port.pm,v 1.60 2013/01/07 10:59:41 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -340,6 +340,14 @@ our @ISA=qw(DPB::Task::Port::Serialized);
sub notime { 1 }
sub add_dontjunk
{
my ($self, $job, $h) = @_;
return if !defined $job->{builder}{dontjunk};
for my $pkgname (keys %{$job->{builder}{dontjunk}}) {
$h->{$pkgname} = 1;
}
}
sub add_live_depends
{
my ($self, $h, $host) = @_;
@ -372,6 +380,7 @@ sub run
my $h = $job->{builder}->locker->find_dependencies(
$core->hostname);
if (defined $h && $self->add_live_depends($h, $core->hostname)) {
$self->add_dontjunk($job, $h);
my @cmd = ('/usr/sbin/pkg_delete', '-aIX', sort keys %$h);
print join(' ', @cmd, "\n");
$core->shell->exec(OpenBSD::Paths->sudo, @cmd);

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: PortBuilder.pm,v 1.27 2012/12/25 10:43:36 espie Exp $
# $OpenBSD: PortBuilder.pm,v 1.28 2013/01/07 10:59:41 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -70,6 +70,12 @@ sub locker
return $self->{state}->locker;
}
sub dontjunk
{
my ($self, $v) = @_;
$self->{dontjunk}{$v->fullpkgname} = 1;
}
sub make
{
my $self = shift;