Skip to content

Commit 89f67a4

Browse files
committed
Rename RustContent to RustPackage
1 parent bcf4e7c commit 89f67a4

17 files changed

Lines changed: 287 additions & 145 deletions

.ci/scripts/check_release.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int:
100100
# Warning: This will not work if branch names contain "/" but we don't really care here.
101101
heads = [h.split("/")[-1] for h in repo.git.branch("--remote").split("\n")]
102102
available_branches = sorted(
103-
{h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)}, key=lambda ver: Version(ver)
103+
{h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)},
104+
key=lambda ver: Version(ver),
104105
) + [DEFAULT_BRANCH]
105106

106107
branches = options.branches
@@ -145,12 +146,20 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int:
145146

146147
last_tag = repo.git.describe("--tags", "--abbrev=0", f"{remote}/{branch}")
147148
req_txt_diff = repo.git.diff(
148-
f"{last_tag}", f"{remote}/{branch}", "--name-only", "--", "requirements.txt"
149+
f"{last_tag}",
150+
f"{remote}/{branch}",
151+
"--name-only",
152+
"--",
153+
"requirements.txt",
149154
)
150155
if req_txt_diff:
151156
reasons.append("requirements.txt")
152157
pyproject_diff = repo.git.diff(
153-
f"{last_tag}", f"{remote}/{branch}", "--name-only", "--", "pyproject.toml"
158+
f"{last_tag}",
159+
f"{remote}/{branch}",
160+
"--name-only",
161+
"--",
162+
"pyproject.toml",
154163
)
155164
if pyproject_diff:
156165
reasons.extend(check_pyproject_dependencies(repo, last_tag, f"{remote}/{branch}"))

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ For understanding the Cargo registry protocol, refer to the upstream documentati
6363
## Common pitfalls
6464

