3
0
mirror of https://git.launchpad.net/ubuntu-dev-tools synced 2025-03-13 08:01:09 +00:00

Config file support for ack-sync

This commit is contained in:
Stefano Rivera 2010-12-21 22:12:05 +02:00
parent 692627c771
commit 3f776be478

@ -28,6 +28,7 @@ import logging
import glob
import fnmatch
from ubuntutools.config import UDTConfig
from ubuntutools.lp.libsupport import get_launchpad
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,
all_uploader_email, key, upload, verbose=False, silent=False):
launchpad = get_launchpad("ubuntu-dev-tools")
all_uploader_email, key, upload, lpinstance, verbose=False,
silent=False):
launchpad = get_launchpad("ubuntu-dev-tools", server=lpinstance)
# TODO: use release-info (once available)
series = launchpad.distributions["ubuntu"].current_series
dist = series.name
@ -300,8 +302,11 @@ def usage():
-e, specify uploader email address
-h, --help displays this help
-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
default is /dev/vg
--no-conf Don't read config files or environment variables
-p, --package=<package> set the package
-P, --with-piuparts use piuparts to check the instalability
--section=<section> Debian section (one of main, contrib, non-free)
@ -318,7 +323,7 @@ if __name__ == '__main__':
try:
long_opts = ["help", "key=", "lvm=", "package=", "section=", "silent",
"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)
except getopt.GetoptError, e:
# will print something like "option -a not recognized"
@ -335,9 +340,11 @@ if __name__ == '__main__':
verbose = False
version = None
piuparts = False
pbuilder = 'pbuilder'
pbuilder = None
lvm = "/dev/vg"
key = None
lpinstance = None
no_conf = False
for o, a in opts:
if o in ("-h", "--help"):
@ -347,8 +354,12 @@ if __name__ == '__main__':
uploader_email = a
elif o in ("-k", "--key"):
key = a
elif o in ("--lpinstance"):
lpinstance = a
elif o in ("-l", "--lvm"):
lvm = a
elif o in ("--no-conf"):
no_conf = True
elif o in ("-p", "--package"):
package = a
elif o in ("-P", "--with-piuparts"):
@ -360,7 +371,7 @@ if __name__ == '__main__':
elif o in ("-S", "--with-sbuild"):
sbuild = True
elif o in ("-C", "--pbuilder"):
pbuilder=a
pbuilder=a
elif o in ("-u", "--update"):
update = True
elif o in ("-U", "--upload"):
@ -387,5 +398,21 @@ if __name__ == '__main__':
sys.exit(COMMAND_LINE_SYNTAX_ERROR)
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,
upload, verbose, silent)
upload, lpinstance, verbose, silent)