Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/9] insane.bbclass: add QA check: file-rdeps
Date: Fri, 29 Aug 2014 13:46:29 +0800	[thread overview]
Message-ID: <540013B5.4090602@windriver.com> (raw)
In-Reply-To: <b4fb230d5c45199aa7989b1ad5a5eea516d242e1.1409154816.git.liezhi.yang@windriver.com>


Removed a blank line and put this patch to:

git://git.openembedded.org/openembedded-core-contrib rbt/rdeps

// Robert

On 08/27/2014 11:57 PM, Robert Yang wrote:
> The ipk or deb can't depend on file such as "/bin/bash" or
> "/usr/bin/perl", so it knows nothing about the pkg depends bash or perl,
> thus there would be dependencies problems when we run "apt-get
> install/remove <pkg>" on the target, this check can help us find the
> issues and then fix them manually.
>
> * Benefits:
>    - Help to fix file rdepends issues for ipk and deb
>    - Help to fix abnormal rdepends.
>    - Help to check whether the rdepends is OK or not after build each
>      recipe (don't have to install to the image), for example, a recipe may
>      generate 10 binary packages, only a part of them will be installed to
>      the image by default, we can know whether the rdepends are OK or
>      not for the ones which are installed, but can't know the ones which
>      are not installed, this patch can help check all the 10 binary
>      packages' rdepends.
>
> * Basic designs:
>    - Get all the RDEPENDS on the chain.
>
>    - Get the pkg's FILERPROVIDES from oe.packagedata.read_subpkgdata()
>      and save to set filerdepends.
>
>    - Get each RPDEPENDS' FILERPROVIDES, RPROVIDES and FILERPROVIDESFLIST,
>      and save to set rdep_rprovides.
>
>    - Do the set "filerdepends -= rdep_rprovides" and QA issue if
>      filerdepends is not null.
>
> [YOCTO #1662]
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>   meta/classes/insane.bbclass |   73 ++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 72 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index 3dd2e7f..d5b4317 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -29,7 +29,7 @@ QA_SANE = "True"
>   WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
>               textrel already-stripped incompatible-license files-invalid \
>               installed-vs-shipped compile-host-path install-host-path \
> -            pn-overrides infodir build-deps \
> +            pn-overrides infodir build-deps file-rdeps \
>               "
>   ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
>               perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
> @@ -797,6 +797,76 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
>                   error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend)
>                   sane = package_qa_handle_error("build-deps", error_msg, d)
>
> +        if "file-rdeps" not in skip:
> +            ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)'])
> +            if bb.data.inherits_class('nativesdk', d):
> +                ignored_file_rdeps |= set(['/bin/bash', '/usr/bin/perl'])
> +            # For Saving the FILERDEPENDS
> +            filerdepends = set()
> +            rdep_data = oe.packagedata.read_subpkgdata(pkg, d)
> +            for key in rdep_data:
> +                if key.startswith("FILERDEPENDS_"):
> +                    for subkey in rdep_data[key].split():
> +                        filerdepends.add(subkey)
> +            filerdepends -= ignored_file_rdeps
> +
> +            if filerdepends:
> +                next = rdepends
> +                done = rdepends[:]
> +                # Find all the rdepends on the dependency chain
> +                while next:
> +                    new = []
> +                    for rdep in next:
> +                        rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
> +                        sub_rdeps = rdep_data.get("RDEPENDS_" + rdep)
> +                        if not sub_rdeps:
> +                            continue
> +                        for sub_rdep in sub_rdeps.split():
> +                            if sub_rdep in done:
> +                                continue
> +                            if not sub_rdep.startswith('(') and \
> +                                    oe.packagedata.has_subpkgdata(sub_rdep, d):
> +                                # It's a new rdep
> +                                done.append(sub_rdep)
> +                                new.append(sub_rdep)
> +                    next = new
> +
> +                # Add the rprovides of itself
> +                if pkg not in done:
> +                    done.insert(0, pkg)
> +
> +                # The python is not a package, but python-core provides it, so
> +                # skip checking /usr/bin/python if python is in the rdeps, in
> +                # case there is a RDEPENDS_pkg = "python" in the recipe.
> +                for py in [ d.getVar('MLPREFIX', True) + "python", "python" ]:
> +                    if py in done:
> +                        filerdepends.discard("/usr/bin/python")
> +                        done.remove(py)
> +                for rdep in done:
> +                    # For Saving the FILERPROVIDES, RPROVIDES and FILES_INFO
> +                    rdep_rprovides = set()
> +                    rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
> +                    for key in rdep_data:
> +                        if key.startswith("FILERPROVIDES_") or key.startswith("RPROVIDES_"):
> +                            for subkey in rdep_data[key].split():
> +                                rdep_rprovides.add(subkey)
> +                        # Add the files list to the rprovides
> +                        if key == "FILES_INFO":
> +                            # Use eval() to make it as a dict
> +                            for subkey in eval(rdep_data[key]):
> +                                rdep_rprovides.add(subkey)
> +                    filerdepends -= rdep_rprovides
> +                    if not filerdepends:
> +                        # Break if all the file rdepends are met
> +                        break
> +                    else:
> +                        # Clear it for the next loop
> +                        rdep_rprovides.clear()
> +            if filerdepends:
> +                error_msg = "%s requires %s, but no providers in its RDEPENDS" % \
> +                            (pkg, ', '.join(str(e) for e in filerdepends))
> +                sane = package_qa_handle_error("file-rdeps", error_msg, d)
> +
>       return sane
>
>   def package_qa_check_deps(pkg, pkgdest, skip, d):
> @@ -894,6 +964,7 @@ python do_package_qa () {
>       for dep in taskdepdata:
>           taskdeps.add(taskdepdata[dep][0])
>
> +
>       g = globals()
>       walk_sane = True
>       rdepends_sane = True
>


  reply	other threads:[~2014-08-29  5:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 15:57 [PATCH 0/9] rdepends fixes and QA check: file-rdeps Robert Yang
2014-08-27 15:57 ` [PATCH 1/9] insane.bbclass: add " Robert Yang
2014-08-29  5:46   ` Robert Yang [this message]
2014-08-27 15:57 ` [PATCH 2/9] ltp: fix RDEPENDS Robert Yang
2014-08-27 15:57 ` [PATCH 3/9] meta: fix RDEPNEDS for the test related pkgs Robert Yang
2014-08-27 15:57 ` [PATCH 4/9] valgrind/oprofile/systemd: no bashism in run-ptest Robert Yang
2014-08-27 15:57 ` [PATCH 5/9] run-ptest: fix bashism Robert Yang
2014-08-27 15:57 ` [PATCH 6/9] lsbtest: no bashism in LSB_Test.sh Robert Yang
2014-08-27 15:57 ` [PATCH 7/9] sed: add sed to RDEPENDS sed-ptest Robert Yang
2014-08-27 15:57 ` [PATCH 8/9] bootchart2: no bashism in bootchartd.in Robert Yang
2014-08-29 17:01   ` Max Eliaser
2014-08-30  5:23     ` Robert Yang
2014-09-03 20:54       ` Max Eliaser
2014-08-27 15:57 ` [PATCH 9/9] python3-distribute: fix interpreter Robert Yang

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=540013B5.4090602@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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