From a52471bf7543810c54fa296e40e7a34587fdbd46 Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 2 Jan 2014 20:13:43 +0000 Subject: [PATCH] simplify handling of special files some more, that stuff has fixed names anyways --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 40 ++++++++++++++-------- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 10 +++--- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 66b90e3a804..ff169d9443d 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.215 2013/12/31 11:21:10 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.216 2014/01/02 20:13:43 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie # @@ -1634,27 +1634,32 @@ sub stringize return $self->category; } -sub add -{ - my ($class, $plist, @args) = @_; - - $class->SUPER::add($plist, $class->category); -} - sub fullname { my $self = shift; my $d = $self->infodir; if (defined $d) { - return $d.$self->category; + return $d.$self->name; } else { return undef; } } +sub category +{ + my $self = shift; + + return $self->name; +} + +sub new +{ + &OpenBSD::PackingElement::UniqueOption::new; +} + package OpenBSD::PackingElement::FCONTENTS; our @ISA=qw(OpenBSD::PackingElement::SpecialFile); -sub category() { OpenBSD::PackageInfo::CONTENTS } +sub name() { OpenBSD::PackageInfo::CONTENTS } # XXX we don't write `self' sub write {} @@ -1669,11 +1674,18 @@ sub copy_deep_if package OpenBSD::PackingElement::FCOMMENT; our @ISA=qw(OpenBSD::PackingElement::SpecialFile); -sub category() { OpenBSD::PackageInfo::COMMENT } +sub name() { OpenBSD::PackageInfo::COMMENT } + +sub new +{ + my ($self, @r) = @_; + print STDERR "Warning: obsolete special file: +COMMENT\n"; + $self->SUPER::new(@r); +} package OpenBSD::PackingElement::FDESC; our @ISA=qw(OpenBSD::PackingElement::SpecialFile); -sub category() { OpenBSD::PackageInfo::DESC } +sub name() { OpenBSD::PackageInfo::DESC } package OpenBSD::PackingElement::DisplayFile; our @ISA=qw(OpenBSD::PackingElement::SpecialFile); @@ -1697,11 +1709,11 @@ sub prepare package OpenBSD::PackingElement::FDISPLAY; our @ISA=qw(OpenBSD::PackingElement::DisplayFile); -sub category() { OpenBSD::PackageInfo::DISPLAY } +sub name() { OpenBSD::PackageInfo::DISPLAY } package OpenBSD::PackingElement::FUNDISPLAY; our @ISA=qw(OpenBSD::PackingElement::DisplayFile); -sub category() { OpenBSD::PackageInfo::UNDISPLAY } +sub name() { OpenBSD::PackageInfo::UNDISPLAY } package OpenBSD::PackingElement::Arch; our @ISA=qw(OpenBSD::PackingElement::Unique); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 007b9d826f5..27655fc98ee 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.79 2014/01/02 18:19:46 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.80 2014/01/02 20:13:43 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie # @@ -417,9 +417,9 @@ sub pretend_to_archive sub may_add { - my ($class, $subst, $plist, $name, $opt) = @_; + my ($class, $subst, $plist, $opt) = @_; if (defined $opt) { - my $o = $class->add($plist, $name); + my $o = $class->add($plist); $subst->copy($opt, $o->fullname) if defined $o->fullname; } } @@ -1226,9 +1226,9 @@ sub add_elements my $subst = $state->{subst}; add_description($state, $plist, DESC, $state->opt('d')); - OpenBSD::PackingElement::FDISPLAY->may_add($subst, $plist, DISPLAY, + OpenBSD::PackingElement::FDISPLAY->may_add($subst, $plist, $state->opt('M')); - OpenBSD::PackingElement::FUNDISPLAY->may_add($subst, $plist, UNDISPLAY, + OpenBSD::PackingElement::FUNDISPLAY->may_add($subst, $plist, $state->opt('U')); for my $d (sort keys %{$state->{dependencies}}) { OpenBSD::PackingElement::Dependency->add($plist, $d); -- 2.20.1