diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 60 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_create | 10 |
3 files changed, 53 insertions, 23 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 172d2a1c1ab..b3d27c06688 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.4 2003/11/16 11:49:15 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.5 2003/12/26 16:44:31 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -83,7 +83,12 @@ sub keyword() { return; } sub write { my ($self, $fh) = @_; - print $fh "\@", $self->keyword()," ", $self->{name}, "\n"; + print $fh "\@", $self->keyword(), " ", $self->stringize(), "\n"; +} + +sub stringize($) +{ + return $_[0]->{name}; } sub compute_fullname @@ -137,10 +142,10 @@ sub write my ($self, $fh) = @_; print $fh "\@ignore\n" if defined $self->{ignore}; print $fh "\@comment no checksum\n" if defined $self->{nochecksum}; - if ($self->{name} =~ m/^\@/) { + if ($self->stringize() =~ m/^\@/) { $self->SUPER::write($fh); } else { - print $fh $self->{name}, "\n"; + print $fh $self->stringize(), "\n"; } if (defined $self->{md5}) { print $fh "\@md5 ", $self->{md5}, "\n"; @@ -292,6 +297,7 @@ sub keyword() { 'option' } package OpenBSD::PackingElement::ExtraInfo; our @ISA=qw(OpenBSD::PackingElement); +sub keyword() { 'comment' } sub category() { 'extrainfo' } @@ -309,12 +315,11 @@ sub add return $self; } -sub write +sub stringize($) { - my ($self, $fh) = @_; - print $fh "\@comment subdir=", $self->{subdir}, - " cdrom=", $self->{cdrom}, - " ftp=", $self->{ftp}, "\n"; + my $self = $_[0]; + return "subdir=".$self->{subdir}." cdrom=".$self->{cdrom}. + " ftp=".$self->{ftp}; } package OpenBSD::PackingElement::PkgDep; @@ -338,6 +343,7 @@ our @ISA=qw(OpenBSD::PackingElement); __PACKAGE__->setKeyword('newdepend'); sub category() { "newdepend" } +sub keyword() { "newdepend" } sub new { @@ -346,11 +352,10 @@ sub new bless { name => $name, pattern => $pattern, def => $def }, $class; } -sub write +sub stringize($) { - my ($self, $fh) = @_; - print $fh "\@newdepend ", $self->{name}, ':', - $self->{pattern}, ':', $self->{def}, "\n"; + my $self = $_[0]; + return $self->{name}.':'.$self->{pattern}.':'.$self->{def}; } package OpenBSD::PackingElement::LibDepend; @@ -359,6 +364,7 @@ our @ISA=qw(OpenBSD::PackingElement); __PACKAGE__->setKeyword('libdepend'); sub category() { "libdepend" } +sub keyword() { "libdepend" } sub new { @@ -368,12 +374,11 @@ sub new def => $def }, $class; } -sub write +sub stringize($) { - my ($self, $fh) = @_; - print $fh "\@libdepend ", $self->{name}, ':', - $self->{libspec}, ':', - $self->{pattern}, ':', $self->{def}, "\n"; + my $self = $_[0]; + return $self->{name}.':'.$self->{libspec}.':'.$self->{pattern}. + ':'.$self->{def}; } package OpenBSD::PackingElement::Unique; @@ -576,4 +581,23 @@ package OpenBSD::PackingElement::FMTREE_DIRS; our @ISA=qw(OpenBSD::PackingElement::SpecialFile); sub category() { OpenBSD::PackageInfo::MTREE_DIRS } +package OpenBSD::PackingElement::Arch; +our @ISA=qw(OpenBSD::PackingElement::Unique); +__PACKAGE__->setKeyword('arch'); +sub category() { 'arch' } +sub keyword() { 'arch' } + +sub new +{ + my ($class, $args) = @_; + my @arches= split(/\,/, $args); + bless { arches => @arches }, $class; +} + +sub stringize($) +{ + my $self = $_[0]; + return join(',',$self->{arches}); +} + 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index c05e5936ac5..24c6b9cdbab 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackingList.pm,v 1.3 2003/11/06 17:46:35 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.4 2003/12/26 16:44:31 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -79,7 +79,9 @@ sub write if (defined $self->{'no-default-conflict'}) { $self->{'no-default-conflict'}->write($fh); } - $self->{extrainfo}->write($fh); + for my $unique_item (qw(extrainfo arch)) { + $self->{$unique_item}->write($fh) if defined $self->{$unique_item}; + } for my $listname (qw(pkgcfl pkgdep newdepend libdepend items)) { if (defined $self->{$listname}) { for my $item (@{$self->{$listname}}) { diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index db733ed835a..cdd33e4e88e 100644 --- a/usr.sbin/pkg_add/pkg_create +++ b/usr.sbin/pkg_add/pkg_create @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_create,v 1.5 2003/11/22 11:59:19 espie Exp $ +# $OpenBSD: pkg_create,v 1.6 2003/12/26 16:44:31 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -129,8 +129,8 @@ package main; our $errors = 0; our ($opt_p, $opt_f, $opt_c, $opt_d, $opt_v, $opt_i, $opt_k, $opt_r, $opt_D, - $opt_S, $opt_m, $opt_h, $opt_s, $opt_O, $opt_P, $opt_C); -getopts('p:f:c:d:vi:k:r:D:S:m:hs:OP:C:'); + $opt_S, $opt_m, $opt_h, $opt_s, $opt_O, $opt_P, $opt_C, $opt_A); +getopts('p:f:c:d:vi:k:r:D:S:m:hs:OP:C:A:'); if (@ARGV != 1) { die "Exactly one single package name is required"; @@ -205,6 +205,10 @@ if (defined $opt_C) { } } +if (defined $opt_A) { + OpenBSD::PackingElement::Arch->add($plist, $opt_A); +} + $plist->fromfile($dir.CONTENTS) or die "Can't open packing list"; |