[meta-oe,v3] net-tools: split into binary packages

Submitted by Sinan Kaya on Dec. 1, 2020, 3:34 a.m. | Patch ID: 178746

Details

Message ID 20201201033449.8961-1-okaya@kernel.org
State New
Headers show

Commit Message

Sinan Kaya Dec. 1, 2020, 3:34 a.m.
Support per binary package to not bloat the system with unneeded
tools.

Signed-off-by: Sinan Kaya <okaya@kernel.org>

---
 .../net-tools/net-tools_1.60-20181103.bb      | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

-- 
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#145107): https://lists.openembedded.org/g/openembedded-core/message/145107
Mute This Topic: https://lists.openembedded.org/mt/78625904/1003190
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mhalstead@linuxfoundation.org]
-=-=-=-=-=-=-=-=-=-=-=-

Patch hide | download patch | download mbox

diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb b/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb
index e97731073e8..63a3ccbe516 100644
--- a/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb
+++ b/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb
@@ -93,7 +93,7 @@  base_bindir_progs  = "ifconfig netstat route \
     ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'dnsdomainname domainname hostname nisdomainname ypdomainname', '', d)} \
 "
 
-ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
+ALTERNATIVE_${PN} = ""
 ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'hostname.1 dnsdomainname.1', '', d)}"
 ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
 ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
@@ -107,4 +107,31 @@  python __anonymous() {
 }
 ALTERNATIVE_PRIORITY = "100"
 
+python __anonymous () {
+    packages = []
+    for prog in d.getVar('base_sbindir_progs').split():
+        pkg = "net-tools-%s" % prog.replace("_", "-")
+        packages.append(pkg)
+        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))
+        if not d.getVar("FILES_%s" % pkg):
+                d.setVar("FILES_%s" % pkg, "${base_sbindir}/%s*" % prog)
+    for prog in d.getVar('base_bindir_progs').split():
+        pkg = "net-tools-%s" % prog.replace("_", "-")
+        packages.append(pkg)
+        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))
+        if not d.getVar("FILES_%s" % pkg):
+                d.setVar("FILES_%s" % pkg, "${base_bindir}/%s*" % prog)
+    pkg = "net-tools-man"
+    packages.append(pkg)
+    if not d.getVar("FILES_%s" % pkg):
+            d.setVar("FILES_%s" % pkg, "${mandir}/*")
+    d.setVar("NETTOOLS_PACKAGES", " ".join(packages))
+}
+# "net-tools" is a metapackage which pulls in all net-tools binaries
+PACKAGES += "${NETTOOLS_PACKAGES}"
+PROVIDES += "${NETTOOLS_PACKAGES}"
+FILES_${PN} = ""
+ALLOW_EMPTY_${PN} = "1"
+RRECOMMENDS_${PN} += "${NETTOOLS_PACKAGES}"
+
 BBCLASSEXTEND = "native nativesdk"

Comments

Aníbal Limón Dec. 3, 2020, 3:40 p.m.
This patch causes problems in multilib configurations,

http://errors.yoctoproject.org/Errors/Details/539019/

Regards,
Anibal

On Mon, 30 Nov 2020 at 21:35, Sinan Kaya <okaya@kernel.org> wrote:

> Support per binary package to not bloat the system with unneeded

> tools.

>

> Signed-off-by: Sinan Kaya <okaya@kernel.org>

> ---

>  .../net-tools/net-tools_1.60-20181103.bb      | 29 ++++++++++++++++++-

>  1 file changed, 28 insertions(+), 1 deletion(-)

>

> diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb

> b/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb

> index e97731073e8..63a3ccbe516 100644

> --- a/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb

> +++ b/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb

> @@ -93,7 +93,7 @@ base_bindir_progs  = "ifconfig netstat route \

>      ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'dnsdomainname

> domainname hostname nisdomainname ypdomainname', '', d)} \

>  "

>

> -ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"

> +ALTERNATIVE_${PN} = ""

>  ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG',

> 'hostname', 'hostname.1 dnsdomainname.1', '', d)}"

>  ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"

>  ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"

> @@ -107,4 +107,31 @@ python __anonymous() {

>  }

>  ALTERNATIVE_PRIORITY = "100"

>

> +python __anonymous () {

> +    packages = []

> +    for prog in d.getVar('base_sbindir_progs').split():

> +        pkg = "net-tools-%s" % prog.replace("_", "-")

> +        packages.append(pkg)

> +        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))

> +        if not d.getVar("FILES_%s" % pkg):

> +                d.setVar("FILES_%s" % pkg, "${base_sbindir}/%s*" % prog)

> +    for prog in d.getVar('base_bindir_progs').split():

> +        pkg = "net-tools-%s" % prog.replace("_", "-")

> +        packages.append(pkg)

> +        d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))

> +        if not d.getVar("FILES_%s" % pkg):

> +                d.setVar("FILES_%s" % pkg, "${base_bindir}/%s*" % prog)

> +    pkg = "net-tools-man"

> +    packages.append(pkg)

> +    if not d.getVar("FILES_%s" % pkg):

> +            d.setVar("FILES_%s" % pkg, "${mandir}/*")

> +    d.setVar("NETTOOLS_PACKAGES", " ".join(packages))

> +}

> +# "net-tools" is a metapackage which pulls in all net-tools binaries

> +PACKAGES += "${NETTOOLS_PACKAGES}"

> +PROVIDES += "${NETTOOLS_PACKAGES}"

> +FILES_${PN} = ""

> +ALLOW_EMPTY_${PN} = "1"

> +RRECOMMENDS_${PN} += "${NETTOOLS_PACKAGES}"

> +

>  BBCLASSEXTEND = "native nativesdk"

> --

> 2.17.1

>

>

> 

>

>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#145239): https://lists.openembedded.org/g/openembedded-core/message/145239
Mute This Topic: https://lists.openembedded.org/mt/78625904/1003190
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mhalstead@linuxfoundation.org]
-=-=-=-=-=-=-=-=-=-=-=-
Sinan Kaya Dec. 3, 2020, 5:02 p.m.
On 12/3/2020 10:40 AM, Anibal Limon wrote:
> This patch causes problems in multilib configurations,

> 

> http://errors.yoctoproject.org/Errors/Details/539019/

> <http://errors.yoctoproject.org/Errors/Details/539019/>

> 


Thanks for the report, I'll take a look.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#145242): https://lists.openembedded.org/g/openembedded-core/message/145242
Mute This Topic: https://lists.openembedded.org/mt/78625904/3616849
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [michael@yoctoproject.org]
-=-=-=-=-=-=-=-=-=-=-=-