Bug 1593948 - Touch clobber in configure.py instead of clobber.py; r=firefox-build-system-reviewers,chmanchester

If configure is invoked manually, clobber.py is bypassed and the CLOBBER
file doesn't get touched. The clobber check in Makefile.in gets
triggered causing the build to stop.

Moving the objdir/CLOBBER file creation into configure.py should cause
it to be created regardless of how configure is invoked.

Depends on D53290

Differential Revision: https://phabricator.services.mozilla.com/D53291

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Shal 2019-11-19 21:49:13 +00:00
Родитель d72f22d80a
Коммит 3ce3aba1c7
3 изменённых файлов: 10 добавлений и 23 удалений

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

@ -34,6 +34,12 @@ def main(argv):
sandbox = ConfigureSandbox(config, os.environ, argv)
clobber_file = 'CLOBBER'
if not os.path.exists(clobber_file):
# Simply touch the file.
with open(clobber_file, 'a'):
pass
if os.environ.get('MOZ_CONFIGURE_TRACE'):
sandbox._logger.setLevel(TRACE)

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

@ -166,20 +166,6 @@ class Clobberer(object):
paths = self.collect_subdirs(cargo_path, {'incremental', })
self.delete_dirs(cargo_path, paths)
def ensure_objdir_state(self):
"""Ensure the CLOBBER file in the objdir exists.
This is called as part of the build to ensure the clobber information
is configured properly for the objdir.
"""
if not os.path.exists(self.topobjdir):
os.makedirs(self.topobjdir)
if not os.path.exists(self.obj_clobber):
# Simply touch the file.
with open(self.obj_clobber, 'a'):
pass
def maybe_do_clobber(self, cwd, allow_auto=False, fh=sys.stderr):
"""Perform a clobber if it is required. Maybe.
@ -199,7 +185,6 @@ class Clobberer(object):
if not self.clobber_needed():
print('Clobber not needed.', file=fh)
self.ensure_objdir_state()
return False, False, None
# So a clobber is needed. We only perform a clobber if we are
@ -223,7 +208,6 @@ class Clobberer(object):
print('Automatically clobbering %s' % objdir, file=fh)
try:
self.remove_objdir(False)
self.ensure_objdir_state()
print('Successfully completed auto clobber.', file=fh)
return True, True, None
except (IOError) as error:

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

@ -64,14 +64,13 @@ class TestClobberer(unittest.TestCase):
c = Clobberer(self.get_topsrcdir(), tmp)
self.assertFalse(c.clobber_needed())
# Side-effect is topobjdir is created with CLOBBER file touched.
required, performed, reason = c.maybe_do_clobber(os.getcwd(), True)
self.assertFalse(required)
self.assertFalse(performed)
self.assertIsNone(reason)
self.assertTrue(os.path.isdir(tmp))
self.assertTrue(os.path.exists(os.path.join(tmp, 'CLOBBER')))
self.assertFalse(os.path.isdir(tmp))
self.assertFalse(os.path.exists(os.path.join(tmp, 'CLOBBER')))
def test_objdir_no_clobber_file(self):
"""If CLOBBER does not exist in topobjdir, treat as empty."""
@ -84,7 +83,7 @@ class TestClobberer(unittest.TestCase):
self.assertFalse(performed)
self.assertIsNone(reason)
self.assertTrue(os.path.exists(os.path.join(c.topobjdir, 'CLOBBER')))
self.assertFalse(os.path.exists(os.path.join(c.topobjdir, 'CLOBBER')))
def test_objdir_clobber_newer(self):
"""If CLOBBER in topobjdir is newer, do nothing."""
@ -121,9 +120,7 @@ class TestClobberer(unittest.TestCase):
self.assertTrue(performed)
self.assertFalse(os.path.exists(dummy_path))
self.assertTrue(os.path.exists(c.obj_clobber))
self.assertGreaterEqual(os.path.getmtime(c.obj_clobber),
os.path.getmtime(c.src_clobber))
self.assertFalse(os.path.exists(c.obj_clobber))
def test_objdir_is_srcdir(self):
"""If topobjdir is the topsrcdir, refuse to clobber."""