[Git][ghc/ghc][wip/test-nightlies] ghcup-metadata: Add dlOutput field

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Fri May 19 13:57:22 UTC 2023



Matthew Pickering pushed to branch wip/test-nightlies at Glasgow Haskell Compiler / GHC


Commits:
66c609ae by Matthew Pickering at 2023-05-19T14:57:14+01:00
ghcup-metadata: Add dlOutput field

ghcup now requires us to add this field which specifies where it should
download the bindist to. See
https://gitlab.haskell.org/ghc/ghcup-metadata/-/issues/1 for some more
discussion.

- - - - -


1 changed file:

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


Changes:

=====================================
.gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
=====================================
@@ -63,7 +63,8 @@ eprint(f"Supported platforms: {job_mapping.keys()}")
 # Artifact precisely specifies a job what the bindist to download is called.
 class Artifact(NamedTuple):
     job_name: str
-    name: str
+    download_name: str
+    output_name: str
     subdir: str
 
 # Platform spec provides a specification which is agnostic to Job
@@ -72,8 +73,14 @@ class PlatformSpec(NamedTuple):
     name: str
     subdir: str
 
-source_artifact = Artifact('source-tarball', 'ghc-{version}-src.tar.xz', 'ghc-{version}' )
-test_artifact = Artifact('source-tarball', 'ghc-{version}-testsuite.tar.xz', 'ghc-{version}' )
+source_artifact = Artifact('source-tarball'
+                          , 'ghc-{version}-src.tar.xz'
+                          , 'ghc-{version}-src.tar.xz'
+                          , 'ghc-{version}' )
+test_artifact = Artifact('source-tarball'
+                        , 'ghc-{version}-testsuite.tar.xz'
+                        , 'ghc-{version}-testsuite.tar.xz'
+                        , 'ghc-{version}' )
 
 def debian(arch, n):
     return linux_platform(arch, "{arch}-linux-deb{n}".format(arch=arch, n=n))
@@ -129,7 +136,7 @@ def download_and_hash(url):
 def mk_one_metadata(release_mode, version, job_map, artifact):
     job_id = job_map[artifact.job_name].id
 
-    url = base_url.format(job_id=job_id, artifact_name=urllib.parse.quote_plus(artifact.name.format(version=version)))
+    url = base_url.format(job_id=job_id, artifact_name=urllib.parse.quote_plus(artifact.download_name.format(version=version)))
 
     # In --release-mode, the URL in the metadata needs to point into the downloads folder
     # rather then the pipeline.
@@ -143,10 +150,13 @@ 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), "dlHash" : h }
+    res = { "dlUri": final_url
+          , "dlSubdir": artifact.subdir.format(version=version)
+          , "dlOutput": artifact.output_name.format(version=version)
+          , "dlHash" : h }
     eprint(res)
     return res
 
@@ -155,7 +165,11 @@ def mk_one_metadata(release_mode, version, job_map, artifact):
 def mk_from_platform(pipeline_type, platform):
     info = job_mapping[platform.name][pipeline_type]
     eprint(f"From {platform.name} / {pipeline_type} selecting {info['name']}")
-    return Artifact(info['name'] , f"{info['jobInfo']['bindistName']}.tar.xz", platform.subdir)
+    return Artifact(info['name']
+                   , f"{info['jobInfo']['bindistName']}.tar.xz"
+                   , "ghc-{version}-{pn}.tar.xz".format(version="{version}", pn=platform.name)
+                   , platform.subdir)
+
 
 # Generate the new metadata for a specific GHC mode etc
 def mk_new_yaml(release_mode, version, date, pipeline_type, job_map):



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66c609ae1c60cf6d1bdec1a7e077c0937d3d8ef1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66c609ae1c60cf6d1bdec1a7e077c0937d3d8ef1
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/20230519/5b1de29d/attachment-0001.html>


More information about the ghc-commits mailing list