6565
- **Cargo.toml is authoritative during publish**: When a crate is published, dependencies are extracted from the `Cargo.toml` inside the `.crate` tarball, NOT from the JSON metadata submitted alongside it. This is an intentional security measure (see rust-lang/cargo#14492).
66-
- **RustDependency is NOT a Content type**: Unlike `RustContent` and `RustPackageYank`, `RustDependency` is a regular Django model with an FK to `RustContent`. Do not treat it as a Pulpcore Content subclass.
66+
- **RustDependency is NOT a Content type**: Unlike `RustPackage` and `RustPackageYank`, `RustDependency` is a regular Django model with an FK to `RustPackage`. Do not treat it as a Pulpcore Content subclass.
6767
- **Django app label is `rust`, not `pulp_rust`**: When running Django management commands (e.g. `makemigrations`), use the app label `rust`. The Python package is `pulp_rust` but the Django app label is set to `rust` in `PulpRustPluginAppConfig`.
6868

pulp_rust/app/migrations/0001_initial.py

Lines changed: 151 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,99 +6,197 @@
66

77

88
class Migration(migrations.Migration):
9-
109
initial = True
1110

1211
dependencies = [
13-
('core', '0106_alter_artifactdistribution_distribution_ptr_and_more'),
12+
("core", "0106_alter_artifactdistribution_distribution_ptr_and_more"),
1413
]
1514

1615
operations = [
1716
migrations.CreateModel(
18-
name='RustContent',
17+
name="RustContent",
1918
fields=[
20-
('content_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.content')),
21-
('name', models.CharField(db_index=True, max_length=255)),
22-
('canonical_name', models.CharField(db_index=True, max_length=255)),
23-
('vers', models.CharField(db_index=True, max_length=64)),
24-
('cksum', models.CharField(db_index=True, max_length=64)),
25-
('features', models.JSONField(blank=True, default=dict)),
26-
('features2', models.JSONField(blank=True, default=dict, null=True)),
27-
('links', models.CharField(blank=True, max_length=255, null=True)),
28-
('rust_version', models.CharField(blank=True, max_length=32, null=True)),
29-
('v', models.IntegerField(default=1)),
30-
('_pulp_domain', models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain')),
19+
(
20+
"content_ptr",
21+
models.OneToOneField(
22+
auto_created=True,
23+
on_delete=django.db.models.deletion.CASCADE,
24+
parent_link=True,
25+
primary_key=True,
26+
serialize=False,
27+
to="core.content",
28+
),
29+
),
30+
("name", models.CharField(db_index=True, max_length=255)),
31+
("canonical_name", models.CharField(db_index=True, max_length=255)),
32+
("vers", models.CharField(db_index=True, max_length=64)),
33+
("cksum", models.CharField(db_index=True, max_length=64)),
34+
("features", models.JSONField(blank=True, default=dict)),
35+
("features2", models.JSONField(blank=True, default=dict, null=True)),
36+
("links", models.CharField(blank=True, max_length=255, null=True)),
37+
(
38+
"rust_version",
39+
models.CharField(blank=True, max_length=32, null=True),
40+
),
41+
("v", models.IntegerField(default=1)),
42+
(
43+
"_pulp_domain",
44+
models.ForeignKey(
45+
default=pulpcore.app.util.get_domain_pk,
46+
on_delete=django.db.models.deletion.PROTECT,
47+
to="core.domain",
48+
),
49+
),
3150
],
3251
options={
33-
'default_related_name': '%(app_label)s_%(model_name)s',
34-
'unique_together': {('name', 'vers', 'cksum', '_pulp_domain')},
52+
"default_related_name": "%(app_label)s_%(model_name)s",
53+
"unique_together": {("name", "vers", "cksum", "_pulp_domain")},
3554
},
36-
bases=('core.content',),
55+
bases=("core.content",),
3756
),
3857
migrations.CreateModel(
39-
name='RustDistribution',
58+
name="RustDistribution",
4059
fields=[
41-
('distribution_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.distribution')),
42-
('allow_uploads', models.BooleanField(default=False)),
60+
(
61+
"distribution_ptr",
62+
models.OneToOneField(
63+
auto_created=True,
64+
on_delete=django.db.models.deletion.CASCADE,
65+
parent_link=True,
66+
primary_key=True,
67+
serialize=False,
68+
to="core.distribution",
69+
),
70+
),
71+
("allow_uploads", models.BooleanField(default=False)),
4372
],
4473
options={
45-
'default_related_name': '%(app_label)s_%(model_name)s',
74+
"default_related_name": "%(app_label)s_%(model_name)s",
4675
},
47-
bases=('core.distribution',),
76+
bases=("core.distribution",),
4877
),
4978
migrations.CreateModel(
50-
name='RustRemote',
79+
name="RustRemote",
5180
fields=[
52-
('remote_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.remote')),
81+
(
82+
"remote_ptr",
83+
models.OneToOneField(
84+
auto_created=True,
85+
on_delete=django.db.models.deletion.CASCADE,
86+
parent_link=True,
87+
primary_key=True,
88+
serialize=False,
89+
to="core.remote",
90+
),
91+
),
5392
],
5493
options={
55-
'default_related_name': '%(app_label)s_%(model_name)s',
94+
"default_related_name": "%(app_label)s_%(model_name)s",
5695
},
57-
bases=('core.remote',),
96+
bases=("core.remote",),
5897
),
5998
migrations.CreateModel(
60-
name='RustRepository',
99+
name="RustRepository",
61100
fields=[
62-
('repository_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.repository')),
101+
(
102+
"repository_ptr",
103+
models.OneToOneField(
104+
auto_created=True,
105+
on_delete=django.db.models.deletion.CASCADE,
106+
parent_link=True,
107+
primary_key=True,
108+
serialize=False,
109+
to="core.repository",
110+
),
111+
),
63112
],
64113
options={
65-
'default_related_name': '%(app_label)s_%(model_name)s',
114+
"default_related_name": "%(app_label)s_%(model_name)s",
66115
},
67-
bases=('core.repository',),
116+
bases=("core.repository",),
68117
),
69118
migrations.CreateModel(
70-
name='RustDependency',
119+
name="RustDependency",
71120
fields=[
72-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
73-
('name', models.CharField(max_length=255)),
74-
('req', models.CharField(max_length=255)),
75-
('features', models.JSONField(blank=True, default=list)),
76-
('optional', models.BooleanField(default=False)),
77-
('default_features', models.BooleanField(default=True)),
78-
('target', models.CharField(blank=True, max_length=255, null=True)),
79-
('kind', models.CharField(choices=[('normal', 'Normal'), ('dev', 'Development'), ('build', 'Build')], default='normal', max_length=16)),
80-
('registry', models.CharField(blank=True, max_length=512, null=True)),
81-
('package', models.CharField(blank=True, max_length=255, null=True)),
82-
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dependencies', to='rust.rustcontent')),
121+
(
122+
"id",
123+
models.AutoField(
124+
auto_created=True,
125+
primary_key=True,
126+
serialize=False,
127+
verbose_name="ID",
128+
),
129+
),
130+
("name", models.CharField(max_length=255)),
131+
("req", models.CharField(max_length=255)),
132+
("features", models.JSONField(blank=True, default=list)),
133+
("optional", models.BooleanField(default=False)),
134+
("default_features", models.BooleanField(default=True)),
135+
("target", models.CharField(blank=True, max_length=255, null=True)),
136+
(
137+
"kind",
138+
models.CharField(
139+
choices=[
140+
("normal", "Normal"),
141+
("dev", "Development"),
142+
("build", "Build"),
143+
],
144+
default="normal",
145+
max_length=16,
146+
),
147+
),
148+
("registry", models.CharField(blank=True, max_length=512, null=True)),
149+
("package", models.CharField(blank=True, max_length=255, null=True)),
150+
(
151+
"content",
152+
models.ForeignKey(
153+
on_delete=django.db.models.deletion.CASCADE,
154+
related_name="dependencies",
155+
to="rust.rustcontent",
156+
),
157+
),
83158
],
84159
options={
85-
'verbose_name_plural': 'rust dependencies',
86-
'default_related_name': '%(app_label)s_%(model_name)s',
87-
'indexes': [models.Index(fields=['content', 'kind'], name='rust_rustde_content_a46e30_idx'), models.Index(fields=['name'], name='rust_rustde_name_6a2db4_idx')],
160+
"verbose_name_plural": "rust dependencies",
161+
"default_related_name": "%(app_label)s_%(model_name)s",
162+
"indexes": [
163+
models.Index(
164+
fields=["content", "kind"],
165+
name="rust_rustde_content_a46e30_idx",
166+
),
167+
models.Index(fields=["name"], name="rust_rustde_name_6a2db4_idx"),
168+
],
88169
},
89170
),
90171
migrations.CreateModel(
91-
name='RustPackageYank',
172+
name="RustPackageYank",
92173
fields=[
93-
('content_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.content')),
94-
('name', models.CharField(db_index=True, max_length=255)),
95-
('vers', models.CharField(db_index=True, max_length=64)),
96-
('_pulp_domain', models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain')),
174+
(
175+
"content_ptr",
176+
models.OneToOneField(
177+
auto_created=True,
178+
on_delete=django.db.models.deletion.CASCADE,
179+
parent_link=True,
180+
primary_key=True,
181+
serialize=False,
182+
to="core.content",
183+
),
184+
),
185+
("name", models.CharField(db_index=True, max_length=255)),
186+
("vers", models.CharField(db_index=True, max_length=64)),
187+
(
188+
"_pulp_domain",
189+
models.ForeignKey(
190+
default=pulpcore.app.util.get_domain_pk,
191+
on_delete=django.db.models.deletion.PROTECT,
192+
to="core.domain",
193+
),
194+
),
97195
],
98196
options={
99-
'default_related_name': '%(app_label)s_%(model_name)s',
100-
'unique_together': {('name', 'vers', '_pulp_domain')},
197+
"default_related_name": "%(app_label)s_%(model_name)s",
198+
"unique_together": {("name", "vers", "_pulp_domain")},
101199
},
102-
bases=('core.content',),
200+
bases=("core.content",),
103201
),
104202
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.2.11 on 2026-04-23 17:49
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("core", "0149_distributedpublication"),
9+
("rust", "0001_initial"),
10+
]
11+
12+
operations = [
13+
migrations.RenameModel(
14+
old_name="RustContent",
15+
new_name="RustPackage",
16+
),
17+
]

0 commit comments

Comments
 (0)