The source code is hosted on github under VyOS organization: github.com/vyos.
Source code structure
The source code is split into git submodules. Submodules is a mechanism for keeping subprojects in separate git repos while being able to access them from the main project.
VyOS is composed of multiple individual packages, some of them are periodically synced with upstream, so keeping the whole source under a single repository would be very inconvenient and slow.
Technically it looks like this:
build-iso/ .git/ .gitmodules pkgs/ pkg-foo/ .git/ pkg-bar/ .git/
.gitmodules it the file that hold the submodule list. Normally you don't need to edit it manually.
When you clone the build-iso.git, pkgs/ subdirectories are empty. Their contents are stored in separate remote repositories.
You can read mode about submodules in the git book or "man git-submodule".
As every submodule represents a debian package,the terms "submodule" and "package" are used here interchangeably.
Cloning the source code
According to the above, you should clone the main repo (build-iso.git) first. It contains the ISO build scripts and serves as a container for submodules.
git clone https://github.com/vyos/build-iso.git
If you want to modify a package, you need to init and update its submodule. Say you want to modify vyatta-cfg-system.
git submodule update --init pkgs/vyatta-cfg-system
After that you will have vyatta-cfg-system source code under pkgs/vyatta-cfg-system directory.
Each new VyOS release gets its own branch. Consult the version history to find out which one is the current.
You can then add the branch to your local copy (e.g. for "hydrogen" branch):
git branch hydrogen --track origin/hydrogen git checkout hydrogen
You need to do it in both build-iso repository and submodules you are going to modify.
Building a submodule
Before you start building submodules, install the following packages:
apt-get install devscripts # Provides debuild
Once you are ready to test the modifications you made to the package, you can build it from the top level directory as easy as:
jrhacker@dev-machine: ~/build-iso$ make vyatta-cfg-system
If the build completes successfully, the .deb will appear under pkgs/
Pushing the changes to remote
If you do not (yet) have permissions to commit directly to the VyOS upstream, and you are planning to keep your code on github and use pull requests to exchange patches, the best procedure is probably the following:
- Clone the build-iso.git from the upstream.
- Init the submodule.
- Fork the package you are going to modify to your github account.
- Replace the path to remote in submodule .git/config