Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Laurentiu Palcu <laurentiu.palcu@intel.com>
To: Hongxu Jia <hongxu.jia@windriver.com>
Cc: saul.wold@intel.com, openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 3/5] rootfs.py: support ipk incremental image generation
Date: Thu, 20 Feb 2014 17:22:20 +0200	[thread overview]
Message-ID: <20140220152220.GC30981@lpalcu-linux> (raw)
In-Reply-To: <df8d61e28d120da0bfc8e2f105e81f528a08d35c.1392877826.git.hongxu.jia@windriver.com>

On Thu, Feb 20, 2014 at 03:06:53PM +0800, Hongxu Jia wrote:
> The incremental image generation is based on the previous existing
> image, adds new packages, upgrades existing packages, and removes unused
> packages.
> 
> [YOCTO #1894]
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>  meta/lib/oe/rootfs.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 49 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
> index 3bcb812..93106c2 100644
> --- a/meta/lib/oe/rootfs.py
> +++ b/meta/lib/oe/rootfs.py
> @@ -438,13 +438,25 @@ class OpkgRootfs(Rootfs):
>      def __init__(self, d, manifest_dir):
>          super(OpkgRootfs, self).__init__(d)
>  
> -        bb.utils.remove(self.image_rootfs, True)
> -        bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
>          self.manifest = OpkgManifest(d, manifest_dir)
>          self.opkg_conf = self.d.getVar("IPKGCONF_TARGET", True)
>          self.pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)
>  
> -        self.pm = OpkgPM(d, self.image_rootfs, self.opkg_conf, self.pkg_archs)
> +        self.inc_opkg_image_gen = self.d.getVar('INC_IPK_IMAGE_GEN', True) or ""
> +        if self.inc_opkg_image_gen != '1':
> +            bb.utils.remove(self.image_rootfs, True)
> +            self.pm = OpkgPM(d,
> +                             self.image_rootfs,
> +                             self.opkg_conf,
> +                             self.pkg_archs)
> +        else:
> +            self.pm = OpkgPM(d,
> +                             self.image_rootfs,
> +                             self.opkg_conf,
> +                             self.pkg_archs)
> +            self.pm.recover_packaging_data()
> +
> +        bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
>  
>      """
>      This function was reused from the old implementation.
> @@ -508,6 +520,34 @@ class OpkgRootfs(Rootfs):
>  
>          self._multilib_sanity_test(dirs)
>  
> +    '''
> +    While ipk incremental image generation is enabled, it will remove the
> +    unneeded pkgs by comparing the old full manifest in previous existing
> +    image and the new full manifest in the current image.
> +    '''
> +    def _create_incremental(self, pkgs_initial_install):
Can we name this function _remove_extra_packages()? Because it doesn't
actually install anything... it just removes packages, correct?

> +        if self.inc_opkg_image_gen == "1":
> +            # Parse full manifest in previous existing image creation session
> +            old_full_manifest = self.manifest.parse_full_manifest()
> +
> +            # Create full manifest for the current image session, the old one
> +            # will be replaced by the new one.
> +            self.manifest.create_full()
> +
> +            # Parse full manifest in current image creation session
> +            new_full_manifest = self.manifest.parse_full_manifest()
> +
> +            pkg_to_remove = list()
> +            for pkg in old_full_manifest:
> +                if pkg not in new_full_manifest:
> +                    pkg_to_remove.append(pkg)
> +
> +            self.pm.update()
this update could be removed, if we move the function call below
self.pm.handle_bad_recommendations(). See below.

> +
> +            if pkg_to_remove != []:
> +                bb.note('decremental removed: %s' % ' '.join(pkg_to_remove))
> +                self.pm.remove(pkg_to_remove)
> +
>      def _create(self):
>          pkgs_to_install = self.manifest.parse_initial_manifest()
>          opkg_pre_process_cmds = self.d.getVar('OPKG_PREPROCESS_COMMANDS', True)
> @@ -518,6 +558,9 @@ class OpkgRootfs(Rootfs):
>          if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS', True) or "") != "1":
>              self.pm.write_index()
>  
> +        if self.inc_opkg_image_gen == "1":
> +            self._create_incremental(pkgs_to_install)
Why not move this piece lower, below
self.pm.handle_bad_recommendations()? Correct me if I'm wrong, but I
believe the rootfs pre process commands should be executed before we do
anything on the rootfs generation.

> + execute_pre_post_process(self.d, opkg_pre_process_cmds)
>  
>          self.pm.update()
> @@ -540,6 +583,9 @@ class OpkgRootfs(Rootfs):
>          execute_pre_post_process(self.d, opkg_post_process_cmds)
>          execute_pre_post_process(self.d, rootfs_post_install_cmds)
>  
> +        if self.inc_opkg_image_gen == "1":
> +            self.pm.backup_packaging_data()
> +
>      def _get_delayed_postinsts(self):
>          pkg_list = []
>          status_file = os.path.join(self.image_rootfs,
> -- 
> 1.8.1.2
> 


  reply	other threads:[~2014-02-20 15:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20  7:06 [PATCH V2 0/5] manifest.py/package_manager.py/rootfs.py: support ipk incremental image generation Hongxu Jia
2014-02-20  7:06 ` [PATCH 1/5] manifest.py: add create_full for OpkgManifest class Hongxu Jia
2014-02-20 15:21   ` Laurentiu Palcu
2014-02-20  7:06 ` [PATCH 2/5] package_manager.py: support ipk incremental image generation Hongxu Jia
2014-02-20 15:22   ` Laurentiu Palcu
2014-02-20  7:06 ` [PATCH 3/5] rootfs.py: " Hongxu Jia
2014-02-20 15:22   ` Laurentiu Palcu [this message]
2014-02-20  7:06 ` [PATCH 4/5] rootfs.py: tweak _multilib_sanity_test for " Hongxu Jia
2014-02-20  7:06 ` [PATCH 5/5] rootfs.py: support BAD_RECOMMENDATIONS " Hongxu Jia
2014-02-20 15:22   ` Laurentiu Palcu
  -- strict thread matches above, loose matches on Subject: below --
2014-02-21  6:38 [PATCH V3 0/5] manifest.py/package_manager.py/rootfs.py: support " Hongxu Jia
2014-02-21  6:38 ` [PATCH 3/5] rootfs.py: " Hongxu Jia
2014-02-18  9:42 [PATCH 0/5] package_manager.py/ootfs.py: " Hongxu Jia
2014-02-18  9:42 ` [PATCH 3/5] rootfs.py: " Hongxu Jia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140220152220.GC30981@lpalcu-linux \
    --to=laurentiu.palcu@intel.com \
    --cc=hongxu.jia@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=saul.wold@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox