Skip to contentSkip to conversation

.opk packages and rootfs?

PATCH Bernhard Reutner-Fischer 2 participants 2 messages Jan 3, 2011 – Jan 4, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

As ipkg-utils doesn't download for me anymore i was wondering about the status of packaged-staging and how to use it (must be documented somewhere, i must be blind or something as i can't seem to find it).

Are there any plans to move to opkg?

For reference, i'm attaching an initial idea (*NOT* a patch) for using opkg to package staging and for use as online-package manager for the roofs. It is heavily based on the existing ipkg classes, as you can see. I'm aware that the dependecy-handling in both base and the opkg-utils recipe would need major fixing (help on that would be very welcome).

$ diffstat -up1 not-an-opkg.opk-patch.diff
 classes/base.bbclass                                    |   14 
 classes/package_opk.bbclass                             |  317 ++++++++++++++++
 classes/packaged-staging.bbclass                        |   38 +
 classes/rootfs_opk.bbclass                              |   95 ++++
 conf/bitbake.conf                                       |    2 
 conf/distro/include/sane-feed-opk.inc                   |    4 
 conf/distro/micro-uclibc.conf                           |    1 
 conf/distro/micro.conf                                  |    2 
 recipes/opkg-utils/opkg-utils_svn.bb                    |   27 +
 recipes/opkg/opkg.inc                                   |    2 
 recipes/stage-manager/stagemanager-ipkg-native_0.0.1.bb |   11 
 recipes/stage-manager/stagemanager-native.inc           |   19 
 recipes/stage-manager/stagemanager-native_0.0.1.bb      |   27 -
 13 files changed, 515 insertions(+), 44 deletions(-)
classes/base.bbclass +10 -4
index c76b77d..644a707 100644
@@ -63,8 +63,11 @@ def base_deps(d):
 	# that case though.
 	#
 	deps = "coreutils-native"
-	if bb.data.getVar('PN', d, True) in ("shasum-native", "stagemanager-native",
-	                                     "coreutils-native"):
+	pn = bb.data.getVar('PN', d, True)
+	if pn in ("shasum-native", "stagemanager-native",
+                                         "stagemanager-ipkg-native",
+                                         "opkg-utils-native", "opkg-utils",
+                                         "coreutils-native"):
 		deps = ""
 
 	# INHIBIT_DEFAULT_DEPS doesn't apply to the patch command.  Whether or  not
@@ -75,10 +78,13 @@ def base_deps(d):
 	     	    bb.data.getVar('BUILD_SYS', d, 1)):
 			deps += " virtual/${TARGET_PREFIX}gcc virtual/libc "
 		elif bb.data.inherits_class('native', d) and \
-				bb.data.getVar('PN', d, True) not in \
+				pn not in \
 				("linux-libc-headers-native", "quilt-native",
 				 "unifdef-native", "shasum-native",
-				 "stagemanager-native", "coreutils-native"):
+				 "stagemanager-native",
+				 "stagemanager-ipkg-native",
+				 "opkg-utils-native", "opkg-utils",
+				 "coreutils-native"):
 			deps += " linux-libc-headers-native"
 	return deps
 
classes/package_opk.bbclass new file +317 -0

317 lines not on this page · raw message

classes/packaged-staging.bbclass +28 -10
index 4eb7a91..6fe0311 100644
@@ -16,7 +16,9 @@ PSTAGE_PKGARCH    = "${PACKAGE_ARCH}-${HOST_OS}"
 PSTAGE_EXTRAPATH  ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/"
 PSTAGE_PKGPATH    = "${DISTRO}${PSTAGE_EXTRAPATH}"
 PSTAGE_PKGPN      = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}"
-PSTAGE_PKGNAME    = "${PSTAGE_PKGPN}_${PSTAGE_PKGVERSION}_${PSTAGE_PKGARCH}.ipk"
+PSTAGE_PKGTYPE    = "${@['ipk', 'opk'][bb.data.inherits_class('package_opk', d)]}"
+PSTAGE_PKGTOOL    = "${PSTAGE_PKGTYPE}g"
+PSTAGE_PKGNAME    = "${PSTAGE_PKGPN}_${PSTAGE_PKGVERSION}_${PSTAGE_PKGARCH}.${PSTAGE_PKGTYPE}"
 PSTAGE_PKG        = "${PSTAGE_DIR}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}"
 PSTAGE_WORKDIR   = "${TMPDIR}/pstage"
 PSTAGE_SCAN_CMD ?= "find ${PSTAGE_TMPDIR_STAGE} \( -name "*.la" -o -name "*-config" \) -type f"
