Contents
Migration of Mageia (and Mandriva) Subversion Repositories to git
Note this does NOT include migrating packages VCS to git (although this is in the works too - and it is fortunately much more scriptable).
Work is already well under way. Several trees from subversion have been converted already and are linked below. If you are coming here after being referred to it when trying to commit to subversion, then there are a few tips below.
Using Git
Git is similar to Subversion in several ways but is much more powerful and has much more advanced workflows for easier offline work. There are lots of guides out there for using git, so there is little point in listing generic instructions here, but here are some recommendations.
- Use your @mageia.org email address if you can. This is not mandatory, but it's nice to keep the profile of Mageia represented in the commits. We would also encourage using your @mageia.org address for upstream contributions too.
- Add the following lines to your ~/.gitconfig file to allow easy cloning/pushing via commands similar to "git clone mga:software/rpm/urpmi" (i.e. missing out the long part of the URLs:
[url "git://git.mageia.org/"] insteadof = mga: [url "ssh://git@git.mageia.org/"] pushInsteadof = mga:
Process of Migration
- Mandriva "soft" SVN repositories converted to git via git-svn with proper author name translation.
- A script to import Mageia SVN repositories has been written. This script:
- Takes the initial Mandriva git-svn git repository and resets it to our branch point.
- Takes the Mageia SVN repository and synthesises a commit to bring the two trees into line.
- Hacks git-svn metadata
- Convinces git-svn to continue and import Mageia SVN up to the present day with proper author name translation.
- Converts tags to proper annotated tags
- Writes out SQL to keep track of SVN Revision -> git SHA1 for each software for future use.
Git Authentication
Authentication is handled by gitolite to allow for fine grained permissions. This work was done by Nicolas Vigier (boklm).
Push access to each git repo is ultimately determined through LDAP group memberships. The mgagit tool queries the LDAP server (with the command mgagit glrun) and writes group members into files in /var/lib/git/.gitolite/conf/ in gitolite format, alongside ACLs for each repository. Repo write access is defined by the top-level repo hieararchy (artwork/, qa/, software/, etc.) and is created from templates specified in https://gitweb.mageia.org/infrastructure/puppet/tree/deployment/mgagit/manifests/init.pp Usually, this consists of the members of the LDAP group %mga-X where X is that top-level hiearchy (%mga-artwork, %mga-qa, etc.), and the individual git repo owner. That owner is specified in a file in one of the meta-repos in infrastructure/repositories/ which defines all the git repos that exist.
Since gitolite does not access LDAP directly but uses the cached group membership information written by mgagit, they can become out of date. Whenever any commit is pushed to any infrastructure/repositories/ repo, a git hook automatically regenerates the LDAP group membership files for gitolite. These repos are updated very infrequently, so if you expect to have push access to a repository but don't, and you are in the correct LDAP group, ask a sysadmin to regenerate the gitolite files.
Git Layout
The subversion layout is a bit "shove it in soft" at the moment. Some thought and care will be put in to make sure the git layout is sensible.
Generally speaking we'll split repos out into main top-level areas. Currently "Software" and "Web" but others will be added in due course. For each top level, there is a Git repository that actually defines the git repositories within them. Cloning this repository and adding an appropriate *.repo file will create that git repository automatically on push.