From Fedora Project Wiki

(→‎SVN Repository: Add a better find command, and use . and a `cd` instead of specifying the directory for every command.)
(Replaced content with "{{header|infra}} This SOP has moved to the fedora Infrastructure SOP git repo. Please see the current document at: http://infrastructure.fedoraproject.org/infra/docs/fedorah...")
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{header|infra}}
{{header|infra}}


Fedora hosted has public repositories for git, bazaar, mercurial, and subversion. These are instructions for adding a new project to one of them.
This SOP has moved to the fedora Infrastructure SOP git repo. Please see the current document at: http://infrastructure.fedoraproject.org/infra/docs/fedorahosted-repo-setup.txt


{{admon/note|Monotone support has been discontinued due to both lack of a sysadmin to maintain it and lack of projects wanting to use it.}}
For changes, questions or comments, please contact anyone in the Fedora Infrastructure team.
 
== Mercurial Repository ==
You'll need to know three things in order to start the mercurial repository.
# PROJECTNAME -- what the project wants to be called.
# OLDURL -- how to access the project's current sourcecode in their mercurial repository.
# PROJECTGROUP -- the group setup in the account system for readwrite access to the repository.
 
The Mercurial repository lives on the hosted server.  Access it by logging into hosted1  Then follow these steps:
 
<pre>
$ cd /hg
$ sudo hg clone -U $OLDURL $PROJECTNAME (or sudo mkdir $PROJECTNAME; cd $PROJECTNAME; sudo hg init)
$ sudo find $PROJECTNAME -type d -exec chmod g+s \{\} \;
$ sudo chmod -R g+w $PROJECTNAME
$ sudo chown -R root:$PROJECTGROUP $PROJECTNAME
</pre>
 
This should setup all the files needed for the repository.
 
=== Commit Mail ===
 
