diff options
author | Milo Casagrande <milo@ubuntu.com> | 2013-05-28 13:28:01 +0200 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2013-05-28 13:28:01 +0200 |
commit | 2da1ec7c0bd44de4c2950baaae9f94feb333076e (patch) | |
tree | 0de0fc6f2f9da6755b1e1c760a952447bb353045 /scripts/rhodecode-setup | |
parent | 7a6233168432d6364e7dcb35d17cd2325ba32c62 (diff) |
Diffstat (limited to 'scripts/rhodecode-setup')
-rwxr-xr-x | scripts/rhodecode-setup | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/scripts/rhodecode-setup b/scripts/rhodecode-setup index d62c8b6..337e695 100755 --- a/scripts/rhodecode-setup +++ b/scripts/rhodecode-setup @@ -24,15 +24,13 @@ import sys DESCRIPTION = "Install and setup RhodeCode Linaro instance." -REQUIRED_PACKAGES = ["python-pip", "python-webob", "python-bcrypt", "members", +REQUIRED_PACKAGES = ["python-pip", "members", "mercurial", "python-mock", "python-babel", "python-dateutil", - "python-markdown", "python-webhelpers", "python-docutils", - "python-formencode", "python-pylons", "python-dev", + "python-docutils", "python-formencode", "python-dev", "python-pastescript", "python-psycopg2", "python-nose", - "build-essential", "python-amqplib", "python-anyjson", + "build-essential", "python-amqplib", "python-mailer", "apache2", "git", "python-ldap", - "python-objgraph", "libapache2-mod-xsendfile", - "mercurial"] + "python-objgraph", "libapache2-mod-xsendfile", ] # Packages required for celery integration. CELERY_REQUIRED_PACKAGES = ["rabbitmq-server"] @@ -285,7 +283,8 @@ def execute_command(cmd_args, work_dir=os.getcwd(), with_sudo=True, input_str=None, - continue_on_error=False): + continue_on_error=False, + env=None): """Runs the command passed. :param cmd_args: List of command and options to run. @@ -309,12 +308,14 @@ def execute_command(cmd_args, if input_str: process = subprocess.Popen(cmd_args, cwd=work_dir, - stdin=subprocess.PIPE) + stdin=subprocess.PIPE, + env=env) process.communicate(input=input_str) else: process = subprocess.Popen(cmd_args, - cwd=work_dir) + cwd=work_dir, + env=env) process.communicate() if continue_on_error: @@ -562,19 +563,28 @@ def update_rhodecode(url, branch, work_dir, source_co, user): set_owners(source_path, user) -def update_database_schema(work_dir, config_file, assume_yes=False): +def update_database_schema(work_dir, config_file, local_dir, assume_yes=False): """Updates the database schema regardles of the database used. :param work_dir: Working directory. :type str :param config_file: Config file to use, it will tell which db to update. :type str + :param local_dir: Path to the local installation dir. """ + cmd_args = [] input_str = None if assume_yes: input_str = "y" - cmd_args = ["paster", "upgrade-db", config_file] + if local_dir: + # We need this or the upgrade-db command will fail while updating the + # database schema. Adding PYTHONPATH to os.environ and passing it to + # subprocess apparently does not work as expected. + python_path = "PYTHONPATH=$PYTHONPATH:" + local_dir + cmd_args.append(python_path) + + cmd_args += ["paster", "upgrade-db", config_file] execute_command(cmd_args, work_dir=work_dir, input_str=input_str, continue_on_error=True) @@ -586,7 +596,7 @@ def remove_old_egg_files(local_dir): :type str """ # At the moment we remove just one. - egg_path = os.path.join(local_dir, "Rhodecode*.egg") + egg_path = os.path.join(local_dir, "Rhodecode*") cmd_args = ["rm", "-rf", egg_path] execute_command(cmd_args, continue_on_error=True) @@ -888,7 +898,7 @@ if __name__ == '__main__': reinstall_rhodecode(work_dir, local_dir, args.rhodecode_usr) # Update database schema. - update_database_schema(work_dir, rhodecode_conf, True) + update_database_schema(work_dir, rhodecode_conf, local_dir, True) # Prepare chown script. prepare_chown_script(args.rhodecode_usr, args.repos_dir) |