diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-01-24 14:12:25 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-01-24 14:12:25 +0000 |
commit | 8a4f641845d706a6dc4b05f26b2434e32281dd80 (patch) | |
tree | a3b99d253bf6e66ff1b28ed2810f666a1e092547 | |
parent | 65e8ac2759b5fd31e7dd136463c950f227c49695 (diff) |
add code to check packagename for problems
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageName.pm | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 60c592503fa..5f3dc7c9541 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,7 +1,7 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.41 2010/01/19 14:58:53 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.42 2010/01/24 14:12:24 espie Exp $ # -# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> +# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -307,6 +307,16 @@ sub compare return $a->{dewey}->compare($b->{dewey}); } +sub has_issues +{ + my $self = shift; + if ($self->{dewey}{deweys}[-1] =~ m/v\d+$/ && defined $self->{p}) { + return ("correct order is pNvM"); + } else { + return (); + } +} + package OpenBSD::PackageName::versionspec; our @ISA = qw(OpenBSD::PackageName::version); @@ -401,6 +411,12 @@ sub to_pattern return $o->{stem}.'-*'; } +sub has_issues +{ + my $self = shift; + return ("is a stem"); +} + package OpenBSD::PackageName::Name; sub flavor_string { @@ -430,4 +446,12 @@ sub compare return $a->{version}->compare($b->{version}); } +sub has_issues +{ + my $self = shift; + return ((map {"flavor $_ can't start with digit"} + grep { /^\d/ } keys %{$self->{flavors}}), + $self->{version}->has_issues); +} + 1; |