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

Commit cff1cee3 authored by Colin Cross's avatar Colin Cross
Browse files

Hide unzip warning when zip file is empty

unzip prints a warning and exits with code 1 when a zip file is empty.
Pipe the output of unzip through grep -v to hide the warning,
using PIPESTATUS to preserve the exit code of unzip, and then
filter out exit codes that are not 0 or 1.

Test: m
Change-Id: If2cf725fc3315d5996d5a7190288df46d84a59e2
parent 17e9a79f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -253,7 +253,13 @@ ifdef LOCAL_DEX_PREOPT
    LOCAL_POST_INSTALL_CMD += &&
  endif

  LOCAL_POST_INSTALL_CMD += for i in $$(zipinfo -1 $(my_dexpreopt_zip)); do mkdir -p $(PRODUCT_OUT)/$$(dirname $$i); done && unzip -qo -d $(PRODUCT_OUT) $(my_dexpreopt_zip)
  LOCAL_POST_INSTALL_CMD += \
    for i in $$(zipinfo -1 $(my_dexpreopt_zip)); \
      do mkdir -p $(PRODUCT_OUT)/$$(dirname $$i); \
    done && \
    ( unzip -qo -d $(PRODUCT_OUT) $(my_dexpreopt_zip) 2>&1 | grep -v "zipfile is empty"; exit $${PIPESTATUS[0]} ) || \
      ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )

  $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
  $(LOCAL_INSTALLED_MODULE): $(my_dexpreopt_zip)