From 7403d4679ff09a72694d55b41bf86746e50919ec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 11 Aug 2022 15:49:44 +0200 Subject: [PATCH 1/3] Unused vars, black --- .../0021_migrate_to_bullseye.py | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/yunohost/data_migrations/0021_migrate_to_bullseye.py b/src/yunohost/data_migrations/0021_migrate_to_bullseye.py index 3be8c9add..cb8a333f5 100644 --- a/src/yunohost/data_migrations/0021_migrate_to_bullseye.py +++ b/src/yunohost/data_migrations/0021_migrate_to_bullseye.py @@ -27,27 +27,24 @@ logger = getActionLogger("yunohost.migration") N_CURRENT_DEBIAN = 10 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 + 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 + 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") + 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): @@ -60,7 +57,7 @@ def _get_all_venvs(dir, level=0, maxlevel=3): def _backup_pip_freeze_for_python_app_venvs(): """ - Generate a requirements file for all python virtual env located inside /opt/ and /var/www/ + 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/") @@ -308,7 +305,6 @@ 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 @@ -344,21 +340,27 @@ class MyMigration(Migration): # Check system is up to date # (but we don't if 'bullseye' is already in the sources.list ... # which means maybe a previous upgrade crashed and we're re-running it) - if os.path.exists("/etc/apt/sources.list") and " bullseye " not in read_file("/etc/apt/sources.list"): + if os.path.exists("/etc/apt/sources.list") and " bullseye " not in read_file( + "/etc/apt/sources.list" + ): tools_update(target="system") upgradable_system_packages = list(_list_upgradable_apt_packages()) - upgradable_system_packages = [package["name"] for package in upgradable_system_packages] + upgradable_system_packages = [ + package["name"] for package in upgradable_system_packages + ] upgradable_system_packages = set(upgradable_system_packages) # Lime2 have hold packages to avoid ethernet instability # See https://github.com/YunoHost/arm-images/commit/b4ef8c99554fd1a122a306db7abacc4e2f2942df - lime2_hold_packages = set([ - "armbian-firmware", - "armbian-bsp-cli-lime2", - "linux-dtb-current-sunxi", - "linux-image-current-sunxi", - "linux-u-boot-lime2-current", - "linux-image-next-sunxi" - ]) + lime2_hold_packages = set( + [ + "armbian-firmware", + "armbian-bsp-cli-lime2", + "linux-dtb-current-sunxi", + "linux-image-current-sunxi", + "linux-u-boot-lime2-current", + "linux-image-next-sunxi", + ] + ) if upgradable_system_packages - lime2_hold_packages: raise YunohostError("migration_0021_system_not_fully_up_to_date") @@ -387,8 +389,8 @@ class MyMigration(Migration): message = m18n.n("migration_0021_general_warning") message = ( - "N.B.: This migration has been tested by the community over the last few months but has only been declared stable recently. If your server hosts critical services and if you are not too confident with debugging possible issues, we recommend you to wait a little bit more while we gather more feedback and polish things up. If on the other hand you are relatively confident with debugging small issues that may arise, you are encouraged to run this migration ;)! You can read about remaining known issues and feedback from the community here: https://forum.yunohost.org/t/20590\n\n" - + message + "N.B.: This migration has been tested by the community over the last few months but has only been declared stable recently. If your server hosts critical services and if you are not too confident with debugging possible issues, we recommend you to wait a little bit more while we gather more feedback and polish things up. If on the other hand you are relatively confident with debugging small issues that may arise, you are encouraged to run this migration ;)! You can read about remaining known issues and feedback from the community here: https://forum.yunohost.org/t/20590\n\n" + + message ) if problematic_apps: From 5fd74577c401ffff08fb4cc382b378d92f5557c2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 11 Aug 2022 15:51:03 +0200 Subject: [PATCH 2/3] /opt may not exist ... --- src/yunohost/data_migrations/0021_migrate_to_bullseye.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/yunohost/data_migrations/0021_migrate_to_bullseye.py b/src/yunohost/data_migrations/0021_migrate_to_bullseye.py index cb8a333f5..162b8e376 100644 --- a/src/yunohost/data_migrations/0021_migrate_to_bullseye.py +++ b/src/yunohost/data_migrations/0021_migrate_to_bullseye.py @@ -39,8 +39,11 @@ def _get_all_venvs(dir, level=0, maxlevel=3): 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 + if not os.path.exists(dir): + return [] + result = [] + # Using os functions instead of glob, because glob doesn't support hidden folders, and we need recursion with a fixed depth for file in os.listdir(dir): path = os.path.join(dir, file) if os.path.isdir(path): From 5d26fec9a54bc53141ed2bf1a8f87f13cb5bd817 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 11 Aug 2022 15:56:44 +0200 Subject: [PATCH 3/3] Update changelog for 4.4.2.1 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index e9e8b2d44..5582bb2ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +yunohost (4.4.2.1) stable; urgency=low + + - [fix] bullseye migration: /opt may not exist ... (5fd74577) + + -- Alexandre Aubin Thu, 11 Aug 2022 15:56:16 +0200 + yunohost (4.4.2) stable; urgency=low - Release as stable