Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2006 16:14:48 -0500
From:      Frank Laszlo <laszlof@vonostingroup.com>
To:        Paul Schmehl <pauls@utdallas.edu>
Cc:        Brooks Davis <brooks@one-eyed-alien.net>, ports@freebsd.org, Joe Marcus Clarke <marcus@freebsd.org>
Subject:   Re: Something wrong with portlint?
Message-ID:  <43D698C8.60609@vonostingroup.com>
In-Reply-To: <1889A83583045D2F7963B083@utd59514.utdallas.edu>
References:  <6E2E84047A522AA3CF4F3F8D@utd59514.utdallas.edu>	<43D65689.8050207@vonostingroup.com>	<0CAD779515C871FE2C1AC21E@utd59514.utdallas.edu>	<43D661F0.5090802@FreeBSD.org>	<9B2BA4ED22481885FB14746D@utd59514.utdallas.edu>	<43D68AC7.3020402@FreeBSD.org> <43D68D0B.4060702@vonostingroup.com>	<B8F07C6C9FBA4F6816450F81@utd59514.utdallas.edu>	<20060124204740.GB21232@odin.ac.hmc.edu>	<F8485D0FD7D5F8F6B7621133@utd59514.utdallas.edu>	<43D694C7.308@vonostingroup.com> <1889A83583045D2F7963B083@utd59514.utdallas.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

__________________________________________________
Frank Laszlo
System Administrator
The VonOstin Group
Email:  laszlof@tvog.net
WWW:    http://www.vonostingroup.com
Mobile: 248-863-7584



Paul Schmehl wrote:
> --On Tuesday, January 24, 2006 15:57:43 -0500 Frank Laszlo
> <laszlof@vonostingroup.com> wrote:
>
>> Paul Schmehl wrote:
>>> --On Tuesday, January 24, 2006 12:47:40 -0800 Brooks Davis
>>> <brooks@one-eyed-alien.net> wrote:
>>>
>>>> On Tue, Jan 24, 2006 at 02:38:56PM -0600, Paul Schmehl wrote:
>>>>> --On Tuesday, January 24, 2006 15:24:43 -0500 Frank Laszlo
>>>>> <laszlof@vonostingroup.com> wrote:
>>>>> >
>>>>> > Put a newline after the "commented" section on the top, all is
>>>>> fine.
>>>>> > Like so:
>>>>> >
>>>>> ># New ports collection makefile for:    barnyard
>>>>> ># Date created:                         1 Feb 2005
>>>>> ># Whom:                                 pauls
>>>>> >#
>>>>> ># $FreeBSD: ports/security/barnyard/Makefile,v 1.5 2005/11/15
>>>>> 06:50:54
>>>>> > ade Exp $
>>>>> >#
>>>>> > <newline here>
>>>>> > PORTNAME=       barnyard
>>>>> >
>>>>> >
>>>>> > Cheers,
>>>>> >    Frank
>>>>>
>>>>> Sheesh.  Wouldn't it be nice if the Handbook actually stipulated
>>>>> that?
>>>>
>>>> Or better yet if the worthless comment section died except for the
>>>> $FreeBSD$ bit. :-P
>>>>
>>> But you'd still have the required newline between that and the text of
>>> the Makefile, right?
>>>
>>>
>> It shouldn't really be required, its mostly just cosmetic.
>>
> But if you leave it out, it drives portlint nuts.
>
Portlint splits the Makefile up into sections, and I believe the code to
do this is where the 'requirement' for the newline exists. Here is the
applicable code:
<--- Begin Code --->
    #
    # break the makefile into sections.
    #
    $tmp = $rawwhole;
    # keep comment, blank line, comment in the same section
    $tmp =~ s/(#.*\n)\n+(#.*)/$1$2/g;
    @sections = split(/\n\n+/, $tmp);
    for ($i = 0; $i <= $#sections; $i++) {
        if ($sections[$i] !~ /\n$/) {
            $sections[$i] .= "\n";
        }
    }
    $idx = 0;

    #
    # section 1: comment lines.
    #
    print "OK: checking comment section of $file.\n" if ($verbose);
    my @linestocheck = split("\n", <<EOF);
Whom
Date [cC]reated
EOF

<..snip..>

    $tmp = $sections[$idx++];
    $tmp = "\n" . $tmp; # to make the begin-of-line check easier

    if ($tmp =~ /\n[^#]/) {
        &perror("FATAL: $file: non-comment line in comment section.");
    }

<--- End Code--->

As you can see it splits the sections based on 2 consecutive \n's.
(equivalent to the end of one line, and a blank line) Then when it gets
to the actual checking portion, it checks the 'comment' section, which
now contains everything in the "PORTNAME" section because there was no
newline to split it. This part does not start with a '#' so it errors
out, and complains about missing the PORTNAME, CATEGORIES, etc. because
they were in the comment section, Seems like there should be a matter
way to do this.

Regards,
    Frank



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43D698C8.60609>