mikkeloscar / gopkgbuild

A golang package for parsing Arch Linux PKGBUILDs
GNU General Public License v3.0
22 stars 5 forks source link

Export CompleteVersion.cmp, Version.rpmvercmp #21

Closed simon04 closed 6 years ago

simon04 commented 6 years ago

The drawback of CompleteVersion.Older/Newer/Equal is that it needs to parse the other version (given as string) and returns false if it fails to parse. Thus, afterwards one cannot why one of those tests failed.

This PR allows to Compare two previously parsed CompleteVersions with each other.

mikkeloscar commented 6 years ago

@simon04 Thanks for the PR.

I think this is actually exposing a problem in the version API which I think should be fixed by changing the API to take a CompleteVersion for the Older / Newer / Equal methods, rather than exposing the lower level compare API which was intended for internal implementation.

What do you think about that?

simon04 commented 6 years ago

This is fine for me as well. However, it breaks backward compatibility of the API …

On Sun, 13 May 2018, 08:51 Mikkel Oscar Lyderik Larsen, < notifications@github.com> wrote:

@simon04 https://github.com/simon04 Thanks for the PR.

I think this is actually exposing a problem in the version API which I think should be fixed by changing the API to take a CompleteVersion for the Older / Newer / Equal methods, rather than exposing the lower level compare API which was intended for internal implementation.

What do you think about that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mikkeloscar/gopkgbuild/pull/21#issuecomment-388605632, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvwbl0a3huEvfkqTHwL8T01iOmooFl1ks5tx9fwgaJpZM4T3V7j .

mikkeloscar commented 6 years ago

@Morganamilo I think you are one of the biggest consumers of this library, what do you say about breaking the API as discussed here? Would it be a big problem for you?

Morganamilo commented 6 years ago

I don't mind, we mostly just parse srcinfos anyway so little would be effected. There's only one call to .Newer in our codbase as far as I can tell. And even if there were more I don't mind changing stuff.

mikkeloscar commented 6 years ago

Replaced by #23