help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Make 4.2 Query


From: nikhil jain
Subject: Re: GNU Make 4.2 Query
Date: Mon, 2 Sep 2019 11:34:36 +0530

Hi,

Thanks for your reply.

Actually, this is not possible in my case. The builds are run by the R&D
teams who are using legacy GNUmakefile. So, I can't force them to change
their way and there are around 10k+ commands in a makefile.
I would rather implement the retry feature in GMAKE like I had implemented
the Remote Execution feature. Thanks for your concern.

Just a point - I think a retry feature is really needed in GMAKE. it is a
very useful for everybody.
Remote execution , I understand can be implementation specific so you guys
left it as a stub. But, retry SHOULD be part of GMAKE.

Let me know whenever this feature can be embedded in GMAKE.

make -e 2

Something like that which can retry 2 times a failed command. Or even
better -

make -e 2 -t 4

Retry 2 times and 4 seconds of delay between each retry. It will help in
resolving NFS issues like -

all:
    mkdir <dir>
    cd <dir>

In my implementation these 2 commands will run on 2 different systems (as I
implemented remote execution facility in GMAKE). All my execution hosts are
in NFS. Sometimes, it takes time to sync (like a second or 2), so second
command fails.

That's why I needed a retry mechanism. Let me know if you guys thing to
make it part of some future releases.

Thanks
Nikhil Jain



On Mon, Sep 2, 2019 at 10:01 AM Kaz Kylheku (gmake) <
address@hidden> wrote:

> Hi nihkil,
>
> Try using a "macro":
>
> # $(1) is retry count: integer constant in shell test syntax
> # $(2) is command
> #
> define retry-times
>    i=0; while [ $$i -lt $(1) ]; do ($(2)) && exit 0; i=$$(( i + 1 ));
> done ; exit 1
> endef
>
> target: prerequisite
>    $(call retry-times,5,your command here)
>
>
> Fixed retries version:
>
> # $(1) is command
> #
> define retry-3-times
>    ($(1)) && exit 0 || ($(1)) && exit 0 || ($(1)) && exit 0 || exit 1
> endef
>
> target: prerequisite
>    $(call retry-3-times,your command here)
>
> We insert the command in parentheses not just for syntactic hygiene but
> to get it to run in a subshell. This way our command can contain
> subcommands like "exit 1" without terminating the retry logic.
>
> Cheers ...
>
> On 2019-09-01 12:48, nikhil jain wrote:
> > Ok, thanks.
> >
> > On Sat, 31 Aug 2019, 19:44 Paul Smith, <address@hidden> wrote:
> >
> >> On Fri, 2019-08-30 at 16:37 +0530, nikhil jain wrote:
> >> > Does GMAKE has a retry option. If a command in a rule is failed, is
> >> > there an option to retry it or I have to implement it ?
> >>
> >> GNU make has no built-in facility to retry failed commands.
> >>
> >>
> > _______________________________________________
> > Help-make mailing list
> > address@hidden
> > https://lists.gnu.org/mailman/listinfo/help-make
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]