1 | #!/bin/sh |
---|
2 | |
---|
3 | #--------------------------------------------------------------------- |
---|
4 | # |
---|
5 | # This script should be installed within the commitinfo file of CVS |
---|
6 | # using the following line : |
---|
7 | # |
---|
8 | # ... |
---|
9 | #.cvsinfos $CVSROOT/CVSROOT/cmt_buildcvsinfos.sh |
---|
10 | # ... |
---|
11 | # |
---|
12 | # and is used whenever one tries to import a file named cmt.cvsinfos |
---|
13 | # |
---|
14 | # This file should only contain the name of a CVS module onto which |
---|
15 | # queries are to be done. |
---|
16 | # |
---|
17 | #--------------------------------------------------------------------- |
---|
18 | |
---|
19 | #set -x |
---|
20 | |
---|
21 | echo $* |
---|
22 | |
---|
23 | if test "$1" = "" ; then |
---|
24 | exit 1 |
---|
25 | fi |
---|
26 | |
---|
27 | if test "$1" = "cmt.cvsinfos" ; then |
---|
28 | module=`cat $1` |
---|
29 | elif test "$1" = "methods.cvsinfos" ; then |
---|
30 | module=`cat $1` |
---|
31 | elif test "$2" = "cmt.cvsinfos" ; then |
---|
32 | module=`cat $2` |
---|
33 | elif test "$2" = "methods.cvsinfos" ; then |
---|
34 | module=`cat $2` |
---|
35 | else |
---|
36 | exit 1 |
---|
37 | fi |
---|
38 | |
---|
39 | if test "${module}" = "" ; then |
---|
40 | exit 1 |
---|
41 | fi |
---|
42 | |
---|
43 | if test -d ${CVSROOT}/${module} ; then |
---|
44 | if test -r ${CVSROOT}/${module}/mgr/requirements,v ; then |
---|
45 | test_file=${CVSROOT}/${module}/mgr/requirements,v |
---|
46 | else |
---|
47 | test_file=`find ${CVSROOT}/${module} -name '*,v' -print | head -n 1` |
---|
48 | fi |
---|
49 | |
---|
50 | tags=`tr ' ' '\n' < ${test_file} | \ |
---|
51 | awk '/symbols/,/locks/ {n=split($0,w,"."); if ((n == 2) || (n == 4)) print; }' | \ |
---|
52 | sed -e 's#:.*##' -e 's#[ ]*##'` |
---|
53 | else |
---|
54 | echo # Module ${module} not found. |
---|
55 | fi |
---|
56 | |
---|
57 | branches= |
---|
58 | for branch in `ls ${CVSROOT}/${module} | grep -v Attic` ; do |
---|
59 | if test -d ${CVSROOT}/${module}/${branch} ; then |
---|
60 | if test ! -r ${CVSROOT}/${module}/${branch}/cmt/requirements,v ; then |
---|
61 | if test ! -r ${CVSROOT}/${module}/${branch}/mgr/requirements,v ; then |
---|
62 | if test "${branches}" = "" ; then |
---|
63 | branches="${branch}" |
---|
64 | else |
---|
65 | branches="${branches} ${branch}" |
---|
66 | fi |
---|
67 | fi |
---|
68 | fi |
---|
69 | fi |
---|
70 | done |
---|
71 | |
---|
72 | subpackages= |
---|
73 | for branch in `ls ${CVSROOT}/${module} | grep -v Attic` ; do |
---|
74 | if test -d ${CVSROOT}/${module}/${branch} ; then |
---|
75 | if test -r ${CVSROOT}/${module}/${branch}/cmt/requirements,v ; then |
---|
76 | if test "${subpackages}" = "" ; then |
---|
77 | subpackages="${branch}" |
---|
78 | else |
---|
79 | subpackages="${subpackages} ${branch}" |
---|
80 | fi |
---|
81 | elif test -r ${CVSROOT}/${module}/${branch}/mgr/requirements,v ; then |
---|
82 | if test "${subpackages}" = "" ; then |
---|
83 | subpackages="${branch}" |
---|
84 | else |
---|
85 | subpackages="${subpackages} ${branch}" |
---|
86 | fi |
---|
87 | fi |
---|
88 | fi |
---|
89 | done |
---|
90 | |
---|
91 | echo tags=${tags} |
---|
92 | echo branches=${branches} |
---|
93 | echo subpackages=${subpackages} |
---|
94 | |
---|
95 | exit 1 |
---|