Skip to contentSkip to conversation

kni: avoid using lsb_release script

PATCH Superseded Robin Jarry 3 participants 5 messages Nov 25, 2016 – Dec 7, 2016 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/1 kni: avoid using lsb_release script

In reply to a message not in the archive

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-release

Read 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
index 4e99e07e7aec..62a957ce8534 100644
@@ -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_RELEASE))
 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
#2 lore raw
Quoted 19 lines · Robin Jarry

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-release

Read 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 +0 -0
index 4e99e07e7aec..62a957ce8534 100644

lib/librte_eal/linuxapp/kni/Makefile MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e · line 47

Quoted 6 lines
lib/librte_eal/linuxapp/kni/Makefile +1 -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),)

I mean removing this check completely, and having only below line, do you think does it works that way?

Quoted 9 lines
lib/librte_eal/linuxapp/kni/Makefile +5 -0
+-include /etc/lsb-release
+endif
+
+ifeq ($(DISTRIB_ID),Ubuntu)
+MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(subst .,,$(DISTRIB_RELEASE))
 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))"
#3 lore raw

PATCH v3 1/1 kni: avoid using lsb_release script

In reply to Robin Jarry

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-release

Read the file if present and use the variables defined in it.

---
 lib/librte_eal/linuxapp/kni/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/kni/Makefile +4 -2
index 4e99e07e7aec..1e4756123d0c 100644
@@ -44,8 +44,10 @@ 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 .)
+-include /etc/lsb-release
+
+ifeq ($(DISTRIB_ID),Ubuntu)
+MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(subst .,,$(DISTRIB_RELEASE))
 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
Acked-by on v3 1/1
#4 lore raw
Quoted 10 lines · Robin Jarry

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-release

Read the file if present and use the variables defined in it.

#5 lore raw

2016-11-25 12:24, Ferruh Yigit:

Quoted 5 lines · Robin Jarry
Quoted 4 lines

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.

Quoted 8 lines
Quoted 6 lines
    root@ubuntu1604:~# dpkg -S /etc/lsb-release
    base-files: /etc/lsb-release

Read the file if present and use the variables defined in it.

Applied, thanks