Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
haskell-wasm
GHC
Commits
1dbc7846
Commit
1dbc7846
authored
2 months ago
by
Matthew Pickering
Committed by
Marge Bot
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Revert "mk-ghcup-metadata: Clean up and add type annotations"
This reverts commit
64ea68d9
. See
#25889
parent
bdf93da8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
+19
-22
19 additions, 22 deletions
.gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
with
19 additions
and
22 deletions
.gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
+
19
−
22
View file @
1dbc7846
...
...
@@ -43,9 +43,10 @@ import json
import
urllib.parse
import
fetch_gitlab
def
eprint
(
*
args
,
**
kwargs
)
->
None
:
def
eprint
(
*
args
,
**
kwargs
):
print
(
*
args
,
file
=
sys
.
stderr
,
**
kwargs
)
gl
=
gitlab
.
Gitlab
(
'
https://gitlab.haskell.org
'
,
per_page
=
100
)
# TODO: Take this file as an argument
...
...
@@ -59,10 +60,6 @@ with open(metadata_file, 'r') as f:
eprint
(
f
"
Supported platforms:
{
job_mapping
.
keys
()
}
"
)
# Mapping from job name to its corresponding Job
JobMap
=
Dict
[
str
,
gitlab
.
Job
]
GhcupDist
=
object
# Artifact precisely specifies a job what the bindist to download is called.
class
Artifact
(
NamedTuple
):
...
...
@@ -89,32 +86,32 @@ test_artifact = Artifact('source-tarball'
,
'
ghc-{version}/testsuite
'
,
'
ghc{version}-testsuite
'
)
def
darwin
(
arch
:
str
)
->
PlatformSpec
:
def
debian
(
n
,
arch
=
'
x86_64
'
):
return
linux_platform
(
arch
,
"
{arch}-linux-deb{n}
"
.
format
(
arch
=
arch
,
n
=
n
))
def
darwin
(
arch
):
return
PlatformSpec
(
'
{arch}-darwin
'
.
format
(
arch
=
arch
)
,
'
ghc-{version}-{arch}-apple-darwin
'
.
format
(
arch
=
arch
,
version
=
"
{version}
"
)
)
windowsArtifact
=
PlatformSpec
(
'
x86_64-windows
'
,
'
ghc-{version}-x86_64-unknown-mingw32
'
)
def
debian
(
n
:
int
,
arch
:
str
=
'
x86_64
'
)
->
PlatformSpec
:
return
linux_platform
(
arch
,
"
{arch}-linux-deb{n}
"
.
format
(
arch
=
arch
,
n
=
n
))
def
centos
(
n
:
int
,
arch
=
'
x86_64
'
)
->
PlatformSpec
:
def
centos
(
n
,
arch
=
'
x86_64
'
):
return
linux_platform
(
arch
,
"
{arch}-linux-centos{n}
"
.
format
(
n
=
n
,
arch
=
arch
))
def
fedora
(
n
:
int
,
arch
=
'
x86_64
'
)
->
PlatformSpec
:
def
fedora
(
n
,
arch
=
'
x86_64
'
):
return
linux_platform
(
arch
,
"
{arch}-linux-fedora{n}
"
.
format
(
n
=
n
,
arch
=
arch
))
def
alpine
(
n
:
str
,
arch
=
'
x86_64
'
)
->
PlatformSpec
:
def
alpine
(
n
,
arch
=
'
x86_64
'
):
return
linux_platform
(
arch
,
"
{arch}-linux-alpine{n}
"
.
format
(
n
=
n
,
arch
=
arch
))
def
rocky
(
n
:
int
,
arch
=
'
x86_64
'
)
->
PlatformSpec
:
def
rocky
(
n
,
arch
=
'
x86_64
'
):
return
linux_platform
(
arch
,
"
{arch}-linux-rocky{n}
"
.
format
(
n
=
n
,
arch
=
arch
))
def
ubuntu
(
n
:
str
,
arch
=
'
x86_64
'
)
->
PlatformSpec
:
def
ubuntu
(
n
,
arch
=
'
x86_64
'
):
return
linux_platform
(
arch
,
"
{arch}-linux-ubuntu{n}
"
.
format
(
n
=
n
,
arch
=
arch
))
def
linux_platform
(
arch
:
str
,
opsys
:
str
)
->
PlatformSpec
:
def
linux_platform
(
arch
,
opsys
)
:
return
PlatformSpec
(
opsys
,
'
ghc-{version}-{arch}-unknown-linux
'
.
format
(
version
=
"
{version}
"
,
arch
=
arch
)
)
...
...
@@ -138,10 +135,10 @@ def download_and_hash(url):
hash_cache
[
url
]
=
digest
return
digest
uri_to_anchor_cache
=
{}
# type: Dict[str, str]
uri_to_anchor_cache
=
dict
()
# Make the metadata for one platform.
def
mk_one_metadata
(
release_mode
:
bool
,
version
:
str
,
job_map
:
JobMap
,
artifact
:
Artifact
)
->
GhcupDist
:
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
.
download_name
.
format
(
version
=
version
)))
...
...
@@ -184,7 +181,7 @@ def mk_one_metadata(release_mode: bool, version: str, job_map: JobMap, artifact:
# Turns a platform into an Artifact respecting pipeline_type
# Looks up the right job to use from the .gitlab/jobs-metadata.json file
def
mk_from_platform
(
pipeline_type
:
str
,
platform
:
PlatformSpec
)
->
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
'
]
...
...
@@ -195,7 +192,7 @@ def mk_from_platform(pipeline_type: str, platform: PlatformSpec) -> Artifact:
# Generate the new metadata for a specific GHC mode etc
def
mk_new_yaml
(
release_mode
:
bool
,
version
:
str
,
date
:
str
,
pipeline_type
,
job_map
:
JobMap
)
->
object
:
def
mk_new_yaml
(
release_mode
,
version
,
date
,
pipeline_type
,
job_map
)
:
def
mk
(
platform
):
eprint
(
"
\n
===
"
+
platform
.
name
+
"
"
+
(
'
=
'
*
(
75
-
len
(
platform
.
name
))))
return
mk_one_metadata
(
release_mode
,
version
,
job_map
,
mk_from_platform
(
pipeline_type
,
platform
))
...
...
@@ -204,7 +201,7 @@ def mk_new_yaml(release_mode: bool, version: str, date: str, pipeline_type, job_
ubuntu1804
=
mk
(
ubuntu
(
"
18_04
"
))
ubuntu2004
=
mk
(
ubuntu
(
"
20_04
"
))
ubuntu2204
=
mk
(
ubuntu
(
"
22_04
"
))
rocky8
=
mk
(
rocky
(
8
))
rocky8
=
mk
(
rocky
(
"
8
"
))
centos7
=
mk
(
centos
(
7
))
fedora33
=
mk
(
fedora
(
33
))
darwin_x86
=
mk
(
darwin
(
"
x86_64
"
))
...
...
@@ -304,14 +301,14 @@ def mk_new_yaml(release_mode: bool, version: str, date: str, pipeline_type, job_
}
def
setNightlyTags
(
ghcup_metadata
:
dict
)
->
None
:
def
setNightlyTags
(
ghcup_metadata
)
:
for
version
in
ghcup_metadata
[
'
ghcupDownloads
'
][
'
GHC
'
]:
if
"
LatestNightly
"
in
ghcup_metadata
[
'
ghcupDownloads
'
][
'
GHC
'
][
version
][
"
viTags
"
]:
ghcup_metadata
[
'
ghcupDownloads
'
][
'
GHC
'
][
version
][
"
viTags
"
].
remove
(
"
LatestNightly
"
)
ghcup_metadata
[
'
ghcupDownloads
'
][
'
GHC
'
][
version
][
"
viTags
"
].
append
(
"
Nightly
"
)
def
mk_dumper
(
version
:
str
)
->
yaml
.
Dumper
:
def
mk_dumper
(
version
)
:
class
CustomAliasDumper
(
yaml
.
Dumper
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment