svn commit: r435456 - in head: comms/wy60 deskutils/gbirthday devel/arduino-builder devel/cityhash devel/google-gdata devel/monodevelop emulators/citra games/openomf security/ssh-vault

Mathieu Arnold mat at FreeBSD.org
Mon Mar 20 18:38:33 UTC 2017


Le 20/03/2017 à 16:45, Kyle Evans a écrit :
> On Sun, Mar 5, 2017 at 2:13 AM, Mathieu Arnold <mat at freebsd.org> wrote:
>> Author: mat
>> Date: Sun Mar  5 08:13:28 2017
>> New Revision: 435456
>> URL: https://svnweb.freebsd.org/changeset/ports/435456
>>
>> Log:
>>   Cleanup USE_GITHUB with GH_TUPLE usage.
>>
>>   Do not use GH_TUPLE for the default distfile.
>>
>>   With hat:     portmgr
>>   Sponsored by: Absolight
>>
>> Modified:
>>   head/comms/wy60/Makefile   (contents, props changed)
>>   head/deskutils/gbirthday/Makefile   (contents, props changed)
>>   head/devel/arduino-builder/Makefile   (contents, props changed)
>>   head/devel/cityhash/Makefile   (contents, props changed)
>>   head/devel/google-gdata/Makefile   (contents, props changed)
>>   head/devel/monodevelop/Makefile   (contents, props changed)
>>   head/devel/monodevelop/distinfo   (contents, props changed)
>>   head/emulators/citra/Makefile   (contents, props changed)
>>   head/games/openomf/Makefile   (contents, props changed)
>>   head/security/ssh-vault/Makefile   (contents, props changed)
>>
>> [...]
>> Modified: head/devel/arduino-builder/Makefile
>> ==============================================================================
>> --- head/devel/arduino-builder/Makefile Sun Mar  5 08:09:35 2017        (r435455)
>> +++ head/devel/arduino-builder/Makefile Sun Mar  5 08:13:28 2017        (r435456)
>> @@ -15,7 +15,7 @@ BUILD_DEPENDS=        go:lang/go
>>
>>  USE_GITHUB=    yes
>>  GH_ACCOUNT=    arduino
>> -GH_SUBDIR=     src/github.com/${GH_ACCOUNT}/${PORTNAME}
>> +GH_SUBDIR=     src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME}
>>  GH_TUPLE=      go-errors:errors:a418503:goerrors/src/github.com/go-errors/errors \
>>                 stretchr:testify:v1.1.3:stretchr/src/github.com/stretchr/testify \
>>                 jstemmer:go-junit-report:833f8ea:jstemmer/src/github.com/jstemmer/go-junit-report
> Hi,
>
> With respect to the above change, may I ask where GH_ACCOUNT vs.
> GH_ACCOUNT_DEFAULT is most appropriately used?

TL:DR; You should never use GH_ACCOUNT/GH_PROJECT/GH_TAGNAME in
GH_SUBDIR because they get messed up with during processing.

When reading the following, you may want to read Mk/bsd.sites.mk,
starting around line 400.

The default values of the GH_(ACCOUNT|PROJECT|TAGNAME) variables have an
implied :DEFAULT group, which is the default group. So, when you write:

GH_ACCOUNT= foo

it ends up being:

GH_ACCOUNT= foo:DEFAULT

It is building on top of multiple distfiles feature explained here:
https://www.freebsd.org/doc/en/books/porters-handbook/makefile-distfiles.html#porting-master-sites-n

They can contain multiple values, and in fact, GH_TUPLE is only a
syntastic sugar on top of them, so, when GH_TUPLE is processed, its
content is hammered and sawed to fit into them.

Then, for each group variables get filled in, so, if you have

GH_ACCOUNT= foo bar:extra

it'll generate

GH_ACCOUNT_DEFAULT= foo
GH_ACCOUNT_extra= bar

and if you write:

GH_ACCOUNT= foo
GH_TUPLE= bar:bar:v1.0:extra/bar

At one point, GH_ACCOUNT will contain "foo bar:extra" and then the same
two variables describe above will be filled.

> I'm not finding any documentation for the latter, but is it safe to
> assume that if I think I need to use GH_ACCOUNT elsewhere in the
> Makefile I should likely be using GH_ACCOUNT_DEFAULT instead?

When you write:

GH_ACCOUNT=    arduino
GH_SUBDIR=     src/github.com/${GH_ACCOUNT}/${PORTNAME}

You might think that what make is going to do with it is obvious.  It is absolutely not.  make(1) defers variable expansion when it really needs it, so what it does when you write that is store that GH_ACCOUNT=arduino, and GH_SUBDIR=src/github.com/${GH_ACCOUNT}/${PORTNAME}.  Now, during the GH_TUPLE parsing, GH_ACCOUNT is *not* going to stay that way.

At one point, it'll have all the accounts present in GH_TUPLE, well, at least, references to them

$ make -dv -V GH_ACCOUNT|&grep GH_ACCOUNT\ =
Global:GH_ACCOUNT = arduino
Global:GH_ACCOUNT = arduino ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\1\4@}
Global:GH_ACCOUNT = arduino

And at the time GH_SUBDIR needs to be evaluated, GH_ACCOUNT will contain the second value in there, which will not be what you meant. Also, at the point where GH_SUBDIR is evaluated, it will contain:

-- 
Mathieu Arnold


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-ports-all/attachments/20170320/059130b9/attachment.sig>


More information about the svn-ports-all mailing list