Skip to content

canutils/lely-canopen: avoid patch reapply on repeated builds.#3447

Merged
raiden00pl merged 1 commit intoapache:masterfrom
ankohuu:fix/lely-core-make-3188
Apr 3, 2026
Merged

canutils/lely-canopen: avoid patch reapply on repeated builds.#3447
raiden00pl merged 1 commit intoapache:masterfrom
ankohuu:fix/lely-core-make-3188

Conversation

@ankohuu
Copy link
Copy Markdown
Contributor

@ankohuu ankohuu commented Apr 2, 2026

Summary

The patch step in canutils/lely-canopen currently uses a phony target, so it
is re-executed when the build is repeated in the same source tree.

When that happens, patch -N detects that the patches were already applied and
returns 1. Although this is treated as a non-fatal condition by patch,
make treats it as an error and aborts the build.

Replace the phony patch target with a stamped .patched file so the patch step
is not re-run unnecessarily on subsequent builds.

Fixes #3188

Impact

canutils/lely-canopen third-party lely-core make process.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): OS (Linux 6.17.0-1012-oem 12-Ubuntu SMP PREEMPT_DYNAMIC), CPU(Intel(R) Core(TM) Ultra 5 235U), compiler(arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi)
  • Target(s): arch(ARMv7-A), board:qemu-armv7a

Configuration used:

rg LELY .config
1503:CONFIG_CANUTILS_LELYCANOPEN=y
1504:CONFIG_CANUTILS_LELYCANOPEN_URL="https://gitlab.com/lely_industries/lely-core/-/archive/master/"
1505:CONFIG_CANUTILS_LELYCANOPEN_VERSION="637de61625c9e8af2b9598109d6fb0e3a2829ce6"

Command:

make -C /home/ankohuu/Project/nuttx-apps/canutils/lely-canopen APPDIR=/home/ankohuu/Project/nuttx-apps TOPDIR=/home/ankohuu/Project/nuttx context V=1

Before the patch, re-running the patch step failed:

First run completed successfully.
Second run failed with:

make: Entering directory '/home/ankohuu/Project/nuttx-apps/canutils/lely-canopen'
Unpacking: lely-core-637de61625c9e8af2b9598109d6fb0e3a2829ce6.tar.gz -> lely-core-master-  637de61625c9e8af2b9598109d6fb0e3a2829ce6
tar -zxf lely-core-637de61625c9e8af2b9598109d6fb0e3a2829ce6.tar.gz
# Get the name of the directory created by the tar command
mv lely-core-master-88848aa28599ea5d6d7e766a9ffa2054446821b5 lely-core
cat 0001-tools-eliminate-multiple-definitions-of-poll-compile.patch | patch -s -N -d lely-core -p1
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file tools/can2udp.c.rej
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file tools/cocatd.c.rej
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file tools/coctl.c.rej
make: *** [Makefile:186: patch_src] Error 1
make: Leaving directory '/home/ankohuu/Project/nuttx-apps/canutils/lely-canopen'

Test logs after the patch:

make: Entering directory '/home/ankohuu/Project/nuttx-apps/canutils/lely-canopen'
make: Nothing to be done for 'context'.
make: Leaving directory '/home/ankohuu/Project/nuttx-apps/canutils/lely-canopen'

Full build logs:

make
Create version.h
LN: platform/board to /home/ankohuu/Project/nuttx-apps/platform/dummy
Register: coremark
Register: hello
Register: dd
Register: gprof
Register: nsh
Register: sh
Register: ostest
Register: getprime
CPP:  /home/ankohuu/Project/nuttx/boards/arm/qemu/qemu-armv7a/scripts/dramboot.ld->   /home/ankohuu/Project/nuttx/boards/arm/qemu/qemu-armv7a/scripts/dLD: nuttx
arm-none-eabi-ld: warning: /home/ankohuu/Project/nuttx/nuttx has a LOAD segment with RWX permissions
Memory region         Used Size  Region Size  %age Used
           ROM:      275600 B         1 MB     26.28%
           RAM:         16 KB        16 MB      0.10%
arm-none-eabi-ld: warning: /home/ankohuu/Project/nuttx/nuttx has a LOAD segment with RWX permissions
Memory region         Used Size  Region Size  %age Used
           ROM:      306704 B         1 MB     29.25%
           RAM:         28 KB        16 MB      0.17%
arm-none-eabi-ld: warning: /home/ankohuu/Project/nuttx/nuttx has a LOAD segment with RWX permissions
Memory region         Used Size  Region Size  %age Used
           ROM:      306704 B         1 MB     29.25%
           RAM:         28 KB        16 MB      0.17%
arm-none-eabi-ld: warning: /home/ankohuu/Project/nuttx/nuttx has a LOAD segment with RWX permissions
Memory region         Used Size  Region Size  %age Used
           ROM:      306704 B         1 MB     29.25%
           RAM:         28 KB        16 MB      0.17%
CP: nuttx.bin

ar t /home/ankohuu/Project/nuttx-apps/libapps.a | grep lely
buf.c.home.ankohuu.Project.nuttx-apps.canutils.lely-canopen_1.o
msg.c.home.ankohuu.Project.nuttx-apps.canutils.lely-canopen_1.o
more..

The patch step currently uses a phony target, so it is executed
again when the build is repeated in the same source tree. In that
case `patch -N` detects previously applied patches and returns 1,
which make treats as a failure.

Replace the phony patch target with a stamped `.patched` file so
the patch step is not re-run unnecessarily.

Fixes apache#3188

Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
Copy link
Copy Markdown
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ankohuu good catch! And BIG THANK YOU for perfect fix description with testing examples!! :-)

@raiden00pl raiden00pl merged commit 231ac39 into apache:master Apr 3, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Patch's strange returns causes compilation failure when using lely-core package

3 participants