Skip to contentSkip to conversation

Makefile: change rsync used in overlays to always transfer files

PATCH New Danomi Manchego 3 participants 4 messages Jun 8, 2013 – Feb 4, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: change rsync used in overlays to always transfer files

If two files with the same relative paths exist in multiple overlay skeletons, and they have the same modification time and size, then rsync might not copy the later file on top of the earlier file. This patch fixes this by adding the -I option to the rsync commands used in the overlay skeleton file installations. ("man rsync" indicates that this option turns off the file-size/mod-date "quick check" behavior, causing all files to be updated - more like the cp commands that we had originally.)

---

Test scenario: add overlay dirs to configuration, such as:

    BR2_ROOTFS_OVERLAY="$(TOPDIR)/AAA $(TOPDIR)/BBB"

Now make a file in both dirs, one at a time, and make:

    $ mkdir -p AAA/etc BBB/etc
    $ echo AAA > AAA/etc/test.txt
    $ echo BBB > BBB/etc/test.txt
    $ make

The file in target is the file from the last overlay skeleton, as expected:

    $ cat output/target/etc/test.txt
    BBB

Now use touch to make the dates on both files the same, delete the file in TARGET_DIR, and make again. The result is that the file from the first skeleton gets into target, contrary to the expected result:

    $ touch AAA/etc/test.txt BBB/etc/test.txt
    $ rm output/target/etc/test.txt
    $ make
    $ cat output/target/etc/test.txt
    AAA

Adding the -I to the rsync fixes this.

---
 Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index d7437a7..969c0c9 100644
@@ -431,7 +431,7 @@ endif
 
 $(BUILD_DIR)/.root:
 	mkdir -p $(TARGET_DIR)
-	rsync -a \
+	rsync -a -I \
 		--exclude .empty --exclude .svn --exclude .git \
 		--exclude .hg --exclude=CVS --exclude '*~' \
 		$(TARGET_SKELETON)/ $(TARGET_DIR)/
@@ -507,7 +507,7 @@ endif
 
 	@$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
 		$(call MESSAGE,"Copying overlay $(d)"); \
-		rsync -a \
+		rsync -a -I \
 			--exclude .empty --exclude .svn --exclude .git \
 			--exclude .hg --exclude=CVS --exclude '*~' \
 			$(d)/ $(TARGET_DIR)$(sep))
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 Makefile: change rsync used in overlays to always transfer files

Quoted 9 lines · Danomi Manchego

If two files with the same relative paths exist in multiple overlay skeletons, and they have the same modification time and size, then rsync might not copy the later file on top of the earlier file. This patch fixes this by adding the -I option to the rsync commands used in the overlay skeleton file installations. ("man rsync" indicates that this option turns off the file-size/mod-date "quick check" behavior, causing all files to be updated - more like the cp commands that we had originally.)

Committed with -I changed to --ignore-times as it is a bit more obvious what the option does.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 Makefile: change rsync used in overlays to always transfer files

Peter,

Quoted 2 lines · Peter Korsgaard

Committed with -I changed to --ignore-times as it is a bit more obvious what the option does.

Using "--ignore-times" is fine with me - but the problem still exists. You added the option to the skeleton install's rsync, but not to the overlay install's rsync, around line 551 of Makefile. (So, you can still demonstrate the issue using the AAA/BBB overlays example that I mentioned in my original submittal.) Can you add the --ignore-times to the second rsync?

Danomi -

#3 lore raw

PATCH 1/1 Makefile: change rsync used in overlays to always transfer files

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Danomi" == Danomi Manchego <[email protected]> writes:

Peter,

Quoted 2 lines · Peter Korsgaard

Committed with -I changed to --ignore-times as it is a bit more obvious what the option does.

Quoted 6 lines

Using "--ignore-times" is fine with me - but the problem still exists. You added the option to the skeleton install's rsync, but not to the overlay install's rsync, around line 551 of Makefile. (So, you can still demonstrate the issue using the AAA/BBB overlays example that I mentioned in my original submittal.) Can you add the --ignore-times to the second rsync?

Argh, crap - I forgot the 2nd instance when I fixed up the merge conflict. I'll fix it now.

Signature · 1 line
Bye, Peter Korsgaard