[MacPorts] #62748: reinplace -q: Check if replacement is needed before replacing
MacPorts
noreply at macports.org
Sun Apr 25 09:34:34 UTC 2021
#62748: reinplace -q: Check if replacement is needed before replacing
-------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.4
Keywords: | Port:
-------------------------+--------------------
Some ports run `reinplace` over a large set of files, using `fs-traverse`,
when not all of the files need the replacement. They use the `reinplace`
`-q` flag to silence the warning that would otherwise be printed when no
replacement occurs, but it was pointed out in
[63bac4a94759958edb1a995907e1ce7cc599c5d8/macports-ports] that performing
a no-op replacement still takes some time which can add up when there are
many files to process: in that commit, it is claimed that the patch phase
runs 15 times faster by just checking first (with `grep`) whether the file
needs to the replacement before replacing it.
I propose enhancing `reinplace` so that it automatically performs this
check (ideally using native Tcl code, not executing `grep`) when
`reinplace` is called using the `-q` flag.
The slowness of performing no-op replacements probably also partly relates
to the amount of logging that `reinplace` performs, regardless of whether
a replacement happened.
--
Ticket URL: <https://trac.macports.org/ticket/62748>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list