summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-04-29 12:06:56 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-04-29 12:06:56 +0000
commit6df11fe2da634ae2ea9e99af7732a69bc16ffeb1 (patch)
treebc4c731a15962d6248459a86cc8554afb956ce44 /usr.sbin
parent59ff7701bdc9ab4ab613b5b3ca8241cc883ad8c6 (diff)
unify some other consistency checks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_create61
1 files changed, 36 insertions, 25 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 2661ea7b851..9b0a3cfb518 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.60 2007/04/29 11:48:00 espie Exp $
+# $OpenBSD: pkg_create,v 1.61 2007/04/29 12:06:55 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -49,18 +49,49 @@ sub count_elements { ${$_[1]}++; }
sub print_file {}
-sub avert_duplicates
+sub avert_duplicates_and_other_checks
{
my ($self, $allfiles) = @_;
return unless $self->NoDuplicateNames();
my $n = $self->fullname();
if (defined $allfiles->{$n}) {
- print STDERR "Error in packing-list: duplicate file $n\n";
+ print STDERR "Error in packing-list: duplicate item $n\n";
$main::errors++;
}
$allfiles->{$n} = 1;
}
+my $warned;
+
+sub warn_once
+{
+ my $self = shift;
+ my $k = $self->keyword;
+ if (!$warned->{$k}) {
+ print STDERR "Error: \@$k is deprecated\n";
+ $main::errors++;
+ $warned->{$k} = 1;
+ }
+}
+
+package OpenBSD::PackingElement::PkgConflict;
+sub avert_duplicates_and_other_checks
+{
+ shift->warn_once;
+}
+
+package OpenBSD::PackingElement::PkgDep;
+sub avert_duplicates_and_other_checks
+{
+ shift->warn_once;
+}
+
+package OpenBSD::PackingElement::DirRm;
+sub avert_duplicates_and_other_checks
+{
+ shift->warn_once;
+}
+
package OpenBSD::PackingElement::SpecialFile;
sub archive
{
@@ -135,18 +166,6 @@ sub comment_create_package
print "Cwd: ", $self->{name}, "\n";
}
-package OpenBSD::PackingElement::DirRm;
-my $warned;
-
-sub create_checksum
-{
- if (!$warned) {
- print STDERR "Error: \@dirrm is deprecated\n";
- $warned=1;
- $main::errors++;
- }
-}
-
package OpenBSD::PackingElement;
sub create_checksum
@@ -568,18 +587,10 @@ unless (defined $opt_q && defined $opt_n) {
$plist->makesum($base);
}
}
-$plist->avert_duplicates({});
+$plist->avert_duplicates_and_other_checks({});
-if (defined $plist->{pkgcfl}) {
- print STDERR "Error: \@pkgcfl is obsolete, use \@conflict instead\n";
- $errors++;
-}
-if (defined $plist->{pkgdep}) {
- print STDERR "\@pkgdep is obsolete, use \@depend instead\n";
- $errors++;
-}
if ($errors) {
- exit(1);
+ exit 1;
}
if (!defined $plist->{name}) {