OSDN Git Service

Replace some uses of acp with cp
authorDan Willemsen <dwillemsen@google.com>
Mon, 29 Feb 2016 20:45:18 +0000 (12:45 -0800)
committerDan Willemsen <dwillemsen@google.com>
Tue, 1 Mar 2016 21:08:50 +0000 (13:08 -0800)
ACP was originally created to overcome differences with cp between
Linux, Darwin, and Windows. We've since dropped Windows as a build host,
and don't use features like '-u' anymore.

For most of our current usecases, 'acp' is identical to 'cp' except that
it splits 'cp -p' into 'acp -p' for mode and ownership, and 'acp -t' for
timestamps. On Linux, this could be specified using
'--preserve=mode,ownership', but Darwin doesn't have this.

Since we're removing the destination file before copying, 'cp' already
preserves the mode (modulated by the umask). So the only extra thing
that gets preserved with 'acp -p' is ownership, which we should not care
about in the build system. (In many cases we shouldn't be preserving
mode either, so that readonly source trees can actually be marked
readonly, but that will be a future change)

Change-Id: Ied96fdc303ac5c774347c07363daec8b6dfb22e4

core/definitions.mk

index 6960ff3..9cce072 100644 (file)
@@ -2363,7 +2363,7 @@ endef
 # $(1): source file
 # $(2): destination file
 define copy-one-file
-$(2): $(1) | $(ACP)
+$(2): $(1)
        @echo "Copy: $$@"
        $$(copy-file-to-target)
 endef
@@ -2399,13 +2399,15 @@ endef
 # Copy a single file from one place to another,
 # preserving permissions and overwriting any existing
 # file.
-# We disable the "-t" option for acp cannot handle
-# high resolution timestamp correctly on file systems like ext4.
-# Therefore copy-file-to-target is the same as copy-file-to-new-target.
+# When we used acp, it could not handle high resolution timestamps
+# on file systems like ext4. Because of that, '-t' option was disabled
+# and copy-file-to-target was identical to copy-file-to-new-target.
+# Keep the behavior until we audit and ensure that switching this back
+# won't break anything.
 define copy-file-to-target
 @mkdir -p $(dir $@)
 $(hide) rm -f $@
-$(hide) $(ACP) -p $< $@
+$(hide) cp $< $@
 endef
 
 # The same as copy-file-to-target, but use the local
@@ -2436,7 +2438,7 @@ endef
 define copy-file-to-new-target
 @mkdir -p $(dir $@)
 $(hide) rm -f $@
-$(hide) $(ACP) -p $< $@
+$(hide) cp $< $@
 endef
 
 # The same as copy-file-to-new-target, but use the local