Skip to content
Permalink
a683a4089e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Mozilla Worksheet

intro

  • In this worksheet you will either finish setting up your mozilla build environment in our virtual machine image, or start installing one on your own machine.

A quick note or two about installing your own

  • There are advantages, it will compile faster, the codebase will be easier to access, once you’ve downloaded it (this stage alone may take a while).
  • However, we cannot offer much help for you. You may get help from the community, that is, after all, what they do.
  • Here are some quick build guides
  • For Building on Linux
  • For Building on Windows
  • For Building on MacOS
  • If you use a Mac and choose to do this, DO NOT upgrade to the new version of MacOS when it comes out halfway through the module. Wait till it’s finished.

Virtual Machine stuff

  • Mozilla have their own virtual machine, but have proved to be so slow at updating it, to the point where it’s essentially useless. As a result we have produced our own instead.
  • The download link for this, and associated information will be available on the Moodle page. It already has the base code for Mozilla, so you will only need to retrieve the latest revisions.
  • This may take a while, but it will vastly easier than downloading the entire codebase, which can take many hours, and is prone to failure.
  • All the instructions for this are on the Mozilla portion of the Moodle page, so head over there to get those.

Mercurial Commands we will use

  • hg update
    • refresh your local codebase so it is the same as the current version on the remote repositories head branch. (used when first using the codebase on our virtual machine image)
  • hg strip tip –force
    • Remove local edits
  • hg pull -u
    • Pull down the latest source
  • hg tags
    • List all tags in a mercurial repository.
  • hg diff
    • Run from the repository folder. Compares the current state of the files with that on the last commit and shows any differences.
  • hg qnew [patchname]
    • Creates a patch (written to firefox/.hg/patches) that will allow any local changes to be applied to another clone of this codebase (or different branches of the same one).
  • ./mach mercurial-setup
    • Set up Mercurial to work with mach.
  • hg log -l 10
    • list the last 10 commits. To go back further, just specify a different number

Tasks

Set up Mercurial for Mozilla Patch Creation

  • Out of the box mercurial isn’t set up to work with the mozilla build system (mach).

– Some of this has already been done, but you will need to open the .hgrc file (this is a hidden file, you won’t see it until you open it with an editor, but it’s in your home folder.

  • In .hgrc, first edit the username entry so it matches the phabricator username you create. You’ll have to go online and do this first.
  • You won’t get a key to do passwordless commits, only long time contributors get those, so each time you do one, you’ll have to log in.
  • Then add
mq = 

to the [extensions] section

  • This should be your .hgrc file set up.

List all the tags

  • hg tags
  • Evidence this by piping the output to a text file, then include that in your submission for this worksheet.

compile the source code

  • This will take quite a while, so use the & again in case you have to log out before the build finishes.
  • NOTE If you are using the VM, as mentioned above and in lectures, you will need to update th source code before compiling by using the command hg update
./mach build &
  • Once it has built, you can launch it with this command:
./mach run
  • Screenshot the running program and include it in your submission.

edit a cpp file

  • Select any cpp file and make a change to it. This change can be trivial, it only needs to show up in a diff.

Create a patch

  • Diff the codebase, if there are changes shown, create a patch. This patch then goes in your submission for this worksheet.
  • You will need to get your evidence out of the virtual machine. Use git to achieve this.

restore the codebase

  • Use the command listed above in the commands section that will remove any local edits so you can begin your proper bug fixing work.

inspecting the commit history

  • List the last ten commits

Worksheet evidence.

  • Put the tags listing, the list of the last ten commits and your Patch, in a single document.