From 77b76b6db6149a65bce1a34a8b5a1d34517e65da Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 10 Oct 2000 19:35:40 +0000 Subject: Substantially revise to handle the fact that Python CVS is no longer in a file-system accessible repository. Add a little bit of smarts to convert the cvsroot to an anonymous cvsroot the real one requires an authenticated login to SourceForge; this avoids the SSH startup delay when doing the checkout or export to get a fresh copy of the tree. --- Doc/tools/mksourcepkg | 51 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/Doc/tools/mksourcepkg b/Doc/tools/mksourcepkg index 260ae6d..098bed2 100755 --- a/Doc/tools/mksourcepkg +++ b/Doc/tools/mksourcepkg @@ -21,12 +21,17 @@ __version__ = "$Revision$" import getopt import glob import os +import re import shutil import sys import tempfile +import cvsinfo + quiet = 0 +rx = re.compile(r":ext:(?:[a-zA-Z0-9]+)@cvs\.([a-zA-Z0-9]+).sourceforge.net:" + r"/cvsroot/\1") def main(): @@ -70,33 +75,47 @@ def main(): cvstag = args[1] tempdir = tempfile.mktemp() os.mkdir(tempdir) - os.mkdir(os.path.join(tempdir, "Python-%s" % release)) - docdir = os.path.join(tempdir, "Python-%s" % release, "Doc") - os.mkdir(docdir) - mydir = os.getcwd() + pkgdir = os.path.join(tempdir, "Python-" + release) + os.mkdir(pkgdir) + pwd = os.getcwd() + mydir = os.path.abspath(os.path.dirname(sys.argv[0])) + info = cvsinfo.RepositoryInfo(mydir) + cvsroot = info.get_cvsroot() + m = rx.match(cvsroot) + if m: + # If this is an authenticated SourceForge repository, convert to + # anonymous usage for the export/checkout, since that avoids the + # SSH overhead. + group = m.group(1) + cvsroot = ":pserver:anonymous@cvs.%s.sourceforge.net:/cvsroot/%s" \ + % (group, group) + # For some reason, SourceForge/CVS doesn't seem to care that we + # might not have done a "cvs login" to the anonymous server. + # That avoids a lot of painful gunk here. + os.chdir(pkgdir) + if not quiet: + print "--- current directory is:", pkgdir if cvstag: - run("cvs export -r %s -d %s/Python-%s/Doc python/dist/src/Doc" - % (cvstag, tempdir, release)) + run("cvs -d%s export -r %s -d Doc python/dist/src/Doc" + % (cvsroot, cvstag)) else: - run("cvs checkout -d %s/Python-%s/Doc python/dist/src/Doc" - % (tempdir, release)) + run("cvs -Q -d%s checkout -d Doc python/dist/src/Doc" % cvsroot) # remove CVS directories - os.chdir("%s/Python-%s" % (tempdir, release)) for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'): map(shutil.rmtree, glob.glob(p)) - os.chdir(mydir) if tools: - archive = "tools-" + release + archive = "doctools-" + release # we don't want the actual documents in this case: - for d in ("api", "doc", "ext", "lib", "mac", "ref", "tut"): - shutil.rmtree(os.path.join(docdir, d)) + for d in ("api", "dist", "doc", "ext", "inst", + "lib", "mac", "ref", "tut"): + shutil.rmtree(os.path.join(os.path.join(pkgdir, "Doc"), d)) else: archive = "latex-" + release # XXX should also remove the .cvsignore files at this point os.chdir(tempdir) - archive = os.path.join(mydir, archive) + archive = os.path.join(pwd, archive) for format in formats: if format == "bzip2": run("tar cf - Python-%s | bzip2 -9 >%s.tar.bz2" @@ -111,7 +130,7 @@ def main(): % (archive, release)) # clean up the work area: - os.chdir(mydir) + os.chdir(pwd) shutil.rmtree(tempdir) @@ -119,7 +138,7 @@ def run(cmd): if quiet < 2: print "+++", cmd if quiet: - cmd = "(%s) >/dev/null" % cmd + cmd = "%s >/dev/null" % cmd rc = os.system(cmd) if rc: sys.exit(rc) -- cgit v0.12