Summary: | Added GH_TUPLE that allows to add many GitHub projects in a more succinct form | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Yuri Victorovich <yuri> | ||||||||||||
Component: | Ports Framework | Assignee: | Mathieu Arnold <mat> | ||||||||||||
Status: | Closed FIXED | ||||||||||||||
Severity: | Affects Only Me | CC: | jbeich, ports-bugs | ||||||||||||
Priority: | --- | Keywords: | dogfood, feature, needs-qa, patch | ||||||||||||
Version: | Latest | Flags: | koobs:
exp-run?
|
||||||||||||
Hardware: | Any | ||||||||||||||
OS: | Any | ||||||||||||||
URL: | https://reviews.freebsd.org/D4514 | ||||||||||||||
Bug Depends on: | |||||||||||||||
Bug Blocks: | 204932, 204578, 204906, 204907, 205053, 205282, 205699 | ||||||||||||||
Attachments: |
|
Description
Yuri Victorovich
2015-11-24 00:55:44 UTC
This will need: * Documentation updates (in the respective .mk file) for usage * A review (on phabricator) is highly recommended * An exp-run testing for regressions Comment on attachment 163461 [details] patch >+# GH_PROJECTS - column-separated account, project, tagname and id s/column/colon/ and plural names may attract typos. How about the following? # GH_TUPLE - above shortened to account:project:tagname[:group] >+. if defined(GH_PROJECTS) >+GH_ACCOUNT+= ${GH_PROJECTS:@ENTRY@${ENTRY:C,^([^:]*):([^:]*):([^:]*)((:[^:]*)?),\1\4,}@} >+GH_PROJECT+= ${GH_PROJECTS:@ENTRY@${ENTRY:C,^([^:]*):([^:]*):([^:]*)((:[^:]*)?),\2\4,}@} >+GH_TAGNAME+= ${GH_PROJECTS:@ENTRY@${ENTRY:C,^([^:]*):([^:]*):([^:]*)((:[^:]*)?),\3\4,}@} >+. endif :@ loops are neither supported by fmake (on 9.x systems) nor required here. GH_ACCOUNT+= ${GH_PROJECTS:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\1\4@} GH_PROJECT+= ${GH_PROJECTS:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\2\4@} GH_TAGNAME+= ${GH_PROJECTS:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\3\4@} Created attachment 163645 [details]
patch
Jan,
Thanks for your suggestions.
Created attachment 163857 [details]
patch
Added two useful targets related to GH_TUPLE:
gh-get-latest-revisions - finds the latest revisions of every project listed in GH_TUPLE
gh-get-changed-revisions - finds all projects which revisions changed on GitHub
These are useful for ports that have a lot of GitHub projects as distfiles, which update in a rolling release fashion.
You still can't use the @var@ loop thing. Ok, @var@ loop thing is only for the developer helper targets. They can be left out for now. The main thing is GH_TUPLE. Added a review for a working version. Created attachment 164127 [details]
patch
Fixed the bug: need to allow subsequent elements like this :xxx[:yyy[...]] for convenience of other uses.
Created attachment 164140 [details]
patch with .for cycle and fix for extra-elements
So far I couldn't make it work with _ACCOUNT/_PROJECT variables. So posting the working patch with .for cycle for now.
When I add
> _GROUP:=${_TUPLE_TMP:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?).*@\4@:C@:@@:C@-@_@g}
and use ${_GROUP}, every group evaluates to the same, last value in cycle.
I don't know if there is any workaround for this.
Here is the short testcase: TT+=lx:x TT+=cx:y .for T in ${TT} X:=${T:C@:.*@@} G+=X${X:C@x@@} .endfor .error "G=${G}" It evaluates to Xc Xc instead of Xl Xc I am not sure if it is practical to attempt to find a solution in this case. Because it otherwise works fine, just nor very human-readable. You are using the := at the wrong place, it should read: X=${T:C@:.*@@} G:=${G} X${X:C@x@@} yes, I get the same now, and got this before too. It looks like https://go.googlesource.com produces the different file for the same URL after a while. Temporary workaround: rm /usr/ports/distfiles/* && make makesum && make Sorry, wrong thread. When Makefile has this: X:=${X} $$ABC X:=${X} $$ABC $ make -VX BC BC Do you know how to print the dollar sign without it being expanded? It's why I rewrote the whole thing to not use make. You mean you rewrote the whole ports system? If you are saying that that this is impossible to represent the dollar sign like that, this needs to be just fixed. What does need to be fixed ? Say you have: $ cat foo .for a in bar baz FOO:= ${FOO} $$${a} .warning ${FOO} .endfor $ make -f foo make: "/home/mat/work/freebsd/ports/tata" line 3: warning: ar make: "/home/mat/work/freebsd/ports/tata" line 3: warning: ar az You're trying to coerce make(1)'s loop mechanism into generating shell code, it can't work easily. It's much simpler to do all that in shell, which is what I did. I see, I didn't notice, no notifications from phabricator. I will also add the ability to set them based on options: SOMEOPT_GH_TUPLE+= ... Please, stop updating the patch here, I'm not looking at it any more, put comments on the code review. Also, you don't need OPT_GH_TUPLE, you can use OPT_VARS= GH_TUPLE+=foo:bar:baz The latest version is here: https://reviews.freebsd.org/D4603 This can be committed without gh-* targets (GH_TUPLE itself). There were some questions asked, ex "why the hashtags are clipped at 7 characters?" that need to be resolved. A commit references this bug: Author: mat Date: Tue Mar 1 20:22:46 UTC 2016 New revision: 409898 URL: https://svnweb.freebsd.org/changeset/ports/409898 Log: Introduce GH_TUPLE. GH_TUPLE allows one to put all the GH_{ACCOUNT,PROJECT,TAGNAME} into one variable, in the form of account:project:tagname[:group]. It is helpful when there are many submodules. PR: 204772 With hat: portmgr Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D4514 Changes: head/CHANGES head/Mk/bsd.sites.mk A commit references this bug: Author: mat Date: Tue Mar 1 20:23:18 UTC 2016 New revision: 48308 URL: https://svnweb.freebsd.org/changeset/doc/48308 Log: Add a bit of documentation about the upcoming GH_TUPLE. PR: 204772 Reviewed by: wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D5509 Changes: head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml |