Re: sysutils/logwatch: Need to patch very first line of a script fails, dunno why
"Edward Sanford Sutton, III" <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.ports |
|---|---|
| Message-ID | <SA1PR11MB88113C4983634B94A525DB1FE650A@SA1PR11MB8811.namprd11.prod.outlook.com> |
On 7/18/25 11:48, Michael Grimm wrote:
> Hi,
>
> I am preparing for the upcoming logwatch-7.13 release, and ran into an issue I can't understand.
>
> I do want to patch the logwatch.pl script by providing a 'files/patch-scripts_logwatch.pl' which starts as follows:
>
> --- scripts/logwatch.pl.orig 2025-07-18 18:21:47 UTC
> +++ scripts/logwatch.pl
> @@ -1,4 +1,4 @@
> -#!/usr/bin/perl -w
> +#!/usr/local/bin/perl -w
> use strict;
> ##########################################################################
> ##########################################################################
>
> [followed by 17 other hunks]
>
>
> Using "poudriere testport … sysutils/logwatch" I get:
>
> =======================<phase: patch >============================
> ===== env: DEVELOPER_MODE=yes DEVELOPER=1 STRICT_DEPENDS=yes USER=root UID=0 GID=0
> ===> Patching for logwatch-7.13
> ===> Applying FreeBSD patches for logwatch-7.13 from /usr/ports/sysutils/logwatch/files
> Ignoring previously applied (or reversed) patch.
> 18 out of 18 hunks ignored--saving rejects to scripts/logwatch.pl.rej
> ===> FAILED Applying FreeBSD patch-scripts_logwatch.pl
> ===> FAILED to apply cleanly FreeBSD patch(es) patch-scripts_logwatch.pl
> *** Error code 1
>
> Stop.
>
>
> But: If I do apply that very same patch by 'patch < files/patch-scripts_logwatch.pl' at the appropriate location, all 18 hunks are applied successfully.
>
>
> Can you help me to understand how to fix this?
As a workflow, I copy the file to file.orig, manually patch it, and then
run `make makepatch` in the port's folder to create the patches under
files/ appropriately. You can also use this to compare the result to
your current work.
For this case you should consider replacing a static patch replacement
with a more dynamic replacement if possible (modify as needed):
post-patch:
@${REINPLACE_CMD} -e 's|/usr/bin|${PREFIX}/bin|g'
${WRKSRC}/scripts/logwatch.pl
though in such a particular case there is also the following predesigned
fix which may work:
USES= shebangfix
SHEBANG_FILES= ./scripts/logwatch.pl
this can easily handle multiple files in a port too and has some
additional options described in the porter's handbook.
> Thanks in advance and regards,
> Michael