Add pyfuse3 support for backup (borg) app

This commit is contained in:
Lance Edgar 2022-11-27 18:47:43 -06:00
parent a9bbee572a
commit 1fedc314b3

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar # Copyright © 2010-2022 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -55,6 +55,7 @@ def deploy_backup_everything(c, **context):
def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail', def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
python_exe='/usr/bin/python3', python_exe='/usr/bin/python3',
install_borg=False, install_borg=False,
pyfuse3=False,
link_borg_to_bin=True, link_borg_to_bin=True,
install_luigi=False, install_luigi=False,
luigi_history_db=None, luigi_history_db=None,
@ -93,9 +94,9 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
python.mkvirtualenv(c, envname, python=python_exe, runas_user=user) python.mkvirtualenv(c, envname, python=python_exe, runas_user=user)
# TODO: this should not be necessary, right? # TODO: this should not be necessary, right?
c.sudo('chown -R {}: {}'.format(user, envpath)) c.sudo('chown -R {}: {}'.format(user, envpath))
mkdir(c, os.path.join(envpath, 'src'), use_sudo=True, runas_user=user)
c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install -U pip setuptools wheel'".format(envpath), c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install -U pip setuptools wheel'".format(envpath),
user=user) user=user)
mkdir(c, os.path.join(envpath, 'src'), use_sudo=True, runas_user=user)
if install_rattail: if install_rattail:
@ -131,16 +132,18 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
# borg # borg
if install_borg: if install_borg:
if install_rattail: if isinstance(install_borg, list):
packages = [ packages = install_borg
'rattail[backup]', elif isinstance(install_borg, str):
] packages = [install_borg]
else: else:
# TODO: these should be same as rattail[backup] packages = ['msgpack']
packages = [ if pyfuse3:
'msgpack', apt.install(c, 'libfuse3-dev')
'borgbackup[fuse]', packages.append('borgbackup[pyfuse3]')
] else:
# TODO: this is legacy and should stop being default
packages.append('borgbackup[fuse]')
c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install {1}'".format(envpath, ' '.join(packages)), c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install {1}'".format(envpath, ' '.join(packages)),
user=user) user=user)
if link_borg_to_bin: if link_borg_to_bin: