[114592] trunk/dports/_resources/port1.0/group/github-1.0.tcl

Ryan Schmidt ryandesign at macports.org
Wed Dec 11 12:58:56 PST 2013


On Dec 11, 2013, at 01:33, mww at macports.org wrote:

> Revision
> 114592
> Author
> mww at macports.org
> Date
> 2013-12-10 23:33:11 -0800 (Tue, 10 Dec 2013)
> Log Message
> 
> be more intractable in the search for the worksrcdir
> Modified Paths
> 
> 	• trunk/dports/_resources/port1.0/group/github-1.0.tcl
> Diff
> 
> Modified: trunk/dports/_resources/port1.0/group/github-1.0.tcl (114591 => 114592)
> 
> --- trunk/dports/_resources/port1.0/group/github-1.0.tcl	2013-12-11 02:08:31 UTC (rev 114591)
> +++ trunk/dports/_resources/port1.0/group/github-1.0.tcl	2013-12-11 07:33:11 UTC (rev 114592)
> 
> @@ -78,14 +78,19 @@
> 
>      distname                ${github.project}-${github.version}
> 
>      fetch.ignore_sslcert    yes
> 
>  
> 
> +    # if worksrcpath does not exist, try to guess the directory that should be and rename it
> 
>      post-extract {
> 
>          if {![file exists ${worksrcpath}] && \
> 
>                  ${fetch.type} eq "standard" && \
> 
>                  ${master_sites} eq ${github.master_sites} && \
> 
>                  [llength ${distfiles}] > 0 && \
> 
> -                [llength [glob -nocomplain ${workpath}/*]] > 0 && \
> -                [file isdirectory [glob ${workpath}/*]]} {
> -            move [glob ${workpath}/*] ${worksrcpath}
> 
> +                [llength [glob -nocomplain ${workpath}/*]] > 0} {
> +            foreach item [glob ${workpath}/*] {
> +                if {[file isdirectory ${item}]} {
> +                    move ${item} ${worksrcpath}
> +                    break
> +                }
> +            }

Where were you running into problems with this?

The goal here is to not have to specify the git revision in the portfile. So, for example, the Readown port specifies "github.setup suminb readown 1.0.5” and this makes it downloads a tarball from https://github.com/suminb/readown/tarball/1.0.5 but it extracts to a directory called suminb-readown-9cf4ef5. Since I don’t want maintainers using the github portgroup to have to specify revisions like “9cf4ef5” each time they want to update a port, I introduced this magic into the portgroup that renames it to the common worksrcdir.

But this magic has proved problematic in many cases, needing this now rather lengthy list of exceptions, and even so it’s still doesn’t work in all cases.

Since the directory name that’s extracted is always ${github.project}-${github.author}-[a-z0-9]+ how about we check if there’s a directory matching that and rename that? That might reduce the number of checks we need to do and remove more opportunities for problems.

Also, it should probably rename to ${distname}, not ${worksrcpath}, which I think should finally solve the misfeature that ports using the github portgroup were not allowed to override worksrcpath and had to instead override configure.dir and build.dir.




More information about the macports-dev mailing list