From: Chris Conroy <Chris.Conroy@hillcrestlabs.com>
To: OE-Dev <openembedded-devel@lists.openembedded.org>
Subject: interest in binary packaging?
Date: Thu, 17 Sep 2009 18:20:07 -0400 [thread overview]
Message-ID: <1253226007.1495.264.camel@conroy-linux> (raw)
[-- Attachment #1: Type: text/plain, Size: 1817 bytes --]
I've developed a rather simplistic method for managing "binary" packages
within OE in order to satisfy certain licensing requirements. I am not
sure whether other users would have an interest in such a system, but
I'll go ahead and pitch what I have working so far to see if there is
any interest in improving it further or merging upstream.
Problem: Some packages we maintain internally are proprietary, and we
need mechanisms for dealing with different licensing schemes.
Approach: Allow third parties to build images using the packages but
without seeing source.
Solution: binary_ipk.bbclass defines a type of package which simply
installs a prebuilt .ipk for use in an image.
Also, for ease of deployment, I've added a flag to the standard
package_ipk.bbclass which will copy relevant packages into the WORKDIR
for a 'binreleasable' package.
The result is a developer with access to the code builds package FOO out
of the overlay and deploys the WORKDIR/binrelease .ipks onto a mirror.
Another developer without access to the code uses the FOO-bin recipe
which inherits the binary_ipk.bbclass. It pulls the ipk from the mirror
and tells OE about any runtime dependencies of the package.
A simple binary recipe looks like this (I'll just put it inline since
it's so short)
####################EXAMPLE FOO BINARY RECIPE
inherit binary_ipk
DESCRIPTION = "FOO"
HOMEPAGE = ""
LICENSE = "FOO License"
RPROVIDES += "foo"
RDEPENDS += "bar"
BIN_PR = "r21"
SRC_URI = "${FOO_MIRROR}/foo-bin/foo_${PV}-${BIN_PR}_
${PACKAGE_ARCH}.ipk"
############END EXAMPLE
Perhaps there is a smarter way to do this with ipkg feeds, but I saw no
clear route to get here using them.
Thoughts, comments, questions, patches, etc... are all welcomed.
--Chris Conroy
[-- Attachment #2: binary_packaging.patch --]
[-- Type: text/x-patch, Size: 2691 bytes --]
diff --git a/classes/binary_ipk.bbclass b/classes/binary_ipk.bbclass
new file mode 100644
index 0000000..8cb1eb3
--- /dev/null
+++ b/classes/binary_ipk.bbclass
@@ -0,0 +1,56 @@
+### A class for installing prebuilt packages
+
+inherit package_ipk
+
+PACKAGES="${PN}"
+
+do_configure() {
+ :
+}
+do_compile() {
+ :
+}
+do_stage() {
+ :
+}
+do_install() {
+ :
+}
+do_populate_staging() {
+ :
+}
+do_install() {
+ :
+}
+
+python do_package_ipk() {
+ import sys, bb, os, re, glob
+
+ outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, 1)
+ if not outdir:
+ bb.error("DEPLOY_DIR_IPK not defined, unable to package")
+ return
+
+ tmpdir = bb.data.getVar('TMPDIR', d, 1)
+ if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK):
+ os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"))
+
+
+ path = bb.data.getVar('PATH', d, 1)
+ workdir = bb.data.getVar('WORKDIR', d, 1)
+ packages = glob.glob("%s/*.ipk" % (workdir))
+
+ for pkg in packages:
+ ipkgPipe = os.popen("PATH=%s ipkg-list-fields %s | grep \"Architecture\" | cut -d \' \' -sf2" % (path, pkg))
+ arch = ipkgPipe.readline()
+ bb.debug(1, "PKG %s, ARCH %s" % (pkg, arch))
+ ipkgPipe.close()
+ if arch == '' or arch == None:
+ bb.fatal("Unable to read architecture from %s" % (pkg))
+
+ pkgoutdir = "%s/%s" % (outdir, arch)
+
+ bb.note("Installing %s into %s" % (pkg, pkgoutdir))
+ os.system("cp %s %s" % (pkg, pkgoutdir))
+}
+
diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass
index e556108..853da21 100644
--- a/classes/package_ipk.bbclass
+++ b/classes/package_ipk.bbclass
@@ -302,6 +302,21 @@ python do_package_ipk () {
bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("ipkg-build execution failed")
+ #for binary packaging, a release package will also install into its WORKDIR
+ binrelease = bb.data.getVar("BINRELEASE", d, 1)
+ if binrelease == '1':
+ bindir = "%s/binrelease" % (workdir)
+ bb.mkdirhier(bindir)
+ ret = os.system("PATH=\"%s\" %s %s %s" % (bb.data.getVar("PATH", localdata, 1), bb.data.getVar("IPKGBUILDCMD",d,1), pkg, bindir))
+
+ #Don't binrelease dbg/dev/doc packages
+ todelPkgs = glob("%s/*-dbg*.ipk" % (bindir))
+ todelPkgs.extend(glob("%s/*-dev*.ipk" % (bindir)))
+ todelPkgs.extend(glob("%s/*-doc*.ipk" % (bindir)))
+ for todel in todelPkgs:
+ bb.debug(1, "Uninstalling %s for binrelease" % (todel))
+ os.system("rm -f %s" % (todel))
+
bb.utils.prunedir(controldir)
bb.utils.unlockfile(lf)
}
next reply other threads:[~2009-09-17 22:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-17 22:20 Chris Conroy [this message]
2009-09-24 19:52 ` interest in binary packaging? Tom Rini
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=1253226007.1495.264.camel@conroy-linux \
--to=chris.conroy@hillcrestlabs.com \
--cc=openembedded-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.