aboutsummaryrefslogtreecommitdiff
path: root/android-lcr/common/builders.sh
blob: 8eba8a63586877c8aa7df5c43cb596489f1f6d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

# Install needed packages
sudo apt-get update

# Here is for packages not listed by the source.android.com site below.
# But the following packages might not be really necessary,
# as the docker image for docker-focal-aosp labelled nodes is linaro/jenkins-amd64-ubuntu:focal
# which is defined here: https://git.linaro.org/infrastructure/ci-yadp-builder.git/tree/docker_templates_aosp_amd64.yml#n2
# And the packages listed here might be already defined there.
sudo apt-get install -y --allow-change-held-packages wget sudo python3 python-is-python3 openjdk-11-jdk-headless
java -version

## https://source.android.com/docs/setup/start/requirements#hardware-requirements
sudo apt-get install -y --allow-change-held-packages git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 libncurses5 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig

# Install jinja2-cli and ruamel.yaml==0.16.13
pip install --user --force-reinstall jinja2-cli ruamel.yaml==0.16.13 pycryptodome pycryptodomex
pip3 install --user --force-reinstall pycryptodome pycryptodomex ruamel.yaml Jinja2

# Set local configuration
git config --global user.email "ci_notify@linaro.org"
git config --global user.name "Linaro CI"
java -version

BUILD_DIR=${BUILD_DIR:-${JOB_NAME}}
if [ ! -d "/home/buildslave/srv/${BUILD_DIR}" ]; then
  sudo mkdir -p /home/buildslave/srv/${BUILD_DIR}
  sudo chmod 777 /home/buildslave/srv/${BUILD_DIR}
fi
cd /home/buildslave/srv/${BUILD_DIR}

# temporary workaround to clean the workspace for android-cts and android-vts builds
if [ "X${BUILD_DIR}" == "Xandroid-cts" ] || [ "X${BUILD_DIR}" == "Xandroid-vts" ]; then
    rm -fr /home/buildslave/srv/${BUILD_DIR}/*
    rm -fr /home/buildslave/srv/${BUILD_DIR}/.repo
fi
# clean the out directory as this workspace is used accross multiple builds
rm -fr .repo-backup
[ -d "build/.repo" ] && mv -f build/.repo .repo-backup
rm -fr build/ && mkdir -p build/
[ -d "build/.repo-backup" ] && mv -f .repo-backup build/.repo
[ -d "build/.repo/local_manifests" ] && rm -fr build/.repo/local_manifests

# Download helper scripts (repo)
mkdir -p ${HOME}/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ${HOME}/bin/repo
chmod a+x ${HOME}/bin/*
export PATH=${HOME}/bin:${PATH}

# Install helper packages
rm -rf build-tools jenkins-tools build-configs build/bionic build/frameworks/base build/system/core build/device build/out build/android-patchsets build/kernel/ti/x15 build/kernel/hikey-linaro build/hardware/interfaces
rm -fr build/external/optee_test build/external/optee_client build/optee/optee_os build/optee/edk2 build/device/linaro/kmgk
rm -fr build/external/u-boot
git clone --depth 1 https://git.linaro.org/infrastructure/linaro-android-build-tools.git build-tools
git clone --depth 1 https://git.linaro.org/infrastructure/linaro-jenkins-tools.git jenkins-tools
git clone --depth 1 http://android-git.linaro.org/git/android-build-configs.git build-configs

set -xe
# Define job configuration's repo
export BUILD_CONFIG_FILENAME=${BUILD_CONFIG_FILENAME:-${JOB_NAME#android-*}}
cat << EOF > config.txt
BUILD_CONFIG_REPO=http://android-git.linaro.org/git/android-build-configs.git
BUILD_CONFIG_BRANCH=master
EOF
echo config.txt
export CONFIG=`base64 -w 0 config.txt`
export SKIP_LICENSE_CHECK=1

# still not in the build directory