forked from elastic/ml-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdependency_report.sh
executable file
·55 lines (48 loc) · 1.45 KB
/
dependency_report.sh
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
#!/bin/bash
#
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License;
# you may not use this file except in compliance with the Elastic License.
#
#
# Create a CSV file listing the information about our 3rd party dependencies
# that is required for the stack-wide list.
#
# Usage:
# dependency_report.sh --csv <output_file>
#
# The format is that defined in https://github.com/elastic/release-manager/issues/207,
# i.e. a CSV file with the following fields:
#
# name,version,revision,url,license,copyright
#
# The way this script works, each component must have its own CSV file with
# those fields, and this script simply combines them into a single CSV file.
# Because of this, the field order is important - in each per-component CSV
# file the fields must be in the order shown above.
OUTPUT_FILE=
if [ "x$1" = "x--csv" ] ; then
OUTPUT_FILE="$2"
elif [[ "x$1" == x--csv=* ]] ; then
OUTPUT_FILE="${1#--csv=}"
fi
if [ -z "$OUTPUT_FILE" ] ; then
echo "Usage: $0 --csv <output_file>"
exit 1
fi
exec > "$OUTPUT_FILE"
SCRIPT_DIR=`dirname "$0"`
cd "$SCRIPT_DIR"
# IMPORTANT: this assumes all the *INFO.csv files have the following header:
#
# name,version,revision,url,license,copyright
FIRST=yes
for INFO_FILE in licenses/*INFO.csv
do
if [ "$FIRST" = yes ] ; then
cat $INFO_FILE
FIRST=no
else
grep -v '^name,' $INFO_FILE
fi
done