@@ -25,6 +27,7 @@ PSTAGE_NATIVEDEPENDS = "\
     shasum-native \
     stagemanager-native \
     "
+PSTAGE_NATIVEDEPENDS += "${@['stagemanager-ipkg-native', 'opkg-utils-native'][bb.data.inherits_class('package_opk', d)]}"
 
 BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}"
 
@@ -80,7 +83,7 @@ python __anonymous() {
         bb.data.setVarFlag('do_setscene', 'depends', deps, d)
 
         policy = bb.data.getVar("BB_STAMP_POLICY", d, True)
-        if policy == "whitelist" or policy == "full":
+        if policy in ["whitelist", "full"]:
            deps = bb.data.getVarFlag('do_setscene', 'recrdeptask', d) or ""
            deps += " do_setscene"
            bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d)
@@ -92,9 +95,7 @@ python __anonymous() {
 
 PSTAGE_MACHCONFIG   = "${PSTAGE_WORKDIR}/opkg.conf"
 
-PSTAGE_PKGMANAGER = "stage-manager-ipkg"
-
-PSTAGE_BUILD_CMD        = "stage-manager-ipkg-build -o 0 -g 0"
+PSTAGE_BUILD_CMD = "${@['stage-manager-ipkg-build -o 0 -g 0', 'opkg-build -o 0 -g 0 -O'][bb.data.inherits_class('package_opk', d)]}"
 PSTAGE_INSTALL_CMD      = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -force-depends -o ${TMPDIR} install"
 PSTAGE_UPDATE_CMD       = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR} update"
 PSTAGE_REMOVE_CMD       = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -force-depends -o ${TMPDIR} remove"
@@ -115,14 +116,21 @@ def pstage_manualclean(srcname, destvarname, d):
 			filepath = os.path.join(walkroot, file).replace(src, dest)
 			oe.path.remove(filepath)
 
-def pstage_set_pkgmanager(d):
+def pstage_set_pkgmanager_XXXX(d):
     path = bb.data.getVar("PATH", d, 1)
-    pkgmanager = bb.which(path, 'opkg-cl')
-    if pkgmanager == "":
+    pkg_type = bb.data.getVar("PSTAGE_PKGTYPE", d, True)
+    pkgmanager = ""
+    if pkg_type == "opk":
+        pkgmanager = bb.which(path, 'opkg-cl')
+    elif pkg_type == "ipk":
         pkgmanager = bb.which(path, 'ipkg-cl')
     if pkgmanager != "":
         bb.data.setVar("PSTAGE_PKGMANAGER", pkgmanager, d)
 
+def pstage_set_pkgmanager(d):
+    pkg_type = bb.data.getVar("PSTAGE_PKGTYPE", d, True)
+    if pkg_type in ("opk", "ipk"):
+        bb.data.setVar("PSTAGE_PKGMANAGER", pkg_type + "g-cl", d)
 
 def pstage_cleanpackage(pkgname, d):
     pstage_set_pkgmanager(d)
@@ -176,7 +184,7 @@ staging_helper () {
 	if [ ! -e ${TMPDIR}${libdir_native}/opkg/info/ ]; then
 		mkdir -p ${TMPDIR}${libdir_native}/opkg/info/
 	fi
- 	if [ ! -e ${TMPDIR}${libdir_native}/ipkg/ ]; then
+ 	if [ "${PSTAGE_PKGTOOL}" != "opkg" ] && [ ! -e ${TMPDIR}${libdir_native}/ipkg/ ]; then
 		ln -sf opkg/ ${TMPDIR}${libdir_native}/ipkg || true
 	fi
 }
@@ -202,7 +210,7 @@ def staging_fetch(stagepkg, d):
         except:
             return
 
-PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_locales compile sizecheck install deploy package populate_sysroot package_write_deb package_write_ipk package_write package_stage qa_staging"
+PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_locales compile sizecheck install deploy package populate_sysroot package_write_deb package_write_${PSTAGE_PKGTYPE} package_write package_stage qa_staging"
 
 SCENEFUNCS += "packagestage_scenefunc"
 
