Portfile: fetching/verifying a single file

Ryan Schmidt ryandesign at macports.org
Sat Aug 29 03:52:34 UTC 2020



On Aug 28, 2020, at 21:52, Eric F wrote:

> When downloading/fetching a single (script) file from a Git repo. If I use:
> 
> ```
> fetch {
>     file mkdir ${worksrcpath}
>     system -W ${worksrcpath} "curl -qs ${master_sites}/${_file} -o ${distpath}/${distname}"
> }
> 
> post-checksum {
>     copy ${distpath}/${distname} ${worksrcpath}
> }
> ```
> 
> That works, and I can verify against the checksums, etc. But is that an ok method? …or is there a better &/or preferred way?

No, that's not ok. Let MacPorts fetch the files for you. Set master_sites and distfiles as needed. For unversioned distfiles, set dist_subdir; consult PortfileRecipes wiki page.

Don't populate the worksrcpath in the checksum phase. That's what the extract phase is for.



More information about the macports-dev mailing list