lib/oe/utils.py: add pre/post process helper function

This helper function will be used to execute pre/post process commands.

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

This will replace the old bash image creation code. This needs the
rootfs to be already generated in order to work.

Usage:
  Image(d).create()
or using the provided wrapper function:
  create_image(d)

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

This new library allows for the creation of 2 types of manifests:
 * initial manifest - used by the new rootfs creation routines to
   generate the rootfs;
 * final_manifest - this will contain all the packages in the image,
   after all installations finished;

Usage:
  Manifest(d, manifest_dir).create_initial()
  Manifest(d, manifest_dir).create_final()
or using the provided wrapper function:
  create_manifest(d, False, manifest_dir) -> creates initial manifest
  create_manifest(d, True, manifest_dir) -> creates final manifest

If manifest_dir argument is ommited, it defaults to ${WORKDIR}.

NOTE: this commit creates fixed manifests for minimal/sato/sato-sdk
images, for Rpm & Opkg backends, in order to help speed up
development of rootfs refactoring. Dpkg initial manifest creation is
implemented.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/package_manager.py: add new package management library

This new library is intended to be used by the new python rootfs
creation code.

It implements the rpm/dpkg/opkg package management backends: RpmPM,
DpkgPM and OpkgPM.

The base API is this:
  update()
  install()
  install_complementary()
  remove()
  write_index()
  remove_packaging_data()
  list_installed()

All implementations have to provide these functions. Some backends may
need to implement additional functions though.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
lib/oe/rootfs.py: add new library for rootfs creation

This library will be used to generate the rootfs.

Recommended usage:
 create_rootfs(d, manifest_file)

this will determine the PM backend used, save the shell environment and
will call the appropriate backend implementation (DpkgRootfs(d,
manifest_file).create()).

NOTE: this commit adds Dpkg support.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Activate the new python rootfs/image creation routines

This commit will:
 * remove old bash code common to all backends;
 * create a new do_rootfs() python function that will use the new
   rootfs/image creation routines;
 * allow creation of dpkg based images;
 * fail for rpm/opkg (not implemented yet);

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
oe/manifest.py: Add manifest creation for opkg

In this commit:
 * add ability to create initial manifest for opkg;
 * make var_map available to all backends;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
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>