Bug 283790 - textproc/py-bracex: Version went backwards
Summary: textproc/py-bracex: Version went backwards
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Matthew Seaman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-02 08:19 UTC by Christian Ullrich
Modified: 2025-01-12 19:07 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (matthew)


Attachments
Patch (2.68 KB, patch)
2025-01-02 08:21 UTC, Christian Ullrich
chris: maintainer-approval?
Details | Diff
[patch] textproc/py-bracex - fix definition of both PORTVERSION and DISTVERSION (1.04 KB, patch)
2025-01-11 19:30 UTC, John Hein
jcfyecrayz: maintainer-approval? (matthew)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Ullrich 2025-01-02 08:19:33 UTC
The latest update to textproc/py-bracex changed DISTVERSION from 2.5 to 2.5.post1, which becomes a PORTVERSION of 2.5.p1, and this is less than the previous version:

$ pkg version -t 2.5 2.5.p1
<

Suggested patch attached. It looks fairly ugly because I hit a problem with USES=python where DISTVERSION is used in a number of places. Because overriding both DISTVERSION and PORTVERSION is not permitted, I had to copy the things that use DISTVERSION.
Comment 1 Christian Ullrich 2025-01-02 08:21:49 UTC
Created attachment 256339 [details]
Patch
Comment 2 Matthew Seaman freebsd_committer freebsd_triage 2025-01-02 08:32:20 UTC
Thanks for the report.  I think your patch is a bit too much -- there should be a much simpler solution.  Leave it with me.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-01-02 21:25:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f3a480104b6b787539b4f8990ce432aad506d38b

commit f3a480104b6b787539b4f8990ce432aad506d38b
Author:     Matthew Seaman <matthew@FreeBSD.org>
AuthorDate: 2025-01-02 21:21:58 +0000
Commit:     Matthew Seaman <matthew@FreeBSD.org>
CommitDate: 2025-01-02 21:24:19 +0000

    textproc/py-bracex: fix version going backwards

    Force a pkg version of 2.5p1 because 2.5.p1 is less than 2.5

    PR:     283790

 textproc/py-bracex/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 4 Matthew Seaman freebsd_committer freebsd_triage 2025-01-02 21:26:48 UTC
Thank you very much for the report.  Fixed, thanks!
Comment 5 John Hein 2025-01-08 23:21:22 UTC
When I test with pkg version, I don't get what is described in comment 0...

% pkg version -t 2.5 2.5.p1
>

This is using pkg-1.21.3


Also the fix that was committed triggers an error in 'DEVELOPER' mode (sets a DEV_ERROR in bsd.port.mk):

% locp make extract DEVELOPER=yes
/!\ py311-bracex-2.5p1: Makefile errors /!\

Defining both PORTVERSION and DISTVERSION is wrong, only set one, if necessary,
set DISTNAME

*** Error code 1
Comment 6 Christian Ullrich 2025-01-09 11:39:47 UTC
(In reply to John Hein from comment #5)

> When I test with pkg version, I don't get what is described in comment 0...
> 
> % pkg version -t 2.5 2.5.p1
> >

You get the expected correct result (left is higher), whereas I got it wrong when I neglected to copy the command and its output and instead typed them.
Comment 7 John Hein 2025-01-10 19:52:27 UTC
(In reply to Christian Ullrich from comment #6)
Okay, so it seems the fix committed by matthew@ (comment 3) should be rolled back, and there is no "going backwards" problem after all?
Comment 8 John Hein 2025-01-10 19:56:35 UTC
(In reply to John Hein from comment #7)
Never mind.  Brain problem on my end.

The definition of both PORTVERSION and DISTVERSION is still a problem, however.
Comment 9 John Hein 2025-01-11 19:30:07 UTC
Created attachment 256627 [details]
[patch] textproc/py-bracex - fix definition of both PORTVERSION and DISTVERSION

Here's a patch to address the "violation" of defining both PORTVERSION and DISTVERSION.  Same idea as the fix from comment 3, but just a little different to appease the DEV_ERROR complaint and the ports tree policy.

https://docs.freebsd.org/en/books/porters-handbook/makefiles/#makefile-naming
Comment 10 John Hein 2025-01-12 19:07:31 UTC
(In reply to John Hein from comment #9)
Hmm... that patch (attachment 256627 [details]) doesn't work because Mk/Uses/python.mk explicitly references DISTVERSION for pep517 builds (which is now 2.5p1 and the .whl that is built with 2.5.post1 in the name, so 'make stage' fails).

Without overriding PEP517_INSTALL_CMD and do-install, I don't see any way with the current bsd.port.mk and Uses/python.mk to avoid setting both DISTVERSION and PORTVERSION.

python.mk could add a knob to override the DISTVERSION referenced in PEP517_INSTALL_CMD and the do-install target.  I did that locally, and that works.

Or maybe the ports tree could loosen the restriction and officially allow both PORTVERSION and DISTVERSION if needed.