]> git.ozlabs.org Git - next-scripts/blob - common.sh
update to_build_host a bit
[next-scripts] / common.sh
1 #
2 # Common setup for linux-next scripts
3 #
4
5 # Just in case this gets included twice ...
6 [ "$_next_common_included" ] && return 0
7 _next_common_included=1
8
9 bin_dir=$(realpath $(dirname "$0"))
10 top_dir=$(dirname "$bin_dir")
11
12 [ "$LOG_FILE" ] || LOG_FILE="$top_dir/merge.log"
13 SHA1_FILE="$top_dir/SHA1s"
14 CTRL_FILE="$top_dir/etc/control"
15
16 build_host="ash"
17 build_dir="/home/sfr/next/next"
18 gcc_version="4.9.0"
19 j_factor=$(nproc)
20 gpg_key=89F91C0A41D5C07A
21 kup_gpg_key=015042F34957D06C
22
23 [ "$NEXT_BUILD_HOST" ] && {
24         build_host="$NEXT_BUILD_HOST"
25         [ "$build_host" = "none" ] && build_host=""
26 }
27 [ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR"
28 [ "$NEXT_GCC_VERSION" ] && gcc_version="$NEXT_GCC_VERSION"
29 gcc_ppc_version=$gcc_version
30 [ "$NEXT_GCC_PPC_VERSION" ] && gcc_ppc_version="$NEXT_GCC_PPC_VERSION"
31 gcc_ppcle_version=$gcc_ppc_version
32 [ "$NEXT_GCC_PPCLE_VERSION" ] && gcc_ppcle_version="$NEXT_GCC_PPCLE_VERSION"
33 [ "$NEXT_J_FACTOR" ] && j_factor="$NEXT_J_FACTOR"
34
35 [ -n "$1" ] && {
36         build_host="$1"
37         shift
38 }
39 [ -n "$1" ] && {
40         build_dir="$1"
41         shift
42 }
43
44 export NEXT_BUILD_HOST="${build_host:-none}"
45 export NEXT_BUILD_DIR="$build_dir"
46 export NEXT_GCC_VERSION="$gcc_version"
47 export NEXT_GCC_PPC_VERSION="$gcc_ppc_version"
48 export NEXT_GCC_PPCLE_VERSION="$gcc_ppcle_version"
49 export NEXT_J_FACTOR="$j_factor"
50
51 # Support functions
52 get_contacts()
53 {
54         awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $1; }' $CTRL_FILE
55 }
56
57 get_url()
58 {
59         awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $4; }' $CTRL_FILE
60 }
61
62 get_build_flag()
63 {
64         awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $6; }' $CTRL_FILE
65 }
66
67 check_unmerged_files()
68 {
69         local tree="$1"
70         local um_files
71         local rm_files
72
73         um_files=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p')
74         if [ "$um_files" ] && [ -f "../merge-files/$tree" ]; then
75                 rm_files=$(grep -F "$um_files" "../merge-files/$tree")
76                 if [ "$rm_files" ]; then
77                         "$bin_dir/do_rm" $rm_files
78                 fi
79         fi
80 }
81
82 true