Bug 1415335 - Move Windows line endings detection to configure; r=nalexander

This doesn't need to be in client.mk.

Also, we inline the info to help people correct the failure, as this
results in a better user experience.

MozReview-Commit-ID: KURL3RIGzKf

--HG--
extra : rebase_source : dc79d3f6aa4e91a12cab0e26d5fc0a3e15afa833
extra : source : 2eceb30625acd8cfadda0baa6326a7e9fd07dece
This commit is contained in:
Gregory Szorc 2017-11-07 17:16:39 -08:00
Родитель 6ff5d5762b
Коммит 989efa7a51
2 изменённых файлов: 24 добавлений и 8 удалений

Просмотреть файл

@ -14,6 +14,7 @@ option(env='DIST', nargs=1, help='DIST directory')
@depends('--help', 'DIST')
@imports(_from='__builtin__', _import='open')
@imports(_from='os.path', _import='exists')
def check_build_environment(help, dist):
topobjdir = os.path.realpath(os.path.abspath('.'))
@ -61,6 +62,29 @@ def check_build_environment(help, dist):
' ***'
)
# Check for CRLF line endings.
with open(os.path.join(topsrcdir, 'configure.py'), 'rb') as fh:
data = fh.read()
if '\r' in data:
die('\n ***\n'
' * The source tree appears to have Windows-style line endings.\n'
' *\n'
' * If using Git, Git is likely configured to use Windows-style\n'
' * line endings.\n'
' *\n'
' * To convert the working copy to UNIX-style line endings, run\n'
' * the following:\n'
' *\n'
' * $ git config core.autocrlf false\n'
' * $ git config core.eof lf\n'
' * $ git rm --cached -r .\n'
' * $ git reset --hard\n'
' *\n'
' * If not using Git, the tool you used to obtain the source\n'
' * code likely converted files to Windows line endings. See\n'
' * usage information for that tool for more.\n'
' ***')
# Check for a couple representative files in the source tree
conflict_files = [
'* %s' % f for f in ('Makefile', 'config/autoconf.mk')

Просмотреть файл

@ -56,14 +56,6 @@ CONFIG_GUESS := $(shell $(TOPSRCDIR)/build/autoconf/config.guess)
# Windows checks.
ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
# check for CRLF line endings
ifneq (0,$(shell $(PERL) -e 'binmode(STDIN); while (<STDIN>) { if (/\r/) { print "1"; exit } } print "0"' < $(TOPSRCDIR)/client.mk))
$(error This source tree appears to have Windows-style line endings. To \
convert it to Unix-style line endings, check \
"https://developer.mozilla.org/en-US/docs/Developer_Guide/Mozilla_build_FAQ\#Win32-specific_questions" \
for a workaround of this issue.)
endif
# Set this for baseconfig.mk
HOST_OS_ARCH=WINNT
endif