@@ -208,20 +208,18 @@ function install_local_homebrew(local_homebrew_dir, local_brew_path)
208
208
209
209
# Post-install setup with better error handling
210
210
try
211
- # Set environment variables for local Homebrew
212
- homebrew_env = copy (ENV )
213
- homebrew_env[" HOMEBREW_NO_AUTO_UPDATE" ] = " 1"
214
- homebrew_env[" HOMEBREW_NO_INSTALL_CLEANUP" ] = " 1"
215
- homebrew_env[" HOMEBREW_NO_ANALYTICS" ] = " 1"
216
- homebrew_env[" HOMEBREW_CACHE" ] = joinpath (local_homebrew_dir, " cache" )
217
- homebrew_env[" HOMEBREW_TEMP" ] = joinpath (local_homebrew_dir, " temp" )
218
- homebrew_env[" TMPDIR" ] = joinpath (local_homebrew_dir, " temp" )
219
-
220
211
# Create cache and temp directories
221
- mkpath (homebrew_env[" HOMEBREW_CACHE" ])
222
- mkpath (homebrew_env[" HOMEBREW_TEMP" ])
223
-
224
- withenv (homebrew_env) do
212
+ cache_dir = joinpath (local_homebrew_dir, " cache" )
213
+ temp_dir = joinpath (local_homebrew_dir, " temp" )
214
+ mkpath (cache_dir)
215
+ mkpath (temp_dir)
216
+
217
+ withenv (" HOMEBREW_NO_AUTO_UPDATE" => " 1" ,
218
+ " HOMEBREW_NO_INSTALL_CLEANUP" => " 1" ,
219
+ " HOMEBREW_NO_ANALYTICS" => " 1" ,
220
+ " HOMEBREW_CACHE" => cache_dir,
221
+ " HOMEBREW_TEMP" => temp_dir,
222
+ " TMPDIR" => temp_dir) do
225
223
run (` $local_brew_path update --force --quiet` )
226
224
end
227
225
catch e
@@ -240,37 +238,43 @@ function install_coveralls_with_homebrew(brew_cmd, reporter_info, coveralls_path
240
238
homebrew_type = use_local_homebrew ? " local Homebrew" : " system Homebrew"
241
239
@info " Installing Coveralls reporter via $homebrew_type ..."
242
240
243
- # Set up environment for local Homebrew
244
- homebrew_env = copy (ENV )
245
- if use_local_homebrew
241
+ # Set up environment variables for local Homebrew
242
+ local_env_vars = if use_local_homebrew
246
243
local_homebrew_dir = dirname (dirname (brew_cmd)) # Get parent of bin directory
247
- homebrew_env[" HOMEBREW_NO_AUTO_UPDATE" ] = " 1"
248
- homebrew_env[" HOMEBREW_NO_INSTALL_CLEANUP" ] = " 1"
249
- homebrew_env[" HOMEBREW_NO_ANALYTICS" ] = " 1"
250
- homebrew_env[" HOMEBREW_CACHE" ] = joinpath (local_homebrew_dir, " cache" )
251
- homebrew_env[" HOMEBREW_TEMP" ] = joinpath (local_homebrew_dir, " temp" )
252
- homebrew_env[" TMPDIR" ] = joinpath (local_homebrew_dir, " temp" )
253
- homebrew_env[" HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK" ] = " 1"
254
- homebrew_env[" HOMEBREW_FORCE_BREWED_CURL" ] = " 1"
255
- homebrew_env[" HOMEBREW_NO_ENV_HINTS" ] = " 1"
256
- homebrew_env[" HOMEBREW_QUIET" ] = " 1"
244
+ cache_dir = joinpath (local_homebrew_dir, " cache" )
245
+ temp_dir = joinpath (local_homebrew_dir, " temp" )
257
246
258
247
# Ensure directories exist
259
- mkpath (homebrew_env[ " HOMEBREW_CACHE " ] )
260
- mkpath (homebrew_env[ " HOMEBREW_TEMP " ] )
248
+ mkpath (cache_dir )
249
+ mkpath (temp_dir )
261
250
262
251
# Set additional permissions to handle CI environments
263
252
try
264
- chmod (homebrew_env[ " HOMEBREW_CACHE " ] , 0o755 )
265
- chmod (homebrew_env[ " HOMEBREW_TEMP " ] , 0o755 )
253
+ chmod (cache_dir , 0o755 )
254
+ chmod (temp_dir , 0o755 )
266
255
catch e
267
256
@debug " Could not set directory permissions: $e "
268
257
end
258
+
259
+ [
260
+ " HOMEBREW_NO_AUTO_UPDATE" => " 1" ,
261
+ " HOMEBREW_NO_INSTALL_CLEANUP" => " 1" ,
262
+ " HOMEBREW_NO_ANALYTICS" => " 1" ,
263
+ " HOMEBREW_CACHE" => cache_dir,
264
+ " HOMEBREW_TEMP" => temp_dir,
265
+ " TMPDIR" => temp_dir,
266
+ " HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK" => " 1" ,
267
+ " HOMEBREW_FORCE_BREWED_CURL" => " 1" ,
268
+ " HOMEBREW_NO_ENV_HINTS" => " 1" ,
269
+ " HOMEBREW_QUIET" => " 1"
270
+ ]
271
+ else
272
+ []
269
273
end
270
274
271
275
# Add tap (ignore failures)
272
276
try
273
- withenv (homebrew_env ) do
277
+ withenv (local_env_vars ... ) do
274
278
run (` $brew_cmd tap $(reporter_info. tap) ` )
275
279
end
276
280
catch e
@@ -280,7 +284,7 @@ function install_coveralls_with_homebrew(brew_cmd, reporter_info, coveralls_path
280
284
# Install coveralls
281
285
install_cmd = force ? " reinstall" : " install"
282
286
try
283
- withenv (homebrew_env ) do
287
+ withenv (local_env_vars ... ) do
284
288
# For local Homebrew, try to install with more permissive settings
285
289
if use_local_homebrew
286
290
run (` $brew_cmd $install_cmd $(reporter_info. package) --force-bottle` )
0 commit comments