[meta-dpdk][PATCH 1/4] dpdk: move common code to inc

Anuj Mittal <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
Move the common code from both dpdk versions to inc so it's not
duplicated.

Signed-off-by: Anuj Mittal <[email protected]>
---
 recipes-extended/dpdk/dpdk.inc        | 50 ++++++++++++++++++++++++++
 recipes-extended/dpdk/dpdk_23.11.5.bb | 42 ----------------------
 recipes-extended/dpdk/dpdk_25.11.0.bb | 52 ---------------------------
 3 files changed, 50 insertions(+), 94 deletions(-)

diff --git a/recipes-extended/dpdk/dpdk.inc b/recipes-extended/dpdk/dpdk.inc
index f88ad98..0a947fc 100644
--- a/recipes-extended/dpdk/dpdk.inc
+++ b/recipes-extended/dpdk/dpdk.inc
@@ -9,4 +9,54 @@ LIC_FILES_CHKSUM = "file://license/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4
 SRC_URI = "git://dpdk.org/git/dpdk${STABLE};protocol=https;branch=${BRANCH};tag=v${PV} \
 "
 
+def get_cpu_instruction_set(bb, d):
+    import re
+    march = re.search(r'-march=([^\s]*)', d.getVar('CC'))
+    if march:
+        return march.group(1)
+    else:
+        return "core2"
+
+EXTRA_OEMESON = " -Dexamples=all -Dcpu_instruction_set=${@get_cpu_instruction_set(bb, d)}"
+EXTRA_OEMESON:append:class-target = " --cross-file ${WORKDIR}/dpdk.cross"
+
+COMPATIBLE_HOST:libc-musl:class-target = "null"
+COMPATIBLE_HOST:linux-gnux32 = "null"
+
+PACKAGECONFIG ??= " "
+PACKAGECONFIG[afxdp] = ",,libbpf xdp-tools"
+PACKAGECONFIG[libvirt] = ",,libvirt"
+
+RDEPENDS:${PN} += "pciutils python3-core"
+RDEPENDS:${PN}-examples += "bash"
+DEPENDS = "numactl python3-pyelftools-native"
+
+inherit meson pkgconfig
+
+INSTALL_PATH = "${prefix}/share/dpdk"
+
+RTE_PLATFORM ?= "generic"
+
+do_write_config:append() {
+    cat >${WORKDIR}/dpdk.cross <<EOF
+[properties]
+platform = '${RTE_PLATFORM}'
+EOF
+}
+
+do_install:append(){
+    # remove  source files
+    rm -rf ${D}/${INSTALL_PATH}/examples/*
+
+    # Install examples
+    install -m 0755 -d ${D}/${INSTALL_PATH}/examples/
+    for dirname in ${B}/examples/dpdk-*
+    do
+        if [ ! -d ${dirname} ] && [ -x ${dirname} ]; then
+            install -m 0755 ${dirname} ${D}/${INSTALL_PATH}/examples/
+        fi
+    done
+
+}
+
 CVE_PRODUCT = "data_plane_development_kit"
diff --git a/recipes-extended/dpdk/dpdk_23.11.5.bb b/recipes-extended/dpdk/dpdk_23.11.5.bb
index aaff7eb..4785e0c 100644
--- a/recipes-extended/dpdk/dpdk_23.11.5.bb
+++ b/recipes-extended/dpdk/dpdk_23.11.5.bb
@@ -7,46 +7,6 @@ STABLE = "-stable"
 BRANCH = "23.11"
 SRCREV = "62f583c49bf67dd4d6733ece14e55fe6839e66d1"
 
-def get_cpu_instruction_set(bb, d):
-    import re
-    march = re.search(r'-march=([^\s]*)', d.getVar('CC'))
-    if march:
-        return march.group(1)
-    else:
-        return "core2"
-
-EXTRA_OEMESON = " -Dexamples=all -Dcpu_instruction_set=${@get_cpu_instruction_set(bb, d)} "
-
-COMPATIBLE_HOST:libc-musl:class-target = "null"
-COMPATIBLE_HOST:linux-gnux32 = "null"
-
-PACKAGECONFIG ??= " "
-PACKAGECONFIG[afxdp] = ",,libbpf xdp-tools"
-PACKAGECONFIG[libvirt] = ",,libvirt"
-
-RDEPENDS:${PN} += "pciutils python3-core"
-RDEPENDS:${PN}-examples += "bash"
-DEPENDS = "numactl python3-pyelftools-native"
-
-inherit meson pkgconfig
-
-INSTALL_PATH = "${prefix}/share/dpdk"
-
-do_install:append(){
-    # remove  source files
-    rm -rf ${D}/${INSTALL_PATH}/examples/*
-
-    # Install examples
-    install -m 0755 -d ${D}/${INSTALL_PATH}/examples/
-    for dirname in ${B}/examples/dpdk-*
-    do
-        if [ ! -d ${dirname} ] && [ -x ${dirname} ]; then
-            install -m 0755 ${dirname} ${D}/${INSTALL_PATH}/examples/
-        fi
-    done
-
-}
-
 PACKAGES =+ "${PN}-examples ${PN}-tools"
 
 FILES:${PN} += " ${bindir}/dpdk-testpmd \
@@ -65,6 +25,4 @@ FILES:${PN}-tools = " \
     ${bindir}/dpdk-*.py \
     "
 
-CVE_PRODUCT = "data_plane_development_kit"
-
 INSANE_SKIP:${PN} = "dev-so"
diff --git a/recipes-extended/dpdk/dpdk_25.11.0.bb b/recipes-extended/dpdk/dpdk_25.11.0.bb
index c2a71d5..d5de179 100644
--- a/recipes-extended/dpdk/dpdk_25.11.0.bb
+++ b/recipes-extended/dpdk/dpdk_25.11.0.bb
@@ -7,56 +7,6 @@ STABLE = "-stable"
 BRANCH = "25.11"
 SRCREV = "ed957165eadbe60a47d5ec223578cdd1c13d0bd9"
 
-def get_cpu_instruction_set(bb, d):
-    import re
-    march = re.search(r'-march=([^\s]*)', d.getVar('CC'))
-    if march:
-        return march.group(1)
-    else:
-        return "core2"
-
-EXTRA_OEMESON = " -Dexamples=all -Dcpu_instruction_set=${@get_cpu_instruction_set(bb, d)} "
-EXTRA_OEMESON:append:class-target = " --cross-file ${WORKDIR}/dpdk.cross"
-
-COMPATIBLE_HOST:libc-musl:class-target = "null"
-COMPATIBLE_HOST:linux-gnux32 = "null"
-
-PACKAGECONFIG ??= " "
-PACKAGECONFIG[afxdp] = ",,libbpf xdp-tools"
-PACKAGECONFIG[libvirt] = ",,libvirt"
-
-RDEPENDS:${PN} += "pciutils python3-core"
-RDEPENDS:${PN}-examples += "bash"
-DEPENDS = "numactl python3-pyelftools-native"
-
-inherit meson pkgconfig
-
-INSTALL_PATH = "${prefix}/share/dpdk"
-
-RTE_PLATFORM ?= "generic"
-
-do_write_config:append() {
-    cat >${WORKDIR}/dpdk.cross <<EOF
-[properties]
-platform = '${RTE_PLATFORM}'
-EOF
-}
-
-do_install:append(){
-    # remove  source files
-    rm -rf ${D}/${INSTALL_PATH}/examples/*
-
-    # Install examples
-    install -m 0755 -d ${D}/${INSTALL_PATH}/examples/
-    for dirname in ${B}/examples/dpdk-*
-    do
-        if [ ! -d ${dirname} ] && [ -x ${dirname} ]; then
-            install -m 0755 ${dirname} ${D}/${INSTALL_PATH}/examples/
-        fi
-    done
-
-}
-
 PACKAGES =+ "${PN}-examples ${PN}-tools"
 
 FILES:${PN} += " ${bindir}/dpdk-testpmd \
@@ -75,6 +25,4 @@ FILES:${PN}-tools = " \
     ${bindir}/dpdk-*.py \
     "
 
-CVE_PRODUCT = "data_plane_development_kit"
-
 INSANE_SKIP:${PN} = "dev-so"
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.