Submit a patch

From VyOS Wiki
Jump to: navigation, search

Patches are always welcome.

You should follow some procedures and guidelines though.

Before you make a patch

In a big system, such as VyOS, that is comprised of multiple components, it's impossible to keep track of all the changes and bugs/feature requests in one's head. We use a bugtracker for it ("issue tracker" would be a better term, but this one stuck).

This information is used in two ways:

  • Keep track of the progress (what we've already done in this branch and what we still need to do).
  • Prepare release notes.

To make this approach work, every change must be associated with a bug number.

If there is no bug/enhancement request for the changes you are going to make, you must create a bugtracker entry first.

Once there is a bugtracker entry about it, you should reference in your commit message, as in:

Bug #42: Fix foo handling in bar.

Bug #9000: add support for baz in quux.


How to make a patch

We only accept patches in git format, because traditional UNIX patch is only good if the code it's going to be applied to doesn't change. If the code changes, merge will fail and the patch will need manual editing, even if there are no real conflicting changes.

Git keeps more information and uses more sophisticated merge algorithms, which makes a fake conflict a rare occurence. For the same reason you should always make a patch against the latest development branch.

You can either make a pull request on Github or email us a patch (maintainers@vyos.net).

Find the submodule

Our debian packages have the same names as submodules they are built from. Suppose you want to make a change in the webproxy script.

You can find its package with "dpkg -S":

# dpkg -S /opt/vyatta/sbin/vyatta-update-webproxy.pl 
vyatta-webproxy: /opt/vyatta/sbin/vyatta-update-webproxy.pl

This means it's in vyatta-webproxy submodule, that is, [1].

Clone the submodule

There are two options.

Clone directly:

git clone https://github.com/vyos/vyatta-webproxy.git

Clone as a submodule:

An easier way is to clone the build-iso repository first and do the rest from there:

git clone https://github.com/vyos/build-iso.git
cd build-iso/

# Ensure you are on the correct branch, suppose you want "helium"/1.1.0:
git checkout helium

# Clone the submodule:
git submodule update --init pkgs/vyatta-webproxy

# Go to the submodule and switch to the correct branch to:
cd pkgs/vyatta-webproxy
git checkout helium

Making a patch

Set your name and email in the git config:

git config user.name "J. Random Hacker"
git config user.email "jrhacker@example.net"

Make your changes and save them. Then do the following for all changes files:

git add myfile

# Or, for a whole dir:
git add somedir/*

Commit the changes:

git commit

Please use meaningful commit descriptions and don't forget to reference the bug number there!

Now submit the patch. If you forked the repo on github, push and make a pull request.

If not, you can export the patch and send it to maintainers@vyos.net or attach to the bug.

git format-patch

# Or, for multiple commits, suppose you made two:
git format-patch -2