This repository was archived by the owner on Mar 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
154 lines (129 loc) · 4.74 KB
/
configure.ac
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# configure.ac
# ===============================
# Project: administratrix GitOps
# Purpose: directory-based configuration of unattended 'GitOps Agent'
# Author: Tiara Rodney <[email protected]>
# ===============================
#
#
AC_PREREQ([2.69])
AC_INIT([administratrix GitOps], [1.0], [[email protected]])
echo $0
if test "$(basename $0)" '=' 'configure'; then
GITOPS_PATH="$(realpath $(dirname $0))"
fi
# The git origin associated with this GitOps distribution.
GITOPS_GIT_URL='[email protected]:administratrix/gitops.git'
# The local path to the base directory of GitOps distribution
# The local path to the base directory of the GitOps distribution, should it
# not be git submodule
GITOPS_PROTO_PATH='.gitops'
#needs to be exported, because not defined in client configure.ac
export GITOPS_ENV_PATH="gitops.env"
# List of auxiliary files to check
AUTOMAKE_FILES="$GITOPS_ENV_PATH .deps compile install-sh missing AUTHORS ChangeLog INSTALL NEWS COPYING depcomp"
# it's not too bad if these files don't get deleted, thats why they're separate
DEBUG_FILES="config.status config.log autom4te.cache aclocal.m4"
LS_SNAPSHOT=$(ls -a)
ARG_ROLLBACK=yes
# ==============================================================================
# Flag
# ==============================================================================
AC_ARG_WITH([exposed-patch],
[AS_HELP_STRING([--with-exposed-patch],
[Keep the patched ./configure.ac after autoconf @<:@default=no@:>@])],
[with_exposed_patch_flag=$withval],
[with_exposed_patch_flag=no])
AC_ARG_WITH([porcelain-git],
[AS_HELP_STRING([--without-porcelain-git],
[do not consider git status @<:@default=no@:>@])],
[ARG_PORCELAIN_GIT=$withval])
# ==============================================================================
# Macro: check for staged git files
# ==============================================================================
# MY_MSG_ERROR([ERROR])
# should be called instead of, AC_MGS_ERROR, if an execution failure would leave
# the local directory in a broken state
# --------------------------------------
AC_DEFUN([MY_MSG_ERROR], [
REVERT
AC_MSG_ERROR([$1])
])
AC_DEFUN([ENFORCE_PORCELAIN_GIT], [
test "$ARG_PORCELAIN_GIT" '!=' 'yes' && {
AC_MSG_ERROR([
refusing to continue without porcelain git.
`--without-porcelain-git`, at this point, is illegal.
])
}
])
# REMOVE_ORPHANED(FILE_LIST)
# --------------------------------------
# Remove auxiliary files that were not present before running this
AC_DEFUN([REMOVE_ORPHANED], [
for file in $1; do
if ! test -f $file && ! test -d $file; then
continue
fi
AC_MSG_CHECKING([fate of file './$file'])
match=0
for _file in $LS_SNAPSHOT; do
if test "$_file" '=' "$file"; then
match=1
fi
done
if test $match -eq 0 && test "$ARG_ROLLBACK" '=' 'yes'; then
AC_MSG_RESULT([orphan (remove)])
rm -r $file
elif test "$ARG_ROLLBACK" '=' 'no'; then
AC_MSG_RESULT([keep (no rollback)])
else
AC_MSG_RESULT([keep])
fi
done
])
# REVERT()
# --------------------------------------
AC_DEFUN([REVERT], [
AC_MSG_NOTICE([reverting...])
REMOVE_ORPHANED([$AUTOMAKE_FILES])
])
# tell the environment auditor not to snapshot the environment
_QUIET=1
# queue of the environment auditor
#TODO: move the
export GITOPS_ENV_CHECKS=''
printf '=== Git ===\n'
m4_include([configure.ac-git.m4])
printf '=== GitOps ===\n'
m4_include([configure.ac-gitops.m4])
printf '=== Framework ===\n'
m4_include([configure.ac-framework.m4])
printf '=== CI/CD Pipeline ===\n'
m4_include([configure.ac-cicd.m4])
printf '=== Autoconf ===\n'
m4_include([configure.ac-autoconf.m4])
printf '=== Configure ===\n'
m4_include([configure.ac-exec.m4])
printf '=== Environment Audit ===\n'
m4_include([configure.ac-gitops-audit.m4])
printf '=== Automake ===\n'
m4_include([configure.ac-automake.m4])
printf '=== Makefile ===\n'
m4_include([configure.ac-makefile.m4])
AC_OUTPUT
# Call the cleanup macro after configure
AC_CONFIG_COMMANDS_POST([REMOVE_ORPHANED([$AUTOMAKE_FILES])])
AC_CONFIG_COMMANDS_POST([REMOVE_ORPHANED([$DEBUG_FILES])])
dnl# clear the default help message.
m4_cleardivert([HELP_BEGIN])dnl
m4_cleardivert([HELP_CANON])dnl
m4_cleardivert([HELP_ENABLE])dnl
m4_cleardivert([HELP_WITH])dnl
m4_cleardivert([HELP_VAR])dnl
m4_cleardivert([HELP_VAR_END])dnl
m4_cleardivert([HELP_END])dnl
dnl# custom help message with man page
m4_divert_push([HELP_BEGIN])dnl
test "$ac_init_help" '=' "long" && { $(dirname "$(realpath "$0")")/man configure; exit 1; }
m4_divert_pop([HELP_BEGIN])dnl