summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-07-23 10:42:40 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2018-09-20 11:03:54 +0200
commit3e471b0b5a14cdd785c860087f27d08e8355a40d (patch)
tree3ad9adc7c1a8cf63db496b305af777515349646f
parent717e122dbeeded5cf80953cb7225da25ddd98891 (diff)
downloadptxdist-3e471b0b5a14cdd785c860087f27d08e8355a40d.tar.gz
ptxdist-3e471b0b5a14cdd785c860087f27d08e8355a40d.tar.xz
rules: implement & use ptx/in-platformconfigdir
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/at91bootstrap2.make3
-rw-r--r--rules/barebox.make3
-rw-r--r--rules/barebox_mlo.make4
-rw-r--r--rules/image-rauc.make4
-rw-r--r--rules/kernel.make2
-rw-r--r--rules/pre/get_alternative.make2
-rw-r--r--rules/templates/template-barebox-make2
-rw-r--r--rules/templates/template-kernel-make2
-rw-r--r--scripts/libptxdist.sh29
9 files changed, 42 insertions, 9 deletions
diff --git a/rules/at91bootstrap2.make b/rules/at91bootstrap2.make
index 7f28a0650..b5def8985 100644
--- a/rules/at91bootstrap2.make
+++ b/rules/at91bootstrap2.make
@@ -23,7 +23,8 @@ AT91BOOTSTRAP2_SUFFIX := tar.gz
AT91BOOTSTRAP2_URL := https://github.com/linux4sam/at91bootstrap/archive/v$(AT91BOOTSTRAP2_VERSION).$(AT91BOOTSTRAP2_SUFFIX)
AT91BOOTSTRAP2_SOURCE := $(SRCDIR)/$(AT91BOOTSTRAP2).$(AT91BOOTSTRAP2_SUFFIX)
AT91BOOTSTRAP2_DIR := $(BUILDDIR)/$(AT91BOOTSTRAP2)
-AT91BOOTSTRAP2_CONFIG := $(call remove_quotes, $(PTXDIST_PLATFORMCONFIGDIR)/$(PTXCONF_AT91BOOTSTRAP2_CONFIG))
+AT91BOOTSTRAP2_CONFIG := $(call ptx/in-platformconfigdir, \
+ $(call remove_quotes, $(PTXCONF_AT91BOOTSTRAP2_CONFIG)))
AT91BOOTSTRAP2_LICENSE := unknown
# ----------------------------------------------------------------------------
diff --git a/rules/barebox.make b/rules/barebox.make
index f09572941..a672de43e 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -27,7 +27,8 @@ BAREBOX_DIR := $(BUILDDIR)/$(BAREBOX)
BAREBOX_LICENSE := GPL-2.0-only
BAREBOX_DEVPKG := NO
-BAREBOX_CONFIG := $(call remove_quotes, $(PTXDIST_PLATFORMCONFIGDIR)/$(PTXCONF_BAREBOX_CONFIG))
+BAREBOX_CONFIG := $(call ptx/in-platformconfigdir, \
+ $(call remove_quotes, $(PTXCONF_BAREBOX_CONFIG)))
# ----------------------------------------------------------------------------
# Prepare
diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make
index e8d1743c1..368da0e8f 100644
--- a/rules/barebox_mlo.make
+++ b/rules/barebox_mlo.make
@@ -24,8 +24,8 @@ BAREBOX_MLO_DIR := $(BUILDDIR)/barebox_mlo-$(BAREBOX_MLO_VERSION)
BAREBOX_MLO_SOURCE = $(SRCDIR)/$(BAREBOX_MLO).$(BAREBOX_SUFFIX)
BAREBOX_MLO_LICENSE := GPL-2.0-only
-BAREBOX_MLO_CONFIG := $(call remove_quotes, \
- $(PTXDIST_PLATFORMCONFIGDIR)/$(PTXCONF_BAREBOX_MLO_CONFIG))
+BAREBOX_MLO_CONFIG := $(call ptx/in-platformconfigdir, \
+ $(call remove_quotes, $(PTXCONF_BAREBOX_MLO_CONFIG)))
# ----------------------------------------------------------------------------
# Prepare
diff --git a/rules/image-rauc.make b/rules/image-rauc.make
index 0ee31b0ab..fb4298fe4 100644
--- a/rules/image-rauc.make
+++ b/rules/image-rauc.make
@@ -26,8 +26,8 @@ IMAGE_RAUC_CONFIG := rauc.config
# Image
# ----------------------------------------------------------------------------
-IMAGE_RAUC_KEY = $(PTXDIST_PLATFORMCONFIGDIR)/config/rauc/rauc.key.pem
-IMAGE_RAUC_CERT = $(PTXDIST_PLATFORMCONFIGDIR)/config/rauc/rauc.cert.pem
+IMAGE_RAUC_KEY := $(call ptx/in-platformconfigdir, config/rauc/rauc.key.pem)
+IMAGE_RAUC_CERT := $(call ptx/in-platformconfigdir, config/rauc/rauc.cert.pem)
IMAGE_RAUC_ENV := \
RAUC_BUNDLE_COMPATIBLE="$(call remove_quotes,$(PTXCONF_RAUC_COMPATIBLE))" \
diff --git a/rules/kernel.make b/rules/kernel.make
index e5d5178ed..2e7ef1953 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -27,7 +27,7 @@ KERNEL_SUFFIX := tar.gz
KERNEL_URL := https://git.kernel.org/torvalds/t/$(KERNEL).$(KERNEL_SUFFIX)
endif
KERNEL_DIR := $(BUILDDIR)/$(KERNEL)
-KERNEL_CONFIG := $(call remove_quotes, $(PTXDIST_PLATFORMCONFIGDIR)/$(PTXCONF_KERNEL_CONFIG))
+KERNEL_CONFIG := $(call ptx/in-platformconfigdir, $(call remove_quotes, $(PTXCONF_KERNEL_CONFIG)))
KERNEL_LICENSE := GPL-2.0-only
KERNEL_SOURCE := $(SRCDIR)/$(KERNEL).$(KERNEL_SUFFIX)
KERNEL_DEVPKG := NO
diff --git a/rules/pre/get_alternative.make b/rules/pre/get_alternative.make
index c24d44dd3..f8043639f 100644
--- a/rules/pre/get_alternative.make
+++ b/rules/pre/get_alternative.make
@@ -13,4 +13,6 @@ ptx/get_alternative = $(error ptx/get_alternative has been renamed to ptx/get-al
ptx/in-path = $(shell ptxd_in_path $(1) $(2) && echo $$ptxd_reply)
+ptx/in-platformconfigdir = $(if $(strip $(1)),$(shell ptxd_in_platformconfigdir $(1)))
+
# vim: syntax=make
diff --git a/rules/templates/template-barebox-make b/rules/templates/template-barebox-make
index 0195c30c2..f0b2b4a0a 100644
--- a/rules/templates/template-barebox-make
+++ b/rules/templates/template-barebox-make
@@ -21,7 +21,7 @@ BAREBOX_@PACKAGE@_MD5 :=
BAREBOX_@PACKAGE@ := barebox-$(BAREBOX_@PACKAGE@_VERSION)
BAREBOX_@PACKAGE@_SUFFIX := tar.bz2
BAREBOX_@PACKAGE@_DIR := $(BUILDDIR)/barebox-@package@-$(BAREBOX_@PACKAGE@_VERSION)
-BAREBOX_@PACKAGE@_CONFIG := $(PTXDIST_PLATFORMCONFIGDIR)/barebox-@package@.config.$(BAREBOX_@PACKAGE@_VERSION)
+BAREBOX_@PACKAGE@_CONFIG := $(call ptx/in-platformconfigdir, barebox-@package@.config.$(BAREBOX_@PACKAGE@_VERSION))
BAREBOX_@PACKAGE@_LICENSE := GPL-2.0
BAREBOX_@PACKAGE@_URL := $(call barebox-url, BAREBOX_@PACKAGE@)
BAREBOX_@PACKAGE@_SOURCE := $(SRCDIR)/$(BAREBOX_@PACKAGE@).$(BAREBOX_@PACKAGE@_SUFFIX)
diff --git a/rules/templates/template-kernel-make b/rules/templates/template-kernel-make
index 15ce77af1..390cf6cbf 100644
--- a/rules/templates/template-kernel-make
+++ b/rules/templates/template-kernel-make
@@ -21,7 +21,7 @@ KERNEL_@PACKAGE@_MD5 :=
KERNEL_@PACKAGE@ := linux-$(KERNEL_@PACKAGE@_VERSION)
KERNEL_@PACKAGE@_SUFFIX := tar.xz
KERNEL_@PACKAGE@_DIR := $(BUILDDIR)/linux-@package@-$(KERNEL_@PACKAGE@_VERSION)
-KERNEL_@PACKAGE@_CONFIG := $(PTXDIST_PLATFORMCONFIGDIR)/kernelconfig-@package@
+KERNEL_@PACKAGE@_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig-@package@)
KERNEL_@PACKAGE@_LICENSE := GPL-2.0
KERNEL_@PACKAGE@_URL := $(call kernel-url, KERNEL_@PACKAGE@)
KERNEL_@PACKAGE@_SOURCE := $(SRCDIR)/$(KERNEL_@PACKAGE@).$(KERNEL_@PACKAGE@_SUFFIX)
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index ea186540e..a8682863a 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -611,6 +611,35 @@ ptxd_in_path() {
export -f ptxd_in_path
#
+# ptxd_in_platformconfigdir - find paths in platformconfigdir
+#
+# $1 filename to find
+#
+# If the filename is absolute then return the filename unchanged.
+# Otherwise search in platformconfigdir in all layers for the file and
+# return the first hit.
+# If no file is found return ${PTXDIST_PLATFORMCONFIGDIR}/${1}
+#
+# return:
+# The result is written to stdout.
+#
+ptxd_in_platformconfigdir() {
+ case "${1}" in
+ /*)
+ echo "${1}"
+ ;;
+ *)
+ if ptxd_in_path PTXDIST_PATH_PLATFORMCONFIGDIR "${1}"; then
+ echo "${ptxd_reply[0]}"
+ else
+ echo "${PTXDIST_PLATFORMCONFIGDIR}/${1}"
+ fi
+ ;;
+ esac
+}
+export -f ptxd_in_platformconfigdir
+
+#
# convert a relative or absolute path into an absolute path
#
ptxd_abspath() {