[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 9 commits: hadrian/bindist: Eliminate extraneous `dirname` invocation
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Mar 19 23:33:20 UTC 2024
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
064e1b66 by Ben Gamari at 2024-03-19T19:33:03-04:00
hadrian/bindist: Eliminate extraneous `dirname` invocation
Previously we would call `dirname` twice per installed library file.
We now instead reuse this result. This helps appreciably on Windows, where
processes are quite expensive.
- - - - -
fb774956 by Ben Gamari at 2024-03-19T19:33:03-04:00
hadrian: Package mingw toolchain in expected location
This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89.
Specifically, GHC expects to find the mingw32 toolchain in the binary distribution
root. However, after this patch it was packaged in the `lib/` directory.
- - - - -
3d23f491 by Ben Gamari at 2024-03-19T19:33:03-04:00
gitlab/rel_eng: More upload.sh tweaks
- - - - -
83e1893b by Ben Gamari at 2024-03-19T19:33:03-04:00
rel_eng: Drop dead prepare_docs codepath
- - - - -
3f7f860c by Ben Gamari at 2024-03-19T19:33:04-04:00
rel_env/recompress_all: unxz before recompressing
Previously we would rather compress the xz *again*, before in addition
compressing it with the desired scheme.
Fixes #24545.
- - - - -
879fa724 by Ben Gamari at 2024-03-19T19:33:04-04:00
mk-ghcup-metadata: Fix directory of testsuite tarball
As reported in #24546, the `dlTest` artifact should be extracted into
the `testsuite` directory.
- - - - -
e59f4c16 by Ben Gamari at 2024-03-19T19:33:04-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.
- - - - -
aef64c4b by Zubin Duggal at 2024-03-19T19:33:04-04:00
Revert "Apply shellcheck suggestion to SUBST_TOOLDIR"
This reverts commit c82770f57977a2b5add6e1378f234f8dd6153392.
The shellcheck suggestion is spurious and results in SUBST_TOOLDIR being a
no-op. `set` sets positional arguments for bash, but we want to set the variable
given as the first autoconf argument.
Fixes #24542
Metric decreases because the paths in the settings file are now shorter,
so we allocate less when we read the settings file.
-------------------------
Metric Decrease:
T12425
T13035
T9198
-------------------------
- - - - -
ed7b3d68 by Fendor at 2024-03-19T19:33:05-04:00
Compact serialisation of IfaceAppArgs
In #24563, we identified that IfaceAppArgs serialisation tags each
cons cell element with a discriminator byte. These bytes add up
quickly, blowing up interface files considerably when
'-fwrite-if-simplified-core' is enabled.
We compact the serialisation by writing out the length of
'IfaceAppArgs', followed by serialising the elements directly without
any discriminator byte.
This improvement can decrease the size of some interface files by up
to 35%.
- - - - -
7 changed files:
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitlab/rel_eng/recompress-all
- .gitlab/rel_eng/upload.sh
- compiler/GHC/Iface/Type.hs
- hadrian/bindist/Makefile
- hadrian/src/Rules/BinaryDist.hs
- m4/fp_settings.m4
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
@@ -80,7 +81,7 @@ source_artifact = Artifact('source-tarball'
test_artifact = Artifact('source-tarball'
, 'ghc-{version}-testsuite.tar.xz'
, 'ghc-{version}-testsuite.tar.xz'
- , 'ghc-{version}' )
+ , 'ghc-{version}/testsuite' )
def debian(arch, n):
return linux_platform(arch, "{arch}-linux-deb{n}".format(arch=arch, n=n))
@@ -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
=====================================
.gitlab/rel_eng/recompress-all
=====================================
@@ -9,21 +9,22 @@ usage :
%.gz : %.xz
echo "[xz->gz] $< to $@..."
- xz -c $< | gzip -c > $@
+ xz -cd $< | gzip -c > $@
%.bz2 : %.xz
echo "[xz->bz2] $< to $@..."
- xz -c $< | bzip2 -c > $@
+ xz -cd $< | bzip2 -c > $@
%.lz : %.xz
echo "[xz->lz] $< to $@..."
- xz -c $< | lzip -c > $@
+ xz -cd $< | lzip -c > $@
%.zip : %.tar.xz
echo "[tarxz->zip] $< to $@..."
- tmp="$(mktemp tmp.XXX)" && \
+ tmp="$$(mktemp tmp.XXX)" && \
tar -C "$$tmp" -xf $< && \
cd "$$tmp" && \
zip -9 -r $@ * && \
+ cd .. && \
rm -R "$$tmp"
=====================================
.gitlab/rel_eng/upload.sh
=====================================
@@ -145,7 +145,7 @@ function purge_all() {
curl -X PURGE http://downloads.haskell.org/~ghc/$dir
curl -X PURGE http://downloads.haskell.org/~ghc/$dir/
for i in *; do
- purge_file $i
+ purge_file "$i"
done
}
@@ -158,43 +158,14 @@ function purge_file() {
)
for dir in ${dirs[@]}; do
- curl -X PURGE http://downloads.haskell.org/$dir/$i
- curl -X PURGE http://downloads.haskell.org/$dir/$i/
- curl -X PURGE http://downloads.haskell.org/$dir/$i/docs/
+ curl -X PURGE http://downloads.haskell.org/$dir/$1
+ curl -X PURGE http://downloads.haskell.org/$dir/$1/
+ curl -X PURGE http://downloads.haskell.org/$dir/$1/docs/
done
}
function prepare_docs() {
echo "THIS COMMAND IS DEPRECATED, THE DOCS FOLDER SHOULD BE PREPARED BY THE FETCH SCRIPT"
- local tmp
- rm -Rf docs
- if [ -z "$GHC_TREE" ]; then
- tmp="$(mktemp -d)"
- tar -xf "ghc-$ver-src.tar.xz" -C "$tmp"
- GHC_TREE="$tmp/ghc-$ver"
- fi
- mkdocs="$GHC_TREE/distrib/mkDocs/mkDocs"
- if [ ! -e "$mkdocs" ]; then
- echo "Couldn't find GHC mkDocs at $mkdocs."
- echo "Perhaps you need to override GHC_TREE?"
- rm -Rf "$tmp"
- exit 1
- fi
- windows_bindist="$(ls ghc-$ver-x86_64-unknown-mingw32.tar.xz | head -n1)"
- linux_bindist="$(ls ghc-$ver-x86_64-deb9-linux.tar.xz | head -n1)"
- echo "Windows bindist: $windows_bindist"
- echo "Linux bindist: $linux_bindist"
- $ENTER_FHS_ENV $mkdocs $linux_bindist $windows_bindist
- if [ -d "$tmp" ]; then rm -Rf "$tmp"; fi
-
- mkdir -p docs/html
- tar -Jxf "$linux_bindist"
- cp -R "ghc-$ver/docs/users_guide/build-html/users_guide docs/html/users_guide"
- #cp -R ghc-$ver/utils/haddock/doc/haddock docs/html/haddock
- rm -R "ghc-$ver"
-
- tar -Jxf docs/libraries.html.tar.xz -C docs/html
- mv docs/index.html docs/html
}
function recompress() {
@@ -213,7 +184,7 @@ function recompress() {
needed+=( "$(basename $i .tar.xz).zip" )
done
- recompress-all -l ${needed[@]}
+ recompress-all -j10 ${needed[@]}
}
function upload_docs() {
=====================================
compiler/GHC/Iface/Type.hs
=====================================
@@ -728,6 +728,12 @@ ifaceVisAppArgsLength = go 0
| isVisibleForAllTyFlag argf = go (n+1) rest
| otherwise = go n rest
+ifaceAppArgsLength :: IfaceAppArgs -> Int
+ifaceAppArgsLength = go 0
+ where
+ go !n IA_Nil = n
+ go !n (IA_Arg _ _ ts) = go (n + 1) ts
+
{-
Note [Suppressing invisible arguments]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2090,21 +2096,27 @@ instance Binary IfaceTyLit where
_ -> panic ("get IfaceTyLit " ++ show tag)
instance Binary IfaceAppArgs where
- put_ bh tk =
- case tk of
- IA_Arg t a ts -> putByte bh 0 >> put_ bh t >> put_ bh a >> put_ bh ts
- IA_Nil -> putByte bh 1
+ put_ bh tk = do
+ -- Int is variable length encoded so only
+ -- one byte for small lists.
+ put_ bh (ifaceAppArgsLength tk)
+ go tk
+ where
+ go IA_Nil = pure ()
+ go (IA_Arg a b t) = do
+ put_ bh a
+ put_ bh b
+ go t
- get bh =
- do c <- getByte bh
- case c of
- 0 -> do
- t <- get bh
- a <- get bh
- ts <- get bh
- return $! IA_Arg t a ts
- 1 -> return IA_Nil
- _ -> panic ("get IfaceAppArgs " ++ show c)
+ get bh = do
+ n <- get bh :: IO Int
+ go n
+ where
+ go 0 = return IA_Nil
+ go c = do
+ a <- get bh
+ b <- get bh
+ IA_Arg a b <$> go (c - 1)
-------------------
=====================================
hadrian/bindist/Makefile
=====================================
@@ -176,18 +176,19 @@ install_lib: lib/settings
@dest="$(DESTDIR)$(ActualLibsDir)"; \
cd lib; \
for i in `$(FIND) . -type f`; do \
- $(INSTALL_DIR) "$$dest/`dirname $$i`" ; \
+ dir="`dirname $$i`" ; \
+ $(INSTALL_DIR) "$$dest/$$dir" ; \
case $$i in \
*.a) \
- $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \
+ $(INSTALL_DATA) $$i "$$dest/$$dir" ; \
$(RANLIB_CMD) "$$dest"/$$i ;; \
*.dll) \
- $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \
+ $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \
$(STRIP_CMD) "$$dest"/$$i ;; \
*.so) \
- $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \
+ $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \
*.dylib) \
- $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \
+ $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \
*.mjs) \
$(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \
*) \
=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -135,7 +135,8 @@ bindistRules = do
let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform
let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty
installTo Relocatable prefix
-
+ copyDirectory (root -/- "mingw") prefix
+ liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw")
phony "install" $ do
need ["binary-dist-dir"]
@@ -145,8 +146,6 @@ bindistRules = do
installTo NotRelocatable installPrefix
phony "binary-dist-dir" $ do
-
-
version <- setting ProjectVersion
targetPlatform <- setting TargetPlatformFull
distDir <- Context.distDir Stage1
@@ -309,7 +308,7 @@ bindistRules = do
let buildBinDist compressor = do
win_target <- isWinTarget
- when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.")
+ when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.")
buildBinDistX "binary-dist-dir" "bindist" compressor
buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist"
=====================================
m4/fp_settings.m4
=====================================
@@ -44,7 +44,7 @@ dnl ghc-toolchain.
AC_DEFUN([SUBST_TOOLDIR],
[
dnl and Note [How we configure the bundled windows toolchain]
-set -- "$(echo "$$1" | sed 's%'"$mingw_prefix"'%'"$mingw_install_prefix"'%g')"
+ $1=`echo "$$1" | sed 's%'"$mingw_prefix"'%'"$mingw_install_prefix"'%g'`
])
# FP_SETTINGS
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5e6f66e49d4bb3339ead5500b0e4bde7485f6d46...ed7b3d680f08d593ebfcd3f361a533c86dbe6e81
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5e6f66e49d4bb3339ead5500b0e4bde7485f6d46...ed7b3d680f08d593ebfcd3f361a533c86dbe6e81
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/20240319/09adeef3/attachment-0001.html>
More information about the ghc-commits
mailing list