Remove mdsal from autorelease handling
[releng/builder.git] / jjb / autorelease / compare-autorelease-projects.sh
1 #!/bin/bash -l
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11
12 # This script performs version bumping activities for an ODL release.
13 echo "---> compare-autorelease-projects.sh"
14
15 # The purpose of this script is to compare list of projects in autorelease
16 # are equal to the list of projects in integration/distribution.
17
18 mapfile -t PROJECTS_INT_DIST < <(xmlstarlet sel\
19      -N "x=http://maven.apache.org/POM/4.0.0"\
20      -t -m "/x:project/x:profiles/x:profile[x:activation/x:activeByDefault='true']/x:dependencies/x:dependency/x:groupId"\
21      -v .\
22      -n integration/distribution/features/repos/index/pom.xml 2>/dev/null | sort -u)
23
24 # process projects in int/dist read from pom.xml file
25 declare -a project_int_dist
26 for project in "${PROJECTS_INT_DIST[@]}"; do
27     if [[ $project =~ project.groupId ]] || [[ $project =~ odlparent ]]; then
28         continue
29     elif [[ $project =~ org.opendaylight ]]; then
30         project=$(echo "${project/org.opendaylight./}")
31         project_int_dist+=( "$(echo "${project/.//}" )" )
32     fi
33 done
34
35 project_int_dist+=("integration/distribution")
36
37 # Get a list of all the projects from releng/autorelease repo
38 declare -a project_AR
39 mapfile -t project_AR < <(git submodule status | awk -e '{print $2}' | sort | uniq)
40
41 # Use associative arrays to get diff in the projects lists
42 declare -A map_AR map_intdist
43 for project in "${project_AR[@]}"
44 do
45     ((map_AR[$project]++))
46 done
47
48 for project in "${project_int_dist[@]-0}"
49 do
50     ((map_intdist[$project]++))
51 done
52
53 for project in "${!map_AR[@]}"
54 do
55     if (( ${map_AR[$project]} >= 1 && ${map_intdist[$project]-0} >= 1 )); then
56         unset "map_AR[$project]" "map_intdist[$project]"
57     fi
58 done
59
60 result=("${!map_AR[@]}" "${!map_intdist[@]}")
61
62 if [ "${#result[@]}" != "0" ]; then
63     if [ "${#map_AR[@]}" != "0"  ]; then
64         echo "WARNING: List of projects in releng/autorelease but NOT in integration/distribution: ${!map_AR[*]}"
65     elif [ "${#map_intdist[@]}" != "0"  ]; then
66         echo "ERROR: List of projects in integration/distribution but NOT in releng/autorelease: ${!map_intdist[*]}"
67         exit 1
68     fi
69 else
70     echo "List of projects releng/autorelease and integration/distribution repositories are equal"
71 fi