Pin pip to 20.3.3 and disable tmpfs in DIB
[ta/build-tools.git] / create_rpmdata_in_docker.sh
1 #!/bin/bash
2 # Copyright 2019 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -ex
17
18 scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
19 source $scriptdir/lib.sh
20
21 docker_image=buildtools
22 _load_docker_image $docker_image
23
24 function _resolve_abs_path() {
25   if ! echo $1 | grep -q "^/"; then
26     echo $(pwd)/$1
27   else
28     echo $1
29   fi
30 }
31
32 input_dir=$(_resolve_abs_path ${1:?ERROR, please give input dir as argument})
33 output_dir=$(_resolve_abs_path ${2:?ERROR, please give output dir as argument})
34 shift; shift
35
36 # Run!
37 input_mp=/input
38 output_mp=/output
39 docker run \
40   --network=host \
41   --rm \
42   -e PYTHONPATH=/work \
43   -e BUILD_URL -e JENKINS_USERNAME -e JENKINS_TOKEN -e WORK \
44   -v $scriptdir:/work \
45   -v $input_dir:$input_mp \
46   -v $output_dir:$output_mp \
47   -w /work \
48   $docker_image \
49   python tools/script/create_rpm_data.py \
50     --build-config-path $input_mp/build_config.ini \
51     --yum-info-path $input_mp/yum_info_installed \
52     --rpm-info-path $input_mp/rpm_info_installed \
53     --crypto-info-path $input_mp/crypto_rpms.json \
54     --boms-path $input_mp/boms \
55     --output-json $output_mp/rpmdata.json \
56     --output-csv $output_mp/rpmdata.csv \
57     --output-ms-csv $output_mp/rpmdata-ms.csv \
58     --output-rpmlist $output_mp/rpmlist \
59     $*
60
61 docker run \
62   --network=host \
63   --rm \
64   -e PYTHONPATH=/work \
65   -v $scriptdir:/work \
66   -v $output_dir:$output_mp \
67   -w /work \
68   $docker_image \
69   python tools/script/process_rpmdata.py \
70     --rpmdata-path $output_mp/rpmdata.json \
71     --output-components $output_mp/components.json \
72     --output-components-csv $output_mp/components-ms.csv \
73