mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-03 23:44:19 +00:00 
			
		
		
		
	Config file support for ack-sync
This commit is contained in:
		
							parent
							
								
									692627c771
								
							
						
					
					
						commit
						3f776be478
					
				
							
								
								
									
										39
									
								
								ack-sync
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								ack-sync
									
									
									
									
									
								
							@ -28,6 +28,7 @@ import logging
 | 
				
			|||||||
import glob
 | 
					import glob
 | 
				
			||||||
import fnmatch
 | 
					import fnmatch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from ubuntutools.config import UDTConfig
 | 
				
			||||||
from ubuntutools.lp.libsupport import get_launchpad
 | 
					from ubuntutools.lp.libsupport import get_launchpad
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COMMAND_LINE_SYNTAX_ERROR = 1
 | 
					COMMAND_LINE_SYNTAX_ERROR = 1
 | 
				
			||||||
@ -147,8 +148,9 @@ def unsubscribe_sponsors(launchpad, bug):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main(bug_numbers, all_package, all_version, all_section, update,
 | 
					def main(bug_numbers, all_package, all_version, all_section, update,
 | 
				
			||||||
         all_uploader_email, key, upload, verbose=False, silent=False):
 | 
					         all_uploader_email, key, upload, lpinstance, verbose=False,
 | 
				
			||||||
	launchpad = get_launchpad("ubuntu-dev-tools")
 | 
					         silent=False):
 | 
				
			||||||
 | 
						launchpad = get_launchpad("ubuntu-dev-tools", server=lpinstance)
 | 
				
			||||||
	# TODO: use release-info (once available)
 | 
						# TODO: use release-info (once available)
 | 
				
			||||||
	series = launchpad.distributions["ubuntu"].current_series
 | 
						series = launchpad.distributions["ubuntu"].current_series
 | 
				
			||||||
	dist = series.name
 | 
						dist = series.name
 | 
				
			||||||
@ -300,8 +302,11 @@ def usage():
 | 
				
			|||||||
  -e,                       specify uploader email address
 | 
					  -e,                       specify uploader email address
 | 
				
			||||||
  -h, --help                displays this help
 | 
					  -h, --help                displays this help
 | 
				
			||||||
  -k, --key                 key used to sign the package (in case of sponsoring)
 | 
					  -k, --key                 key used to sign the package (in case of sponsoring)
 | 
				
			||||||
 | 
					      --lpinstance=<instance> Launchpad instance to connect to
 | 
				
			||||||
 | 
					                            (default: production)
 | 
				
			||||||
  -l, --lvm                 lvm root dev directory, used for sbuild and piuparts
 | 
					  -l, --lvm                 lvm root dev directory, used for sbuild and piuparts
 | 
				
			||||||
                            default is /dev/vg
 | 
					                            default is /dev/vg
 | 
				
			||||||
 | 
					      --no-conf             Don't read config files or environment variables
 | 
				
			||||||
  -p, --package=<package>   set the package
 | 
					  -p, --package=<package>   set the package
 | 
				
			||||||
  -P, --with-piuparts       use piuparts to check the instalability
 | 
					  -P, --with-piuparts       use piuparts to check the instalability
 | 
				
			||||||
      --section=<section>   Debian section (one of main, contrib, non-free)
 | 
					      --section=<section>   Debian section (one of main, contrib, non-free)
 | 
				
			||||||
@ -318,7 +323,7 @@ if __name__ == '__main__':
 | 
				
			|||||||
	try:
 | 
						try:
 | 
				
			||||||
		long_opts = ["help", "key=", "lvm=", "package=", "section=", "silent",
 | 
							long_opts = ["help", "key=", "lvm=", "package=", "section=", "silent",
 | 
				
			||||||
				"update", "upload", "verbose", "version=", "with-sbuild",
 | 
									"update", "upload", "verbose", "version=", "with-sbuild",
 | 
				
			||||||
				"pbuilder=", "with-piuparts"]
 | 
									"pbuilder=", "with-piuparts", "lpinstance=", "no-conf"]
 | 
				
			||||||
		opts, args = getopt.gnu_getopt(sys.argv[1:], "e:hk:p:PsSC:uUvV:", long_opts)
 | 
							opts, args = getopt.gnu_getopt(sys.argv[1:], "e:hk:p:PsSC:uUvV:", long_opts)
 | 
				
			||||||
	except getopt.GetoptError, e:
 | 
						except getopt.GetoptError, e:
 | 
				
			||||||
		# will print something like "option -a not recognized"
 | 
							# will print something like "option -a not recognized"
 | 
				
			||||||
