mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
Throw better error when conf files are missing (#1030)
* Throw better error when conf files are missing Previously, if some directories were missing .conf files, an error like this would be thrown: cp: missing destination file operand after '/nix/store/pnmrz06g0sa4s3yx53hgmr9k8jrh6ww0-ouroboros-network-framework-lib-ouroboros-network-framework-0.1.0.0-haddock-config/lib/ghc-8.6.5/package.conf.d' While normally this shouldn't occur, I've seen it happen in CI anyways, with the problem disappearing if the store path that's missing the files was rebuilt a couple times. With this commit, it becomes much easier to figure out which store path is missing the files, which would be very hard to figure out from the previous message.
This commit is contained in:
parent
59a9ee7db1
commit
feea345b32
@ -371,7 +371,14 @@ let
|
||||
echo "package-id $id" >> $out/envDep
|
||||
else
|
||||
echo 'ERROR: ${package.identifier.name} id could not be found with ${target-pkg-and-db}'
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
if ver=$(${target-pkg-and-db} field ${package.identifier.name} version --simple-output); then
|
||||
echo "constraint: ${package.identifier.name} == $ver" >> $out/exactDep/cabal.config
|
||||
echo "constraint: ${package.identifier.name} installed" >> $out/exactDep/cabal.config
|
||||
else
|
||||
echo 'ERROR: ${package.identifier.name} version could not be found with ${target-pkg-and-db}'
|
||||
exit 1
|
||||
fi
|
||||
''
|
||||
else
|
||||
@ -389,17 +396,10 @@ let
|
||||
echo "--dependency=${package.identifier.name}:''${name#z-${package.identifier.name}-z-}=$id" >> $out/exactDep/configure-flags
|
||||
else
|
||||
echo 'ERROR: ${package.identifier.name} id could not be found with ${target-pkg-and-db}'
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
'')
|
||||
}
|
||||
if ver=$(${target-pkg-and-db} field ${package.identifier.name} version --simple-output); then
|
||||
echo "constraint: ${package.identifier.name} == $ver" >> $out/exactDep/cabal.config
|
||||
echo "constraint: ${package.identifier.name} installed" >> $out/exactDep/cabal.config
|
||||
else
|
||||
echo 'ERROR: ${package.identifier.name} version could not be found with ${target-pkg-and-db}'
|
||||
exit 0
|
||||
fi
|
||||
''}
|
||||
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId) ''
|
||||
mkdir -p $out/bin
|
||||
|
@ -93,12 +93,24 @@ let
|
||||
|
||||
for l in "${cfgFiles}"; do
|
||||
if [ -n "$l" ]; then
|
||||
cp -f "$l/${packageCfgDir}/"*.conf $out/${packageCfgDir}
|
||||
files=("$l/${packageCfgDir}/"*.conf)
|
||||
if (( ''${#files[@]} )); then
|
||||
cp -f "''${files[@]}" $out/${packageCfgDir}
|
||||
else
|
||||
echo "$l/${packageCfgDir} didn't contain any *.conf files!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for l in "${libs}"; do
|
||||
if [ -n "$l" ]; then
|
||||
cp -f "$l/package.conf.d/"*.conf $out/${packageCfgDir}
|
||||
files=("$l/package.conf.d/"*.conf)
|
||||
if (( ''${#files[@]} )); then
|
||||
cp -f "''${files[@]}" $out/${packageCfgDir}
|
||||
else
|
||||
echo "$l/package.conf.d didn't contain any *.conf files!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
6
ci.nix
6
ci.nix
@ -25,6 +25,7 @@
|
||||
# Update supported-ghc-versions.md to reflect any changes made here.
|
||||
{
|
||||
ghc865 = true;
|
||||
ghc884 = false; # Just included because the native version is needed at eval time
|
||||
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2009") {
|
||||
ghc883 = false;
|
||||
ghc884 = true;
|
||||
@ -51,9 +52,12 @@
|
||||
|| (nixpkgsName == "R2003" && __elem compiler-nix-name ["ghc865"]))) {
|
||||
# Windows cross compilation is currently broken on macOS
|
||||
inherit (lib.systems.examples) mingwW64;
|
||||
} // lib.optionalAttrs (system == "x86_64-linux") {
|
||||
} // lib.optionalAttrs (system == "x86_64-linux"
|
||||
&& !(nixpkgsName == "R2003" && compiler-nix-name == "ghc884")) {
|
||||
# Musl cross only works on linux
|
||||
# aarch64 cross only works on linux
|
||||
# We also skip these for the R2003 was build of ghc884 (we only need the
|
||||
# native so ifdLevel 1 includes compiler needed in ifdLevel2 eval)
|
||||
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
|
||||
};
|
||||
isDisabled = d:
|
||||
|
@ -285,19 +285,19 @@ stdenv.mkDerivation (rec {
|
||||
# Sanity checks for https://github.com/input-output-hk/haskell.nix/issues/660
|
||||
if ! "$out/bin/${targetPrefix}ghc" --version; then
|
||||
echo "ERROR: Missing file $out/bin/${targetPrefix}ghc"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
if ! "$out/bin/${targetPrefix}ghc-pkg" --version; then
|
||||
echo "ERROR: Missing file $out/bin/${targetPrefix}ghc-pkg"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$out/lib/${targetPrefix}ghc-${version}" ]]; then
|
||||
echo "ERROR: Missing directory $out/lib/${targetPrefix}ghc-${version}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
if (( $(ls -1 "$out/lib/${targetPrefix}ghc-${version}" | wc -l) < 30 )); then
|
||||
echo "ERROR: Expected more files in $out/lib/${targetPrefix}ghc-${version}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
|
@ -31,7 +31,7 @@ ${
|
||||
pkgs.lib.optionalString (index ? outputHash) ''
|
||||
if [[ "${index.outputHash}" != "$index_sha256" ]]; then
|
||||
echo "ERROR See https://github.com/input-output-hk/haskell.nix/issues/884"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
''}
|
||||
export index_length=$(stat --printf="%s" ${index})
|
||||
|
@ -26,11 +26,11 @@ in
|
||||
buildCommand = ''
|
||||
if [[ "${version-before}" != "0.6.0.0" ]]; then
|
||||
echo 'Unexpected version ${version-before} (expected "0.6.0.0")'
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${version-after}" != "0.6.0.1" ]]; then
|
||||
echo 'Unexpected version ${version-after} (expected "0.6.0.1")'
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch $out
|
||||
|
Loading…
Reference in New Issue
Block a user