The Mercurial [http://www.selenic.com/mercurial/wiki/index.cgi/NotifyExtension Notify extension]  can be used to send out email when commits are pushed to a Mecurial repository.  To enable notifications, create the file ''/hg/$PROJECTNAME/.hg/hgrc'':
 
<pre>
[extensions]
hgext.notify =
 
[hooks]
changegroup.notify = python:hgext.notify.hook
 
[email]
from = admin@fedoraproject.org
 
[smtp]
host = localhost
 
[web]
baseurl = http://hg.fedorahosted.org/hg
 
[notify]
sources = serve push pull bundle
test = False
config = /hg/$PROJECTNAME/.hg/subscriptions
maxdiff = -1
</pre>
 
And the file ''/hg/$PROJECTNAME/.hg/subscriptions'':
<pre>
[usersubs]
 
user@host = *
 
[reposubs]
</pre>
 
== Git Repository ==
You'll need to know several things in order to start the git repository.
# PROJECTNAME -- what the project wants to be called.
# OLDURL -- how to access the project's current source code in their git repository.
# PROJECTGROUP -- the group setup in the account system for write access to the repository.
# COMMITLIST -- comma-separated list of email addresses for commits (optional)
# DESCRIPTION -- description of the project (optional)
# PROJECTOWNER -- the FAS username of the project owner
 
The git repository lives on the hosted server.  Access it by logging into hosted1 Then follow these steps:
 
<pre>
$ cd /git
 
$ # Clone an existing repository:
$ sudo git clone --bare $OLDURL $PROJECTNAME.git
$ cd $PROJECTNAME.git
$ sudo git config core.sharedRepository true
$ #
$ ## or
$ #
$ # Create a new repository:
$ sudo mkdir $PROJECTNAME.git
$ cd $PROJECTNAME.git
$ sudo git --bare init --shared=true
 
$ # Give the repository a nice description for gitweb
$ echo $DESCRIPTION | sudo tee description > /dev/null
 
$ # Setup and run post-update hook.
$ # (We symlink this because /git is on a filesystem with noexec set)
$ sudo ln -svf $(git --exec-path)/git-update-server-info ./hooks/post-update
$ sudo git update-server-info
 
$ # Ensure ownership and modes are correct
$ sudo find -type d -exec chmod g+s \{\} \;
$ sudo find -perm /u+w -a ! -perm /g+w -exec chmod g+w \{\} \;
$ sudo chown -R $PROJECTOWNER:$PROJECTGROUP .
</pre>
 
This should setup all the files needed for the repository.  The repository owner can push changes into the repo by running:
<pre>
$ git push ssh://git.fedorahosted.org/git/$PROJECTNAME.git/ master
</pre>
from within their local git repository.
 
=== Commit Mail ===
If they want commit mail, then there are a couple of additional steps.
<pre>
$ echo $COMMITLIST | sudo tee ./commit-list > /dev/null
$ sudo ln -svf /usr/bin/fedora-git-commit-mail-hook ./hooks/update
</pre>
 
=== CIAbot Notifications ===
The CIA bots can be used to send git commit messages to IRC channels.  See http://cia.vc/ for information.
 
To have IRC messages sent whenever you publish new commits to your git repository, you can add a git update hook.
 
In your home directory on fedorahosted, create two files: a copy of [http://cia.vc/clients/git/ciabot.pl ciabot.pl] modified with your own project name and email address; and an 'update' file, modified to include the path to your copy of the ciabot.pl script.
 
<pre>
$ cd
$ mkdir $PROJECTNAME-hooks
$ cat - > $PROJECTNAME-hooks/update << EOF
refname=${1#refs/heads/}
[ "$refname" = "master" ] && refname=
oldhead=$2
newhead=$3
for merged in $(git-rev-list $newhead ^$oldhead | tac); do
    /home/fedora/$PROJECTOWNER/$PROJECTNAME-hooks/ciabot.pl $merged $refname
done
EOF
$ chmod a+x $PROJECTNAME-hooks/update
$ cd /git/$PROJECTNAME.git/hooks
$ mv update update.orig
$ ln -s /home/fedora/$PROJECTOWNER/$PROJECTNAME-hooks/update
</pre>
 
These must be in your home directory, as the git repositories themselves are mounted using 'noexec'.
 
== Bazaar Repository ==
You'll need to know three things in order to start a bazaar repository.
# PROJECTNAME -- what the project wants to be called.
# OLDBRANCHURL -- how to access the project's current sourcecode in their previous bazaar repository.  Note that a project may have multiple branches that they want to import.  Each branch will have a separate URL.  (The project can import the new branches after the repository is created if they want.)
# PROJECTGROUP -- the group setup in the account system for readwrite access to the repository.
 
The bzr repository lives on the hosted server.  Access it by logging into hosted1 then follow these steps:
 
The first stage is to create the Bazaar repository.
<pre>
$ cd /srv/bzr/
$ # This creates a Bazaar repository which has shared storage between branches
$ sudo bzr init-repo $PROJECTNAME --no-trees
$ cd $PROJECTNAME
$ sudo bzr branch $OLDURL
$ sudo bzr branch $OLDURL2
$ # [...]
$ sudo bzr branch $OLDURLN
$ cd ..
$ sudo find $PROJECTNAME -type d -exec chmod g+s \{\} \;
$ sudo chmod -R g+w $PROJECTNAME
$ sudo chown -R root:$PROJECTGROUP $PROJECTNAME
</pre>
 
This should be all that is needed.  To checkout run:
<pre>
bzr init-repo $MYLOCALPROJECTREPO
cd $MYLOCALPROJECTREPO
bzr branch bzr+ssh://bzr.fedorahosted.org/bzr/$PROJECTNAME/$BRANCHNAME
bzr branch bzr://bzr.fedorahosted.org/bzr/$PROJECTNAME/$BRANCHNAME/
</pre>
Note: If the end user checks out a branch without creating their own repository they will need to create a local working tree by doing the following:
<pre>
cd $BRANCHNAME
bzr checkout --lightweight
</pre>
 
== SVN Repository ==
You'll need to know two things in order to start a svn repository.
# PROJECTNAME -- what the project wants to be called.
# PROJECTGROUP -- The Fedora account system group with read-write access.
# COMMITLIST -- comma-separated list of email addresses for commits (optional)
 
SVN lives on the hosted server.  Access it by logging into hosted1.  Then run the following steps:
 
<pre>
$ cd /svn/
$ sudo svnadmin create $PROJECTNAME
$ cd $PROJECTNAME
$ sudo chgrp -R $PROJECTGROUP .
$ sudo chmod -R g+w .
$ sudo find -type d -exec chmod g+s \{\} \;
</pre>
 
This should be all that is needed.  To checkout run:
<pre>
svn co svn+ssh://svn.fedorahosted.org/svn/$PROJECTNAME
</pre>
 
=== Commit Mail ===
If they want commit mail, then there are a couple of additional steps.
<pre>
$ echo $COMMITLIST | sudo tee $PROJECTNAME/commit-list > /dev/null
$ sudo ln -sv /usr/bin/fedora-svn-commit-mail-hook $PROJECTNAME/hooks/post-commit
</pre>


[[Category:Infrastructure]] [[Category:Hosted Projects]]
[[Category:Infrastructure]] [[Category:Hosted Projects]]

Latest revision as of 14:52, 20 January 2012

This SOP has moved to the fedora Infrastructure SOP git repo. Please see the current document at: http://infrastructure.fedoraproject.org/infra/docs/fedorahosted-repo-setup.txt

For changes, questions or comments, please contact anyone in the Fedora Infrastructure team.