diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-17 10:44:02 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-17 10:44:02 +0000 |
commit | 773ec2def0a41798bc89c75fd4d394850c8ad18f (patch) | |
tree | 1e1edce9977f3984f5c7a447c58bab5bee7e4474 /usr.sbin | |
parent | 9bb1d4e1cf533c7e490f4b4ee391505ac2c4de5e (diff) |
more scaffolding we don't really use yet.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 26 |
2 files changed, 35 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 2f9fa4b56d7..f1af78e8389 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.139 2007/06/17 09:50:02 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.140 2007/06/17 10:44:01 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -586,10 +586,18 @@ sub add if ($args eq 'no checksum') { $plist->{state}->{lastfile}->{nochecksum} = 1; } else { - die "Unknown tag $args"; + my $object = $plist->{state}->{lastfileobject}; + $object->{tags}->{$args} = 1; + push(@{$plist->{tags}->{$args}}, $object); } } +package OpenBSD::PackingElement::DefineTag; +our @ISA=qw(OpenBSD::PackingElement::Meta); + +sub keyword() { 'define-tag' } +__PACKAGE__->register_with_factory; + package OpenBSD::PackingElement::symlink; our @ISA=qw(OpenBSD::PackingElement::Annotation); diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index d4699b37d25..2be184135c7 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.324 2007/06/16 11:50:48 espie Exp $ +# $OpenBSD: pkg_add,v 1.325 2007/06/17 10:44:01 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -141,6 +141,30 @@ sub complete } } +sub reorder_old +{ + my ($set, $state) = @_; + # no need to sort things if there is one package to replace + # return if $set->older <= 1; + + my $resolved; + my @l = (); + my %todo = map {($_->{pkgname}, $_)} $set->older; + do { + $resolved = 0; +BIGLOOP: while (my ($pkg, $h) = each %todo) { + for my $name (OpenBSD::RequiredBy->new($pkg)->list) { + next BIGLOOP if defined $todo{$name}; + } + push(@l, $h); + delete $todo{$pkg}; + $resolved++; + } + } while ($resolved); + push(@l, values %todo); + $set->{older} = \@l; +} + sub can_install { my ($set, $state) = @_; |