Class: Katello::Pulp3::Srpm

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

Constant Summary collapse

CONTENT_TYPE =
"srpm".freeze
PULP_INDEXED_FIELDS =
%w(pulp_href 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, 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_apiObject



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

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

.generate_model_row(unit) ⇒ Object



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

def self.generate_model_row(unit)
  custom_json = {}
  custom_json['pulp_id'] = unit['pulp_href']
  (PULP_INDEXED_FIELDS - ['pulp_href', '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



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

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



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

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

Instance Method Details

#build_timeObject



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

def build_time
  backend_data['time_build']
end

#buildhostObject



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

def buildhost
  backend_data['rpm_buildhost']
end

#changelogObject



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

def changelog
  backend_data['changelogs']
end

#checksumtypeObject



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

def checksumtype
  backend_data['checksum_type']
end

#groupObject



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

def group
  backend_data['rpm_group']
end

#licenseObject



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

def license
  backend_data['rpm_license']
end

#relativepathObject



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

def relativepath
  backend_data['location_href']
end

#sizeObject



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

def size
  backend_data['size_package']
end

#vendorObject



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

def vendor
  backend_data['rpm_vendor']
end