This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
/
pulp2_models.py
158 lines (128 loc) · 4.79 KB
/
pulp2_models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import logging
from mongoengine import (
BooleanField,
DictField,
IntField,
ListField,
StringField,
)
from pulp_2to3_migration.pulp2.base import (
ContentUnit,
FileContentUnit,
)
_logger = logging.getLogger(__name__)
class NonMetadataPackage(FileContentUnit):
"""
An abstract Pulp 2 model to be subclassed by packages which are not metadata.
"""
version = StringField(required=True)
release = StringField(required=True)
checksum = StringField(required=True)
checksumtype = StringField(required=True)
checksums = DictField()
signing_key = StringField() # not used in the migration plugin
version_sort_index = StringField() # not used in the migration plugin
release_sort_index = StringField() # not used in the migration plugin
meta = {
'abstract': True,
}
class RpmBase(NonMetadataPackage):
"""
An abstract model designed to be sub-classed by both RPM and SRPM.
RPM amd SRPM package types are similar. Most fields map to metadata fields in the RPM package
format.
"""
# Unit Key Fields
name = StringField(required=True)
epoch = StringField(required=True)
version = StringField(required=True)
release = StringField(required=True)
arch = StringField(required=True)
# Other Fields
build_time = IntField() # not used in the migration plugin
buildhost = StringField() # not used in the migration plugin
vendor = StringField() # not used in the migration plugin
size = IntField()
base_url = StringField() # not used in the migration plugin
filename = StringField()
relative_url_path = StringField() # not used in the migration plugin
relativepath = StringField() # not used in the migration plugin
group = StringField() # not used in the migration plugin
provides = ListField() # not used in the migration plugin
files = DictField() # not used in the migration plugin
repodata = DictField(default={})
description = StringField() # not used in the migration plugin
header_range = DictField() # not used in the migration plugin
sourcerpm = StringField() # not used in the migration plugin
license = StringField() # not used in the migration plugin
changelog = ListField() # not used in the migration plugin
url = StringField() # not used in the migration plugin
summary = StringField() # not used in the migration plugin
time = IntField() # not used in the migration plugin
requires = ListField() # not used in the migration plugin
recommends = ListField() # not used in the migration plugin
unit_key_fields = ('name', 'epoch', 'version', 'release', 'arch', 'checksumtype', 'checksum')
meta = {
'indexes': [
"name", "epoch", "version", "release", "arch", "filename", "checksum", "checksumtype",
"version_sort_index", ("version_sort_index", "release_sort_index")
],
'abstract': True,
}
class RPM(RpmBase):
"""
A model for Pulp 2 RPM content type.
It will become a Package content type in Pulp 3 world.
"""
TYPE_ID = 'rpm'
# For backward compatibility
_ns = StringField(default='units_rpm')
_content_type_id = StringField(required=True, default=TYPE_ID)
unit_display_name = 'RPM'
unit_description = 'RPM'
unit_referenced_types = ['erratum']
is_modular = BooleanField(default=False)
meta = {
'collection': 'units_rpm',
'allow_inheritance': False,
}
class Errata(ContentUnit):
"""
A model for Pulp 2 Erratum content type.
It will become an Advisory content type in Pulp 3 world.
"""
TYPE_ID = 'erratum'
errata_id = StringField(required=True)
status = StringField()
updated = StringField(required=True, default='')
description = StringField()
issued = StringField()
pushcount = StringField()
references = ListField()
reboot_suggested = BooleanField()
relogin_suggested = BooleanField()
restart_suggested = BooleanField()
errata_from = StringField(db_field='from')
severity = StringField()
rights = StringField()
version = StringField()
release = StringField()
type = StringField()
pkglist = ListField()
title = StringField()
solution = StringField()
summary = StringField()
# For backward compatibility
_ns = StringField(default='units_erratum')
_content_type_id = StringField(required=True, default='erratum')
unit_key_fields = ('errata_id',)
unit_display_name = 'Erratum'
unit_description = 'Erratum advisory information'
unit_referenced_types = ['rpm']
meta = {
'indexes': [
"version", "release", "type", "status", "updated", "issued", "severity", "references"
],
'collection': 'units_erratum',
'allow_inheritance': False,
}