diff options
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r-- | meta/lib/oe/package_manager.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 367490fc5b..a73e054ae9 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -1774,6 +1774,36 @@ class DpkgPM(OpkgDpkgPM): return tmp_dir + def handle_bad_recommendations(self): + bad_recommendations = (self.d.getVar("BAD_RECOMMENDATIONS", True) or "").strip() + if not bad_recommendations: + return + + status_file = self.target_rootfs + "/var/lib/dpkg/status" + + with open(status_file + ".tmp", "w") as status: + for pkg in bad_recommendations.split(): + pkg_info = ('apt-cache', 'show', pkg) + + try: + output = subprocess.check_output(pkg_info, stderr=subprocess.STDOUT).decode("utf-8") + except subprocess.CalledProcessError as e: + if e.returncode == 100: + # Ignore unavailable packages. + continue + bb.fatal("Cannot get package info. Command '%s' " + "returned %d:\n%s" % (' '.join(pkg_info), e.returncode, e.output)) + + for line in output.splitlines(): + if not line: + status.write("Status: hold ok not-installed\n\n") + break + + if line.startswith(' ') or line.split(': ', 1)[0] not in ('Filename', 'Size', 'MD5sum', 'MSDOS-Filename'): + status.write(line + "\n") + + os.rename(status_file + ".tmp", status_file) + def generate_index_files(d): classes = d.getVar('PACKAGE_CLASSES').replace("package_", "").split() |