本文整理汇总了Python中RepSys.svn.SVN.checkout方法的典型用法代码示例。如果您正苦于以下问题:Python SVN.checkout方法的具体用法?Python SVN.checkout怎么用?Python SVN.checkout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepSys.svn.SVN
的用法示例。
在下文中一共展示了SVN.checkout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_package
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import checkout [as 别名]
def create_package(pkgdirurl, log="", verbose=0):
svn = SVN()
tmpdir = tempfile.mktemp()
try:
basename = layout.package_name(pkgdirurl)
if verbose:
print "Creating package directory...",
sys.stdout.flush()
ret = svn.mkdir(pkgdirurl,
log="Created package directory for '%s'." % basename)
if verbose:
print "done"
print "Checking it out...",
svn.checkout(pkgdirurl, tmpdir)
if verbose:
print "done"
print "Creating package structure...",
svn.mkdir(os.path.join(tmpdir, "current"))
svn.mkdir(os.path.join(tmpdir, "current", "SPECS"))
svn.mkdir(os.path.join(tmpdir, "current", "SOURCES"))
if verbose:
print "done"
print "Committing...",
svn.commit(tmpdir,
log="Created package structure for '%s'." % basename)
print "done"
finally:
if os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
示例2: checkout
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import checkout [as 别名]
def checkout(pkgdirurl, path=None, revision=None, branch=None,
distro=None, spec=False):
o_pkgdirurl = pkgdirurl
pkgdirurl = layout.package_url(o_pkgdirurl, distro=distro)
append = None
if spec:
append = "SPECS"
current = layout.checkout_url(pkgdirurl, branch=branch,
append_path=append)
if path is None:
path = layout.package_name(pkgdirurl)
mirror.info(current, write=True)
svn = SVN()
svn.checkout(current, path, rev=revision, show=1)
示例3: patch_spec
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import checkout [as 别名]
def patch_spec(pkgdirurl, patchfile, log=""):
#FIXME use get_spec
svn = SVN()
tmpdir = tempfile.mktemp()
try:
geturl = layout.checkout_url(pkgdirurl, append_path="SPECS")
svn.checkout(geturl, tmpdir)
speclist = glob.glob(os.path.join(tmpdir, "*.spec"))
if not speclist:
raise Error, "no spec files found"
spec = speclist[0]
status, output = execcmd(["patch", spec, patchfile])
if status != 0:
raise Error, "can't apply patch:\n%s\n" % output
else:
svn.commit(tmpdir, log="")
finally:
if os.path.isdir(tmpdir):
shutil.rmtree(tmpdir)
示例4: put_srpm
# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import checkout [as 别名]
def put_srpm(srpmfile, markrelease=False, striplog=True, branch=None,
baseurl=None, baseold=None, logmsg=None, rename=True):
svn = SVN()
srpm = SRPM(srpmfile)
tmpdir = tempfile.mktemp()
if baseurl:
pkgurl = mirror._joinurl(baseurl, srpm.name)
else:
pkgurl = layout.package_url(srpm.name, distro=branch,
mirrored=False)
print "Importing package to %s" % pkgurl
try:
if srpm.epoch:
version = "%s:%s" % (srpm.epoch, srpm.version)
else:
version = srpm.version
versionurl = "/".join([pkgurl, "releases", version])
releaseurl = "/".join([versionurl, srpm.release])
currenturl = "/".join([pkgurl, "current"])
currentdir = os.path.join(tmpdir, "current")
#FIXME when pre-commit hook fails, there's no clear way to know
# what happened
ret = svn.mkdir(pkgurl, noerror=1, log="Created package directory")
if ret or not svn.ls(currenturl, noerror=1):
svn.checkout(pkgurl, tmpdir)
svn.mkdir(os.path.join(tmpdir, "releases"))
svn.mkdir(currentdir)
svn.mkdir(os.path.join(currentdir, "SPECS"))
svn.mkdir(os.path.join(currentdir, "SOURCES"))
#svn.commit(tmpdir,log="Created package structure.")
version_exists = 1
else:
if svn.ls(releaseurl, noerror=1):
raise Error, "release already exists"
svn.checkout("/".join([pkgurl, "current"]), tmpdir)
svn.mkdir(versionurl, noerror=1,
log="Created directory for version %s." % version)
currentdir = tmpdir
specsdir = os.path.join(currentdir, "SPECS")
sourcesdir = os.path.join(currentdir, "SOURCES")
unpackdir = tempfile.mktemp()
os.mkdir(unpackdir)
try:
srpm.unpack(unpackdir)
uspecsdir = os.path.join(unpackdir, "SPECS")
usourcesdir = os.path.join(unpackdir, "SOURCES")
uspecsentries = os.listdir(uspecsdir)
usourcesentries = os.listdir(usourcesdir)
specsentries = os.listdir(specsdir)
sourcesentries = os.listdir(sourcesdir)
# Remove old entries
for entry in [x for x in specsentries
if x not in uspecsentries]:
if entry == ".svn":
continue
entrypath = os.path.join(specsdir, entry)
os.unlink(entrypath)
svn.remove(entrypath)
for entry in [x for x in sourcesentries
if x not in usourcesentries]:
if entry == ".svn":
continue
entrypath = os.path.join(sourcesdir, entry)
os.unlink(entrypath)
svn.remove(entrypath)
# Copy all files
execcmd(["cp", "-rf", uspecsdir, currentdir])
execcmd(["cp", "-rf", usourcesdir, currentdir])
# Add new entries
for entry in [x for x in uspecsentries
if x not in specsentries]:
entrypath = os.path.join(specsdir, entry)
svn.add(entrypath)
for entry in [x for x in usourcesentries
if x not in sourcesentries]:
entrypath = os.path.join(sourcesdir, entry)
svn.add(entrypath)
finally:
if os.path.isdir(unpackdir):
shutil.rmtree(unpackdir)
specs = glob.glob(os.path.join(specsdir, "*.spec"))
if not specs:
raise Error, "no spec file found on %s" % specsdir
if len(specs) > 1:
raise Error, "more than one spec file found on %s" % specsdir
specpath = specs[0]
if rename:
specfile = os.path.basename(specpath)
specname = specfile[:-len(".spec")]
if specname != srpm.name:
newname = srpm.name + ".spec"
newpath = os.path.join(specsdir, newname)
#.........这里部分代码省略.........