Sha256: c3de656381538be6b0e11d2fd64522ee294f4e8babe7e2792ac5f6e0593bbe2a

Contents?: true

Size: 1.73 KB

Versions: 20

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,
                        "zypper install '%s'",
                        "zypper -n install '%s'")
            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

20 entries across 20 versions & 1 rubygems

Version Path
autoproj-2.0.0.rc30 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc29 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc28 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc27 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc26 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc25 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc24 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc23 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc22 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc21 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc20 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc19 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc18 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc17 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc16 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc15 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc14 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc13 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc12 lib/autoproj/package_managers/zypper_manager.rb
autoproj-2.0.0.rc11 lib/autoproj/package_managers/zypper_manager.rb