Update cloud image list docs
[releng/builder.git] / jjb / include-raw-check-poms.sh
1 #!/bin/bash
2
3 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
4 ##############################################################################
5 # Copyright (c) 2015 The Linux Foundation and others.
6 #
7 # All rights reserved. This program and the accompanying materials
8 # are made available under the terms of the Eclipse Public License v1.0
9 # which accompanies this distribution, and is available at
10 # http://www.eclipse.org/legal/epl-v10.html
11 #
12 # Contributors:
13 #   Thanh Ha (The Linux Foundation) - Initial implementation
14 ##############################################################################
15
16 # Clear workspace
17 rm -rf -- "${WORKSPACE:?}"/*
18
19 # Create python script to parse json
20 cat > "${WORKSPACE}/parse_json.py" << EOF
21 import json
22 import sys
23
24 obj=json.load(sys.stdin)
25 for key in obj.keys():
26     print(key)
27
28 EOF
29
30 # Clone all ODL projects
31 curl -s --header "Accept: application/json" \
32     https://git.opendaylight.org/gerrit/projects/ | \
33     tail -n +2 > "${WORKSPACE}/projects.json"
34 for p in $(python "${WORKSPACE}/parse_json.py" < "${WORKSPACE}/projects.json")
35 do
36     # Ignore non-projects and archived projects
37     if [ "$p" == "All-Users" ] || \
38        [ "$p" == "affinity" ] || \
39        [ "$p" == "integration" ] || \
40        [ "$p" == "net-virt-platform" ] || \
41        [ "$p" == "opendove" ] || \
42        [ "$p" == "plugin2oc" ] || \
43        # Also ignore projects known to deploy to non-ODL repositories
44        [ "$p" == "yangide" ]
45     then
46         continue
47     fi
48     mkdir -p "$(dirname "$p")"
49     git clone "https://git.opendaylight.org/gerrit/$p.git" "$p"
50 done
51
52 # Check pom.xml for <repositories> and <pluginRepositories>
53 FILE=repos.txt
54
55 find . -name pom.xml -print0 | xargs -0 grep -i '<repositories>\|<pluginRepositories>' > "$FILE"
56 [[ $(tr -d "\r\n" < $FILE|wc -c) -eq 0 ]] && rm $FILE
57
58 if [ -a $FILE ]
59 then
60     cat $FILE
61     echo "[ERROR] Repos with <repositories> and/or <pluginRepositories> sections found!"
62     exit 1
63 fi