pkg-generic: refactor the "Downloading" message logic
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 29 Mar 2015 17:33:18 +0000 (19:33 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 30 Mar 2015 21:39:01 +0000 (23:39 +0200)
In the .stamp_downloaded hook, the logic to decide whether or not to
display the "Downloading" message is treating the check of
<pkg>_SOURCE as a special case. But in fact, there is no real reason
to do so: the existing loop used for <pkg>_PATCH and
<pkg>_EXTRA_DOWNLOADS could work just as well.

This commit therefore refactors this piece of code, to have a single
loop checking <pkg>_SOURCE, <pkg>_PATCH and <pkg>_EXTRA_DOWNLOADS.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
package/pkg-generic.mk

index 003fd693d619514593bbfdef2a0ab7668b95c391..3c868780bf664d87d59e41d545a61ede1352e9b6 100644 (file)
@@ -73,16 +73,12 @@ $(BUILD_DIR)/%/.stamp_downloaded:
        $(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 # Only show the download message if it isn't already downloaded
-       $(Q)if test ! -e $(DL_DIR)/$($(PKG)_SOURCE); then \
-               $(call MESSAGE,"Downloading") ; \
-       else \
-               for p in $($(PKG)_PATCH) $($(PKG)_EXTRA_DOWNLOADS) ; do \
-                       if test ! -e $(DL_DIR)/`basename $$p` ; then \
-                               $(call MESSAGE,"Downloading") ; \
-                               break ; \
-                       fi ; \
-               done ; \
-       fi
+       $(Q)for p in $($(PKG)_SOURCE) $($(PKG)_PATCH) $($(PKG)_EXTRA_DOWNLOADS) ; do \
+               if test ! -e $(DL_DIR)/`basename $$p` ; then \
+                       $(call MESSAGE,"Downloading") ; \
+                       break ; \
+               fi ; \
+       done
 endif
        $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_SOURCE)))
        $(foreach p,$($(PKG)_EXTRA_DOWNLOADS),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$(p))$(sep))