Browse Source

new: git charm is completed and tested.

postgres
root 11 years ago
parent
commit
e6725b874b
  1. 49
      precise/git/hooks/install
  2. 2
      precise/git/revision
  3. 13
      precise/git/src/patch/bzr-fastimport/btree-except.patch
  4. 129
      precise/git/src/sbin/git-bzr-syncs
  5. 2
      precise/openerp/hooks/install

49
precise/git/hooks/install

@ -12,36 +12,69 @@ mkdir -p /srv/git-bzr-mirrors
mkdir -p /opt/apps
##
## install git-hooks
##
(cd /opt/apps &&
git clone -s /var/git/0k/git-hooks.git
git clone git.0k.io:/var/git/0k/git-hooks.git &&
git config --system git-hooks.install-dir /opt/apps/git-hooks &&
ln -sf /opt/apps/git-hooks/bin/git-hooks /usr/lib/git-core/git-hooks
)
##
## bzr-fastimport
##
(
cd /opt/apps &&
bzr clone lp:bzr-fastimport &&
mkdir /root/.bazaar/plugins -p
ln -sf /opt/apps/bzr-fastimport /root/.bazaar/plugins/fastimport
mkdir /root/.bazaar/plugins -p &&
ln -sf /opt/apps/bzr-fastimport /root/.bazaar/plugins/fastimport
)
## This patch will correct a nasty exception documented here:
## https://bugs.launchpad.net/bzr/+bug/541626
(cd /opt/apps/bzr-fastimport &&
patch -p0 ) < src/patch/bzr-fastimport/btree-except.patch
##
## python-fastimport
##
(
cd /opt/apps &&
bzr clone lp:python-fastimport &&
cd ../python-fastimport &&
cd python-fastimport &&
python setup.py install
)
##
## git-bzr-ng
##
(
cd /opt/apps &&
git clone https://github.com/termie/git-bzr-ng.git &&
cd /opt/apps/git-bzr-ng &&
ln -sf /opt/apps/git-bzr-ng/git-bzr /usr/lib/git-core/
)
cp src/sbin/git-bzr-syncs /usr/sbin/git-bzr-syncs
##
## git-bzr-syncs
##
(
cd /opt/apps &&
git clone git.0k.io:/var/git/0k/git-bzr-syncs.git &&
ln -sf /opt/apps/git-bzr-syncs/bin/git-bzr-syncs /usr/sbin/git-bzr-syncs
)
cp src/etc/cron.daily/git-bzr-syncs /etc/cron.daily/git-bzr-syncs
@ -56,7 +89,7 @@ groupadd -r git-users &&
adduser --system --home=$LXC_USER_HOME --shell /bin/bash --ingroup=git-users $LXC_USER &&
mkdir $LXC_USER_HOME/.ssh -p &&
cat srv/etc/ssh/lxc_git_access_id_rsa.pub >> $LXC_USER_HOME/.ssh/authorized_keys &&
cat src/etc/ssh/lxc_git_access_id_rsa.pub >> $LXC_USER_HOME/.ssh/authorized_keys &&
chown lxc-user $LXC_USER_HOME/.ssh -R

2
precise/git/revision

@ -1 +1 @@
0
1

13
precise/git/src/patch/bzr-fastimport/btree-except.patch

