[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: rel_eng: Update hackage docs upload scripts

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Mar 5 14:12:32 UTC 2024



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


Commits:
11ccf8d4 by Matthew Pickering at 2024-03-05T09:12:24-05:00
rel_eng: Update hackage docs upload scripts

This adds the upload of ghc-internal and ghc-experimental to our scripts
which upload packages to hackage.

- - - - -
9f8b4ddf by Matthew Pickering at 2024-03-05T09:12:24-05:00
docs: Remove stray module comment from GHC.Profiling.Eras

- - - - -
841aad2e by Matthew Pickering at 2024-03-05T09:12:24-05:00
Fix ghc-internal cabal file

The file mentioned some artifacts relating to the base library. I have
renamed these to the new ghc-internal variants.

- - - - -
7c2fe093 by Matthew Pickering at 2024-03-05T09:12:24-05:00
Fix haddock source links and hyperlinked source

There were a few issues with the hackage links:

1. We were using the package id rather than the package name for the
   package links. This is fixed by now allowing the template to mention
   %pkg% or %pkgid% and substituing both appropiatly.
2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage`
   as the new base link works on a local or remote hackage server.
3. The "src" path including too much stuff, so cross-package source
   links were broken as the template was getting double expanded.

Fixes #24086

- - - - -
2ec4d32e by Ben Gamari at 2024-03-05T09:12:24-05:00
filepath: Bump submodule to 1.5.2.0

- - - - -
5472fdf1 by Ben Gamari at 2024-03-05T09:12:24-05:00
os-string: Bump submodule to 2.0.2

- - - - -


10 changed files:

- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/upload_ghc_libs.py
- hadrian/README.md
- hadrian/src/CommandLine.hs
- hadrian/src/Settings/Builders/Haddock.hs
- libraries/filepath
- libraries/ghc-experimental/src/GHC/Profiling/Eras.hs
- libraries/ghc-internal/ghc-internal.cabal
- libraries/os-string


Changes:

=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -1031,7 +1031,7 @@ job_groups =
     -- (see Note [Object unloading]).
     fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native")
 
-    hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url")
+    hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage")
 
     tsan_jobs =
       modifyJobs


=====================================
.gitlab/jobs.yaml
=====================================
@@ -2330,7 +2330,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--haddock-base-url",
+      "HADRIAN_ARGS": "--haddock-for-hackage",
       "LLC": "/bin/false",
       "OPT": "/bin/false",
       "RUNTEST_ARGS": "",
@@ -4007,7 +4007,7 @@
       "BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
-      "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids",
+      "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids",
       "IGNORE_PERF_FAILURES": "all",
       "LLC": "/bin/false",
       "OPT": "/bin/false",


=====================================
.gitlab/rel_eng/upload_ghc_libs.py
=====================================
@@ -49,6 +49,10 @@ def prep_base():
     shutil.copy('config.guess', 'libraries/base')
     shutil.copy('config.sub', 'libraries/base')
 
+def prep_ghc_internal():
+    shutil.copy('config.guess', 'libraries/ghc-internal')
+    shutil.copy('config.sub', 'libraries/ghc-internal')
+
 def build_copy_file(pkg: Package, f: Path):
     target = Path('_build') / 'stage1' / pkg.path / 'build' / f
     dest = pkg.path / f
@@ -93,6 +97,8 @@ PACKAGES = {
     pkg.name: pkg
     for pkg in [
         Package('base', Path("libraries/base"), prep_base),
+        Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal),
+        Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep),
         Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim),
         Package('integer-gmp', Path("libraries/integer-gmp"), no_prep),
         Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum),


=====================================
hadrian/README.md
=====================================
@@ -306,9 +306,9 @@ all of the documentation targets:
 You can pass several `--docs=...` flags, Hadrian will combine
 their effects.
 
-To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag,
-by default this will choose a url suitable for uploading to hackage but you might also want to pass something like
-`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server.
+To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag,
+This will generate URLs which are appropiate for either uploading to a local hackage
+server or the global hackage server.
 
 #### Source distribution
 


=====================================
hadrian/src/CommandLine.hs
=====================================
@@ -17,7 +17,6 @@ import System.Environment
 import qualified System.Directory as Directory
 
 import qualified Data.Set as Set
-import Data.Maybe
 
 data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq)
 
@@ -114,7 +113,7 @@ data DocArgs = DocArgs
   } deriving (Eq, Show)
 
 defaultDocArgs :: DocArgs
-defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" }
+defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" }
 
 readConfigure :: Either String (CommandLineArgs -> CommandLineArgs)
 readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually"
@@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO
 readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs)
 readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } }
 
-readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
-readHaddockBaseUrl base_url = Right $ \flags ->
-  flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } }
+readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs)
+readHaddockBaseUrl = Right $ \flags ->
+  flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } }
 
-  where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url
+  where base_url = "/package/%pkg%/docs"
 
 
 readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
@@ -320,8 +319,8 @@ optDescrs =
         "Destination path for the bindist 'install' rule"
     , Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING")
         "Setting key to autocomplete, for the 'autocomplete' target."
-    , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL")
-        "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)."
+    , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl)
+        "Generate documentation suitable for upload to a hackage server."
     ]
 
 -- | A type-indexed map containing Hadrian command line arguments to be passed


=====================================
hadrian/src/Settings/Builders/Haddock.hs
=====================================
@@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat
         version  <- expr $ pkgVersion  pkg
         synopsis <- expr $ pkgSynopsis pkg
         haddocks <- expr $ haddockDependencies context
-        haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks]
+        haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks]
 
         hVersion <- expr $ pkgVersion haddock
         statsDir <- expr $ haddockStatsFilesDir
         baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs)
-        let baseUrl p = substituteTemplate baseUrlTemplate p
+        -- The path to where the docs for a package are
+        let docpath p = substituteTemplate baseUrlTemplate p
+        -- The path to where the src folder is for a package (typically docs ++ "/src/")
+        let srcpath p = docpath p ++ "/src/"
         ghcOpts  <- haddockGhcArgs
         -- These are the options which are necessary to perform the build. Additional
         -- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are
@@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat
             , arg $ "--optghc=-D__HADDOCK_VERSION__="
                     ++ show (versionToInt hVersion)
             , map ("--hide=" ++) <$> getContextData otherModules
-            , pure [ "--read-interface=../" ++ p
-                     ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME},"
-                     ++ haddock | (p, haddock) <- haddocks_with_versions ]
+            , pure [ "--read-interface=" ++ docpath (p, pid)
+                     ++ "," ++ srcpath (p, pid) ++ ","
+                     ++ haddock | (p, pid, haddock) <- haddocks_with_versions ]
             , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ]
             , arg "+RTS"
             , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t")
             , arg "--machine-readable"
             , arg "-RTS" ] ]
 
-substituteTemplate :: String -> String -> String
-substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate
+substituteTemplate :: String -> (String, String) -> String
+substituteTemplate baseTemplate (pkg, pkgId) =
+  T.unpack
+    . T.replace "%pkg%" (T.pack pkg)
+    . T.replace "%pkgid%" (T.pack pkgId)
+    . T.pack $ baseTemplate


=====================================
libraries/filepath
=====================================
@@ -1 +1 @@
-Subproject commit b55465e3d174ccd63914e7146079435503204187
+Subproject commit 4dd36add328032f9cbf0eff2a3511ab4369b18eb


=====================================
libraries/ghc-experimental/src/GHC/Profiling/Eras.hs
=====================================
@@ -1,7 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 
--- | TODO move this module into ghc-internals
 module GHC.Profiling.Eras ( setUserEra
                      , getUserEra
                      , incrementUserEra


=====================================
libraries/ghc-internal/ghc-internal.cabal
=====================================
@@ -17,7 +17,7 @@ description:
 
 extra-tmp-files:
     autom4te.cache
-    base.buildinfo
+    ghc-internal.buildinfo
     config.log
     config.status
     include/EventConfig.h
@@ -25,8 +25,8 @@ extra-tmp-files:
 
 extra-source-files:
     aclocal.m4
-    base.buildinfo.in
-    changelog.md
+    ghc-internal.buildinfo.in
+    CHANGELOG.md
     configure
     configure.ac
     include/CTypes.h


=====================================
libraries/os-string
=====================================
@@ -1 +1 @@
-Subproject commit fb2711ba1f43fd609de0e231e161025ee8ed3216
+Subproject commit 6c567f572e62437b8431b0f64b91393c40b677c8



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2254cd78e793065c4eb8490321d6904bf7f1be2f...5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2254cd78e793065c4eb8490321d6904bf7f1be2f...5472fdf1fe1fc502ca16fe30a1d80ffa68d0c9cc
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/20240305/5c5d9c14/attachment-0001.html>


More information about the ghc-commits mailing list