File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,11 +56,14 @@ def write_simple_api(publication):
5656 domain = get_domain ()
5757 simple_dir = "simple/"
5858 os .mkdir (simple_dir )
59+ # Secondary ORDER BY makes DISTINCT ON pick a stable display name when
60+ # metadata names differ but canonicalize to the same name_normalized
61+ # (e.g. msg-parser vs msg_parser).
5962 project_names = (
6063 python_models .PythonPackageContent .objects .filter (
6164 pk__in = publication .repository_version .content , _pulp_domain = domain
6265 )
63- .order_by ("name_normalized" )
66+ .order_by ("name_normalized" , "name" )
6467 .values_list ("name" , flat = True )
6568 .distinct ("name_normalized" )
6669 )
@@ -81,7 +84,7 @@ def write_simple_api(publication):
8184 packages = python_models .PythonPackageContent .objects .filter (
8285 pk__in = publication .repository_version .content , _pulp_domain = domain
8386 )
84- releases = packages .order_by ("name_normalized" ).values ("name" , "filename" , "sha256" )
87+ releases = packages .order_by ("name_normalized" , "filename" ).values ("name" , "filename" , "sha256" )
8588
8689 ind = 0
8790 current_name = canonicalize_name (project_names [ind ])
You can’t perform that action at this time.
0 commit comments