Sha256: a96bc10b01e0882e9ed0f52cc20146bac8361a54e239b625a4508743a65179ef

Contents?: true

Size: 1.46 KB

Versions: 515

Compression:

Stored size: 1.46 KB

Contents

Puppet::Type.type(:package).provide :urpmi, :parent => :rpm, :source => :rpm do
  desc "Support via `urpmi`."
  commands :urpmi => "urpmi", :urpmq => "urpmq", :rpm => "rpm", :urpme => "urpme"

  defaultfor :operatingsystem => [:mandriva, :mandrake]

  has_feature :versionable

  def install
    should = @resource.should(:ensure)
    self.debug "Ensuring => #{should}"
    wanted = @resource[:name]

    # XXX: We don't actually deal with epochs here.
    case should
    when true, false, Symbol
      # pass
    else
      # Add the package version
      wanted += "-#{should}"
    end

    urpmi "--auto", wanted

    unless self.query
      raise Puppet::Error, _("Package %{name} was not present after trying to install it") % { name: self.name }
    end
  end

  # What's the latest package version available?
  def latest
    output = urpmq "-S", @resource[:name]

    if output =~ /^#{Regexp.escape @resource[:name]}\s+:\s+.*\(\s+(\S+)\s+\)/
      return $1
    else
      # urpmi didn't find updates, pretend the current
      # version is the latest
      return @resource[:ensure]
    end
  end

  def update
    # Install in urpmi can be used for update, too
    self.install
  end

  # For normal package removal the urpmi provider will delegate to the RPM
  # provider. If the package to remove has dependencies then uninstalling via
  # rpm will fail, but `urpme` can be used to remove a package and its
  # dependencies.
  def purge
    urpme '--auto', @resource[:name]
  end
end

Version data entries

515 entries across 515 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/provider/package/urpmi.rb
puppet-7.34.0-x86-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.34.0-x64-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.34.0-universal-darwin lib/puppet/provider/package/urpmi.rb
puppet-7.33.0 lib/puppet/provider/package/urpmi.rb
puppet-7.33.0-x86-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.33.0-x64-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.33.0-universal-darwin lib/puppet/provider/package/urpmi.rb
puppet-7.32.1 lib/puppet/provider/package/urpmi.rb
puppet-7.32.1-x86-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.32.1-x64-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.32.1-universal-darwin lib/puppet/provider/package/urpmi.rb
puppet-7.31.0 lib/puppet/provider/package/urpmi.rb
puppet-7.31.0-x86-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.31.0-x64-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.31.0-universal-darwin lib/puppet/provider/package/urpmi.rb
puppet-7.30.0 lib/puppet/provider/package/urpmi.rb
puppet-7.30.0-x86-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.30.0-x64-mingw32 lib/puppet/provider/package/urpmi.rb
puppet-7.30.0-universal-darwin lib/puppet/provider/package/urpmi.rb