diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-01 22:35:48 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-01 22:35:48 +0000 |
commit | aa4bec8342bc433b9cc45237f416706fac18736e (patch) | |
tree | 4a41a19ee6f832868e291b45957f4c5f221019ee /usr.sbin/pkg_add/OpenBSD | |
parent | d15c9890e9f728d449db02f4111216999416bb66 (diff) |
very small clean-up of dependencies list handling.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 9 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Replace.pm | 5 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/RequiredBy.pm | 9 |
3 files changed, 10 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 8cb633fa640..bf563df6be8 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.43 2007/05/31 22:33:45 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.44 2007/06/01 22:35:46 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -184,12 +184,11 @@ sub register_dependencies require OpenBSD::RequiredBy; my $pkgname = $self->pkgname; + my @l = $self->dependencies; - my $r = OpenBSD::Requiring->new($pkgname); - - for my $dep ($self->dependencies) { + OpenBSD::Requiring->new($pkgname)->add(@l); + for my $dep (@l) { OpenBSD::RequiredBy->new($dep)->add($pkgname); - $r->add($dep); } } diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index 829bfaca859..1991c8bef1b 100644 --- a/usr.sbin/pkg_add/OpenBSD/Replace.pm +++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Replace.pm,v 1.29 2007/06/01 22:06:03 espie Exp $ +# $OpenBSD: Replace.pm,v 1.30 2007/06/01 22:35:46 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -374,8 +374,7 @@ sub walk_depends_closure print "\t$pkg2\n" if $state->{beverbose}; $done->{$pkg2} = 1; $write->add($pkg2); - my $l = OpenBSD::Requiring->new($pkg2); - $l->add($name); + OpenBSD::Requiring->new($pkg2)->add($name); $depend = 1; } } diff --git a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm index 888547ee0e9..176303f00f0 100644 --- a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm +++ b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: RequiredBy.pm,v 1.14 2007/05/14 09:49:27 espie Exp $ +# $OpenBSD: RequiredBy.pm,v 1.15 2007/06/01 22:35:47 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -21,12 +21,11 @@ use warnings; package OpenBSD::RequirementList; use OpenBSD::PackageInfo; -sub fill_entries($) +sub fill_entries { my $self = shift; if (!exists $self->{entries}) { - my $l = {}; - $self->{entries} = $l; + my $l = $self->{entries} = {}; if (-f $self->{filename}) { open(my $fh, '<', $self->{filename}) or @@ -34,9 +33,9 @@ sub fill_entries($) $self->{filename}, ": $!"; local $_; while(<$fh>) { - chomp $_; s/\s+$//; next if /^$/; + chomp; $l->{$_} = 1; } close($fh); |