@@ -437,6 +445,8 @@ python do_package_stage () {
     tmpdir = bb.data.getVar("TMPDIR", d, True)
     packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
     if len(packages) > 0:
+        if bb.data.inherits_class('package_opk', d):
+            opkpath = bb.data.getVar('DEPLOY_DIR_OPK', d, True).replace(tmpdir, stagepath)
         if bb.data.inherits_class('package_ipk', d):
             ipkpath = bb.data.getVar('DEPLOY_DIR_IPK', d, True).replace(tmpdir, stagepath)
         if bb.data.inherits_class('package_deb', d):
@@ -456,6 +466,14 @@ python do_package_stage () {
                 pr = bb.data.getVar('PR', d, 1)
             if not oe.packagedata.packaged(pkg, d):
                 continue
+            if bb.data.inherits_class('package_opk', d):
+                srcname = bb.data.expand(pkgname + "_${PKGV}-" + pr + "${DISTRO_PR}" + "_" + arch + ".opk", d)
+                srcfile = bb.data.expand("${DEPLOY_DIR_OPK}/" + arch + "/" + srcname, d)
+                if os.path.exists(srcfile):
+                    destpath = opkpath + "/" + arch + "/"
+                    bb.mkdirhier(destpath)
+                    bb.copyfile(srcfile, destpath + srcname)
+
             if bb.data.inherits_class('package_ipk', d):
                 srcname = bb.data.expand(pkgname + "_${PKGV}-" + pr + "${DISTRO_PR}" + "_" + arch + ".ipk", d)
                 srcfile = bb.data.expand("${DEPLOY_DIR_IPK}/" + arch + "/" + srcname, d)
classes/rootfs_opk.bbclass new file +95 -0

95 lines not on this page · raw message

conf/bitbake.conf +2 -0
index 17b9b28..12019b0 100644
@@ -342,6 +342,7 @@ STAGING_DIR_SDK = "${STAGING_DIR}/${SDK_SYS}"
 DEPLOY_DIR ?= "${TMPDIR}/deploy"
 DEPLOY_DIR_TAR = "${DEPLOY_DIR}/tar"
 DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk"
+DEPLOY_DIR_OPK = "${DEPLOY_DIR}/opk"
 DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm"
 DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb"
 DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images"
@@ -657,6 +658,7 @@ export PATCH_GET="0"
 # Program to be used to build ipkg packages
 
 IPKGBUILDCMD = "ipkg-build -o 0 -g 0"
+OPKGBUILDCMD = "opkg-build -o 0 -g 0 -O"
 
 ##################################################################
 # Not sure about the rest of this yet.
conf/distro/include/sane-feed-opk.inc new file +4 -0
new file mode 100644
index 0000000..90b276b
@@ -0,0 +1,4 @@
+INHERIT += "package_opk"
+
+PREFERRED_PROVIDER_virtual/update-alternatives-native ?= "opkg-native"
+PREFERRED_PROVIDER_virtual/update-alternatives ?= ${PREFERRED_PROVIDER_opkg}
conf/distro/micro-uclibc.conf +1 -0
index 85ea9b3..14ba506 100644
@@ -12,6 +12,7 @@
 #############################################################################
 
 DISTRO_NAME = "micro-uclibc"
+PREFERRED_PKG_FORMAT = "opk"
 
 #############################################################################
 # TOOLCHAIN
conf/distro/micro.conf +1 -1
index 102afa1..f12b436 100644
@@ -31,7 +31,7 @@ INHERIT += "debian"
 # PACKAGING & FEEDS
 #############################################################################
 # Select packaging system
-PREFERRED_PKG_FORMAT = "ipk"
+PREFERRED_PKG_FORMAT ?= "ipk"
 IPKG_VARIANT = "opkg"
 
 require conf/distro/include/sane-feed.inc
recipes/opkg-utils/opkg-utils_svn.bb +22 -5
index 4634690..6804dac 100644
@@ -2,11 +2,21 @@ DESCRIPTION = "OPKG Package Manager Utilities"
 SECTION = "base"
 PRIORITY = "optional"
 LICENSE = "GPL"
-RDEPENDS_${PN} = "python"
-RDEPENDS_virtclass-native = ""
-SRCREV = "4595"
+#trips loop :( INHIBIT_DEFAULT_DEPS_virtclass-native = "1"
+#trips loop :( INHIBIT_AUTOTOOLS_DEPS_virtclass-native = "1"
+INHIBIT_DEFAULT_DEPS = "1"
+INHIBIT_AUTOTOOLS_DEPS = "1"
+
+#INHIBIT_DEFAULT_DEPS_virtclass-native = "1"
+#INHIBIT_AUTOTOOLS_DEPS_virtclass-native = "1"
+
+#PATCHDEPENDENCY_virtclass-native = ""
+#PSTAGING_DISABLED_virtclass-native = "1"
+#DEPENDS_virtclass-native = ""
+
+SRCREV = "5997"
 PV = "0.0+svnr${SRCPV}"
-PR = "r5"
+PR = "r8"
 
 BBCLASSEXTEND = "native"
 
@@ -15,4 +25,11 @@ SRC_URI = "svn://svn.openmoko.org/trunk/src/host/;module=opkg-utils;proto=http"
 TARGET_CC_ARCH += "${LDFLAGS}"
 S = "${WORKDIR}/opkg-utils"
 
-inherit autotools
+do_install() {
+  oe_runmake PREFIX= DESTDIR="${D}" install
+}
+#inherit autotools
+
+PACKAGES =+ "opkg-utils-arfile"
+FILES_opkg-utils-arfile = "${base_bindir}/arfile.py"
+RDEPENDS_opkg-utils-arfile = "python"
recipes/opkg/opkg.inc +1 -1
index cdfbef8..89fa51e 100644
@@ -5,7 +5,7 @@ LICENSE = "GPLv2"
 SRCREV = "596"
 PV = "0.1.8+svnr${SRCPV}"
 CONFLICTS = "ipkg"
-INC_PR = "r3"
+INC_PR = "r4"
 
 SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;proto=http \
 	   file://configure \
recipes/stage-manager/stagemanager-ipkg-native_0.0.1.bb new file +11 -0
new file mode 100644
index 0000000..2281513
@@ -0,0 +1,11 @@
+require stagemanager-native.inc
+PR = "${INC_PR}.0"
+
+SRC_URI_append = "file://stage-manager-ipkg \
+                  file://stage-manager-ipkg-build "
+
+do_install_append() {
+	install -D ${STAGING_BINDIR}
+	install -m 0755 ${WORKDIR}/stage-manager-ipkg \
+			${WORKDIR}/stage-manager-ipkg-build ${STAGING_BINDIR}
+}
recipes/stage-manager/stagemanager-native.inc new file +19 -0
new file mode 100644
index 0000000..0720e08
@@ -0,0 +1,19 @@
+DESCRIPTION = "Helper script for packaged-staging.bbclass"
+INC_PR = "r16"
+
+SRC_URI = "file://stage-manager "
+LICENSE = "GPLv2"
+
+PACKAGE_ARCH = "all"
+
+inherit native
+
+DEPENDS = ""
+PACKAGE_DEPENDS = ""
+PATCHDEPENDENCY = ""
+INHIBIT_DEFAULT_DEPS = "1"
+
+PSTAGING_DISABLED = "1"
+
+NATIVE_INSTALL_WORKS = "1"
+
recipes/stage-manager/stagemanager-native_0.0.1.bb +4 -23
index 9577749..ae52d79 100644
@@ -1,26 +1,7 @@
-DESCRIPTION = "Helper script for packaged-staging.bbclass"
-PR = "r15"
+require stagemanager-native.inc
+PR = "${INC_PR}"
+DEPENDS += "${@['stagemanager-ipkg-native', 'opkg-utils-native'][bb.data.inherits_class('package_opk', d)]}"
 
-SRC_URI = "file://stage-manager \
-           file://stage-manager-ipkg \
-           file://stage-manager-ipkg-build "
-LICENSE = "GPLv2"
-
-PACKAGE_ARCH = "all"
-
-inherit native
-
-DEPENDS = " "
-PACKAGE_DEPENDS = " "
-PATCHDEPENDENCY = ""
-INHIBIT_DEFAULT_DEPS = "1"
-
-PSTAGING_DISABLED = "1"
-
-NATIVE_INSTALL_WORKS = "1"
 do_install() {
-	install -d ${STAGING_BINDIR}
-	install -m 0755 ${WORKDIR}/stage-manager ${STAGING_BINDIR}
-	install -m 0755 ${WORKDIR}/stage-manager-ipkg ${STAGING_BINDIR}
-	install -m 0755 ${WORKDIR}/stage-manager-ipkg-build ${STAGING_BINDIR}
+	install -D -m 0755 ${WORKDIR}/stage-manager ${STAGING_BINDIR}/stage-manager
 }
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Bernhard Reutner-Fischer

Hi,

As ipkg-utils doesn't download for me anymore i was wondering about the status of packaged-staging and how to use it (must be documented somewhere, i must be blind or something as i can't seem to find it).

Are there any plans to move to opkg?

Not sure what you are doing, but over here (when using angstrom) packaged-staging is already using opkg-cl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFNIxzAMkyGM64RGpERArKeAJ4gENfc8f/4c2dKLF+VYYxTK/XKUQCeLMid XzEDIhxo/Sx0PLaKcRluGKc=
=TIt5
-----END PGP SIGNATURE-----