Sha256: 4b1263065d1844a0d7a26d142e4aa0edcc08da16b26f7106ba4991cbf3a8baa9

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 KB

Contents

module Autoproj
    module PackageManagers
        # Package manger for OpenSuse and Suse (untested)
        class ZypperManager < ShellScriptManager
            def initialize(ws)
                super(ws, true,
                        %w[zypper install],
                        %w[zypper -n install])
            end

            def filter_uptodate_packages(packages)
                `LANG=C rpm -q --whatprovides '#{packages.join("' '")}'`
                has_all_pkgs = $?.success?

                if has_all_pkgs
                    []
                else
                    packages # let zypper filter, we need root now anyways
                end
            end

            def install(packages, filter_uptodate_packages: false, install_only: false)
                if filter_uptodate_packages || install_only
                    packages = filter_uptodate_packages(packages)
                end

                patterns, packages = packages.partition { |pkg| pkg =~ /^@/ }
                patterns = patterns.map { |str| str[1..-1] }
                result = false
                unless patterns.empty?
                    result |= super(patterns,
                                    auto_install_cmd: %w[zypper --non-interactive install --type pattern],
                                    user_install_cmd: %w[zypper install --type pattern])
                end
                result |= super(packages) unless packages.empty?
                if result
                    # Invalidate caching of installed packages, as we just
                    # installed new packages !
                    @installed_packages = nil
                end
            end
        end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
autoproj-2.17.0 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.16.0 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.15.3 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.15.2 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.15.1 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.15.0 lib/autoproj/package_managers/zypper_manager.rb