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

Commit 16bde1fa authored by Ying Wang's avatar Ying Wang Committed by Gerrit Code Review
Browse files

Split to multiple bash commands.

This can fix the error "/bin/bash: Argument list too long", if we get a
really long apk list.
Bug tracker Link: http://code.google.com/p/android/issues/detail?id=38937

Change-Id: Ic6318465a0413ba9ac5afe2c4974ebb3abf59b01
parent 8aaf0aa3
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -247,6 +247,12 @@ package-stats: $(PACKAGE_STATS_FILE)

# -----------------------------------------------------------------
# Cert-to-package mapping.  Used by the post-build signing tools.
# Use a macro to add newline to each echo command
define _apkcerts_echo_with_newline
$(hide) echo $(1)

endef

name := $(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug)
  name := $(name)_debug
@@ -261,13 +267,15 @@ $(APKCERTS_FILE):
	@echo APK certs list: $@
	@mkdir -p $(dir $@)
	@rm -f $@
	$(hide) cd $(dir $@) && $(foreach p,$(PACKAGES),\
	$(foreach p,$(PACKAGES),\
	  $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
	    echo 'name="$(p).apk" certificate="EXTERNAL" \
	         private_key=""' >> $(notdir $@);,\
	    echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
	         private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $(notdir $@);))
	# In case $(PACKAGES) is empty.
	    $(call _apkcerts_echo_with_newline,\
	      'name="$(p).apk" certificate="EXTERNAL" \
	      private_key=""' >> $@),\
	    $(call _apkcerts_echo_with_newline,\
	      'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
	      private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@)))
	# In case value of PACKAGES is empty.
	$(hide) touch $@

.PHONY: apkcerts-list