diff options
author | Graeme Gregory <dp@xora.org.uk> | 2009-01-08 14:46:32 +0000 |
---|---|---|
committer | Graeme Gregory <dp@xora.org.uk> | 2009-01-30 13:19:44 +0000 |
commit | 9fba646c971c06e229355a0888511128101b20e1 (patch) | |
tree | 32999f730db39d45fcc235377c09f445bb5cbc82 | |
parent | eff32d62b939facef48cab008bf6a0cb33ac20c9 (diff) |
package_deb.bbclass, rootfs_deb.bbclass : merge in poky changes to these classes that make sure correct files end up on rootfs
-rw-r--r-- | classes/package_deb.bbclass | 32 | ||||
-rw-r--r-- | classes/rootfs_deb.bbclass | 50 |
2 files changed, 37 insertions, 45 deletions
diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index 6d4abaf5d0..5127d32f33 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -1,5 +1,5 @@ # -# Copyright 2006-2007 OpenedHand Ltd. +# Copyright 2006-2008 OpenedHand Ltd. # inherit package @@ -88,13 +88,20 @@ 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")) - packages = bb.data.getVar('PACKAGES', d, 1) + if packages == []: + bb.debug(1, "No packages; nothing to do") + return + for pkg in packages.split(): localdata = bb.data.createCopy(d) pkgdest = bb.data.getVar('PKGDEST', d, 1) @@ -242,17 +249,7 @@ python do_package_deb () { bb.utils.unlockfile(lf) raise bb.build.FuncFailed("dpkg-deb execution failed") - for script in ["preinst", "postinst", "prerm", "postrm", "control" ]: - scriptfile = os.path.join(controldir, script) - try: - os.remove(scriptfile) - except OSError: - pass - try: - os.rmdir(controldir) - except OSError: - pass - + bb.utils.prunedir(controldir) bb.utils.unlockfile(lf) } @@ -266,13 +263,8 @@ python () { } python do_package_write_deb () { - 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) + 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/rootfs_deb.bbclass b/classes/rootfs_deb.bbclass index 1b93767463..6bc251f16d 100644 --- a/classes/rootfs_deb.bbclass +++ b/classes/rootfs_deb.bbclass @@ -1,6 +1,8 @@ # # Copyright 2006-2007 Openedhand Ltd. # +ROOTFS_PKGMANAGE = "run-postinsts dpkg" +ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts" do_rootfs[depends] += "dpkg-native:do_populate_staging apt-native:do_populate_staging" do_rootfs[recrdeptask] += "do_package_write_deb" @@ -14,7 +16,7 @@ fakeroot rootfs_deb_do_rootfs () { rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences > ${IMAGE_ROOTFS}/var/dpkg/status > ${IMAGE_ROOTFS}/var/dpkg/available - # > ${STAGING_DIR}/var/dpkg/status + mkdir -p ${IMAGE_ROOTFS}/var/dpkg/alternatives priority=1 for arch in ${PACKAGE_ARCHS}; do @@ -39,16 +41,14 @@ fakeroot rootfs_deb_do_rootfs () { tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \ - | sed -e 's#Architecture ".*";#Architecture "${TARGET_ARCH}";#' \ + | sed -e 's#Architecture ".*";#Architecture "${DPKG_ARCH}";#' \ > "${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" export D=${IMAGE_ROOTFS} export OFFLINE_ROOT=${IMAGE_ROOTFS} export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} - export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT} - - mkdir -p ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives + export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} apt-get update @@ -80,12 +80,20 @@ fakeroot rootfs_deb_do_rootfs () { if [ $? -ne 0 ]; then exit 1 fi - find ${IMAGE_ROOTFS} -name \*.dpkg-new | for i in `cat`; do - mv $i `echo $i | sed -e's,\.dpkg-new$,,'` - done done fi + rm ${WORKDIR}/temp/log.do_$target-attemptonly.${PID} + if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then + for i in ${PACKAGE_INSTALL_ATTEMPTONLY}; do + apt-get install $i --force-yes --allow-unauthenticated >> ${WORKDIR}/temp/log.do_rootfs-attemptonly.${PID} || true + done + fi + + find ${IMAGE_ROOTFS} -name \*.dpkg-new | for i in `cat`; do + mv $i `echo $i | sed -e's,\.dpkg-new$,,'` + done + install -d ${IMAGE_ROOTFS}/${sysconfdir} echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version @@ -110,22 +118,14 @@ fakeroot rootfs_deb_do_rootfs () { set -e - # Hacks to make dpkg/opkg coexist for now - mv ${IMAGE_ROOTFS}/var/dpkg ${IMAGE_ROOTFS}/usr/ - if [ -e ${IMAGE_ROOTFS}/usr/dpkg/alternatives ]; then - rmdir ${IMAGE_ROOTFS}/usr/dpkg/alternatives + # Hacks to allow opkg's update-alternatives and opkg to coexist for now + mkdir -p ${IMAGE_ROOTFS}/usr/lib/opkg + if [ -e ${IMAGE_ROOTFS}/var/dpkg/alternatives ]; then + rmdir ${IMAGE_ROOTFS}/var/dpkg/alternatives fi - if [ ! -e ${IMAGE_ROOTFS}${libdir}/opkg ] ; then - mkdir -p ${IMAGE_ROOTFS}${libdir}/opkg - fi - - if [ ! -e ${IMAGE_ROOTFS}${sysconfdir}/opkg ] ; then - mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/opkg - fi - - ln -sf ${libdir}/opkg/alternatives ${IMAGE_ROOTFS}/usr/dpkg/alternatives - ln -sf /usr/dpkg/info ${IMAGE_ROOTFS}${libdir}/opkg/info - ln -sf /usr/dpkg/status ${IMAGE_ROOTFS}${libdir}/opkg/status + ln -s /usr/lib/opkg/alternatives ${IMAGE_ROOTFS}/var/dpkg/alternatives + ln -s /var/dpkg/info ${IMAGE_ROOTFS}/usr/lib/opkg/info + ln -s /var/dpkg/status ${IMAGE_ROOTFS}/usr/lib/opkg/status ${ROOTFS_POSTPROCESS_COMMAND} @@ -142,7 +142,7 @@ rootfs_deb_log_check() { if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1 then echo "log_check: There were error messages in the logfile" - printf "log_check: Matched keyword: [$keyword_die]\n" + echo -e "log_check: Matched keyword: [$keyword_die]\n" echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" echo "" do_exit=1 @@ -153,6 +153,6 @@ rootfs_deb_log_check() { } remove_packaging_data_files() { - rm -rf ${IMAGE_ROOTFS}${libdir}/opkg/ + rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg/ rm -rf ${IMAGE_ROOTFS}/usr/dpkg/ } |