package_(deb|ipk).bbclass: remove the stamp when creating package from cache

If the packages are created from cache, we need to remove the stamp so
that we re-generate the index files at do_rootfs time.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/manifest.py: create global variables for package types

Manifest class clients don't really need to know how package types are
encoded.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/package_manager.py: add deploy dir locking mechanism

This is needed in order to serialize the index file creation when
multiple do_rootfs tasks are running in the same time.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/package_manager.py: use the bitbake APT_ARGS variable

This commit will revert on using the bitbake APT_ARGS variable, so users
can alter the way apt is called without needing to change it in code.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/package_manager.py: add support for opkg backend

Additionaly, the commit contains a couple of minor changes
(comments, error printing, etc).

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/rootfs.py: add support for opkg backend

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Cleanup image,rootfs_ipk,package_ipk bbclass files

This commit cleans up the functions that were ported to python.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
image.bbclass, lib/oe/rootfs.py: remove intercept_scripts directory

Remove the directory, manually, in the Rootfs.create() function.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/manifest.py: create manifests for SDK too

This commit contains several changes:
 * it is possible to create manifests for following types of images:
   regular image, target SDK and host SDK. To distinguish between these
   types of manifests, one has to pass the manifest_type argument to the
   contructor or create_manifest() wrapper. The manifest type can have
   the following values: image, sdk_host, sdk_target;
 * move image_rootfs variable to _create_dummy_initial() since it's used
   only here. This function will probably be removed in the future;
 * fix a bug in the Dpkg class;
 * add INSTALL_ORDER property to Manifest class which contains the
   default install order for the packages and will be used Rootfs/Sdk
   classes;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/rootfs.py: use Manifest.INSTALL_ORDER

Since the Manifest class has this property, use it. This contains the
default package installation order.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/package_manager.py: fixes for dpkg backend

This commit contains the following fixes:
 * pass the apt config directory to the DpkgPM constructor, so one can
   instantiate this class multiple times and give it different config
   files (like for creating SDK);
 * change constructor argument name from 'dpkg_archs' to 'base_archs';
 * export APT_CONFIG environment variable before calling apt-get, not in
   constructor. If done in constructor, the last class instantiation,
   sets the environment, which is note desireable;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/sdk.py: add SDK class

This new file contains the python 'populate sdk' implementation of the
old bash populate_sdk_image() function for Opkg and Dpkg.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
populate_sdk_base.bbclass: activate the new python routines

Lose the old shell populate_sdk_image() function and use the new python
implementation.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
image.bbclass: change POPULATE_SDK_POST_TARGET_COMMAND

Since rootfs_install_complementary() is now implemented in python for
each backend, remove it from POPULATE_SDK_POST_TARGET_COMMAND. Call it
directly in python.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
populate_sdk_(deb|ipk).bbclass: remove old shell code

The old code no more needed since the job is done in python now.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/manifest.py: add rpm image manifest creation

Implementation RpmManifest class.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/package_manager.py: support RpmPM

- Implementation RpmPM class
- Support rpm incremental image generation

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/rootfs.py: support RpmRootfs

- Implementation RpmRootfs class
- Refactor list_installed_packages in python

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/rootfs.py: Tweak the rootfs removing operation

Move the bb.utils.remove(self.image_rootfs, True) from the base class
constructor, to Opkg/Ipkg constructors after super's constructor is
called.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
rootfs.py: fix uninstall uneeded pkgs failed

The refactor of shell function rootfs_uninstall_unneeded is incorrect,
it should check and update the installed_pkgs.txt file for the existance
of the packages that were removed.
...
rootfs_uninstall_unneeded () {
    if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
        if [ -z "$(delayed_postinsts)" ]; then
            # All packages were successfully configured.
            # update-rc.d, base-passwd, run-postinsts are no further
            # use, remove them now
            remove_run_postinsts=false
            if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
                remove_run_postinsts=true
            fi

            # Remove package only if it's installed
            pkgs_to_remove="update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
            for pkg in $pkgs_to_remove; do
                # regexp for pkg, to be used in grep and sed
                pkg_regexp="^`echo $pkg | sed 's/\./\\\./'` "
                if grep -q "$pkg_regexp" ${WORKDIR}/installed_pkgs.txt; then
                rootfs_uninstall_packages $pkg
                sed -i "/$pkg_regexp/d" ${WORKDIR}/installed_pkgs.txt
                fi
            done
...

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>