There are several ways to obtain the sources from Wireshark’s Git repository.
|Check out from the master branch using Git.|
Using Git is much easier than synchronizing your source tree by hand using any of the snapshot methods mentioned below. Git merges changes into your personal source tree in a very comfortable and quick way. So you can update your source tree several times a day without much effort.
|Keep your sources up to date|
The following ways to retrieve the Wireshark sources are sorted in decreasing source timeliness. If you plan to commit changes you’ve made to the sources, it’s a good idea to keep your private source tree as current as possible.
The age mentioned in the following sections indicates the age of the most recent change in that set of the sources.
Recommended for development purposes.
Age: a few minutes.
You can use a Git client to download the source code from Wireshark’s code review system. Anyone can clone from the anonymous git URL:
If you create a Gerrit account you can clone from an authenticated URL:
SSH lets you use Gerrit on the command line. HTTP lets you access the repository in environments that block the Gerrit SSH port (29418). At the time of this writing (early 2014) we recommend that you use the SSH interface. However, this may change as more tools take advantage of Gerrit’s HTTP REST API.
The following example shows how to get up and running on the command line. See Section 4.12, “Git client” for information on installing and configuring graphical Git and Gerrit clients.
Install git-review. This is an installable package in many Linux distributions. You can also install it as a Python package. (This step isn’t strictly necessary but it makes working with Gerrit much easier.) To install it from Chocolatey run
# If you have not already, install Python 3 first and then *restart* the shell. PS$> choco install -y python3 PS$> choco install -y git-review -source python # Make sure that "git-review" is present in our path (edit the version as needed). PS$>$userpath = [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::User) PS$>$userpath += ";C:\Python37\Scripts" PS$>[Environment]::SetEnvironmentVariable("Path", $userpath, [EnvironmentVariableTarget]::User) PS$>RefreshEnv
Now on to the command line. First, make sure
$ git --version
If this is your first time using Git, make sure your username and email address are configured. This is particularly important if you plan on uploading changes.
$ git config --global user.name "Henry Perry" $ git config --global user.email firstname.lastname@example.org
Next, clone the Wireshark repository:
$ git clone ssh://email@example.com:29418/wireshark
The clone only has to be done once. This will copy all the sources (including directories) from the server to your machine and check out the latest version. This may take some time depending on the speed of your internet connection.
Then set up the git pre-commit hook and the push address:
$ cd wireshark $ cp tools/pre-commit .git/hooks/ $ git config --add remote.origin.push HEAD:refs/for/master
This will run a few basic checks on commit to make sure that the code does not contain trivial errors. It will also warn if it is out of sync with its master copy in the tools/ directory. The change in the push address is necessary: We have an asymmetric process for pulling and pushing because of gerrit.
$ git review -s
This prepares your local repository for use with Gerrit, including
commit-msg hook script.
Recommended for informational purposes only, as only individual files can be downloaded.
Age: a few minutes (same as anonymous Git access).
The entire source tree of the Git repository is available via a web interface at https://code.wireshark.org/review/gitweb?p=wireshark.git. You can view each revision of a particular file, as well as diffs between different revisions. You can also download individual files but not entire directories.
Recommended for development purposes, if direct Git access isn’t possible (e.g. because of a restrictive firewall).
Age: some number of minutes (a bit older than the Git access).
The Buildbot server will automatically start to generate a snapshot of Wireshark’s source tree after a source code change is committed. These snapshots can be found at https://www.wireshark.org/download/automated/src/.
If Git access isn’t possible, e.g. if the connection to the server isn’t possible because of a corporate firewall, the sources can be obtained by downloading the Buildbot snapshots. However, if you are going to maintain your sources in parallel to the "official" sources for some time, it’s recommended to use the anonymous (or authenticated) Git access if possible (believe it, it will save you a lot of time).
Recommended for building pristine packages.
Age: from days to weeks.
The official source releases can be found at https://www.wireshark.org/download.html. You should use these sources if you want to build Wireshark on your platform for with minimal or no changes, such Linux distribution packages.
The differences between the released sources and the sources in the Git repository will keep on growing until the next release is made. (At the release time, the released and latest Git repository versions are identical again :-).