Commits (3355)
# http://editorconfig.org
root = true
[*.hs]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
[Makefile]
indent_style = tab
# convert CRLF into LF on checkin
# don't convert anything on checkout
* text=auto eol=lf
mk/win32-tarballs.md5sum text=auto eol=LF
......@@ -42,6 +42,8 @@ autom4te.cache
config.log
config.status
configure
# GHC's own aclocal.m4 is generated by aclocal
/aclocal.m4
# Temporarily generated configure files
confdefs.h
......@@ -50,11 +52,13 @@ confdefs.h
stage0
stage1
stage2
_build
# Ignore _build, _validatebuild and any other custom build directories headed by _
_*
*/generated/
*/ghc-stage1
.shake.*
.hadrian_ghci
.hie-bios
# -----------------------------------------------------------------------------
# Ignore any overlapped darcs repos and back up files
......@@ -73,14 +77,12 @@ _darcs/
/driver/ghc/dist/
/driver/haddock/dist/
/driver/ghci/dist/
/includes/dist/
/includes/dist-*/
/libffi/dist-install/
/libraries/*/dist-boot/
/libraries/*/dist-install/
/libraries/*/dist-newstyle/
/libraries/dist-haddock/
/rts/dist/
/linters/*/dist-install/
/utils/*/dist*/
/compiler/stage1/
/compiler/stage2/
......@@ -102,12 +104,16 @@ _darcs/
/ch01.html
/ch02.html
/compiler/dist/
/compiler/Bytecodes.h
/compiler/ClosureTypes.h
/compiler/FunTypes.h
/compiler/MachRegs.h
/compiler/ghc-llvm-version.h
/compiler/ghc.cabal
/compiler/ghc.cabal.old
/distrib/configure.ac
/distrib/ghc.iss
/docs/man
/docs/index.html
/docs/users_guide/.log
/docs/users_guide/users_guide
/docs/users_guide/ghc.1
......@@ -124,13 +130,19 @@ _darcs/
/docs/users_guide/utils.pyc
/driver/ghci/ghc-pkg-inplace
/driver/ghci/ghci-inplace
/driver/ghci/ghci-wrapper.cabal
/driver/ghci/ghci.res
/driver/ghci/cwrapper.c
/driver/ghci/cwrapper.h
/driver/ghci/getLocation.c
/driver/ghci/getLocation.h
/driver/ghci/isMinTTY.c
/driver/ghci/isMinTTY.h
/driver/package.conf
/driver/package.conf.inplace.old
/settings
/ghc.spec
/ghc/ghc-bin.cabal
/includes/dist/
/index.html
/inplace/
/libffi/build/
......@@ -171,15 +183,11 @@ _darcs/
/mk/config.h.in
/mk/config.mk
/mk/config.mk.old
/mk/system-cxx-std-lib-1.0.conf
/mk/install.mk
/mk/project.mk
/mk/project.mk.old
/mk/validate.mk
/rts/rts.cabal
/rts/package.conf.inplace
/rts/package.conf.inplace.raw
/rts/package.conf.install
/rts/package.conf.install.raw
/stage3.package.conf
/testsuite_summary*.txt
/testsuite*.xml
......@@ -190,9 +198,9 @@ _darcs/
/utils/mkUserGuidePart/mkUserGuidePart.cabal
/utils/runghc/runghc.cabal
/utils/gen-dll/gen-dll.cabal
/utils/ghc-pkg/ghc-pkg.cabal
utils/lndir/fs.*
utils/unlit/fs.*
rts/fs.*
libraries/base/include/fs.h
libraries/base/cbits/fs.c
missing-win32-tarballs
......@@ -215,11 +223,6 @@ GIT_COMMIT_ID
# Should be equal to testdir_suffix from testsuite/driver/testlib.py.
*.run
# -----------------------------------------------------------------------------
# Output of ghc-in-ghci
/.ghci-objects/
# -----------------------------------------------------------------------------
# ghc.nix
ghc.nix/
......@@ -242,3 +245,4 @@ ghc.nix/
# clangd
.clangd
dist-newstyle/
This diff is collapsed.
This diff is collapsed.
{
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
"sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "wip/ghc-8.10.7-darwin",
"description": "Nix Packages collection",
"homepage": "",
"owner": "bgamari",
"repo": "nixpkgs",
"rev": "37c60356e3f83c708a78a96fdd914b5ffc1f551c",
"sha256": "0i5j7nwk4ky0fg4agla3aznadpxz0jyrdwp2q92hyxidra987syn",
"type": "tarball",
"url": "https://github.com/bgamari/nixpkgs/archive/37c60356e3f83c708a78a96fdd914b5ffc1f551c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
if spec ? ref then spec.ref else
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {};
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
{ system }:
let
sources = import ./nix/sources.nix;
nixpkgsSrc = sources.nixpkgs;
pkgs = import nixpkgsSrc { inherit system; };
in
let
hsPkgs = pkgs.haskellPackages;
alex = hsPkgs.alex;
happy = hsPkgs.happy;
targetTriple = pkgs.stdenv.targetPlatform.config;
ghcBindists = let version = ghc.version; in {
aarch64-darwin = pkgs.fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz";
sha256 = "sha256:0p2f35pihlnmkm7x73b5xm3dyhiczrywc19khr7i7vb2q1y4zw6i";
};
x86_64-darwin = pkgs.fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
sha256 = "sha256:0gzq0vfjbhr9n8z63capvdwrw7bisy15d5c1y1gynfix13bbnjlk";
};
};
ghc = pkgs.stdenv.mkDerivation rec {
version = "9.2.2";
name = "ghc";
src = ghcBindists.${pkgs.stdenv.hostPlatform.system};
configureFlags = [
"CC=/usr/bin/clang"
"CLANG=/usr/bin/clang"
"LLC=${llvm}/bin/llc"
"OPT=${llvm}/bin/opt"
"CONF_CC_OPTS_STAGE2=--target=${targetTriple}"
"CONF_CXX_OPTS_STAGE2=--target=${targetTriple}"
"CONF_GCC_LINKER_OPTS_STAGE2=--target=${targetTriple}"
];
buildPhase = "true";
# N.B. Work around #20253.
nativeBuildInputs = [ pkgs.gnused ];
postInstallPhase = ''
settings="$out/lib/ghc-${version}/settings"
sed -i -e "s%\"llc\"%\"${llvm}/bin/llc\"%" $settings
sed -i -e "s%\"opt\"%\"${llvm}/bin/opt\"%" $settings
sed -i -e "s%\"clang\"%\"/usr/bin/clang\"%" $settings
sed -i -e 's%("C compiler command", "")%("C compiler command", "/usr/bin/clang")%' $settings
sed -i -e 's%("C compiler flags", "")%("C compiler flags", "--target=${targetTriple}")%' $settings
sed -i -e 's%("C++ compiler flags", "")%("C++ compiler flags", "--target=${targetTriple}")%' $settings
sed -i -e 's%("C compiler link flags", "")%("C compiler link flags", "--target=${targetTriple}")%' $settings
'';
# Sanity check: verify that we can compile hello world.
doInstallCheck = true;
installCheckPhase = ''
unset DYLD_LIBRARY_PATH
$out/bin/ghc --info
cd $TMP
mkdir test-ghc; cd test-ghc
cat > main.hs << EOF
{-# LANGUAGE TemplateHaskell #-}
module Main where
main = putStrLn \$([|"yes"|])
EOF
$out/bin/ghc --make -v3 main.hs || exit 1
echo compilation ok
[ $(./main) == "yes" ]
'';
};
ourtexlive = with pkgs;
texlive.combine {
inherit (texlive)
scheme-medium collection-xetex fncychap titlesec tabulary varwidth
framed capt-of wrapfig needspace dejavu-otf helvetic upquote;
};
fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; };
llvm = pkgs.llvm_11;
in
pkgs.writeTextFile {
name = "toolchain";
text = ''
export PATH
PATH="${pkgs.autoconf}/bin:$PATH"
PATH="${pkgs.automake}/bin:$PATH"
PATH="${pkgs.coreutils}/bin:$PATH"
export FONTCONFIG_FILE=${fonts}
export XELATEX="${ourtexlive}/bin/xelatex"
export MAKEINDEX="${ourtexlive}/bin/makeindex"
export HAPPY="${happy}/bin/happy"
export ALEX="${alex}/bin/alex"
export GHC="${ghc}/bin/ghc"
export LLC="${llvm}/bin/llc"
export OPT="${llvm}/bin/opt"
export SPHINXBUILD="${pkgs.python3Packages.sphinx}/bin/sphinx-build"
export CABAL_INSTALL="${pkgs.cabal-install}/bin/cabal"
export CABAL="$CABAL_INSTALL"
sdk_path="$(xcrun --sdk macosx --show-sdk-path)"
export CONFIGURE_ARGS="$CONFIGURE_ARGS --with-ffi-libraries=$sdk_path/usr/lib --with-ffi-includes=$sdk_path/usr/include/ffi"
'';
}
This diff is collapsed.
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p cabal-install ghc jq
cd "$(dirname "${BASH_SOURCE[0]}")"
tmp=$(mktemp)
./gen_ci.hs $tmp
rm -f jobs.yaml
echo "### THIS IS A GENERATED FILE, DO NOT MODIFY DIRECTLY" > jobs.yaml
cat $tmp | jq | tee -a jobs.yaml
<!--
READ THIS FIRST: If the feature you are proposing changes the language that GHC accepts
or adds any warnings to `-Wall`, it should be written as a [GHC Proposal](https://github.com/ghc-proposals/ghc-proposals/).
Other features, appropriate for a GitLab feature request, include GHC API/plugin
innovations, new low-impact compiler flags, or other similar additions to GHC.
-->
## Motivation
Briefly describe the problem your proposal solves and why this problem should
......
This diff is collapsed.
#!/usr/bin/env bash
set -e
COLOR_RED="\e[31m"
COLOR_GREEN="\e[32m"
COLOR_NONE="\e[0m"
grep TBA libraries/*/changelog.md && (
echo -e "${COLOR_RED}Error: Found \"TBA\"s in changelogs.${COLOR_NONE}"
exit 1
) || (
echo -e "${COLOR_GREEN}changelogs look okay.${COLOR_NONE}"
exit 0
)
#!/usr/bin/env bash
set -e
grep -E -q '\[[0-9]+\.[0-9]+\.[0-9]+\]' configure.ac ||
( echo "error: configure.ac: GHC version number must have three components."; exit 1 )
......@@ -24,4 +24,8 @@ If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR
title with `WIP:`.
Once your change is ready please remove the `WIP:` tag and wait for review. If
no one has offerred review in a few days then please leave a comment mentioning
@triagers.
[notes]: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/coding-style#comments-in-the-source-code
#!/usr/bin/env bash
set -e
# Start a head.hackage job and wait for completion. Expected to be called from
# GitLab CI.
if [ -z "$HEAD_HACKAGE_TRIGGER_TOKEN" ]; then
echo "Error: Expected head.hackage trigger token in HEAD_HACKAGE_TRIGGER_TOKEN"
exit 1
fi
if [ -z "$CI_PIPELINE_ID" ]; then
echo "Error: Expected pipeline id in CI_PIPELINE_ID"
exit 1
fi
if [ -z "$HEAD_HACKAGE_PROJECT_ID" ]; then
HEAD_HACKAGE_PROJECT_ID="78"
fi
# Start pipeline
curl --silent --show-error \
--request POST \
-F "token=$HEAD_HACKAGE_TRIGGER_TOKEN" \
-F "ref=master" \
-F "variables[GHC_PIPELINE_ID]=$CI_PIPELINE_ID" \
-F "variables[EXTRA_HC_OPTS]=-dcore-lint" \
https://gitlab.haskell.org/api/v4/projects/$HEAD_HACKAGE_PROJECT_ID/trigger/pipeline \
| tee resp.json
echo
pipeline_id=$(jq .id < resp.json)
url=$(jq .web_url < resp.json)
echo
echo "Started head.hackage pipeline $pipeline_id: $url"
# Wait for completion
running=
echo "Waiting for build to complete..."
while true; do
sleep 10
curl --silent --show-error \
--request GET \
-F "job_token=$CI_JOB_TOKEN" \
https://gitlab.haskell.org/api/v4/projects/$HEAD_HACKAGE_PROJECT_ID/pipelines/$pipeline_id \
> resp.json
status=$(jq .status < resp.json)
case $status in
"\"pending\"")
;;
"\"running\"")
if [ -z "$running" ]; then
echo "Pipeline $pipeline_id is now running."
running=1
fi
;;
"\"success\"")
echo "Pipeline $pipeline_id finished successfully."
exit 0
;;
"\"failed\"")
echo "Pipeline $pipeline_id failed."
exit 1
;;
"\"canceled\"")
echo "Pipeline $pipeline_id was canceled."
exit 1
;;
"\"skipped\"")
echo "Pipeline $pipeline_id was skipped."
exit 1
;;
*)
cat resp.json
echo "Error: Unknown pipeline status $status"
exit 2
;;
esac
done
......@@ -3,7 +3,6 @@
set -euo pipefail
NOTES_ORIGIN="https://gitlab.haskell.org/ghc/ghc-performance-notes.git"
NOTES_ORIGIN_PUSH="git@gitlab.haskell.org:ghc/ghc-performance-notes.git"
REF="perf"
run() {
......@@ -18,60 +17,45 @@ fail() {
function pull() {
local ref="refs/notes/$REF"
run git fetch -f $NOTES_ORIGIN $ref:$ref
run git fetch -f "$NOTES_ORIGIN" "$ref:$ref"
echo "perf notes ref $ref is $(git rev-parse $ref)"
}
function setup_ssh() {
# Add gitlab as a known host.
# This can be generated with `ssh-keyscan -H gitlab.haskell.org`
mkdir -p ~/.ssh
echo "|1|cta91z3DoAGdpX2Epe9WF+sr+Rk=|1qlsbqiTTa8YsDyQBjVnzANFQ3Y= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDSzzl8mwY6ohtW6MftKaQfta8yTL8cTxtA7lcueo2mkPpwBBQ7FA6z3nFATx25QwdV7fa7DuNRDX57f/a/W7+wMhXZ6yyQr+gwr0h4vdZ8Nt4XNfNdkdGw4fZKRApWxyvfSkxjs/E9+G0o3eQLspxjVohBkmkcsowpFUI5Aazv/K6QIf1gKt+4iPvYcB/dBJ1yF1qmpayz4htrKyUC5l3GCBEwvMdAjIQ2bX8pyjTtqcJDLosAVzQ5wprkdgkL29MgJXEbM+B1d1log0hnX4AsbOlL7tWhTO1Je2hSuEeiVaDDPFUyCoGQRFDrisQU5lb8NrzuN3jpNc+PxOHbXHfaTppAoED/++UepvgtLF1zUM13cRk56YmpmABOa48W72VJuzLLm8DF+KBWBs6TDuVk3y9z/SS6zDS0VGkHotldopW2kpsjErJIdWVKIL3RP/Flay7mzl3l/izIMTHXXKMxV3/+XaBjG/gDOCld3JjORQXah2hvJfvXeNaePE1RKAMS63cj3XTE77fsYH7VmEdE34RTBDtsZR5WhEjdf29hjEcQDPf0vDphxRHr6IqUSwVcd7ps6nVoccTfaepJm62IIXDgOsc2piWl2xXNZJVtph6U+MzsPDSSbu1MTwalwgqpApcYK7ZzUjGHA7+NBhjjSuUZO6eHzwxjAn0FXZyrpQ==" >> ~/.ssh/known_hosts
echo "|1|uZkjsBS2bmdh7L/8zBquxJd/F20=|by/tpuDAPT6BpEXrDOiOv1/Zx/A= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA7ltOZyaULDgxE3Vw6RgQVp+OPKQi79ssUenbhdWy36" >> ~/.ssh/known_hosts
# Setup ssh keys.
eval `ssh-agent`
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJPR1vrZgeGTXmgJw2PsJfMjf22LcDnVVwt3l0rwTZ+8Q2J0bHaYxMRKBco1sON6LGcZepw0Hy76RQ87v057pTz18SXvnfE7U/B6v9qBk0ILJz+4BOX9sEhxu2XmScp/wMxkG9IoyruMlsxXzd1sz09o+rzzx24U2Rp27PRm08vG0oipve6BWLbYEqYrE4/nCufqOJmGd56fju7OTU0lTpEkGDEDWGMxutaX2CbTbDju7qy07Ld8BjSc9aHfvuQaslUbj3ex3EF8EXahURzGpHQn/UFFzVGMokFumiJCAagHQb7cj6jOkKseZLaysbA/mTBQsOzjWiRmkN23bQf1wF ben+ghc-ci@smart-cactus.org" > ~/.ssh/perf_rsa.pub
touch ~/.ssh/perf_rsa
chmod 0600 ~/.ssh/perf_rsa
echo "$PERF_NOTE_KEY" >> ~/.ssh/perf_rsa
ssh-add ~/.ssh/perf_rsa
}
# Reset the git notes and append the metrics file to the notes, then push and return the result.
# This is favoured over a git notes merge as it avoids potential data loss/duplication from the merge strategy.
function reset_append_note_push {
pull || true
run git notes --ref=$REF append -F $METRICS_FILE HEAD
run git push $NOTES_ORIGIN_PUSH refs/notes/$REF
run git notes --ref="$REF" append -F "$METRICS_FILE" HEAD
run git push "$PERF_NOTES_PUSH_REPO" "refs/notes/$REF"
}
function push() {
# Check that private key is available (Set on all GitLab protected branches).
if [ -z ${PERF_NOTE_KEY+"$PERF_NOTE_KEY"} ]
then
echo "Not pushing performance git notes: PERF_NOTE_KEY is not set."
exit 0
# PERF_NOTES_PUSH_CREDENTIALS is a CI variable set on all GitLab protected branches.
if [ -z "${PERF_NOTES_PUSH_REPO:-}" ]; then
if [ -n "${PERF_NOTES_PUSH_CREDENTIALS:-}" ]; then
PERF_NOTES_PUSH_REPO="https://$PERF_NOTES_PUSH_CREDENTIALS@gitlab.haskell.org/ghc/ghc-performance-notes.git"
else
echo "Not pushing performance git notes: PERF_NOTES_PUSH_REPO or PERF_NOTES_PUSH_CREDENTIALS not set."
exit 0
fi
fi
# TEST_ENV must be set.
if [ -z ${TEST_ENV+"$TEST_ENV"} ]
if [ -z "${TEST_ENV:-}" ]
then
fail "Not pushing performance git notes: TEST_ENV must be set."
fi
# Assert that the METRICS_FILE exists and can be read.
if [ -z ${METRICS_FILE+"$METRICS_FILE"} ]
if [ -z "${METRICS_FILE:-}" ]
then
fail "\$METRICS_FILE not set."
fi
if ! [ -r $METRICS_FILE ]
if ! [ -r "$METRICS_FILE" ]
then
fail "Metrics file not found: $METRICS_FILE"
fi
setup_ssh
# Push the metrics file as a git note. This may fail if another task pushes a note first. In that case
# the latest note is fetched and appended.
MAX_RETRY=20
......@@ -81,10 +65,6 @@ function push() {
echo ""
echo "Failed to push git notes. Fetching, appending, and retrying... $MAX_RETRY retries left."
done
# Be sure to kill agent before we terminate since otherwise the Windows CI
# job won't finish.
ssh-agent -k
}
case $1 in
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A tool for uploading GHC's core libraries to Hackage.
This is a utility for preparing and uploading source distributions and
documentation of GHC's core libraries to Hackage. This should be run in
a GHC tree of the release commit after having run ./configure.
There are two modes, preparation and upload.
* The `prepare` mode takes a link to a bindist and creates a folder containing the
source and doc tarballs ready to upload to hackage.
* The `upload` mode takes the folder created by prepare and performs the upload to
hackage.
"""
from subprocess import run, check_call
import shutil
from pathlib import Path
from typing import NamedTuple, Callable, List, Dict, Optional
import tempfile
import re
import pickle
import os
WORK_DIR = Path('.upload-libs')
WORK_DIR.mkdir(exist_ok=True)
OUT_DIR = WORK_DIR / 'docs'
OUT_DIR.mkdir(exist_ok=True)
class Package(NamedTuple):
name: str
path: Path
prepare_sdist: Callable[[], None]
def no_prep():
pass
def prep_base():
shutil.copy('config.guess', 'libraries/base')
shutil.copy('config.sub', 'libraries/base')
def build_copy_file(pkg: Package, f: Path):
target = Path('_build') / 'stage1' / pkg.path / 'build' / f
dest = pkg.path / f
print(f'Building {target} for {dest}...')
build_cabal = Path('hadrian') / 'build-cabal'
if not build_cabal.is_file():
build_cabal = Path('hadrian') / 'build.cabal.sh'
run([build_cabal, target], check=True)
dest.parent.mkdir(exist_ok=True, parents=True)
shutil.copyfile(target, dest)
def modify_file(pkg: Package, fname: Path, f: Callable[[str], str]):
target = pkg.path / fname
s = target.read_text()
target.write_text(f(s))
def prep_ghc_prim():
build_copy_file(PACKAGES['ghc-prim'], Path('GHC/PrimopWrappers.hs'))
def prep_ghc_bignum():
shutil.copy('config.guess', 'libraries/base')
shutil.copy('config.sub', 'libraries/base')
def prep_ghc_boot():
build_copy_file(PACKAGES['ghc-boot'], Path('GHC/Platform/Host.hs'))
build_copy_file(PACKAGES['ghc-boot'], Path('GHC/Version.hs'))
def prep_ghc():
# Drop RTS includes from `include-dirs` as Hackage rejects this
modify_file(PACKAGES['ghc'], 'ghc.cabal',
lambda s: s.replace('../rts/dist/build', ''))
build_copy_file(PACKAGES['ghc'], 'GHC/Platform/Constants.hs')
build_copy_file(PACKAGES['ghc'], 'GHC/Settings/Config.hs')
PACKAGES = {
pkg.name: pkg
for pkg in [
Package('base', Path("libraries/base"), prep_base),
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),
Package('template-haskell', Path("libraries/template-haskell"), no_prep),
Package('ghc-heap', Path("libraries/ghc-heap"), no_prep),
Package('ghc-boot', Path("libraries/ghc-boot"), prep_ghc_boot),
Package('ghc-boot-th', Path("libraries/ghc-boot-th"), no_prep),
Package('ghc-compact', Path("libraries/ghc-compact"), no_prep),
Package('libiserv', Path("libraries/libiserv"), no_prep),
Package('ghc', Path("compiler"), prep_ghc),
]
}
# Dict[str, Package]
def cabal_upload(tarball: Path, publish: bool=False, extra_args=[]):
if publish:
extra_args += ['--publish']
run(['cabal', 'upload'] + extra_args + [tarball], check=True)
def prepare_sdist(pkg: Package):
print(f'Preparing package {pkg.name}...')
shutil.rmtree(pkg.path / 'dist-newstyle', ignore_errors=True)
pkg.prepare_sdist()
# Upload source tarball
run(['cabal', 'sdist'], cwd=pkg.path, check=True)
sdist = list((pkg.path / 'dist-newstyle' / 'sdist').glob('*.tar.gz'))[0]
res_path = shutil.copy(sdist, OUT_DIR)
return os.path.relpath(res_path, OUT_DIR)
def upload_pkg_sdist(sdist : Path, pkg : Package, publish : bool):
publish_tag = '-publish' if publish else ''
stamp = WORK_DIR / f'{pkg.name}-sdist{publish_tag}'
if stamp.is_file():
return
print(f'Uploading package {pkg.name}...')
cabal_upload(sdist, publish)
stamp.write_text('')
def get_version(cabal_file: Path) -> Optional[str]:
m = re.search(r'^version:\s*(\d+(\.\d+)*)', cabal_file.read_text(), re.I | re.M)
return None if m is None else m.group(1)
def prepare_docs(bindist: Path, pkg: Package):
"""
Prepare Haddock documentation for a package. bindist
is the path to an extract binary distribution produced by
hadrian.
"""
cabal_file = pkg.path / f'{pkg.name}.cabal'
version = get_version(cabal_file)
docdir = bindist / 'docs' / 'html' / 'libraries' / (pkg.name + "-" + version)
assert version is not None
# Build the documentation tarball from the bindist documentation
stem = f'{pkg.name}-{version}-docs'
tmp = tempfile.TemporaryDirectory(stem)
shutil.copytree(docdir, Path(tmp.name) / stem)
tarball = Path(f'{stem}.tar.gz')
run(['tar', '-czf', OUT_DIR / tarball, '-H', 'ustar', '-C', tmp.name, stem])
return tarball
def upload_docs(tarball : Path, pkg : Package, publish : bool):
publish_tag = '-publish' if publish else ''
stamp = WORK_DIR / f'{pkg.name}-docs{publish_tag}'
if stamp.is_file():
return
# Upload the documentation tarball
print(f'Uploading documentation for {pkg.name}...')
cabal_upload(tarball, publish=publish, extra_args=['--documentation'])
stamp.write_text('')
def upload_pkg(pkg: Package, d : Path, meta, publish : bool):
print(f'Uploading {pkg.name}...')
upload_pkg_sdist(d / meta['sdist'], pkg, publish=publish)
upload_docs(d / meta['docs'], pkg, publish=publish)
def prepare_pkg(bindist : Path, pkg : Package):
if pkg.path.exists():
print(f'Processing {pkg.name}...')
p1 = prepare_sdist(pkg)
p2 = prepare_docs(bindist, pkg)
return { 'sdist' : p1, 'docs': p2 }
else:
print(f"Package {pkg.name} doesn't exist... skipping")
def upload_all(bindist: Path):
for pkg in PACKAGES.values():
upload_pkg(bindist, pkg)
def main() -> None:
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('pkg', type=str, nargs='*', help='package to upload')
subparsers = parser.add_subparsers(dest="command")
parser_prepare = subparsers.add_parser('prepare')
parser_prepare.add_argument('--bindist', required=True, type=Path, help='extracted binary distribution')
parser_upload = subparsers.add_parser('upload')
parser_upload.add_argument('--docs', required = True, type=Path, help='folder created by --prepare')
parser_upload.add_argument('--publish', action='store_true', help='Publish Hackage packages instead of just uploading candidates')
args = parser.parse_args()
pkgs = args.pkg
for pkg_name in pkgs:
assert pkg_name in PACKAGES
if pkgs == []:
pkgs = PACKAGES.keys()
if args.command == "prepare":
manifest = {}
for pkg_name in pkgs:
print(pkg_name)
pkg = PACKAGES[pkg_name]
pkg_meta = prepare_pkg(args.bindist, pkg)
manifest[pkg] = pkg_meta
manifest_path = WORK_DIR / 'docs' / 'manifest.pickle'
with open(WORK_DIR / 'docs' / 'manifest.pickle', 'wb') as fout:
pickle.dump(manifest, fout)
elif args.command == "upload":
manifest_path = args.docs
with open(manifest_path / 'manifest.pickle', 'rb') as fin:
manifest = pickle.load(fin)
for pkg, item in manifest.items():
if pkg.name in pkgs:
print(pkg, item)
upload_pkg(pkg, manifest_path, item, publish=args.publish)
if __name__ == '__main__':
main()
......@@ -349,6 +349,7 @@ shelarcy <shelarcy@gmail.com> # Uses this name onl
Ömer Sinan Ağacan <omeragacan@gmail.com> <omer@well-typed.com>
# Note [geoffw]
# ~~~~~~~~~~~~~
# From GHC wiki: "Geoff Washburn made the first implementation of GADTs in GHC"
# Other possibilities (but not such a direct connection with GHC):
# * Geoff W. Hamilton
......@@ -357,14 +358,16 @@ shelarcy <shelarcy@gmail.com> # Uses this name onl
# PhD student, OCaml, "Dynamic ADTs"
#
# Note [uid245]
# ~~~~~~~~~~~~~
# Circumstantial evidence only:
# * Commit fafe43, "Avoid divide by zero", by simonm.
# * Subsequent commit fd40a1, "avoid another divide by zero", by uid245.
# * Three commits later 15e6ea, "urk, extra parenthesis crept in", by simonm. Same file section.
#
# Note [usrbincc]
# ~~~~~~~~~~~~~~~
# https://github.com/thlorenz/node-traceur/commit/59f97feae23763c456b70bb129dbe04004e9fe04
#
# Note [zhuang]
# ~~~~~~~~~~~~~
# http://comments.gmane.org/gmane.comp.lang.haskell.cvs.ghc/33473
#EOF
# The following enables container-based travis instances
sudo: false
git:
submodules: false
env:
- DEBUG_STAGE2=YES
- DEBUG_STAGE2=NO
# TODO. Install llvm once llvm's APT repository is working again.
# See http://lists.llvm.org/pipermail/llvm-dev/2016-May/100303.html.
addons:
apt:
sources:
- hvr-ghc
#- llvm-toolchain-precise-3.7
- ubuntu-toolchain-r-test
packages:
- cabal-install-2.2
- ghc-8.4.3
- alex-3.1.7
- happy-1.19.5
- python3
#- llvm-3.7
before_install:
- export PATH=/opt/ghc/8.4.3/bin:/opt/cabal/2.2/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:/usr/lib/llvm-3.7/bin:$PATH
# Be explicit about which protocol to use, such that we don't have to repeat the rewrite command for each.
- git config remote.origin.url git://github.com/${TRAVIS_REPO_SLUG}.git
- git config --global url."git://github.com/${TRAVIS_REPO_SLUG%/*}/packages-".insteadOf "git://github.com/${TRAVIS_REPO_SLUG%/*}/packages/"
- git submodule --quiet init # Be quiet about these urls, as we may override them later.
# Check if submodule repositories exist.
- git config --get-regexp submodule.*.url | while read entry url; do git ls-remote "$url" dummyref 2>/dev/null && echo "$entry = $url" || git config --unset-all "$entry" ; done
# Use github.com/ghc for those submodule repositories we couldn't connect to.
- git config remote.origin.url git://github.com/ghc/ghc.git
- git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/
- git submodule init # Don't be quiet, we want to show these urls.
- git submodule --quiet update --recursive # Now we can be quiet again.
script:
# do not build docs
- echo 'HADDOCK_DOCS = NO' >> mk/validate.mk
- echo 'BUILD_SPHINX_HTML = NO' >> mk/validate.mk
- echo 'BUILD_SPHINX_PDF = NO' >> mk/validate.mk
# do not build dynamic libraries
- echo 'DYNAMIC_GHC_PROGRAMS = NO' >> mk/validate.mk
- echo 'GhcLibWays = v' >> mk/validate.mk
- if [ "$DEBUG_STAGE2" = "YES" ]; then echo 'GhcStage2HcOpts += -DDEBUG' >> mk/validate.mk; fi
# * Use --quiet, otherwise the build log might exceed the limit of 4
# megabytes, causing Travis to kill our job.
# * But use VERBOSE=2 (the default, but not when using --quiet) otherwise
# the testsuite might not print output for over 10 minutes (more likely so
# when DEBUG_STAGE2=NO), causing Travis to again kill our job.
# * Use --fast, to stay within the time limits set by Travis.
# See Note [validate and testsuite speed] in toplevel Makefile.
# Actually, do not run test suite. Takes too long.
- THREADS=3 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet --build-only