Class: Katello::Pulp3::Rpm
Constant Summary
collapse
- CONTENT_TYPE =
"rpm".freeze
- PULPCORE_CONTENT_TYPE =
"rpm.package".freeze
- PULP_INDEXED_FIELDS =
%w(pulp_href prn name version release arch epoch summary is_modular rpm_sourcerpm location_href pkgId).freeze
Instance Attribute Summary
#backend_data, #uuid
Class Method Summary
collapse
Instance Method Summary
collapse
included
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
Class Method Details
.content_api ⇒ Object
14
15
16
|
# File 'app/services/katello/pulp3/rpm.rb', line 14
def self.content_api
PulpRpmClient::ContentPackagesApi.new(Katello::Pulp3::Api::Yum.new(SmartProxy.pulp_primary!).api_client)
end
|
.generate_model_row(unit) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'app/services/katello/pulp3/rpm.rb', line 89
def self.generate_model_row(unit)
custom_json = {}
custom_json['modular'] = unit['is_modular']
custom_json['pulp_id'] = unit['pulp_href']
custom_json['pulp_prn'] = unit['prn'] (PULP_INDEXED_FIELDS - ['is_modular', 'pulp_href', 'prn', 'rpm_sourcerpm', '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['filename'] = parse_filename(unit['location_href']) custom_json['checksum'] = unit['pkgId']
custom_json['sourcerpm'] = unit['rpm_sourcerpm']
custom_json['nvra'] = Util::Package.build_nvra(custom_json.with_indifferent_access)
custom_json['summary'] = custom_json['summary']&.truncate(255)
custom_json
end
|
.ids_for_repository(repo_id) ⇒ Object
18
19
20
21
22
|
# File 'app/services/katello/pulp3/rpm.rb', line 18
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
24
25
26
27
|
# File 'app/services/katello/pulp3/rpm.rb', line 24
def self.page_options(page_opts = {})
page_opts["arch__ne"] = "src"
page_opts
end
|
.parse_filename(path) ⇒ Object
85
86
87
|
# File 'app/services/katello/pulp3/rpm.rb', line 85
def self.parse_filename(path)
File.split(path).last unless path.blank?
end
|
Instance Method Details
#build_time ⇒ Object
73
74
75
|
# File 'app/services/katello/pulp3/rpm.rb', line 73
def build_time
backend_data['time_build']
end
|
#buildhost ⇒ Object
49
50
51
|
# File 'app/services/katello/pulp3/rpm.rb', line 49
def buildhost
backend_data['rpm_buildhost']
end
|
#changelog ⇒ Object
65
66
67
|
# File 'app/services/katello/pulp3/rpm.rb', line 65
def changelog
backend_data['changelogs']
end
|
#checksumtype ⇒ Object
61
62
63
|
# File 'app/services/katello/pulp3/rpm.rb', line 61
def checksumtype
backend_data['checksum_type']
end
|
#files ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/services/katello/pulp3/rpm.rb', line 37
def files
files = backend_data['files'].collect do |file_and_path|
if file_and_path[0][0] != '/'
file_and_path.shift
end
file_and_path.join('')
end
files.uniq
end
|
#group ⇒ Object
69
70
71
|
# File 'app/services/katello/pulp3/rpm.rb', line 69
def group
backend_data['rpm_group']
end
|
#license ⇒ Object
81
82
83
|
# File 'app/services/katello/pulp3/rpm.rb', line 81
def license
backend_data['rpm_license']
end
|
#relativepath ⇒ Object
57
58
59
|
# File 'app/services/katello/pulp3/rpm.rb', line 57
def relativepath
backend_data['location_href']
end
|
#size ⇒ Object
77
78
79
|
# File 'app/services/katello/pulp3/rpm.rb', line 77
def size
backend_data['size_package']
end
|
#vendor ⇒ Object
53
54
55
|
# File 'app/services/katello/pulp3/rpm.rb', line 53
def vendor
backend_data['rpm_vendor']
end
|