Esempio n. 1
0
    def find_packages_for_ssource(self, db, db_ssource):
        self.log_debug("Build-id: %s", db_ssource.build_id)
        files = self._build_id_to_debug_files(db_ssource.build_id)
        self.log_debug("File names: %s", ', '.join(files))
        db_debug_package = get_package_by_file(db, files)
        if db_debug_package is None:
            debug_nvra = "Not found"
        else:
            debug_nvra = db_debug_package.nvra()

        self.log_debug("Debug Package: %s", debug_nvra)

        db_bin_package = None

        if db_debug_package is not None:
            paths = [db_ssource.path]
            if os.path.sep in db_ssource.path:
                paths.append(usrmove(db_ssource.path))
                paths.append(os.path.abspath(db_ssource.path))
                paths.append(usrmove(os.path.abspath(db_ssource.path)))

            db_build = db_debug_package.build
            db_arch = db_debug_package.arch
            for path in paths:
                db_bin_package = get_package_by_file_build_arch(
                    db, path, db_build, db_arch)

                if db_bin_package is not None:
                    break

        if db_bin_package is None:
            bin_nvra = "Not found"
        else:
            bin_nvra = db_bin_package.nvra()

        self.log_debug("Binary Package: %s", bin_nvra)

        db_src_package = None

        if not self.skipsrc and db_debug_package is not None:
            db_build = db_debug_package.build
            db_src_package = get_src_package_by_build(db, db_build)

        if db_src_package is None:
            src_nvra = "Not found"
        else:
            src_nvra = db_src_package.nvra()

        self.log_debug("Source Package: %s", src_nvra)

        # indicate incomplete result
        if db_bin_package is None:
            db_debug_package = None

        return db_ssource, (db_debug_package, db_bin_package, db_src_package)
Esempio n. 2
0
File: core.py Progetto: trams/faf
    def find_packages_for_ssource(self, db, db_ssource):
        self.log_debug("Build-id: {0}".format(db_ssource.build_id))
        filename = self._get_file_name_from_build_id(db_ssource.build_id)
        self.log_debug("File name: {0}".format(filename))
        db_debug_package = get_package_by_file(db, filename)
        if db_debug_package is None:
            debug_nvra = "Not found"
        else:
            debug_nvra = db_debug_package.nvra()

        self.log_debug("Debug Package: {0}".format(debug_nvra))

        db_bin_package = None

        if db_debug_package is not None:
            paths = [db_ssource.path]
            if os.path.sep in db_ssource.path:
                paths.append(usrmove(db_ssource.path))
                paths.append(os.path.abspath(db_ssource.path))
                paths.append(usrmove(os.path.abspath(db_ssource.path)))

            db_build = db_debug_package.build
            db_arch = db_debug_package.arch
            for path in paths:
                db_bin_package = get_package_by_file_build_arch(db, path,
                                                                db_build,
                                                                db_arch)

                if db_bin_package is not None:
                    # Do not fix UsrMove in the DB - it's a terrible slow-down
                    # Rather fake it with symlinks when unpacking

                    #if db_ssource.path != path:
                    #    self.log_debug("Fixing path: {0} ~> {1}"
                    #                   .format(db_ssource.path, path))
                    #    build_id = db_ssource.build_id
                    #    db_ssource_fixed = get_ssource_by_bpo(db,
                    #                                          build_id,
                    #                                          path,
                    #                                          db_ssource.offset)
                    #    if db_ssource_fixed is None:
                    #        db_ssource.path = path
                    #    else:
                    #        db_ssource = db_ssource_fixed

                    break

        if db_bin_package is None:
            bin_nvra = "Not found"
        else:
            bin_nvra = db_bin_package.nvra()

        self.log_debug("Binary Package: {0}".format(bin_nvra))

        db_src_package = None

        if not self.skipsrc and db_debug_package is not None:
            db_build = db_debug_package.build
            db_src_package = get_src_package_by_build(db, db_build)

        if db_src_package is None:
            src_nvra = "Not found"
        else:
            src_nvra = db_src_package.nvra()

        self.log_debug("Source Package: {0}".format(src_nvra))

        # indicate incomplete result
        if db_bin_package is None:
            db_debug_package = None

        return db_ssource, (db_debug_package, db_bin_package, db_src_package)
Esempio n. 3
0
    def find_packages_for_ssource(self, db, db_ssource):
        self.log_debug("Build-id: %d", db_ssource.build_id)
        files = self._build_id_to_debug_files(db_ssource.build_id)
        self.log_debug("File names: %s", ', '.join(files))
        db_debug_package = get_package_by_file(db, files)
        if db_debug_package is None:
            debug_nvra = "Not found"
        else:
            debug_nvra = db_debug_package.nvra()

        self.log_debug("Debug Package: %s", debug_nvra)

        db_bin_package = None

        if db_debug_package is not None:
            paths = [db_ssource.path]
            if os.path.sep in db_ssource.path:
                paths.append(usrmove(db_ssource.path))
                paths.append(os.path.abspath(db_ssource.path))
                paths.append(usrmove(os.path.abspath(db_ssource.path)))

            db_build = db_debug_package.build
            db_arch = db_debug_package.arch
            for path in paths:
                db_bin_package = get_package_by_file_build_arch(
                    db, path, db_build, db_arch)

                if db_bin_package is not None:
                    # Do not fix UsrMove in the DB - it's a terrible slow-down
                    # Rather fake it with symlinks when unpacking

                    #if db_ssource.path != path:
                    #    self.log_debug("Fixing path: {0} ~> {1}"
                    #                   .format(db_ssource.path, path))
                    #    build_id = db_ssource.build_id
                    #    db_ssource_fixed = get_ssource_by_bpo(db,
                    #                                          build_id,
                    #                                          path,
                    #                                          db_ssource.offset)
                    #    if db_ssource_fixed is None:
                    #        db_ssource.path = path
                    #    else:
                    #        db_ssource = db_ssource_fixed

                    break

        if db_bin_package is None:
            bin_nvra = "Not found"
        else:
            bin_nvra = db_bin_package.nvra()

        self.log_debug("Binary Package: %s", bin_nvra)

        db_src_package = None

        if not self.skipsrc and db_debug_package is not None:
            db_build = db_debug_package.build
            db_src_package = get_src_package_by_build(db, db_build)

        if db_src_package is None:
            src_nvra = "Not found"
        else:
            src_nvra = db_src_package.nvra()

        self.log_debug("Source Package: %s", src_nvra)

        # indicate incomplete result
        if db_bin_package is None:
            db_debug_package = None

        return db_ssource, (db_debug_package, db_bin_package, db_src_package)