mozilla_tools is a set of programs designed to make typical Mozilla development tasks easier.  Things like patch management, surgically rebuild, and manipulate cvs.  Every program in the .tgz supports the --help parameter and will give you help if you do not use it correctly.  The are all designed to work out of the box: if you have sufficient tools to build Mozilla now, you can run mozilla_tools.

4/30/2003 - 1.1 - made installation easier, updated to track changes in the build system, got roaming scripts working better
2/1/2003 - 1.0 - all the tools I need, I don't know about you


1. Download
2. Untar to a location of your choice.
3. Ensure that location is in your PATH and PERLLIB.


Here are docs on the most useful programs: - Surgically Rebuild Mozilla <directories or files> - takes the list of files or directories specified and does "make" in those directories, as well as determining where it needs to "make" in order to link those directories so that Mozilla is immediately runnable after you make your change. - Manage, Import, and Commit Patches In Your Tree <action> <fixname> - is a suite of tools to help you keep track of what patches you have in your tree and perform operations on them such as committing, temporarily (or permanently) removing them from the tree, rebuilding them. It allows you to import patches from the web or Bugzilla, as well, if you have the wget program (comes with cygwin and most Linux installs).  I typically name fixes the same as the bug # so that I can reference them later.  The script remembers what is in the tree by storing patches in a special directory under mozilla/ called "fixes/".

These utilities are designed to be safe.  They ensure several things to make sure nothing goes wrong: (a) atomicity: if a patch does not apply, no part of the patch will be applied; (b) no conflicts: the utility will never allow two patches to affect the same file, and will furthermore check cvs and not apply if you have personally modified the file.  This makes it safe to apply someone else's patch pretty much blindly (with a lot fewer worries).  With this utility I have been able to easily keep track of 11 or 12 patches at the same time.

Additionally, like all other utilities here, this utility is able to automatically perform cvs adds and cvs removes so you never miss anything in your cvs diffs or commits.

"fixname," which you will see throughout this, is a name you give to identify a patch so you can do things with it.

Certain common development routines become pretty simple with

Try out a patch

1. import somefix
2. build somefix
3. dist/bin/mozilla
4. remove somefix
5. build somefix
You are now back to the state you were at at the beginning.

Develop your own patch

1. Modify the files
2. define myfix <files>
3. build myfix
4. Modify files more
5. update myfix
6. Upload mozilla/fixes/myfix.patch to Bugzilla
7. commit --message="Commit message" myfix

Quickly move a fix out of the way so you can do something else

1. update myfix
2. remove myfix
3. Do your thing
4. resurrect myfix (when you are done)

Here is a list of the more useful commands. 

Defining and Naming Fixes import fixname <patchfile|url>
Import a fix from a patchfile, either locally or from a remote server (this is how I try out Bugzilla attachments--just supply the attachment URL).  This will apply the patch and remember that it is applied.  It also figures out where in the tree the patch was made so it can just apply it without bothering you. define fixname <directories or files>
Define a fix based on files already in your tree.   Files that are not changed will not be included in the fix, so that you can specify directories and it will automatically include just your changes. forget fixname
Forget that the fix existed but don't touch the tree rename fixname newfixname
Rename a fix
Viewing Fixes list
List the fixes in the tree list_saved
List saved fixes (patches that were removed with remove) showfiles [fixname]
List all the files in the tree that are affected by a fix (leave off the fix to show all files affected by all fixes) whichfix [files]
Show which fix a particular file is in findnew [directories | files]
Find other files in your tree that you have modified but are not in any defined fix showdiff fixname
Show the stored patch for a fix diff fixname
Show the difference between the patch and what you have in your tree.  Really useful when you make changes to a patch and want to know what you did so you can make bug comments.
Manipulating Fixes update fixname [new files]
Update the patch for a fix, adding any new files specified in [new files] build fixname Surgically rebuild all the files in a fix with so that you can run Mozilla with the fix. commit --message="..." fixname Commit the fix to the Mozilla tree.  This checks to ensure that the fix is up to date and ensures that all necessary files have been cvs added and cvs removed; and even cooler, it checks the tree for you before checking in.  Use --ignoretree if the tree is red or closed and you have permission to check in. remove fixname
Remove a fix from your tree but save the patch resurrect fixname
Bring back a fix you removed earlier - Revert Files To CVS <directories or files> - removes changes you have made to a set of directories or files.  This utility is especially useful because it does not do a "cvs update" and therefore potentially make your tree out of synch.

Roaming Scripts [--dir=... | --ssh_loc=... --ssh_dir=...] profilename
Uploads pertinent parts of your profile to a remote server (or directory).  Currently only does bookmarks. [--dir=... | --ssh_loc=... --ssh_dir=...] profilename
Brings down pertinent parts of your profile to a remote server (or directory).  Currently only does bookmarks.

Other Programs
This will go back to the server, grab the .tgz and install it in the location where the script resides. <files>
Convert \r\n to \n in a set of files.
Generate a UUID and print it in two forms (one for .idls and one for .h). <patch>
Fixes up a patch to fit the mozilla/ root and atomically applies it to the tree (if the apply fails, no part of the patch is applied).  You must be in the mozilla/ dir for this to work. --message="..." <patch>
Performs same function as " commit" <file>, <text>
Search lxr for a file or text, output in convenient text format <dir>
Show what files were modified in a directory <patch>
Remake a patch with the same files (and any new ones) against the current tree <patch1> <patch2>
diff two patches to see what changed between them (this is sophisticated cvs stuff) [-a|-w]
switch cvs root to anonymous or writable (this switches the root in all directories at and under the current directory).

Copyleft 2003 John Keiser (