mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
upgrades: Treat n/a release as testing
Closes #2092 On testing and unstable systems, /etc/os-release does not contain VERSION_ID. In this case, lsb_release will report the release as "n/a". For unstable, this means that backports can be enabled in development mode. When this happens, trixie-backports will be added as an apt repository. The repository already exists, so it does not cause any problem. Tests: - In stable container, backports can be enabled. - In stable container, dist-upgrade can be disable and enabled. - In stable container, in development mode, dist-upgrade can be started. - In testing container, backports cannot be enabled. - In testing container, dist-upgrade cannot be enabled or started. - In testing container, in development mode, backports can be enabled. - In testing container, in development mode, dist-upgrade cannot be started. - In unstable container, in development mode, backports can be enabled (as trixie-backports). - In unstable container, in development mode, dist-upgrade cannot be started. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> [sunil: Merge the case of outdated unstable distributions that return 'unstable' as release and newer unstable distributions that return 'n/a'] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
be615e9cdb
commit
dceee56684
@ -10,8 +10,9 @@ from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import gettext_noop
|
||||
|
||||
import plinth
|
||||
from plinth import action_utils
|
||||
from plinth import app as app_module
|
||||
from plinth import action_utils, cfg, glib, kvstore, menu, package
|
||||
from plinth import cfg, glib, kvstore, menu, package
|
||||
from plinth.config import DropinConfigs
|
||||
from plinth.daemon import RelatedDaemon
|
||||
from plinth.diagnostic_check import DiagnosticCheck, Result
|
||||
@ -294,17 +295,18 @@ def is_backports_current():
|
||||
|
||||
def can_activate_backports():
|
||||
"""Return whether backports can be activated."""
|
||||
release, _ = get_current_release()
|
||||
if release == 'unstable' or (release == 'testing' and not cfg.develop):
|
||||
return False
|
||||
if cfg.develop:
|
||||
return True
|
||||
|
||||
return True
|
||||
# Release will be 'n/a' in latest unstable and testing distributions.
|
||||
release, _ = get_current_release()
|
||||
return release not in ['unstable', 'testing', 'n/a']
|
||||
|
||||
|
||||
def can_enable_dist_upgrade():
|
||||
"""Return whether dist upgrade can be enabled."""
|
||||
release, _ = get_current_release()
|
||||
return release not in ['unstable', 'testing']
|
||||
return release not in ['unstable', 'testing', 'n/a']
|
||||
|
||||
|
||||
def can_test_dist_upgrade():
|
||||
|
||||
@ -257,7 +257,7 @@ def _check_and_backports_sources(develop=False):
|
||||
return
|
||||
|
||||
release, dist = get_current_release()
|
||||
if release == 'unstable' or (release == 'testing' and not develop):
|
||||
if release in ['unstable', 'testing', 'n/a'] and not develop:
|
||||
logging.info(f'System release is {release}. Skip enabling backports.')
|
||||
return
|
||||
|
||||
@ -326,7 +326,7 @@ def _check_dist_upgrade(test_upgrade=False) -> tuple[bool, str]:
|
||||
|
||||
from plinth.modules.upgrades import get_current_release
|
||||
release, dist = get_current_release()
|
||||
if release in ['unstable', 'testing']:
|
||||
if release in ['unstable', 'testing', 'n/a']:
|
||||
return (False, f'already-{release}')
|
||||
|
||||
check_dists = ['stable']
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user