Пример #1
0
    def __get_file_from_pool(self, filename, entry, session, logger):
        cnf = Config()

        if cnf.has_key("Dinstall::SuiteSuffix"):
            component = cnf["Dinstall::SuiteSuffix"] + entry["component"]
        else:
            component = entry["component"]

        poolname = poolify(entry["source"], component)
        l = get_location(cnf["Dir::Pool"], component, session=session)

        found, poolfile = check_poolfile(os.path.join(poolname, filename),
                                         entry['size'],
                                         entry["md5sum"],
                                         l.location_id,
                                         session=session)

        if found is None:
            if logger is not None:
                logger.log(["E: Found multiple files for pool (%s) for %s" % (filename, component)])
            return None
        elif found is False and poolfile is not None:
            if logger is not None:
                logger.log(["E: md5sum/size mismatch for %s in pool" % (filename)])
            return None
        else:
            if poolfile is None:
                if logger is not None:
                    logger.log(["E: Could not find %s in pool" % (filename)])
                return None
            else:
                return poolfile
Пример #2
0
    def file_summary(self):
        # changes["distribution"] may not exist in corner cases
        # (e.g. unreadable changes files)
        if "distribution" not in self.changes or not \
               isinstance(self.changes["distribution"], dict):
            self.changes["distribution"] = {}

        byhand = False
        new = False
        summary = ""
        override_summary = ""

        for name, entry in sorted(self.files.items()):
            if "byhand" in entry:
                byhand = True
                summary += name + " byhand\n"

            elif "new" in entry:
                new = True
                summary += "(new) %s %s %s\n" % (name, entry["priority"],
                                                 entry["section"])

                if "othercomponents" in entry:
                    summary += "WARNING: Already present in %s distribution.\n" % (
                        entry["othercomponents"])

                if entry["type"] == "deb":
                    deb_fh = open_file(name)
                    summary += TagSection(
                        deb_extract_control(deb_fh))["Description"] + '\n'
                    deb_fh.close()

            else:
                entry["pool name"] = poolify(self.changes.get("source", ""))
                destination = entry["pool name"] + name
                summary += name + "\n  to " + destination + "\n"

                if "type" not in entry:
                    entry["type"] = "unknown"

                if entry["type"] in ["deb", "udeb", "dsc"]:
                    # (queue/unchecked), there we have override entries already, use them
                    # (process-new), there we dont have override entries, use the newly generated ones.
                    override_prio = entry.get("override priority",
                                              entry["priority"])
                    override_sect = entry.get("override section",
                                              entry["section"])
                    override_summary += "%s - %s %s\n" % (name, override_prio,
                                                          override_sect)

        return (byhand, new, summary, override_summary)
Пример #3
0
    def file_summary(self):
        # changes["distribution"] may not exist in corner cases
        # (e.g. unreadable changes files)
        if not self.changes.has_key("distribution") or not \
               isinstance(self.changes["distribution"], dict):
            self.changes["distribution"] = {}

        byhand = False
        new = False
        summary = ""
        override_summary = ""

        for name, entry in sorted(self.files.items()):
            if entry.has_key("byhand"):
                byhand = True
                summary += name + " byhand\n"

            elif entry.has_key("new"):
                new = True
                summary += "(new) %s %s %s\n" % (name, entry["priority"], entry["section"])

                if entry.has_key("othercomponents"):
                    summary += "WARNING: Already present in %s distribution.\n" % (entry["othercomponents"])

                if entry["type"] == "deb":
                    deb_fh = open_file(name)
                    summary += TagSection(deb_extract_control(deb_fh))["Description"] + '\n'
                    deb_fh.close()

            else:
                entry["pool name"] = poolify(self.changes.get("source", ""), entry["component"])
                destination = entry["pool name"] + name
                summary += name + "\n  to " + destination + "\n"

                if not entry.has_key("type"):
                    entry["type"] = "unknown"

                if entry["type"] in ["deb", "udeb", "dsc"]:
                    # (queue/unchecked), there we have override entries already, use them
                    # (process-new), there we dont have override entries, use the newly generated ones.
                    override_prio = entry.get("override priority", entry["priority"])
                    override_sect = entry.get("override section", entry["section"])
                    override_summary += "%s - %s %s\n" % (name, override_prio, override_sect)

        return (byhand, new, summary, override_summary)