diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2014-02-04 18:11:37 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2014-02-04 18:11:37 +0000 |
commit | 0e253bf642ea98c405d3c8b7f4f58000d7ea58ae (patch) | |
tree | fe171fb9719f065ebd9339d4ce497fd4fc2438f9 | |
parent | 1c491e2bd458e383c84a136a1da7ff91b7a1ccc0 (diff) |
no functional change (for now). Make things more debuggable by subclassing
PackingList into types that describe what info they've been limited to.
Long term (post 5.5) some operations will be restricted, such as e.g.,
only committing lists to installation if they're "full", or only checking
signatures for same.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/OldLibs.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 49 |
2 files changed, 45 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/OldLibs.pm b/usr.sbin/pkg_add/OpenBSD/OldLibs.pm index b83b81c820f..e92facf185f 100644 --- a/usr.sbin/pkg_add/OpenBSD/OldLibs.pm +++ b/usr.sbin/pkg_add/OpenBSD/OldLibs.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: OldLibs.pm,v 1.11 2012/05/07 15:55:36 espie Exp $ +# $OpenBSD: OldLibs.pm,v 1.12 2014/02/04 18:11:36 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -154,7 +154,7 @@ sub split_some_libs my $c1 = {}; my $c2 = {}; $plist->separate_element($libs, $c1, $c2); - my $p1 = OpenBSD::PackingList->new; + my $p1 = OpenBSD::PackingList::OldLibs->new; $p1->set_infodir($plist->infodir); $plist->special_deep_copy($p1, $c1, {}); my $p2 = $plist->make_shallow_copy($c2); diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 071ebb18111..1279084039e 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.130 2014/02/01 11:03:50 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.131 2014/02/04 18:11:36 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -63,6 +63,7 @@ sub match package OpenBSD::Composite; +# convert call to $self->sub(@args) into $self->visit(sub, @args) sub AUTOLOAD { our $AUTOLOAD; @@ -113,7 +114,7 @@ sub make_shallow_copy { my ($plist, $h) = @_; - my $copy = OpenBSD::PackingList->new; + my $copy = ref($plist)->new; $copy->set_infodir($plist->infodir); $plist->copy_shallow_if($copy, $h); return $copy; @@ -123,7 +124,7 @@ sub make_deep_copy { my ($plist, $h) = @_; - my $copy = OpenBSD::PackingList->new; + my $copy = ref($plist)->new; $copy->set_infodir($plist->infodir); $plist->copy_deep_if($copy, $h); return $copy; @@ -154,6 +155,8 @@ sub conflict_list return OpenBSD::PkgCfl->make_conflict_list($self); } +my $subclass; + sub read { my ($a, $u, $code) = @_; @@ -164,6 +167,9 @@ sub read } else { $plist = new $a; } + if (defined $subclass->{$code}) { + bless $plist, "OpenBSD::PackingList::".$subclass->{$code}; + } &$code($u, sub { my $line = shift; @@ -511,7 +517,7 @@ sub to_cache { my ($self) = @_; return if defined $plist_cache->{$self->pkgname}; - my $plist = new OpenBSD::PackingList; + my $plist = OpenBSD::PackingList::Depend->new; for my $c (@cache_categories) { if (defined $self->{$c}) { $plist->{$c} = $self->{$c}; @@ -551,8 +557,6 @@ sub forget { } -# convert call to $self->sub(@args) into $self->visit(sub, @args) - sub signature { my $self = shift; @@ -561,4 +565,37 @@ sub signature return OpenBSD::Signature->from_plist($self); } +$subclass = { + \&defaultCode => 'Full', + \&SharedItemsOnly => 'SharedItems', + \&DirrmOnly => 'SharedItems', + \&LibraryOnly => 'Libraries', + \&FilesOnly => 'Files', + \&PrelinkStuffOnly => 'Prelink', + \&DependOnly => 'Depend', + \&ExtraInfoOnly => 'ExtraInfo', + \&UpdateInfoOnly => 'UpdateInfo', + \&ConflictOnly => 'Conflict' }; + +package OpenBSD::PackingList::OldLibs; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::Full; +our @ISA = qw(OpenBSD::PackingList::OldLibs); +package OpenBSD::PackingList::SharedItems; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::Libraries; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::Files; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::Prelink; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::Depend; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::ExtraInfo; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::UpdateInfo; +our @ISA = qw(OpenBSD::PackingList); +package OpenBSD::PackingList::Conflict; +our @ISA = qw(OpenBSD::PackingList); + 1; |