User Tools

Site Tools


wiki:development:development-workspace

How to set up an X2Go Development Workspace

Get the Code

Before you can start developing you need the source code. The code is managed in a GIT repository.

Building

Debian/Ubuntu

On Ubuntu you'll probably need the following dependencies to get a proper build:

  sudo apt-get install devscripts debhelper ubuntu-dev-tools build-essential

More info in general form: https://wiki.ubuntu.com/PackagingGuide/HandsOn

Getting Build Dependencies

Each Git has a file debian/control. It has a section Build-Depends.

The package ubuntu-dev-tools (also provided in Debian) allows to install them running sudo get-build-deps debian/control.

Makefile

Most projects should have a Makefile, that builds the project by running make (This is work in progress).

DPKG

An installable package can be built running debuild -b -us -uc in the project folder. The .deb-file will be placed in the superior folder. The package can be installed using dpkg -i <packagenmame>*.deb.

Development Strategies

There are a few different approaches for working on X2Go code (or Git-hosted code in general). This wiki page will address two of them: HEAD development and local branch development.

HEAD X2Go Development

With the term HEAD one refers to the topmost recent code in a code repository. The Git branch that HEAD development gets committed to is the master branch of each X2Go Git project.

If you are a core X2Go developer and the code you are working on is something that is intended to become a core component of X2Go then you are likely to directly work on HEAD.

Also bug fixes should be committed to the master branch directly.

Development on Local Git Branches

However, if you work on a piece of code or a feature, that may or may not become a part of X2Go or a piece of code that will break a couple of things when committed to the master branch then you should rather start a local branch to work on that.

If you want to branch of from HEAD, use this command:

$ git checkout -b <my-local-branch-name>

If you want to branch of from some old release/refspec then use these commands:

$ git checkout <blessed-refspec-or-tag>
$ git checkout -b <my-local-branch-name>

You then continue your work on the <my-local-branch-name> branch and commit your changes there.

You may also upload your local branch to the X2Go Git site. Please discuss this first on the x2go-dev mailing list.

$ git push <my-local-branch-name>

To incorporate changes from your <my-local-branch-name> you may use e.g. the git-cherry-pick command or the git-checkout command.

Note: The only thing we do not accept on X2Go Git are Git merges.

Coding Strategies

There are some recommendations that we give when coding X2Go and committing in X2Go Git:

  • run git-pull before starting to work on new code snippets (to avoid nasty merge problems)
  • code in little portions
  • commit in little portions
  • important commits always have a representative line in the project's changelog (currently: /debian/changelog, this may change)
  • do not combine code of two different features/bugfixes/etc. in the same commit

Committing Changes to Git Locally

Before you change something:

$ git pull

After you have performed some changes on an X2Go Git project, please use the git-commit command to commit your changes to your local Git:

# commit everything
$ git commit -a
# commit specific files
$ git commit <file-1> <file-2> <file-etc>

You will be presented an editor to add a commit message. If you want to give the commit message on the command line use the -m option:

# commit specific files
$ git commit <file-1> <file-2> <file-etc> -m "Fix something in file 1, 2 and etc."

In case you have lost track of files that have changed since the last commit, you can use the git-status command:

$ git status

New files and folders can be added with git-add:

$ git add <file-3> <folder-2>
$ git commit <file-3> <folder-2> -m "This message should explain why you have added file 3 and folder 2..."
Most important: DO NOT commit any dynamic/temporary files into Git. Any file that has the characteristic of being somehow temporary or part of the package build process or whatever should stay out of Git!!! The same applies for files that result from compilation runs etc.

Use .gitignore files in respective folders to exclude systematically unwanted non-Git files (by RegExp) whereever necessary!!!

Maintaining Changelogs

Currently we use Debian tools to maintain each project's changelog file. Debian tools are optimal for developing Debian packages. For an upstream project like X2Go we have to find something that's more generic.

However, as this is in process and till it has settled, please continue as described below when maintaining the X2Go projects' changelog files.

  1. code your code
  2. before you commit, run dch
  3. explain what you have changed about the code
  4. save your changes
  5. run the debcommit command instead of git-commit, it accepts a similar set of options.

For more information on the used Debian tools refer to the dch and the debcommit man pages.

Maintainer Stuff

Install Software

For working with X2Go Git you have to install some software on your development workstation. We will presume you develop under Debian:

$ aptitude install git devscripts

Setup devscripts Configuration

We currently use Debian based tools to maintain the projects' changelogs. This may change in the future (in order to become even more generic and Debian-independent), but for now, developers should add these lines to ~/.devscripts:

DEBCHANGE_RELEASE_HEURISTIC=changelog
DEBCHANGE_MULTIMAINT_MERGE=yes
DEBCHANGE_MAINTTRAILER=yes

and these lines to ~/.bashrc:

export DEBFULLNAME="<Firstname Lastname>"
export EMAIL="<my.mailaccount@mydomain.com>"
export DEBEMAIL=${EMAIL}

Releasing X2Go Projects

The X2Go version scheme is a four digit version number: <major>.<minor>.<micro>.<nano>

For releasing X2Go components make sure that you have a GPG key for your commit mail address available and installed on your local system. The commit mail address can normally be found in ~/.gitconfig (see above).

If you decide for releasing an X2Go component, please perform the following steps:

  1. Change any string location in the project that reflects the version number: changelog, VERSION.<x2go-project> file, maybe there is a version number somewhere in the code (Python: init.py files)
  2. Change the UNRELEASED tag in the /debian/changelog header to unstable, this can be done by using dch -r.
  3. Commit and push the versioning updates
  4. Tag (and GPG-sign) the pushed code with
    $ cd ~/MyCode/x2go-upstream/<x2go-project>.git
    $ git tag -s <a.b.c.d> -m "Upstream version <a.b.c.d>
    $ git push --tags
  5. Use the x2go-updatebuildmain script from the X2Go buildscripts to update the build-main branch of the project
    $ x2go-updatebuildmain HEAD
  6. Run x2go-tarballrelease in the base folder of the X2Go Git project to be released:
    $ x2go-tarballrelease <a.b.c.d> [<blessed-refspec-or-tag>]

    The tarball will then be moved to this location: ../_releases_/source/<project>/.

  7. Sync the new tarball to code.x2go.org, a recommended tool for keeping a local _releases_ folder in sync with the releases folder on code.x2go.org is unison/unison-gtk.
  8. Send an e-Mail to the Git Administrator to extra-inform him about a new component release.
  9. Maybe even kick-off a Lauchpad package build for Ubuntu (if impatient or if you intend to change more on master's HEAD before the next package build).
  10. Before you continue working on the code you should make sure that the newly released code has been built on Launchpad and also moved to the x2go-stable PPA.

Git / Code Administration

For Git / code administation you have to be able to logon to the host code.x2go.org as user x2go-admin:

ssh -lx2go-admin -p32032 code.x2go.org

As x2go-admin you can:

  • create new X2Go Git projects
  • edit Git configs
  • edit Git descriptions
  • edit Git ACLs (currently not in use)
  • upload released tarballs and binaries (Win32, MacOS X)
  • build packages (not recommended on code.x2go.org, as no KVM support is available on that machine)
  • upload Debian packages to http://packages.x2go.org/debian

Using X2Go Build Scripts

The X2Go project uses a hand full of build scripts that are also hosted in X2Go Git:

$ mkdir -p ~/MyCode/x2go-upstream
$ cd ~/MyCode/x2go-upstream
$ git clone ssh://x2go@code.x2go.org:32032/srv/git/code.x2go.org/buildscripts.git

The buildscripts.git Git project contains a /bin folder in which you find a series of helper scripts. Symlink all of these script files to your personal ~/bin directory:

$ mkdir -p ~/bin
$ cd ~/bin
$ ln -s ~/MyCode/x2go-upstream/buildscripts/bin/* .

And make sure it is included in your user's PATH variable:

echo $PATH

If you cannot find a hint that ~/bin is included in the PATH variable, add it to it:

echo 'PATH=~/bin:$PATH' >> ~/.bashrc

After extending the PATH variable log off an on to make sure it takes effect (or use your own style of letting it take effect).

Upload Released Tarballs

The equivalent of http://code.x2go.org/releases can be accessed on code.x2go.org like this:

$ cd /srv/sites/x2go.org/code/releases

Build X2Go Packages for Debian

On japsand.x2go.org there is a qemubuilder build environment installed.

Upload X2Go Packages to X2Go's Debian Repository

As x2go-admin you have upload rights for the X2Go Debian repository. Use Debian's dupload tool for this (for further info refer to man dupload and man dupload.conf). Please add the following lines to your ~/.dupload configuration file:

### X2Go/DEBIAN
$cfg{"x2go-debian-sid"} = {
        fqdn => "code.x2go.org",
        login => "x2go-admin",
        method => "scpb",
        incoming => "/srv/sites/x2go.org/packages/debian/incoming/sid",
        qeueudir => "/srv/sites/x2go.org/packages/debian/upload/sid",
        dinstall_runs => 1,
};
$cfg{"x2go-debian-wheezy"} = {
        fqdn => "code.x2go.org",
        login => "x2go-admin",
        method => "scpb",
        incoming => "/srv/sites/x2go.org/packages/debian/incoming/wheezy",
        qeueudir => "/srv/sites/x2go.org/packages/debian/upload/wheezy",
        dinstall_runs => 1,
};
$cfg{"x2go-debian-squeeze"} = {
        fqdn => "code.x2go.org",
        login => "x2go-admin",
        method => "scpb",
        incoming => "/srv/sites/x2go.org/packages/debian/incoming/squeeze",
        qeueudir => "/srv/sites/x2go.org/packages/debian/upload/squeeze",
        dinstall_runs => 1,
};
$cfg{"x2go-debian-lenny"} = {
        fqdn => "code.x2go.org",
        login => "x2go-admin",
        method => "scpb",
        incoming => "/srv/sites/x2go.org/packages/debian/incoming/lenny",
        qeueudir => "/srv/sites/x2go.org/packages/debian/upload/lenny",
        dinstall_runs => 1,
};

As ~/.dupload is a Perl include file, make sure that the file's last line looks like this:

1;
wiki/development/development-workspace.txt · Last modified: 2013/03/14 23:40 by sunweaver