Merge "Signed-off-by: Thomas Kulik <thomas.kulik@telekom.de>"
[doc.git] / tools / checkdocs.sh
1 #!/bin/bash
2 #set -x # uncomment for bash script debugging
3
4 ### ============================================================================
5 ### Licensed under the Apache License, Version 2.0 (the "License");
6 ### you may not use this file except in compliance with the License.
7 ### You may obtain a copy of the License at
8 ###
9 ###       http://www.apache.org/licenses/LICENSE-2.0
10 ###
11 ### Unless required by applicable law or agreed to in writing, software
12 ### distributed under the License is distributed on an "AS IS" BASIS,
13 ### WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ### See the License for the specific language governing permissions and
15 ### limitations under the License.
16 ### ============LICENSE_END=====================================================
17
18 ###
19 ### checkdocs.sh
20 ###
21 ### AUTHOR(S):
22 ### Thomas Kulik, Deutsche Telekom AG, 2020
23 ###
24 ### DESCRIPTION:
25 ### Retrieves a full list of ONAP repos from gerrit inluding their state.
26 ### Clones all active repos of the ONAP master branch plus other requested ONAP
27 ### branches. Then the script does some docs related analyses depending on the
28 ### clone results. It creates logfiles containing filtered results. In addition
29 ### a table.csv is created which can be used to import it in a spreadsheed.
30 ### Also a zip-file is created which contains all the results.
31 ###
32 ### IMPORTANT:
33 ### - in the output, repo names are shown in square brackets for readability
34 ###   e.g [aai/aai-common]/docs/release-notes.rst
35 ### - in the table.csv file you see data for the requested branch if available.
36 ###   if not available, data is retrieved from the master branch. it will be
37 ###   denoted in round brackets, e.g. (3) (tox.ini)
38 ###
39 ### REQUIREMENTS:
40 ### curl
41 ### jq
42 ###
43
44 ###
45 ### SOME HELPING COMMANDS TO PROCESS LOG FILES:
46 ### create repo list
47 ### curl -s https://git.onap.org/ | grep "^<tr><td class='toplevel-repo'><a title='" | sed -r "s:^<tr><td class='toplevel-repo'><a title='::" | sed -r "s:'.*::"
48 ###
49 ### remove branchname from the line
50 ### cat frankfurt_repoclone.log | sed 's:frankfurt|::'
51 ###
52 ### list only image names
53 ### cat master_dockerimagesfull.log | grep image | sed -r 's:image\:::' | sed -r 's:^ +::' | sed '/^[[:space:]]*$/d'
54 ###
55 ### more interesting stuff ...
56 ### curl https://gerrit.onap.org/r/projects/?d
57 ### LONG:  curl -s 'https://gerrit.onap.org/r/projects/?d' | awk '{if(NR>1)print}' | jq -c '.[] | {id, state}' | sed -r 's:%2F:/:g' | sed -r 's:["{}]::g' | sed -r 's:id\:::' | sed -r 's:,state\::|:' | sed '/All-Projects/d' | sed '/All-Users/d'
58 ### SHORT: curl -s 'https://gerrit.onap.org/r/projects/?d' | awk '{if(NR>1)print}' | jq -c '.[] | {id, state}' | sed -r 's:%2F:/:g; s:["{}]::g; s:id\:::; s:,state\::|:; /All-Projects/d; /All-Users/d'
59 ###
60
61 script_version="1.4 (2021/03/24)"
62
63 # save command for the restart with logging enabled
64 command=$0
65 arguments=$@
66 fullcommand="${command} ${arguments}"
67
68 ###
69 ### functions
70 ###
71
72 # print usage
73 function usage() {
74   echo "                                                           "
75   echo " checkdocs.sh Version ${script_version}"
76   echo "                                                           "
77   echo " USAGE:                                                    "
78   echo "  ./checkdocs.sh <arguments>                               "
79   echo "                                                           "
80   echo " ARGUMENTS:                                                "
81   echo "  -u|--user username                                       "
82   echo "  linux foundation username used to clone ONAP repositories"
83   echo "                                                           "
84   echo "  -b|--branches branch1,branch2,branch3                    "
85   echo "  list of branches to be cloned. master is automatically   "
86   echo "  added to the list. do not add manually!                  "
87   echo "                                                           "
88   echo "  -d|--dev                                                 "
89   echo "  development-mode - limits number of repos to be cloned   "
90   echo "                                                           "
91 }
92
93 # draw a simple line
94 function drawline {
95   echo "*******************************************************************************"
96 }
97
98 # remove lockfile in case script is interrupted
99 trap InterruptedScript SIGINT SIGTERM SIGHUP SIGKILL SIGSTOP
100 function InterruptedScript {
101   echo " "
102   echo "Script was interrupted."
103   if [ -f $lockfile ] ; then
104     rm $lockfile
105   fi
106   exit 0
107 }
108
109 ###
110 ### arguments handling
111 ###
112
113 PARAMS=""
114
115 while (( "$#" )); do
116   case "$1" in
117     -d|--dev)
118       devmode="TRUE"
119       shift
120       ;;
121     -b|--branches)
122       if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
123         branches_csv=$2
124         shift 2
125       else
126         echo "Error: Argument for $1 is missing" >&2
127         usage
128         exit 1
129       fi
130       ;;
131     -u|--user)
132       if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
133         lfusername=$2
134         shift 2
135       else
136         echo "Error: Argument for $1 is missing" >&2
137         usage
138         exit 1
139       fi
140         ;;
141     -*|--*=) # unsupported flags
142       echo "Error: Unsupported argument $1" >&2
143       usage
144       exit 1
145       ;;
146     *) # preserve positional arguments
147       PARAMS="$PARAMS $1"
148       shift
149       ;;
150   esac
151 done
152
153 # set positional arguments in their proper place
154 eval set -- "$PARAMS"
155
156 # old: declare -a branches=("master" "frankfurt" "guilin")
157 if [[ $branches_csv == "" || $lfusername == "" ]]; then
158   usage
159   exit -1
160 fi
161
162 # master branch is automatically added and must not part of the user arguments
163 if [[ $branches_csv == *"master"* ]]; then
164   usage
165   exit -1
166 fi
167 # clone master first, then the other branches
168 branches_csv="master,${branches_csv}"
169
170 # create the branches array by readinging in the values from the variable
171 IFS=',' read -r -a branches <<< "${branches_csv}"
172
173 #echo "DBUG: devmode      = \"${devmode}\""
174 #echo "DBUG: branches_csv = \"${branches_csv}\""
175 #echo "DBUG: lfusername   = \"${lfusername}\""
176 #echo "DBUG: branches     = \"${branches[@]}\""
177
178 # restart script with logging enabled
179 lockfile="checkdocs-runtime-lockfile"
180 if [ ! -f $lockfile ] ; then
181   touch $lockfile
182   echo "Restarting script with logging enabled."
183   ${fullcommand} 2>&1 | tee checkdocs.log
184   rm $lockfile
185   exit
186 fi
187
188 echo " "
189 echo "checkdocs.sh Version ${script_version}"
190 echo " "
191
192 # curl must be installed
193 if ! command -v curl &> /dev/null
194 then
195   echo "ERROR: curl command could not be found"
196   exit -1
197 fi
198
199 today=$(date '+%Y-%m-%d');
200 repolist="gerrit-repos-master-"$today".txt";
201 unique=$(date +%s)
202
203 echo "Retrieving a full list of ONAP repositories (master) from gerrit.onap.org."
204
205 # retrieve the full repolist from gerrit
206 # workaround because of the (wrong?) response of gerrit.onap.org which makes jq command fail
207 # "| awk '{if(NR>1)print}'" filters the first line of the response so that jq will work again (thx marek)
208 curl -s 'https://gerrit.onap.org/r/projects/?d' | awk '{if(NR>1)print}' | jq -c '.[] | {id, state}' | sed -r 's:%2F:/:g; s:["{}]::g; s:id\:::; s:,state\::|:; /All-Projects/d; /All-Users/d' >./$repolist
209
210 # process the created repolist and try to clone the projects from the mirror
211
212 source="git://cloud.onap.org/mirror"
213 echo "Using \"${source}\" as the source and username \"${lfusername}\" for cloning the repositories."
214 echo "Start cloning of repositories ..."
215
216 for branch in "${branches[@]}"
217 do
218
219   echo " "
220   echo "###"
221   echo "### ${branch}"
222   echo "###"
223   echo " "
224
225   branch_upper=$(echo "${branch}" | tr '[:lower:]' '[:upper:]')
226
227   mkdir $branch
228   cp $repolist $branch
229   cd $branch
230
231   devcounter=0
232
233   # process repolist
234   while read line
235   do
236
237   if [[ $devmode == "TRUE" ]]; then
238     devcounter=$((devcounter+1))
239   fi
240
241   if [[ $devcounter -lt "11" ]]; then
242
243       if [[ $devmode == "TRUE" ]]; then
244         echo "INFO: devmode! counter=${devcounter}"
245       fi
246
247       drawline
248       reponame=$(echo $line | awk -F "|" '{print $1}');
249       repostate=$(echo $line | awk -F "|" '{print $2}');
250       echo $reponame
251       echo $repostate
252
253       if [[ $repostate == "ACTIVE" ]] || [[ $repostate == "READ_ONLY" ]]; then
254         echo "Cloning \"${branch}\" branch of \"${repostate}\" project ${reponame}..."
255
256         # previously used:   git clone --branch ${branch} --recurse-submodules ssh://${lfusername}@gerrit.onap.org:29418/$reponame ./$reponame
257         # clone script Jess: git clone "git://cloud.onap.org/mirror/${i}" "${LOCALNAME}"
258         git clone --branch ${branch} --recurse-submodules ${source}/${reponame} ./${reponame}
259         gitexitcode=$?
260
261         if [[ ! ${gitexitcode} == "0" ]]; then
262           errormsg=$(tail -1 ../checkdocs.log)
263         else
264           errormsg="cloned"
265         fi
266
267         # repoclone.log format:  $1=gitexitcode|$2=reponame|$3=repostate|$4=errormsg
268         echo "${gitexitcode}|${reponame}|${repostate}|${errormsg}" | tee -a ${branch}_repoclone.log
269
270       #elif [[ $repostate == "READ_ONLY" ]]; then
271         #echo "-|${reponame}|${repostate}|ignored" | tee -a ${branch}_repoclone.log
272       else
273         echo "-|${reponame}|unknown repo state \"${repostate}\"|-" | tee -a ${branch}_repoclone.log
274       fi
275
276       # examine repo
277       if [[ ${gitexitcode} == "0" ]]; then
278
279         printf "\ndocs directories:\n"
280         find ./$reponame -type d -name docs | sed -r 's:./::' | sed -r s:${reponame}:[${reponame}]: | tee -a ${branch}_docs.log
281
282         printf "\nrst files:\n"
283         find ./$reponame -type f -name *.rst | sed -r 's:./::' | sed -r s:${reponame}:[${reponame}]: | tee -a ${branch}_rstfiles.log
284
285         printf "\nrelease notes rst:\n"
286         find ./$reponame -type f | grep 'release.*note.*.rst' | sed -r 's:./::' | sed -r s:${reponame}:[${reponame}]: | tee -a ${branch}_releasenotes.log
287
288         printf "\ntox.ini files:\n"
289         find ./$reponame -type f -name tox.ini | sed -r 's:./::' | sed -r s:${reponame}:[${reponame}]: | tee -a ${branch}_toxini.log
290
291         printf "\nconf.py files:\n"
292         find ./$reponame -type f -name conf.py | sed -r 's:./::' | sed -r s:${reponame}:[${reponame}]: | tee -a ${branch}_confpy.log
293
294         printf "\nindex.rst files:\n"
295         find ./$reponame -type f -name index.rst | sed -r 's:./::' | sed -r s:${reponame}:[${reponame}]: | tee -a ${branch}_indexrst.log
296
297       fi
298
299     # end defcounter loop
300     fi
301
302     gitexitcode=""
303
304   done <${repolist}
305
306   # examine repos
307   drawline
308   find . -type f -name values.yaml -print -exec grep "image:" {} \; | sed -r 's:^ +::' | tee ${branch}_dockerimagesfull.log
309   drawline
310   ls --format single-column -d */ | sed 's:/$::' | tee ${branch}_directories.log
311   drawline
312   cat ${branch}_dockerimagesfull.log | grep image | sed -r 's:image\:::' | sed -r 's:^ +::' | sed '/^[[:space:]]*$/d' >${branch}_dockerimages.log
313   drawline
314   ls --format single-column -d oom/kubernetes/*/ | tee ${branch}_oomkubernetes.log
315   drawline
316
317   # examine docs
318   readarray -t docs_array < ./${branch}_docs.log;
319
320   for line in "${docs_array[@]}"
321   do
322
323     echo $line | tee -a ${branch}_docsconfig.log
324
325     # remove [ and ] which are distinguish the project name in the output
326     line=$(echo $line | sed -r 's:\[:: ; s:\]::')
327
328     if [ -f ./${line}/conf.py ] ; then
329       echo "  conf.py ..... found" | tee -a ${branch}_docsconfig.log
330     else
331       echo "  conf.py ..... NOT FOUND" | tee -a ${branch}_docsconfig.log
332     fi
333
334     if [ -f ./${line}/index.rst ] ; then
335       echo "  index.rst ... found" | tee -a ${branch}_docsconfig.log
336     else
337       echo "  index.rst ... NOT FOUND" | tee -a ${branch}_docsconfig.log
338     fi
339
340     if [ -f ./${line}/tox.ini ] ; then
341       echo "  tox.ini ..... found" | tee -a ${branch}_docsconfig.log
342     else
343       echo "  tox.ini ..... NOT FOUND" | tee -a ${branch}_docsconfig.log
344     fi
345
346     echo " " | tee -a ${branch}_docsconfig.log
347
348   done
349   unset docs_array
350
351   drawline
352
353   ###
354   ### build a csv table that combines results
355   ###
356
357   #
358   # csv column #1: project name
359   #
360
361   readarray -t array < ./${repolist};
362   i=0
363   csv[i]="project"
364   ((i++))
365   for line in "${array[@]}"
366   do
367     reponame=$(echo $line | awk -F "|" '{print $1}');
368     project=$(echo $reponame | sed 's:/.*$::')
369     #echo "DBUG: reponame=${reponame}"
370     #echo "DBUG:  project=${project}"
371     #echo "DBUG:        i=${i}"
372     csv[i]=${project}
373     ((i++))
374   done
375   unset array
376   unset i
377   unset reponame
378   unset project
379
380   #
381   # csv column #2: repo name
382   #
383
384   readarray -t array < ./${repolist};
385   i=0
386   csv[i]="${csv[i]},MASTER repo name"
387   ((i++))
388   for line in "${array[@]}"
389   do
390     reponame=$(echo $line | awk -F "|" '{print $1}');
391     csv[i]="${csv[i]},${reponame}"
392     ((i++))
393   done
394   unset array
395   unset i
396   unset reponame
397
398   #
399   # csv column #3: repo state
400   #
401
402   readarray -t array < ./${repolist};
403   i=0
404   csv[i]="${csv[i]},MASTER repo state"
405   ((i++))
406   for line in "${array[@]}"
407   do
408     repostate=$(echo $line | awk -F "|" '{print $2}');
409     csv[i]="${csv[i]},${repostate}"
410     ((i++))
411   done
412   unset array
413   unset i
414   unset repostate
415
416   #
417   # csv column #4: clone message
418   #
419
420   readarray -t array < ./${branch}_repoclone.log;
421   i=0
422   csv[i]="${csv[i]},${branch_upper} clone message"
423   ((i++))
424   for line in "${array[@]}"
425   do
426     # repoclone.log format:  $1=gitexitcode|$2=reponame|$3=repostate|$4=errormsg
427     errormsg=$(echo $line | awk -F "|" '{print $4}');
428     csv[i]="${csv[i]},${errormsg}"
429     ((i++))
430   done
431   unset array
432   unset i
433   unset errormsg
434
435   #
436   # csv column #5: RELEASE component (yes|maybe|unknown)
437   # to be filled with values of the planned release config file maintained by
438   # the onap release manager
439   #
440
441   # repoclone.log format:  $1=gitexitcode|$2=reponame|$3=repostate|$4=errormsg
442   readarray -t array < ./${branch}_repoclone.log;
443   i=0
444   csv[i]="${csv[i]},${branch_upper} component"
445   ((i++))
446   for line in "${array[@]}"
447   do
448
449     # repoclone.log format:  $1=gitexitcode|$2=reponame|$3=repostate|$4=errormsg
450     gitexitcode=$(echo $line | awk -F "|" '{print $1}');
451        reponame=$(echo $line | awk -F "|" '{print $2}');
452       repostate=$(echo $line | awk -F "|" '{print $3}');
453        errormsg=$(echo $line | awk -F "|" '{print $4}');
454
455     if [[ ${repostate} == "ACTIVE" && ${gitexitcode} == "0" ]]; then
456       releasecomponent="yes"
457     elif [ ${repostate} == "ACTIVE" ]; then
458     #elif [[ ${repostate} == "ACTIVE" && ${gitexitcode} == "128" ]]; then
459       releasecomponent="maybe"
460     elif [[ ${repostate} == "READ_ONLY" && ${gitexitcode} == "0" ]]; then
461       releasecomponent="yes"
462     elif [ ${repostate} == "READ_ONLY" ]; then
463       releasecomponent="maybe"
464     else
465       releasecomponent="unknown"
466     fi
467
468     csv[i]="${csv[i]},${releasecomponent}"
469     ((i++))
470   done
471   unset array
472   unset i
473   unset gitexitcode
474   unset reponame
475   unset repostate
476   unset errormsg
477   unset releasecomponent
478
479   #
480   # csv column #6: docs (at repo root directory only; no recursive search!)
481   # csv column #7: conf.py
482   # csv column #8: tox.ini
483   # csv column #9: index.rst
484   #
485   # columns are filled with values from requested branch.
486   # if data is not available values from master branch are used.
487   # to identify master branch values, data is put into brackets "(...)"
488   #
489
490   readarray -t array < ./${repolist};
491   i=0
492   csv[$i]="${csv[i]},docs,conf.py,tox.ini,index.rst"
493   ((i++))
494   for line in "${array[@]}"
495   do
496     line=$(echo $line | sed 's:|.*$::')
497     #echo "DBUG: line=${line}"
498     #echo "DBUG: i=${i}"
499
500     # docs
501     if [ -d ./${line}/docs ] ; then
502       docs="docs"
503     elif [ -d ../master/${line}/docs ] ; then
504       docs="(docs)"
505     else
506       docs="-"
507     fi
508
509     # conf.py
510     if [ -f ./${line}/docs/conf.py ] ; then
511       docs="${docs},conf.py"
512     elif [ -f ../master/${line}/docs/conf.py ] ; then
513       docs="${docs},(conf.py)"
514     else
515       docs="${docs},-"
516     fi
517
518     # tox.ini
519     if [ -f ./${line}/docs/tox.ini ] ; then
520       docs="${docs},tox.ini"
521     elif [ -f ../master/${line}/docs/tox.ini ] ; then
522       docs="${docs},(tox.ini)"
523     else
524       docs="${docs},-"
525     fi
526
527     # index.rst
528     if [ -f ./${line}/docs/index.rst ] ; then
529       docs="${docs},index.rst"
530     elif [ -f ../master/${line}/docs/index.rst ] ; then
531       docs="${docs},(index.rst)"
532     else
533       docs="${docs},-"
534     fi
535
536     #echo "DBUG: docs=${docs}"
537     line="${csv[i]},${docs}"
538     csv[$i]=${line}
539     ((i++))
540   done
541   unset array
542   unset i
543   unset docs
544
545   #
546   # csv column #10: index.html@RTD accessibility check
547   # csv column #11: index.html url
548   #
549
550   readarray -t array < ./${branch}_repoclone.log;
551   i=0
552   csv[i]="${csv[i]},index.html@RTD,index.html url"
553   ((i++))
554   for line in "${array[@]}"
555   do
556     # repoclone.log format:  $1=gitexitcode|$2=reponame|$3=repostate|$4=errormsg
557     gitexitcode=$(echo $line | awk -F "|" '{print $1}');
558        reponame=$(echo $line | awk -F "|" '{print $2}');
559       repostate=$(echo $line | awk -F "|" '{print $3}');
560        errormsg=$(echo $line | awk -F "|" '{print $4}');
561
562             url=""
563     curl_result=""
564
565     # this script works only with release "frankfurt" and later because
566     # earlier releases are using submodule structure for documentation files
567     if echo "$branch" | grep -q '^[abcde]'; then
568       curl_result="unsupported release"
569       url="-"
570     else
571
572       # we are working on "frankfurt" branch or later ...
573       if [[ ${repostate} == "ACTIVE" ]] || [[ ${repostate} == "READ_ONLY" ]]; then
574
575         # OPTIONAL: USE ALSO GITEXITCODE AS A FILTER CRITERIA ???
576
577         # url base
578         # important! only doc project needs a different url base
579         if [[ ${reponame} == "doc" ]]; then
580           url_start="https://docs.onap.org"
581         else
582           url_start="https://docs.onap.org/projects/onap"
583         fi
584         url_lang="en"
585         url_branch=${branch}
586
587         # "master" branch documentation is available as "latest" in RTD
588         if [[ ${url_branch} == "master" ]]; then
589           url_branch="latest"
590         fi
591
592         # replace all / characters in repo name with - charachter
593         url_repo=$(echo ${reponame} | sed -r 's/\//-/g')
594         url_file="index.html"
595
596         # build the full url
597         if [[ ${reponame} == "doc" ]]; then
598           # build the full url for the doc project
599           url="${url_start}/${url_lang}/${url_branch}/${url_file}"
600         else
601           # build the full url for the other projects
602           url="${url_start}-${url_repo}/${url_lang}/${url_branch}/${url_file}"
603         fi
604         #echo "DBUG: url=$url"
605
606         # test accessibility of url
607         curl --head --silent --fail "${url}?${unique}" >/dev/null
608         curl_result=$?
609
610         # convert numeric results to text
611         if [ "${curl_result}" = "0" ]; then
612           curl_result="accessible"
613         elif [ "${curl_result}" = "22" ]; then
614           curl_result="does not exist"
615         else
616           curl_result="ERROR:${curl_result}"
617         fi
618
619         # url does not exist for this branch.
620         # in case the requested url is not already for "master" branch,
621         # we try to access the url of the master branch and denote the
622         # result by using round brackets (result)
623         if [[ ${curl_result} == "does not exist" && ! $branch == "master" ]]; then
624
625           # build the full (master/latest) url
626           url="${url_start}-${url_repo}/${url_lang}/latest/${url_file}"
627           #echo "DBUG: url=$url"
628
629           # test accessibility of url in "master branch" (latest)
630           curl --head --silent --fail "${url}?${unique}" >/dev/null
631           curl_result=$?
632           # denote result as a value from "master" branch (latest)
633           url="(${url})"
634
635           # convert numeric results to text
636           if [ "${curl_result}" = "0" ]; then
637             curl_result="(accessible)"
638           elif [ "${curl_result}" = "22" ]; then
639             curl_result="(does not exist)"
640           else
641             curl_result="(ERROR:${curl_result})"
642           fi
643
644         fi
645       else
646         # repostate IS NOT ACTIVE OR READ_ONLY - no curl test required
647         curl_result="-"
648         url="-"
649       fi
650     fi
651
652     echo "$url ... $curl_result"
653     csv[i]="${csv[i]},${curl_result},${url}"
654     #echo "DBUG: csv line=${csv[i]}"
655
656     ((i++))
657   done
658
659   #
660   # csv column #12: release notes
661   #
662
663   readarray -t array < ../${repolist};
664   i=0
665   csv[i]="${csv[i]},release notes"
666   ((i++))
667   for line in "${array[@]}"
668   do
669     line=$(echo $line | sed 's:|.*$::')
670     #echo "DBUG: line=\"${line}\""
671     #echo "DBUG: i=${i}"
672     relnote=""
673
674     # put repo name in square brackets for increased grep hit rate
675     # escape minus and bracket characters to avoid problems with the grep command
676     #repo_grepable=$(echo ${line} | sed -r s:${line}:[${line}]: | sed -r 's/-/\\-/g' | sed -r 's/\[/\\[/g' | sed -r 's/\]/\\]/g')
677     #echo "DBUG: repo_grepable=\"${repo_grepable}\""
678
679     # check if repo dir exists in this branch
680     if [ -d ./${line} ] ; then
681       # if yes, check if repo name appears in the branch releasenotes.log
682       relnote=$(find "./${line}" -type f | grep 'release.*note.*.rst' | wc -l);
683       #echo "DBUG: relnote=${relnote}"
684       # repo dir DOES NOT exist in this branch - so check if repo dir exists in MASTER branch
685     elif [ -d ../master/${line} ] ; then
686       # if yes, check if repo name appears in the MASTER releasenotes.log
687       # count release notes files in MASTER branch (in repo root and its subdirectories)
688       relnote=$(find "../master/${line}" -type f | grep 'release.*note.*.rst' | wc -l);
689       #echo "DBUG: relnote=${relnote}"
690       # put results in round brackets to show that this is MASTER data
691       relnote=$(echo ${relnote} | sed -r s:${relnote}:\(${relnote}\):)
692     else
693       relnote="-"
694     fi
695     #echo "DBUG: relnote=${relnote}"
696
697     line="${csv[i]},${relnote}"
698     csv[i]=${line}
699     ((i++))
700
701   done
702   unset array
703   unset i
704   unset relnote
705   unset repo_grepable
706
707   #
708   # build the table.csv file
709   #
710
711   for i in "${csv[@]}"
712   do
713     echo "$i" | tee -a ./${branch}_table.csv
714   done
715
716   #
717   # create data package for this branch and zip it
718   #
719
720   datadir=${branch}_data
721   mkdir $datadir
722   cp $repolist $datadir
723   cp ${branch}_table.csv $datadir
724   cp ${branch}_*.log $datadir
725   zip -r ${datadir}.zip $datadir
726
727   # return from the branch directory
728   cd ..
729
730 # return and work on the next requested branch ... or exit
731 done