mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge remote-tracking branch 'origin/buster' into dev
This commit is contained in:
commit
ad9b6661c2
2 changed files with 47 additions and 1 deletions
|
@ -487,6 +487,7 @@
|
|||
"main_domain_change_failed": "Unable to change the main domain",
|
||||
"main_domain_changed": "The main domain has been changed",
|
||||
"migration_0021_cleaning_up": "Cleaning up cache and packages not useful anymore...",
|
||||
"migration_0021_venv_regen_failed": "The virtual environment '{venv}' failed to regenerate, you probably need to run the command `yunohost app upgrade --force`",
|
||||
"migration_0021_general_warning": "Please note that this migration is a delicate operation. The YunoHost team did its best to review and test it, but the migration might still break parts of the system or its apps.\n\nTherefore, it is recommended to:\n - Perform a backup of any critical data or app. More info on https://yunohost.org/backup;\n - Be patient after launching the migration: Depending on your Internet connection and hardware, it might take up to a few hours for everything to upgrade.",
|
||||
"migration_0021_main_upgrade": "Starting main upgrade...",
|
||||
"migration_0021_modified_files": "Please note that the following files were found to be manually modified and might be overwritten following the upgrade: {manually_modified_files}",
|
||||
|
|
|
@ -30,6 +30,44 @@ N_CURRENT_YUNOHOST = 4
|
|||
N_NEXT_DEBAN = 11
|
||||
N_NEXT_YUNOHOST = 11
|
||||
|
||||
VENV_REQUIREMENTS_SUFFIX = ".requirements_backup_for_bullseye_upgrade.txt"
|
||||
|
||||
|
||||
def _get_all_venvs(dir, level=0, maxlevel=3):
|
||||
"""
|
||||
Returns the list of all python virtual env directories recursively
|
||||
|
||||
Arguments:
|
||||
dir - the directory to scan in
|
||||
maxlevel - the depth of the recursion
|
||||
level - do not edit this, used as an iterator
|
||||
"""
|
||||
# Using os functions instead of glob, because glob doesn't support hidden folders, and we need recursion with a fixed depth
|
||||
result = []
|
||||
for file in os.listdir(dir):
|
||||
path = os.path.join(dir, file)
|
||||
if os.path.isdir(path):
|
||||
activatepath = os.path.join(path,"bin", "activate")
|
||||
if os.path.isfile(activatepath):
|
||||
content = read_file(activatepath)
|
||||
if ("VIRTUAL_ENV" in content) and ("PYTHONHOME" in content):
|
||||
result.append(path)
|
||||
continue
|
||||
if level < maxlevel:
|
||||
result += _get_all_venvs(path, level=level + 1)
|
||||
return result
|
||||
|
||||
|
||||
def _backup_pip_freeze_for_python_app_venvs():
|
||||
"""
|
||||
Generate a requirements file for all python virtual env located inside /opt/ and /var/www/
|
||||
"""
|
||||
|
||||
venvs = _get_all_venvs("/opt/") + _get_all_venvs("/var/www/")
|
||||
for venv in venvs:
|
||||
# Generate a requirements file from venv
|
||||
os.system(f"{venv}/bin/pip freeze > {venv}{VENV_REQUIREMENTS_SUFFIX}")
|
||||
|
||||
|
||||
class MyMigration(Migration):
|
||||
|
||||
|
@ -70,6 +108,12 @@ class MyMigration(Migration):
|
|||
'wget --timeout 900 --quiet "https://packages.sury.org/php/apt.gpg" --output-document=- | gpg --dearmor >"/etc/apt/trusted.gpg.d/extra_php_version.gpg"'
|
||||
)
|
||||
|
||||
#
|
||||
# Get requirements of the different venvs from python apps
|
||||
#
|
||||
|
||||
_backup_pip_freeze_for_python_app_venvs()
|
||||
|
||||
#
|
||||
# Run apt update
|
||||
#
|
||||
|
@ -264,6 +308,7 @@ class MyMigration(Migration):
|
|||
|
||||
tools_upgrade(target="system", postupgradecmds=postupgradecmds)
|
||||
|
||||
|
||||
def debian_major_version(self):
|
||||
# The python module "platform" and lsb_release are not reliable because
|
||||
# on some setup, they may still return Release=9 even after upgrading to
|
||||
|
|
Loading…
Add table
Reference in a new issue