Exemple #1
0
    def build_delta_packages(self, package, outdir):
        max_delta_count = int(ctx.config.values.build.max_delta_count)

        if not max_delta_count:
            return []

        old_package_dirs = (ctx.config.compiled_packages_dir(),
                            ctx.config.debug_packages_dir(),
                            outdir or ".")

        old_packages = []
        for update in self.spec.history[1:]:
            filename = self.package_filename(package.metadata.package, update)

            for package_dir in old_package_dirs:
                path = util.join_path(package_dir, filename)
                if os.path.exists(path):
                    old_packages.append(path)
                    break

            if len(old_packages) == max_delta_count:
                break

        from pisi.operations.delta import create_delta_packages_from_obj
        return create_delta_packages_from_obj(old_packages,
                                              package,
                                              self.specdir)
Exemple #2
0
    def build_delta_packages(self, package):

        def find_old_package(filename, search_paths):
            for package_dir in search_paths:
                path = util.join_path(package_dir, filename)
                if os.path.exists(path):
                    return path

        old_packages = {}

        for old_release, search_paths in self.delta_search_paths.items():
            if old_release in old_packages:
                continue

            update = None
            for update_tag in self.spec.history[1:]:
                if update_tag.release == old_release:
                    update = update_tag
                    break
            else:
                continue

            filename = self.package_filename(package.metadata.package, update)
            old_package = find_old_package(filename, search_paths)
            if old_package:
                old_packages[old_release] = old_package

        for search_paths, max_count in self.delta_history_search_paths:
            if max_count < 1:
                continue

            found_old_packages = {}
            for update in self.spec.history[1:]:
                if update.release in old_packages:
                    continue

                filename = self.package_filename(package.metadata.package,
                                                 update)
                old_package = find_old_package(filename, search_paths)
                if old_package:
                    found_old_packages[update.release] = old_package

                    if len(found_old_packages) == max_count:
                        break

            old_packages.update(found_old_packages)

        from pisi.operations.delta import create_delta_packages_from_obj
        return create_delta_packages_from_obj(old_packages.values(),
                                              package,
                                              self.specdir)
Exemple #3
0
    def build_delta_packages(self, package):
        def find_old_package(filename, search_paths):
            for package_dir in search_paths:
                path = util.join_path(package_dir, filename)
                if os.path.exists(path):
                    return path

        old_packages = {}

        for old_release, search_paths in self.delta_search_paths.items():
            if old_release in old_packages:
                continue

            update = None
            for update_tag in self.spec.history[1:]:
                if update_tag.release == old_release:
                    update = update_tag
                    break
            else:
                continue

            filename = self.package_filename(package.metadata.package, update)
            old_package = find_old_package(filename, search_paths)
            if old_package:
                old_packages[old_release] = old_package

        for search_paths, max_count in self.delta_history_search_paths:
            if max_count < 1:
                continue

            found_old_packages = {}
            for update in self.spec.history[1:]:
                if update.release in old_packages:
                    continue

                filename = self.package_filename(package.metadata.package,
                                                 update)
                old_package = find_old_package(filename, search_paths)
                if old_package:
                    found_old_packages[update.release] = old_package

                    if len(found_old_packages) == max_count:
                        break

            old_packages.update(found_old_packages)

        from pisi.operations.delta import create_delta_packages_from_obj
        return create_delta_packages_from_obj(old_packages.values(), package,
                                              self.specdir)