本文整理汇总了Python中projects.Projects.last_tag方法的典型用法代码示例。如果您正苦于以下问题:Python Projects.last_tag方法的具体用法?Python Projects.last_tag怎么用?Python Projects.last_tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects.Projects
的用法示例。
在下文中一共展示了Projects.last_tag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import last_tag [as 别名]
def get(self, name='', branch='master'):
try:
if name:
project = Projects(name)
reply = {'name': project.name,
'branch': project.branches(),
'group_name': project.group_name,
'git_url': project.git_url,
'version': project.version(),
'last_tag_testing': project.last_tag(tag_type='testing'),
'last_tag_stable': project.last_tag(tag_type='stable'),
'last_commit': project.last_commit(branch)}
else:
projects = Projects.get_all()
reply = []
for project in projects:
reply.append(
{'name': project.name,
'branch': project.branches(),
'group_name': project.group_name,
'git_url': project.git_url,
'version': project.version(),
'last_tag_testing': project.last_tag(tag_type='testing'),
'last_tag_stable': project.last_tag(tag_type='stable'),
'last_commit': project.last_commit(branch)
})
self.write(cyclone.escape.json_encode(reply))
except Exception, e:
self.write(cyclone.escape.json_encode("%s No project found" % e))
示例2: get
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import last_tag [as 别名]
def get(self, name="", branch="master"):
try:
if name:
project = Projects(name)
reply = {
"name": project.name,
"branch": project.branches(),
"experimental": int(project.experimental),
"group_name": project.group_name,
"git_url": project.git_url,
"version": project.version(),
"last_tag_testing": project.last_tag(tag_type="testing"),
"last_tag_stable": project.last_tag(tag_type="stable"),
"last_tag_unstable": project.last_tag(tag_type="unstable"),
"last_commit": project.last_commit(branch),
}
else:
projects = Projects.get_all()
reply = []
for project in projects:
reply.append(
{
"name": project.name,
"branch": project.branches(),
"experimental": int(project.experimental),
"group_name": project.group_name,
"git_url": project.git_url,
"version": project.version(),
"last_tag_testing": project.last_tag(tag_type="testing"),
"last_tag_stable": project.last_tag(tag_type="stable"),
"last_tag_unstable": project.last_tag(tag_type="unstable"),
"last_commit": project.last_commit(branch),
}
)
self.write(cyclone.escape.json_encode(reply))
except Exception, e:
self.write(cyclone.escape.json_encode("%s No project found" % e))
示例3: Builder
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import last_tag [as 别名]
class Builder(object):
def __init__(self, project):
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.build_system = BrickConfig().get('build', 'system')
self.build_options = BuildOptions(self.git.workdir)
self.build_container = None
self.workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'),
self.project.name,
)
self.real_workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'), self.project.name
)
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
if True or self.build_options.not_found:
return subprocess.Popen(cmd, *args, **kwargs)
else:
chroot_cmd = "chroot %s bash -c \"cd %s; %s\"" % (self.build_container.dir, self.real_workspace, " ".join(cmd))
kwargs.update({'shell': True})
return subprocess.Popen(chroot_cmd, *args, **kwargs)
def build_project(self, branch=None, release=None, version=None, commit=None):
if not self.project.is_building():
self.project.start_building()
try:
self.workdir = "%s-%s" % (self.git.workdir, release)
self.real_workspace = "%s-%s" % (self.real_workspace, release)
shutil.copytree(self.git.workdir, self.workdir)
if self.build_system == 'rpm':
self.package_builder = BuilderRpm(self)
elif self.build_system == 'deb':
self.package_builder = BuilderDeb(self)
os.chdir(self.workdir)
self.git.workdir = self.workdir
self.git.checkout_branch(branch)
if release == 'experimental' and self.build_options.changelog:
self.git.checkout_branch(branch)
self.package_builder.build(branch, release)
self.package_builder.upload(branch)
if release != None and commit != None:
self.git.checkout_tag(commit)
self.package_builder.build(branch, force_version=version, force_release=release)
self.package_builder.upload(release)
else:
self.project.last_tag(release, self.git.last_tag(release))
self.git.checkout_tag(self.project.last_tag(release))
self.package_builder.build(branch, self.project.last_tag(release))
self.package_builder.upload(release)
self.git.checkout_branch('master')
except Exception, e:
log.exception("build failed: %s" % repr(e))
finally:
示例4: Builder
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import last_tag [as 别名]
class Builder(object):
def __init__(self, project):
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.build_system = BrickConfig().get('build', 'system')
self.build_options = BuildOptions(self.git.workdir)
self.build_container = None
self.workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'),
self.project.name,
)
self.real_workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'), self.project.name
)
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
log.msg("[%s] exec: %s %s [%s]" % (self.project.name, cmd, args, kwargs))
return subprocess.Popen(cmd, *args, **kwargs)
def build_project(self, branch=None, release=None, version=None, commit=None):
if not self.project.is_building():
self.project.start_building()
try:
if (release is not None and version is not None):
log.msg("[%s] git fetch/clone" % (self.project.name,))
if (not self.git.pull()):
self.git.clone(branch)
self.workdir = "%s-%s" % (self.git.workdir, release)
self.real_workspace = "%s-%s" % (self.real_workspace, release)
if (os.path.exists(self.workdir)):
shutil.rmtree(self.workdir, ignore_errors=True)
shutil.copytree(self.git.workdir, self.workdir, True)
log.msg("[%s] shutil.copytree: ok" % (self.project.name,))
if self.build_system == 'rpm':
self.package_builder = BuilderRpm(self)
elif self.build_system == 'deb':
self.package_builder = BuilderDeb(self)
os.chdir(self.workdir)
self.git.workdir = self.workdir
self.git.checkout_branch(branch)
if release == 'experimental' and self.build_options.changelog:
self.git.checkout_branch(branch)
self.package_builder.build(branch, release)
self.package_builder.upload(branch)
if release != None and commit != None:
self.git.checkout_tag(commit)
self.package_builder.build(branch, force_version=version, force_release=release)
self.package_builder.upload(release)
else:
self.project.last_tag(release, self.git.last_tag(release))
self.git.checkout_tag(self.project.last_tag(release))
self.package_builder.build(branch, self.project.last_tag(release))
self.package_builder.upload(release)
self.git.checkout_branch('master')
except Exception, e:
log.msg("[%s] %s" % (self.project.name, traceback.format_exc()))
finally:
示例5: __init__
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import last_tag [as 别名]
class Builder:
def __init__(self, project):
self.workspace = BrickConfig().get('workspace', 'dir')
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.build_system = BrickConfig().get('build', 'system')
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
return subprocess.Popen(cmd, *args, **kwargs)
def build_project(self, branch=None, release=None, version=None):
if not self.project.is_building():
self.project.start_building()
try:
self.workdir = "%s-%s" % (self.git.workdir, release)
shutil.copytree(self.git.workdir, self.workdir)
if self.build_system == 'rpm':
self.package_builder = RpmBuilder(self)
elif self.build_system == 'deb':
self.package_builder = DebBuilder(self)
os.chdir(self.workdir)
self.git.workdir = self.workdir
self.git.checkout_branch(branch)
if release == 'experimental':
self.git.checkout_branch(branch)
self.package_builder.build(branch, release)
self.package_builder.upload(branch)
else:
self.project.last_tag(release, self.git.last_tag(release))
self.git.checkout_tag(self.project.last_tag(release))
self.package_builder.build(branch, self.project.last_tag(release))
self.package_builder.upload(release)
self.git.checkout_branch('master')
shutil.rmtree(self.workdir)
except Exception, e:
log.exception("build failed: %s" % repr(e))
finally:
示例6: __init__
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import last_tag [as 别名]
class Builder:
def __init__(self, project):
self.workspace = BrickConfig().get('workspace', 'dir')
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.workdir = self.git.workdir
self.build_system = BrickConfig().get('build', 'system')
self.ftp_host = BrickConfig().get('ftp', 'host')
self.ftp_user = BrickConfig().get('ftp', 'user')
self.ftp_pass = BrickConfig().get('ftp', 'pass')
self.ftp_dir = BrickConfig().get('ftp', 'dir')
if self.build_system == 'rpm':
self.package_builder = RpmBuilder(self)
elif self.build_system == 'deb':
self.package_builder = DebBuilder(self)
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
return subprocess.Popen(cmd, *args, **kwargs)
def build_project(self, force=False, a_branch=None):
try:
if force:
build = 1
else:
build = 0
"""
force build for a specific branch only if a_branch is not None
"""
if a_branch:
branches = [a_branch]
else:
branches = self.project.branches()
for branch in branches:
log.debug("Checking project: %s" % self.project.name)
try:
if not os.path.isdir(self.git.workdir):
self.git.clone(branch)
else:
self.git.checkout_tag(tag=".")
self.git.pull()
except Exception, e:
log.exception('Could not clone or update repository')
raise
if os.path.isdir(self.workdir):
os.chdir(self.workdir)
last_commit = self.git.last_commit(branch)
if self.project.last_commit(branch) != last_commit:
self.project.last_commit(branch, last_commit)
build = 1
self.project.save()
self.oldworkdir = self.workdir
if not os.path.isdir("%s-%s" % (self.workdir, branch)):
shutil.copytree(self.workdir, "%s-%s" % (self.workdir, branch))
self.workdir = "%s-%s" % (self.workdir, branch)
self.git.workdir = self.workdir
self.git.pull()
self.git.checkout_branch(branch)
if build == 1:
log.info('Generating packages for %s on %s' % (self.project, self.workdir))
self.package_builder.build(branch)
self.package_builder.upload(branch)
log.info("build complete")
self.workdir = self.oldworkdir
self.git.workdir = self.workdir
self.git.checkout_branch('master')
branch = 'master'
for tag_type in ('testing', 'stable'):
log.info('Last tag found: %s' % self.project.last_tag(tag_type))
if self.project.last_tag(tag_type) != self.git.last_tag(tag_type):
#.........这里部分代码省略.........