summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/pkg_create
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-24 14:23:48 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-24 14:23:48 +0000
commitc316e88de332539ef0804a0ce0e73c054b39b531 (patch)
tree9133cced77d5ac81dafc3820e1569746a2afba0b /usr.sbin/pkg_add/pkg_create
parentb54121fdb6f2b57fe243bd7c7c9dfc3f460ed393 (diff)
prevent broken packagenames from creeping in.
Diffstat (limited to 'usr.sbin/pkg_add/pkg_create')
-rw-r--r--usr.sbin/pkg_add/pkg_create30
1 files changed, 29 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 49aa92cf72e..3250633c0cb 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.133 2010/01/19 14:32:22 espie Exp $
+# $OpenBSD: pkg_create,v 1.134 2010/01/24 14:23:47 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -311,6 +311,34 @@ sub avert_duplicates_and_other_checks
$self->SUPER::avert_duplicates_and_other_checks($allfiles);
}
+package OpenBSD::PackingElement::Dependency;
+sub avert_duplicates_and_other_checks
+{
+ my ($self, $allfiles) = @_;
+
+ my @issues = OpenBSD::PackageName->from_string($self->{def})->has_issues;
+ if (@issues > 0) {
+ print STDERR "Error in packing-list: invalid \@",
+ $self->keyword, " ", $self->stringize, "\n";
+ print STDERR "$self->{def}: ", join(' ', @issues), "\n";
+ $main::errors++;
+ }
+
+ $self->SUPER::avert_duplicates_and_other_checks($allfiles);
+}
+
+package OpenBSD::PackingElement::Name;
+sub avert_duplicates_and_other_checks
+{
+ my ($self, $allfiles) = @_;
+
+ my @issues = OpenBSD::PackageName->from_string($self->name)->has_issues;
+ if (@issues > 0) {
+ print STDERR "Bad packagename ", $self->name, ":",
+ join(' ', @issues), "\n";
+ $main::errors++;
+ }
+}
# put together file and filename, in order to handle fragments simply
package MyFile;