-
Notifications
You must be signed in to change notification settings - Fork 393
/
Copy pathup_to_compliance_check.sh
executable file
·90 lines (74 loc) · 2.64 KB
/
up_to_compliance_check.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Created by argbash-init v2.5.0
# ARGBASH_SET_DELIM([ ])
# ARGBASH_SET_INDENT([ ])
# ARG_OPTION_STACKING([none])
# ARG_RESTRICT_VALUES([none])
# ARG_OPTIONAL_BOOLEAN([clean],[c],[Clean the repository before proceeding. Use with care, as you will lose all uncommitted local modifications and all untracked files.],[off])
# ARG_HELP([Compile OpenSCAP, perform tests and execute ABI check.])
# DEFINE_SCRIPT_DIR([])
# ARGBASH_GO()
# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.5.0 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
die()
{
local _ret=$2
test -n "$_ret" || _ret=1
test "$_PRINT_HELP" = yes && print_help >&2
echo "$1" >&2
exit ${_ret}
}
# THE DEFAULTS INITIALIZATION - OPTIONALS
_arg_clean=off
print_help ()
{
printf "%s\n" "Compile OpenSCAP, perform tests and execute ABI check."
printf 'Usage: %s [-c|--(no-)clean] [-h|--help]\n' "$0"
printf "\t%s\n" "-c,--clean,--no-clean: Clean the repository before proceeding. Use with care, as you will lose all uncommitted local modifications and all untracked files. (off by default)"
printf "\t%s\n" "-h,--help: Prints help"
echo
echo 'Short options stacking mode is not supported.'
}
parse_commandline ()
{
while test $# -gt 0
do
_key="$1"
case "$_key" in
-c|--no-clean|--clean)
_arg_clean="on"
test "${1:0:5}" = "--no-" && _arg_clean="off"
;;
-h|--help)
print_help
exit 0
;;
*)
_PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1
;;
esac
shift
done
}
parse_commandline "$@"
# OTHER STUFF GENERATED BY Argbash
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || die "Couldn't determine the script's running directory, which probably matters, bailing out" 2
### END OF CODE GENERATED BY Argbash (sortof) ### ])
# [ <-- needed because of Argbash
. "$script_dir/release.sh"
build_stderr=build-stderr.log
build_stdout=build-stdout.log
if [ "$_arg_clean" = "on" ]; then
echo Cleaning the repository...
clean_repository
clean_repository_aggressively
fi
echo Checking whether the repository is clean...
check_for_clean_repo
echo Building and executing tests...
execute_local_tests > "$build_stdout" 2> "$build_stderr" || die "The build or tests failed, check '$build_stdout' and '$build_stderr' for errors."
echo Arranging the API check...
check_abi
# ] <-- needed because of Argbash