Browse Source

let modules to be easily disabled

belliash 7 years ago
parent
commit
916260efa9
2 changed files with 52 additions and 40 deletions
  1. 51
    40
      ezsync
  2. 1
    0
      libraries/common

+ 51
- 40
ezsync View File

@@ -49,6 +49,9 @@ until [[ -z "${1}" ]]; do
49 49
 		-s|--syscheck)
50 50
 			EZOPT_SYSCHECKONLY=true
51 51
 			;;
52
+		-t|--notrigger)
53
+			EZOPT_NOTRIGGER=true
54
+			;;
52 55
 		*)
53 56
 			die "Unrecognized option ${1}"
54 57
 			;;
@@ -98,16 +101,18 @@ eval `keychain --noask --eval id_dsa id_rsa &> /dev/null`
98 101
 [ ${?} -ne 0 ] && die "EzBuild was unable to load public keys!" 1
99 102
 
100 103
 # Execute all 'presync' enabled modules
101
-for MODULE in ${MODULES_PRESYNC}; do
102
-	loadModule ${MODULE} "presync"
103
-	RESULT=${?}
104
-	if [ ${RESULT} -eq 255 ]; then
105
-		printWarn "Trying to load module: ${MODULE}, that is incompatible with event: presync!"
106
-	elif [ ${RESULT} -ne 0 ]; then
107
-		fail "EzBuild was unable to execute module: ${MODULE}!" 255
108
-	fi
109
-	unloadModule
110
-done
104
+if ! isEnabled ${EZOPT_NOTRIGGER}; then
105
+	for MODULE in ${MODULES_PRESYNC}; do
106
+		loadModule ${MODULE} "presync"
107
+		RESULT=${?}
108
+		if [ ${RESULT} -eq 255 ]; then
109
+			printWarn "Trying to load module: ${MODULE}, that is incompatible with event: presync!"
110
+		elif [ ${RESULT} -ne 0 ]; then
111
+			fail "EzBuild was unable to execute module: ${MODULE}!" 255
112
+		fi
113
+		unloadModule
114
+	done
115
+fi
111 116
 
112 117
 # Update local copy of Portage that is being built
113 118
 printInfo "Refreshing constructed Portage tree..."
@@ -142,16 +147,18 @@ for OVERLAY in ${SYNC_OVERLAYS[*]}; do
142 147
 done
143 148
 
144 149
 # Execute all 'postsync' enabled modules
145
-for MODULE in ${MODULES_POSTSYNC}; do
146
-	loadModule ${MODULE} "postsync"
147
-	RESULT=${?}
148
-	if [ ${RESULT} -eq 255 ]; then
149
-		printWarn "Trying to load module: ${MODULE}, that is incompatible with event: postsync!"
150
-	elif [ ${RESULT} -ne 0 ]; then
151
-		fail "EzBuild was unable to execute module: ${MODULE}!" 255
152
-	fi
153
-	unloadModule
154
-done
150
+if ! isEnabled ${EZOPT_NOTRIGGER}; then
151
+	for MODULE in ${MODULES_POSTSYNC}; do
152
+		loadModule ${MODULE} "postsync"
153
+		RESULT=${?}
154
+		if [ ${RESULT} -eq 255 ]; then
155
+			printWarn "Trying to load module: ${MODULE}, that is incompatible with event: postsync!"
156
+		elif [ ${RESULT} -ne 0 ]; then
157
+			fail "EzBuild was unable to execute module: ${MODULE}!" 255
158
+		fi
159
+		unloadModule
160
+	done
161
+fi
155 162
 
156 163
 # Optionally merge data into build overlay
157 164
 if isSet MERGED_OVERLAY && isSet OVERLAY_BUILD; then
@@ -184,16 +191,18 @@ for OVERLAY in ${MERGED_PORTAGE[*]}; do
184 191
 done
185 192
 
186 193
 # Execute all 'precommit' enabled modules
187
-for MODULE in ${MODULES_PRECOMMIT}; do
188
-	loadModule ${MODULE} "precommit"
189
-	RESULT=${?}
190
-	if [ ${RESULT} -eq 255 ]; then
191
-		printWarn "Trying to load module: ${MODULE}, that is incompatible with event: precommit!"
192
-	elif [ ${RESULT} -ne 0 ]; then
193
-		fail "EzBuild was unable to execute module: ${MODULE}!" 255
194
-	fi
195
-	unloadModule
196
-done
194
+if ! isEnabled ${EZOPT_NOTRIGGER}; then
195
+	for MODULE in ${MODULES_PRECOMMIT}; do
196
+		loadModule ${MODULE} "precommit"
197
+		RESULT=${?}
198
+		if [ ${RESULT} -eq 255 ]; then
199
+			printWarn "Trying to load module: ${MODULE}, that is incompatible with event: precommit!"
200
+		elif [ ${RESULT} -ne 0 ]; then
201
+			fail "EzBuild was unable to execute module: ${MODULE}!" 255
202
+		fi
203
+		unloadModule
204
+	done
205
+fi
197 206
 
198 207
 # Regenerate Portage cache
199 208
 printInfo "Updating constructed Portage cache..."
@@ -208,16 +217,18 @@ if ! isEnabled ${EZOPT_NOPUSH}; then
208 217
 fi
209 218
 
210 219
 # Execute all 'postcommit' enabled modules
211
-for MODULE in ${MODULES_POSTCOMMIT}; do
212
-	loadModule ${MODULE} "postcommit"
213
-	RESULT=${?}
214
-	if [ ${RESULT} -eq 255 ]; then
215
-		printWarn "Trying to load module: ${MODULE}, that is incompatible with event: postcommit!"
216
-	elif [ ${RESULT} -ne 0 ]; then
217
-		fail "EzBuild was unable to execute module: ${MODULE}!" 255
218
-	fi
219
-	unloadModule
220
-done
220
+if ! isEnabled ${EZOPT_NOTRIGGER}; then
221
+	for MODULE in ${MODULES_POSTCOMMIT}; do
222
+		loadModule ${MODULE} "postcommit"
223
+		RESULT=${?}
224
+		if [ ${RESULT} -eq 255 ]; then
225
+			printWarn "Trying to load module: ${MODULE}, that is incompatible with event: postcommit!"
226
+		elif [ ${RESULT} -ne 0 ]; then
227
+			fail "EzBuild was unable to execute module: ${MODULE}!" 255
228
+		fi
229
+		unloadModule
230
+	done
231
+fi
221 232
 
222 233
 # Finally quit the application
223 234
 quit

+ 1
- 0
libraries/common View File

@@ -422,6 +422,7 @@ function showEzsyncUsage() {
422 422
 	echo -e "  -p\t--purge\t\tclears temporary folder"
423 423
 	echo -e "  -P\t--purgeonly\tclears temporary folder and exits"
424 424
 	echo -e "  -s\t--syscheck\tperforms prerequisites check only"
425
+	echo -e "  -t\t--notrigger\tdisables all build triggers and modules"
425 426
 	echo -e "\nEXAMPLES:"
426 427
 	echo -e "   ezsync -c -n mainline"
427 428
 	echo -e "   ezsync -n mainline -n my_repo1"

Loading…
Cancel
Save