On Feb 28, 2018, at 08:13, Mojca Miklavec wrote:

> Mojca Miklavec (mojca) pushed a commit to branch master
> in repository macports-ports.
> 
> 
> https://github.com/macports/macports-ports/commit/546836465116f3173095874d10b57aa0d0bbfb13
> 
> The following commit(s) were added to refs/heads/master by this push:
> 
>      new 5468364  cpan2port: fetch from github, use perl5.26
> 
> 5468364 is described below
> 
> 
> commit 546836465116f3173095874d10b57aa0d0bbfb13
> 
> Author: Mojca Miklavec
> AuthorDate: Wed Feb 28 11:46:58 2018 +0100
> 
> 
>     cpan2port: fetch from github, use perl5.26
> 
>     
> 
>     See: https://trac.macports.org/ticket/55208
> 
> ---
>  sysutils/cpan2port/Portfile | 31 +++++++++++++------------------
>  1 file changed, 13 insertions(+), 18 deletions(-)
> 
> diff --git a/sysutils/cpan2port/Portfile b/sysutils/cpan2port/Portfile
> index 8ae2de9..81d68fd 100644
> --- a/sysutils/cpan2port/Portfile
> +++ b/sysutils/cpan2port/Portfile
> @@ -1,12 +1,15 @@
>  # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; 
> c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
>  
>  PortSystem          1.0
> +PortGroup           github 1.0
>  PortGroup           perl5 1.0
>  
> +set git_shasum      4207b22
> +set git_date        20180228
> +
> +github.setup        macports macports-contrib ${git_shasum}

I'd like to discourage the practice of ports defining their own variables for 
things which already exist as standard variables. You're meant to specify the 
version or git committish as the third argument to github.setup, e.g.:

github.setup        macports macports-contrib 
4207b227800b8ce6ba7db02641a1b1a66b3218de

It doesn't look like you need to refer to this value elsewhere in the port, but 
if you did, you would be able to do so using the standard MacPorts variable 
${git.branch}.

I guess there's a difference of opinion about whether the committish should be 
abbreviated or not. I see no reason to abbreviate it, and some reason not to 
abbreviate it: The github portgroup is programmed to recognize version strings 
composed of 9 or more hexadecimal characters as a git committish, so a git 
committish should not be abbreviated to fewer than 9 characters. (The portgroup 
currently restricts this detection to 9 or more characters so as not to 
misidentify YYYYMMDD version numbers as a committish. This could possibly be 
improved to allow shorter hex strings to be recognized, provided they are not 
composed entirely of decimal digits.)

It's pretty crappy that we have to fetch the entire contrib repository just to 
get one of its subdirectories. I guess contrib is still pretty small so it's 
not a huge problem yet. But if this is how we're going to handle it, let's at 
least use "dist_subdir macports-contrib" so that all the ports for contrib 
software fetch to the same place, and there's at least a chance that two 
contrib ports might use the same git committish and thus the same distfile.


> @@ -38,10 +35,8 @@ depends_run-append  port:p${perl5.major}-carp-clan \
>                      port:p${perl5.major}-pod-simple \
>                      port:p${perl5.major}-yaml
>  
> -worksrcdir          ${name}
> -
>  configure {
> -    reinplace "s|#! /usr/bin/env perl|#!${prefix}/bin/perl${perl5.major}|g" 
> ${worksrcpath}/${name}
> +    reinplace "s|#! /usr/bin/env perl|#!${prefix}/bin/perl${perl5.major}|g" 
> ${worksrcpath}/${name}/${name}
>  }
>  
>  # should be implied by overriding configure:
> @@ -50,10 +45,10 @@ configure.ccache    no
>  build {}
>  
>  destroot {
> -    xinstall -m 755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name}
> +    xinstall -m 755 ${worksrcpath}/${name}/${name} 
> ${destroot}${prefix}/bin/${name}
>      xinstall -d ${destroot}${prefix}/share/doc/${name}
> -    xinstall -m 644 ${worksrcpath}/COPYING 
> ${destroot}${prefix}/share/doc/${name}/COPYING
> +    xinstall -m 644 ${worksrcpath}/${name}/COPYING 
> ${destroot}${prefix}/share/doc/${name}/COPYING
>  }
>  

Rather than replacing every occurrence of "${worksrcpath}" in the Portfile with 
"${worksrcpath}/${name}", isn't it better to set "worksrcdir 
${worksrcdir}/${name}"?


> -# TODO: check the latest svn revision of the file
> +# TODO: check the latest revision of the file
>  livecheck.type      none

The livecheck would be fixed by removing this line, and using the full git 
committish.

Reply via email to