blob: 257b44cd9d0ee0d65de2c28b708a038db22e68a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/bin/sh
#
# Migrate TCOS to GIT
#
SVN_TRUNK=http://tcosproject.org/svn/tcos/trunk
GIT_WEB=http://tcosproject.org/gitweb/
GIT_SSH=ssh://git@tcosproject.org/git/
GIT_ANO=http://tcosproject.org/git/
AUTHORS=/ftp/tcosproject.org/authors.txt
ROOT=/ftp/tcosproject.org/root
GITROOT=/ftp/tcosproject.org/gitroot/
migrate_repo() {
PKG=$1
if [ "$1" = "" ]; then
echo "Need a package to migrate"
return
fi
if [ -d ${GITROOT}/${PKG}.git ]; then
#echo "Error: Package '$PKG' found"
return
fi
# import with git-svn
mkdir -p ${ROOT}/${PKG}
( cd ${ROOT}/${PKG} && git-svn clone ${SVN_TRUNK}/${PKG} --authors-file=${AUTHORS} )
if [ $? != 0 ]; then
echo "Error while downloading SVN repos of $PKG"
return
fi
# create git from SVN
mkdir -p ${ROOT}/${PKG}.git
(cd ${ROOT}/${PKG}.git && git --bare init)
# go to git-svn, add remote and push
( cd ${ROOT}/${PKG}/$PKG && git remote add origin ${ROOT}/${PKG}.git )
if [ $? != 0 ]; then
echo "Error while pushing repos of $PKG"
return
fi
( cd ${ROOT}/${PKG}/$PKG && git-push origin master )
if [ $? != 0 ]; then
echo "Error while pushing repos of $PKG"
return
fi
rm -rf ${ROOT}/${PKG}
mv ${ROOT}/${PKG}.git ${GITROOT}
echo "${PKG}.git mariodebian@gmail.com" >> ${GITROOT}/gitweb-projects
echo "Done"
}
configure_git() {
PKG=$1
if [ "$1" = "" ]; then
echo "Need a package to migrate"
return
fi
cat << EOF > ${GITROOT}/${PKG}.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = true
[gitweb]
owner = "Mario Izquierdo (mariodebian)"
EOF
cat << EOF > ${GITROOT}/${PKG}.git/description
TCOS GIT repository of $PKG package
EOF
touch ${GITROOT}/${PKG}.git/git-daemon-export-ok
chmod a+x ${GITROOT}/${PKG}.git/hooks/post-update
# set URLS
cat << EOF > ${GITROOT}/${PKG}.git/cloneurl
$GIT_ANO$PKG.git (anonymous)
$GIT_SSH$PKG.git (SSH key)
$GIT_WEB?p=$PKG;a=summary (browse)
EOF
echo " * configured ${PKG}"
#echo "${GITROOT}/${PKG}.git/cloneurl"
}
# get SVN dirs from trunk
PACKAGES=$(svn ls $SVN_TRUNK| grep "/$")
for _p in $PACKAGES; do
p=$(basename $_p)
migrate_repo "$p"
configure_git "$p"
done
|