Skip to content

Commit bea5f43

Browse files
committed
Nest the by-digest URLs into a subdir to prevent them from drowning out the normal URLs
1 parent c0c81a7 commit bea5f43

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

pulp_deb/app/models/content/content.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def filename(self, component="", layout=LAYOUT_TYPES.NESTED_ALPHABETICALLY):
100100
component,
101101
self.sha256[0:2],
102102
self.sha256[2:6],
103+
"by-digest",
103104
"{}.{}".format(self.name, self.SUFFIX),
104105
)
105106

@@ -227,7 +228,9 @@ def derived_dir(self, component="", layout=LAYOUT_TYPES.NESTED_ALPHABETICALLY):
227228
return os.path.join("pool", component, sourcename[0], sourcename)
228229
else: # NESTED_BY_DIGEST or NESTED_BY_BOTH
229230
sha256 = self.sha256
230-
return os.path.join("pool", component, sha256[0:2], sha256[2:6], sourcename)
231+
return os.path.join(
232+
"pool", component, "by-digest", sha256[0:2], sha256[2:6], sourcename
233+
)
231234

232235
def derived_path(self, name, component="", layout=LAYOUT_TYPES.NESTED_ALPHABETICALLY):
233236
"""Assemble filename in pool directory."""

pulp_deb/tests/functional/api/test_publish.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def test_publish_layout(
242242
if "layout" not in publication_args or publication_args["layout"] == "nested_alphabetically":
243243
expected = r"pool/asgard/[a-z]/"
244244
else: # nested_by_digest or nested_by_both
245-
expected = r"pool/asgard/[0-9a-f]{2}/[0-9a-f]{4}/"
245+
expected = r"pool/asgard/by-digest/[0-9a-f]{2}/[0-9a-f]{4}/"
246246

247247
# Verify than an expected Package index exists, and that the expected URL is
248248
# generated and that the package is actually available.

pulp_deb/tests/unit/test_models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def test_filename_by_digest(self):
6161
"""Test that the pool filename of a package is correct."""
6262
for layout in [LAYOUT_TYPES.NESTED_BY_DIGEST, LAYOUT_TYPES.NESTED_BY_BOTH]:
6363
self.assertEqual(
64-
self.package1.filename(layout=layout), "pool/ee/ff11/aegir_0.1-edda0_sea.deb"
64+
self.package1.filename(layout=layout),
65+
"pool/by-digest/ee/ff11/aegir_0.1-edda0_sea.deb"
6566
)
6667

6768
def test_filename_with_component(self):
@@ -75,7 +76,7 @@ def test_filename_with_component_and_by_digest(self):
7576
for layout in [LAYOUT_TYPES.NESTED_BY_DIGEST, LAYOUT_TYPES.NESTED_BY_BOTH]:
7677
self.assertEqual(
7778
self.package1.filename("joetunn", layout=layout),
78-
"pool/joetunn/ee/ff11/aegir_0.1-edda0_sea.deb",
79+
"pool/joetunn/by-digest/ee/ff11/aegir_0.1-edda0_sea.deb",
7980
)
8081

8182
def test_to822(self):

0 commit comments

Comments
 (0)