Setup Simple

Setting up an LHCb package

  • Prepare a package and check out a portion of it.

Prerequisites for building LHCb software

You should have a valid LHCb environment, using one of the ways previously mentioned, or by working on lxplus. You may need to run source /cvmfs/lhcb.cern.ch/group_login.sh to set up your environment variables.

Git

LHCb uses the git versioning system.

Prerequisites for git

Before using git, you should go to your gitlab.cern.ch account and set up an ssh key. The procedure is the same as with github (and the public key is the same). In short, on Linux or Mac, make sure you have key pair in ~/.ssh/id_rsa.pub and ~/.ssh/id_rsa. If you don't have one, run

local:~ $ ssh-keygen

and use the default location. If you don't put in a passphrase, you can directly push and pull without a password; if you do put a passphrase, you can run

local:~ $ test -z "$SSH_AGENT_PID" && eval $(ssh-agent)
local:~ $ ssh-add

when you start a terminal to enter your passphrase once per session. Your computer keychain (Mac, Ubuntu, etc) can also store your password once per login.

If you encounter problemsClick to expand

Defaults

You can set the lb-commands to default to ssh by running the following line to save a global (all repository) config variable:

local:~ $ git config --global lb-use.protocol ssh

You can also set the git default push policy for git if you have a version between 1.7.11 and 2.0:

local:~ $ git config --global push.default simple

This is not mandatory, but is a more reasonable default (and is the default in git 2.0. Note that SLC6 systems, like lxplus, have a version less than 1.7.11. On these systems, you can still set the default to current, which is better than the original default of matching.

Aside: Explanation of defaults for the curiousClick to expand

Coming from SVN?Click to expand

LHCb simplifications

While vanilla git commands are covered in the alternate lesson, this lesson uses special LHCb commands added to git. These are special programs that sit in the LHCb bin, and have names that start with git-. Git automatically converts a command like git x to git-x, so these seamlessly blend with the built in commands. To differentiate them, they all start with lb-.

Setting up a satellite project

If you want to setup a satellite project (local project) for small changes, you'll need to prepare that project:

local:~ $ lb-dev Project vXrY
local:~ $ cd ProjectDev_vXrY

For example, the project might be DaVinci, and the version might be v40r3p1. Then, you'll been to tell git where it can checkout subprojects from:

local:ProjectDev_vXrY $ git lb-use Project

This sets up a remote that points to the LHCb repository Project on GitLab.

To get the code from Project/Branch to checkout into Some/Package:

local:ProjectDev_vXrY $ git lb-checkout Project/Branch Some/Package

The branch can be master, or a specific version vXrY, or any other valid branch. See the GitLab page to browse projects and branches.

Future reading

The twiki page Git4LHCb is currently the best source for git examples.

results matching ""

    No results matching ""