Bug 1195748 - Make mach clobber never auto-log. r=gps

This never was a problem since auto-logging was broken on Windows, but
having mach clobber auto-log is a problem on Windows since it tries to
remove the log file while itself has it open, which fails.

--HG--
extra : rebase_source : 6da9f3e6148c201eade01d4598ce9c4becd051a0
This commit is contained in:
Mike Hommey 2016-07-27 16:29:02 +09:00
Родитель 6283835342
Коммит e6ea4a5bfe
1 изменённых файлов: 38 добавлений и 35 удалений

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

@ -573,41 +573,6 @@ class Build(MachCommandBase):
print('Hit CTRL+c to stop server.')
server.run()
CLOBBER_CHOICES = ['objdir', 'python']
@Command('clobber', category='build',
description='Clobber the tree (delete the object directory).')
@CommandArgument('what', default=['objdir'], nargs='*',
help='Target to clobber, must be one of {{{}}} (default objdir).'.format(
', '.join(CLOBBER_CHOICES)))
def clobber(self, what):
invalid = set(what) - set(self.CLOBBER_CHOICES)
if invalid:
print('Unknown clobber target(s): {}'.format(', '.join(invalid)))
return 1
ret = 0
if 'objdir' in what:
try:
self.remove_objdir()
except OSError as e:
if sys.platform.startswith('win'):
if isinstance(e, WindowsError) and e.winerror in (5,32):
self.log(logging.ERROR, 'file_access_error', {'error': e},
"Could not clobber because a file was in use. If the "
"application is running, try closing it. {error}")
return 1
raise
if 'python' in what:
if os.path.isdir(mozpath.join(self.topsrcdir, '.hg')):
cmd = ['hg', 'purge', '--all', '-I', 'glob:**.py[co]']
elif os.path.isdir(mozpath.join(self.topsrcdir, '.git')):
cmd = ['git', 'clean', '-f', '-x', '*.py[co]']
else:
cmd = ['find', '.', '-type', 'f', '-name', '*.py[co]', '-delete']
ret = subprocess.call(cmd, cwd=self.topsrcdir)
return ret
@Command('build-backend', category='build',
description='Generate a backend used to build the tree.')
@CommandArgument('-d', '--diff', action='store_true',
@ -657,6 +622,44 @@ class Doctor(MachCommandBase):
doctor = Doctor(self.topsrcdir, self.topobjdir, fix)
return doctor.check_all()
@CommandProvider
class Clobber(MachCommandBase):
NO_AUTO_LOG = True
CLOBBER_CHOICES = ['objdir', 'python']
@Command('clobber', category='build',
description='Clobber the tree (delete the object directory).')
@CommandArgument('what', default=['objdir'], nargs='*',
help='Target to clobber, must be one of {{{}}} (default objdir).'.format(
', '.join(CLOBBER_CHOICES)))
def clobber(self, what):
invalid = set(what) - set(self.CLOBBER_CHOICES)
if invalid:
print('Unknown clobber target(s): {}'.format(', '.join(invalid)))
return 1
ret = 0
if 'objdir' in what:
try:
self.remove_objdir()
except OSError as e:
if sys.platform.startswith('win'):
if isinstance(e, WindowsError) and e.winerror in (5,32):
self.log(logging.ERROR, 'file_access_error', {'error': e},
"Could not clobber because a file was in use. If the "
"application is running, try closing it. {error}")
return 1
raise
if 'python' in what:
if os.path.isdir(mozpath.join(self.topsrcdir, '.hg')):
cmd = ['hg', 'purge', '--all', '-I', 'glob:**.py[co]']
elif os.path.isdir(mozpath.join(self.topsrcdir, '.git')):
cmd = ['git', 'clean', '-f', '-x', '*.py[co]']
else:
cmd = ['find', '.', '-type', 'f', '-name', '*.py[co]', '-delete']
ret = subprocess.call(cmd, cwd=self.topsrcdir)
return ret
@CommandProvider
class Logs(MachCommandBase):
"""Provide commands to read mach logs."""