@ -335,9 +340,11 @@ if __name__ == '__main__':
 | 
				
			|||||||
	verbose = False
 | 
						verbose = False
 | 
				
			||||||
	version = None
 | 
						version = None
 | 
				
			||||||
	piuparts = False
 | 
						piuparts = False
 | 
				
			||||||
	pbuilder = 'pbuilder'
 | 
						pbuilder = None
 | 
				
			||||||
	lvm = "/dev/vg"
 | 
						lvm = "/dev/vg"
 | 
				
			||||||
	key = None
 | 
						key = None
 | 
				
			||||||
 | 
						lpinstance = None
 | 
				
			||||||
 | 
						no_conf = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for o, a in opts:
 | 
						for o, a in opts:
 | 
				
			||||||
		if o in ("-h", "--help"):
 | 
							if o in ("-h", "--help"):
 | 
				
			||||||
@ -347,8 +354,12 @@ if __name__ == '__main__':
 | 
				
			|||||||
			uploader_email = a
 | 
								uploader_email = a
 | 
				
			||||||
		elif o in ("-k", "--key"):
 | 
							elif o in ("-k", "--key"):
 | 
				
			||||||
			key = a
 | 
								key = a
 | 
				
			||||||
 | 
							elif o in ("--lpinstance"):
 | 
				
			||||||
 | 
								lpinstance = a
 | 
				
			||||||
		elif o in ("-l", "--lvm"):
 | 
							elif o in ("-l", "--lvm"):
 | 
				
			||||||
			lvm = a
 | 
								lvm = a
 | 
				
			||||||
 | 
							elif o in ("--no-conf"):
 | 
				
			||||||
 | 
								no_conf = True
 | 
				
			||||||
		elif o in ("-p", "--package"):
 | 
							elif o in ("-p", "--package"):
 | 
				
			||||||
			package = a
 | 
								package = a
 | 
				
			||||||
		elif o in ("-P", "--with-piuparts"):
 | 
							elif o in ("-P", "--with-piuparts"):
 | 
				
			||||||
@ -360,7 +371,7 @@ if __name__ == '__main__':
 | 
				
			|||||||
		elif o in ("-S", "--with-sbuild"):
 | 
							elif o in ("-S", "--with-sbuild"):
 | 
				
			||||||
			sbuild = True
 | 
								sbuild = True
 | 
				
			||||||
		elif o in ("-C", "--pbuilder"):
 | 
							elif o in ("-C", "--pbuilder"):
 | 
				
			||||||
		    pbuilder=a
 | 
								pbuilder=a
 | 
				
			||||||
		elif o in ("-u", "--update"):
 | 
							elif o in ("-u", "--update"):
 | 
				
			||||||
			update = True
 | 
								update = True
 | 
				
			||||||
		elif o in ("-U", "--upload"):
 | 
							elif o in ("-U", "--upload"):
 | 
				
			||||||
@ -387,5 +398,21 @@ if __name__ == '__main__':
 | 
				
			|||||||
			sys.exit(COMMAND_LINE_SYNTAX_ERROR)
 | 
								sys.exit(COMMAND_LINE_SYNTAX_ERROR)
 | 
				
			||||||
		bug_numbers.append(number)
 | 
							bug_numbers.append(number)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						config = UDTConfig(no_conf)
 | 
				
			||||||
 | 
						if lpinstance is None:
 | 
				
			||||||
 | 
							lpinstance = config.get_value('LPINSTANCE')
 | 
				
			||||||
 | 
						if pbuilder is None and not sbuild:
 | 
				
			||||||
 | 
							builder = config.get_value('BUILDER')
 | 
				
			||||||
 | 
							if builder == 'pbuilder':
 | 
				
			||||||
 | 
								pbuilder = 'pbuilder'
 | 
				
			||||||
 | 
							elif builder == 'sbuild':
 | 
				
			||||||
 | 
								sbuild = True
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								print >> sys.stderr, "E: Unsupported build-system: %s" % builder
 | 
				
			||||||
 | 
								sys.exit(COMMAND_LINE_SYNTAX_ERROR)
 | 
				
			||||||
 | 
						if not update:
 | 
				
			||||||
 | 
							update = config.get_value('UPDATE_BUILDER', boolean=True)
 | 
				
			||||||
 | 
						#TODO: Support WORKDIR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	main(bug_numbers, package, version, section, update, uploader_email, key,
 | 
						main(bug_numbers, package, version, section, update, uploader_email, key,
 | 
				
			||||||
		upload, verbose, silent)
 | 
							upload, lpinstance, verbose, silent)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user