Sha256: 851479df6f71ebd4bec46cf70a9c38ea5f436b1d755c8fda41431ceee5fa0226

Contents?: true

Size: 1.73 KB

Versions: 7

Compression:

Stored size: 1.73 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)
                result = `LANG=C rpm -q --whatprovides '#{packages.join("' '")}'`
                has_all_pkgs = $?.success?

                if !has_all_pkgs
                    return packages # let zypper filter, we need root now anyways
                else 
                    return []
                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
                if !patterns.empty?
                    result |= super(patterns,
                                    auto_install_cmd: "zypper --non-interactive install --type pattern '%s'",
                                    user_install_cmd: "zypper install --type pattern '%s'")
                end
                if !packages.empty?
                    result |= super(packages)
                end
                if result
                    # Invalidate caching of installed packages, as we just
                    # installed new packages !
                    @installed_packages = nil
                end
            end
        end
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
autoproj-2.0.0.rc37 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc36 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc35 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc34 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc33 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc32 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc31 lib/autoproj/package_managers/zypper_manager.rb