Warning: Line X seems to hardcode the version number, consider using ${version} instead

Ryan Schmidt ryandesign at macports.org
Wed Jan 6 19:29:01 PST 2010


On Jan 6, 2010, at 18:01, nox wrote:

> Another one false positive is caused by the checksums from the verbose output of portchecksum when there is multiple distfiles (e.g. in zsh-devel).

IMHO that's not a false positive; that's exactly the kind of place where lint is correct in suggesting that ${version} be used instead.

Instead of

checksums        zsh-4.3.10.tar.bz2 \

use

checksums        zsh-${version}.tar.bz2 \

or

checksums        [suffix ${distname}] \

or

set source_distfile [suffix ${distname}]
checksums        ${source_distfile} \

and then you can use ${source_distfile} also in the distfiles declaration, and define additional variables for each other distfile; I've done this in a few ports, like minivmac.

minivmac also exemplifies another case where the lint version suggestion can be wrong, but there's no way lint could know that:

set my_bootstrap_distfile                   ${my_name}-bootstrap-3.1.2_1.zip

When minivmac was at version 3.1.2, lint would flag this line. But I specifically wanted the bootstrap to be 3.1.2, not ${version}; they just happened to be the same at that particular time. I ignored the lint warning until minivmac got updated to 3.1.3 and now it's not a problem anymore (until I next decide to update the bootstrap version).



More information about the macports-dev mailing list