All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@streamunlimited.com>
To: poky@yoctoproject.org
Cc: andriy.danylovskyy@streamunlimited.com,
	Alejandro del Castillo <alejandro.delcastillo@ni.com>
Subject: [thud] [PATCH 2/2] OpkgPM: use --add-ignore-recommends to process BAD_RECOMMENDATIONS
Date: Tue, 11 Jun 2019 16:46:48 +0200	[thread overview]
Message-ID: <20190611144648.30886-3-quentin.schulz@streamunlimited.com> (raw)
In-Reply-To: <20190611144648.30886-1-quentin.schulz@streamunlimited.com>

From: Alejandro del Castillo <alejandro.delcastillo@ni.com>

Currently, BAD_RECOMMENDATIONS on the opkg backed relies on editing the
opkg status file (it sets BAD_RECOMMENDATIONS pkg want state to
deinstalled and pinned). This is brittle, and not consistent across the
different solver backends. Use new --add-ignore-recommends flag instead.

(From OE-Core rev: 0d11e813ba9b4e8de9e6e5099ff85f5d914243bc)

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oe/package_manager.py | 41 ++--------------------------------
 meta/lib/oe/rootfs.py          |  2 --
 2 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 882e7c429f..7d8804811c 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1329,6 +1329,8 @@ 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)
 
@@ -1397,45 +1399,6 @@ 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 e5512d09ef..aa9fb2e0b5 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -879,8 +879,6 @@ class OpkgRootfs(DpkgOpkgRootfs):
 
         self.pm.update()
 
-        self.pm.handle_bad_recommendations()
-
         if self.progress_reporter:
             self.progress_reporter.next_stage()
 
-- 
2.17.1



  parent reply	other threads:[~2019-06-11 14:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 14:46 [thud] [PATCH 0/2] opkg and BAD_RECOMMENDATIONS in thud 2.6.2 Quentin Schulz
2019-06-11 14:46 ` [thud] [PATCH 1/2] opkg: add --ignore-recommends flag Quentin Schulz
2019-06-11 14:46 ` Quentin Schulz [this message]
2019-06-11 17:24 ` [thud] [PATCH 0/2] opkg and BAD_RECOMMENDATIONS in thud 2.6.2 akuster808
2019-06-12  7:25   ` Quentin Schulz
2019-07-01 15:35     ` Quentin Schulz
2019-07-25  9:14       ` Quentin Schulz
2019-08-14  7:10         ` Quentin Schulz
2019-10-16  8:27 ` Sean Nyekjaer
2019-10-17  8:15   ` Quentin Schulz
2019-10-17  8:23   ` richard.purdie
2019-10-17  8:54     ` Quentin Schulz
2019-10-17 14:07       ` Sean Nyekjaer

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=20190611144648.30886-3-quentin.schulz@streamunlimited.com \
    --to=quentin.schulz@streamunlimited.com \
    --cc=alejandro.delcastillo@ni.com \
    --cc=andriy.danylovskyy@streamunlimited.com \
    --cc=poky@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.