lib/rpm/transaction.rb
def delete(pkg)
      iterator = case pkg
                 when Package
                   pkg[:sigmd5] ? each_match(:sigmd5, pkg[:sigmd5]) : each_match(:label, pkg[:label])
                 when String
                   each_match(:label, pkg)
                 when Dependency
                   each_match(:label, pkg.name).set_iterator_version(pkg.version)
                 else
                   raise TypeError, 'illegal argument type'
                 end

      iterator.each do |header|
        ret = RPM::C.rpmtsAddEraseElement(@ptr, header.ptr, iterator.offset)
        raise "Error while adding erase/#{pkg} to transaction" if ret != 0
      end
    end
def delete(pkg)
      iterator = case pkg
                 when Package
                   pkg[:sigmd5] ? each_match(:sigmd5, pkg[:sigmd5]) : each_match(:label, pkg[:label])
                 when String
                   each_match(:label, pkg)
                 when Dependency
                   each_match(:label, pkg.name).set_iterator_version(pkg.version)
                 else
                   raise TypeError, 'illegal argument type'
                 end

      iterator.each do |header|
        ret = RPM::C.rpmtsAddEraseElement(@ptr, header.ptr, iterator.offset)
        raise "Error while adding erase/#{pkg} to transaction" if ret != 0
      end
    end
Add a delete operation to the transaction
 @param [String, Package, Dependency] pkg Package to delete