kumquat-buildroot/package/fakedate
Ignacy Gawędzki cd9c604c96 package/fakedate: fix finding the right date executable
Currently, we look for the actual date be easrching form the end of the
PATH, and keeping the last-found date that occurs after the wrapper.

However, in some cases, the wrapper will be the last item in the PATH.
This is the cae when users already have the HOST_DIR/bin at the end of
their PATH, à-la:  PATH="${PATH}:/path/to/buildroot/output/host/bin"

In this case, we would not find any matching date.

The issue is that Buildroot adds HOST_DIR/bin at the beginning of the
PATH, so the real date will be to be found after the HOST_DIR that is
early in the PATH, but before the HOST_DIR that is at the end.

We fix the issue by searching the PATH as it is expecte to be searched,
shoud Buildroot had not added its date wrapper: we use the first date
executable that is found in the PATH, starting from the beginning, that
is after our wrapper, abd that is not the wrapper itself.

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
[yann.morin.1998@free.fr:
  - iterate in order from first-to-last
  - stop on the first occurence
  - handle the case where no date was found
  - extend and expand the commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-01-05 21:35:12 +01:00
..
fakedate
fakedate.mk