1 | #!/bin/sh -f |
---|
2 | |
---|
3 | set -x |
---|
4 | |
---|
5 | #---------------------------------------------------------- |
---|
6 | build_version () |
---|
7 | #---------------------------------------------------------- |
---|
8 | { |
---|
9 | # |
---|
10 | # arg1 = "version" |
---|
11 | # arg2 = DetectorDescription-00-00-11:19990122114459 |
---|
12 | # |
---|
13 | # Convert a-b-c into v<b>r<c> |
---|
14 | # |
---|
15 | # (might be v<a>r<b>p<c> instead) |
---|
16 | # |
---|
17 | |
---|
18 | #tag=`echo $2 | cut -d':' -f1 | cut -d'-' -f3-4` |
---|
19 | #version=`echo $tag | cut -d'-' -f1 | sed 's#^0##'` |
---|
20 | #release=`echo $tag | cut -d'-' -f2 | sed 's#^0##'` |
---|
21 | #echo v${version}r${release} |
---|
22 | |
---|
23 | echo "v2r1" |
---|
24 | } |
---|
25 | |
---|
26 | #---------------------------------------------------------- |
---|
27 | install_cvs () |
---|
28 | #---------------------------------------------------------- |
---|
29 | { |
---|
30 | # |
---|
31 | # Install all required management files for a directory. |
---|
32 | # |
---|
33 | # CVS/Entries (empty) |
---|
34 | # CVS/Root (filled in with current $CVSROOT) |
---|
35 | # CVS/Repository (filled in with current $CVSROOT/$1) |
---|
36 | # |
---|
37 | repository=$1 |
---|
38 | |
---|
39 | if test ! -d CVS ; then |
---|
40 | mkdir CVS |
---|
41 | fi |
---|
42 | |
---|
43 | if test ! -d CVS/Entries ; then |
---|
44 | cat <<END >CVS/entries |
---|
45 | END |
---|
46 | fi |
---|
47 | |
---|
48 | if test ! -d CVS/Root ; then |
---|
49 | cat <<END >CVS/Root |
---|
50 | ${CVSROOT} |
---|
51 | END |
---|
52 | fi |
---|
53 | |
---|
54 | if test ! -d CVS/Repository ; then |
---|
55 | cat <<END >CVS/Repository |
---|
56 | ${CVSROOT}/${repository} |
---|
57 | END |
---|
58 | fi |
---|
59 | |
---|
60 | } |
---|
61 | |
---|
62 | #---------------------------------------------------------- |
---|
63 | install_cvs_branch () |
---|
64 | #---------------------------------------------------------- |
---|
65 | { |
---|
66 | # |
---|
67 | # Manually add a branch entry in the CVS/Entries file |
---|
68 | # (avoid duplications) |
---|
69 | # |
---|
70 | branch=$1 |
---|
71 | |
---|
72 | a=`egrep -e "/${branch}/" CVS/Entries` |
---|
73 | |
---|
74 | if test "${a}" = "" ; then |
---|
75 | cat <<END >>CVS/Entries |
---|
76 | D/${branch}//// |
---|
77 | END |
---|
78 | fi |
---|
79 | } |
---|
80 | |
---|
81 | #---------------------------------------------------------- |
---|
82 | do_help () |
---|
83 | #---------------------------------------------------------- |
---|
84 | { |
---|
85 | cat <<END |
---|
86 | > srt2cmt.sh <package> <package> ... |
---|
87 | |
---|
88 | Checkout packages (commited using the SRT organisation) from CVS, |
---|
89 | and install them using the cmt organisation. |
---|
90 | |
---|
91 | The following conventions are used : |
---|
92 | |
---|
93 | files from : go to : |
---|
94 | <package>/ <package>/<version>/cmt/ |
---|
95 | <package>/<branch>/ <package>/<version>/<branch>/ |
---|
96 | |
---|
97 | END |
---|
98 | } |
---|
99 | |
---|
100 | #---------------------------------------------------------- |
---|
101 | work () |
---|
102 | #---------------------------------------------------------- |
---|
103 | { |
---|
104 | target=$1 |
---|
105 | |
---|
106 | echo "================= working in target ${target}" |
---|
107 | |
---|
108 | for package_file in `find ${root}/${target} -name PACKAGE,v -print` ; do |
---|
109 | |
---|
110 | echo "================= working on package_file ${package_file}" |
---|
111 | |
---|
112 | package=`dirname ${package_file} | sed -e "s#${root}/##"` |
---|
113 | |
---|
114 | echo "================= package is ${package}" |
---|
115 | |
---|
116 | cd ${home_dir} |
---|
117 | |
---|
118 | # |
---|
119 | # First of all export the PACKAGE file to get basic infos (version) |
---|
120 | # about the package. |
---|
121 | # |
---|
122 | mkdir -p ${package} |
---|
123 | cvs export -r HEAD -d ${package} offline/${package}/PACKAGE |
---|
124 | |
---|
125 | tag=`grep version ${package}/PACKAGE` |
---|
126 | title=`grep title ${package}/PACKAGE` |
---|
127 | author=`grep author ${package}/PACKAGE` |
---|
128 | |
---|
129 | echo ${tag} ${title} ${author} |
---|
130 | |
---|
131 | /bin/rm -f ${package}/PACKAGE |
---|
132 | |
---|
133 | done |
---|
134 | } |
---|
135 | |
---|
136 | #---------------------------------------------------------- |
---|
137 | # main () |
---|
138 | #---------------------------------------------------------- |
---|
139 | |
---|
140 | #if test "$#" = "0" ; then |
---|
141 | # do_help |
---|
142 | # exit 1 |
---|
143 | #fi |
---|
144 | |
---|
145 | case "$1" in |
---|
146 | --help) |
---|
147 | do_help |
---|
148 | exit 1 |
---|
149 | ;; |
---|
150 | esac |
---|
151 | |
---|
152 | home_dir=`pwd` |
---|
153 | |
---|
154 | root=$CVSROOT/offline |
---|
155 | |
---|
156 | #for target in $* ; do |
---|
157 | #done |
---|
158 | |
---|
159 | work |
---|
160 | |
---|
161 | |
---|