diff mbox series

[1/1] package/pkg-utils: only overwrite newer for per-package-rsync

Message ID 20211024052852.3999292-1-james.hilliard1@gmail.com
State Changes Requested
Headers show
Series [1/1] package/pkg-utils: only overwrite newer for per-package-rsync | expand

Commit Message

James Hilliard Oct. 24, 2021, 5:28 a.m. UTC
Currently during target-finalize we rsync packages in sorted order,
however if one rebuilds a package that has reverse dependencies
the rebuilt version may get overwritten by the old version from the
reverse dependency if the reverse dependency gets recyned after
the rebuilt package(based on alphabetical sorting) during the
target-finalize stage.

To prevent this only copy files newer than their targets.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 package/pkg-utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Petazzoni Oct. 24, 2021, 1:02 p.m. UTC | #1
Hello James,

On Sat, 23 Oct 2021 23:28:52 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> Currently during target-finalize we rsync packages in sorted order,
> however if one rebuilds a package that has reverse dependencies
> the rebuilt version may get overwritten by the old version from the
> reverse dependency if the reverse dependency gets recyned after
> the rebuilt package(based on alphabetical sorting) during the
> target-finalize stage.
> 
> To prevent this only copy files newer than their targets.
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

There's an entire patch series from Hervé Codina at
https://lore.kernel.org/buildroot/20210817083930.3718711-1-herve.codina@bootlin.com/
to address this issue, and it is much more involved. Parts of the
series have been applied, but not all of it, as there are some
remaining issues.

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index ae3c7f9da9..5af34d4ee0 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -184,7 +184,7 @@  ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
 define per-package-rsync
 	mkdir -p $(3)
 	$(foreach pkg,$(1),\
-		rsync -a --link-dest=$(PER_PACKAGE_DIR)/$(pkg)/$(2)/ \
+		rsync -au --link-dest=$(PER_PACKAGE_DIR)/$(pkg)/$(2)/ \
 		$(PER_PACKAGE_DIR)/$(pkg)/$(2)/ \
 		$(3)$(sep))
 endef