• Which ports get their PORTVERSION from outside the Makefile

    From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Mon Sep 14 21:00:14 2026
    From Newsgroup: muc.lists.freebsd.ports

    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION). Slave ports are one example, and they are solved: There is a direct link between a slave port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    How can you tell if a port uses PYTHON_DEFAULT? I'm using make -V like this:

    [0:14 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION
    3.12
    3.12

    Now let's set

    [0:15 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION PYTHON_DEFAULT=3.10
    3.10
    3.10

    The values changed... so clearly this port depends on that.

    Repeat for all 39 values. Over all 35313 ports. Takes about 2.5 hours. That's just for initial population of the data. For each commit to a port, that check will be run again to keep the relationships up to date.

    I still have some debugging of that script to do. Some of it is clearly wrong and some ports are missing. They are edge cases. The gist in [1] has the list so far.

    So far, it's a list of 14 ports - I find it ironic that so much code was written and run to find so few ports. And only 7 of the *_DEFAULT values are actually used for PORTVERSION. It's as if we could maintain that list manually (however, that goes against the core values of FreshPorts design).

    Questions:

    - can you think of a better way to do this?
    - what other files hold magic values such as *_DEFAULT

    Thank you.

    1 - list of *_DEFAULT values - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-1-the-default-values-from-bsd-default-versions

    2 - https://github.com/FreshPorts/DefaultVersions/blob/main/populate_port_default_version_deps.py - with much help from Claude

    3 - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-3-port_default_version_variable
    --
    Dan Langille
    dan@langille.org


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Tomoaki AOKI@junchoon@dec.sakura.ne.jp to muc.lists.freebsd.ports on Tue Sep 15 17:59:01 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Mon, 14 Sep 2026 21:00:14 -0400
    "Dan Langille" <dan@langille.org> wrote:

    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION). Slave ports are one example, and they are solved: There is a direct link between a slave port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    How can you tell if a port uses PYTHON_DEFAULT? I'm using make -V like this:

    [0:14 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION
    3.12
    3.12

    Now let's set

    [0:15 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION PYTHON_DEFAULT=3.10
    3.10
    3.10

    The values changed... so clearly this port depends on that.

    Repeat for all 39 values. Over all 35313 ports. Takes about 2.5 hours. That's just for initial population of the data. For each commit to a port, that check will be run again to keep the relationships up to date.

    I still have some debugging of that script to do. Some of it is clearly wrong and some ports are missing. They are edge cases. The gist in [1] has the list so far.

    So far, it's a list of 14 ports - I find it ironic that so much code was written and run to find so few ports. And only 7 of the *_DEFAULT values are actually used for PORTVERSION. It's as if we could maintain that list manually (however, that goes against the core values of FreshPorts design).

    Questions:

    - can you think of a better way to do this?
    - what other files hold magic values such as *_DEFAULT

    Thank you.

    1 - list of *_DEFAULT values - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-1-the-default-values-from-bsd-default-versions

    2 - https://github.com/FreshPorts/DefaultVersions/blob/main/populate_port_default_version_deps.py - with much help from Claude

    3 - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-3-port_default_version_variable

    --
    Dan Langille
    dan@langille.org

    x11/nvidia-driver, x11/nvidia-kmod, x11/linux-nvidia-libs and graphics/nvidia-drm*-kmod includes x11/nvidia-driver/Makefile.version
    from each ports, while all child (aka slave) ports has their own
    DISTVERSION in each Makefile.

    But it could be considerable to have Makefile.version for
    -580 and -devel variants that have corresponding graphics/nvidia-drm*-kmod-{580|devel} to avoid typo in
    any of child pors.

    Note that quick `find` for Makefile.version found 34 results below.

    /usr/ports/devel/electron40/Makefile.version /usr/ports/devel/electron41/Makefile.version /usr/ports/devel/electron42/Makefile.version /usr/ports/devel/electron43/Makefile.version /usr/ports/devel/electron44/Makefile.version /usr/ports/devel/mdds/Makefile.version /usr/ports/editors/vscode/Makefile.version /usr/ports/emulators/linux_base-rl9/Makefile.version /usr/ports/graphics/drm-515-kmod/Makefile.version /usr/ports/graphics/drm-61-kmod/Makefile.version /usr/ports/graphics/drm-612-kmod/Makefile.version /usr/ports/graphics/drm-66-kmod/Makefile.version /usr/ports/graphics/drm-latest-kmod/Makefile.version /usr/ports/lang/gcc6-aux/Makefile.version /usr/ports/lang/python27/Makefile.version /usr/ports/lang/python310/Makefile.version /usr/ports/lang/python311/Makefile.version /usr/ports/lang/python312/Makefile.version /usr/ports/lang/python313/Makefile.version /usr/ports/lang/python314/Makefile.version /usr/ports/lang/python315/Makefile.version /usr/ports/math/rubygem-narray/Makefile.version /usr/ports/math/vtk9/Makefile.version /usr/ports/science/InsightToolkit/Makefile.version /usr/ports/science/paraview/Makefile.version /usr/ports/shells/nushell/Makefile.version /usr/ports/sysutils/usacloud-core/Makefile.version /usr/ports/www/node20/Makefile.version
    /usr/ports/www/node22/Makefile.version
    /usr/ports/www/node24/Makefile.version
    /usr/ports/www/node26/Makefile.version /usr/ports/x11-servers/xlibre-server/Makefile.version /usr/ports/x11/linux-rl9-xorg-libs/Makefile.version /usr/ports/x11/nvidia-driver/Makefile.version


    Regards.
    --
    Tomoaki AOKI <junchoon@dec.sakura.ne.jp>


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hilko Meyer@hilko.meyer@gmx.de to muc.lists.freebsd.ports on Wed Sep 16 00:58:47 2026
    From Newsgroup: muc.lists.freebsd.ports

    "Dan Langille" <dan@langille.org> wrote:
    I'm trying to solve a FreshPorts.org problem: ports which have
    PORTVERSION set by something outside their Makefile (when I say
    PORTVERSION here, I am also considering DISTVERSION). Slave ports are
    one example, and they are solved: There is a direct link between a slave
    port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]
    Maybe I' missing something, but why don't you use something like
    grep -r -l PYTHON_DEFAULT /usr/ports/ --include Makefile | cut -d /
    -f 1-5
    for each *_DEFAULT value and feed the results to the differential make
    -V check?
    Regards
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Wed Sep 16 08:34:17 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Tue, Sep 15, 2026, at 6:58 PM, Hilko Meyer wrote:
    "Dan Langille" <dan@langille.org> wrote:
    I'm trying to solve a FreshPorts.org problem: ports which have
    PORTVERSION set by something outside their Makefile (when I say
    PORTVERSION here, I am also considering DISTVERSION). Slave ports are
    one example, and they are solved: There is a direct link between a slave
    port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile
    PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions),
    refresh lang/python, and any other ports which use PYTHON_DEFAULT for
    PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    Maybe I' missing something, but why don't you use something like

    grep -r -l PYTHON_DEFAULT /usr/ports/ --include Makefile | cut -d /
    -f 1-5

    for each *_DEFAULT value and feed the results to the differential make
    -V check?

    That's a good idea. It certainly reduces the number of `make -V` checks needed. That grep could be expanded too, to something like:

    % grep -rEo --include='Makefile*' --include='*.mk' --exclude-dir=work --exclude-dir=.git '\b[A-Z0-9_]+_DEFAULT\b' /usr/ports | wc -l
    4643

    Which finds 4643 matches.

    I compared the list of ports in my gist aginst that output. I found the following where missing (false negatives):

    databases/py-gdbm - uses PYTHON_DISTVERSION
    databases/py-sqlite3 - same
    lang/python-doc-html - slave port : MASTERDIR= ${.CURDIR}/../python-doc-html lang/python-tools - same
    lang/python-tools - PYTHON_DISTVERSION
    www/node - NODEJS_PORTVERSION
    x11-toolkits/py-tkinter - PYTHON_DISTVERSION

    Any path where the variable reaches PORTVERSION without appearing in that port's Makefile becomes a silent miss. It's the false negatives.

    Yes, we could start adding exceptions and grepping for them all.

    The problem: FreshPorts cannot dictate ports tree standards. It can only try to keep up.

    The stuff already implemented is the easier stuff: PORTVERSION in Makefile.

    The harder stuff (e.g. master & slave ports) came later.

    I'm trying Mk/bsd.default-versions next.

    I'm always open to how to solve this. I don't want to be the only one figuring this out, and
    in isolation. That's a sure way to miss a good idea.

    Thank you.
    --
    Dan Langille
    dan@langille.org


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Hilko Meyer@hilko.meyer@gmx.de to muc.lists.freebsd.ports on Wed Sep 16 15:39:17 2026
    From Newsgroup: muc.lists.freebsd.ports

    On 16.09.2026 14:34, Dan Langille wrote:
    On Tue, Sep 15, 2026, at 6:58 PM, Hilko Meyer wrote:
    "Dan Langille" <dan@langille.org> wrote:
    I'm trying to solve a FreshPorts.org problem: ports which have
    PORTVERSION set by something outside their Makefile (when I say
    PORTVERSION here, I am also considering DISTVERSION). Slave ports are
    one example, and they are solved: There is a direct link between a slave >>> port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile
    PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions),
    refresh lang/python, and any other ports which use PYTHON_DEFAULT for
    PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    Maybe I' missing something, but why don't you use something like

    > grep -r -l PYTHON_DEFAULT /usr/ports/ --include Makefile | cut -d /
    -f 1-5

    for each *_DEFAULT value and feed the results to the differential make
    -V check?

    That's a good idea. It certainly reduces the number of `make -V` checks needed. That grep could be expanded too, to something like:

    % grep -rEo --include='Makefile*' --include='*.mk' --exclude-dir=work --exclude-dir=.git '\b[A-Z0-9_]+_DEFAULT\b' /usr/ports | wc -l
    4643

    Which finds 4643 matches.
    Because it matches OPTIONS_DEFAULT. I tried something similar first and
    got too much false positives. So using the list of *_DEFAULT extracted
    from Mk/bsd.default-versions seemed easier. If you want one single grep instead of one per *_DEFAULT ist could be combined like this:
    grep -rEo --include='Makefile*' --include='*.mk' --exclude-dir=work --exclude-dir=.git '\b(NODEJS|OPENLDAP|PYTHON|PYTHON2|RUBY|SAMBA|SSL|SUDO)+_DEFAULT\b' /usr/ports | sort -u
    And I would exlude /usr/ports/Mk/ too.
    I compared the list of ports in my gist aginst that output. I found the following where missing (false negatives):

    databases/py-gdbm - uses PYTHON_DISTVERSION
    databases/py-sqlite3 - same
    lang/python-doc-html - slave port : MASTERDIR= ${.CURDIR}/../python-doc-html lang/python-tools - same
    lang/python-tools - PYTHON_DISTVERSION
    www/node - NODEJS_PORTVERSION
    x11-toolkits/py-tkinter - PYTHON_DISTVERSION
    Hm, modifying the expression to something like this '\b(NODEJS|OPENLDAP|PYTHON|PYTHON2|RUBY|SAMBA|SSL|SUDO)+_(DEFAULT|DISTVERSION|PORTVERSION)\b'
    will get them.
    Any path where the variable reaches PORTVERSION without appearing in that port's Makefile becomes a silent miss. It's the false negatives.

    Yes, we could start adding exceptions and grepping for them all.
    Well, I did before I completely understood your point. :-)
    The problem: FreshPorts cannot dictate ports tree standards. It can only try to keep up.
    True, but the ports tree standards could be in a way that doesn't make
    it harder for tools like Freshports.
    Bye
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Tatsuki Makino@tatsuki_makino@hotmail.com to muc.lists.freebsd.ports on Thu Sep 17 18:43:37 2026
    From Newsgroup: muc.lists.freebsd.ports

    Hello.

    This will be an approach to unrelated parts, but...
    For example, for the following two commands, in my environment, the time it takes for a response to return is clearly different.

    make -C /usr/ports/multimedia/libopenshot/ -V PORTVERSION -V DISTVERSION
    make -C /usr/ports/multimedia/libopenshot/ -D _INCLUDE_USES_COMPILER_MK -V PORTVERSION -V DISTVERSION

    It seems that the logic of what happens when -D _INCLUDE_USES_COMPILER_MK is added can be understood by looking at Mk/Uses/compiler.mk.
    The dependencies change because the contents are skipped over, but if that does not cause even the version number to change, it is thought that this could become a usable method.

    I apologize if that method has already been adopted :)

    Regards.



    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 07:41:15 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 5:43 AM, Tatsuki Makino wrote:
    Hello.

    This will be an approach to unrelated parts, but...
    For example, for the following two commands, in my environment, the
    time it takes for a response to return is clearly different.

    make -C /usr/ports/multimedia/libopenshot/ -V PORTVERSION -V DISTVERSION
    make -C /usr/ports/multimedia/libopenshot/ -D _INCLUDE_USES_COMPILER_MK
    -V PORTVERSION -V DISTVERSION

    It seems that the logic of what happens when -D
    _INCLUDE_USES_COMPILER_MK is added can be understood by looking at Mk/Uses/compiler.mk.
    The dependencies change because the contents are skipped over, but if
    that does not cause even the version number to change, it is thought
    that this could become a usable method.

    I apologize if that method has already been adopted :)

    I did some time tests, pasted below.

    [11:35 mydev dvl ~] % time make -C /usr/ports/multimedia/libopenshot/ -V PORTVERSION -V DISTVERSION
    1.0.0
    1.0.0
    make -C /usr/ports/multimedia/libopenshot/ -V PORTVERSION -V DISTVERSION 0.42s user 0.21s system 99% cpu 0.637 total


    [11:35 mydev dvl ~] % time make -C /usr/ports/multimedia/libopenshot/ -D _INCLUDE_USES_COMPILER_MK -V PORTVERSION -V DISTVERSION
    1.0.0
    1.0.0
    make -C /usr/ports/multimedia/libopenshot/ -D _INCLUDE_USES_COMPILER_MK -V - 0.05s user 0.02s system 102% cpu 0.067 total


    That's 10% of the first time. That's huge.

    This differences isn't caching. When I repeat, the times are similar:

    [11:38 mydev dvl ~] % time make -C /usr/ports/multimedia/libopenshot/ -D _INCLUDE_USES_COMPILER_MK -V PORTVERSION -V DISTVERSION
    1.0.0
    1.0.0
    make -C /usr/ports/multimedia/libopenshot/ -D _INCLUDE_USES_COMPILER_MK -V - 0.04s user 0.04s system 102% cpu 0.074 total

    [11:38 mydev dvl ~] % time make -C /usr/ports/multimedia/libopenshot/ -V PORTVERSION -V DISTVERSION
    1.0.0
    1.0.0
    make -C /usr/ports/multimedia/libopenshot/ -V PORTVERSION -V DISTVERSION 0.43s user 0.21s system 100% cpu 0.636 total

    Thank you. That is interesting.
    --
    Dan Langille
    dan@langille.org


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 07:59:48 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Wed, Sep 16, 2026, at 9:47 PM, Jamie Landeg-Jones wrote:
    Hilko Meyer <hilko.meyer@gmx.de> wrote:

    The problem: FreshPorts cannot dictate ports tree standards. It can only try to keep up.

    True, but the ports tree standards could be in a way that doesn't make
    it harder for tools like Freshports.

    I have a tool that requires such variables too, and with all the edge cases that kept popping up, I finally gave up, and now have a background job
    that simply does make -V from a sandbox user and caches the results. It automatically fires for updates to a ports Makefile (which I realise could miss some changes), but also runs a complete fresh-run every 4 weeks or so.

    So, some standard way of extracting all port variables without requiring
    make -V would be welcome.

    02:42 (31.0-#C 798) (6) "www" jamie@catflap% getallextattr ~git-mirrors/repos/freebsd-ports/latest/www/w3m/Makefile ________________________________________________________________________________________________________________________________________
    /usr/native/git-mirrors/repos/freebsd-ports/latest/www/w3m/Makefile:
    Thu May 7 22:47:29 BST 2026 : git-mirrors git-mirrors -rw-r--r-- -
    3014 bytes (Namespace: user)

    port.comment : Pager/text-based WWW browser
    port.flavors :
    port.license : w3m
    port.maintainer : nobutaka@FreeBSD.org
    port.version : 0.5.6 (PKG: 0.5.6_1)
    Is the above, this: port.version : ${PORTVERSION} (PKG: ${PORTVERSION}_${PORTREVISION})
    port.www : https://git.sr.ht/~rkta/w3m ________________________________________________________________________________________________________________________________________
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 08:25:21 2026
    From Newsgroup: muc.lists.freebsd.ports


    On Mon, Sep 14, 2026, at 9:00 PM, Dan Langille wrote:
    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have
    PORTVERSION set by something outside their Makefile (when I say
    PORTVERSION here, I am also considering DISTVERSION). Slave ports are
    one example, and they are solved: There is a direct link between a
    slave port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer
    to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions
    - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a
    first draft of that. [2]

    How can you tell if a port uses PYTHON_DEFAULT? I'm using make -V like this:

    [0:14 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V
    PORTVERSION -V DISTVERSION
    3.12
    3.12

    Now let's set

    [0:15 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V
    PORTVERSION -V DISTVERSION PYTHON_DEFAULT=3.10
    3.10
    3.10

    The values changed... so clearly this port depends on that.

    Repeat for all 39 values. Over all 35313 ports. Takes about 2.5 hours. That's just for initial population of the data. For each commit to a
    port, that check will be run again to keep the relationships up to date.

    I still have some debugging of that script to do. Some of it is clearly wrong and some ports are missing. They are edge cases. The gist in [1]
    has the list so far.

    So far, it's a list of 14 ports - I find it ironic that so much code
    was written and run to find so few ports. And only 7 of the *_DEFAULT
    values are actually used for PORTVERSION. It's as if we could maintain
    that list manually (however, that goes against the core values of
    FreshPorts design).

    Questions:

    - can you think of a better way to do this?
    - what other files hold magic values such as *_DEFAULT

    Thank you.

    1 - list of *_DEFAULT values - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-1-the-default-values-from-bsd-default-versions

    2 - https://github.com/FreshPorts/DefaultVersions/blob/main/populate_port_default_version_deps.py
    - with much help from Claude

    3 - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-3-port_default_version_variable

    While reviewing https://github.com/FreshPorts/freshports/issues/596 I realized there is more to this than just PORTVERSION. This affects all DEPENDS variables as well. See this example from that issue:

    [12:24 mydev dvl ~] % make -C /usr/ports/archivers/R-cran-zip -V BUILD_DEPENDS
    R-cran-cli>=0:devel/R-cran-cli /usr/local/bin/R:math/R gfortran14:lang/gcc14 /usr/local/bin/as:devel/binutils


    [12:24 mydev dvl ~] % make -C /usr/ports/archivers/R-cran-zip -V BUILD_DEPENDS GCC_DEFAULT=1
    R-cran-cli>=0:devel/R-cran-cli /usr/local/bin/R:math/R gfortran1:lang/gcc1 /usr/local/bin/as:devel/binutils

    This proves the BUILD_DEPENDS for archivers/R-cran-zip depends upon the value of GCC_DEFAULT.

    It also increases the scope of DefatulVersion from PORTVERSION/DISTVERSION to all *_DEPENDS variables.
    --
    Dan Langille
    dan@langille.org


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mathieu Arnold@mat@freebsd.org to muc.lists.freebsd.ports on Thu Sep 17 16:12:50 2026
    From Newsgroup: muc.lists.freebsd.ports


    --yigrz5pz7jnlnsau
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    On Mon, Sep 14, 2026 at 09:00:14PM -0400, Dan Langille wrote:
    - can you think of a better way to do this?
    - what other files hold magic values such as *_DEFAULT

    I can see another way, but asynchronous, you regularly, like every hour
    or so, run make index, or something similar to retrieve the package
    origin, name and version of all ports.

    For each port, you compare the version of the one you have in your
    database, and for each that differ, it means their version is not
    defined in their port, you then run a git bisect from the previous
    commit you did the comparison to the new one, running make -V PKGVERSION
    for each one, and after a few steps, you'll find out which commit
    changed the version, and you can then use that commit to run whatever is usually run when a port is updated.

    --=20
    Mathieu Arnold

    --yigrz5pz7jnlnsau
    Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQITBAABCgB9FiEE9XJBpJetWizkEBUef2IOCp6dQb4FAmqr9WJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY1 NzI0MUE0OTdBRDVBMkNFNDEwMTUxRTdGNjIwRTBBOUU5RDQxQkUACgkQf2IOCp6d Qb5VhgwAxhTj4fu2C5FTOPz952sFlIEPfngxSFoWKpF2xXjCKSwX5v/WBc5xR23W CLJOVsk2LHUi69Tnjm0dOX8QdUbdxAarGBgGychG2nlgDRBI4kpqeDPyAkEx1tUq bSLeH7qUphYXoUhCmRao7n66jUS29+M854qbXQuD+v2dfXAqVKAj5M7LjMKH/cvn k/gURWhM60XRAX3n0H6ViifLiGdzlN0dSnIEk6/M81hzqN9Zr/q2J8mKpJe+uhAq 4X7LT+4FhvOziG3fHRTk0mJBrbQWbg8ifJaOCgW3b4jXAtqvvvmUELMEIEDiFXlm txv6jpMciogsTtYyI0wcesoKaU7Td1CyRFatL49bpiuI+KZeHT3NpfTUE2DsLpc/ IzTDxPFKg2X2rKAsD918wXmHFcF9987OlGEjrDBLhfszsnwIzK2i/cd4y4H/TGlW WfXcoTrzYbpG0ED4j7pVIMajW9IodXZs3+eELVx2eh4zvdRqHSDeMETEsKgk0MpN
    roQMBI1v
    =2YWA
    -----END PGP SIGNATURE-----

    --yigrz5pz7jnlnsau--


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 11:00:55 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 10:12 AM, Mathieu Arnold wrote:
    On Mon, Sep 14, 2026 at 09:00:14PM -0400, Dan Langille wrote:
    - can you think of a better way to do this?
    - what other files hold magic values such as *_DEFAULT

    I can see another way, but asynchronous, you regularly, like every hour
    or so, run make index, or something similar to retrieve the package
    origin, name and version of all ports.

    For each port, you compare the version of the one you have in your
    database, and for each that differ, it means their version is not
    defined in their port, you then run a git bisect from the previous
    commit you did the comparison to the new one, running make -V PKGVERSION
    for each one, and after a few steps, you'll find out which commit
    changed the version, and you can then use that commit to run whatever is usually run when a port is updated.

    That is a very nice idea. Rather eloquent.

    Don't know enough about git bisect and perhaps that answers this race condition:

    The creation of INDEX takes time. By the time it is ready, more commits have occurred and INDEX is already out of date and some PORTVERSION values have changed.

    I need the magic to determine that situation and ignore that situation.
    --
    Dan Langille
    dan@langille.org


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Thierry Thomas@thierry@freebsd.org to muc.lists.freebsd.ports on Thu Sep 17 17:11:13 2026
    From Newsgroup: muc.lists.freebsd.ports

    --wXSCrQodJ5EnWxwq
    Content-Type: text/plain; charset=iso-8859-1
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    Le jeu. 17 sept. 26 =E0 17:00:55 +0200, Dan Langille <dan@langille.org>
    =E9crivait=A0:

    The creation of INDEX takes time. By the time it is ready, more commits h=
    ave
    occurred and INDEX is already out of date and some PORTVERSION values have changed.

    `make fetchindex` is fine.

    Warning: INDEX-i depends on the system version.
    --=20
    Th. Thomas.

    --wXSCrQodJ5EnWxwq
    Content-Type: application/pgp-signature; name=signature.asc

    -----BEGIN PGP SIGNATURE-----

    iQJPBAEBCAA5FiEE5Ta+hThTmdALb6p28cUWs8g1l1MFAmqsAwUbFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwzAAoJEPHFFrPINZdTiAoQAI3/XPUrAYEcef0RRlof qJ6iR+MqageZq235OZawN030X8tOD6lRrtWcUbx//BxontwkYyDx5+DbwS48WfXR gmYDiXzOtVsufjBTVZA2PCar+5cOV9UceUeCmehdod5Tt9sRfyjM/f1/ucDu9ZXp HpPM6SP3HK3y7NaPjgp9Ou9aR3uvt+zvLBAXiaAEkBi6gQIoPjCrIKPzPlhU+3i8 EUPVjLER3aUtRYYobxrzM2soxPEXggrXgtMOJkXQQF1YpchvFbndhXShVAlk4DHn purLnAna4YEUbviS9P3p53A2VNM+grlR2NLuuGREdsRYPOenMgMyYPqxT+v/KFOu KCWaMniKCOLRpMvglpSuAjQEEczhrUiVsg1h2VOaQ04CQYRsvVOO7m7qnB8jAS3s Tfe0jr0kn7aPJk2Lt7INirin0Krmt5th9PsVe/lQi3THNNiHXeB2RtNW0EZOi+WI rigfnnSC+nYB2zXdutUfL6QBMs12fRHW2gX7Caaxp+gaefKQqDdm3tNSdiBTyWhc l8a84kFt0rztwGaqTPWZjvU9JDwjrfjBIT3gQ4hoAGfX60VAkzurV121IHFZgIm2 MI/i2HEM/E42Km5r2mI0rTOan7FOYtkY6Zomit087PqvqEMdZSTA7Sp470tbQ7Nj ov7O1Su3GpTwohomvgBBYXyx
    =JsEh
    -----END PGP SIGNATURE-----

    --wXSCrQodJ5EnWxwq--


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 11:22:24 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 11:11 AM, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org>
    |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have >> occurred and INDEX is already out of date and some PORTVERSION values have >> changed.

    `make fetchindex` is fine.

    Warning: INDEX-i depends on the system version.
    I hope I understand the following correctly.
    That is faster to get the INDEX. I believe the race condition still exists. INDEX is out of date as soon as it is created, unless I can stop FreshPorts commit processing and get an INDEX that is built upon the commits FreshPorts has already processed.
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mathieu Arnold@mat@freebsd.org to muc.lists.freebsd.ports on Thu Sep 17 18:42:39 2026
    From Newsgroup: muc.lists.freebsd.ports


    --a4xzm2wyebrpzkro
    Content-Type: text/plain; charset=iso-8859-1
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 =E0 17:00:55 +0200, Dan Langille <dan@langille.org>
    =E9crivait=A0:
    =20
    The creation of INDEX takes time. By the time it is ready, more commits=
    have
    occurred and INDEX is already out of date and some PORTVERSION values h=
    ave
    changed.
    =20
    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output,
    as it's a previously generated INDEX that was geneated from another
    ports tree.

    --=20
    Mathieu Arnold

    --a4xzm2wyebrpzkro
    Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQITBAABCgB9FiEE9XJBpJetWizkEBUef2IOCp6dQb4FAmqsGH9fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY1 NzI0MUE0OTdBRDVBMkNFNDEwMTUxRTdGNjIwRTBBOUU5RDQxQkUACgkQf2IOCp6d Qb5pUwv/RD0th5NGst6xo0xRZAG4y9cmQ2fOItIFNqGxyxuXd1oYuMUQvdKclfHa MZyvFtBnwr464j5vX4V27crLqFtWzFsi9Au5uDKhI8uVd/KFYQtyq2Dk/9S8Vv8z LvRltj+js4nBbzihZHJX/m1VNe+Da3BV/FxAoyZtEpE/76rkbsENIuZZjBPLaWyg RfNQDkggC2+PjIcHb/vPP4oGOK6I/nEaJHeX2DmnRKnDKDFdoSHyJZoSguEi35q+ iS1TYNhUGVpT3960/04GidC5f19uUuyyhJsXnToC0nKP9yaGGhIvwtjh5GbGSF2e XqNtu9xtosh2yNWupjmAcVvUwDSeASTGp58/BO772hvHjHBt2p/nuWp8U+W5rPaS +CO1G4m+HT9N8jOousLYzf6Yt41UTMHXXpWVIWCu8xcb+SszUzkp/QjUlak0ln7A cGgsHekm9zsvcZLVGSyu0YhyrQB4rN/ogk3zR0G7BHph2CR1Ff9qoB4zc0Axdimz
    73mICUI6
    =MvHk
    -----END PGP SIGNATURE-----

    --a4xzm2wyebrpzkro--


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 13:33:23 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 12:42 PM, Mathieu Arnold wrote:
    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org>
    |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have
    occurred and INDEX is already out of date and some PORTVERSION values have >> > changed.

    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output,
    as it's a previously generated INDEX that was geneated from another
    ports tree.
    That gave me an idea. I ran `make index` in a jail[1]. It took 747 seconds (or 12.5 minutes).
    How does this sound for a strategy?
    * periodic/cronjob inserts a job into the FreshPorts work queue
    * freshports daemon (FPD) processes the queue in order, so commit processing is not going on during that job
    * FPD find the job, notes the time, and launches a background job to `make index` (MI)
    * FPD continues on with the queue
    * ...
    * 12.5 minutes later, as the MI job completes, it inserts a reconcile job into the queue
    * when FPD gets to the reconcile job, it knows the start time associated with the MI
    * FPD compares the INDEX against the database and compiles a list of ports which don't match INDEX
    * any ports with commits after that MI start time are not included in that list * The ports on that list are refreshed from their Makefiles (because more than just PORTVERSION can change) in the usual way that FP handles a commit
    * FPD continues on with the queue
    * ...
    1 - [17:03 mydev dvl /usr/ports] % sudo time make index
    Generating INDEX-15 - please wait..--- describe.accessibility ---
    --- describe.arabic ---
    --- describe.archivers ---
    ...
    --- describe.x11-toolkits ---
    --- describe.x11-wm ---
    Done. 747.38 real 2831.68 user 1706.13 sys
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Jamie Landeg-Jones@jamie@catflap.org to muc.lists.freebsd.ports on Thu Sep 17 20:46:47 2026
    From Newsgroup: muc.lists.freebsd.ports

    "Dan Langille" <dan@langille.org> wrote:

    port.comment : Pager/text-based WWW browser
    port.flavors :
    port.license : w3m
    port.maintainer : nobutaka@FreeBSD.org
    port.version : 0.5.6 (PKG: 0.5.6_1)


    Is the above, this: port.version : ${PORTVERSION} (PKG: ${PORTVERSION}_${PORTREVISION})

    It's currently "$PORTVERSION (PKG: $PKGVERSION)", with the "(PKG ...)" bit
    only displayed if the two are different.

    However, I'll probably be changing that because PORTVERSION without the revision/epoch bits is pointless to display. I'll probably change it to DISTVERSION, and keep them as two distinct entries.

    Cheers, Jamie


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Sep 17 18:01:14 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 1:33 PM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 12:42 PM, Mathieu Arnold wrote:
    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org>
    |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have
    occurred and INDEX is already out of date and some PORTVERSION values have
    changed.

    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output,
    as it's a previously generated INDEX that was geneated from another
    ports tree.

    That gave me an idea. I ran `make index` in a jail[1]. It took 747
    seconds (or 12.5 minutes).

    How does this sound for a strategy?

    * periodic/cronjob inserts a job into the FreshPorts work queue
    * freshports daemon (FPD) processes the queue in order, so commit
    processing is not going on during that job
    * FPD find the job, notes the time, and launches a background job to
    `make index` (MI)
    * FPD continues on with the queue
    * ...
    * 12.5 minutes later, as the MI job completes, it inserts a reconcile
    job into the queue
    * when FPD gets to the reconcile job, it knows the start time
    associated with the MI
    * FPD compares the INDEX against the database and compiles a list of
    ports which don't match INDEX
    * any ports with commits after that MI start time are not included in
    that list
    * The ports on that list are refreshed from their Makefiles (because
    more than just PORTVERSION can change) in the usual way that FP handles
    a commit
    * FPD continues on with the queue
    * ...
    One issue to overcome with INDEX: multiple packages for the same origin.
    If the versions are the same, no issue, but when they differ...
    Which one is correct?
    For example:
    py311-tkinter-3.11.16_11
    py312-tkinter-3.12.14_11
    py313-tkinter-3.13.15_11
    py313t-tkinter-3.13.15_11
    py314-tkinter-3.14.7_11
    py314t-tkinter-3.14.7_11
    py315-tkinter-3.15.0.r2_11
    All from x11-toolkits/py-tkinter
    Which one should FreshPorts choose as the correct one? The existing practice is to use `make -V PORTVERSION`
    This seems to affect only these ports:
    databases/py-gdbm
    databases/py-sqlite3
    devel/libclc
    devel/opencl-clang
    devel/spirv-llvm-translator
    x11-servers/xorg-server
    Full output at https://gist.github.com/dlangille/105f15e6e0c219e1ef0fd747398ae8bf
    Next, I'll load that data into a FreshPorts database, and see what differences I can pull back from a query.
    That's all I have for now. I'll come back to this exercise later.
    Thank you.
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Edward Sanford Sutton, III@mirror176@hotmail.com to muc.lists.freebsd.ports on Thu Sep 17 16:09:00 2026
    From Newsgroup: muc.lists.freebsd.ports

    On 9/14/26 18:00, Dan Langille wrote:
    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION). Slave ports are one example, and they are solved: There is a direct link between a slave port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    How can you tell if a port uses PYTHON_DEFAULT? I'm using make -V like this:

    [0:14 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION
    3.12
    3.12

    Now let's set

    [0:15 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION PYTHON_DEFAULT=3.10
    3.10
    3.10

    The values changed... so clearly this port depends on that.

    Repeat for all 39 values. Over all 35313 ports. Takes about 2.5 hours. That's just for initial population of the data. For each commit to a port, that check will be run again to keep the relationships up to date.

    I still have some debugging of that script to do. Some of it is clearly wrong and some ports are missing. They are edge cases. The gist in [1] has the list so far.

    So far, it's a list of 14 ports - I find it ironic that so much code was written and run to find so few ports. And only 7 of the *_DEFAULT values are actually used for PORTVERSION. It's as if we could maintain that list manually (however, that goes against the core values of FreshPorts design).

    Questions:

    - can you think of a better way to do this?

    I don't know what is better as I didn't finish a full workload to
    this yet but in case it inspires better/faster minds I was thinking
    along the line of...

    You can get raw values with debugging information:

    make -C /usr/ports/lang/python -dV -VPORTVERSION -VDISTVERSION

    That makes it easier to identify the variable contains a reference to another variable but you then need to find where that variable is
    defined. Another debug variable and now we can identify where
    definitions are coming from in terms of filenames but will have a lot
    more noise to sort out.

    make -C /usr/ports/lang/python -dpV -VPKGVERSION 2>debug.txt

    I was not able to use -dFdebug.txt to get it to write output to that
    file and am not sure why.
    This would allow us to avoid running make more than once if we can
    get through the noise and it also makes it so we can tell what is being
    set by external files.
    I assume that freshports would need to both store the value of a
    variable and store the list of files that are involved to set that
    value. By watching for changes to files, you now know which variables
    are impacted by a file being updated. Not sure when it is worth trying
    to manually track when that information changes in the file vs use make
    to recreate values anytime the file gets updated but I'd assume that
    some effort of doing make's job would be lighter on load. Alternatively,
    you could save some runs if you can extract select variables such as
    from Mk/bsd.default-versions.mk so that instead of having to rerun make
    for every use of a variable from it, you could get the value from one
    run of a variable and use it for all occurrences if you have accurate non-substitution values stored and you tracked what file completes the substitution.

    I was then attempting to use awk to process the debug output contents
    but have kind of given up as awk is not making sense to me. Using an awk script if I put match($4,"}") inside of a print statement I get a number
    of the position 17 if $4=${PYTHON_DEFAULT} but if I try to save it to a variable like

    SubVarStart = match($4,"${")
    SubVarEnd = match($4,"}")

    then I end up with

    SubVarStart='Parsing Makefile:2: PORTVERSION= ${PYTHON_DEFAULT}' SubVarEnd=''

    which is not the equivalent to just printing the match function's output
    nor can I make any sense of what I am logically getting instead. If I
    cannot store the function's output then I cannot use the function as far
    as I am aware of.
    Not sure if awk was the right tool for the job or if it would get it
    done alone or in how many passes but I assumed it would become much more efficient to do text processing on a make run's debug output to both get
    more details like the file that defines a variable and be able to walk
    through subvariables at much higher speed.
    For anyone trying to build off of this, $2 collects /path/file.name:linenumber: , $3 collects VARIABLE (characters to set it
    vary: '=', ':=', '?=' and $4 collects the value of the variable. I'd
    guess $5+ may be relevant when looking at other things like variables containing dependencies but I never went there yet.

    - what other files hold magic values such as *_DEFAULT

    It was already brought up in this thread that there is a wider issue
    of external values being used to do more than set a port's version. That
    is why I was trying to approach it by collecting information about a
    variable being defined against another variable, and then try to collect
    where that variable comes from.

    Thank you.

    1 - list of *_DEFAULT values - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-1-the-default-values-from-bsd-default-versions

    2 - https://github.com/FreshPorts/DefaultVersions/blob/main/populate_port_default_version_deps.py - with much help from Claude

    3 - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-3-port_default_version_variable




    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Fri Sep 18 08:09:02 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 6:57 PM, Tomoaki AOKI wrote:
    On Thu, 17 Sep 2026 18:01:14 -0400
    "Dan Langille" <dan@langille.org> wrote:

    On Thu, Sep 17, 2026, at 1:33 PM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 12:42 PM, Mathieu Arnold wrote:
    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org> >> >>> |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have
    occurred and INDEX is already out of date and some PORTVERSION values have
    changed.

    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output,
    as it's a previously generated INDEX that was geneated from another
    ports tree.

    That gave me an idea. I ran `make index` in a jail[1]. It took 747
    seconds (or 12.5 minutes).

    How does this sound for a strategy?

    * periodic/cronjob inserts a job into the FreshPorts work queue
    * freshports daemon (FPD) processes the queue in order, so commit
    processing is not going on during that job
    * FPD find the job, notes the time, and launches a background job to
    `make index` (MI)
    * FPD continues on with the queue
    * ...
    * 12.5 minutes later, as the MI job completes, it inserts a reconcile
    job into the queue
    * when FPD gets to the reconcile job, it knows the start time
    associated with the MI
    * FPD compares the INDEX against the database and compiles a list of
    ports which don't match INDEX
    * any ports with commits after that MI start time are not included in
    that list
    * The ports on that list are refreshed from their Makefiles (because
    more than just PORTVERSION can change) in the usual way that FP handles >> > a commit
    * FPD continues on with the queue
    * ...

    One issue to overcome with INDEX: multiple packages for the same origin.

    If the versions are the same, no issue, but when they differ...

    Which one is correct?

    For example:

    py311-tkinter-3.11.16_11
    py312-tkinter-3.12.14_11
    py313-tkinter-3.13.15_11
    py313t-tkinter-3.13.15_11
    py314-tkinter-3.14.7_11
    py314t-tkinter-3.14.7_11
    py315-tkinter-3.15.0.r2_11

    All from x11-toolkits/py-tkinter

    Which one should FreshPorts choose as the correct one? The existing practice is to use `make -V PORTVERSION`

    This seems to affect only these ports:

    databases/py-gdbm
    databases/py-sqlite3
    devel/libclc
    devel/opencl-clang
    devel/spirv-llvm-translator
    x11-servers/xorg-server

    Full output at https://gist.github.com/dlangille/105f15e6e0c219e1ef0fd747398ae8bf

    Next, I'll load that data into a FreshPorts database, and see what differences I can pull back from a query.

    That's all I have for now. I'll come back to this exercise later.

    Thank you.

    --
    Dan Langille
    dan@langille.org

    It would be depending on FLAVORs.
    IIRC, when mail/claws-mail still had GTK2 flavor, versions for
    GTK2 was 3.*, while (currently remaining unflavored) GTK3 has 4.*.

    So choosing for default flavor may be preferrable.
    Can the default flavor be identified in INDEX?
    I also just realized, I don't think it matters. If a difference is found, FreshPorts (FP) needs to refresh the port from the repo. It will not be taking the PORTVERSION from INDEX. All FP needs to do is notice a difference between the database and INDEX. That will initiate the refresh.
    This will lead to some ports being frequently refreshed. However, I expect this job to run daily, not hourly. Those perhaps-unnecessary refreshes are not a huge burden.
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Fri Sep 18 08:37:32 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 7:09 PM, Edward Sanford Sutton, III wrote:
    On 9/14/26 18:00, Dan Langille wrote:
    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION). Slave ports are one example, and they are solved: There is a direct link between a slave port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile
    PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    How can you tell if a port uses PYTHON_DEFAULT? I'm using make -V like this: >>
    [0:14 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION
    3.12
    3.12

    Now let's set

    [0:15 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION PYTHON_DEFAULT=3.10
    3.10
    3.10

    The values changed... so clearly this port depends on that.

    Repeat for all 39 values. Over all 35313 ports. Takes about 2.5 hours. That's just for initial population of the data. For each commit to a port, that check will be run again to keep the relationships up to date.

    I still have some debugging of that script to do. Some of it is clearly wrong and some ports are missing. They are edge cases. The gist in [1] has the list so far.

    So far, it's a list of 14 ports - I find it ironic that so much code was written and run to find so few ports. And only 7 of the *_DEFAULT values are actually used for PORTVERSION. It's as if we could maintain that list manually (however, that goes against the core values of FreshPorts design).

    Questions:

    - can you think of a better way to do this?

    I don't know what is better as I didn't finish a full workload to
    this yet but in case it inspires better/faster minds I was thinking
    along the line of...

    You can get raw values with debugging information:

    make -C /usr/ports/lang/python -dV -VPORTVERSION -VDISTVERSION

    Oh wow. For those following along at home:

    [12:01 mydev dvl /usr/ports/sysutils/samdruckerclientshell] % make -C /usr/ports/lang/python -dV -VPORTVERSION -VDISTVERSION
    ${PYTHON_DEFAULT}
    ${PORTVERSION:S/:/::/g}

    That makes it easier to identify the variable contains a reference to another variable but you then need to find where that variable is
    defined. Another debug variable and now we can identify where
    definitions are coming from in terms of filenames but will have a lot
    more noise to sort out.

    make -C /usr/ports/lang/python -dpV -VPKGVERSION 2>debug.txt

    I was not able to use -dFdebug.txt to get it to write output to that
    file and am not sure why.
    This would allow us to avoid running make more than once if we can
    get through the noise and it also makes it so we can tell what is being
    set by external files.
    I assume that freshports would need to both store the value of a
    variable and store the list of files that are involved to set that
    value.

    That sounds reasonable.

    By watching for changes to files, you now know which variables
    are impacted by a file being updated. Not sure when it is worth trying
    to manually track when that information changes in the file vs use make
    to recreate values anytime the file gets updated but I'd assume that
    some effort of doing make's job would be lighter on load.

    FreshPorts always wants to use make to extract data. It seems the only
    way to ensure it has accurate information.

    Alternatively,
    you could save some runs if you can extract select variables such as
    from Mk/bsd.default-versions.mk so that instead of having to rerun make
    for every use of a variable from it, you could get the value from one
    run of a variable and use it for all occurrences if you have accurate non-substitution values stored and you tracked what file completes the substitution.

    That might miss other uses of that variable with the port. I'd really
    want to run a full refrence

    I was then attempting to use awk to process the debug output contents
    but have kind of given up as awk is not making sense to me. Using an awk script if I put match($4,"}") inside of a print statement I get a number
    of the position 17 if $4=${PYTHON_DEFAULT} but if I try to save it to a variable like

    SubVarStart = match($4,"${")
    SubVarEnd = match($4,"}")

    then I end up with

    SubVarStart='Parsing Makefile:2: PORTVERSION= ${PYTHON_DEFAULT}' SubVarEnd=''

    which is not the equivalent to just printing the match function's output
    nor can I make any sense of what I am logically getting instead. If I
    cannot store the function's output then I cannot use the function as far
    as I am aware of.
    Not sure if awk was the right tool for the job or if it would get it
    done alone or in how many passes but I assumed it would become much more efficient to do text processing on a make run's debug output to both get more details like the file that defines a variable and be able to walk through subvariables at much higher speed.
    For anyone trying to build off of this, $2 collects /path/file.name:linenumber: , $3 collects VARIABLE (characters to set it vary: '=', ':=', '?=' and $4 collects the value of the variable. I'd
    guess $5+ may be relevant when looking at other things like variables containing dependencies but I never went there yet.

    That overloads my brain so early in the morning. I can't imagine how to
    do that yet.

    - what other files hold magic values such as *_DEFAULT

    It was already brought up in this thread that there is a wider issue
    of external values being used to do more than set a port's version. That
    is why I was trying to approach it by collecting information about a variable being defined against another variable, and then try to collect where that variable comes from.

    That seems to be the main block for this problem: What affects what?

    I am still pursuing the "`make index` then compare against the DB" proposal. That may be a simple solution.


    Thank you.

    1 - list of *_DEFAULT values - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-1-the-default-values-from-bsd-default-versions

    2 - https://github.com/FreshPorts/DefaultVersions/blob/main/populate_port_default_version_deps.py - with much help from Claude

    3 - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-3-port_default_version_variable

    --
    Dan Langille
    dan@langille.org


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Fri Sep 18 08:44:44 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 6:38 PM, Tomoaki AOKI wrote:
    On Thu, 17 Sep 2026 13:33:23 -0400
    "Dan Langille" <dan@langille.org> wrote:

    On Thu, Sep 17, 2026, at 12:42 PM, Mathieu Arnold wrote:
    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org>
    |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have
    occurred and INDEX is already out of date and some PORTVERSION values have
    changed.

    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output,
    as it's a previously generated INDEX that was geneated from another
    ports tree.

    That gave me an idea. I ran `make index` in a jail[1]. It took 747 seconds (or 12.5 minutes).

    How does this sound for a strategy?

    * periodic/cronjob inserts a job into the FreshPorts work queue
    * freshports daemon (FPD) processes the queue in order, so commit processing is not going on during that job
    * FPD find the job, notes the time, and launches a background job to `make index` (MI)
    * FPD continues on with the queue
    * ...
    * 12.5 minutes later, as the MI job completes, it inserts a reconcile job into the queue
    * when FPD gets to the reconcile job, it knows the start time associated with the MI
    * FPD compares the INDEX against the database and compiles a list of ports which don't match INDEX
    * any ports with commits after that MI start time are not included in that list
    * The ports on that list are refreshed from their Makefiles (because more than just PORTVERSION can change) in the usual way that FP handles a commit
    * FPD continues on with the queue
    * ...


    1 - [17:03 mydev dvl /usr/ports] % sudo time make index
    Generating INDEX-15 - please wait..--- describe.accessibility ---
    --- describe.arabic ---
    --- describe.archivers ---
    ...
    --- describe.x11-toolkits ---
    --- describe.x11-wm ---
    Done. 747.38 real 2831.68 user 1706.13 sys

    --
    Dan Langille
    dan@langille.org

    IIUC, `make index` recursively runs `make describe`
    per ALL ports, thus, take a long time.
    I did not know.
    And IIUC, FreshPorts updates information (thanks!) per commit
    basis.
    Yes. (my pleasure)
    So, is it considerable to store the output of `make describe`
    for ports affected by the commit (i.e., store into same
    directory structure under different ports top directory,
    or store into any database of your choice)?

    If you want json format instead, you can use `make describe-json`.
    What goal did you have in mind for that output? Did you see a way
    this can be used for the `make index` problem? Is that for public use,
    say through an API?
    Thank you.
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Gleb Popov@arrowd@freebsd.org to muc.lists.freebsd.ports on Fri Sep 18 16:30:51 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Tue, Sep 15, 2026 at 4:01rC>AM Dan Langille <dan@langille.org> wrote:

    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION).
    How about checking TIMESTAMP in the distinfo file? I can't imagine a
    version bump without touching distinfo.
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Fri Sep 18 10:56:58 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Fri, Sep 18, 2026, at 9:30 AM, Gleb Popov wrote:
    On Tue, Sep 15, 2026 at 4:01rC>AM Dan Langille <dan@langille.org> wrote:

    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION).

    How about checking TIMESTAMP in the distinfo file? I can't imagine a
    version bump without touching distinfo.
    Commits get version bumps without files in their directory being touched. lang/python is the best example.
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Edward Sanford Sutton, III@mirror176@hotmail.com to muc.lists.freebsd.ports on Fri Sep 18 13:13:11 2026
    From Newsgroup: muc.lists.freebsd.ports

    On 9/18/26 05:37, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 7:09 PM, Edward Sanford Sutton, III wrote:
    On 9/14/26 18:00, Dan Langille wrote:
    Hello,

    I'm trying to solve a FreshPorts.org problem: ports which have PORTVERSION set by something outside their Makefile (when I say PORTVERSION here, I am also considering DISTVERSION). Slave ports are one example, and they are solved: There is a direct link between a slave port and the master port.

    The problem at hand is Mk/bsd.default-versions

    I'm posting my approach for sharing and for peer review.

    Use lang/ports as an example.

    [0:15 mydev dvl /usr/ports/lang/python] % grep PORTVERSION Makefile
    PORTVERSION= ${PYTHON_DEFAULT}

    PYTHON_DEFAULT is defined within Mk/bsd.default-versions - I will refer to those magic values as *_DEFAULT.

    My goal: when PYTHON_DEFAULT is modified (in Mk/bsd.default-versions), refresh lang/python, and any other ports which use PYTHON_DEFAULT for PORTVERSION.

    First step: get a list of *_DEFAULT values from Mk/bsd.default-versions - that's done. [1]

    Next: get a list of ports which use those *_DEFAULT values - I have a first draft of that. [2]

    How can you tell if a port uses PYTHON_DEFAULT? I'm using make -V like this:

    [0:14 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION
    3.12
    3.12

    Now let's set

    [0:15 mydev dvl /usr/ports] % make -C /usr/ports/lang/python -V PORTVERSION -V DISTVERSION PYTHON_DEFAULT=3.10
    3.10
    3.10

    The values changed... so clearly this port depends on that.

    Repeat for all 39 values. Over all 35313 ports. Takes about 2.5 hours. That's just for initial population of the data. For each commit to a port, that check will be run again to keep the relationships up to date.

    I still have some debugging of that script to do. Some of it is clearly wrong and some ports are missing. They are edge cases. The gist in [1] has the list so far.

    So far, it's a list of 14 ports - I find it ironic that so much code was written and run to find so few ports. And only 7 of the *_DEFAULT values are actually used for PORTVERSION. It's as if we could maintain that list manually (however, that goes against the core values of FreshPorts design).

    Questions:

    - can you think of a better way to do this?

    I don't know what is better as I didn't finish a full workload to
    this yet but in case it inspires better/faster minds I was thinking
    along the line of...

    You can get raw values with debugging information:

    make -C /usr/ports/lang/python -dV -VPORTVERSION -VDISTVERSION

    Oh wow. For those following along at home:

    [12:01 mydev dvl /usr/ports/sysutils/samdruckerclientshell] % make -C /usr/ports/lang/python -dV -VPORTVERSION -VDISTVERSION
    ${PYTHON_DEFAULT}
    ${PORTVERSION:S/:/::/g}

    PYTHON_DEFAULT is a simple one to process as you can take it as is. I
    don't know of a way to process the non-variable PORTVERSION parts on the command line but maybe a bunch of special cases could be written to
    'properly' do that part. Even without such a proper thing these steps
    could check if PORTVERSION contains a variable itself and blindly grab
    any variables and check if they contain variables, ... recursion \o/
    The case you brought up and many like it likely just care about
    following 1 variable inside a variable, but there are variables that are
    set to a collection of variables like PKGVERSION. If we care to verify
    their contents then we need to more carefully extract + process the
    chain of variables. We won't want to ignore such scenarios because this
    is relevant to process dependency variables properly and maybe other
    things, but once we get this basic case working then we could more
    easily expand it to those other cases.
    The debug log I mention below is the only way I know to associate a variable to the file that sets it and knowing the file from there tells
    us which additional files we 'generally' need to keep watch on to know
    its time to refresh that variable.
    If anyone knows how to request variable modifiers be processed on the command line into a final but intermediate result that would be helpful. Likewise if anyone knows how to request what file(s) set a variable
    without parsing the log then I'd be interested to know.

    That makes it easier to identify the variable contains a reference to
    another variable but you then need to find where that variable is
    defined. Another debug variable and now we can identify where
    definitions are coming from in terms of filenames but will have a lot
    more noise to sort out.

    make -C /usr/ports/lang/python -dpV -VPKGVERSION 2>debug.txt

    I was not able to use -dFdebug.txt to get it to write output to that
    file and am not sure why.
    This would allow us to avoid running make more than once if we can
    get through the noise and it also makes it so we can tell what is being
    set by external files.
    I assume that freshports would need to both store the value of a
    variable and store the list of files that are involved to set that
    value.

    Correcting myself, I think -dF was likely working and I was doing
    something else wrong at the time.

    That sounds reasonable.

    By watching for changes to files, you now know which variables
    are impacted by a file being updated. Not sure when it is worth trying
    to manually track when that information changes in the file vs use make
    to recreate values anytime the file gets updated but I'd assume that
    some effort of doing make's job would be lighter on load.

    FreshPorts always wants to use make to extract data. It seems the only
    way to ensure it has accurate information.

    Even with several recursive runs to populate desired variables
    details on suspected changes, I think we would still be ahead of what we
    would get by doing some of the much larger sweeps. If we store a list of variables that previously needed expansion then we should be able to
    request them all in one make run for a port and could manually iterate
    through them to look for any changes midway; a variable being changed
    from defined by another variable to becoming static could be set and any variable chain from a previous run is discarded after this variable but
    if its altered then we would begin to need a chain of runs or do some
    log reading to get the new chain properly noted from that point.
    If we want to know which files gave us which variables, the only way
    I know to connect that is by reading the log; we get it from make
    generating it which gives us that accuracy but we have to tear the log
    apart a bit to get our desired piece.
    At least for simple things with widespread use, we could skip full
    make runs of many ports if we know what variable becomes a new value, so
    a change in default python can have the variable updated to all
    consumers once 1 make run extracts the new default value or less if we manually do it, but 1 run isn't bad and gets us an official make
    generated answer.

    Alternatively,
    you could save some runs if you can extract select variables such as
    from Mk/bsd.default-versions.mk so that instead of having to rerun make
    for every use of a variable from it, you could get the value from one
    run of a variable and use it for all occurrences if you have accurate
    non-substitution values stored and you tracked what file completes the
    substitution.

    That might miss other uses of that variable with the port. I'd really
    want to run a full refrence

    We 'could' do the full run, but if you saved the whole trail until
    you know that "PYTHON_DEFAULT?=" in Mk/bsd.default-versions.mk set it
    across a number of ports and you already ran any make command to update
    to get a new "PYTHON_DEFAULT?=" value from that file, I'd assume little
    issue is left. Maybe ports would set the new value, and use logic
    elsewhere inside the port to override it if its a certain value but I'd
    need to run a test to see if we could be hitting that as a problem. At
    least we would be at the point where we know which few ports need their
    full reference rebuilt.

    I was then attempting to use awk to process the debug output contents
    but have kind of given up as awk is not making sense to me. Using an awk
    script if I put match($4,"}") inside of a print statement I get a number
    of the position 17 if $4=${PYTHON_DEFAULT} but if I try to save it to a
    variable like

    SubVarStart = match($4,"${")
    SubVarEnd = match($4,"}")

    then I end up with

    SubVarStart='Parsing Makefile:2: PORTVERSION= ${PYTHON_DEFAULT}'
    SubVarEnd=''

    which is not the equivalent to just printing the match function's output
    nor can I make any sense of what I am logically getting instead. If I
    cannot store the function's output then I cannot use the function as far
    as I am aware of.
    Not sure if awk was the right tool for the job or if it would get it
    done alone or in how many passes but I assumed it would become much more
    efficient to do text processing on a make run's debug output to both get
    more details like the file that defines a variable and be able to walk
    through subvariables at much higher speed.
    For anyone trying to build off of this, $2 collects
    /path/file.name:linenumber: , $3 collects VARIABLE (characters to set it
    vary: '=', ':=', '?=' and $4 collects the value of the variable. I'd
    guess $5+ may be relevant when looking at other things like variables
    containing dependencies but I never went there yet.

    That overloads my brain so early in the morning. I can't imagine how to
    do that yet.

    It was me planning to find variable defining lines, extract variables values from it, and extract the filename from it. I didn't complete it
    but could share + explain what little I had in a start; figured others
    are better at the tooling than I am. Using whatever tools to do the task
    is fine though.

    - what other files hold magic values such as *_DEFAULT

    It was already brought up in this thread that there is a wider issue
    of external values being used to do more than set a port's version. That
    is why I was trying to approach it by collecting information about a
    variable being defined against another variable, and then try to collect
    where that variable comes from.

    That seems to be the main block for this problem: What affects what?

    I am still pursuing the "`make index` then compare against the DB" proposal. That may be a simple solution.

    A full make index should get toward accurate answers but the full run should also be overkill for something like a python revision bump. My understanding is occasionally manual intervention took place to force a
    more thorough collection of details to fix such occurrences but that
    this discussion is to try to identify when it needs to happen so that it
    can automatically happen. If we fix this by associating a variable to a
    list of files that impacted its value then we know which files we have
    to watch. Such effort should also solve all special cases where
    variables come from an external file like Makefile.version or from
    another port's files.
    All of this effort is still susceptible to changes like (just an
    example even if such specific case is best 'not' done this way) if Mk/bsd.port.mk is updated to also include Mk/bsd.defaults_but_new_and_magical.mk and it does other logic like
    setting the variable that bsd.defaults.mk only would set if not already defined. Eventually we would need to identify that changes outside a variable's chain can be impacted and a full blind database generation
    becomes the proper fix.
    If freshports won't have proper results for newer commits until index generation finishes but will continue trying to shower newer commits
    values, it may be good to mark the externally dependent values with a
    warning that they are being refreshed when such a job runs.
    I'd be interested to know how long a full make index takes to run +
    extract what you want from it vs how long a full database regeneration otherwise takes to extract the current tree's details from scratch
    without this new work.


    Thank you.

    1 - list of *_DEFAULT values - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-1-the-default-values-from-bsd-default-versions

    2 - https://github.com/FreshPorts/DefaultVersions/blob/main/populate_port_default_version_deps.py - with much help from Claude

    3 - https://gist.github.com/dlangille/fec174122c9c8fe4be892de8021710ad#file-3-port_default_version_variable





    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Wed Sep 23 10:44:41 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Thu, Sep 17, 2026, at 6:01 PM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 1:33 PM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 12:42 PM, Mathieu Arnold wrote:
    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org> >>>> |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have
    occurred and INDEX is already out of date and some PORTVERSION values have
    changed.

    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output,
    as it's a previously generated INDEX that was geneated from another
    ports tree.

    That gave me an idea. I ran `make index` in a jail[1]. It took 747
    seconds (or 12.5 minutes).

    How does this sound for a strategy?

    * periodic/cronjob inserts a job into the FreshPorts work queue
    * freshports daemon (FPD) processes the queue in order, so commit
    processing is not going on during that job
    * FPD find the job, notes the time, and launches a background job to
    `make index` (MI)
    * FPD continues on with the queue
    * ...
    * 12.5 minutes later, as the MI job completes, it inserts a reconcile
    job into the queue
    * when FPD gets to the reconcile job, it knows the start time
    associated with the MI
    * FPD compares the INDEX against the database and compiles a list of
    ports which don't match INDEX
    * any ports with commits after that MI start time are not included in
    that list
    * The ports on that list are refreshed from their Makefiles (because
    more than just PORTVERSION can change) in the usual way that FP handles
    a commit
    * FPD continues on with the queue
    * ...

    One issue to overcome with INDEX: multiple packages for the same origin.

    If the versions are the same, no issue, but when they differ...

    Which one is correct?

    For example:

    py311-tkinter-3.11.16_11
    py312-tkinter-3.12.14_11
    py313-tkinter-3.13.15_11
    py313t-tkinter-3.13.15_11
    py314-tkinter-3.14.7_11
    py314t-tkinter-3.14.7_11
    py315-tkinter-3.15.0.r2_11

    All from x11-toolkits/py-tkinter

    Which one should FreshPorts choose as the correct one? The existing practice is to use `make -V PORTVERSION`

    This seems to affect only these ports:

    databases/py-gdbm
    databases/py-sqlite3
    devel/libclc
    devel/opencl-clang
    devel/spirv-llvm-translator
    x11-servers/xorg-server

    Full output at https://gist.github.com/dlangille/105f15e6e0c219e1ef0fd747398ae8bf

    Next, I'll load that data into a FreshPorts database, and see what differences I can pull back from a query.

    That's all I have for now. I'll come back to this exercise later.
    An update...
    I have a script which compares INDEX against the FreshPorts database. Once fetched[1], it takes about 17 seconds to produce a list of ports which will be refreshed.
    Partial output is shown here. I have not checked the list. However, I have confirmed accessibility/kdeaccessibility needs a refresh[2]. The full output is in a gist[3].
    Next tasks:
    * refresh the ports in refresh.txt
    * rerun the script - refresh.txt should then be empty
    Thank you
    $ time ./compare-index.sh
    ./compare-index.sh: comparing against /jails/freshports/usr/ports/INDEX-15 index_pkgversions.py: 38851 rows, 35205 origins, 0 malformed lines ./compare-index.sh: 38851 packages read from the INDEX
    ./compare-index.sh: 38851 rows loaded and compared
    144 /var/db/freshports/cache/spooling/refresh.txt
    0 /var/db/freshports/cache/spooling/not-in-index.txt
    0 /var/db/freshports/cache/spooling/not-in-freshports.txt
    18.30 real 0.40 user 0.12 sys
    $ cat /var/db/freshports/cache/spooling/refresh.txt accessibility/kdeaccessibility
    audio/pulseaudio-qt
    databases/py-gdbm
    databases/py-sqlite3
    deskutils/kdepim
    devel/boost-docs
    devel/boost-jam
    ...
    x11/nvidia-kmod
    x11/plasma6-plasma
    x11/plasma6-plasma-workspace
    1 - INDEX is fetched rather than built for two main reasons:
    * the repo FreshPorts uses is in a jail. It has no installed packages, and no network access.
    * `make fetchindex` is faster
    2 - https://www.freshports.org/accessibility/kdeaccessibility/ shows 25.08.0 The ports tree shows:
    [14:41 mydev dvl ~] % make -C /usr/ports/accessibility/kdeaccessibility -V PORTVERSION
    26.08.1
    3 - https://gist.github.com/dlangille/74f5de44b4b8534674d45e35e2a0cb24
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Dan Langille@dan@langille.org to muc.lists.freebsd.ports on Thu Oct 1 09:09:53 2026
    From Newsgroup: muc.lists.freebsd.ports

    On Wed, Sep 23, 2026, at 10:44 AM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 6:01 PM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 1:33 PM, Dan Langille wrote:
    On Thu, Sep 17, 2026, at 12:42 PM, Mathieu Arnold wrote:
    On Thu, Sep 17, 2026 at 05:11:13PM +0200, Thierry Thomas wrote:
    Le jeu. 17 sept. 26 |a 17:00:55 +0200, Dan Langille <dan@langille.org> >>>>> |-crivait-a:

    The creation of INDEX takes time. By the time it is ready, more commits have
    occurred and INDEX is already out of date and some PORTVERSION values have
    changed.

    `make fetchindex` is fine.

    Well, it is faster, but it will not be what `make index` would output, >>>> as it's a previously generated INDEX that was geneated from another
    ports tree.

    That gave me an idea. I ran `make index` in a jail[1]. It took 747
    seconds (or 12.5 minutes).

    How does this sound for a strategy?

    * periodic/cronjob inserts a job into the FreshPorts work queue
    * freshports daemon (FPD) processes the queue in order, so commit
    processing is not going on during that job
    * FPD find the job, notes the time, and launches a background job to
    `make index` (MI)
    * FPD continues on with the queue
    * ...
    * 12.5 minutes later, as the MI job completes, it inserts a reconcile
    job into the queue
    * when FPD gets to the reconcile job, it knows the start time
    associated with the MI
    * FPD compares the INDEX against the database and compiles a list of
    ports which don't match INDEX
    * any ports with commits after that MI start time are not included in
    that list
    * The ports on that list are refreshed from their Makefiles (because
    more than just PORTVERSION can change) in the usual way that FP handles >>> a commit
    * FPD continues on with the queue
    * ...

    One issue to overcome with INDEX: multiple packages for the same origin.

    If the versions are the same, no issue, but when they differ...

    Which one is correct?

    For example:

    py311-tkinter-3.11.16_11
    py312-tkinter-3.12.14_11
    py313-tkinter-3.13.15_11
    py313t-tkinter-3.13.15_11
    py314-tkinter-3.14.7_11
    py314t-tkinter-3.14.7_11
    py315-tkinter-3.15.0.r2_11

    All from x11-toolkits/py-tkinter

    Which one should FreshPorts choose as the correct one? The existing
    practice is to use `make -V PORTVERSION`

    This seems to affect only these ports:

    databases/py-gdbm
    databases/py-sqlite3
    devel/libclc
    devel/opencl-clang
    devel/spirv-llvm-translator
    x11-servers/xorg-server

    Full output at
    https://gist.github.com/dlangille/105f15e6e0c219e1ef0fd747398ae8bf

    Next, I'll load that data into a FreshPorts database, and see what
    differences I can pull back from a query.

    That's all I have for now. I'll come back to this exercise later.

    An update...

    I have a script which compares INDEX against the FreshPorts database.
    Once fetched[1], it takes about 17 seconds to produce a list of ports
    which will be refreshed.

    Partial output is shown here. I have not checked the list. However, I
    have confirmed accessibility/kdeaccessibility needs a refresh[2]. The
    full output is in a gist[3].

    Next tasks:

    * refresh the ports in refresh.txt
    * rerun the script - refresh.txt should then be empty

    Thank you

    $ time ./compare-index.sh
    ./compare-index.sh: comparing against /jails/freshports/usr/ports/INDEX-15 index_pkgversions.py: 38851 rows, 35205 origins, 0 malformed lines ./compare-index.sh: 38851 packages read from the INDEX
    ./compare-index.sh: 38851 rows loaded and compared
    144 /var/db/freshports/cache/spooling/refresh.txt
    0 /var/db/freshports/cache/spooling/not-in-index.txt
    0 /var/db/freshports/cache/spooling/not-in-freshports.txt
    18.30 real 0.40 user 0.12 sys
    $ cat /var/db/freshports/cache/spooling/refresh.txt accessibility/kdeaccessibility
    audio/pulseaudio-qt
    databases/py-gdbm
    databases/py-sqlite3
    deskutils/kdepim
    devel/boost-docs
    devel/boost-jam
    ...
    x11/nvidia-kmod
    x11/plasma6-plasma
    x11/plasma6-plasma-workspace

    1 - INDEX is fetched rather than built for two main reasons:

    * the repo FreshPorts uses is in a jail. It has no installed packages,
    and no network access.
    * `make fetchindex` is faster


    2 - https://www.freshports.org/accessibility/kdeaccessibility/ shows 25.08.0

    The ports tree shows:

    [14:41 mydev dvl ~] % make -C /usr/ports/accessibility/kdeaccessibility
    -V PORTVERSION
    26.08.1


    3 - https://gist.github.com/dlangille/74f5de44b4b8534674d45e35e2a0cb24
    So far, I think the code has proven this is feasible. More information than you wish you knew:
    https://news.freshports.org/2026/09/27/using-index-to-find-portversion-deviations/
    To date, this is only on the dev host. It will progress to prod in time.
    --
    Dan Langille
    dan@langille.org
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.22a-Linux NewsLink 1.2