Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1a98af5 authored by Dan Willemsen's avatar Dan Willemsen
Browse files

Replace some uses of acp with cp

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
parent 1dde47d0
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -2363,7 +2363,7 @@ endef
# $(1): source file
# $(1): source file
# $(2): destination file
# $(2): destination file
define copy-one-file
define copy-one-file
$(2): $(1) | $(ACP)
$(2): $(1)
	@echo "Copy: $$@"
	@echo "Copy: $$@"
	$$(copy-file-to-target)
	$$(copy-file-to-target)
endef
endef
@@ -2399,13 +2399,15 @@ endef
# Copy a single file from one place to another,
# Copy a single file from one place to another,
# preserving permissions and overwriting any existing
# preserving permissions and overwriting any existing
# file.
# file.
# We disable the "-t" option for acp cannot handle
# When we used acp, it could not handle high resolution timestamps
# high resolution timestamp correctly on file systems like ext4.
# on file systems like ext4. Because of that, '-t' option was disabled
# Therefore copy-file-to-target is the same as copy-file-to-new-target.
# 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
define copy-file-to-target
@mkdir -p $(dir $@)
@mkdir -p $(dir $@)
$(hide) rm -f $@
$(hide) rm -f $@
$(hide) $(ACP) -p $< $@
$(hide) cp $< $@
endef
endef


# The same as copy-file-to-target, but use the local
# The same as copy-file-to-target, but use the local
@@ -2436,7 +2438,7 @@ endef
define copy-file-to-new-target
define copy-file-to-new-target
@mkdir -p $(dir $@)
@mkdir -p $(dir $@)
$(hide) rm -f $@
$(hide) rm -f $@
$(hide) $(ACP) -p $< $@
$(hide) cp $< $@
endef
endef


# The same as copy-file-to-new-target, but use the local
# The same as copy-file-to-new-target, but use the local