Bug 234468 - Disparity between GH_TUPLE grouping behaviour and documentation
Summary: Disparity between GH_TUPLE grouping behaviour and documentation
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Port Management Team
Depends on:
Reported: 2018-12-28 16:02 UTC by ben.lavery@hashbang0.com
Modified: 2019-01-04 13:45 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description ben.lavery@hashbang0.com 2018-12-28 16:02:33 UTC
In Example 5.16 of the Porters Handbook (under section https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#makefile-master_sites-github-multiple) it says:

> Some redundant information is present with GH_TUPLE because grouping is not possible.

I think this can be interpreted to suggest that grouping does not happen when specified as part of a GH_TUPLE.  However, the grouping code is still run and causes GH_TUPLE entries with the same group to be reduced to the last entry defined.

I recently had a case where the www/gohugo project forked another to implement a change.  The Pull Request back to the original project was not accepted by the time the gohugo team wanted to release (0.51) so both the original and forked repositories are specified as dependancies (because the original is looked for by other dependancies).

Until now, I had specified the [:group] part of the tuple to be the same as the project name, this had never caused an issue for me because no two projects were named the same, until now!  I had:

# grep -n mapstructure Makefile
31:		bep:mapstructure:bb74f1d:mapstructure/src/github.com/bep/mapstructure \
63:		mitchellh:mapstructure:v1.0.0:mapstructure/src/github.com/mitchellh/mapstructure \

But distinfo was being generated with the following:

# grep -n mapstructure distinfo
88:SHA256 (gohugo/mitchellh-mapstructure-v1.0.0_GH0.tar.gz) = 6eddc2ee4c69177e6b3a47e134277663f7e70b1f23b6f05908503db9d5ad5457
89:SIZE (gohugo/mitchellh-mapstructure-v1.0.0_GH0.tar.gz) = 18841

By swapping the lines around in Makefile I could see different results in distinfo.
After much head scratching I realised the issue and starting grouping entries like the following:

# grep -n mapstructure Makefile
31:		bep:mapstructure:bb74f1d:bep_mapstructure/src/github.com/bep/mapstructure \
63:		mitchellh:mapstructure:v1.0.0:mitchellh_mapstructure/src/github.com/mitchellh/mapstructure \

See the use of account_project.

I believe that either the documentation requires some additional clarity around grouping in GH_TUPLE, or Mk/bsd.sites.mk (lines 407-430, I think) needs to ignore grouping entries in GH_TUPLE to better match what is said in the documentation.
Comment 1 Mathieu Arnold freebsd_committer 2019-01-04 13:45:46 UTC
The porter's handbook clearly says:


  The :group part must be used for only one distribution file. 
  It is used as a unique key and using it more than once will
  overwrite the previous values