[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: users-guide: Support both distutils and packaging

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Aug 15 23:20:21 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
d814bda9 by Ben Gamari at 2023-08-15T05:43:53-04:00
users-guide: Support both distutils and packaging

As noted in #23818, some old distributions (e.g. Debian 9) only include
`distutils` while newer distributions only include `packaging`.

Fixes #23818.

- - - - -
1726db3f by Ben Gamari at 2023-08-15T05:43:53-04:00
users-guide: Ensure extlinks is compatible with Sphinx <4

The semantics of the `extlinks` attribute annoyingly changed in Sphinx
4. Reflect this in our configuration. See #22690.

Fixes #23807.

- - - - -
03e4d1a3 by Matthew Pickering at 2023-08-15T19:20:08-04:00
ci: Run full-ci on master and release branches

Fixes #23737

- - - - -
fdfc3e7c by Bodigrim at 2023-08-15T19:20:14-04:00
Add @since pragmas for Data.Ord.clamp and GHC.Float.clamp

- - - - -


8 changed files:

- .gitlab-ci.yml
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- docs/users_guide/flags.py
- docs/users_guide/ghc_config.py.in
- docs/users_guide/utils.py
- libraries/base/Data/Ord.hs
- libraries/base/GHC/Float.hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -123,6 +123,12 @@ workflow:
   rules:
     - if: '$RELEASE_JOB == "yes"'
 
+.full-ci: &full-ci
+  - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
+  - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+  - if: '$CI_COMMIT_BRANCH == "master"'
+  - if: '$CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/'
+
 ############################################################
 # Runner Tags
 ############################################################
@@ -433,8 +439,7 @@ hadrian-multi:
     paths:
       - cabal-cache
   rules:
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
 
 ############################################################
 # stack-hadrian-build
@@ -605,8 +610,7 @@ source-tarball:
     - if: $NIGHTLY
     - if: '$RELEASE_JOB == "yes"'
     - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-bootstrap.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
 
 generate-hadrian-bootstrap-sources:
   stage: full-build
@@ -625,8 +629,7 @@ generate-hadrian-bootstrap-sources:
     - if: $NIGHTLY
     - if: '$RELEASE_JOB == "yes"'
     - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-bootstrap.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
 
 
 package-hadrian-bootstrap-sources:
@@ -644,8 +647,7 @@ package-hadrian-bootstrap-sources:
     - if: $NIGHTLY
     - if: '$RELEASE_JOB == "yes"'
     - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-bootstrap.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
 
 test-bootstrap:
   stage: full-build
@@ -682,8 +684,7 @@ test-bootstrap:
   rules:
     - if: $NIGHTLY
     - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-bootstrap.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
     - if: '$RELEASE_JOB == "yes"'
       when: always
       variables:
@@ -837,11 +838,7 @@ perf-nofib:
   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV"
   rules:
     - when: never
-    - if: $CI_MERGE_REQUEST_ID
-    - if: '$CI_COMMIT_BRANCH == "master"'
-    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
   tags:
     - x86_64-linux
   before_script:
@@ -883,10 +880,6 @@ perf:
       optional: true
   dependencies: null
   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV"
-  rules:
-    - if: $CI_MERGE_REQUEST_ID
-    - if: '$CI_COMMIT_BRANCH == "master"'
-    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
   tags:
     - x86_64-linux-perf
   script:
@@ -908,8 +901,7 @@ perf:
     paths:
       - out
   rules:
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
 
 ############################################################
 # ABI testing
@@ -949,8 +941,7 @@ abi-test:
     paths:
       - out
   rules:
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
-    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
+    - *full-ci
 
 
 ############################################################


=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -620,8 +620,20 @@ ruleString Off Nightly = "$NIGHTLY == null"
 labelString :: String -> String
 labelString s =  "$CI_MERGE_REQUEST_LABELS =~ /.*" ++ s ++ ".*/"
 
+branchStringExact :: String -> String
+branchStringExact s = "$CI_COMMIT_BRANCH == \"" ++ s ++ "\""
+
+branchStringLike :: String -> String
+branchStringLike s = "$CI_COMMIT_BRANCH =~ /" ++ s ++ "/"
+
+
 validateRuleString :: ValidateRule -> String
-validateRuleString FullCI = or_all ([labelString "full-ci", labelString "marge_bot_batch_merge_job"])
+validateRuleString FullCI = or_all ([ labelString "full-ci"
+                                    , labelString "marge_bot_batch_merge_job"
+                                    , branchStringExact "master"
+                                    , branchStringLike "ghc-[0-9]+\\.[0-9]+"
+                                    ])
+
 validateRuleString LLVMBackend = labelString "LLVM backend"
 validateRuleString FreeBSDLabel = labelString "FreeBSD"
 validateRuleString NonmovingGc = labelString "non-moving GC"


=====================================
.gitlab/jobs.yaml
=====================================
@@ -163,7 +163,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -3802,7 +3802,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -3933,7 +3933,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -3997,7 +3997,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -4061,7 +4061,7 @@
     "rules": [
       {
         "allow_failure": true,
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "manual"
       }
     ],
@@ -4125,7 +4125,7 @@
     "rules": [
       {
         "allow_failure": true,
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "manual"
       }
     ],
@@ -4188,7 +4188,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -4250,7 +4250,7 @@
     "rules": [
       {
         "allow_failure": true,
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "manual"
       }
     ],
@@ -4373,7 +4373,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -4434,7 +4434,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -4557,7 +4557,7 @@
     "rules": [
       {
         "allow_failure": true,
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "manual"
       }
     ],
@@ -4681,7 +4681,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],
@@ -4744,7 +4744,7 @@
     ],
     "rules": [
       {
-        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+        "if": "((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
         "when": "on_success"
       }
     ],


