Skip to content

Commit

Permalink
Bug 1417264 - Write objdir .mozconfig from Python; r=nalexander
Browse files Browse the repository at this point in the history
This is a pretty straightforward port of the logic. But we
even go a step further: we delete the file in the objdir if there is
no source mozconfig!

MozReview-Commit-ID: AHFFzy6mXRY
  • Loading branch information
indygreg committed Nov 14, 2017
1 parent 526d70d commit 7a0d8dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 0 additions & 6 deletions client.mk
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ configure-files: $(CONFIGURES)

configure-preqs = \
configure-files \
save-mozconfig \
$(OBJDIR)/.mozconfig.json \
$(NULL)

Expand All @@ -151,11 +150,6 @@ endif

$(OBJDIR)/.mozconfig.json: ;

save-mozconfig: $(FOUND_MOZCONFIG)
ifdef FOUND_MOZCONFIG
-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
endif

configure:: $(configure-preqs)
$(call BUILDSTATUS,TIERS configure)
$(call BUILDSTATUS,TIER_START configure)
Expand Down
14 changes: 14 additions & 0 deletions python/mozbuild/mozbuild/controller/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from __future__ import absolute_import, unicode_literals

import errno
import getpass
import io
import json
Expand Down Expand Up @@ -1371,6 +1372,19 @@ def _run_client_mk(self, target=None, line_handler=None, jobs=0,
with FileAvoidWrite(mozconfig_mk) as fh:
fh.write(b'\n'.join(mozconfig_filtered_lines))

# Copy the original mozconfig to the objdir.
mozconfig_objdir = os.path.join(self.topobjdir, '.mozconfig')
if mozconfig['path']:
with open(mozconfig['path'], 'rb') as ifh:
with FileAvoidWrite(mozconfig_objdir) as ofh:
ofh.write(ifh.read())
else:
try:
os.unlink(mozconfig_objdir)
except OSError as e:
if e.errno != errno.ENOENT:
raise

if mozconfig_make_lines:
self.log(logging.WARNING, 'mozconfig_content', {
'path': mozconfig['path'],
Expand Down

0 comments on commit 7a0d8dc

Please sign in to comment.