From fe19658344ff665ae7bdfb2de2cc48e82398bc6e Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Sat, 25 Mar 2017 01:04:42 -0700 Subject: [PATCH 1/3] bump cryptography to 1.8.1 --- braid/venv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/braid/venv.py b/braid/venv.py index 8ca59b0..ecb0f05 100644 --- a/braid/venv.py +++ b/braid/venv.py @@ -51,7 +51,7 @@ def install_twisted(self): attrs==16.3.0 cffi==1.9.1 constantly==15.1.0 - cryptography==1.7.1 + cryptography==1.8.1 enum34==1.1.6 h2==2.5.1 hpack==2.3.0 From a3d9e00231f1fae52125a301bce1c8226036b977 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Sat, 25 Mar 2017 01:05:03 -0700 Subject: [PATCH 2/3] Virtualenv can clean up after itself. --- braid/venv.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/braid/venv.py b/braid/venv.py index ecb0f05..9bd9199 100644 --- a/braid/venv.py +++ b/braid/venv.py @@ -33,6 +33,14 @@ def create(self, site_packages=False): self.install("setuptools wheel") + def remove(self): + """ + Remove the virtualenv. + """ + with settings(user=self._user): + run("rm -rf {}".format(self._location)) + + def install(self, package): """ Install a package into the virtualenv. It updates if there is a newer From 66d1af5ea352979f07438ccb1398b197e42a1484 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Sat, 25 Mar 2017 01:05:42 -0700 Subject: [PATCH 3/3] Everything gets a recreateVirtualEnvironment task. This removes the current virtualenv, creates a new one, and then installs any dependencies. You should run it like this: fab config.production service.stop service.recreateVirtualenv service.start --- services/amptrac/fabfile.py | 16 +++++++-- services/buildbot/fabfile.py | 62 ++++++++++++++++++++--------------- services/codespeed/fabfile.py | 22 +++++++++---- services/kenaan/fabfile.py | 12 ++++++- services/t-names/fabfile.py | 12 ++++++- services/t-web/fabfile.py | 13 ++++++-- services/trac/fabfile.py | 14 +++++--- 7 files changed, 107 insertions(+), 44 deletions(-) diff --git a/services/amptrac/fabfile.py b/services/amptrac/fabfile.py index 02a2e2f..fd8796e 100644 --- a/services/amptrac/fabfile.py +++ b/services/amptrac/fabfile.py @@ -38,9 +38,19 @@ def update(self): os.path.dirname(__file__) + '/*', self.configDir, mirror_local_mode=True) - self.venv.install_twisted() - self.venv.install('git+https://github.com/twisted-infra/amptrac.git') - self.venv.install('git+https://github.com/twisted-infra/amptrac-server') + self.task_recreateVirtualEnvironment() + + + def task_recreateVirtualEnvironment(self): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + self.venv.install_twisted() + self.venv.install('git+https://github.com/twisted-infra/amptrac.git') + self.venv.install('git+https://github.com/twisted-infra/amptrac-server') + def task_update(self): """ diff --git a/services/buildbot/fabfile.py b/services/buildbot/fabfile.py index 008a6ff..7ca36ae 100644 --- a/services/buildbot/fabfile.py +++ b/services/buildbot/fabfile.py @@ -87,36 +87,44 @@ def update(self, _installDeps=False): os.path.dirname(__file__) + '/start', self.configDir, mirror_local_mode=True) - buildbotSource = os.path.join(self.configDir, 'buildbot-source') - buildmasterSource = os.path.join(buildbotSource, 'master') - # For now we are using a buildbot eight HEAD due to a bug in - # 0.8.12 - # https://github.com/buildbot/buildbot/pull/1924 - # A forked branch is still used to control its version. - # If changes are required to this branch it should use a name - # other than `eight` to reduce confusion. - buildbotBranch = 'eight' - git.branch( - url='https://github.com/twisted-infra/buildbot', - destination=buildbotSource, - branch=buildbotBranch, - ) - - self.venv.install_twisted() - self.venv.install("virtualenv twisted==16.2 txacme==0.9.1 txgithub>=15.0.0") - - if _installDeps: - # sqlalchemy-migrate only works with a specific version of - # sqlalchemy. - self.venv.install( - 'sqlalchemy==0.7.10 sqlalchemy-migrate==0.7.2 ' - '{}'.format(buildmasterSource)) - else: - self.venv.install('--no-deps {}'.format(buildmasterSource)) - + self.task_recreateVirtualEnvironment(_installDeps) self.updatefast() + def task_recreateVirtualEnvironment(self, installDeps=False): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + self.venv.install_twisted() + self.venv.install("virtualenv twisted==16.2 txacme==0.9.1 txgithub>=15.0.0") + + buildbotSource = os.path.join(self.configDir, 'buildbot-source') + buildmasterSource = os.path.join(buildbotSource, 'master') + # For now we are using a buildbot eight HEAD due to a bug in + # 0.8.12 + # https://github.com/buildbot/buildbot/pull/1924 + # A forked branch is still used to control its version. + # If changes are required to this branch it should use a name + # other than `eight` to reduce confusion. + buildbotBranch = 'eight' + git.branch( + url='https://github.com/twisted-infra/buildbot', + destination=buildbotSource, + branch=buildbotBranch, + ) + + if installDeps: + # sqlalchemy-migrate only works with a specific version of + # sqlalchemy. + self.venv.install( + 'sqlalchemy==0.7.10 sqlalchemy-migrate==0.7.2 ' + '{}'.format(buildmasterSource)) + else: + self.venv.install('--no-deps {}'.format(buildmasterSource)) + + def updatefast(self): """ Update only some of the config. diff --git a/services/codespeed/fabfile.py b/services/codespeed/fabfile.py index 9abe70f..a4ddb7b 100644 --- a/services/codespeed/fabfile.py +++ b/services/codespeed/fabfile.py @@ -63,16 +63,26 @@ def update(self): os.path.dirname(__file__) + '/*', self.configDir, mirror_local_mode=True) - git.branch('https://github.com/tobami/codespeed.git', '~/codespeed') - with cd("~/codespeed"): - run("git checkout 9893b87de02bdc1ea6256207de5cc010b095b3a5") - run("git reset --hard") - self.venv.install_twisted() - self.venv.install('-r ~/codespeed/requirements.txt') + self.task_recreateVirtualEnvironment() if env.get('installTestData'): execute(self.task_installTestData) + + def task_recreateVirtualEnvironment(self): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + git.branch('https://github.com/tobami/codespeed.git', '~/codespeed') + with cd("~/codespeed"): + run("git checkout 9893b87de02bdc1ea6256207de5cc010b095b3a5") + run("git reset --hard") + self.venv.install_twisted() + self.venv.install('-r ~/codespeed/requirements.txt') + + def djangoAdmin(self, args): """ Run django-admin with proper settings. diff --git a/services/kenaan/fabfile.py b/services/kenaan/fabfile.py index de708bd..d4cf0f0 100644 --- a/services/kenaan/fabfile.py +++ b/services/kenaan/fabfile.py @@ -75,7 +75,7 @@ def update(self): ] run('mkdir -p ' + self.configDir) - self.venv.install("git+https://github.com/twisted-infra/amptrac.git") + self.task_recreateVirtualEnvironment() for f in filesToCopy: put(os.path.join(os.path.dirname(__file__), f), self.configDir, @@ -87,6 +87,16 @@ def update(self): execute(self.task_installTestData) + def task_recreateVirtualEnvironment(self): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + self.venv.install_twisted() + self.venv.install("git+https://github.com/twisted-infra/amptrac.git") + + def task_update(self): """ Update config and restart. diff --git a/services/t-names/fabfile.py b/services/t-names/fabfile.py index b8dec42..e24e898 100644 --- a/services/t-names/fabfile.py +++ b/services/t-names/fabfile.py @@ -35,12 +35,22 @@ def update(self): Update config. """ with settings(user=self.serviceUser): - self.venv.install_twisted() + self.task_recreateVirtualEnvironment() run('mkdir -p ' + self.configDir) put( os.path.dirname(__file__) + '/*', self.configDir, mirror_local_mode=True) + + def task_recreateVirtualEnvironment(self): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + self.venv.install_twisted() + + def task_update(self): """ Update config and restart. diff --git a/services/t-web/fabfile.py b/services/t-web/fabfile.py index 4fb0eef..72fe080 100644 --- a/services/t-web/fabfile.py +++ b/services/t-web/fabfile.py @@ -103,15 +103,24 @@ def task_updateSoftware(self): Update just the Twisted versions. """ self.task_stop() - self.venv.install_twisted() + self.task_recreateVirtualEnvironment() self.task_start() + def task_recreateVirtualEnvironment(self): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + self.venv.install_twisted() + + def update(self): """ Update config. """ - self.venv.install_twisted() + self.task_recreateVirtualEnvironment() with settings(user=self.serviceUser): run('mkdir -p ' + self.configDir) diff --git a/services/trac/fabfile.py b/services/trac/fabfile.py index b47e564..2fae33d 100644 --- a/services/trac/fabfile.py +++ b/services/trac/fabfile.py @@ -45,14 +45,20 @@ def update(self): Remove the current trac installation and reinstalls it. """ with settings(user=self.serviceUser): - self.venv.create() - run('mkdir -p ' + self.configDir) put(os.path.dirname(__file__) + '/*', self.configDir, mirror_local_mode=True) + self.task_recreateVirtualEnvironment() + - self.venv.install_twisted() - self.venv.install(" ".join(""" + def task_recreateVirtualEnvironment(self): + """ + Recreate the virtual environment. + """ + self.venv.remove() + self.venv.create() + self.venv.install_twisted() + self.venv.install(" ".join(""" psycopg2==2.6.2 pygments==1.6 spambayes==1.1b2