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 1/5] manifest.py: add create_full for OpkgManifest class
Date: Thu, 20 Feb 2014 17:21:11 +0200 [thread overview]
Message-ID: <20140220152111.GA30981@lpalcu-linux> (raw)
In-Reply-To: <754f90d6ffc10d27c5a9249837f2527f8bb44b68.1392877826.git.hongxu.jia@windriver.com>
On Thu, Feb 20, 2014 at 03:06:51PM +0800, Hongxu Jia wrote:
> The function create_full creates the manifest after the package in
> initial manifest has been dummy installed. It lists all *to be
> installed* packages. There is no real installation, just a test.
>
> [YOCTO #1894]
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
> meta/lib/oe/manifest.py | 65 ++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 64 insertions(+), 1 deletion(-)
>
> diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py
> index a4bc04b..6e40a9f 100644
> --- a/meta/lib/oe/manifest.py
> +++ b/meta/lib/oe/manifest.py
> @@ -1,6 +1,8 @@
> from abc import ABCMeta, abstractmethod
> +from oe.package_manager import *
> import os
> import re
> +import bb
>
>
> class Manifest(object):
> @@ -69,6 +71,7 @@ class Manifest(object):
>
> self.initial_manifest = os.path.join(self.manifest_dir, "%s_initial_manifest" % manifest_type)
> self.final_manifest = os.path.join(self.manifest_dir, "%s_final_manifest" % manifest_type)
> + self.full_manifest = os.path.join(self.manifest_dir, "%s_full_manifest" % manifest_type)
>
> # packages in the following vars will be split in 'must install' and
> # 'multilib'
> @@ -128,6 +131,15 @@ class Manifest(object):
> pass
>
> """
> + This creates the manifest after the package in initial manifest has been
> + dummy installed. It lists all *to be installed* packages. There is no real
> + installation, just a test.
> + """
> + @abstractmethod
> + def create_full(self):
> + pass
> +
> + """
> The following function parses an initial manifest and returns a dictionary
> object with the must install, attempt only, multilib and language packages.
> """
> @@ -158,6 +170,22 @@ class Manifest(object):
>
> return pkgs
>
> + '''
> + This following function parses a full manifest and return a list
> + object with packages.
> + '''
> + def parse_full_manifest(self):
> + installed_pkgs = list()
> + if not os.path.exists(self.full_manifest):
> + bb.note('full manifest not exist')
> + return installed_pkgs
> +
> + with open(self.full_manifest, 'r') as manifest:
> + for pkg in manifest.read().split('\n'):
> + installed_pkgs.append(pkg.strip())
> +
> + return installed_pkgs
> +
>
> class RpmManifest(Manifest):
> """
> @@ -202,10 +230,12 @@ class RpmManifest(Manifest):
> for pkg in pkgs[pkg_type].split():
> manifest.write("%s,%s\n" % (pkg_type, pkg))
>
> -
> def create_final(self):
> pass
>
> + def create_full(self):
> + pass
> +
>
> class OpkgManifest(Manifest):
> """
> @@ -253,6 +283,36 @@ class OpkgManifest(Manifest):
> def create_final(self):
> pass
>
> + def create_full(self):
> + if not os.path.exists(self.initial_manifest):
> + self.create_initial()
> +
> + initial_manifest = self.parse_initial_manifest()
> + pkgs_to_install = list()
> + for pkg_type in initial_manifest:
> + pkgs_to_install += initial_manifest[pkg_type]
> + if len(pkgs_to_install) == 0:
> + return
> +
> + image_rootfs = self.d.expand("${T}/opkg")
> + opkg_conf = self.d.getVar("IPKGCONF_TARGET", True)
> + pkg_archs = self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)
> + pm = OpkgPM(self.d, image_rootfs, opkg_conf, pkg_archs)
Do we really need to instantiate another PM object here? Can't the
caller pass an instance to it? After all, dummy_install() is not
supposed to alter the metadata, am I wrong? So, in this case, I believe
the caller can safely pass an instance to PM as an argument to the
function.
> +
> + pm.update()
> + pm.handle_bad_recommendations()
> + output = pm.dummy_install(pkgs_to_install)
> +
> + with open(self.full_manifest, 'w+') as manifest:
> + pkg_re = re.compile('^Installing ([^ ]+) [^ ].*')
> + for line in set(output.split('\n')):
> + m = pkg_re.match(line)
> + if m:
> + manifest.write(m.group(1) + '\n')
> +
> + bb.utils.remove(image_rootfs, True)
> + return
> +
>
> class DpkgManifest(Manifest):
> def create_initial(self):
> @@ -272,6 +332,9 @@ class DpkgManifest(Manifest):
> def create_final(self):
> pass
>
> + def create_full(self):
> + pass
> +
>
> def create_manifest(d, final_manifest=False, manifest_dir=None,
> manifest_type=Manifest.MANIFEST_TYPE_IMAGE):
> --
> 1.8.1.2
>
next prev parent reply other threads:[~2014-02-20 15:21 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 [this message]
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
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 1/5] manifest.py: add create_full for OpkgManifest class Hongxu Jia
2014-02-21 7:28 ` 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=20140220152111.GA30981@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