Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions dev/run
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import functools
import glob
import inspect
import json
import ntpath
import optparse
import os
import posixpath
import re
import subprocess as sp
import sys
Expand All @@ -42,6 +44,12 @@ except ImportError:
import http.client as httpclient


def toposixpath(path):
if os.sep == ntpath.sep:
return path.replace(ntpath.sep, posixpath.sep)
else:
return path

def log(msg):
def decorator(func):
@functools.wraps(func)
Expand Down Expand Up @@ -162,23 +170,18 @@ def setup_configs(ctx):
for idx, node in enumerate(ctx['nodes']):
cluster_port, backend_port = get_ports(idx + ctx['node_number'])
env = {
"prefix": ctx['rootdir'],
"prefix": toposixpath(ctx['rootdir']),
"package_author_name": "The Apache Software Foundation",
"data_dir": ensure_dir_exists(ctx['devdir'],
"lib", node, "data"),
"view_index_dir": ensure_dir_exists(ctx['devdir'],
"lib", node, "data"),
"data_dir": toposixpath(ensure_dir_exists(ctx['devdir'],
"lib", node, "data")),
"view_index_dir": toposixpath(ensure_dir_exists(ctx['devdir'],
"lib", node, "data")),
"node_name": "-name %s@127.0.0.1" % node,
"cluster_port": cluster_port,
"backend_port": backend_port,
"fauxton_root": "src/fauxton/dist/release",
"uuid": "fake_uuid_for_dev"
}
if os.name == 'nt':
# Erlang always wants UNIX-style paths
env["data_dir"] = env["data_dir"].replace("\\", "/")
env["view_index_dir"] = env["view_index_dir"].replace("\\", "/")
env["prefix"] = env["prefix"].replace("\\", "/")
write_config(ctx, node, env)


Expand Down Expand Up @@ -236,10 +239,7 @@ def boot_haproxy(ctx):

def hack_default_ini(ctx, node, content):
# Replace log file
logfile = os.path.join(ctx['devdir'], "logs", "%s.log" % node)
if os.name == 'nt':
# Erlang always wants UNIX-style paths
logfile = logfile.replace("\\", "/")
logfile = toposixpath(os.path.join(ctx['devdir'], "logs", "%s.log" % node))
repl = "file = %s" % logfile
contents = re.sub("(?m)^file.*$", repl, content)

Expand All @@ -248,10 +248,10 @@ def hack_default_ini(ctx, node, content):
mainjs = os.path.join(ctx['rootdir'], "share", "server", "main.js")
coffeejs = os.path.join(ctx['rootdir'], "share", "server", "main-coffee.js")

repl = "javascript = %s %s" % (couchjs, mainjs)
repl = toposixpath("javascript = %s %s" % (couchjs, mainjs))
contents = re.sub("(?m)^javascript.*$", repl, contents)

repl = "coffeescript = %s %s" % (couchjs, coffeejs)
repl = toposixpath("coffeescript = %s %s" % (couchjs, coffeejs))
contents = re.sub("(?m)^coffeescript.*$", repl, contents)

return contents
Expand Down Expand Up @@ -382,9 +382,7 @@ def boot_node(ctx, node):
]
logfname = os.path.join(ctx['devdir'], "logs", "%s.log" % node)
log = open(logfname, "wb")
if os.name == 'nt':
# Erlang always wants UNIX-style paths
cmd = [x.replace("\\", "/") for x in cmd]
cmd = [toposixpath(x) for x in cmd]
return sp.Popen(cmd, stdin=sp.PIPE, stdout=log, stderr=sp.STDOUT, env=env)


Expand Down