make-tarball.nix: Fix <nixpkgs> check

This was broken by 6bcf194449, which
caused the result of the check to be ignored (since xargs will return
a non-zero exit status if *any* grep doesn't find a match).
This commit is contained in:
Eelco Dolstra 2017-12-07 15:57:06 +01:00
parent 9a8633bb59
commit 5c5223d46b
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -43,8 +43,10 @@ releaseTools.sourceTarball rec {
echo 'abort "Illegal use of <nixpkgs> in Nixpkgs."' > $TMPDIR/barf.nix
# Make sure that Nixpkgs does not use <nixpkgs>
if (find pkgs -type f -name '*.nix' -print | xargs grep '<nixpkgs\/'); then
badFiles=$(find pkgs -type f -name '*.nix' -print | xargs grep -l '^[^#]*<nixpkgs\/' || true)
if [[ -n $badFiles ]]; then
echo "Nixpkgs is not allowed to use <nixpkgs> to refer to itself."
echo "The offending files: $badFiles"
exit 1
fi