Print a more descriptive error message if setting up the build environment fails
This commit is contained in:
		
							parent
							
								
									95c74eae26
								
							
						
					
					
						commit
						f406288cc7
					
				
					 1 changed files with 14 additions and 3 deletions
				
			
		|  | @ -825,6 +825,11 @@ private: | ||||||
|     HashRewrites rewritesToTmp, rewritesFromTmp; |     HashRewrites rewritesToTmp, rewritesFromTmp; | ||||||
|     PathSet redirectedOutputs; |     PathSet redirectedOutputs; | ||||||
| 
 | 
 | ||||||
|  |     /* Magic exit code denoting that setting up the child environment
 | ||||||
|  |        failed.  (It's possible that the child actually returns the | ||||||
|  |        exit code, but ah well.) */ | ||||||
|  |     const static int childSetupFailed = 189; | ||||||
|  | 
 | ||||||
| public: | public: | ||||||
|     DerivationGoal(const Path & drvPath, Worker & worker); |     DerivationGoal(const Path & drvPath, Worker & worker); | ||||||
|     ~DerivationGoal(); |     ~DerivationGoal(); | ||||||
|  | @ -1348,6 +1353,8 @@ void DerivationGoal::buildDone() | ||||||
|         /* Check the exit status. */ |         /* Check the exit status. */ | ||||||
|         if (!statusOk(status)) { |         if (!statusOk(status)) { | ||||||
|             deleteTmpDir(false); |             deleteTmpDir(false); | ||||||
|  |             if (WIFEXITED(status) && WEXITSTATUS(status) == childSetupFailed) | ||||||
|  |                 throw Error(format("failed to set up the build environment for `%1%'") % drvPath); | ||||||
|             throw BuildError(format("builder for `%1%' %2%") |             throw BuildError(format("builder for `%1%' %2%") | ||||||
|                 % drvPath % statusToString(status)); |                 % drvPath % statusToString(status)); | ||||||
|         } |         } | ||||||
|  | @ -1872,6 +1879,8 @@ void DerivationGoal::initChild() | ||||||
|     /* Warning: in the child we should absolutely not make any SQLite
 |     /* Warning: in the child we should absolutely not make any SQLite
 | ||||||
|        calls! */ |        calls! */ | ||||||
| 
 | 
 | ||||||
|  |     bool inSetup = true; | ||||||
|  | 
 | ||||||
|     try { /* child */ |     try { /* child */ | ||||||
| 
 | 
 | ||||||
| #if CHROOT_ENABLED | #if CHROOT_ENABLED | ||||||
|  | @ -2023,15 +2032,17 @@ void DerivationGoal::initChild() | ||||||
|         restoreSIGPIPE(); |         restoreSIGPIPE(); | ||||||
| 
 | 
 | ||||||
|         /* Execute the program.  This should not return. */ |         /* Execute the program.  This should not return. */ | ||||||
|  |         inSetup = false; | ||||||
|         execve(program.c_str(), (char * *) &args[0], (char * *) envArr); |         execve(program.c_str(), (char * *) &args[0], (char * *) envArr); | ||||||
| 
 | 
 | ||||||
|         throw SysError(format("executing `%1%'") |         throw SysError(format("executing `%1%'") % drv.builder); | ||||||
|             % drv.builder); |  | ||||||
| 
 | 
 | ||||||
|     } catch (std::exception & e) { |     } catch (std::exception & e) { | ||||||
|         std::cerr << format("build error: %1%") % e.what() << std::endl; |         std::cerr << format("build error: %1%") % e.what() << std::endl; | ||||||
|  |         quickExit(inSetup ? childSetupFailed : 1); | ||||||
|     } |     } | ||||||
|     quickExit(1); | 
 | ||||||
|  |     abort(); /* never reached */ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue