Patching a port (monit) with EXTRA_PATCHES and poudriere - fails
Ole
ole at free.de
Fri Aug 20 09:17:08 UTC 2021
Hello,
there is a Bug in the current version of the monit port.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257941
It was already fixed in the repo.
https://bitbucket.org/tildeslash/monit/commits/47e042610940624e492119a895098dfbd459b8df
I am building my packages with poudriere. And since I need the package
strongly, i thought it would be good to learn how to patch a port with
poudriere.
I took my information from this sites:
https://dan.langille.org/2014/06/10/freebsd-custom-port-patches-when-using-poudriere/
https://docs.freebsd.org/en/books/porters-handbook/slow-porting/
1. Create the patch:
diff -u src/validate.c.orig src/validate.c /usr/ports/distfiles/local-patches/monit.patch
2. Edit make.conf:
.if ${.CURDIR:M*/sysutils/monit}
EXTRA_PATCHES+= /distfiles/local-patches/monit.patch
.endif
3. remove old package
find /poudriere/base/data/packages/freebsd:12:x86:64-HEAD/ -name monit\* -delete
4. run poudriere again.
===> Patching for monit-5.28.1
===> Applying extra patch /distfiles/local-patches/monit.patch
Ignoring previously applied (or reversed) patch.
2 out of 2 hunks ignored--saving rejects to src/validate.c.rej
===> FAILED Applying extra
patch /distfiles/local-patches/monit.patch *** Error code 1
Stop.
make: stopped in /usr/ports/sysutils/monit
sadly it fails applying the patch. Any idea why?
The patch is below.
Ole
--- src/validate.c.orig 2021-08-20 10:58:45.165650000 +0200
+++ src/validate.c 2021-08-20 10:58:48.797744000 +0200
@@ -1518,17 +1518,21 @@
int errors = 0;
/* Check the services */
for (Service_T s = servicelist; s && ! interrupt(); s = s->next) {
- // FIXME: The Service_Program must collect the exit value from last run, even if the program start should be skipped in this cycle => let check program always run the test (to be refactored with new scheduler)
- if (! _doScheduledAction(s) && s->monitor && (s->type == Service_Program || ! _checkSkip(s))) {
- _checkTimeout(s); // Can disable monitoring => need to check s->monitor again
- if (s->monitor) {
- State_Type state = s->check(s);
- if (state != State_Init && s->monitor != Monitor_Not) // The monitoring can be disabled by some matching rule in s->check so we have to check again before setting to Monitor_Yes
- s->monitor = Monitor_Yes;
- if (state == State_Failed)
- errors++;
- if (s->type != Service_Program)
- gettimeofday(&s->collected, NULL);
+ if (! _doScheduledAction(s) && s->monitor) {
+ bool skip = _checkSkip(s);
+ // FIXME: The Service_Program must collect the exit value from last run, even if the program start should be skipped in this cycle => let check program always run the test (to be refactored with new scheduler)
+ if (! skip || s->type == Service_Program) {
+ _checkTimeout(s); // Can disable monitoring => need to check s->monitor again
+ if (s->monitor) {
+ State_Type state = s->check(s);
+ if (state != State_Init && s->monitor != Monitor_Not) // The monitoring can be disabled by some matching rule in s->check so we have to check again before setting to Monitor_Yes
+ s->monitor = Monitor_Yes;
+ if (state == State_Failed)
+ errors++;
+ //FIXME: the Service_Program is executed each cycle to collect exit value ... record the last data collection timestamp only on the real non-skip cycle
+ if (! skip)
+ gettimeofday(&s->collected, NULL);
+ }
}
}
}
@@ -1920,8 +1924,6 @@
Event_post(s, Event_Status, State_Succeeded, s->action_EXEC, "program started");
s->program->started = now;
}
- // We canot set the data collection timestmap in validate(), as the program check calls the _checkSkip() here
- gettimeofday(&s->collected, NULL);
}
return rv;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20210820/5d1b0fd5/attachment.sig>
More information about the freebsd-questions
mailing list