Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Denys Dmytriyenko <denis@denix.org>
To: Armin Kuster <akuster808@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [thud][PATCH] Revert "OpkgPM: use --add-ignore-recommends to process BAD_RECOMMENDATIONS"
Date: Thu, 17 Oct 2019 14:42:22 -0400	[thread overview]
Message-ID: <20191017184222.GN17412@denix.org> (raw)
In-Reply-To: <1571325700-5138-1-git-send-email-akuster808@gmail.com>

Thank you for this revert! I've been pulling my hair out past couple days 
figuring out why BAD_RECOMMENDATIONS stopped working for us. This fixed it.

-- 
Denys


On Thu, Oct 17, 2019 at 08:21:40AM -0700, Armin Kuster wrote:
> This reverts commit e8cd30ba6cec854d85c7ad47edc208107858a5d7.
> 
> This backport introduced an issue not seen the AB QA.
> 
> Issue can be seen if
> BAD_RECOMMENDATIONS_append = " udev-hwdb" is used
> ---
>  meta/lib/oe/package_manager.py | 41 +++++++++++++++++++++++++++++++++++++++--
>  meta/lib/oe/rootfs.py          |  2 ++
>  2 files changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
> index 7d88048..882e7c4 100644
> --- a/meta/lib/oe/package_manager.py
> +++ b/meta/lib/oe/package_manager.py
> @@ -1329,8 +1329,6 @@ class OpkgPM(OpkgDpkgPM):
>          cmd = "%s %s" % (self.opkg_cmd, self.opkg_args)
>          for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split():
>              cmd += " --add-exclude %s" % exclude
> -        for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split():
> -            cmd += " --add-ignore-recommends %s" % bad_recommendation
>          cmd += " install "
>          cmd += " ".join(pkgs)
>  
> @@ -1399,6 +1397,45 @@ class OpkgPM(OpkgDpkgPM):
>      def list_installed(self):
>          return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs()
>  
> +    def handle_bad_recommendations(self):
> +        bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS") or ""
> +        if bad_recommendations.strip() == "":
> +            return
> +
> +        status_file = os.path.join(self.opkg_dir, "status")
> +
> +        # If status file existed, it means the bad recommendations has already
> +        # been handled
> +        if os.path.exists(status_file):
> +            return
> +
> +        cmd = "%s %s info " % (self.opkg_cmd, self.opkg_args)
> +
> +        with open(status_file, "w+") as status:
> +            for pkg in bad_recommendations.split():
> +                pkg_info = cmd + pkg
> +
> +                try:
> +                    output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
> +                except subprocess.CalledProcessError as e:
> +                    bb.fatal("Cannot get package info. Command '%s' "
> +                             "returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
> +
> +                if output == "":
> +                    bb.note("Ignored bad recommendation: '%s' is "
> +                            "not a package" % pkg)
> +                    continue
> +
> +                for line in output.split('\n'):
> +                    if line.startswith("Status:"):
> +                        status.write("Status: deinstall hold not-installed\n")
> +                    else:
> +                        status.write(line + "\n")
> +
> +                # Append a blank line after each package entry to ensure that it
> +                # is separated from the following entry
> +                status.write("\n")
> +
>      def dummy_install(self, pkgs):
>          """
>          The following function dummy installs pkgs and returns the log of output.
> diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
> index aa9fb2e..e5512d0 100644
> --- a/meta/lib/oe/rootfs.py
> +++ b/meta/lib/oe/rootfs.py
> @@ -879,6 +879,8 @@ class OpkgRootfs(DpkgOpkgRootfs):
>  
>          self.pm.update()
>  
> +        self.pm.handle_bad_recommendations()
> +
>          if self.progress_reporter:
>              self.progress_reporter.next_stage()
>  
> -- 
> 2.7.4
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


  parent reply	other threads:[~2019-10-17 18:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 15:21 [thud][PATCH] Revert "OpkgPM: use --add-ignore-recommends to process BAD_RECOMMENDATIONS" Armin Kuster
2019-10-17 15:32 ` ✗ patchtest: failure for " Patchwork
2019-10-17 18:42 ` Denys Dmytriyenko [this message]
2019-10-17 19:21   ` [thud][PATCH] " akuster808
2019-10-17 20:01     ` Denys Dmytriyenko
2019-10-18 17:58       ` Alejandro Del Castillo
2019-10-18 21:18         ` akuster808
2019-10-21  6:08           ` Sean Nyekjaer
2019-11-22 15:15           ` Quentin Schulz
2019-10-23  8:41     ` Adrian Bunk

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=20191017184222.GN17412@denix.org \
    --to=denis@denix.org \
    --cc=akuster808@gmail.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