Sha256: b232c0d57afba247b83944d7d01c71afe098d284b3f76009acbde575dd51064c

Contents?: true

Size: 1.63 KB

Versions: 101

Compression:

Stored size: 1.63 KB

Contents

module Katello
  module Pulp
    class Deb < PulpContentUnit
      include LazyAccessor

      PULP_SELECT_FIELDS = %w(name version architecture checksumtype checksum).freeze
      PULP_INDEXED_FIELDS = %w(name version architecture description sourcedeb checksum filename _id).freeze
      CONTENT_TYPE = "deb".freeze

      lazy_accessor :pulp_facts, :initializer => :backend_data

      lazy_accessor :description, :license, :buildhost, :vendor, :relativepath, :children, :checksumtype,
                    :changelog, :group, :size, :url, :build_time, :group,
                    :initializer => :pulp_facts

      def update_model(model)
        keys = Pulp::Deb::PULP_INDEXED_FIELDS - ['_id']
        custom_json = backend_data.slice(*keys)
        if custom_json.any? { |name, value| model.send(name) != value }
          model.assign_attributes(custom_json)
          model.save!
        end
      end

      def requires
        if pulp_facts['requires']
          pulp_facts['requires'].map { |entry| Katello::Util::Package.format_requires(entry) }.uniq.sort
        else
          []
        end
      end

      def provides
        if pulp_facts['provides']
          pulp_facts['provides'].map { |entry| Katello::Util::Package.build_nvrea(entry, false) }.uniq.sort
        else
          []
        end
      end

      def files
        result = []
        if pulp_facts['files']
          if pulp_facts['files']['file']
            result << pulp_facts['files']['file']
          end
          if pulp_facts['files']['dir']
            result << pulp_facts['files']['dir']
          end
        end
        result.flatten
      end
    end
  end
end

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
katello-4.3.1 app/services/katello/pulp/deb.rb
katello-4.2.2 app/services/katello/pulp/deb.rb
katello-4.3.0 app/services/katello/pulp/deb.rb
katello-4.3.0.rc4 app/services/katello/pulp/deb.rb
katello-4.3.0.rc3 app/services/katello/pulp/deb.rb
katello-4.3.0.rc2.1 app/services/katello/pulp/deb.rb
katello-4.3.0.rc2 app/services/katello/pulp/deb.rb
katello-4.3.0.rc1 app/services/katello/pulp/deb.rb
katello-4.2.1 app/services/katello/pulp/deb.rb
katello-4.2.0.1 app/services/katello/pulp/deb.rb
katello-4.1.4 app/services/katello/pulp/deb.rb
katello-4.0.3 app/services/katello/pulp/deb.rb
katello-4.2.0.1.rc3 app/services/katello/pulp/deb.rb
katello-3.18.5 app/services/katello/pulp/deb.rb
katello-4.2.0.1.rc2 app/services/katello/pulp/deb.rb
katello-4.2.0.rc2 app/services/katello/pulp/deb.rb
katello-4.1.3 app/services/katello/pulp/deb.rb
katello-4.2.0.rc1 app/services/katello/pulp/deb.rb
katello-4.0.2.1 app/services/katello/pulp/deb.rb
katello-4.1.2.1 app/services/katello/pulp/deb.rb