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>
The phase-completion timing messages ("Phase X completed in N seconds")
were too noisy at the default output level. Changed from ui_notice to
ui_info so they only appear when -v (verbose) is passed.
Updated the two affected tests to redirect channels(info) instead of
channels(notice).
See: https://trac.macports.org/ticket/2020
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace darwintrace test setup and cleanup steps that invoke system
binaries under DYLD_INSERT_LIBRARIES.
On macOS 15 arm64 GitHub runners, some Apple binaries used by the
tests are arm64e, while darwintrace.dylib is built with x86_64 and
arm64 slices. Injecting the library into those helpers causes dyld to
abort before the test body runs.
Use Pextlib symlink creation in the affected tests and add a local rmrf
helper for the long-path cleanup case so the suite no longer depends on
traced system ln/rm binaries.
See: https://trac.macports.org/ticket/60818
Adds two related logging improvements to port build output:
- New -T flag prepends an ISO 8601 timestamp (e.g. 2026-03-18T09:42:01-0400)
to every line of terminal output. Timestamps are off by default. The flag is
implemented via a new ui_options(ports_timestamps) option, consistent with
ports_verbose, ports_debug, etc.
- Phase elapsed time is always reported. When a build phase completes,
a notice is emitted showing the phase name and duration in seconds
(e.g. "Phase build completed in 112.034 seconds"). This is implemented
in set_phase, which now tracks phase_start_ms and emits the notice on
each phase transition. A call to set_phase main after eval_targets
ensures the final phase's elapsed time is also reported.
The timestamp format is stored in macports::log_timestamp_format so it
is defined in one place. Tests are added for both features.
Closes: https://trac.macports.org/ticket/2020
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add MP_TOOL_PATH(GIT, [git]) to configure.ac so that users can supply
an alternate git binary via --with-git=PATH at configure time, matching
the pattern used for rsync, openssl, cvs, and other tools.
Fixes: https://trac.macports.org/ticket/72451
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead, clean up the temp files on the main thread after getting the
fetch results. Still deleting on workers in the case of cancellation,
since the whole program may be about to exit when that happens.