Date: Fri, 20 Aug 2021 11:41:11 +0200 From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= <fernando.apesteguia@gmail.com> To: Ole <ole@free.de> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: Patching a port (monit) with EXTRA_PATCHES and poudriere - fails Message-ID: <CAGwOe2Z2nC5KzyRptiWrN1QN2LJZVrZ7QwdiMeNwQD=KQUWUUA@mail.gmail.com> In-Reply-To: <20210820111654.48c52853.ole@free.de> References: <20210820111654.48c52853.ole@free.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 20, 2021 at 11:17 AM Ole <ole@free.de> wrote: > > 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 ^^^^^^^ It seems the whole patch was rejected. You can confirm this by looking at src/validate.c.rej Is it possible that the changes are being applied twice? > ===> 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; > }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGwOe2Z2nC5KzyRptiWrN1QN2LJZVrZ7QwdiMeNwQD=KQUWUUA>