[openwrt/openwrt] kernel.mk: update LINUX_VERSION filename for cloned repo

LEDE Commits lede-commits at lists.infradead.org
Sat Jan 27 14:19:42 PST 2018


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/953bf6b43d50492a96a9bac692f4d99dd804b31f

commit 953bf6b43d50492a96a9bac692f4d99dd804b31f
Author: Alexandru Ardelean <ardeleanalex at gmail.com>
AuthorDate: Mon Jan 15 16:50:38 2018 +0200

    kernel.mk: update LINUX_VERSION filename for cloned repo
    
    In case there is an external git repo specified,
    it could overwrite the kernel tarball that was
    downloaded from kernel.org.
    
    The only identifier for such a file is the
    KERNEL_GIT_CLONE_URI & KERNEL_GIT_REF symbols,
    so if we have to download it we'll use that
    information [after some sanitization]
    to create a different filename for the kernel tarball.
    
    If KERNEL_GIT_REF symbol is empty, HEAD will be used
    as mentioned in the description of KERNEL_GIT_REF.
    
    Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 include/kernel-version.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 6103cee..05b7a0d 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -12,9 +12,20 @@ LINUX_KERNEL_HASH-4.4.112 = 544b42cbeed022896115c76a18fc97b4507d5b41d7ac0ce1dce9
 LINUX_KERNEL_HASH-4.9.77 = 7c29bc3fb96f1e23d98f664e786dddd53a1599f56431b9b7fdfba402a4b3705c
 LINUX_KERNEL_HASH-4.14.14 = 8b96362eb55ae152555980e7193fe2585b487176fb936cc69b8947d7dd32044a
 
+remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
+sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
+
+ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
+  LINUX_VERSION:=$(call sanitize_uri,$(call remove_uri_prefix,$(CONFIG_KERNEL_GIT_CLONE_URI)))
+  ifeq ($(call qstrip,$(CONFIG_KERNEL_GIT_REF)),)
+    CONFIG_KERNEL_GIT_REF:=HEAD
+  endif
+  LINUX_VERSION:=$(LINUX_VERSION)-$(call sanitize_uri,$(CONFIG_KERNEL_GIT_REF))
+else
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
 endif
+endif
 
 split_version=$(subst ., ,$(1))
 merge_version=$(subst $(space),.,$(1))



More information about the lede-commits mailing list