pkg/pkg.mk: make sure we are building the correct commit.
Once the repo is downloaded, the version is not checked gain. This means that even if a package's Makefile is touched, that will only cause a rebuild of the previously downloaded version. For packages that are normally not deleted, like edbg, this renders PKG_VERSION bumps ineffective, unless the user manually deletes the repo directory. This patch fixes that by always checking that the repo is at the right commit.
This commit is contained in:
parent
87d0757689
commit
f8f229b6f7
14
pkg/pkg.mk
14
pkg/pkg.mk
@ -9,26 +9,34 @@ ifneq (,$(PKG_SOURCE_LOCAL))
|
||||
include $(RIOTBASE)/pkg/local.mk
|
||||
else
|
||||
|
||||
.PHONY: prepare git-download clean
|
||||
.PHONY: prepare git-download clean git-ensure-version
|
||||
|
||||
prepare: git-download
|
||||
|
||||
ifneq (,$(wildcard $(PKG_DIR)/patches))
|
||||
git-download: $(PKG_BUILDDIR)/.git-patched
|
||||
else
|
||||
git-download: $(PKG_BUILDDIR)/.git-downloaded
|
||||
git-download: git-ensure-version
|
||||
endif
|
||||
|
||||
GITFLAGS ?= -c user.email=buildsystem@riot -c user.name="RIOT buildsystem"
|
||||
GITAMFLAGS ?= --no-gpg-sign --ignore-whitespace
|
||||
|
||||
ifneq (,$(wildcard $(PKG_DIR)/patches))
|
||||
$(PKG_BUILDDIR)/.git-patched: $(PKG_BUILDDIR)/.git-downloaded $(PKG_DIR)/Makefile $(PKG_DIR)/patches/*.patch
|
||||
$(PKG_BUILDDIR)/.git-patched: git-ensure-version $(PKG_DIR)/Makefile $(PKG_DIR)/patches/*.patch
|
||||
git -C $(PKG_BUILDDIR) checkout -f $(PKG_VERSION)
|
||||
git $(GITFLAGS) -C $(PKG_BUILDDIR) am $(GITAMFLAGS) "$(PKG_DIR)"/patches/*.patch
|
||||
touch $@
|
||||
endif
|
||||
|
||||
git-ensure-version: $(PKG_BUILDDIR)/.git-downloaded
|
||||
if [ $(shell git -C $(PKG_BUILDDIR) rev-parse HEAD) != $(PKG_VERSION) ] ; then \
|
||||
git -C $(PKG_BUILDDIR) clean -xdff ; \
|
||||
git -C $(PKG_BUILDDIR) fetch "$(PKG_URL)" "$(PKG_VERSION)" ; \
|
||||
git -C $(PKG_BUILDDIR) checkout -f $(PKG_VERSION) ; \
|
||||
touch $(PKG_BUILDDIR)/.git-downloaded ; \
|
||||
fi
|
||||
|
||||
$(PKG_BUILDDIR)/.git-downloaded:
|
||||
rm -Rf $(PKG_BUILDDIR)
|
||||
mkdir -p $(PKG_BUILDDIR)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user