Merge branch 'rename_chili_to_redmine'
This commit is contained in:
commit
4e9f85f9e1
|
@ -1,4 +0,0 @@
|
|||
DOC_PATH=/var/doc/chiliproject
|
||||
TMP_PATH=/tmp/chiliproject-doxygen$RANDOM$RANDOM
|
||||
MYSQL_USER=chiliproject
|
||||
MYSQL_DBNAME=chiliproject
|
|
@ -2,6 +2,6 @@ export LANG=ru_RU.UTF-8
|
|||
MYSQL_USER=git
|
||||
MYSQL_HOSTNAME=127.0.0.1
|
||||
GITORIOUS_MYSQL_DBNAME=gitorious
|
||||
CHILI_MYSQL_DBNAME=chiliproject
|
||||
REDMINE_MYSQL_DBNAME=redmine
|
||||
GITORIOUS_REPOS_PATH=/var/www/gitorious/repositories
|
||||
CHILI_REQUIRED_ROLES="Ответственный Менеджер Major Manager Responsible"
|
||||
REDMINE_REQUIRED_ROLES="Ответственный Менеджер Major Manager Responsible"
|
|
@ -0,0 +1,4 @@
|
|||
DOC_PATH=/var/doc/redmine
|
||||
TMP_PATH=/tmp/redmine-doxygen$RANDOM$RANDOM
|
||||
MYSQL_USER=redmine
|
||||
MYSQL_DBNAME=redmine
|
|
@ -1,6 +0,0 @@
|
|||
export LANG=ru_RU.UTF-8
|
||||
RHODECODE_SQLITE_PATH=/home/rhodecode/rhodecode/rhodecode.db
|
||||
CHILI_MYSQL_USER=redmine
|
||||
CHILI_MYSQL_DBNAME=redmine
|
||||
CHILI_MYSQL_HOSTNAME=127.0.0.1
|
||||
CHILI_REQUIRED_ROLES="Ответственный Менеджер Major Manager Responsible"
|
|
@ -0,0 +1,6 @@
|
|||
export LANG=ru_RU.UTF-8
|
||||
RHODECODE_SQLITE_PATH=/home/rhodecode/rhodecode/rhodecode.db
|
||||
REDMINE_MYSQL_USER=redmine
|
||||
REDMINE_MYSQL_DBNAME=redmine
|
||||
REDMINE_MYSQL_HOSTNAME=127.0.0.1
|
||||
REDMINE_REQUIRED_ROLES="Ответственный Менеджер Major Manager Responsible"
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# load config files
|
||||
if [ -f /etc/gitorious_chiliproject ]; then
|
||||
source /etc/gitorious_chiliproject
|
||||
elif [ -f ~/etc/gitorious_chiliproject ]; then
|
||||
source ~/etc/gitorious_chiliproject
|
||||
if [ -f /etc/gitorious_redmine ]; then
|
||||
source /etc/gitorious_redmine
|
||||
elif [ -f ~/etc/gitorious_redmine ]; then
|
||||
source ~/etc/gitorious_redmine
|
||||
else
|
||||
echo "Config file not found ;-("
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# === REMOVE ALL BROKEN REPOSITORY LINKS IN CHILIPROJECT MYSQL DATABASE ===
|
||||
# === REMOVE ALL BROKEN REPOSITORY LINKS IN REDMINE MYSQL DATABASE ===
|
||||
ALL_MYSQL_REPOS=`mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "SELECT url,root_url,id
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories
|
||||
WHERE type='Git'
|
||||
OR type='Repository::Git'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+4`
|
||||
|
@ -30,70 +30,70 @@ for v in $ALL_MYSQL_REPOS; do
|
|||
let n++
|
||||
done;
|
||||
repos_to_remove=${repos_to_remove#,}
|
||||
[ "$repos_to_remove" != "" ] && mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "DELETE FROM $CHILI_MYSQL_DBNAME.repositories WHERE id IN ($repos_to_remove)"
|
||||
[ "$repos_to_remove" != "" ] && mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "DELETE FROM $REDMINE_MYSQL_DBNAME.repositories WHERE id IN ($repos_to_remove)"
|
||||
|
||||
# === REMOVE REPOSITORY LINKS WITH DIFFERENT PROJECT NAMES ===
|
||||
REMOVE_IDS=`mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "SELECT $CHILI_MYSQL_DBNAME.repositories.id
|
||||
FROM $CHILI_MYSQL_DBNAME.projects,
|
||||
$CHILI_MYSQL_DBNAME.repositories,
|
||||
REMOVE_IDS=`mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "SELECT $REDMINE_MYSQL_DBNAME.repositories.id
|
||||
FROM $REDMINE_MYSQL_DBNAME.projects,
|
||||
$REDMINE_MYSQL_DBNAME.repositories,
|
||||
$GITORIOUS_MYSQL_DBNAME.repositories
|
||||
WHERE ($CHILI_MYSQL_DBNAME.repositories.url=CONCAT('$GITORIOUS_REPOS_PATH/',$GITORIOUS_MYSQL_DBNAME.repositories.hashed_path,'.git')
|
||||
OR $CHILI_MYSQL_DBNAME.repositories.root_url=CONCAT('$GITORIOUS_REPOS_PATH/',$GITORIOUS_MYSQL_DBNAME.repositories.hashed_path,'.git'))
|
||||
AND $CHILI_MYSQL_DBNAME.projects.name <> $GITORIOUS_MYSQL_DBNAME.repositories.name
|
||||
AND $CHILI_MYSQL_DBNAME.projects.id = $CHILI_MYSQL_DBNAME.repositories.project_id
|
||||
WHERE ($REDMINE_MYSQL_DBNAME.repositories.url=CONCAT('$GITORIOUS_REPOS_PATH/',$GITORIOUS_MYSQL_DBNAME.repositories.hashed_path,'.git')
|
||||
OR $REDMINE_MYSQL_DBNAME.repositories.root_url=CONCAT('$GITORIOUS_REPOS_PATH/',$GITORIOUS_MYSQL_DBNAME.repositories.hashed_path,'.git'))
|
||||
AND $REDMINE_MYSQL_DBNAME.projects.name <> $GITORIOUS_MYSQL_DBNAME.repositories.name
|
||||
AND $REDMINE_MYSQL_DBNAME.projects.id = $REDMINE_MYSQL_DBNAME.repositories.project_id
|
||||
;" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||
[ "$REMOVE_IDS" != "" ] && mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "DELETE FROM $CHILI_MYSQL_DBNAME.repositories WHERE id IN ($REMOVE_IDS)"
|
||||
[ "$REMOVE_IDS" != "" ] && mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "DELETE FROM $REDMINE_MYSQL_DBNAME.repositories WHERE id IN ($REMOVE_IDS)"
|
||||
|
||||
# === GET DATA FROM GITORIOUS MYSQL BASE ===
|
||||
roles_mysql_string=`echo $CHILI_REQUIRED_ROLES | sed "s~\>~'~g ; s~\<~,'~g ; s~^,~~ ; s~ ~~g"`
|
||||
CHILI_ID_GITORIOUS_REPO=`mysql --default-character-set=utf8 -h$MYSQL_HOSTNAME -u $MYSQL_USER -e \
|
||||
"SELECT DISTINCT $CHILI_MYSQL_DBNAME.projects.id,$GITORIOUS_MYSQL_DBNAME.repositories.hashed_path
|
||||
FROM $CHILI_MYSQL_DBNAME.member_roles,
|
||||
$CHILI_MYSQL_DBNAME.members,
|
||||
$CHILI_MYSQL_DBNAME.projects,
|
||||
$CHILI_MYSQL_DBNAME.roles,
|
||||
$CHILI_MYSQL_DBNAME.users,
|
||||
roles_mysql_string=`echo $REDMINE_REQUIRED_ROLES | sed "s~\>~'~g ; s~\<~,'~g ; s~^,~~ ; s~ ~~g"`
|
||||
REDMINE_ID_GITORIOUS_REPO=`mysql --default-character-set=utf8 -h$MYSQL_HOSTNAME -u $MYSQL_USER -e \
|
||||
"SELECT DISTINCT $REDMINE_MYSQL_DBNAME.projects.id,$GITORIOUS_MYSQL_DBNAME.repositories.hashed_path
|
||||
FROM $REDMINE_MYSQL_DBNAME.member_roles,
|
||||
$REDMINE_MYSQL_DBNAME.members,
|
||||
$REDMINE_MYSQL_DBNAME.projects,
|
||||
$REDMINE_MYSQL_DBNAME.roles,
|
||||
$REDMINE_MYSQL_DBNAME.users,
|
||||
$GITORIOUS_MYSQL_DBNAME.repositories,
|
||||
$GITORIOUS_MYSQL_DBNAME.roles,
|
||||
$GITORIOUS_MYSQL_DBNAME.users
|
||||
WHERE $CHILI_MYSQL_DBNAME.member_roles.member_id=$CHILI_MYSQL_DBNAME.members.id
|
||||
AND $CHILI_MYSQL_DBNAME.member_roles.role_id=$CHILI_MYSQL_DBNAME.roles.id
|
||||
AND $CHILI_MYSQL_DBNAME.members.user_id=$CHILI_MYSQL_DBNAME.users.id
|
||||
AND $CHILI_MYSQL_DBNAME.members.project_id=$CHILI_MYSQL_DBNAME.projects.id
|
||||
AND $CHILI_MYSQL_DBNAME.projects.name=$GITORIOUS_MYSQL_DBNAME.repositories.name
|
||||
AND $CHILI_MYSQL_DBNAME.users.type='User'
|
||||
AND $CHILI_MYSQL_DBNAME.users.mail=$GITORIOUS_MYSQL_DBNAME.users.email
|
||||
AND $CHILI_MYSQL_DBNAME.roles.name IN ($roles_mysql_string)
|
||||
WHERE $REDMINE_MYSQL_DBNAME.member_roles.member_id=$REDMINE_MYSQL_DBNAME.members.id
|
||||
AND $REDMINE_MYSQL_DBNAME.member_roles.role_id=$REDMINE_MYSQL_DBNAME.roles.id
|
||||
AND $REDMINE_MYSQL_DBNAME.members.user_id=$REDMINE_MYSQL_DBNAME.users.id
|
||||
AND $REDMINE_MYSQL_DBNAME.members.project_id=$REDMINE_MYSQL_DBNAME.projects.id
|
||||
AND $REDMINE_MYSQL_DBNAME.projects.name=$GITORIOUS_MYSQL_DBNAME.repositories.name
|
||||
AND $REDMINE_MYSQL_DBNAME.users.type='User'
|
||||
AND $REDMINE_MYSQL_DBNAME.users.mail=$GITORIOUS_MYSQL_DBNAME.users.email
|
||||
AND $REDMINE_MYSQL_DBNAME.roles.name IN ($roles_mysql_string)
|
||||
AND $GITORIOUS_MYSQL_DBNAME.repositories.user_id=$GITORIOUS_MYSQL_DBNAME.users.id;" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+3`
|
||||
|
||||
# add repositories paths to $CHILI_MYSQL_DBNAME.repositories
|
||||
chili_project_id=
|
||||
# add repositories paths to $REDMINE_MYSQL_DBNAME.repositories
|
||||
redmine_project_id=
|
||||
gitorious_path=
|
||||
let n=0
|
||||
for v in $CHILI_ID_GITORIOUS_REPO; do
|
||||
for v in $REDMINE_ID_GITORIOUS_REPO; do
|
||||
let idx=n/2
|
||||
case $((n%2)) in
|
||||
0) chili_project_id=$v ;;
|
||||
0) redmine_project_id=$v ;;
|
||||
1) gitorious_path=$GITORIOUS_REPOS_PATH/$v.git
|
||||
# Test for already present repo
|
||||
ALREADY_EXIST=`mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "SELECT id
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories
|
||||
WHERE project_id='$chili_project_id'
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories
|
||||
WHERE project_id='$redmine_project_id'
|
||||
OR url='$gitorious_path'
|
||||
OR root_url='$gitorious_path'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||
if [ "" == "$ALREADY_EXIST" ]; then
|
||||
# insert to $CHILI_MYSQL_DBNAME.repositories
|
||||
echo "insert $chili_project_id: $gitorious_path"
|
||||
mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "INSERT INTO $CHILI_MYSQL_DBNAME.repositories(project_id,
|
||||
# insert to $REDMINE_MYSQL_DBNAME.repositories
|
||||
echo "insert $redmine_project_id: $gitorious_path"
|
||||
mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e "INSERT INTO $REDMINE_MYSQL_DBNAME.repositories(project_id,
|
||||
url,
|
||||
root_url,
|
||||
type,
|
||||
path_encoding,
|
||||
is_default)
|
||||
VALUES('$chili_project_id',
|
||||
VALUES('$redmine_project_id',
|
||||
'$gitorious_path',
|
||||
'$gitorious_path',
|
||||
'Repository::Git',
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# load config files
|
||||
if [ -f /etc/chiliproject_doxygen ]; then
|
||||
source /etc/chiliproject_doxygen
|
||||
elif [ -f ~/etc/chiliproject_doxygen ]; then
|
||||
source ~/etc/chiliproject_doxygen
|
||||
if [ -f /etc/redmine_doxygen ]; then
|
||||
source /etc/redmine_doxygen
|
||||
elif [ -f ~/etc/redmine_doxygen ]; then
|
||||
source ~/etc/redmine_doxygen
|
||||
else
|
||||
echo "Config file not found ;-("
|
||||
exit -1
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# load config files
|
||||
if [ -f /etc/rhodecode_chiliproject ]; then
|
||||
source /etc/rhodecode_chiliproject
|
||||
elif [ -f ~/etc/rhodecode_chiliproject ]; then
|
||||
source ~/etc/rhodecode_chiliproject
|
||||
if [ -f /etc/rhodecode_redmine ]; then
|
||||
source /etc/rhodecode_redmine
|
||||
elif [ -f ~/etc/rhodecode_redmine ]; then
|
||||
source ~/etc/rhodecode_redmine
|
||||
else
|
||||
echo "Config file not found ;-("
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# === REMOVE ALL BROKEN REPOSITORY LINKS IN CHILIPROJECT MYSQL DATABASE ===
|
||||
ALL_MYSQL_REPOS=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT url,root_url,id
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories
|
||||
# === REMOVE ALL BROKEN REPOSITORY LINKS IN REDMINE MYSQL DATABASE ===
|
||||
ALL_MYSQL_REPOS=`mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "SELECT url,root_url,id
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories
|
||||
WHERE type='Mercurial'
|
||||
OR type='Repository::Mercurial'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+4`
|
||||
|
@ -30,8 +30,8 @@ for v in $ALL_MYSQL_REPOS; do
|
|||
let n++
|
||||
done;
|
||||
repos_to_remove=${repos_to_remove#,}
|
||||
[ "$repos_to_remove" != "" ] && mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "DELETE
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories
|
||||
[ "$repos_to_remove" != "" ] && mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "DELETE
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories
|
||||
WHERE id IN ($repos_to_remove)"
|
||||
|
||||
# === GET DATA FROM RHODECODE SQLITE BASE ===
|
||||
|
@ -64,46 +64,46 @@ done
|
|||
|
||||
# === FOR ALL REPOS FROM RHODECODE DATABASE===
|
||||
for i in `seq 0 $((nrepos-1))`; do
|
||||
# === GET DATA FROM CHILIPROJECT MYSQL BASE ===
|
||||
USERID=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT id
|
||||
FROM $CHILI_MYSQL_DBNAME.users
|
||||
# === GET DATA FROM REDMINE MYSQL BASE ===
|
||||
USERID=`mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "SELECT id
|
||||
FROM $REDMINE_MYSQL_DBNAME.users
|
||||
WHERE users.status='1'
|
||||
AND users.mail='${repos_mails[$i]}'
|
||||
AND users.type='User'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||
[ "$USERID" == "" ] && continue
|
||||
|
||||
PROJECTID=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT DISTINCT id FROM $CHILI_MYSQL_DBNAME.projects
|
||||
PROJECTID=`mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "SELECT DISTINCT id FROM $REDMINE_MYSQL_DBNAME.projects
|
||||
WHERE name='${repos_names[$i]}'
|
||||
AND status='1'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||
[ "$PROJECTID" == "" ] && continue
|
||||
|
||||
REMOVE_ID=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT repositories.id
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories,$CHILI_MYSQL_DBNAME.projects
|
||||
REMOVE_ID=`mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "SELECT repositories.id
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories,$REDMINE_MYSQL_DBNAME.projects
|
||||
WHERE (repositories.url='${repos_paths[$i]}'
|
||||
OR repositories.root_url='${repos_paths[$i]}')
|
||||
AND repositories.project_id=projects.id
|
||||
AND projects.name <> '${repos_names[$i]}'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||
|
||||
[ "$REMOVE_ID" != "" ] && mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "DELETE
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories
|
||||
[ "$REMOVE_ID" != "" ] && mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "DELETE
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories
|
||||
WHERE id = '$REMOVE_ID'"
|
||||
|
||||
ALREADY_EXIST=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT id
|
||||
FROM $CHILI_MYSQL_DBNAME.repositories
|
||||
ALREADY_EXIST=`mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "SELECT id
|
||||
FROM $REDMINE_MYSQL_DBNAME.repositories
|
||||
WHERE project_id='$PROJECTID'
|
||||
OR url='${repos_paths[$i]}'
|
||||
OR root_url='${repos_paths[$i]}'" \
|
||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||
[ "$ALREADY_EXIST" != "" ] && continue
|
||||
|
||||
roles_mysql_string=`echo $CHILI_REQUIRED_ROLES | sed "s~\>~'~g ; s~\<~,'~g ; s~^,~~ ; s~ ~~g"`
|
||||
ROLES=`mysql --default-character-set=utf8 -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT roles.name
|
||||
FROM $CHILI_MYSQL_DBNAME.roles,
|
||||
$CHILI_MYSQL_DBNAME.member_roles,
|
||||
$CHILI_MYSQL_DBNAME.members
|
||||
roles_mysql_string=`echo $REDMINE_REQUIRED_ROLES | sed "s~\>~'~g ; s~\<~,'~g ; s~^,~~ ; s~ ~~g"`
|
||||
ROLES=`mysql --default-character-set=utf8 -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "SELECT roles.name
|
||||
FROM $REDMINE_MYSQL_DBNAME.roles,
|
||||
$REDMINE_MYSQL_DBNAME.member_roles,
|
||||
$REDMINE_MYSQL_DBNAME.members
|
||||
WHERE roles.id=member_roles.role_id
|
||||
AND member_roles.member_id=members.id
|
||||
AND members.user_id='$USERID'
|
||||
|
@ -113,11 +113,11 @@ for i in `seq 0 $((nrepos-1))`; do
|
|||
|
||||
[ "$ROLES" == "" ] && continue
|
||||
|
||||
# === ATTACH RHODECODE REPOSITORY TO CHILIPROJECT ===
|
||||
# === ATTACH RHODECODE REPOSITORY TO REDMINE ===
|
||||
# DEBUG
|
||||
echo "insert $PROJECTID,${repos_paths[$i]},${repos_types[$i]}"
|
||||
|
||||
mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "INSERT INTO $CHILI_MYSQL_DBNAME.repositories(project_id,
|
||||
mysql -h$REDMINE_MYSQL_HOSTNAME -u $REDMINE_MYSQL_USER -e "INSERT INTO $REDMINE_MYSQL_DBNAME.repositories(project_id,
|
||||
url,
|
||||
root_url,
|
||||
type,
|
Loading…
Reference in New Issue