mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-10-31 05:54:03 +00:00 
			
		
		
		
	Catch OSErrors when creating directories (LP: #671067)
This commit is contained in:
		
							parent
							
								
									7126a9e894
								
							
						
					
					
						commit
						04eb3ada8b
					
				
							
								
								
									
										1
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							| @ -15,6 +15,7 @@ ubuntu-dev-tools (0.107) UNRELEASED; urgency=low | |||||||
|     packages. 3.0 (quilt) has optional per-vendor patch series. |     packages. 3.0 (quilt) has optional per-vendor patch series. | ||||||
|   * pbuilder-dist: |   * pbuilder-dist: | ||||||
|     - Refactor to use subprocess.popen instead of os.system (LP: #398974) |     - Refactor to use subprocess.popen instead of os.system (LP: #398974) | ||||||
|  |     - Catch OSErrors when creating directories (LP: #671067) | ||||||
| 
 | 
 | ||||||
|   [ Benjamin Drung ] |   [ Benjamin Drung ] | ||||||
|   * wrap-and-sort: Remove duplicate items from sorted lists. |   * wrap-and-sort: Remove duplicate items from sorted lists. | ||||||
|  | |||||||
| @ -89,8 +89,13 @@ class pbuilder_dist: | |||||||
| 		 | 		 | ||||||
| 		self.base = os.path.expanduser(os.environ.get('PBUILDFOLDER', '~/pbuilder/')) | 		self.base = os.path.expanduser(os.environ.get('PBUILDFOLDER', '~/pbuilder/')) | ||||||
| 
 | 
 | ||||||
| 		if not os.path.exists(self.base): | 		if not os.path.isdir(self.base): | ||||||
|  | 			try: | ||||||
| 				os.makedirs(self.base) | 				os.makedirs(self.base) | ||||||
|  | 			except os.OSError: | ||||||
|  | 				print >> stderr, ('Error: Cannot create base directory "%s"' | ||||||
|  | 				                  % self.base) | ||||||
|  | 				exit(1) | ||||||
| 		 | 		 | ||||||
| 		if 'PBUILDAUTH' in os.environ: | 		if 'PBUILDAUTH' in os.environ: | ||||||
| 			self.auth = os.environ['PBUILDAUTH'] | 			self.auth = os.environ['PBUILDAUTH'] | ||||||
| @ -182,8 +187,12 @@ class pbuilder_dist: | |||||||
| 			self.logfile = os.path.normpath('%s/last_operation.log' % result) | 			self.logfile = os.path.normpath('%s/last_operation.log' % result) | ||||||
| 		 | 		 | ||||||
| 		if not os.path.isdir(result): | 		if not os.path.isdir(result): | ||||||
| 			# Create the results directory, if it doesn't exist. | 			try: | ||||||
| 				os.makedirs(result) | 				os.makedirs(result) | ||||||
|  | 			except os.OSError: | ||||||
|  | 				print >> stderr, ('Error: Cannot create results directory "%s"' | ||||||
|  | 				                  % result) | ||||||
|  | 				exit(1) | ||||||
| 		 | 		 | ||||||
| 		if self.builder == 'pbuilder': | 		if self.builder == 'pbuilder': | ||||||
| 			base = '--basetgz "%s-base.tgz"' % prefix | 			base = '--basetgz "%s-base.tgz"' % prefix | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user