kni: avoid using lsb_release script
PATCH 1/1 kni: avoid using lsb_release script
The lsb_release script is part of an optional package which is not always installed. On the other hand, /etc/lsb-release is always present even on minimal Ubuntu installations.
root@ubuntu1604:~# dpkg -S /etc/lsb-release
base-files: /etc/lsb-releaseRead the file if present and use the variables defined in it.
--- lib/librte_eal/linuxapp/kni/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/kni/Makefile +6 -2
@@ -44,8 +44,12 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h MODULE_CFLAGS += -Wall -Werror -ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu) -MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .) +ifneq ($(wildcard /etc/lsb-release),) +include /etc/lsb-release +endif + +ifeq ($(DISTRIB_ID),Ubuntu) +MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(subst .,,$(DISTRIB_ID)) UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/generated/utsrelease.h \ | cut -d '"' -f2 | cut -d- -f1,2 | tr .- ,`,1) MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
Signature · 1 line
2.1.4
Quoted 19 lines · Robin Jarry
The
lsb_releasescript is part of an optional package which is not always installed. On the other hand,/etc/lsb-releaseis always present even on minimal Ubuntu installations.root@ubuntu1604:~# dpkg -S /etc/lsb-release base-files: /etc/lsb-releaseRead the file if present and use the variables defined in it.
Signed-off-by Robin Jarry <[email protected]>--- lib/librte_eal/linuxapp/kni/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)lib/librte_eal/linuxapp/kni/Makefile +0
-0
lib/librte_eal/linuxapp/kni/Makefile MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e · line 49
Quoted 8 lines
lib/librte_eal/linuxapp/kni/Makefile +3
-2@@ -44,8 +44,12 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h MODULE_CFLAGS += -Wall -Werror -ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu) -MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .) +ifneq ($(wildcard /etc/lsb-release),) +include /etc/lsb-release +endif
What about:
+-include /etc/lsb-release
lib/librte_eal/linuxapp/kni/Makefile MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e · line 52
Quoted 3 lines
lib/librte_eal/linuxapp/kni/Makefile +3
-0+ +ifeq ($(DISTRIB_ID),Ubuntu) +MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(subst .,,$(DISTRIB_ID))
s/DISTRIB_ID/DISTRIB_RELEASE
Quoted 4 lines
lib/librte_eal/linuxapp/kni/Makefile +0
-0UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/generated/utsrelease.h \ | cut -d '"' -f2 | cut -d- -f1,2 | tr .- ,`,1) MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
2016-11-25, Ferruh Yigit:
Quoted 2 lines
What about:
+-include/etc/lsb-release
Sure, that cannot hurt.
Quoted 1 line
s/DISTRIB_ID/DISTRIB_RELEASE
Oops last minute typo... I'll submit a v2 right away.
Signature · 1 line
Robin