Closed
Bug 803400
Opened 12 years ago
Closed 11 years ago
Add clobber mach commands
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla20
People
(Reporter: gps, Assigned: gps)
Details
(Whiteboard: [mach])
Attachments
(1 file, 1 obsolete file)
2.81 KB,
patch
|
glandium
:
review+
|
Details | Diff | Splinter Review |
A couple people asked for mach to have "clean" and "clobber" commands. This patch implements them. Patch is trivial. It does include a minor change to proxy process exit codes properly. The ignore_errors bit is there so we don't raise an exception if make exits with a non-0 exit code.
Attachment #673071 -
Flags: review?(mh+mozilla)
Comment 1•12 years ago
|
||
Comment on attachment 673071 [details] [diff] [review] clobber and clean mach commands, v1 Review of attachment 673071 [details] [diff] [review]: ----------------------------------------------------------------- ::: python/mozbuild/mach/commands/build.py @@ +48,5 @@ > self.log(logging.INFO, 'build_output', {'line': line}, '{line}') > > + result = self._run_make(srcdir=True, filename='client.mk', > + line_handler=on_line, log=False, print_directory=False, > + ignore_errors=True) ignore_errors=True doesn't seem like a good idea for build(). @@ +62,5 @@ > + @Command('clean', help='Clean the build directory.') > + def clean(self): > + return self._run_make_target('clean') > + > + @Command('clobber', help='Clobber (remove) the object directory.') That's a lie. make clobber is strictly identical to make clean. However, I'd be in favor of a rule that actually just does that. @@ +70,5 @@ > + def _run_make_target(self, target): > + root_makefile = os.path.join(self.topobjdir, 'Makefile') > + > + if not os.path.exists(root_makefile): > + print('%s does not contain build files. Nothing to do.' % I've had cases where my objdir was lacking the Makefile, but almost nothing else. Might be better to just tell the truth and that there was no Makefile found thus nothing can be done.
Attachment #673071 -
Flags: review?(mh+mozilla) → review-
Assignee | ||
Comment 2•11 years ago
|
||
Removed contentious clean command. Focusing on clobber for now. Added mozfile to mach's fake virtualenv environment because it has faster implementation of "delete all the things."
Assignee: nobody → gps
Attachment #673071 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #689071 -
Flags: review?(mh+mozilla)
Assignee | ||
Updated•11 years ago
|
Summary: Add clean and clobber mach commands → Add clobber mach commands
Whiteboard: [mach]
Updated•11 years ago
|
Attachment #689071 -
Flags: review?(mh+mozilla) → review+
Assignee | ||
Comment 3•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/051613fd8775
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment 4•11 years ago
|
||
Comment on attachment 689071 [details] [diff] [review] Add clobber mach command, v2 ># HG changeset patch ># Parent 137d80a07e64b82e2fbc95c9a0a7cc8690376bf4 ># User Gregory Szorc <gps@mozilla.com> >Bug 803400 - Add clobber mach command > >diff --git a/mach b/mach >--- a/mach >+++ b/mach >@@ -27,16 +27,17 @@ > 'python/blessings', > 'python/psutil', > 'python/which', > 'other-licenses/ply', > 'xpcom/idl-parser', > 'testing', > 'testing/xpcshell', > 'testing/mozbase/mozprocess', >+ 'testing/mozbase/mozfile', > 'testing/mozbase/mozinfo', > ] > > # Individual files providing mach commands. > MACH_MODULES = [ > 'layout/tools/reftest/mach_commands.py', > 'python/mozboot/mozboot/mach_commands.py', > 'python/mozbuild/mozbuild/config.py', >diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py >--- a/python/mozbuild/mozbuild/base.py >+++ b/python/mozbuild/mozbuild/base.py >@@ -8,16 +8,18 @@ > import os > import subprocess > import sys > import which > > from mach.mixin.logging import LoggingMixin > from mach.mixin.process import ProcessExecutionMixin > >+from mozfile.mozfile import rmtree >+ > from .config import BuildConfig > from .mozconfig import ( > MozconfigFindException, > MozconfigLoadException, > MozconfigLoader, > ) > > >@@ -77,16 +79,23 @@ > @property > def bindir(self): > return os.path.join(self.topobjdir, 'dist', 'bin') > > @property > def statedir(self): > return os.path.join(self.topobjdir, '.mozbuild') > >+ def remove_objdir(self): >+ """Remove the entire object directory.""" >+ >+ # We use mozfile because it is faster than shutil.rmtree(). >+ # mozfile doesn't like unicode arguments (bug 818783). >+ rmtree(self.topobjdir.encode('utf-8')) >+ > @property > def _config_guess(self): > if self._config_guess_output is None: > p = os.path.join(self.topsrcdir, 'build', 'autoconf', > 'config.guess') > args = self._normalize_command([p], True) > self._config_guess_output = subprocess.check_output(args, > cwd=self.topsrcdir).strip() >diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py >--- a/python/mozbuild/mozbuild/mach_commands.py >+++ b/python/mozbuild/mozbuild/mach_commands.py >@@ -56,16 +56,21 @@ > self.log(logging.WARNING, 'warning_summary', > {'count': len(warnings_collector.database)}, > '{count} compiler warnings present.') > > warnings_database.save_to_file(warnings_path) > > return status > >+ @Command('clobber', help='Clobber the tree (delete the object directory).') >+ def clobber(self): >+ self.remove_objdir() >+ return 0 >+ > > @CommandProvider > class Warnings(MachCommandBase): > """Provide commands for inspecting warnings.""" > > @property > def database_path(self): > return self._get_state_filename('warnings.json')
Comment 5•11 years ago
|
||
Comment on attachment 689071 [details] [diff] [review] Add clobber mach command, v2 ># HG changeset patch ># Parent 137d80a07e64b82e2fbc95c9a0a7cc8690376bf4 ># User Gregory Szorc <gps@mozilla.com> >Bug 803400 - Add clobber mach command > >diff --git a/mach b/mach >--- a/mach >+++ b/mach >@@ -27,16 +27,17 @@ > 'python/blessings', > 'python/psutil', > 'python/which', > 'other-licenses/ply', > 'xpcom/idl-parser', > 'testing', > 'testing/xpcshell', > 'testing/mozbase/mozprocess', >+ 'testing/mozbase/mozfile', > 'testing/mozbase/mozinfo', > ] > > # Individual files providing mach commands. > MACH_MODULES = [ > 'layout/tools/reftest/mach_commands.py', > 'python/mozboot/mozboot/mach_commands.py', > 'python/mozbuild/mozbuild/config.py', >diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py >--- a/python/mozbuild/mozbuild/base.py >+++ b/python/mozbuild/mozbuild/base.py >@@ -8,16 +8,18 @@ > import os > import subprocess > import sys > import which > > from mach.mixin.logging import LoggingMixin > from mach.mixin.process import ProcessExecutionMixin > >+from mozfile.mozfile import rmtree >+ > from .config import BuildConfig > from .mozconfig import ( > MozconfigFindException, > MozconfigLoadException, > MozconfigLoader, > ) > > >@@ -77,16 +79,23 @@ > @property > def bindir(self): > return os.path.join(self.topobjdir, 'dist', 'bin') > > @property > def statedir(self): > return os.path.join(self.topobjdir, '.mozbuild') > >+ def remove_objdir(self): >+ """Remove the entire object directory.""" >+ >+ # We use mozfile because it is faster than shutil.rmtree(). >+ # mozfile doesn't like unicode arguments (bug 818783). >+ rmtree(self.topobjdir.encode('utf-8')) >+ > @property > def _config_guess(self): > if self._config_guess_output is None: > p = os.path.join(self.topsrcdir, 'build', 'autoconf', > 'config.guess') > args = self._normalize_command([p], True) > self._config_guess_output = subprocess.check_output(args, > cwd=self.topsrcdir).strip() >diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py >--- a/python/mozbuild/mozbuild/mach_commands.py >+++ b/python/mozbuild/mozbuild/mach_commands.py >@@ -56,16 +56,21 @@ > self.log(logging.WARNING, 'warning_summary', > {'count': len(warnings_collector.database)}, > '{count} compiler warnings present.') > > warnings_database.save_to_file(warnings_path) > > return status > >+ @Command('clobber', help='Clobber the tree (delete the object directory).') >+ def clobber(self): >+ self.remove_objdir() >+ return 0 >+ > > @CommandProvider > class Warnings(MachCommandBase): > """Provide commands for inspecting warnings.""" > > @property > def database_path(self): > return self._get_state_filename('warnings.json')
Updated•6 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•