[MacPorts] #40831: PortGroup github 1.0 shouldn't set name in subport
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Keywords: github PortGroup | Port: github ------------------------------+-------------------------------- {{{github.setup}}} sets the port name to the project name (among other things).[[BR]] This causes troubles if the instruction is used inside a subport, namely the subport is not found by 'port'. Setting {{{name ${subport}}}} after {{{github.setup}}} causes an error with 'port lint' (port name and directory name mismatch).[[BR]] A workaround is {{{set PortInfo(name) ${subport}}}} (see also the definition of 'proc subport' in portutil.tcl). The solution would be to conditionally set {{{name}}} only when {{{github.setup}}} is not used in a subport, since the subport name is already set. An example where this problem arises can be seen in attachment:Portfile.9:ticket:40139. (Cc: ryandesign because he's the one who created the PortGroup and did most of the changes.) -- Ticket URL: <https://trac.macports.org/ticket/40831> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by ryandesign@…): Yes I've noticed some ports needing to go to unusual lengths when the github portgroup is used in a subport but not in the main port. I did not anticipate this usage pattern when creating the portgroup. I'm open to a change to the portgroup that would set name only if it isn't already set. Perhaps the bitbucket portgroup (which was based on the github portgroup) needs a similar change. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): I tried different things, but the only one that worked as I wanted was the workaround I already implemented in attachment:Portfile.9:ticket:40139. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): (Just in case you are following the ticket updates only through email, I uploaded a patch.) -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): The new version of the patch works better: it does what I originally thought (set name only when it is necessary, instead of fixing it when it isn't) and takes into account the case of a port with a different name than the github project name (if you set name before github.setup, the name won't be overwritten). Can you review this? -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by raimue@…): In my opinion `PortInfo` is an internal data structure and should not be used by Portfiles. Can't we check if we are in a subport with `$subport != $name` as we already do in other Portfiles? -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by ryandesign@…): Why does this need to be any more complicated than changing {{{ name ${github.project} }}} to {{{ default name {${github.project}} }}} ? -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): Replying to [comment:5 raimue@…]:
In my opinion `PortInfo` is an internal data structure and should not be used by Portfiles. Can't we check if we are in a subport with `$subport != $name` as we already do in other Portfiles?
I did try many things that I saw in other Portfiles, including this, but they either didn't work or gave errors with `port lint`. In this case, I wasn't able to access `name` from the PortGroup file when github.setup is used inside a subport. Replying to [comment:6 ryandesign@…]:
Why does this need to be any more complicated than changing {{{ name ${github.project} }}} to {{{ default name {${github.project}} }}} ?
This seems to work. Are the external `{}` really necessary? I can't see any difference here. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): I upgraded the patch according to Ryan's suggestion. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by ryandesign@…): Replying to [comment:7 davide.liessi@…]:
Are the external `{}` really necessary? I can't see any difference here.
Yes; they are what enable the lazy evaluation feature of options. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:9> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): Replying to [comment:9 ryandesign@…]:
Replying to [comment:7 davide.liessi@…]:
Are the external `{}` really necessary? I can't see any difference here.
Yes; they are what enable the lazy evaluation feature of options.
OK, I added them. Do you think that this can be committed? I think that it wouldn't affect existing ports. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:10> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: fixed | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Changes (by raimue@…): * status: new => closed * resolution: => fixed Comment: Committed in r115223. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:14> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Changes (by davide.liessi@…): * status: closed => reopened * resolution: fixed => Comment: Please revert r115223. * It turns out that the external `{}` break , e.g., `port info`: instead of the name of the port I get `${github.project}`. * Even without the external `{}`, the subport defined in the Portfile in my local development repository is not recognized, and the old version present in MacPorts' main repository is seen instead. On my machine the patch attachment:github-1.0.tcl.2.diff works exactly as intended: unless there are any objections, please commit it. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:15> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by davide.liessi@…): I'm sorry for the inconvenience caused by attachment:github-1.0.tcl.4.diff (and also the one that would have been caused by attachment:github-1.0.tcl.3.diff). I did try the patches, but in a local development repository and not in MacPorts' main repository, and the behaviour was different. In particular, `port info` was not broken. I tried attachment:github-1.0.tcl.2.diff changing the PortGroup file in `/opt/local/var/macports/sources/rsync.macports.org/release/ports/_resources/port1.0/group`, so I'm fairly confident that it works as intended. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:16> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Comment (by raimue@…): Reverted in r115231. -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:17> MacPorts <http://www.macports.org/> Ports system for OS X
#40831: PortGroup github 1.0 shouldn't set name in subport ------------------------------+-------------------------------- Reporter: davide.liessi@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.99 Resolution: fixed | Keywords: github PortGroup Port: github | ------------------------------+-------------------------------- Changes (by ryandesign@…): * status: reopened => closed * resolution: => fixed Comment: r122343 -- Ticket URL: <https://trac.macports.org/ticket/40831#comment:18> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts