summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackingList.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-09-04 22:47:57 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-09-04 22:47:57 +0000
commit2491e24fbcb5bf7f102559b04685505a55540a40 (patch)
treeadf517bc59741fd86b70ae1478ebd17ed891f00b /usr.sbin/pkg_add/OpenBSD/PackingList.pm
parentdb2b33c1ae5ac54b7cf4811c71ed9a875ec2490d (diff)
* New -i interactive option, that can ask obnoxious questions.
* move the signature code to a packing-list method, prepend the pkgname. * depend on distant listings, cache these systematically. * cut the PKG_PATH at :/ systematically, much simpler than parsing URLs. People should get used to trailing /s. * let pkg_add -u actually run the update. * check for signature in more places, for instance, let pkg_add installed_stuff be a void operation. * grab enough stuff during updates to check signatures, so that pkg_add -u can report updates that are not needed right away, instead of waiting for the more confusing `trying to update' * beginning of @module support. * @pkgpath support, including updates. * systematically expand stems when applicable. * use visitors systematically in pkg_info. * pkg_info -S reports signature. * remove hardcoding of categories in PackingList, so that future modules will be able to expand them. * add @updateset and @incompatibility keywords.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm51
1 files changed, 47 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index af9360785a7..d0c83e84982 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.47 2005/08/17 10:00:19 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.48 2005/09/04 22:47:56 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -74,6 +74,10 @@ sub read
next if m/^\s*$/;
chomp;
OpenBSD::PackingElement::Factory($_, $plist);
+ if ($plist->{need_modules}) {
+ close($fh);
+ open($fh, '<', '/dev/null');
+ }
});
return $plist;
}
@@ -159,6 +163,27 @@ sub ExtraInfoOnly
}
}
+sub UpdateInfoOnly
+{
+ my ($fh, $cont) = @_;
+ local $_;
+ while (<$fh>) {
+ # XXX optimization
+ if (m/^\@arch\b/o) {
+ while (<$fh>) {
+ if (m/^\@(?:depend|wantlib|pkgdep|newdepend|libdepend|pkgpath)\b/o) {
+ &$cont($_);
+ } elsif (m/^\@(?:groups|users|cwd)\b/o) {
+ last;
+ }
+ }
+ return;
+ }
+ next unless m/^\@(?:name\b|depend\b|wantlib\b|pkgdep\b|newdepend\b|libdepend\b|pkgpath\b|comment\s+subdir\=|arch\b)/o;
+ &$cont($_);
+ }
+}
+
sub FatOnly
{
my ($fh, $cont) = @_;
@@ -306,6 +331,16 @@ sub pkgbase($)
}
}
+our @unique_categories =
+ (qw(name no-default-conflict manual-installation extrainfo arch));
+
+our @list_categories =
+ (qw(pkgcfl conflict depend wantlib pkgdep newdepend
+ libdepend module groups users items));
+
+our @cache_categories =
+ (qw(depend wantlib pkgdep newdepend libdepend));
+
sub visit
{
my ($self, $method, @l) = @_;
@@ -320,7 +355,7 @@ sub visit
}
}
- for my $unique_item (qw(name no-default-conflict manual-installation extrainfo arch)) {
+ for my $unique_item (@unique_categories) {
$self->{$unique_item}->$method(@l) if defined $self->{$unique_item};
}
@@ -328,7 +363,7 @@ sub visit
$self->{$special}->$method(@l) if defined $self->{$special};
}
- for my $listname (qw(modules pkgcfl conflict depend wantlib pkgdep newdepend libdepend groups users items)) {
+ for my $listname (@list_categories) {
if (defined $self->{$listname}) {
for my $item (@{$self->{$listname}}) {
$item->$method(@l);
@@ -368,7 +403,7 @@ sub to_cache
my ($self) = @_;
return if defined $plist_cache->{$self->pkgname()};
my $plist = new OpenBSD::PackingList;
- for my $c (qw(depend wantlib pkgdep newdepend libdepend)) {
+ for my $c (@cache_categories) {
if (defined $self->{$c}) {
$plist->{$c} = $self->{$c};
}
@@ -388,6 +423,14 @@ sub to_installation
}
+sub signature
+{
+ my $self = shift;
+ my $k = {};
+ $self->visit('signature', $k);
+ return join(',', $self->pkgname(), sort keys %$k);
+}
+
sub forget
{
}