Class: Katello::Pulp3::Srpm

Inherits:
PulpContentUnit show all
Includes:
LazyAccessor
Defined in:
app/services/katello/pulp3/srpm.rb

Constant Summary collapse

PULPCORE_CONTENT_TYPE =
"rpm.package".freeze
CONTENT_TYPE =
"srpm".freeze
PULP_INDEXED_FIELDS =
%w(pulp_href prn name version release arch epoch summary location_href pkgId).freeze

Instance Attribute Summary

Attributes inherited from PulpContentUnit

#backend_data, #uuid

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LazyAccessor

included

Methods inherited from PulpContentUnit

add_timestamps, backend_unit_identifier, content_api_create, content_type, content_unit_list, create_content, #fetch_backend_data, fetch_content_list, find_duplicate_unit, #initialize, katello_name_from_pulpcore_name, model_class, pulp_data, pulp_units_batch_all, pulp_units_batch_for_repo, pulp_units_for_ids, supports_id_fetch?, unit_identifier

Constructor Details

This class inherits a constructor from Katello::Pulp3::PulpContentUnit

Class Method Details

.content_api(smart_proxy = SmartProxy.pulp_primary!) ⇒ Object



17
18
19
# File 'app/services/katello/pulp3/srpm.rb', line 17

def self.content_api(smart_proxy = SmartProxy.pulp_primary!)
  PulpRpmClient::ContentPackagesApi.new(Katello::Pulp3::Api::Yum.new(smart_proxy).api_client)
end

.generate_model_row(unit) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'app/services/katello/pulp3/srpm.rb', line 68

def self.generate_model_row(unit)
  custom_json = {}
  custom_json['pulp_id'] = unit['pulp_href']
  custom_json['pulp_prn'] = unit['prn']
  (PULP_INDEXED_FIELDS - ['pulp_href', 'prn', 'pkgId', 'location_href']).
    each { |field| custom_json[field] = unit[field] }
  custom_json['release_sortable'] = Util::Package.sortable_version(unit['release'])
  custom_json['version_sortable'] = Util::Package.sortable_version(unit['version'])
  custom_json['nvra'] = Katello::Util::Package.build_nvra(custom_json)
  custom_json['filename'] = unit['location_href']
  custom_json['checksum'] = unit['pkgId']
  custom_json['summary'] = custom_json['summary']&.truncate(255)
  custom_json
end

.ids_for_repository(repo_id) ⇒ Object



26
27
28
29
30
# File 'app/services/katello/pulp3/srpm.rb', line 26

def self.ids_for_repository(repo_id)
  repo = Katello::Pulp3::Repository::Yum.new(Katello::Repository.find(repo_id), SmartProxy.pulp_primary)
  repo_content_list = repo.content_list
  repo_content_list.map { |content| content.try(:pulp_href) }
end

.page_options(page_opts = {}) ⇒ Object



21
22
23
24
# File 'app/services/katello/pulp3/srpm.rb', line 21

def self.page_options(page_opts = {})
  page_opts["arch"] = "src"
  page_opts
end

Instance Method Details

#build_timeObject



56
57
58
# File 'app/services/katello/pulp3/srpm.rb', line 56

def build_time
  backend_data['time_build']
end

#buildhostObject



32
33
34
# File 'app/services/katello/pulp3/srpm.rb', line 32

def buildhost
  backend_data['rpm_buildhost']
end

#changelogObject



48
49
50
# File 'app/services/katello/pulp3/srpm.rb', line 48

def changelog
  backend_data['changelogs']
end

#checksumtypeObject



44
45
46
# File 'app/services/katello/pulp3/srpm.rb', line 44

def checksumtype
  backend_data['checksum_type']
end

#groupObject



52
53
54
# File 'app/services/katello/pulp3/srpm.rb', line 52

def group
  backend_data['rpm_group']
end

#licenseObject



64
65
66
# File 'app/services/katello/pulp3/srpm.rb', line 64

def license
  backend_data['rpm_license']
end

#relativepathObject



40
41
42
# File 'app/services/katello/pulp3/srpm.rb', line 40

def relativepath
  backend_data['location_href']
end

#sizeObject



60
61
62
# File 'app/services/katello/pulp3/srpm.rb', line 60

def size
  backend_data['size_package']
end

#vendorObject



36
37
38
# File 'app/services/katello/pulp3/srpm.rb', line 36

def vendor
  backend_data['rpm_vendor']
end