# Hydra build file for coccinelle
-{ nixpkgs ? /etc/nixos/nixpkgs
+{ nixpkgs ? "/etc/nixos/nixpkgs"
, cocciSrc ? { outPath = ./.; revCount = 1234; gitTag = "abcdef"; }
, testsSrc ? { outPath = ../big-tests; rev = 1234; }
, officialRelease ? false
postDist = ''
export HOME=$PREVHOME # restore the home directory
- ensureDir "$out/tarballs"
+ mkdir -p "$out/tarballs"
# rename the tarball to give it a version-specific name
cp coccinelle-*.tar.gz "$out/tarballs/coccinelle-${version}${versionSuffix}.tar.gz"
#
selOcamlDefault = orig: orig.ocamlPackages;
+ selOcaml400 = orig: orig.ocamlPackages_4_00_0;
selOcaml312 = orig: orig.ocamlPackages_3_12_1;
selOcaml311 = orig: orig.ocamlPackages_3_11_2;
selOcaml310 = orig: orig.ocamlPackages_3_10_0;
selCommonOcamlPkgs = ocamlPackages: with ocamlPackages; [
- findlib menhir ocaml_sexplib ocaml_extlib
+ findlib menhir ocaml_sexplib
];
selMinimalOcamlPkgs = ocamlPackages: with ocamlPackages; [
];
selAllOcamlPkgs = ocamlPackages: with ocamlPackages; [
- findlib menhir ocaml_sexplib ocaml_extlib ocaml_pcre pycaml
+ findlib menhir ocaml_sexplib ocaml_pcre pycaml
];
selCommonInputs = pkgs: [ pkgs.pkgconfig pkgs.pcre ];
selOcaml = selOcamlDefault;
extras = selCommonInputs pkgs;
shell = selDefaultShell pkgs;
+ extraAttrs = { };
};
# creates a configuration for a given ocaml version
ocamls = selMinimalOcamlPkgs pkgs.ocamlPackages;
extras = selCommonInputs pkgs;
shell = selDefaultShell pkgs;
+ extraAttrs = { };
};
# creates a default configuration with additional flags
- mkCfgDefault = { name, flags }: pkgs: {
+ mkCfgDefault = { name, flags, extra ? {} }: pkgs: {
inherit name flags;
pythons = selPythonDefault pkgs;
ocamls = selAllOcamlPkgs pkgs.ocamlPackages;
selOcaml = selOcamlDefault;
extras = selCommonInputs pkgs;
shell = selDefaultShell pkgs;
+ extraAttrs = extra;
};
# creates a minimal configuration with additional flags
selOcaml = selOcamlDefault;
extras = [];
shell = selDefaultShell pkgs;
+ extraAttrs = { };
};
# creates a configuration for the given ocaml packages
selOcaml = selOcamlDefault;
extras = selCommonInputs pkgs;
shell = selDefaultShell pkgs;
+ extraAttrs = { };
};
# build the project using the given shell
flags = [];
extras = [ pkgs.pcre ];
shell = selShell pkgs;
+ extraAttrs = { };
};
# creates a configuration with multiple ocaml versions: this gives
flags = [];
extras = selCommonInputs pkgs ++ map (selOcaml pkgs) sels;
shell = selDefaultShell pkgs;
+ extraAttrs = { };
};
defaultCfg = mkCfgDefault { name = "default"; flags = []; };
debugCfg = mkCfgDefault { name = "debug"; flags = [ "--enable-release=no" ]; };
wrappersCfg = mkCfgDefault { name = "wrappers"; flags = [ "--enable-python" "--enable-ocaml" "--without-pkg-config" "--without-ocamlfind" ]; };
- manyOcamlCfg = mkCfgManyOcaml [ selOcaml312 selOcaml311 selOcaml310 ];
+ manyOcamlCfg = mkCfgManyOcaml [ selOcaml400 selOcaml312 selOcaml311 selOcaml310 ];
minimalCfgs = map mkCfgMinimal [
{ name = "minimal"; flags = []; }
# These versions ship with minimal global packages in order
# to thest the bundled packages with these ocaml versions.
ocamlCfgs = map mkCfgOcaml [
+ { name = "400nat"; selOcaml = selOcaml400; flags = [ "--enable-release=yes" ]; }
+ { name = "400byt"; selOcaml = selOcaml400; flags = []; }
{ name = "312"; selOcaml = selOcaml312; flags = []; }
{ name = "311"; selOcaml = selOcaml311; flags = [ "--enable-release=yes" ]; }
{ name = "310"; selOcaml = selOcaml310; flags = []; }
# Several configurations testing different available
# ocaml packages.
pkgCfgs = map mkCfgPackage [
- { name = "extlib"; ocamls = ps: [ ps.ocaml_extlib ]; flags = [ "--enable-extlib" ]; }
{ name = "pcre"; ocamls = ps: [ ps.ocaml_pcre ]; flags = [ "--enable-pcre-syntax" ]; }
{ name = "sexplib"; ocamls = ps: [ ps.ocaml_sexplib ]; flags = [ "--enable-sexplib" ]; }
{ name = "pycaml"; ocamls = ps: [ ps.pycaml ]; flags = [ "--enable-pycaml" ]; }
];
+ # Tests using several different types of shells.
shellCfgs = map mkCfgShell [
{ name = "bash"; selShell = pkgs: "${pkgs.bash}/bin/bash"; }
{ name = "dash"; selShell = pkgs: "${pkgs.dash}/bin/dash"; }
# { name = "tcsh"; selShell = pkgs: "${pkgs.tcsh}/bin/tcsh"; }
];
+ #
+ # Configurations for the compilation of coccinelle using ocamlbuild.
+ #
+
+ ocamlbuildZeroCfg = mkCfgMinimal {
+ name = "ocamlbuild-zero";
+ flags = [ "--enable-ocamlbuild" "--enable-release" ];
+ };
+
+ ocamlbuildFullCfg = mkCfgDefault {
+ name = "ocamlbuild-full";
+ flags = [ "--enable-ocamlbuild" "--enable-release" ];
+ };
+
+ ocamlbuildCfgs = map mkCfgOcaml [
+ { name = "ocamlbuild-400nat"; selOcaml = selOcaml400;
+ flags = [ "--enable-ocamlbuild" "--enable-release=yes" ]; }
+ { name = "ocamlbuild-400byte"; selOcaml = selOcaml400;
+ flags = [ "--enable-ocamlbuild" ]; }
+ { name = "ocamlbuild-312"; selOcaml = selOcaml312;
+ flags = [ "--enable-ocamlbuild" "--enable-release" ]; }
+ { name = "ocamlbuild-311"; selOcaml = selOcaml311;
+ flags = [ "--enable-ocamlbuild" ]; }
+ { name = "ocamlbuild-310"; selOcaml = selOcaml310;
+ flags = [ "--enable-ocamlbuild" "--enable-release" ]; }
+ ] ++ [ ocamlbuildZeroCfg ocamlbuildFullCfg ];
+
altCfgs =
[ debugCfg manyOcamlCfg ]
++ minimalCfgs
++ ocamlCfgs ++ pythonCfgs
- ++ pkgCfgs ++ shellCfgs;
+ ++ pkgCfgs ++ shellCfgs
+ ++ ocamlbuildCfgs;
#
};
cfg = mkConfiguration pkgs;
flags = [ "--enable-release=world" ] ++ cfg.flags;
- in with pkgs; releaseTools.nixBuild {
+ in with pkgs; releaseTools.nixBuild ({
inherit (cfg) shell;
name = "cocci-build-${cfg.name}";
src = tarball;
substituteInPlace $script --replace '#! /bin/sh' '#! ${cfg.shell}'
done
'';
- };
+ } // cfg.extraAttrs);
build = mkBuild defaultCfg;
altBuilds = map mkBuild altCfgs;
allBuilds = [ build ] ++ altBuilds;
+ # compile with ocaml profiling turned on and then running the
+ # test suite to collect results.
+ profileCfg = mkCfgDefault {
+ name = "profiling";
+ flags = [ "--enable-release=profile" ];
+ extra = {
+ installPhase = ''
+ mkdir -p "$out/nix-support"
+ cp ocamlprof.dump "$out/ocamlprof.dump"
+ echo "file binary $out/ocamlprof.dump" >> "$out/nix-support/hydra-build-products"
+ '';
+ };
+ };
+ profile = mkBuild profileCfg {};
+
#
# Package builders
phases = [ "runPhase" ];
runPhase = ''
- ensureDir "$out"
- ensureDir "$out/nix-support"
+ mkdir -p "$out"
+ mkdir -p "$out/nix-support"
touch "$TMPDIR/result.log"
exec > >(tee -a "$TMPDIR/result.log") 2> >(tee -a "$TMPDIR/result.log" >&2)
runHook execPhase
# as this directory contains large
# files, we'll create links to the
# individual files.
- ensureDir "$TMPDIR/tests"
+ mkdir -p "$TMPDIR/tests"
cp -rs ${testsSrc}/* "$TMPDIR/tests/"
chmod -R u+w "$TMPDIR/tests/"
cd "$TMPDIR/tests"
# as this directory contains large
# files, we'll create links to the
# individual files.
- ensureDir "$TMPDIR/tests"
+ mkdir -p "$TMPDIR/tests"
cp -rs ${testsSrc}/* "$TMPDIR/tests/"
chmod -R u+w "$TMPDIR/tests/"
ocaml findlib menhir
python pcre patchelf
];
- configureFlagsArray = [ "--enable-release" ];
+ configureFlags = "--enable-release";
buildPhase = ''
export TARGETDIR="$TMPDIR/dists"
inherit build;
inherit report;
inherit dist;
+ inherit profile;
};
# artificial dependency on report to ensure that we are not going through