本文整理汇总了Python中gitbuildsys.log.LOGGER类的典型用法代码示例。如果您正苦于以下问题:Python LOGGER类的具体用法?Python LOGGER怎么用?Python LOGGER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LOGGER类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _check_passwd
def _check_passwd(self):
'convert passwd item to passwdx and then update origin conf files'
dirty = set()
all_sections = set()
for layer in self._cfgparsers:
for sec in layer.sections():
all_sections.add(sec)
for sec in all_sections:
for key in self.options(sec):
if key.endswith('passwd'):
for cfgparser in self._cfgparsers:
if cfgparser.has_option(sec, key):
plainpass = cfgparser.get(sec, key)
if plainpass is None:
# empty string password is acceptable here
continue
cfgparser.set_into_file(sec,
key + 'x',
encode_passwd(plainpass),
key)
dirty.add(cfgparser)
if dirty:
log.warning('plaintext password in config files will '
'be replaced by encoded ones')
self.update(dirty)
示例2: export_sources
def export_sources(repo, commit, export_dir, spec, args):
"""
Export packaging files using git-buildpackage
"""
tmp = utils.Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'),
directory=True)
gbp_args = create_gbp_export_args(repo, commit, export_dir, tmp.path,
spec, args)
try:
ret = gbp_build(gbp_args)
if ret == 2 and not is_native_pkg(repo, args):
# Try falling back to old logic of one monolithic tarball
log.warning("Generating upstream tarball and/or generating "
"patches failed. GBS tried this as you have "
"upstream branch in you git tree. This is a new "
"mode introduced in GBS v0.10. "
"Consider fixing the problem by either:\n"
" 1. Update your upstream branch and/or fix the "
"spec file. Also, check the upstream tag format.\n"
" 2. Remove or rename the upstream branch")
log.info("Falling back to the old method of generating one "
"monolithic source archive")
gbp_args = create_gbp_export_args(repo, commit, export_dir,
tmp.path, spec, args,
force_native=True)
ret = gbp_build(gbp_args)
if ret:
raise GbsError("Failed to export packaging files from git tree")
except GitRepositoryError, excobj:
raise GbsError("Repository error: %s" % excobj)
示例3: export_sources
def export_sources(repo, commit, export_dir, spec, args, create_tarball=True):
"""
Export packaging files using git-buildpackage
"""
tmp = utils.Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'),
directory=True)
gbp_args = create_gbp_export_args(repo, commit, export_dir, tmp.path,
spec, args, create_tarball=create_tarball)
try:
ret = gbp_build(gbp_args)
if ret == 2 and not is_native_pkg(repo, args):
# Try falling back to old logic of one monolithic tarball
log.error("Generating upstream tarball and/or generating patches "
"failed. GBS tried this as you have upstream branch in "
"you git tree. Fix the problem by either:\n"
" 1. Update your upstream branch and/or fix the spec "
"file. Also, check the upstream tag format.\n"
" 2. Remove or rename the upstream branch (change the "
"package to native)\n"
"See https://source.tizen.org/documentation/reference/"
"git-build-system/upstream-package for more details.")
if ret:
raise GbsError("Failed to export packaging files from git tree")
except GitRepositoryError, excobj:
raise GbsError("Repository error: %s" % excobj)
示例4: main
def main(args):
"""gbs pull entry point."""
# Determine upstream branch
upstream_branch = configmgr.get_arg_conf(args, 'upstream_branch')
# Construct GBP cmdline arguments
gbp_args = ['dummy argv[0]',
'--color-scheme=magenta:green:yellow:red',
'--pristine-tar',
'--upstream-branch=%s' % upstream_branch,
'--packaging-branch=master']
if args.depth:
gbp_args.append('--depth=%s' % args.depth)
if args.force:
gbp_args.append('--force=clean')
if args.all:
gbp_args.append('--all')
if args.debug:
gbp_args.append("--verbose")
# Clone
log.info('updating from remote')
ret = do_pull(gbp_args)
if ret == 2:
raise GbsError('Failed to update some of the branches!')
elif ret:
raise GbsError('Update failed!')
log.info('finished')
示例5: main
def main(args):
"""gbs chroot entry point."""
build_root = args.buildroot
running_lock = '%s/not-ready' % build_root
if os.path.exists(running_lock):
raise GbsError('build root %s is not ready' % build_root)
log.info('chroot %s' % build_root)
user = 'abuild'
if args.root:
user = 'root'
cmd = ['sudo', 'chroot', build_root, 'su', user]
try:
subprocess.call(['sudo', 'cp', '/etc/resolv.conf', build_root + \
'/etc/resolv.conf'])
except OSError:
log.warning('failed to setup /etc/resolv.conf')
try:
build_env = os.environ
build_env['PS1'] = "(tizen-build-env)@\h \W]\$ "
subprocess.call(cmd, env=build_env)
except OSError, err:
raise GbsError('failed to chroot to %s: %s' % (build_root, err))
示例6: main
def main(args):
"""gbs submit entry point."""
workdir = args.gitdir
orphan_packaging = configmgr.get('packaging_branch', 'orphan-devel')
if orphan_packaging and args.commit == 'HEAD':
log.error("You seem to be submitting a development branch of an "
"(orphan) packaging branch. Please export your changes to"
"the packaging branch with 'gbs devel export' and submit"
"from there.")
raise GbsError("Refusing to submit from devel branch")
message = args.msg
if message is None:
message = get_message()
if not message:
raise GbsError("tag message is required")
try:
repo = RpmGitRepository(workdir)
commit = repo.rev_parse(args.commit)
current_branch = repo.get_branch()
except GitRepositoryError, err:
raise GbsError(str(err))
示例7: check_export_branches
def check_export_branches(repo, args):
'''checking export related branches: pristine-tar, upstream.
give warning if pristine-tar/upstream branch exist in remote
but have not been checkout to local
'''
remote_branches = [branch.split('/')[-1] for branch in \
repo.get_remote_branches()]
if args.upstream_branch:
upstream_branch = args.upstream_branch
else:
upstream_branch = configmgr.get('upstream_branch', 'general')
# upstream exist, but pristine-tar not exist
if repo.has_branch(upstream_branch) and \
not repo.has_branch('pristine-tar') and \
'pristine-tar' in remote_branches:
log.warning('pristine-tar branch exist in remote branches, '
'you can checkout it to enable exporting upstrean '
'tarball from pristine-tar branch')
# all upstream and pristine-tar are not exist
if not repo.has_branch(upstream_branch) and \
not repo.has_branch('pristine-tar') and \
'pristine-tar' in remote_branches and upstream_branch in remote_branches:
log.warning('pristine-tar and %s branches exist in remote branches, '
'you can checkout them to enable upstream tarball and '
'patch-generation ' % upstream_branch)
示例8: update
def update(cfgparsers):
'update changed values into files on disk'
for cfgparser in cfgparsers:
try:
cfgparser.update()
except IOError, err:
log.warning('update config file error: %s' % err)
示例9: main
def main(args):
"""gbs clone entry point."""
# Determine upstream branch
upstream_branch = configmgr.get_arg_conf(args, 'upstream_branch')
packaging_branch = configmgr.get_arg_conf(args, 'packaging_branch')
# Construct GBP cmdline arguments
gbp_args = ['dummy argv[0]',
'--color-scheme=magenta:green:yellow:red',
'--pristine-tar',
'--upstream-branch=%s' % upstream_branch,
'--packaging-branch=%s' % packaging_branch]
if args.all:
gbp_args.append('--all')
if args.depth:
gbp_args.append('--depth=%s' % args.depth)
if args.debug:
gbp_args.append("--verbose")
gbp_args.append(args.uri)
if args.directory:
gbp_args.append(args.directory)
# Clone
log.info('cloning %s' % args.uri)
if do_clone(gbp_args):
raise GbsError('Failed to clone %s' % args.uri)
log.info('finished')
示例10: grab
def grab(self, url, filename, user=None, passwd=None):
"""Grab url to file."""
log.debug("fetching %s => %s" % (url, filename))
with open(filename, 'w') as outfile:
self.change_url(url, outfile, user, passwd)
self.perform()
示例11: main
def main(args):
"""gbs import entry point."""
if args.author_name:
os.environ["GIT_AUTHOR_NAME"] = args.author_name
if args.author_email:
os.environ["GIT_AUTHOR_EMAIL"] = args.author_email
path = args.path
tmp = Temp(prefix='gbp_',
dirn=configmgr.get('tmpdir', 'general'),
directory=True)
if args.upstream_branch:
upstream_branch = args.upstream_branch
else:
upstream_branch = configmgr.get('upstream_branch', 'general')
params = ["argv[0] placeholder",
"--color-scheme=magenta:green:yellow:red",
"--packaging-dir=%s" % get_packaging_dir(args),
"--upstream-branch=%s" % upstream_branch, path,
"--tmp-dir=%s" % tmp.path,
]
if args.debug:
params.append("--verbose")
if not args.no_pristine_tar and os.path.exists("/usr/bin/pristine-tar"):
params.append("--pristine-tar")
if args.filter:
params += [('--filter=%s' % f) for f in args.filter]
if path.endswith('.src.rpm') or path.endswith('.spec'):
if args.allow_same_version:
params.append("--allow-same-version")
if args.native:
params.append("--native")
if args.no_patch_import:
params.append("--no-patch-import")
ret = gbp_import_srpm(params)
if ret == 2:
log.warning("Importing of patches into packaging branch failed! "
"Please import manually (apply and commit to git, "
"remove files from packaging dir and spec) in order "
"to enable automatic patch generation.")
elif ret:
raise GbsError("Failed to import %s" % path)
else:
if args.upstream_vcs_tag:
params.append('--upstream-vcs-tag=%s' % args.upstream_vcs_tag)
if args.merge:
params.append('--merge')
else:
params.append('--no-merge')
if gbp_import_orig(params):
raise GbsError('Failed to import %s' % path)
log.info('done.')
示例12: show_file_from_rev
def show_file_from_rev(git_path, relative_path, commit_id):
"""Get a single file content from given git revision."""
args = ['git', 'show', '%s:%s' % (commit_id, relative_path)]
try:
with Workdir(git_path):
return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0]
except (subprocess.CalledProcessError, OSError), err:
log.debug('failed to checkout %s from %s:%s' % (relative_path,
commit_id, str(err)))
示例13: _new_conf
def _new_conf(self):
'generate a default conf file in home dir'
fpath = os.path.expanduser('~/.gbs.conf')
with open(fpath, 'w') as wfile:
wfile.write(self.DEFAULT_CONF_TEMPLATE)
os.chmod(fpath, 0600)
log.warning('Created a new config file %s. Please check and edit '
'your authentication information.' % fpath)
示例14: createimage
def createimage(args, ks_file):
'''create image using mic'''
extra_mic_opts = []
if args.outdir:
extra_mic_opts = ['--outdir=%s' % args.outdir]
if args.tmpfs:
extra_mic_opts += ['--tmpfs']
extra_mic_opts += ['--record-pkgs=name']
mic_cmd = 'sudo mic create auto %s %s' % (ks_file, ' '.join(extra_mic_opts))
log.debug(mic_cmd)
return os.system(mic_cmd)
示例15: filter_valid_repo
def filter_valid_repo(repos):
'filter valid remote and local repo'
rets = []
for url in repos:
if not url.startswith('http://') and \
not url.startswith('https://') and \
not (url.startswith('/') and os.path.exists(url)):
log.warning('ignore invalid repo url: %s' % url)
else:
rets.append(url)
return rets