Re: There should be a requirement to check if a port exists before committing something right into the master

2024-05-31 Thread Joshua Root
I remembered I wrote a script years ago to detect this very situation. 
Attaching in case it's of use to anyone. There are currently no other 
duplicate ports in macports-ports, BTW. :)


- Josh

On 1/6/2024 07:11, Joshua Root wrote:
No, there's no guarantee that a PortIndex exists; you can run port 
commands on the 'current' pseudoport, or with -D, or directly on a 
porturl. The PortIndex itself is indexed on the port name normalised to 
lower case, so it is not straightforward to detect this situation even 
with an index. A warning could be generated when running portindex, but 
you can commit without doing that, and it may impact performance.


- Josh

On 1/6/2024 03:45, Herby G wrote:
Is it a guarantee that the PortIndex is available to `port` 
everytime `port lint` is run? If so, would it be possible for us to 
use the port index to verify that one and only one port exists for the 
current port name?


On Fri, May 31, 2024 at 8:35 AM Joshua Root > wrote:


    On 31/5/2024 21:22, Sergio Had wrote:
 > Otherwise we get this:
 >

https://github.com/macports/macports-ports/commit/6e2c1e19a4ffce5d59a9cdf8147022ad176dffed  >

 >
 > While LimeChat has existed for 4 years in MacPorts:
 >

https://github.com/macports/macports-ports/commits/8c30b0e9fd88d94c115b38c92809b909c4eac9aa/aqua/LimeChat/Portfile  >

 >
 > And now two conflicting ports for the same thing.

    I greatly doubt that this (or any other addition of a duplicate port)
    was deliberate, so having a specific rule against it wouldn't have
    changed anything. Yes, it's a problem that needs to be fixed.

    - Josh





lintportindex.tcl
Description: Tcl script


Re: There should be a requirement to check if a port exists before committing something right into the master

2024-05-31 Thread Joshua Root
No, there's no guarantee that a PortIndex exists; you can run port 
commands on the 'current' pseudoport, or with -D, or directly on a 
porturl. The PortIndex itself is indexed on the port name normalised to 
lower case, so it is not straightforward to detect this situation even 
with an index. A warning could be generated when running portindex, but 
you can commit without doing that, and it may impact performance.


- Josh

On 1/6/2024 03:45, Herby G wrote:
Is it a guarantee that the PortIndex is available to `port` 
everytime `port lint` is run? If so, would it be possible for us to use 
the port index to verify that one and only one port exists for the 
current port name?


On Fri, May 31, 2024 at 8:35 AM Joshua Root > wrote:


On 31/5/2024 21:22, Sergio Had wrote:
 > Otherwise we get this:
 >
https://github.com/macports/macports-ports/commit/6e2c1e19a4ffce5d59a9cdf8147022ad176dffed 

 >
 >
 > While LimeChat has existed for 4 years in MacPorts:
 >

https://github.com/macports/macports-ports/commits/8c30b0e9fd88d94c115b38c92809b909c4eac9aa/aqua/LimeChat/Portfile
 

 
>
 >
 > And now two conflicting ports for the same thing.

I greatly doubt that this (or any other addition of a duplicate port)
was deliberate, so having a specific rule against it wouldn't have
changed anything. Yes, it's a problem that needs to be fixed.

- Josh





Re: There should be a requirement to check if a port exists before committing something right into the master

2024-05-31 Thread Kirill A . Korinsky
On Fri, 31 May 2024 18:45:53 +0100,
Herby G  wrote:
> 
> Is it a guarantee that the PortIndex is available to `port` everytime `port
> lint` is run? If so, would it be possible for us to use the port index to
> verify that one and only one port exists for the current port name?
>

Another option is restrict direct push to master without PR where CI should
catch such issue.

-- 
wbr, Kirill


Re: There should be a requirement to check if a port exists before committing something right into the master

2024-05-31 Thread Herby G
Is it a guarantee that the PortIndex is available to `port` everytime `port
lint` is run? If so, would it be possible for us to use the port index to
verify that one and only one port exists for the current port name?

On Fri, May 31, 2024 at 8:35 AM Joshua Root  wrote:

> On 31/5/2024 21:22, Sergio Had wrote:
> > Otherwise we get this:
> >
> https://github.com/macports/macports-ports/commit/6e2c1e19a4ffce5d59a9cdf8147022ad176dffed
> <
> https://github.com/macports/macports-ports/commit/6e2c1e19a4ffce5d59a9cdf8147022ad176dffed
> >
> >
> > While LimeChat has existed for 4 years in MacPorts:
> >
> https://github.com/macports/macports-ports/commits/8c30b0e9fd88d94c115b38c92809b909c4eac9aa/aqua/LimeChat/Portfile
> <
> https://github.com/macports/macports-ports/commits/8c30b0e9fd88d94c115b38c92809b909c4eac9aa/aqua/LimeChat/Portfile
> >
> >
> > And now two conflicting ports for the same thing.
>
> I greatly doubt that this (or any other addition of a duplicate port)
> was deliberate, so having a specific rule against it wouldn't have
> changed anything. Yes, it's a problem that needs to be fixed.
>
> - Josh
>


Re: There should be a requirement to check if a port exists before committing something right into the master

2024-05-31 Thread Joshua Root

On 31/5/2024 21:22, Sergio Had wrote:
Otherwise we get this: 
https://github.com/macports/macports-ports/commit/6e2c1e19a4ffce5d59a9cdf8147022ad176dffed 


While LimeChat has existed for 4 years in MacPorts: 
https://github.com/macports/macports-ports/commits/8c30b0e9fd88d94c115b38c92809b909c4eac9aa/aqua/LimeChat/Portfile 


And now two conflicting ports for the same thing.


I greatly doubt that this (or any other addition of a duplicate port) 
was deliberate, so having a specific rule against it wouldn't have 
changed anything. Yes, it's a problem that needs to be fixed.


- Josh


There should be a requirement to check if a port exists before committing something right into the master

2024-05-31 Thread Sergio Had
Otherwise we get this: 
https://github.com/macports/macports-ports/commit/6e2c1e19a4ffce5d59a9cdf8147022ad176dffed

While LimeChat has existed for 4 years in MacPorts: 
https://github.com/macports/macports-ports/commits/8c30b0e9fd88d94c115b38c92809b909c4eac9aa/aqua/LimeChat/Portfile

And now two conflicting ports for the same thing.