Commit 32a6fb65 authored by Benjamin Sparks's avatar Benjamin Sparks
Browse files

versionCheckHook: emit warning when falling back to pname

parent 651abd93
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,11 @@ versionCheckHook(){
    elif [[ ! -z "${NIX_MAIN_PROGRAM-}" ]]; then
        cmdProgram="${!outputBin}/bin/${NIX_MAIN_PROGRAM}"
    elif [[ ! -z "${pname-}" ]]; then
        echo "versionCheckHook: Package \`${pname}\` does not have the \`meta.mainProgram\` attribute." \
            "We'll assume that the main program has the same name for now, but this behavior is deprecated," \
            "because it leads to surprising errors when the assumption does not hold." \
            "If the package has a main program, please set \`meta.mainProgram\` in its definition to make this warning go away." \
            "Should the binary that outputs the intended version differ from \`meta.mainProgram\`, consider setting \`versionCheckProgram\` instead." >&2
        cmdProgram="${!outputBin}/bin/${pname}"
    else
        echo "versionCheckHook: \$NIX_MAIN_PROGRAM, \$versionCheckProgram and \$pname are all empty, so" \