Switch global-jjb jobs to use mvn35
[releng/builder.git] / jjb / packaging / build-rpm-snap.sh
1 #!/bin/bash
2
3 # Options:
4 #   -x: Echo commands
5 #   -e: Fail on errors
6 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
7 set -ex -o pipefail
8
9 # Install required packages
10 virtualenv rpm_build
11 # shellcheck disable=SC1091
12 source rpm_build/bin/activate
13 PYTHON="rpm_build/bin/python"
14 $PYTHON -m pip install --upgrade pip
15 $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt"
16
17 # Convert stream to numeric ODL major version
18 if [ "$STREAM" == "carbon" ]; then
19   VERSION_MAJOR=6
20 elif [ "$STREAM" == "nitrogen" ]; then
21   VERSION_MAJOR=7
22 elif [ "$STREAM" == "oxygen" ]; then
23   VERSION_MAJOR=8
24 elif [ "$STREAM" == "fluorine" ]; then
25   VERSION_MAJOR=9
26 else
27   echo "Unable to convert stream to major version"
28   exit 1
29 fi
30
31 # Build the latest snapshot matching the given major minor version
32 "$WORKSPACE/packaging/packages/build.py" --rpm \
33                                          --changelog_name "$CHANGELOG_NAME" \
34                                          --changelog_email "$CHANGELOG_EMAIL" \
35                                          latest_snap \
36                                          --major "$VERSION_MAJOR"
37