Fix: Strip path prefix in dirname
[releng/builder.git] / jjb / integration / distribution / distribution-check-verify-groupid.sh
1 #!/bin/bash -l
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2024 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 "---> distribution-check-verify-groupid.sh"
14
15 echo "These are allowed projects: $ALLOW_PROJECTS"
16 echo "These are distribution pulled projects:"
17 EXIT_CODE="0"
18 for PROJECT in /tmp/r/org/opendaylight/*; do
19     if [[ ! -d "$PROJECT" ]]; then
20         continue
21     fi
22     echo "Checking $PROJECT"
23     # strip path from the dirname
24     base_dir="$(basename -- "$PROJECT")"
25     if [[ "$ALLOW_PROJECTS" != *"$base_dir"* ]]; then
26         echo "ERROR: Not allowed project $PROJECT pulled"
27         EXIT_CODE="1"
28     fi
29 done
30 exit $EXIT_CODE