diff options
| author | Holger Freyther <zecke@selfish.org> | 2008-03-22 00:32:21 +0000 |
|---|---|---|
| committer | Holger Freyther <zecke@selfish.org> | 2008-03-22 00:32:21 +0000 |
| commit | 0362af65b95845f571763fa56e6031a8089091fc (patch) | |
| tree | bae11f352af2fc04b16ae6ddae46fc6cb51b36f5 /classes | |
| parent | 2f8d9c7a57e00b9acd7f7ac445b3ee6cd4eba886 (diff) | |
| parent | a4535d80cb60e8eb76cdd2570e76b39eee2332d0 (diff) | |
merge of '4216327dbc55e359d557266da86971e66ff5f595'
and 'd72643015c099d3f2c3ec5c5bb1294365effbe54'
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/autotools.bbclass | 62 | ||||
| -rw-r--r-- | classes/base.bbclass | 20 | ||||
| -rw-r--r-- | classes/cpan.bbclass | 13 | ||||
| -rw-r--r-- | classes/image.bbclass | 6 | ||||
| -rw-r--r-- | classes/insane.bbclass | 20 | ||||
| -rw-r--r-- | classes/native.bbclass | 7 | ||||
| -rw-r--r-- | classes/package.bbclass | 44 | ||||
| -rw-r--r-- | classes/package_deb.bbclass | 18 | ||||
| -rw-r--r-- | classes/package_ipk.bbclass | 29 | ||||
| -rw-r--r-- | classes/packaged-staging.bbclass | 223 | ||||
| -rw-r--r-- | classes/qmake2.bbclass | 2 | ||||
| -rw-r--r-- | classes/qtopia4core.bbclass | 2 | ||||
| -rw-r--r-- | classes/rm_work.bbclass | 4 | ||||
| -rw-r--r-- | classes/rootfs_deb.bbclass | 19 | ||||
| -rw-r--r-- | classes/rootfs_ipk.bbclass | 30 | ||||
| -rw-r--r-- | classes/seppuku.bbclass | 17 | ||||
| -rw-r--r-- | classes/siteinfo.bbclass | 61 | ||||
| -rw-r--r-- | classes/testlab.bbclass | 14 |
18 files changed, 384 insertions, 207 deletions
diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass index 4f3e0b1c4d..1f03825b92 100644 --- a/classes/autotools.bbclass +++ b/classes/autotools.bbclass @@ -1,5 +1,8 @@ inherit base +# use autotools_stage_all for native packages +AUTOTOOLS_NATIVE_STAGE_INSTALL = "1" + def autotools_dep_prepend(d): import bb; @@ -17,7 +20,6 @@ def autotools_dep_prepend(d): deps += 'libtool-native ' if not bb.data.inherits_class('native', d) \ and not bb.data.inherits_class('cross', d) \ - and not bb.data.inherits_class('sdk', d) \ and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1): deps += 'libtool-cross ' @@ -56,6 +58,7 @@ oe_runconf () { --oldincludedir=${oldincludedir} \ --infodir=${infodir} \ --mandir=${mandir} \ + --enable-mainainer-mode \ ${EXTRA_OECONF} \ $@" oenote "Running $cfgcmd..." @@ -162,6 +165,17 @@ autotools_stage_includes() { fi } +autotools_stage_dir() { + from="$1" + to="$2" + # This will remove empty directories so we can ignore them + rmdir "$from" 2> /dev/null || true + if [ -d "$from" ]; then + mkdir -p "$to" + cp -fpPR -t "$to" "$from"/* + fi +} + autotools_stage_all() { if [ "${INHIBIT_AUTO_STAGE}" = "1" ] then @@ -170,26 +184,40 @@ autotools_stage_all() { rm -rf ${STAGE_TEMP} mkdir -p ${STAGE_TEMP} oe_runmake DESTDIR="${STAGE_TEMP}" install - if [ -d ${STAGE_TEMP}/${includedir} ]; then - cp -fpPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR} + autotools_stage_dir ${STAGE_TEMP}/${includedir} ${STAGING_INCDIR} + if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then + autotools_stage_dir ${STAGE_TEMP}/${bindir} ${STAGING_DIR_HOST}${layout_bindir} + autotools_stage_dir ${STAGE_TEMP}/${sbindir} ${STAGING_DIR_HOST}${layout_sbindir} + autotools_stage_dir ${STAGE_TEMP}/${base_bindir} ${STAGING_DIR_HOST}${layout_base_bindir} + autotools_stage_dir ${STAGE_TEMP}/${base_sbindir} ${STAGING_DIR_HOST}${layout_base_sbindir} + autotools_stage_dir ${STAGE_TEMP}/${libexecdir} ${STAGING_DIR_HOST}${layout_libexecdir} fi if [ -d ${STAGE_TEMP}/${libdir} ] then - find ${STAGE_TEMP}/${libdir} -name '*.la' -exec sed -i s,installed=yes,installed=no, {} \; - - for i in ${STAGE_TEMP}/${libdir}/*.la - do - if [ ! -f "$i" ]; then - cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR} - break - fi - oe_libinstall -so $(basename $i .la) ${STAGING_LIBDIR} - done - fi - if [ -d ${STAGE_TEMP}/${datadir}/aclocal ]; then - install -d ${STAGING_DATADIR}/aclocal - cp -fpPR ${STAGE_TEMP}/${datadir}/aclocal/* ${STAGING_DATADIR}/aclocal + olddir=`pwd` + cd ${STAGE_TEMP}/${libdir} + las=$(find . -name \*.la -type f) + cd $olddir + echo "Found la files: $las" + if [ -n "$las" ]; then + # If there are .la files then libtool was used in the + # build, so install them with magic mangling. + for i in $las + do + dir=$(dirname $i) + echo "oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir}" + oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir} + done + else + # Otherwise libtool wasn't used, and lib/ can be copied + # directly. + echo "cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR}" + cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR} + fi fi + rm -rf ${STAGE_TEMP}/${mandir} || true + rm -rf ${STAGE_TEMP}/${infodir} || true + autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR} rm -rf ${STAGE_TEMP} } diff --git a/classes/base.bbclass b/classes/base.bbclass index 615d02d07e..c2ce508538 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -325,6 +325,7 @@ oe_libinstall() { __runcmd rm -f $destpath/$libname.la __runcmd sed -e 's/^installed=yes$/installed=no/' \ -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \ + -e "/^dependency_libs=/s,\([[:space:]']+\)${libdir},\1${STAGING_LIBDIR},g" \ $dotlai >$destpath/$libname.la else __runcmd install -m 0644 $dotlai $destpath/$libname.la @@ -367,6 +368,25 @@ oe_libinstall() { __runcmd cd "$olddir" } +def package_stagefile(file, d): + import bb, os + + if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1": + destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1)) + bb.mkdirhier(os.path.dirname(destfile)) + #print "%s to %s" % (file, destfile) + bb.copyfile(file, destfile) + +package_stagefile_shell() { + if [ "$PSTAGING_ACTIVE" = "1" ]; then + srcfile=$1 + destfile=`echo $srcfile | sed s#${TMPDIR}#${PSTAGE_TMPDIR_STAGE}#` + destdir=`dirname $destfile` + mkdir -p $destdir + cp -dp $srcfile $destfile + fi +} + oe_machinstall() { # Purpose: Install machine dependent files, if available # If not available, check if there is a default diff --git a/classes/cpan.bbclass b/classes/cpan.bbclass index 5a0b4a5c92..506d4c4c81 100644 --- a/classes/cpan.bbclass +++ b/classes/cpan.bbclass @@ -50,7 +50,16 @@ cpan_do_compile () { } cpan_do_install () { - oe_runmake install_vendor + if [ ${@is_target(d)} == "yes" ]; then + oe_runmake install_vendor + fi +} + +cpan_do_stage () { + if [ ${@is_target(d)} == "no" ]; then + oe_runmake install_vendor + fi } + -EXPORT_FUNCTIONS do_configure do_compile do_install +EXPORT_FUNCTIONS do_configure do_compile do_install do_stage diff --git a/classes/image.bbclass b/classes/image.bbclass index 67a3a4fa10..f8d896d813 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -85,8 +85,6 @@ fakeroot do_rootfs () { insert_feed_uris - rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/* - ${IMAGE_PREPROCESS_COMMAND} export TOPDIR=${TOPDIR} @@ -132,7 +130,7 @@ insert_feed_uris () { echo "Added $feed_name feed with URL $feed_uri" # insert new feed-sources - echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf + echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/opkg/${feed_name}-feed.conf done # Allow to use package deploy directory contents as quick devel-testing @@ -142,7 +140,7 @@ insert_feed_uris () { if [ -n "${FEED_DEPLOYDIR_BASE_URI}" ]; then for arch in ${PACKAGE_ARCHS} do - echo "src/gz local-$arch ${FEED_DEPLOYDIR_BASE_URI}/$arch" >> ${IMAGE_ROOTFS}/etc/ipkg/local-$arch-feed.conf + echo "src/gz local-$arch ${FEED_DEPLOYDIR_BASE_URI}/$arch" >> ${IMAGE_ROOTFS}/etc/opkg/local-$arch-feed.conf done fi } diff --git a/classes/insane.bbclass b/classes/insane.bbclass index 5ff49cd65e..1f7c761b47 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -162,7 +162,7 @@ def package_qa_get_elf(path, bits32): # 2 - package depends on debug package # 3 - non dbg contains .so # 4 - wrong architecture -# 5 - .la contains installed=yes +# 5 - .la contains installed=yes or reference to the workdir # 6 - .pc contains reference to /usr/include or workdir # 7 - the desktop file is not valid # 8 - .la contains reference to the workdir @@ -178,7 +178,7 @@ def package_qa_make_fatal_error(error_class, name, path,d): TODO: Load a whitelist of known errors """ - return not error_class in [0, 5, 7, 8] + return not error_class in [0, 5, 7] def package_qa_write_error(error_class, name, path, d): """ @@ -313,9 +313,8 @@ def package_qa_check_desktop(path, name, d): import bb, os sane = True if path.endswith(".desktop"): - validate = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True), \ - 'desktop-file-validate') - output = os.popen("%s %s" % (validate, path)) + output = os.popen("desktop-file-validate %s" % path) + # This only produces output on errors for l in output: sane = package_qa_handle_error(7, l.strip(), name, path, d) @@ -336,11 +335,10 @@ def package_qa_check_staged(path,d): tmpdir = bb.data.getVar('TMPDIR', d, True) workdir = os.path.join(tmpdir, "work") + installed = "installed=yes" if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d): - installed = "installed=no" pkgconfigcheck = workdir else: - installed = "installed=yes" pkgconfigcheck = tmpdir # find all .la and .pc files @@ -351,9 +349,11 @@ def package_qa_check_staged(path,d): path = os.path.join(root,file) if file[-2:] == "la": file_content = open(path).read() - if installed in file_content: - error_msg = "%s failed sanity test (installed) in path %s" % (file,root) - sane = package_qa_handle_error(5, error_msg, "staging", path, d) + # Don't check installed status for native/cross packages + if not bb.data.inherits_class("native", d) and not bb.data.inherits_class("cross", d): + if installed in file_content: + error_msg = "%s failed sanity test (installed) in path %s" % (file,root) + sane = package_qa_handle_error(5, error_msg, "staging", path, d) if workdir in file_content: error_msg = "%s failed sanity test (workdir) in path %s" % (file,root) sane = package_qa_handle_error(8, error_msg, "staging", path, d) diff --git a/classes/native.bbclass b/classes/native.bbclass index 63e9741397..4022cb09c0 100644 --- a/classes/native.bbclass +++ b/classes/native.bbclass @@ -76,7 +76,12 @@ export oldincludedir = "${STAGING_DIR_NATIVE}${layout_includedir}" do_stage () { if [ "${INHIBIT_NATIVE_STAGE_INSTALL}" != "1" ] then - oe_runmake install + if [ "${AUTOTOOLS_NATIVE_STAGE_INSTALL}" != "1" ] + then + oe_runmake install + else + autotools_stage_all + fi fi } diff --git a/classes/package.bbclass b/classes/package.bbclass index 325c0b52f5..eb43856c55 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -152,7 +152,7 @@ def runstrip(file, d): # If the file is in a .debug directory it was already stripped, # don't do it again... if os.path.dirname(file).endswith(".debug"): - bb.note("Already run strip") + bb.note("Already ran strip") return 0 strip = bb.data.getVar("STRIP", d, 1) @@ -472,24 +472,31 @@ python emit_pkgdata() { if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) - packages = bb.data.getVar('PACKAGES', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) + pkgdatadir = bb.data.getVar('PKGDATA_DIR', d, True) + + pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) + if pstageactive == "1": + lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) - data_file = bb.data.expand("${PKGDATA_DIR}/${PN}", d) + data_file = pkgdatadir + bb.data.expand("/${PN}" , d) f = open(data_file, 'w') f.write("PACKAGES: %s\n" % packages) f.close() + package_stagefile(data_file, d) workdir = bb.data.getVar('WORKDIR', d, 1) for pkg in packages.split(): - subdata_file = bb.data.expand("${PKGDATA_DIR}/runtime/%s" % pkg, d) + subdata_file = pkgdatadir + "/runtime/%s" % pkg sf = open(subdata_file, 'w') + write_if_exists(sf, pkg, 'PN') + write_if_exists(sf, pkg, 'PR') write_if_exists(sf, pkg, 'DESCRIPTION') write_if_exists(sf, pkg, 'RDEPENDS') write_if_exists(sf, pkg, 'RPROVIDES') write_if_exists(sf, pkg, 'RRECOMMENDS') write_if_exists(sf, pkg, 'RSUGGESTS') - write_if_exists(sf, pkg, 'RPROVIDES') write_if_exists(sf, pkg, 'RREPLACES') write_if_exists(sf, pkg, 'RCONFLICTS') write_if_exists(sf, pkg, 'PKG') @@ -501,6 +508,10 @@ python emit_pkgdata() { write_if_exists(sf, pkg, 'pkg_prerm') sf.close() + package_stagefile(subdata_file, d) + #if pkgdatadir2: + # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg) + allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) if not allow_empty: allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1) @@ -508,8 +519,11 @@ python emit_pkgdata() { os.chdir(root) g = glob('*') if g or allow_empty == "1": - packagedfile = bb.data.expand('${PKGDATA_DIR}/runtime/%s.packaged' % pkg, d) + packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg file(packagedfile, 'w').close() + package_stagefile(packagedfile, d) + if pstageactive == "1": + bb.utils.unlockfile(lf) } emit_pkgdata[dirs] = "${PKGDATA_DIR}/runtime" @@ -549,6 +563,10 @@ python package_do_shlibs() { shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) bb.mkdirhier(shlibs_dir) + pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) + if pstageactive == "1": + lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) + needed = {} private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) for pkg in packages.split(): @@ -590,9 +608,11 @@ python package_do_shlibs() { for s in sonames: fd.write(s + '\n') fd.close() + package_stagefile(shlibs_file, d) fd = open(shver_file, 'w') fd.write(ver + '\n') fd.close() + package_stagefile(shver_file, d) if needs_ldconfig: bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) @@ -601,6 +621,9 @@ python package_do_shlibs() { postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) + if pstageactive == "1": + bb.utils.unlockfile(lf) + shlib_provider = {} list_re = re.compile('^(.*)\.list$') for dir in [shlibs_dir]: @@ -715,6 +738,10 @@ python package_do_pkgconfig () { if hdr == 'Requires': pkgconfig_needed[pkg] += exp.replace(',', ' ').split() + pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) + if pstageactive == "1": + lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) + for pkg in packages.split(): pkgs_file = os.path.join(shlibs_dir, pkg + ".pclist") if os.path.exists(pkgs_file): @@ -724,6 +751,7 @@ python package_do_pkgconfig () { for p in pkgconfig_provided[pkg]: f.write('%s\n' % p) f.close() + package_stagefile(pkgs_file, d) for dir in [shlibs_dir]: if not os.path.exists(dir): @@ -758,6 +786,10 @@ python package_do_pkgconfig () { for dep in deps: fd.write(dep + '\n') fd.close() + package_stagefile(deps_file, d) + + if pstageactive == "1": + bb.utils.unlockfile(lf) } python read_shlibdeps () { diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index 22b6166685..e59d194aeb 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -88,20 +88,13 @@ python do_package_deb () { return bb.mkdirhier(dvar) - packages = bb.data.getVar('PACKAGES', d, 1) - if not packages: - bb.debug(1, "PACKAGES not defined, nothing to package") - return tmpdir = bb.data.getVar('TMPDIR', d, 1) if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) - if packages == []: - bb.debug(1, "No packages; nothing to do") - return - + packages = bb.data.getVar('PACKAGES', d, 1) for pkg in packages.split(): localdata = bb.data.createCopy(d) pkgdest = bb.data.getVar('PKGDEST', d, 1) @@ -273,8 +266,13 @@ python () { } python do_package_write_deb () { - bb.build.exec_func("read_subpackage_metadata", d) - bb.build.exec_func("do_package_deb", d) + packages = bb.data.getVar('PACKAGES', d, True) + if not packages: + bb.debug(1, "No PACKAGES defined, nothing to package") + return + + bb.build.exec_func("read_subpackage_metadata", d) + bb.build.exec_func("do_package_deb", d) } do_package_write_deb[dirs] = "${D}" addtask package_write_deb before do_package_write after do_package diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index 2feaeba3b3..f05b7449cf 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -1,17 +1,17 @@ inherit package -BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg" +BOOTSTRAP_EXTRA_RDEPENDS += "opkg-collateral opkg" IMAGE_PKGTYPE ?= "ipk" -IPKGCONF_TARGET = "${STAGING_ETCDIR_NATIVE}/ipkg.conf" -IPKGCONF_SDK = "${STAGING_ETCDIR_NATIVE}/ipkg-sdk.conf" +IPKGCONF_TARGET = "${STAGING_ETCDIR_NATIVE}/opkg.conf" +IPKGCONF_SDK = "${STAGING_ETCDIR_NATIVE}/opkg-sdk.conf" python package_ipk_fn () { from bb import data bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) } -python package_ipk_install () { +python package_ipk_install () { # # Warning - this function is not multimachine safe (see stagingdir reference)! # @@ -35,7 +35,7 @@ python package_ipk_install () { raise bb.build.FuncFailed # Generate ipk.conf if it or the stamp doesnt exist - conffile = os.path.join(stagingdir,"ipkg.conf") + conffile = os.path.join(stagingdir,"opkg.conf") if not os.access(conffile, os.R_OK): ipkg_archs = bb.data.getVar('PACKAGE_ARCHS',d) if ipkg_archs is None: @@ -60,8 +60,8 @@ python package_ipk_install () { f = open(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),"w") f.close() - ret = os.system('ipkg-cl -o %s -f %s update' % (rootfs, conffile)) - ret = os.system('ipkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn)) + ret = os.system('opkg-cl -o %s -f %s update' % (rootfs, conffile)) + ret = os.system('opkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn)) if (ret != 0 ): raise bb.build.FuncFailed } @@ -137,20 +137,12 @@ python do_package_ipk () { return bb.mkdirhier(dvar) - packages = bb.data.getVar('PACKAGES', d, 1) - if not packages: - bb.debug(1, "PACKAGES not defined, nothing 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")) - if packages == []: - bb.debug(1, "No packages; nothing to do") - return - + packages = bb.data.getVar('PACKAGES', d, True) for pkg in packages.split(): localdata = bb.data.createCopy(d) pkgdest = bb.data.getVar('PKGDEST', d, 1) @@ -313,6 +305,11 @@ python () { } python do_package_write_ipk () { + packages = bb.data.getVar('PACKAGES', d, True) + if not packages: + bb.debug(1, "No PACKAGES defined, nothing to package") + return + bb.build.exec_func("read_subpackage_metadata", d) bb.build.exec_func("do_package_ipk", d) } diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass index b564136e3f..1c717b415e 100644 --- a/classes/packaged-staging.bbclass +++ b/classes/packaged-staging.bbclass @@ -4,35 +4,89 @@ # # To use it add that line to conf/local.conf: # -# INHERIT = "packaged-staging" +# INHERIT += "packaged-staging" +# + + +# +# bitbake.conf set PSTAGING_ACTIVE = "0", this class sets to "1" if we're active +# +PSTAGE_PKGVERSION = "${PV}-${PR}" +PSTAGE_PKGARCH = "${BUILD_SYS}" +PSTAGE_EXTRAPATH ?= "" +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_PKG = "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}" + +# multimachine.bbclass will override this but add a default in case we're not using it +MULTIMACH_ARCH ?= "${PACKAGE_ARCH}" + +PSTAGE_NATIVEDEPENDS = "\ + pkgconfig-native \ + autoconf-native \ + automake-native \ + curl-native \ + zlib-native \ + libtool-native \ + gnu-config-native \ + shasum-native \ + libtool-native \ + automake-native \ + update-alternatives-cworth-native \ + ipkg-utils-native \ + opkg-native \ + m4-native \ + quilt-native \ + stagemanager-native \ + " python () { import bb - if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('image', d) and not bb.data.inherits_class('cross', d) and not bb.data.inherits_class('sdk', d): + pstage_allowed = True + + # These classes encode staging paths into the binary data so can only be + # reused if the path doesn't change/ + if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d): + path = bb.data.getVar('PSTAGE_PKGPATH', d, 1) + path = path + bb.data.getVar('TMPDIR', d, 1).replace('/', '-') + bb.data.setVar('PSTAGE_PKGPATH', path, d) + + # PSTAGE_NATIVEDEPENDS lists the packages we need before we can use packaged + # staging. There will always be some packages we depend on. + if bb.data.inherits_class('native', d): + pn = bb.data.getVar('PN', d, True) + nativedeps = bb.data.getVar('PSTAGE_NATIVEDEPENDS', d, True).split() + if pn in nativedeps: + pstage_allowed = False + + # Images aren't of interest to us + if bb.data.inherits_class('image', d): + pstage_allowed = False + + # Add task dependencies if we're active, otherwise mark packaged staging + # as inactive. + if pstage_allowed: deps = bb.data.getVarFlag('do_populate_staging', 'depends', d) or "" deps += " stagemanager-native:do_populate_staging" bb.data.setVarFlag('do_populate_staging', 'depends', deps, d) deps = bb.data.getVarFlag('do_prepackaged_stage', 'depends', d) or "" - deps += " ipkg-native:do_populate_staging ipkg-utils-native:do_populate_staging" + deps += " opkg-native:do_populate_staging ipkg-utils-native:do_populate_staging" bb.data.setVarFlag('do_prepackaged_stage', 'depends', deps, d) + bb.data.setVar("PSTAGING_ACTIVE", "1", d) else: - bb.data.setVar("PSTAGING_DISABLED", "1", d) + bb.data.setVar("PSTAGING_ACTIVE", "0", d) } -# multimachine.bbclass will override this -MULTIMACH_ARCH ?= "${PACKAGE_ARCH}" - -export PSTAGING_DISABLED = "0" - -DEPLOY_DIR_PSTAGE = "${DEPLOY_DIR}/pstage" +DEPLOY_DIR_PSTAGE = "${DEPLOY_DIR}/pstage" +PSTAGE_MACHCONFIG = "${DEPLOY_DIR_PSTAGE}/opkg.conf" PSTAGE_BUILD_CMD = "${IPKGBUILDCMD}" -PSTAGE_INSTALL_CMD = "ipkg-cl install -force-depends -f ${DEPLOY_DIR_PSTAGE}/ipkg-${MACHINE}.conf -o ${TMPDIR}" -PSTAGE_UPDATE_CMD = "ipkg-cl update -f ${DEPLOY_DIR_PSTAGE}/ipkg-${MACHINE}.conf -o ${TMPDIR}" -PSTAGE_REMOVE_CMD = "ipkg-cl remove -force-depends -f ${DEPLOY_DIR_PSTAGE}/ipkg-${MACHINE}.conf -o ${TMPDIR}" -PSTAGE_LIST_CMD = "ipkg-cl list_installed -f ${DEPLOY_DIR_PSTAGE}/ipkg-${MACHINE}.conf -o ${TMPDIR}" -PSTAGE_PKGNAME = "staging-${PN}_${PV}-${PR}_${MULTIMACH_ARCH}.ipk" +PSTAGE_INSTALL_CMD = "opkg-cl install -force-depends -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" +PSTAGE_UPDATE_CMD = "opkg-cl update -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" +PSTAGE_REMOVE_CMD = "opkg-cl remove -force-depends -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" +PSTAGE_LIST_CMD = "opkg-cl list_installed -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" PSTAGE_TMPDIR_STAGE = "${WORKDIR}/staging-pkg" @@ -43,56 +97,50 @@ do_clean_append() { bb.note("Uninstalling package from staging...") path = bb.data.getVar("PATH", d, 1) removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1) - removepkg = bb.data.expand("staging-${PN}", d) + removepkg = bb.data.expand("${PSTAGE_PKGPN}", d) ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, removepkg)) if ret != 0: bb.note("Failure removing staging package") - stagepkg = bb.data.expand("${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGNAME}", d) + stagepkg = bb.data.expand("${PSTAGE_PKG}", d) bb.note("Removing staging package %s" % stagepkg) - #os.system('rm -rf ' + stagepkg) + os.system('rm -rf ' + stagepkg) } staging_helper () { - #assemble appropriate ipkg.conf - conffile=${DEPLOY_DIR_PSTAGE}/ipkg-${MACHINE}.conf + # Assemble appropriate opkg.conf + conffile=${PSTAGE_MACHCONFIG} mkdir -p ${DEPLOY_DIR_PSTAGE}/pstaging_lists if [ ! -e $conffile ]; then - ipkgarchs="${BUILD_ARCH} all any noarch ${TARGET_ARCH} ${PACKAGE_ARCHS} ${PACKAGE_EXTRA_ARCHS} ${MACHINE}" + ipkgarchs="${BUILD_SYS}" priority=1 for arch in $ipkgarchs; do echo "arch $arch $priority" >> $conffile priority=$(expr $priority + 5) done - echo "src oe-staging file:${DEPLOY_DIR_PSTAGE}" >> $conffile - - OLD_PWD=`pwd` - cd ${DEPLOY_DIR_PSTAGE} - ipkg-make-index -p Packages . - cd ${OLD_PWD} - - ${PSTAGE_UPDATE_CMD} fi } +PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_locales compile sizecheck install deploy package populate_staging package_write_deb package_write_ipk package_write package_stage qa_staging" + python do_prepackaged_stage () { import os - if bb.data.getVar("PSTAGING_DISABLED", d, 1) == "1": + if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0": bb.build.make_stamp("do_prepackaged_stage", d) return bb.note("Uninstalling any existing package from staging...") path = bb.data.getVar("PATH", d, 1) removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1) - removepkg = bb.data.expand("staging-${PN}", d) + removepkg = bb.data.expand("${PSTAGE_PKGPN}", d) lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, removepkg)) bb.utils.unlockfile(lf) if ret != 0: bb.note("Failure attempting to remove staging package") - stagepkg = bb.data.expand("${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGNAME}", d) + stagepkg = bb.data.expand("${PSTAGE_PKG}", d) if os.path.exists(stagepkg): bb.note("Following speedup\n") @@ -108,24 +156,10 @@ python do_prepackaged_stage () { if ret != 0: bb.note("Failure installing prestage package") - bb.build.make_stamp("do_prepackaged_stage", d) - bb.build.make_stamp("do_fetch", d) - bb.build.make_stamp("do_unpack", d) - bb.build.make_stamp("do_munge", d) - bb.build.make_stamp("do_patch", d) - bb.build.make_stamp("do_configure", d) - bb.build.make_stamp("do_qa_configure", d) - bb.build.make_stamp("do_rig_locales", d) - bb.build.make_stamp("do_compile", d) - bb.build.make_stamp("do_install", d) - bb.build.make_stamp("do_deploy", d) - bb.build.make_stamp("do_package", d) - bb.build.make_stamp("do_populate_staging", d) - bb.build.make_stamp("do_package_write_deb", d) - bb.build.make_stamp("do_package_write_ipk", d) - bb.build.make_stamp("do_package_write", d) - bb.build.make_stamp("do_package_stage", d) - bb.build.make_stamp("do_qa_staging", d) + #bb.build.make_stamp("do_prepackaged_stage", d) + #for task in bb.data.getVar("PSTAGE_TASKS_COVERED", d, 1).split(): + # bb.build.make_stamp("do_" + task, d) + bb.build.make_stamp("do_stage_package_populated", d) else: bb.build.make_stamp("do_prepackaged_stage", d) @@ -134,17 +168,38 @@ do_prepackaged_stage[cleandirs] = "${PSTAGE_TMPDIR_STAGE}" do_prepackaged_stage[selfstamp] = "1" addtask prepackaged_stage before do_fetch -populate_staging_preamble () { - if [ "$PSTAGING_DISABLED" != "1" ]; then - #mkdir -p ${DEPLOY_DIR_PSTAGE} +addhandler packagedstage_stampfixing_eventhandler +python packagedstage_stampfixing_eventhandler() { + from bb.event import getName + import os + + if getName(e) == "StampUpdate": + taskscovered = bb.data.getVar("PSTAGE_TASKS_COVERED", e.data, 1).split() + for (fn, task) in e.targets: + # strip off 'do_' + task = task[3:] + if task in taskscovered: + stamp = "%s.do_stage_package_populated" % e.stampPrefix[fn] + if os.path.exists(stamp): + # We're targetting a task which was skipped with packaged staging + # so we need to remove the autogenerated stamps. + for task in taskscovered: + dir = "%s.do_%s" % (e.stampPrefix[fn], task) + os.system('rm -f ' + dir) + os.system('rm -f ' + stamp) + + return NotHandled +} - stage-manager -p ${STAGING_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-staging -u - stage-manager -p ${CROSS_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-cross -u +populate_staging_preamble () { + if [ "$PSTAGING_ACTIVE" = "1" ]; then + stage-manager -p ${STAGING_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-staging -u || true + stage-manager -p ${CROSS_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-cross -u || true fi } populate_staging_postamble () { - if [ "$PSTAGING_DISABLED" != "1" ]; then + if [ "$PSTAGING_ACTIVE" = "1" ]; then # list the packages currently installed in staging ${PSTAGE_LIST_CMD} | awk '{print $1}' > ${DEPLOY_DIR_PSTAGE}/installed-list @@ -169,33 +224,42 @@ python do_populate_staging_append() { staging_packager () { mkdir -p ${PSTAGE_TMPDIR_STAGE}/CONTROL + mkdir -p ${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH} - echo "Package: staging-${PN}" > ${PSTAGE_TMPDIR_STAGE}/CONTROL/control - echo "Version: ${PV}-${PR}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control + echo "Package: ${PSTAGE_PKGPN}" > ${PSTAGE_TMPDIR_STAGE}/CONTROL/control + echo "Version: ${PSTAGE_PKGVERSION}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control echo "Description: ${DESCRIPTION}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control echo "Section: ${SECTION}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control echo "Priority: Optional" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control echo "Maintainer: ${MAINTAINER}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control - echo "Architecture: ${MULTIMACH_ARCH}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control + echo "Architecture: ${PSTAGE_PKGARCH}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control echo "Source: ${SRC_URI}" >> ${PSTAGE_TMPDIR_STAGE}/CONTROL/control - ${PSTAGE_BUILD_CMD} ${PSTAGE_TMPDIR_STAGE} ${DEPLOY_DIR_PSTAGE} - ${PSTAGE_INSTALL_CMD} $ |
