2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
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 ##############################################################################
12 # This script performs version bumping activities for an ODL release.
13 echo "---> compare-autorelease-projects.sh"
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.
18 # Note: int/dist pom files uses templates only since Oxygen release.
19 # Todo: Remove this check after Carbon and Nitrogen EOL
20 if [[ $STREAM =~ carbon ]] || [[ $STREAM =~ nitrogen ]]; then
24 mapfile -t PROJECTS_INT_DIST < <(xmlstarlet sel\
25 -N "x=http://maven.apache.org/POM/4.0.0"\
26 -t -m "/x:project/x:profiles/x:profile[x:activation/x:activeByDefault='true']/x:dependencies/x:dependency/x:groupId"\
28 -n integration/distribution/features/repos/index/pom.xml 2>/dev/null | sort -u)
30 # process projects in int/dist read from pom.xml file
31 declare -a project_int_dist
32 for project in "${PROJECTS_INT_DIST[@]}"; do
33 if [[ $project =~ project.groupId ]] || [[ $project =~ odlparent ]]; then
35 elif [[ $project =~ org.opendaylight ]]; then
36 project=$(echo "${project/org.opendaylight./}")
37 project_int_dist+=( "$(echo "${project/.//}" )" )
41 project_int_dist+=("mdsal")
42 project_int_dist+=("integration/distribution")
44 # Get a list of all the projects from releng/autorelease repo
46 mapfile -t project_AR < <(git submodule status | awk -e '{print $2}' | sort | uniq)
48 # Use associative arrays to get diff in the projects lists
49 declare -A map_AR map_intdist
50 for project in "${project_AR[@]}"
52 ((map_AR[$project]++))
55 for project in "${project_int_dist[@]-0}"
57 ((map_intdist[$project]++))
60 for project in "${!map_AR[@]}"
62 if (( ${map_AR[$project]} >= 1 && ${map_intdist[$project]-0} >= 1 )); then
63 unset "map_AR[$project]" "map_intdist[$project]"
67 result=("${!map_AR[@]}" "${!map_intdist[@]}")
69 if [ "${#result[@]}" != "0" ]; then
70 if [ "${#map_AR[@]}" != "0" ]; then
71 echo "WARNING: List of projects in releng/autorelease but NOT in integration/distribution: ${!map_AR[*]}"
72 elif [ "${#map_intdist[@]}" != "0" ]; then
73 echo "ERROR: List of projects in integration/distribution but NOT in releng/autorelease: ${!map_intdist[*]}"
77 echo "List of projects releng/autorelease and integration/distribution repositories are equal"