From c2e19199036717dd24d992369fe580e6647d8a1f Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sat, 5 May 2007 11:18:19 +0000 Subject: set up new way to define COMMENTS, to be able to remove some stuff from the ports' infrastructure. --- usr.sbin/pkg_add/pkg_create | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'usr.sbin/pkg_add') diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index 628fbe689b6..0bb11685fbe 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.93 2007/05/05 10:50:04 espie Exp $ +# $OpenBSD: pkg_create,v 1.94 2007/05/05 11:18:18 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -431,7 +431,17 @@ sub add_description { my ($plist, $name, $infodir, $opt_c, $opt_d) = @_; OpenBSD::PackingElement::File->add($plist, $name); - if (!defined $opt_c) { + my $comment = $defines{COMMENT}; + if (defined $comment) { + $comment =~ s/^\"(.*)\"$/$1/ or + $comment =~ s/^\'(.*)\'$/$1/; + if (length $comment > 60) { + print STDERR "Error: comment is too long\n"; + print STDERR $comment, "\n"; + print STDERR ' 'x60, "^"x (length($comment)-60), "\n"; + exit 1; + } + } elsif (!defined $opt_c) { Usage "Comment required"; } if (!defined $opt_d) { @@ -439,16 +449,26 @@ sub add_description } if (defined $infodir) { open(my $fh, '>', $infodir.$name) or die "Can't write to DESC: $!"; - if ($opt_c =~ /^\-/) { - print $fh $', "\n"; + if (defined $comment) { + print $fh dosubst($comment), "\n"; } else { - copy_subst_fh($opt_c, $fh); + if ($opt_c =~ /^\-/) { + print $fh $', "\n"; + } else { + copy_subst_fh($opt_c, $fh); + } } if ($opt_d =~ /^\-/) { print $fh $', "\n"; } else { copy_subst_fh($opt_d, $fh); } + if (defined $comment) { + print $fh "\n", dosubst('Maintainer: ${MAINTAINER}'), "\n\n"; + if (defined $defines{HOMEPAGE}) { + print $fh dosubst('WWW: ${HOMEPAGE}'), "\n"; + } + } close($fh); } } -- cgit v1.2.3