summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/scripts/_build_set_common.sh
blob: 43e26d83cce365d6ec14439a75294d390f4c0335 (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
71
72
73
74
75
#!/bin/bash

# Load common code and initialization
. ./_build_common.sh
init_common

_BUILDSET_TIMER=1
_BUILDSET_TIME="--/--:--:--:---"

parm_SKIP_FETCH="n"     # if "y" skips N packages from the list
parm_SKIP_N=0           # this argument represents the number of packages to skip
SKIP_cnt=0


#----------------------------
# do_exit for set building
function do_exit()
{
	cd "$SCRIPT_DIR"
	if [ $1 -eq 0 ]; then
		echo -e "${CGray}####  Building process for set \"${0##*/}\" completed  ####${CNone}"
	else
		echo -e "${CGray}####  Building process for set \"${0##*/}\" interrupted ($1)  ####${CNone}"
	fi
	exit $1
}


#----------------------------
function set_log_start()
{
  echo -e "${CGray}####  Starting building process for set \"${0##*/}\"  ####${CNone}"
  echo
  echo "----------  ${0##*/}  ----------" >>"$LOG_RESULT_FILENAME"
  exec_time_start $_BUILDSET_TIMER
}


#----------------------------
function set_log_end()
{
  exec_time_stop $_BUILDSET_TIMER "_BUILDSET_TIME"
  echo "          [$_BUILDSET_TIME]  SET ${0##*/}" >>"$LOG_RESULT_FILENAME"
  echo >>"$LOG_RESULT_FILENAME"
  do_exit 0
}


#----------------------------
function build_module()
{
  if [ $parm_SKIP_N -gt 0 -a $SKIP_cnt -lt $parm_SKIP_N ]; then
    SKIP_cnt=$((SKIP_cnt+1))
  else
    ./build_module.sh "$BUILD_DEFAULT_OPTIONS $@"
    echo
  fi
}


#----------------------------
# Check command line arguments
#----------------------------
for arg in $@; do
  if [ "$parm_SKIP_FETCH" = "y" ]; then
    parm_SKIP_N=$arg
		parm_SKIP_FETCH="n"BUILD_DEFAULT_OPTIONS
	elif [ "$arg" = "-s" ]; then    		# skip first N packages
		parm_SKIP_FETCH="y"
	fi
done
if [ "$parm_SKIP_FETCH" = "y" ]; then
  echo "Invalid command line arguments ($@)"
  do_exit 3
fi