Date: Sun, 08 Oct 2023 12:16:59 -0400 From: "Dan Langille" <dan@langille.org> To: "Sergey A. Osokin" <osa@freebsd.org>, dvl <dvl@freebsd.org> Cc: ports-committers@freebsd.org, dev-commits-ports-all@freebsd.org, dev-commits-ports-main@freebsd.org Subject: Re: git: 73922d6b363a - main - net-mgmt/librenms: Fix start on FreeBSD 14/nginx Message-ID: <d1a0e113-ebce-4a80-b203-f8844239cf43@app.fastmail.com> In-Reply-To: <ZSLCnqP3gTmzxHEr@FreeBSD.org> References: <202310071152.397BqxAf037182@gitrepo.freebsd.org> <ZSLCnqP3gTmzxHEr@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 8, 2023, at 10:54 AM, Sergey A. Osokin wrote: > Hi Dan, > > On Sat, Oct 07, 2023 at 11:52:59AM +0000, Dan Langille wrote: >> The branch main has been updated by dvl: >> >> URL: https://cgit.FreeBSD.org/ports/commit/?id=73922d6b363a6902a05721d9102386ce657b03d4 >> >> commit 73922d6b363a6902a05721d9102386ce657b03d4 >> Author: Dan Langille <dvl@FreeBSD.org> >> AuthorDate: 2023-10-07 11:49:41 +0000 >> Commit: Dan Langille <dvl@FreeBSD.org> >> CommitDate: 2023-10-07 11:49:41 +0000 >> >> net-mgmt/librenms: Fix start on FreeBSD 14/nginx >> >> This may be a path issue or a shell issue, but nginx on FreeBSD 14 >> is not finding /usr/local/bin/php. The fix: use /usr/local/bin/php >> as we have done with other patches. >> >> +- base = ("/usr/bin/env", "php") >> ++ base = ("/usr/local/bin/php",) > > Would that be better to use %%PREFIX%% in a patch and substitute > that with a value of the ${LOCALBASE} variable in a post-patch > phase? This is a great idea. I know the port is already doing this for other locations in the code. There are other patches which need this adjustment as well. This is my planned (and hand pasted patch, don't trust it): [16:15 pkg01 dan ~/ports/head/net-mgmt/librenms] % git diff diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile index 1b64004a9593..f9a2dd2caa0b 100644 --- a/net-mgmt/librenms/Makefile +++ b/net-mgmt/librenms/Makefile @@ -1,6 +1,6 @@ PORTNAME= librenms PORTVERSION= 23.9.1 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 1 CATEGORIES= net-mgmt MASTER_SITES= LOCAL/dvl:vendor @@ -151,6 +151,8 @@ _OTHER_DIRS= database/seeders/config html/plugins html/js/lang \ post-patch: ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/Validations/Php.php + ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/__init__.py + ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/wrapper.py ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/Util/Version.php ${REINPLACE_CMD} 's|%%PORTVERSION%%|${PORTVERSION}|g' ${WRKSRC}/LibreNMS/Util/Version.php ${REINPLACE_CMD} 's|%%RELEASE_TIMESTAMP%%|${_RELEASE_TIMESTAMP}|g' ${WRKSRC}/LibreNMS/Util/Version.php @@ -158,6 +160,7 @@ post-patch: ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/includes/html/output/capture.inc.php ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/config.php.default ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/poller-wrapper.py + ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/snmp-scan.py ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/dist/librenms-scheduler.cron ${REINPLACE_CMD} 's|%%WWWDIR%%|${WWWDIR}|g' ${WRKSRC}/dist/librenms-scheduler.cron ${REINPLACE_CMD} 's|%%USER%%|${WWWOWN}|g' ${WRKSRC}/dist/librenms-scheduler.cron diff --git a/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php b/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php index 744b3533df01..961ebfbeaaac 100644 --- a/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php +++ b/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php @@ -5,7 +5,7 @@ $install_dir = $validator->getBaseDir(); - $lnms = str_replace('lnms:', '', rtrim(`whereis -b lnms 2>/dev/null`)); -+ $lnms = rtrim(`/usr/bin/find /usr/local/bin -name lnms`); ++ $lnms = rtrim(`/usr/bin/find %%LOCALBASE%%/bin -name lnms`); $path = rtrim(`echo "\$PATH"`); // if couldn't find lnms and we have PATH diff --git a/net-mgmt/librenms/files/patch-LibreNMS_____init____.py b/net-mgmt/librenms/files/patch-LibreNMS_____init____.py index a5a301d57649..a648688daae8 100644 --- a/net-mgmt/librenms/files/patch-LibreNMS_____init____.py +++ b/net-mgmt/librenms/files/patch-LibreNMS_____init____.py @@ -14,7 +14,7 @@ if script.endswith(".php"): # save calling the sh process - base = ("/usr/bin/env", "php") -+ base = ("/usr/local/bin/php",) ++ base = ("%%LOCALBASE%%/bin/php",) else: base = () diff --git a/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py b/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py index d0f9187b21cf..d37958f3ac0a 100644 --- a/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py +++ b/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py @@ -5,7 +5,7 @@ wrappers[wrapper_type]["executable"], ) - command = "/usr/bin/env php {} -h {}".format(executable, device_id) -+ command = "/usr/local/bin/php php {} -h {}".format(executable, device_id) ++ command = "%%LOCALBASE%%/bin/php php {} -h {}".format(executable, device_id) if modules is not None and len(str(modules).strip()): module_str = re.sub("\s", "", str(modules).strip()) command = command + " -m {}".format(module_str) diff --git a/net-mgmt/librenms/files/patch-snmp-scan.py b/net-mgmt/librenms/files/patch-snmp-scan.py index 8c8ad9ddfc03..35f95c508731 100644 --- a/net-mgmt/librenms/files/patch-snmp-scan.py +++ b/net-mgmt/librenms/files/patch-snmp-scan.py @@ -6,7 +6,7 @@ arguments = [ - "/usr/bin/env", - "lnms", -+ "/usr/local/bin/lnms", ++ "%%LOCALBASE%%/bin/lnms", "device:add", "-g", POLLER_GROUP, @@ -15,7 +15,7 @@ try: CONFIG = json.loads( - check_output(["/usr/bin/env", "php", "config_to_json.php"]).decode() -+ check_output(["/usr/local/bin/php", "config_to_json.php"]).decode() ++ check_output(["%%LOCALBASE%%/bin/php", "config_to_json.php"]).decode() ) except CalledProcessError as e: parser.error( [16:16 pkg01 dan ~/ports/head/net-mgmt/librenms] % -- Dan Langille dan@langille.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d1a0e113-ebce-4a80-b203-f8844239cf43>