package: make package download from Mercurial repositories more robust
authorMathias De Maré <mathias.demare@gmail.com>
Tue, 10 Dec 2013 18:31:30 +0000 (19:31 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 25 Dec 2013 11:36:39 +0000 (12:36 +0100)
Previously, when cloning a Mercurial repository,
aborting the clone could (in some cases) leave behind an empty directory.
As a result, a later clone would fail.

Signed-off-by: Mathias De Maré <mathias.demare@gmail.com>
Acked-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/pkg-download.mk

index 758b211097e888f5d818a035cc551ab9e1b4cb20..c00689b89c4ed4398d3528ea8b72ee3182ca2556 100644 (file)
@@ -178,6 +178,7 @@ endef
 define DOWNLOAD_HG
        test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
        (pushd $(DL_DIR) > /dev/null && \
+       rm -rf $($(PKG)_BASE_NAME) && \
        $(HG) clone --noupdate --rev $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \
        $(HG) archive --repository $($(PKG)_BASE_NAME) --type tgz --prefix $($(PKG)_BASE_NAME)/ \
                      --rev $($(PKG)_DL_VERSION) $(DL_DIR)/$($(PKG)_SOURCE) && \