def get_old_log(pkgdirurl): chlog = StringIO() oldurl = config.get("log", "oldurl") if oldurl: svn = SVN() tmpdir = tempfile.mktemp() try: if oldurl == '.' or oldurl.startswith('./'): pkgoldurl = os.path.join(pkgdirurl, oldurl) else: 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
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)
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) binrepo.download_binaries(path)