=====================================
docs/users_guide/flags.py
=====================================
@@ -50,8 +50,8 @@ import sphinx
 from sphinx import addnodes
 from sphinx.domains.std import GenericObject
 from sphinx.errors import SphinxError
-from packaging.version import parse
-from utils import build_table_from_list
+
+from utils import build_table_from_list, parse_version
 
 import os.path
 
@@ -628,8 +628,8 @@ def purge_flags(app, env, docname):
 
 def setup(app):
     # The override argument to add_directive_to_domain is only supported by >= 1.8
-    sphinx_version = parse(sphinx.__version__)
-    override_arg = {'override': True} if sphinx_version >= parse('1.8') else {}
+    sphinx_version = parse_version(sphinx.__version__)
+    override_arg = {'override': True} if sphinx_version >= parse_version('1.8') else {}
 
     # Add ghc-flag directive, and override the class with our own
     app.add_object_type('ghc-flag', 'ghc-flag')


=====================================
docs/users_guide/ghc_config.py.in
=====================================
@@ -1,7 +1,17 @@
-extlinks = {
-    'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '%s'),
-    'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#%s'),
-}
+import sphinx
+from utils import parse_version
+
+if parse_version(sphinx.__version__) >= parse_version("4.0.0"):
+    # N.B. see #23807 and #22690
+    extlinks = {
+        'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '#%s'),
+        'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '%s'),
+    }
+else:
+    extlinks = {
+        'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '#'),
+        'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', ''),
+    }
 
 libs_base_uri = '../libraries'
 


=====================================
docs/users_guide/utils.py
=====================================
@@ -1,5 +1,12 @@
 from docutils import nodes
 
+# N.B. `packaging` is not available in Ubuntu 18.04 or Debian 9
+# See #23818.
+try:
+    from packaging.version import parse as parse_version
+except ImportError as e:
+    from distutils.version import LooseVersion as parse_version
+
 # Taken from Docutils source inside the ListTable class. We must bypass
 # using the class itself, but this function comes in handy.
 def build_table_from_list(table_data, col_widths):


=====================================
libraries/base/Data/Ord.hs
=====================================
@@ -64,6 +64,8 @@ comparing p x y = compare (p x) (p y)
 --
 -- >>> clamp ('a', 'm') 'x'
 -- 'm'
+--
+-- @since 4.16.0.0
 clamp :: (Ord a) => (a, a) -> a -> a
 clamp (low, high) a = min high (max a low)
 


=====================================
libraries/base/GHC/Float.hs
=====================================
@@ -1600,6 +1600,8 @@ exponents returned by decodeFloat.
 -- ==== __Example__
 -- >>> clamp (-10) 5
 -- 10
+--
+-- @since 4.13.0.0
 clamp :: Int -> Int -> Int
 clamp bd k = max (-bd) (min bd k)
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/65b8fbdb78e85b2813cc437297bbef7be373a8c7...fdfc3e7ceb4eb76117acff7e922d3c2ecf94aa8c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/65b8fbdb78e85b2813cc437297bbef7be373a8c7...fdfc3e7ceb4eb76117acff7e922d3c2ecf94aa8c
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/20230815/5adba418/attachment-0001.html>


More information about the ghc-commits mailing list