本文整理汇总了Python中gbp.deb.git.DebianGitRepository.has_upstream_tag方法的典型用法代码示例。如果您正苦于以下问题:Python DebianGitRepository.has_upstream_tag方法的具体用法?Python DebianGitRepository.has_upstream_tag怎么用?Python DebianGitRepository.has_upstream_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbp.deb.git.DebianGitRepository
的用法示例。
在下文中一共展示了DebianGitRepository.has_upstream_tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gbp.deb.git import DebianGitRepository [as 别名]
# 或者: from gbp.deb.git.DebianGitRepository import has_upstream_tag [as 别名]
def main(argv):
retval = 0
prefix = "git-"
source = None
branch = None
options, gbp_args, dpkg_args = parse_args(argv, prefix)
if not options:
return 1
try:
repo = DebianGitRepository(os.path.curdir)
except GitRepositoryError:
gbp.log.err("%s is not a git repository" % (os.path.abspath('.')))
return 1
else:
repo_dir = os.path.abspath(os.path.curdir)
try:
Command(options.cleaner, shell=True)()
if not options.ignore_new:
(ret, out) = repo.is_clean()
if not ret:
gbp.log.err("You have uncommitted changes in your source tree:")
gbp.log.err(out)
raise GbpError("Use --git-ignore-new to ignore.")
try:
branch = repo.get_branch()
except GitRepositoryError:
# Not being on any branch is o.k. with --git-ignore-branch
if not options.ignore_branch:
raise
if not options.ignore_new and not options.ignore_branch:
if branch != options.debian_branch:
gbp.log.err("You are not on branch '%s' but on '%s'" % (options.debian_branch, branch))
raise GbpError("Use --git-ignore-branch to ignore or --git-debian-branch to set the branch name.")
tree = write_tree(repo, options)
source = source_vfs(repo, options, tree)
if not options.tag_only:
output_dir = prepare_output_dir(options.export_dir)
tarball_dir = options.tarball_dir or output_dir
# Get/build the upstream tarball if necessary. We delay this in
# case of a postexport hook so the hook gets a chance to modify the
# sources and create different tarballs (#640382)
# We don't delay it in general since we want to fail early if the
# tarball is missing.
if not source.is_native(repo.has_upstream_tag(options.upstream_tag)):
if options.postexport:
gbp.log.info("Postexport hook set, delaying tarball creation")
else:
prepare_upstream_tarball(repo, source.changelog, options, tarball_dir,
output_dir)
# Export to another build dir if requested:
if options.export_dir:
tmp_dir = os.path.join(output_dir, "%s-tmp" % source.sourcepkg)
export_source(repo, tree, source, options, tmp_dir, output_dir)
# Run postexport hook
if options.postexport:
RunAtCommand(options.postexport, shell=True,
extra_env={'GBP_GIT_DIR': repo.git_dir,
'GBP_TMP_DIR': tmp_dir})(dir=tmp_dir)
major = (source.changelog.upstream_version if source.changelog.has_upstream_version()
else source.changelog.debian_version)
export_dir = os.path.join(output_dir, "%s-%s" % (source.sourcepkg, major))
gbp.log.info("Moving '%s' to '%s'" % (tmp_dir, export_dir))
move_old_export(export_dir)
os.rename(tmp_dir, export_dir)
# Delayed tarball creation in case a postexport hook is used:
if not source.is_native(repo.has_upstream_tag(options.upstream_tag)) and options.postexport:
prepare_upstream_tarball(repo, source.changelog, options, tarball_dir,
output_dir)
if options.export_dir:
build_dir = export_dir
else:
build_dir = repo_dir
if options.prebuild:
RunAtCommand(options.prebuild, shell=True,
extra_env={'GBP_GIT_DIR': repo.git_dir,
'GBP_BUILD_DIR': build_dir})(dir=build_dir)
setup_pbuilder(options)
# Finally build the package:
RunAtCommand(options.builder, dpkg_args, shell=True,
extra_env={'GBP_BUILD_DIR': build_dir})(dir=build_dir)
if options.postbuild:
changes = os.path.abspath("%s/../%s_%s_%s.changes" %
(build_dir,
source.sourcepkg,
source.changelog.noepoch,
#.........这里部分代码省略.........
示例2: main
# 需要导入模块: from gbp.deb.git import DebianGitRepository [as 别名]
# 或者: from gbp.deb.git.DebianGitRepository import has_upstream_tag [as 别名]
#.........这里部分代码省略.........
if args:
gbp.log.info("Only looking for changes on '%s'" % " ".join(args))
commits = repo.get_commits(since=since, until=until, paths=args,
options=options.git_log.split(" "))
commits.reverse()
# add a new changelog section if:
if (options.new_version or options.bpo or options.nmu or options.qa or
options.team or options.security):
if options.bpo:
version_change['increment'] = '--bpo'
elif options.nmu:
version_change['increment'] = '--nmu'
elif options.qa:
version_change['increment'] = '--qa'
elif options.team:
version_change['increment'] = '--team'
elif options.security:
version_change['increment'] = '--security'
else:
version_change['version'] = options.new_version
# the user wants to force a new version
add_section = True
elif cp['Distribution'] != "UNRELEASED" and not found_snapshot_banner and commits:
# the last version was a release and we have pending commits
add_section = True
elif options.snapshot and not found_snapshot_banner:
# the user want to switch to snapshot mode
add_section = True
else:
add_section = False
has_upstream_tag = repo.has_upstream_tag(options.upstream_tag)
if add_section and not version_change and not source.is_native(has_upstream_tag):
# Get version from upstream if none provided
v = guess_version_from_upstream(repo, options.upstream_tag, cp)
if v:
version_change['version'] = v
i = 0
for c in commits:
i += 1
parsed = parse_commit(repo, c, options,
last_commit = i == len(commits))
commit_msg, (commit_author, commit_email) = parsed
if not commit_msg:
# Some commits can be ignored
continue
if add_section:
# Add a section containing just this message (we can't
# add an empty section with dch)
cp.add_section(distribution="UNRELEASED", msg=commit_msg,
version=version_change,
author=commit_author,
email=commit_email,
dch_options=dch_options)
# Adding a section only needs to happen once.
add_section = False
else:
cp.add_entry(commit_msg, commit_author, commit_email, dch_options)
# Show a message if there were no commits (not even ignored
# commits).