= Handling git repositories
== Introduction
This document is for developers who want to publish a git repository on the
Frugalware FTP Server and on the Frugalware Gitweb Interface.
== Name of the repository
The name of the official repositories are `frugalware-current`,
`frugalware-stable` and so on.
The name of WIP repositories are typically in a `featureNUM` form, like
`kde45` or `parted2`, referring to the name of the software it contains
and its version. This method is used so that the repository name can be
a valid shell variable as well.
Please note that there is a convention that WIP repository names never
contain a hyphen (`-`). This is on purpose. It's not trivial to decide
that when you merge code from one repository to another then build
servers should try to build automatically the new packages you brought
in or not. Because of this the policy is that if a hyphen is in the
name, the it'll build the new packages (WIP -> -current merge), but it
won't do so when you merge the other way around.
== Location of the repository
Since a repository consists of plain files, we can and should place them on the
ftp server (/home/ftp). To prevent further problems, always use the server name
"git.frugalware.org", currently it's an alias of genesis.frugalware.org.
First decide if it's a personal repository or a team one. For example if you
create a repository to update to a newer python version, then you will
probably do all the work, create it under `/pub/other/people/nick/reponame`.
Simply create a dir, issue `git init` and push at least one commit to
there (but before pushing, enable the hooks, see below).
Now anyone can `git clone` it, using a 'full mirror', for example
`ftp://ftp12.frugalware.org/mirrors/ftp.frugalware.org/pub/`.
== Registering for the gitweb interface
If the repository is a team one, then create it under /pub/other. In this case
you probably want the gitweb interface, too. To use it:
. Update the file `.git/description` inside the repo with a short (less than 80
chars) description.
. Create the file `.git/owner` inside the repo containing your name, _without_
your email address.
. Push a _relative_ symlink to the `homepage-ng` repository, see the existing
ones as a reference.
After some time (a maximum of 30 minutes) it should appear at
`http://git.frugalware.org/`.
== Enabling hooks for your repository
Currently you need hooks for the following reasons:
. If you don't use 'bare' repositories, then the content outside `.git` won't
be updated automatically, you need a hook to do so.
. If you want CIA notification.
. If you want to send mails to the `Frugalware-git` mailing list.
. If you want to let others clone your repository via 'dumb' protocols like
`http` or `rsync`. (This means that if you disable this hook, it won't be
accessible anonymously!)
For the last one:
----
mv .git/hooks/post-update{.sample,}
echo "unset GIT_DIR; cd ..; git checkout -f" > .git/hooks/post-receive
chmod +x .git/hooks/post-receive
----
For the others:
----
ln -sf /home/ftp/pub/other/git-hooks/git-hooks.py .git/hooks/post-receive
----
One thing that a hook won't do for you is to allow pushing to the master branch, even if it's the checked out one. This is normally not good, but our hook will handle this, so we can ignore the problem:
----
git config receive.denyCurrentBranch ignore
----
== Setting up server configuration for a WIP repo
When you run repoman, it invokes `repoman server` on the remote machine
using ssh. `repoman server`, just like plain repoman, reads configuration
from `/etc/repoman.conf` and `$HOME/.repoman.conf`, so you need to set
up the later before you can push packages to your WIP repo.
Here is a minimal example:
----
fst_root=/home/nick/git
repos=('current' 'mywiprepo')
----
And then you have to symlink the repos to `$HOME/git`, for example:
----
cd $HOME/git
ln -s /pub/frugalware/frugalware-current current
ln -s /pub/other/people/nick/nicktesting/ nicktesting
----
== Enabling syncpkgd support for a WIP repo
If you create a new WIP repo, syncpkgd won't sync packages in it by default.
This means that if you just push your commits, no attempt will be made
to build the relevant binary package automatically for you, which is the
case for the -current / -stable repos.
If you want syncpkgd support, then you need to edit 3 configuration
files on the server which runs `syncpkgd` (that's typically not your
local machine and not the one that runs `syncpkgcd`).
Edit syncpkgd's repoman config by extending the repos array and adding
the foo_servers, foo_sudo and foo_bases variables:
----
vi ~syncpkgd/.repoman.conf
----
Add a pacman-g2 configuration file:
----
vi ~syncpkgd/.pacman-g2/repos/foo
----
The contents will be something like this:
----
[foo]
Server = http://ftp.frugalware.org/pub/other/people/nick/foo/frugalware-@CARCH@
----
NOTE: Don't replace `@CARCH@` with anything else, syncpkgcd will do so later!
Finally edit the git hook and add foo to the end of the repos array:
----
vi /pub/other/git-hooks/synchook/config.py
----
If you no longer need these entries, you can remove them, but leave at
least one there as an example.