Skip to content

Commit

Permalink
Bug 1415335 - Move Windows line endings detection to configure; r=nal…
Browse files Browse the repository at this point in the history
…exander

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
  • Loading branch information
indygreg committed Nov 8, 2017
1 parent 6ff5d57 commit 989efa7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
24 changes: 24 additions & 0 deletions build/moz.configure/init.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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('.'))
Expand Down Expand Up @@ -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')
Expand Down
8 changes: 0 additions & 8 deletions client.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 989efa7

Please sign in to comment.