本文整理汇总了Python中RepSys.svn.SVN.export方法的典型用法代码示例。如果您正苦于以下问题:Python SVN.export方法的具体用法?Python SVN.export怎么用?Python SVN.export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepSys.svn.SVN
的用法示例。
在下文中一共展示了SVN.export方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_old_log
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import export [as 别名]
def get_old_log(pkgdirurl):
chlog = StringIO()
oldurl = config.get("log", "oldurl")
if oldurl:
svn = SVN()
tmpdir = tempfile.mktemp()
try:
pkgname = layout.package_name(pkgdirurl)
pkgoldurl = os.path.join(oldurl, pkgname)
try:
# we're using HEAD here because fixes in misc/ (oldurl) may
# be newer than packages' last changed revision.
svn.export(pkgoldurl, tmpdir)
except Error:
pass
else:
logfile = os.path.join(tmpdir, "log")
if os.path.isfile(logfile):
file = open(logfile)
chlog.write("\n") # TODO needed?
log = file.read()
log = escape_macros(log)
chlog.write(log)
file.close()
finally:
if os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
chlog.seek(0)
return chlog
示例2: get_spec
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import export [as 别名]
def get_spec(pkgdirurl, targetdir=".", submit=False):
svn = SVN()
tmpdir = tempfile.mktemp()
try:
geturl = layout.checkout_url(pkgdirurl, append_path="SPECS")
mirror.info(geturl)
svn.export("'%s'" % geturl, tmpdir)
speclist = glob.glob(os.path.join(tmpdir, "*.spec"))
if not speclist:
raise Error, "no spec files found"
spec = speclist[0]
shutil.copy(spec, targetdir)
finally:
if os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
示例3: getrelease
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import export [as 别名]
def getrelease(pkgdirurl, rev=None, macros=[], exported=None):
"""Tries to obtain the version-release of the package for a
yet-not-markrelease revision of the package.
Is here where things should be changed if "automatic release increasing"
will be used.
"""
from RepSys.rpmutil import rpm_macros_defs
svn = SVN()
pkgcurrenturl = os.path.join(pkgdirurl, "current")
specurl = os.path.join(pkgcurrenturl, "SPECS")
if exported is None:
tmpdir = tempfile.mktemp()
svn.export(specurl, tmpdir, rev=rev)
else:
tmpdir = os.path.join(exported, "SPECS")
try:
found = glob.glob(os.path.join(tmpdir, "*.spec"))
if not found:
raise Error, "no .spec file found inside %s" % specurl
specpath = found[0]
options = rpm_macros_defs(macros)
command = (("rpm -q --qf '%%{EPOCH}:%%{VERSION}-%%{RELEASE}\n' "
"--specfile %s %s") %
(specpath, options))
pipe = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
pipe.wait()
output = pipe.stdout.read()
error = pipe.stderr.read()
if pipe.returncode != 0:
raise Error, "Error in command %s: %s" % (command, error)
releases = output.split()
try:
epoch, vr = releases[0].split(":", 1)
version, release = vr.split("-", 1)
except ValueError:
raise Error, "Invalid command output: %s: %s" % \
(command, output)
#XXX check if this is the right way:
if epoch == "(none)":
ev = version
else:
ev = epoch + ":" + version
return ev, release
finally:
if exported is None and os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
示例4: getrelease
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import export [as 别名]
def getrelease(pkgdirurl, rev=None, macros=[], exported=None):
"""Tries to obtain the version-release of the package for a
yet-not-markrelease revision of the package.
Is here where things should be changed if "automatic release increasing"
will be used.
"""
svn = SVN()
pkgcurrenturl = os.path.join(pkgdirurl, "current")
specurl = os.path.join(pkgcurrenturl, "SPECS")
if exported is None:
tmpdir = tempfile.mktemp()
svn.export(specurl, tmpdir, rev=rev)
else:
tmpdir = os.path.join(exported, "SPECS")
try:
found = glob.glob(os.path.join(tmpdir, "*.spec"))
if not found:
raise Error, "no .spec file found inside %s" % specurl
specpath = found[0]
args = ["rpm", "-q", "--qf", "%{EPOCH}:%{VERSION}-%{RELEASE}\n",
"--specfile", specpath]
for pair in macros:
args.extend(("--define", "%s %s" % pair))
proc = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if proc.wait() != 0:
raise CommandError(args, proc.returncode, proc.stderr.read())
output = proc.stdout.read()
releases = output.split()
try:
epoch, vr = releases[0].split(":", 1)
version, release = vr.split("-", 1)
except ValueError:
raise Error, "Invalid command output: %s: %s" % \
(args, output)
#XXX check if this is the right way:
if epoch == "(none)":
ev = version
else:
ev = epoch + ":" + version
return ev, release
finally:
if exported is None and os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
示例5: get_srpm
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import export [as 别名]
def get_srpm(pkgdirurl,
mode = "current",
targetdirs = None,
version = None,
release = None,
revision = None,
packager = "",
revname = 0,
svnlog = 0,
scripts = [],
submit = False,
template = None,
distro = None,
macros = [],
verbose = 0,
strict = False):
svn = SVN()
tmpdir = tempfile.mktemp()
topdir = "_topdir %s" % tmpdir
builddir = "_builddir %s/%s" % (tmpdir, "BUILD")
rpmdir = "_rpmdir %s/%s" % (tmpdir, "RPMS")
sourcedir = "_sourcedir %s/%s" % (tmpdir, "SOURCES")
specdir = "_specdir %s/%s" % (tmpdir, "SPECS")
srcrpmdir = "_srcrpmdir %s/%s" % (tmpdir, "SRPMS")
patchdir = "_patchdir %s/%s" % (tmpdir, "SOURCES")
temppath = "_tmppath %s" % (tmpdir)
rpmdefs = [("--define", expr) for expr in (topdir, builddir, rpmdir,
sourcedir, specdir, srcrpmdir, patchdir, temppath)]
try:
if mode == "version":
geturl = layout.checkout_url(pkgdirurl, version=version,
release=release)
elif mode == "pristine":
geturl = layout.checkout_url(pkgdirurl, pristine=True)
elif mode == "current" or mode == "revision":
#FIXME we should handle revisions specified using @REV
geturl = layout.checkout_url(pkgdirurl)
else:
raise Error, "unsupported get_srpm mode: %s" % mode
strict = strict or config.getbool("submit", "strict-revision", False)
if strict and not rev_touched_url(geturl, revision):
#FIXME would be nice to have the revision number even when
# revision is None
raise Error, "the revision %s does not change anything "\
"inside %s" % (revision or "HEAD", geturl)
mirror.info(geturl)
svn.export(geturl, tmpdir, rev=revision)
srpmsdir = os.path.join(tmpdir, "SRPMS")
os.mkdir(srpmsdir)
specsdir = os.path.join(tmpdir, "SPECS")
speclist = glob.glob(os.path.join(specsdir, "*.spec"))
if config.getbool("srpm", "run-prep", False):
makefile = os.path.join(tmpdir, "Makefile")
if os.path.exists(makefile):
execcmd(("make", "-C", tmpdir, "srpm-prep"))
if not speclist:
raise Error, "no spec files found"
spec = speclist[0]
if svnlog:
submit = not not revision
log.specfile_svn2rpm(pkgdirurl, spec, revision, submit=submit,
template=template, macros=macros, exported=tmpdir)
for script in scripts:
#FIXME revision can be "None"
status, output = execcmd(script, tmpdir, spec, str(revision),
noerror=1)
if status != 0:
raise Error, "script %s failed" % script
if packager:
packager = " --define 'packager %s'" % packager
if distro:
cmpdistro = distro.lower()
for target in cgiutil.get_targets():
if target.name.lower() == cmpdistro:
macros.extend(target.macros)
break
else:
raise Error, "no such submit target in configuration: %s" % (distro)
sourcecmd = config.get("helper", "rpmbuild", "rpmbuild")
args = [sourcecmd, "-bs", "--nodeps"]
for pair in rpmdefs:
args.extend(pair)
for pair in macros:
args.extend(("--define", "%s %s" % pair))
args.append(spec)
try:
execcmd(args)
except CommandError, e:
if config.getbool("global", "verbose"):
cmdline = e.cmdline + "\n"
else:
cmdline = ""
raise Error, ("error while creating the source RPM "
"(with %s):\n%s%s" % (sourcecmd, cmdline, e.output))
# copy the generated SRPMs to their target locations
targetsrpms = []
#.........这里部分代码省略.........