Sha256: e599a4ea8b9fe343c5493f781cd93d6b21f086e809dd53e8c742383d70726d7a

Contents?: true

Size: 1.72 KB

Versions: 18

Compression:

Stored size: 1.72 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
                    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

18 entries across 18 versions & 1 rubygems

Version Path
autoproj-2.3.1 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.3.0 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.2.2 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.2.1 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.2.0 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.1.2 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.1.1 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.1.0 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.1.0.rc1 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.3 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.2 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.1 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc42 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc41 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc40 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc39 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc38 lib/autoproj/package_managers/zypper_manager.rb