map download link to distname
Ryan Schmidt
ryandesign at macports.org
Mon Apr 5 23:39:25 UTC 2021
On Apr 5, 2021, at 16:33, Jonathan Stickel wrote:
> On 4/5/21 14:17, Ryan Schmidt wrote:
>> On Apr 5, 2021, at 14:43, Jonathan Stickel wrote:
>>> I'm working on updating the graphviz portfile.
>> Huh, I thought an update had already been submitted months ago.
>
> No, as per discussion on the ticket:
>
> https://trac.macports.org/ticket/62165
>
> (I see you made more comments there, but providing the URL in case others are interested)
>
>>> The new download link is:
>>>
>>> https://gitlab.com/graphviz/graphviz/-/package_files/8183714/download
>>>
>>> I can get Macports to download it by using:
>>>
>>> master_sites https://gitlab.com/${name}/${name}/-/package_files/8183714
>>> distfiles download
>>>
>>> But the download source file is named "download". How do I rename it to the proper source file name "graphviz-2.47.0.tar.gz"? Forgive me if it is obvious, but I couldn't find this information in the documentation or an example in another Portfile.
>> https://trac.macports.org/wiki/PortfileRecipes#fetchwithgetparams
>> However, I would expect that using the gitlab portgroup would set up the correct download URLs for you automatically. If it does not, improve the gitlab portgroup since this need is not unique to the graphviz port.
>
> From what I can tell, Graphviz (upstream) is not releasing their "preferred" source package in a gitlab-typical way. Since the homepage is also different, I was not going to use the gitlab portgroup.
>
> I have previously observed that the github portgroup does rename the download file from a differently named download link (e.g., `v1.0.tar.gz` to `projectname-1.0.tar.gz`). I looked at the github portgroup source code and could not figure out how it does it. That is why I am asking on the list for help.
Projects hosted at gitlab should use the gitlab portgroup, just as projects hosted at github should use the github portgroup. It abstracts the knowledge of how to download files from those services, as well default homepages and livecheck settings, away into a single file that can be included by multiple ports. If the service ever changes how it works, we only have to fix it in one place.
Github and gitlab are different services that work in different ways, hence the separate portgroups.
The github portgroup does not rename downloaded files. Rather, it makes use of a feature of the github service that allows you to request an automatically-generated tarball of any filename, as long as you've specified the right tag in the URL. I don't know if the gitlab service has the same feature but it's not relevant here since the developers of graphviz have told us not to use the automatically-generated tarballs.
Instead they've told us to use their "portable source" which I presume is what I usually call a manually-generated tarball. The github service provides a means for developers to attach files to tagged releases, and the github portgroup provides a means of downloading such a file by specifying "github.tarball_from releases". (In retrospect the variable name "tarball_from" was probably not great since files are not necessarily tarballs; "download_from" or "download_type" might have been a better choice.) The gitlab service appears to offer a similar feature but the gitlab portgroup does not appear to offer a way to request such a download and should be enhanced to offer it.
Regarding the specific download link you mentioned, https://gitlab.com/graphviz/graphviz/-/package_files/8183714/download, I see that link on the graphviz web site at http://www.graphviz.org/download/source/ but I don't know where they got it. I can't find that link within their gitlab site. I don't know whether that is what in github parlance would be called a release download or whether it is yet another different type of download which is specific to gitlab for which there is not an equivalent within github.
Note that that link is for the .tar.gz source whereas we would want to use the .tar.xz source because it is smaller.
For now the way to do it would be:
name graphviz
version 2.47.0
set package_id 8183717
revision 0
checksums ...
use_xz yes
master_sites https://gitlab.com/graphviz/graphviz/-/package_files/${package_id}/download?dummy=
More information about the macports-dev
mailing list