diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-01-22 21:11:44 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-01-22 21:11:44 +0000 |
commit | fea5e5e20bb3cf8d4e4e72e0a2e3f77bdb8c2a6e (patch) | |
tree | 35e6b220e4d8fd147caf53a1e0249cf083d70a81 /usr.sbin/pkg_add | |
parent | 0991a9522eeb0c7735a7e45554c1698d9c79d89c (diff) |
document/activate @arch. Fix list handling.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 29 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add.1 | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_create.1 | 12 |
4 files changed, 47 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index b3d27c06688..1a03b005afb 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackingElement.pm,v 1.5 2003/12/26 16:44:31 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.6 2004/01/22 21:11:43 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -591,13 +591,13 @@ sub new { my ($class, $args) = @_; my @arches= split(/\,/, $args); - bless { arches => @arches }, $class; + bless { arches => \@arches }, $class; } sub stringize($) { my $self = $_[0]; - return join(',',$self->{arches}); + return join(',',@{$self->{arches}}); } 1; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index fadeaae8d93..5a7b700ed96 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.21 2004/01/01 17:20:54 espie Exp $ +# $OpenBSD: pkg_add,v 1.22 2004/01/22 21:11:43 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -93,6 +93,27 @@ sub install system('/bin/sh', '-c', $self->{expanded}) unless $not; } +package OpenBSD::PackingElement::Arch; + +sub check +{ + my $self = $_[0]; + + my ($machine_arch, $arch); + for my $ok (@{$self->{arches}}) { + return 1 if $ok eq '*'; + if (!defined $machine_arch) { + chomp($machine_arch = `/usr/bin/arch -s`); + } + return 1 if $ok eq $machine_arch; + if (!defined $arch) { + chomp($arch = `/usr/bin/uname -m`); + } + return 1 if $ok eq $arch; + } + return undef; +} + package main; my $errors = 0; @@ -413,6 +434,12 @@ while (my $pkg = shift @todo) { $handle->close(); next; } + if ($plist->has('arch')) { + unless ($plist->{arch}->check()) { + print "$pkg is not for the right architecture\n"; + next MAINLOOP; + } + } if (!defined $handle->{solved_dependencies}) { my @deps = solve_dependencies($handle, @todo); if (@deps > 0) { diff --git a/usr.sbin/pkg_add/pkg_add.1 b/usr.sbin/pkg_add/pkg_add.1 index 296b74114ea..683a3574e95 100644 --- a/usr.sbin/pkg_add/pkg_add.1 +++ b/usr.sbin/pkg_add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_add.1,v 1.6 2003/11/14 23:18:50 espie Exp $ +.\" $OpenBSD: pkg_add.1,v 1.7 2004/01/22 21:11:43 espie Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -158,6 +158,10 @@ directives, see with an already recorded as installed package. If it is, installation is terminated. .It +For packages tagged with architecture constraints, +.Nm +verifies that the current machine architecture agrees with the constraints. +.It All package dependencies (from .Cm @pkgdep , .Cm @libdepend , diff --git a/usr.sbin/pkg_add/pkg_create.1 b/usr.sbin/pkg_add/pkg_create.1 index 042dfcf56b8..de16a581c31 100644 --- a/usr.sbin/pkg_add/pkg_create.1 +++ b/usr.sbin/pkg_add/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_create.1,v 1.2 2003/11/14 23:03:55 espie Exp $ +.\" $OpenBSD: pkg_create.1,v 1.3 2004/01/22 21:11:43 espie Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -34,6 +34,7 @@ .Nm pkg_create .Bk -words .Op Fl hv +.Op Fl A Ar arches .Op Fl P Ar dpkgs .Op Fl C Ar cpkgs .Op Fl p Ar prefix @@ -63,6 +64,13 @@ description of the input syntax is included in this document. .Pp The options are as follows: .Bl -tag -width Ds +.It Fl A Ar arches +Register a list of architectures for which this package should install. +.Ar arches +is a comma-separated list of architectures. +Use +.Sq * +to mean any architecture (e.g., arch-independent packages). .It Fl f Ar packinglist Fetch .Dq packing list @@ -163,6 +171,8 @@ This is done by imbedding specialized command sequences in the packing list. Briefly described, these sequences are: .Bl -tag -width indent +.It Cm @arch Ar arches +List of architectures for which this package is intended. .It Cm @cwd Ar directory Set the internal directory pointer to point to .Ar directory . |