Linux - PKGBUILD contains CRLF characters and cannot be sourced

Reference: https://github.com/Jguer/yay/issues/1024

Sometimes, when we are trying to install packages, we run into this error.

ERROR: PKGBUILD contains CRLF characters and cannot be sourced.

It was indeed a autocrlf related issue. To get it work, we need to clean the build caches for already fetched packages.

For future reference for people with the same issue:

  1. ensure right autocrlf value (not set, or ‘input) e.g. via git config --edit --global
  2. remove/rename for the package manager that is being used
    ~/.cache/yay or ~/.cache/paru
    

(required?) clear makepkg builddir folder (see value BUILDDIR in /etc/makepkg.conf for the builddir path)


Links to this note