From: "Sinan Kaya" <okaya@kernel.org>
To: openembedded-core@lists.openembedded.org
Cc: Sinan Kaya <okaya@kernel.org>
Subject: [meta-oe][PATCH v4 1/3] introduce lib_subpackage
Date: Thu, 3 Dec 2020 23:28:24 +0000 [thread overview]
Message-ID: <20201203232826.28519-1-okaya@kernel.org> (raw)
This subclass allows us to easily split a recipe into
subpackages.
Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
meta/classes/lib_subpackage.bbclass | 40 +++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 meta/classes/lib_subpackage.bbclass
diff --git a/meta/classes/lib_subpackage.bbclass b/meta/classes/lib_subpackage.bbclass
new file mode 100644
index 00000000000..a0c3d2446c7
--- /dev/null
+++ b/meta/classes/lib_subpackage.bbclass
@@ -0,0 +1,40 @@
+python __anonymous() {
+ packages = []
+
+ variables = [ ("base_sbindir_progs", "base_sbindir"),
+ ("base_bindir_progs", "base_bindir"),
+ ("bindir_progs", "bindir"),
+ ("sbindir_progs", "sbindir"),
+ ]
+
+ for v in variables:
+ if d.getVar(v[0]) is None:
+ continue
+ for prog in d.getVar(v[0]).split():
+ pkg = "%s-%s" % (d.getVar("PN"), prog.replace("_", "-"))
+ packages.append(pkg)
+
+ # set alternatives
+ d.setVar("ALTERNATIVE_%s" % pkg, prog.replace("_", "-"))
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar(v[1]), prog))
+
+ d.setVar("RDEPENDS_%s" % pkg, "%s-lib" % d.getVar("PN"))
+ d.appendVar("FILES_%s" % pkg, " ${%s}/%s.%s" % (v[1], prog, d.getVar("BPN")))
+
+ pkg = "%s-man" % (d.getVar("PN"))
+ packages.append(pkg)
+ d.appendVar("FILES_%s" % pkg, " ${mandir}/*")
+
+ pkg = "%s-lib" % (d.getVar("PN"))
+ packages.append(pkg)
+ d.appendVar("FILES_%s" % pkg, " ${libdir}/*")
+
+ d.setVar("LIB_SUBPACKAGES_%s" % d.getVar("PN"), " ".join(packages))
+
+ d.setVar("FILES_%s" % d.getVar("PN"), "")
+ d.setVar("ALTERNATIVE_%s" % d.getVar("PN"), "")
+ d.setVar("ALLOW_EMPTY_%s" % d.getVar("PN"), "1")
+ d.appendVar("PACKAGES", " " + " ".join(packages))
+ d.appendVar("PROVIDES", " " + " ".join(packages))
+ d.appendVar("RRECOMMENDS_%s" % d.getVar("PN"), " " + " ".join(packages))
+}
--
2.17.1
next reply other threads:[~2020-12-03 23:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 23:28 Sinan Kaya [this message]
2020-12-03 23:28 ` [meta-oe][PATCH v4 2/3] net-tools: split into binary packages Sinan Kaya
2020-12-03 23:28 ` [meta-oe][PATCH v4 3/3] procps: split into binary subpackages Sinan Kaya
2020-12-04 11:01 ` [OE-core] [meta-oe][PATCH v4 1/3] introduce lib_subpackage Phil Blundell
2020-12-04 13:30 ` Sinan Kaya
2020-12-05 22:23 ` Phil Blundell
2020-12-06 0:54 ` Sinan Kaya
[not found] ` <164DFA8489EB0A7A.29396@lists.openembedded.org>
2020-12-09 23:47 ` Sinan Kaya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201203232826.28519-1-okaya@kernel.org \
--to=okaya@kernel.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox