A stale entry with a lower ping time should be preferred to an entry
with a higher ping time that happens to have been refreshed recently.
So don't decide on status alone if both entries have a time.
CURL_CFLAGS (from curl-config --cflags) was applied globally to all
compiled files. When --with-curlprefix=/opt/local is used, this adds
-I/opt/local/include to every compilation, causing readline.c to pick
up MacPorts' GNU readline headers instead of the system headers that
configure probed against. This mismatch produces a build failure due
to differing readline symbol names (e.g. rl_username_completion_function
vs username_completion_function).
Fix by scoping CURL_CFLAGS, MD5_CFLAGS, and READLINE_CFLAGS to the
object files that actually need them, so each file only sees the
include paths appropriate to its own dependencies.
Fixes: https://trac.macports.org/ticket/57160
The concept of an extract method is introduced, which is a string which
identifies the command and args to be used to extract. The method is
normally determined based on the file extension, but can be overridden
on a per distfile basis by setting extract.methods.
The built-in list of methods have names matching the second part of the
use_* options names, e.g. "bzip2". There is additionally a "gzip"
method for the case where no use_* option is set.
extract.methods should be a valid dict, with each pair of elements
being a distfile name and the method that should be used for it.
Distfiles not present in extract.methods will use a method determined
from their filename. A method that is not in the built-in list will be
assumed to be a proc defined by the Portfile, which takes the path to
a distfile as its argument. This can be used to extract arbitrary new
file formats while still taking advantage of the built-in methods for
other distfiles.
The extract.cmd, extract.pre_args and extract.post_args options are
used when extracting files that use a method matching extract.suffix.
The behaviour thus stays the same for the single distfile case and when
all distfiles in extract.only are of the same type.
Files that do not use the method matching extract.suffix, either
because of their extension or extract.methods, will use an internally
discovered command and args. A custom method can be used if the
defaults are not suitable.
Since the commands and args are now derived from the filename suffixes,
setting the use_* options now simply sets extract.suffix appropriately.
Add livecheck.user_agent to override the HTTP User-Agent for livecheck
requests, mirroring the existing fetch.user_agent option. Also document
both options in portfile.7, where they were previously undocumented.
Fixes: https://trac.macports.org/ticket/64369
The previous chdir()-based implementation held an opendir(".") DIR
handle open at every recursion level. With deeply nested trees (e.g.,
270 levels in darwintrace_readdir_at_maxpathlen), this exceeded the
default file descriptor limit (EMFILE).
Collect directory entry names into a list and close the DIR handle
before recursing, so at most one file descriptor is open at any
recursion depth.
See: https://trac.macports.org/ticket/73697
Drop sed(1) entirely from portbump. Instead, read the Portfile into a
line list and use three new procs for targeted modifications:
- replace_checksums: match hash values as whole words using \y
word-boundary anchors, so a size value like 123 cannot accidentally
clobber a larger value such as 12345; targets only the correct lines
even with multiple subports, conditional branches, or variant-scoped
checksums.
- find_revision_line: two-phase strategy — first check for an inline
revision on the subport declaration line (e.g. llvm pattern), then
fall back to the nearest standalone revision line, excluding lines
inside subport { } blocks when bumping the parent port.
- reset_revision: simple regsub to set revision to 0, preserving
indentation and surrounding text.
Fixes a bug where both_checksums was reset on each distfile iteration,
causing only the last distfile's checksums to be updated in Portfiles
with multiple distfiles (e.g. git with git-manpages and git-htmldocs).
Fixes a bug where already-correct checksums were shown in the
"We will bump these:" output.
Also fixes a bug where patch mode applied file attributes to the
Portfile instead of the patch file.
Removes dead code left over from the sed-based implementation.
Adds comprehensive test suite covering real-world Portfile patterns
(git, go, llvm-16, gradle), including tests for whole-word size
matching, subport blocks with nested braces, multiple distfiles,
partial mismatch, and the no-revision-line code path.
Closes: https://trac.macports.org/ticket/65601
Closes: https://trac.macports.org/ticket/73593
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous implementation built full paths by concatenation, which
failed with ENAMETOOLONG on macOS (PATH_MAX=1024) when cleaning up
deeply nested directories like those in darwintrace_readdir_at_maxpathlen.
Use chdir()/fchdir() to descend into directories instead, keeping all
syscall arguments to single-component relative names. All functions
used are standard POSIX available on OS X 10.5+.
This likely went unnoticed in CI because GitHub Actions runs Linux where
PATH_MAX is 4096.
Replace POSIX.1-2008 *at() functions (fstatat, openat, unlinkat,
fdopendir) with traditional alternatives (lstat, opendir, rmdir,
unlink). The *at() family was introduced in macOS 10.10, so the
previous implementation failed to compile on 10.9 and earlier.
See: https://trac.macports.org/ticket/60818
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>