11 if [ "$outstr" != "" ]; then
16 echo "This script is used to validate the rpm builds for each edition."
17 echo "The script will compare the different editions against each other"
18 echo "to identify the proper filters when starting the controller,"
19 echo "list the dependencies in the different editions and identify"
20 echo "any inconsistencies between the edition poms and the project specs."
22 echo "Usage: `basename $0` [OPTION...]"
25 echo " --options OPTIONS List of test options. Available options:"
26 echo " integration: compare integration editions"
27 echo " pom: get pom dependencies from integration poms"
28 echo " spec: compare projects specs against the pom dependencies"
29 echo " --gitdir DIR git root directory where projects are cloned"
32 echo " -?, -h, --h, --help Display this help and exit"
38 function parse_options {
42 shift; options="$1"; shift
46 shift; gitdir="$1"; shift
47 if [ "$gitdir" = "" ]; then
48 usage 1 "Missing directory.";
52 -? | -h | --h | --help)
59 echo "Ignoring unknown option: $1"; shift;
64 function array_contains () {
68 for element in "${!array}"; do
69 if [ $element = $seeking ]; then
78 function compare_integration () {
82 echo "========================================================================="
83 echo " Comparing dirs"
84 echo "========================================================================="
86 cd $gitdir/integration
89 basezip=$(find . -name "*distributions-base*.zip")
90 unzip -qd /tmp/base $basezip
93 virtzip=$(find . -name "*distributions-virtualization*.zip")
94 unzip -qd /tmp/virt $virtzip
97 spzip=$(find . -name "*distributions-serviceprovider*.zip")
98 unzip -qd /tmp/sp $spzip
100 # Compare one edition against another.
103 echo "Compare base and virt:"
104 echo "-------------------------------------------------------------------------"
105 diff -qr /tmp/base/opendaylight/ /tmp/virt/opendaylight/
107 echo "Compare base and sp:"
108 echo "-------------------------------------------------------------------------"
109 diff -qr /tmp/base/opendaylight/ /tmp/sp/opendaylight/
111 echo "Compare virt and sp:"
112 echo "-------------------------------------------------------------------------"
113 diff -qr /tmp/virt/opendaylight/ /tmp/sp/opendaylight/
115 # Compare one edition against the other two.
117 rm -rf /tmp/base_virt
119 cp -rf /tmp/base/* /tmp/base_virt/
120 cp -rf /tmp/virt/* /tmp/base_virt/
124 cp -rf /tmp/base/* /tmp/base_sp/
125 cp -rf /tmp/sp/* /tmp/base_sp/
129 cp -rf /tmp/virt/* /tmp/virt_sp/
130 cp -rf /tmp/sp/* /tmp/virt_sp/
134 echo "Compare base and virt_sp."
135 echo "-------------------------------------------------------------------------"
136 diff -qr /tmp/base/opendaylight/ /tmp/virt_sp/opendaylight/
138 echo "Compare virt and base_sp. Useful to see what virt pulls in - look for Only in /tmp/virt."
139 echo "-------------------------------------------------------------------------"
140 diff -qr /tmp/virt/opendaylight/ /tmp/base_sp/opendaylight/
142 echo "Compare sp and base_virt. Useful to see what sp pulls in - look for Only in /tmp/sp."
143 echo "-------------------------------------------------------------------------"
144 diff -qr /tmp/sp/opendaylight/ /tmp/base_virt/opendaylight/
147 function check_affinity () {
148 # allaffinity=$(find /tmp/virt -name "*affinity.*.jar")
149 # while read line; do
154 function read_dom () {
156 read -d \< ENTITY CONTENT
159 function read_poms () {
161 local distribution="$2"
162 local pomfile=$gitdir/integration/distributions/$distribution/pom.xml
169 echo "read_poms $gitdir $distribution"
170 echo "-------------------------------------------------------------------------"
175 if [ "$ENTITY" = "dependencies" ]; then
185 editions[i]=$distribution
189 if [ $groups -eq 1 ]; then
190 artifactIds[i]=$CONTENT
195 if [ $groups -eq 1 ]; then
212 for index in `seq $pomcnt $end`; do
213 echo "$index artifact: ${groupIds[$index]}.${artifactIds[$index]}-${versions[$index]}"
219 function check_poms () {
224 echo "========================================================================="
225 echo " Checking poms"
226 echo "========================================================================="
228 read_poms "$gitdir" "base"
229 read_poms "$gitdir" "serviceprovider"
230 read_poms "$gitdir" "virtualization"
233 function read_spec () {
236 local specfile=$gitdir/integration/packaging/rpm/opendaylight-$project.spec
244 echo "read_spec $gitdir $project"
245 echo "-------------------------------------------------------------------------"
250 if [ "$line" = "done <<'.'" ]; then
256 if [ "$line" = "." ]; then
267 for index in ${!specarts[*]}; do
268 echo "$index spec artifact: ${specarts[$index]}"
273 function check_project () {
276 local specfile=$gitdir/integration/packaging/rpm/opendaylight-$project.specfile
283 echo "check_project $gitdir $project"
284 echo "-------------------------------------------------------------------------"
286 read_spec "$gitdir" "$project"
288 for i in ${!groupIds[*]}; do
289 if [ ${groupIds[$i]} = "org.opendaylight.$project" ]; then
291 for j in ${!specarts[*]}; do
292 specart=$(echo ${specarts[$j]} | sed -e "s/-\*.*//")
293 artifactId=${artifactIds[$i]}
294 if [ "$specart" = "$artifactId" ]; then
300 if [ $found -eq 0 ]; then
301 notfoundeds[k]=${editions[$i]}
302 notfoundarts[k]=${artifactIds[$i]}
308 for index in ${!notfoundarts[*]}; do
309 echo ">>>>> $index missing artifact: ${notfoundeds[$index]}: ${notfoundarts[$index]}"
313 function check_specs () {
317 echo "========================================================================="
318 echo " Checking specs"
319 echo "========================================================================="
321 check_project "$gitdir" "affinity"
322 check_project "$gitdir" "bgpcep"
323 check_project "$gitdir" "lispflowmapping"
324 check_project "$gitdir" "snmp4sdn"
325 check_project "$gitdir" "yangtools"
331 if [ ! -d "$dir" ]; then
332 usage 1 "Invalid path."