move the common state things as well

This commit is contained in:
espie 2019-11-19 14:45:28 +00:00
parent eed5fb48b6
commit f1c3d659c4
3 changed files with 36 additions and 61 deletions

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: build-debug-info,v 1.17 2019/11/19 14:41:29 espie Exp $
# $OpenBSD: build-debug-info,v 1.18 2019/11/19 14:45:28 espie Exp $
# Copyright (c) 2019 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
@ -41,36 +41,8 @@ sub command_name
return 'build-debug-info';
}
# specialized state
package PlistReader::State;
our @ISA = qw(OpenBSD::PkgCreate::State);
# mostly make sure we have a progressmeter
sub init
{
my ($self, $realstate) = @_;
$self->{subst} = $self->substclass->new($realstate);
$self->{progressmeter} = $realstate->{progressmeter};
$self->{bad} = 0;
$self->{repo} = $realstate->{repo};
$self->{quiet} = $realstate->{quiet};
$self->{cache_dir} = $realstate->{cache_dir};
}
# if we're in quiet mode, get rid of status messages
sub set_status
{
my $self = shift;
return if $self->{quiet};
$self->SUPER::set_status(@_);
}
sub end_status
{
my $self = shift;
return if $self->{quiet};
$self->SUPER::end_status(@_);
}
our @ISA = qw(OpenBSD::BasePlistReader::State);
sub substclass
{

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: update-plist,v 1.183 2019/11/19 14:41:29 espie Exp $
# $OpenBSD: update-plist,v 1.184 2019/11/19 14:45:28 espie Exp $
# Copyright (c) 2018 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
@ -353,36 +353,9 @@ sub figure_out_dependencies
# specialized state
package PlistReader::State;
our @ISA = qw(OpenBSD::PkgCreate::State);
# mostly make sure we don't care about problems, that our subst records stuff
# and that we have a progressmeter
sub init
{
my ($self, $realstate) = @_;
$self->{subst} = $self->substclass->new($realstate);
$self->{progressmeter} = $realstate->{progressmeter};
$self->{bad} = 0;
$self->{repo} = $realstate->{repo};
$self->{quiet} = $realstate->{quiet};
$self->{cache_dir} = $realstate->{cache_dir};
}
# if we're in quiet mode, get rid of status messages
sub set_status
{
my $self = shift;
return if $self->{quiet};
$self->SUPER::set_status(@_);
}
sub end_status
{
my $self = shift;
return if $self->{quiet};
$self->SUPER::end_status(@_);
}
our @ISA = qw(OpenBSD::BasePlistReader::State);
# our subst will record everything
sub substclass
{
return 'OpenBSD::ReverseSubst';

View File

@ -1,4 +1,4 @@
# $OpenBSD: CommonPlist.pm,v 1.1 2019/11/19 14:38:57 espie Exp $
# $OpenBSD: CommonPlist.pm,v 1.2 2019/11/19 14:45:28 espie Exp $
# Copyright (c) 2019 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
@ -55,4 +55,34 @@ sub process_next_subpackage
return $r;
}
# specialized state
package OpenBSD::BasePlistReader::State;
our @ISA = qw(OpenBSD::PkgCreate::State);
# mostly make sure we have a progressmeter
sub init
{
my ($self, $realstate) = @_;
$self->{subst} = $self->substclass->new($realstate);
$self->{progressmeter} = $realstate->{progressmeter};
$self->{bad} = 0;
$self->{repo} = $realstate->{repo};
$self->{quiet} = $realstate->{quiet};
$self->{cache_dir} = $realstate->{cache_dir};
}
# if we're in quiet mode, get rid of status messages
sub set_status
{
my $self = shift;
return if $self->{quiet};
$self->SUPER::set_status(@_);
}
sub end_status
{
my $self = shift;
return if $self->{quiet};
$self->SUPER::end_status(@_);
}
1;