使用 HEAD and/or origin/master 从 git 存储库创建 Portfile?如何?

Creating Portfile from git repo using HEAD and/or origin/master? How to?

关于如何使用 github 回购 HEAD 并从 origin/master 或标签中提取文件来创建 Portfile 的文档非常少。

是否需要校验和?如果是,如何计算?

如何从不同的 repo/fork 拉取 PR?

例如

PortSystem          1.0

name                zimg
version             1.0
categories          multimedia

maintainers         nomaintainer

description         Colorspaces: SMPTE-C (NTSC)
homepage            https://github.com/sekrit-twc/zimg
distname            ${name}

fetch.type          git
git.url             https://github.com/sekrit-twc/zimg.git
git.branch          origin/master

how to pull a PR from a different repo/fork?

如果您有 PR 的 ID,如“Checking out pull requests locally”中所述,提取 URL 将是

git fetch origin pull/ID/head:BRANCHNAME

应用到一个porfile, with fetch.type set to git,你可以尝试作为分支名称

git.branch          origin/pull/ID/head

作为neverpanic adds in :

Note that while you can set fetch.type git and git.branch origin/master, this is not supported by MacPorts.
It's fine for development, but when trying to get a Portfile included in MacPorts, we expect that a certain version of the Portfile will always produce the same result, regardless of when you install it.

For git submodules, add post-fetch { system -W ${worksrcpath} "${git.cmd} submodule update --init" } together with fetch.type git.