[Git][ghc/ghc][wip/release-fixes] ghcup-metadata: Don't populate dlOutput unless necessary

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Mar 14 16:33:08 UTC 2024



Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC


Commits:
470331cd by Ben Gamari at 2024-03-14T12:32:01-04:00
ghcup-metadata: Don't populate dlOutput unless necessary

ghcup can apparently infer the output name of an artifact from its URL.
Consequently, we should only include the `dlOutput` field when it would
differ from the filename of `dlUri`.

Fixes #24547.

- - - - -


1 changed file:

- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py


Changes:

=====================================
.gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
=====================================
@@ -36,6 +36,7 @@ import os
 import yaml
 import gitlab
 from urllib.request import urlopen
+from urllib.parse import urlparse
 import hashlib
 import sys
 import json
@@ -156,13 +157,18 @@ def mk_one_metadata(release_mode, version, job_map, artifact):
     eprint(f"Bindist URL: {url}")
     eprint(f"Download URL: {final_url}")
 
-    #Download and hash from the release pipeline, this must not change anyway during upload.
+    # Download and hash from the release pipeline, this must not change anyway during upload.
     h = download_and_hash(url)
 
     res = { "dlUri": final_url
           , "dlSubdir": artifact.subdir.format(version=version)
-          , "dlOutput": artifact.output_name.format(version=version)
           , "dlHash" : h }
+
+    # Only add dlOutput if it is inconsistent with the filename inferred from the URL
+    output = artifact.output_name.format(version=version)
+    if Path(urlparse(final_url).path).name != output:
+        res["dlOutput"] = output
+
     eprint(res)
     return res
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/470331cd89b6184125f8876085c2aae073d3ea43

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/470331cd89b6184125f8876085c2aae073d3ea43
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240314/507acfd7/attachment-0001.html>


More information about the ghc-commits mailing list