@ -0,0 +1,13 @@
=== modified file 'revision_store.py'
--- revision_store.py 2012-01-10 08:48:02 +0000
+++ revision_store.py 2013-06-13 13:42:59 +0000
@@ -170,7 +170,7 @@
"""
self.repo = repo
self._graph = None
- self._use_known_graph = True
+ self._use_known_graph = False
self._supports_chks = getattr(repo._format, 'supports_chks', False)
def expects_rich_root(self):

129
precise/git/src/sbin/git-bzr-syncs

@ -1,129 +0,0 @@
#!/bin/bash
. /etc/shlib
include common
include pretty
devdir=/srv/git-bzr-mirrors
conf_file="/etc/git-bzr-syncs/git-bzr-syncs.conf"
if ! [ -f "$conf_file" ]; then
print_error "No config file found in '$conf_file'."
fi
modules_branch=$(cat "$conf_file" | egrep -v ^\s*# | egrep -v ^\$)
## get branch from bzr_branch
function get_bzr_remote_branch() {
git config -l | grep "^bzr\.bzr/.*\.upstream=$1$" |
sed -r "s,^bzr\.(bzr/.*)\.upstream=.*$,\1,"
}
function get_bzr_local_branch() {
git config -l | grep "^bzr\..*\.bzr=$1" |
sed -r "s,^bzr\.(.*)\.bzr=.*$,\1,g" |
## This is because git-bzr-ng do not support "/" in branches names
grep -v "/" |
head -n 1
}
function get_current_branch() {
local branch
branch=$(git symbolic-ref HEAD)
echo "${branch#refs/heads/}"
}
function git_pull_remote_bzr() {
Wrap git checkout "$1" &&
Wrap git bzr sync &&
Wrap git merge --ff-only "$2" || exit 1
## remove bogus tags
export bogus_tags=$(git tag -l | grep ^openerp-build)
Wrap -d "delete $(echo "$bogus_tags" | wc -l ) bogus tags" 'echo "$bogus_tags" | xargs -n 20 git tag -d ' || exit 1
}
function get_bzr_official_branch() {
git config -l | grep "^branch\..*\.follow-git-bzr=$1$" |
sed -r "s,^branch\.(.*)\.follow-git-bzr=.*$,\1,g" |
## This is because git-bzr-ng do not support "/" in branches names
head -n 1
:
}
function git_update_official() {
update_to=$(git config branch.$1.follow-git-bzr)
## XXXvlab: this should be better but current git version is not
## supporting "-B"
#Wrap git checkout -B "$1" "$update_to"
if git branch "$1" >/dev/null 2>&1 ; then
Elt "Created branch $YELLOW$1$NORMAL"; Feed
fi
Wrap git checkout "$1" &&
Wrap git reset --hard "$update_to" || exit 1
}
if [ "$1" ]; then
modules_branch=$(echo "$modules_branch" | grep "^$1=")
fi
for line in $modules_branch; do
dir=$(echo "$line" | cut -f 1 -d "=")
bzr_branches=$(echo "$line" | cut -f 2- -d "=" | tr "," "\n")
Title Repository $YELLOW$dir$NORMAL
for bzr_branch in $bzr_branches; do
if ! [ -d "$devdir/$dir" ]; then
echo " You must clone your git repository in $devdir/$dir."
echo
echo " git clone GIT_REPO_URL $devdir/$dir"
echo " OR git bzr clone GIT_REPO_URL $devdir/$dir"
echo
print_error "No repository found in $devdir/$dir."
fi
cd "$devdir/$dir"
git_bzr_remote_branch="$(get_bzr_remote_branch $bzr_branch)"
if [ -z "$git_bzr_remote_branch" ]; then
echo " You must do the first 'git bzr' import yourself:"
echo
echo " git bzr import lp:LP_BRANCH LOCAL_BZR_BRANCH"
echo
echo " ie: git bzr import lp:openobject-addons/7.0 openobject-addons-7.0"
echo
print_error "bzr branch $bzr_branch was not configured in $dir repository."
fi
#echo " BZR REMOTE: $git_bzr_remote_branch"
git_bzr_local_branch="$(get_bzr_local_branch $git_bzr_remote_branch)"
if [ -z "$git_bzr_local_branch" ]; then
print_error "git bzr remote branch $git_bzr_remote_branch was not linked to a branch in $dir repository."
fi
#echo " BZR LOCAL: $git_bzr_local_branch"
current_branch=$(get_current_branch)
if [ "$(git diff)" ]; then
print_error "Repository $dir is not clean."
fi
git_bzr_official_branch="$(get_bzr_official_branch $git_bzr_local_branch)"
if [ -z "$git_bzr_official_branch" ]; then
echo " You must link $git_bzr_local_branch branch to the branch managed by 'git bzr'."
echo
echo " git config branch.$git_bzr_local_branch.follow-git-bzr LOCAL_BZR_BRANCH"
echo
print_error "git bzr local branch $git_bzr_local_branch was not linked to an official branch in $dir repository."
fi
Section "sync branch $YELLOW$git_bzr_official_branch$NORMAL"
Elt bzr branch: $YELLOW$bzr_branch$NORMAL ; Feed
Elt git intermediary branch: $YELLOW$git_bzr_local_branch$NORMAL ; Feed
git_pull_remote_bzr "$git_bzr_local_branch" "$git_bzr_remote_branch"
git_update_official "$git_bzr_official_branch"
Wrap git push origin "$git_bzr_official_branch" || exit 1
Wrap git push --tags || exit 1
done
done

2
precise/openerp/hooks/install

@ -36,7 +36,7 @@ fi
python setup.py install
)
pip install lxml pyparsing==1.5.7 psycopg2 pyyaml reportlab mako \
pip install lxml genshi==0.6 pyparsing==1.5.7 psycopg2 pyyaml reportlab mako \
pywebdav==0.9.4 feedparser caldav pytz pydot \
python-dateutil==1.5 cherrypy==3.1.2 formencode==1.2.2 \
babel simplejson==2.0.9 python-openid mysql-python vatnumber \

Loading…
Cancel
Save