Fetch branch from github

Jan Beich jbeich at vfemail.net
Mon Jul 25 04:00:57 UTC 2016

abi <abi at abinet.ru> writes:

> On 24.07.2016 22:15, Bradley T. Hughes wrote:
>>> On 24 Jul 2016, at 18:23, abi <abi at abinet.ru> wrote:
>>> Hello,
>>> is it possible to fetch specific branch+commit from GitHub in port
>>> makefile? I found only release fetch or master+commit one.
>> Yes, it's possible. The Porter's handbook has a great explanation of it:
>> https://www.freebsd.org/doc/en/books/porters-handbook/makefile-distfiles.html#makefile-master_sites-github-description
> It is not. I read handbook - and I found no explanation how to fetch
> branch and failed to achieve results tinkering options randomly :P
> Here is example
> https://github.com/ZoneMinder/ZoneMinder
> 1. Account is ZoneMinder
> 2. Project is ZoneMinder
> I need a branch here, they have plenty of them. |GH_TAGNAME is working
> only for releases or for commit id. The latter tries master branch.|

Just pin a commit within a branch or pull request and adjust variables.
Repeat the procedure for every update. For one,

1. Pick the desired branch
2. Pick the desired commit
3. Put the commit into GH_TAGNAME
4. Annotate GH_TAGNAME with a branch name
5. Construct PORTVERSION with the commit at the end
6. Execute |make makesum|

would produce something like

  PORTVERSION=	0.4.s20160725
  GH_TAGNAME=	abcdef1 # mybranch

If |git describe --tags| returns something useful this can be simplified.
For one,

  $ git describe --tags origin/release-0.4

can be converted into (no explicit GH_TAGNAME)


where tag offset becomes part of version

  $ make -V PKGVERSION

A more concrete example for multimedia/zoneminder

  DISTVERSION=	1.30.0-rc2-476 # feature-h264-videostorage

Note, when switching branches always check resulting PKGVERSION and bump
PORTEPOCH if the version goes backwards.

  $ pkg version -t 1.30.0_1 1.30.0.r2.476

  $ pkg version -t 1.30.0_1 1.30.0.r2.476,1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 602 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20160725/9ccf9af3/attachment.sig>

More information about the freebsd-ports mailing list