def test_get_installed_packages_ubuntu_with_missing_md5sums(self): test_root_dir = self.get_test_loc('debian/ubuntu-var-lib-dpkg/') packages = debian.get_installed_packages(root_dir=test_root_dir, distro='ubuntu', detect_licenses=False) result = [p.to_dict(_detailed=True) for p in packages] expected = self.get_test_loc('debian/ubuntu-var-lib-dpkg/expected.json') check_result_equals_expected_json(result, expected, regen=False)
def test_basic_rootfs(self): test_rootfs = self.extract_test_tar('debian/basic-rootfs.tar.gz') result = [ package.to_dict(_detailed=True) for package in debian.get_installed_packages(test_rootfs) ] expected = self.get_test_loc('debian/basic-rootfs-expected.json') check_result_equals_expected_json(result, expected, regen=False)
def package_getter(root_dir, distro="debian", detect_licenses=True, **kwargs): """ Yield installed package objects. Optionally detect licenses in a Debian copyright file for each package. """ packages = debian.get_installed_packages(root_dir=root_dir, distro=distro, detect_licenses=detect_licenses) for package in packages: yield package.purl, package
def test_get_installed_packages_should_not_fail_on_rootfs_without_installed_debian_packages(self): test_rootfs = self.get_temp_dir() result = list(debian.get_installed_packages(test_rootfs)) assert result == []