def _save_packages(self, db, db_report, packages, count=1): for package in packages: role = "RELATED" if "package_role" in package: if package["package_role"] == "affected": role = "CRASHED" elif package["package_role"] == "selinux_policy": role = "SELINUX_POLICY" db_package = get_package_by_nevra(db, name=package["name"], epoch=package["epoch"], version=package["version"], release=package["release"], arch=package["architecture"]) if db_package is None: self.log_warn("Package {0}-{1}:{2}-{3}.{4} not found in " "storage".format(package["name"], package["epoch"], package["version"], package["release"], package["architecture"])) db_unknown_pkg = get_unknown_package(db, db_report, role, package["name"], package["epoch"], package["version"], package["release"], package["architecture"]) if db_unknown_pkg is None: db_arch = get_arch_by_name(db, package["architecture"]) if db_arch is None: continue db_unknown_pkg = ReportUnknownPackage() db_unknown_pkg.report = db_report db_unknown_pkg.name = package["name"] db_unknown_pkg.epoch = package["epoch"] db_unknown_pkg.version = package["version"] db_unknown_pkg.release = package["release"] db_unknown_pkg.arch = db_arch db_unknown_pkg.type = role db_unknown_pkg.count = 0 db.session.add(db_unknown_pkg) db_unknown_pkg.count += count continue db_reportpackage = get_reportpackage(db, db_report, db_package) if db_reportpackage is None: db_reportpackage = ReportPackage() db_reportpackage.report = db_report db_reportpackage.installed_package = db_package db_reportpackage.count = 0 db_reportpackage.type = role db.session.add(db_reportpackage) db_reportpackage.count += count
def _save_packages(self, db, db_report, packages, count=1): for package in packages: role = "RELATED" if "package_role" in package: if package["package_role"] == "affected": role = "CRASHED" elif package["package_role"] == "selinux_policy": role = "SELINUX_POLICY" db_package = get_package_by_nevra(db, name=package["name"], epoch=package["epoch"], version=package["version"], release=package["release"], arch=package["architecture"]) if db_package is None: self.log_warn("Package {0}-{1}:{2}-{3}.{4} not found in " "storage".format(package["name"], package["epoch"], package["version"], package["release"], package["architecture"])) db_unknown_pkg = get_unknown_package(db, db_report, role, package["name"], package["epoch"], package["version"], package["release"], package["architecture"]) if db_unknown_pkg is None: db_arch = get_arch_by_name(db, package["architecture"]) if db_arch is None: continue db_unknown_pkg = ReportUnknownPackage() db_unknown_pkg.report = db_report db_unknown_pkg.name = package["name"] db_unknown_pkg.epoch = package["epoch"] db_unknown_pkg.version = package["version"] db_unknown_pkg.release = package["release"] db_unknown_pkg.semver = to_semver(package["version"]) db_unknown_pkg.semrel = to_semver(package["release"]) db_unknown_pkg.arch = db_arch db_unknown_pkg.type = role db_unknown_pkg.count = 0 db.session.add(db_unknown_pkg) db_unknown_pkg.count += count continue db_reportpackage = get_reportpackage(db, db_report, db_package) if db_reportpackage is None: db_reportpackage = ReportPackage() db_reportpackage.report = db_report db_reportpackage.installed_package = db_package db_reportpackage.count = 0 db_reportpackage.type = role db.session.add(db_reportpackage) db_reportpackage.count += count
def find_packages_for_ssource(self, db, db_ssource): if db_ssource.build_id is None: self.log_debug("No kernel information for '{0}' @ '{1}'".format( db_ssource.symbol.name, db_ssource.path)) return db_ssource, (None, None, None) if db_ssource.build_id in self._kernel_pkg_map: return db_ssource, self._kernel_pkg_map[db_ssource.build_id] if self.archnames is None: self.archnames = set(arch.name for arch in get_archs(db)) kernelver = self._parse_kernel_build_id(db_ssource.build_id, self.archnames) version, release, arch, flavour = kernelver if flavour is not None: basename = "kernel-{0}-debuginfo".format(flavour) else: basename = "kernel-debuginfo" db_debug_pkg = get_package_by_nevra(db, basename, 0, version, release, arch) nvra = "{0}-{1}-{2}.{3}".format(basename, version, release, arch) db_src_pkg = None if db_debug_pkg is None: self.log_debug("Package {0} not found in storage".format(nvra)) elif not self.skipsrc: srcname = "kernel-debuginfo-common-{0}".format(arch) db_src_pkg = get_package_by_name_build_arch( db, srcname, db_debug_pkg.build, db_debug_pkg.arch) if db_src_pkg is None: self.log_debug( "Package {0}-{1}-{2}.{3} not found in storage".format( srcname, version, release, arch)) result = db_debug_pkg, db_debug_pkg, db_src_pkg self._kernel_pkg_map[db_ssource.build_id] = result return db_ssource, result
def find_packages_for_ssource(self, db, db_ssource): if db_ssource.build_id is None: self.log_debug("No kernel information for '{0}' @ '{1}'" .format(db_ssource.symbol.name, db_ssource.path)) return db_ssource, (None, None, None) if db_ssource.build_id in self._kernel_pkg_map: return db_ssource, self._kernel_pkg_map[db_ssource.build_id] if self.archnames is None: self.archnames = set(arch.name for arch in get_archs(db)) kernelver = self._parse_kernel_build_id(db_ssource.build_id, self.archnames) version, release, arch, flavour = kernelver if flavour is not None: basename = "kernel-{0}-debuginfo".format(flavour) else: basename = "kernel-debuginfo" db_debug_pkg = get_package_by_nevra(db, basename, 0, version, release, arch) nvra = "{0}-{1}-{2}.{3}".format(basename, version, release, arch) db_src_pkg = None if db_debug_pkg is None: self.log_debug("Package {0} not found in storage".format(nvra)) elif not self.skipsrc: srcname = "kernel-debuginfo-common-{0}".format(arch) db_src_pkg = get_package_by_name_build_arch(db, srcname, db_debug_pkg.build, db_debug_pkg.arch) if db_src_pkg is None: self.log_debug("Package {0}-{1}-{2}.{3} not found in storage" .format(srcname, version, release, arch)) result = db_debug_pkg, db_debug_pkg, db_src_pkg self._kernel_pkg_map[db_ssource.build_id] = result return db_ssource, result