-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sync support for content types from comps.xml
Updates model relations, adds serializers, constants, viewsets, libcomps parsing, and sync support for comps.xml content types closes #5423 https://pulp.plan.io/issues/5423
- Loading branch information
1 parent
789fc83
commit ec0ed46
Showing
10 changed files
with
973 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Comps.xml sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import hashlib | ||
|
||
|
||
def strdict_to_dict(value): | ||
""" | ||
Convert libcomps StrDict type object to standard dict. | ||
Args: | ||
value: a libcomps StrDict | ||
Returns: | ||
lang_dict: a dict | ||
""" | ||
lang_dict = {} | ||
if len(value): | ||
for i, j in value.items(): | ||
lang_dict[i] = j | ||
return lang_dict | ||
|
||
|
||
def dict_digest(dict): | ||
""" | ||
Calculate a hexdigest for a given dictionary. | ||
Args: | ||
dict: a dictionary | ||
Returns: | ||
A digest | ||
""" | ||
prep_hash = list(dict.values()) | ||
str_prep_hash = [str(i) for i in prep_hash] | ||
str_prep_hash.sort() | ||
return hashlib.sha256(''.join(str_prep_hash).encode('utf-8')).hexdigest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Generated by Django 2.2.6 on 2019-10-25 18:50 | ||
|
||
import django.contrib.postgres.fields.jsonb | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0011_relative_path'), | ||
('rpm', '0005_pulp_fields'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PackageCategory', | ||
fields=[ | ||
('content_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='rpm_packagecategory', serialize=False, to='core.Content')), | ||
('id', models.CharField(max_length=255)), | ||
('name', models.CharField(max_length=255)), | ||
('description', models.TextField(default='')), | ||
('display_order', models.IntegerField()), | ||
('group_ids', django.contrib.postgres.fields.jsonb.JSONField(default=list)), | ||
('desc_by_lang', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), | ||
('name_by_lang', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), | ||
('digest', models.CharField(max_length=64, unique=True)), | ||
], | ||
options={ | ||
'default_related_name': '%(app_label)s_%(model_name)s', | ||
}, | ||
bases=('core.content',), | ||
), | ||
migrations.CreateModel( | ||
name='PackageEnvironment', | ||
fields=[ | ||
('content_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='rpm_packageenvironment', serialize=False, to='core.Content')), | ||
('id', models.CharField(max_length=255)), | ||
('name', models.CharField(max_length=255)), | ||
('description', models.TextField(default='')), | ||
('display_order', models.IntegerField(null=True)), | ||
('group_ids', django.contrib.postgres.fields.jsonb.JSONField(default=list)), | ||
('option_ids', django.contrib.postgres.fields.jsonb.JSONField(default=list)), | ||
('desc_by_lang', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), | ||
('name_by_lang', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), | ||
('digest', models.CharField(max_length=64, unique=True)), | ||
], | ||
options={ | ||
'default_related_name': '%(app_label)s_%(model_name)s', | ||
}, | ||
bases=('core.content',), | ||
), | ||
migrations.CreateModel( | ||
name='PackageLangpacks', | ||
fields=[ | ||
('content_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='rpm_packagelangpacks', serialize=False, to='core.Content')), | ||
('matches', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), | ||
('digest', models.CharField(max_length=64, unique=True)), | ||
], | ||
options={ | ||
'default_related_name': '%(app_label)s_%(model_name)s', | ||
}, | ||
bases=('core.content',), | ||
), | ||
migrations.RemoveField( | ||
model_name='environment', | ||
name='content_ptr', | ||
), | ||
migrations.RemoveField( | ||
model_name='langpacks', | ||
name='content_ptr', | ||
), | ||
migrations.AddField( | ||
model_name='packagegroup', | ||
name='related_packages', | ||
field=models.ManyToManyField(related_name='rpm_packagegroup', to='rpm.Package'), | ||
), | ||
migrations.AlterField( | ||
model_name='packagegroup', | ||
name='desc_by_lang', | ||
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict), | ||
), | ||
migrations.AlterField( | ||
model_name='packagegroup', | ||
name='description', | ||
field=models.TextField(default=''), | ||
), | ||
migrations.AlterField( | ||
model_name='packagegroup', | ||
name='name_by_lang', | ||
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict), | ||
), | ||
migrations.AlterField( | ||
model_name='packagegroup', | ||
name='packages', | ||
field=django.contrib.postgres.fields.jsonb.JSONField(default=list), | ||
), | ||
migrations.DeleteModel( | ||
name='Category', | ||
), | ||
migrations.DeleteModel( | ||
name='Environment', | ||
), | ||
migrations.DeleteModel( | ||
name='Langpacks', | ||
), | ||
migrations.AddField( | ||
model_name='packageenvironment', | ||
name='optionalgroups', | ||
field=models.ManyToManyField(related_name='optionalgroups_to_env', to='rpm.PackageGroup'), | ||
), | ||
migrations.AddField( | ||
model_name='packageenvironment', | ||
name='packagegroups', | ||
field=models.ManyToManyField(related_name='packagegroups_to_env', to='rpm.PackageGroup'), | ||
), | ||
migrations.AddField( | ||
model_name='packagecategory', | ||
name='packagegroups', | ||
field=models.ManyToManyField(related_name='rpm_packagecategory', to='rpm.PackageGroup'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 2.2.6 on 2019-11-01 16:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('rpm', '0006_auto_20191025_1850'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='packagecategory', | ||
name='display_order', | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='packagegroup', | ||
name='display_order', | ||
field=models.IntegerField(null=True), | ||
), | ||
] |
Oops, something went wrong.