mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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
|
from django.utils.translation import gettext_noop
|
||||||
|
|
||||||
import plinth
|
import plinth
|
||||||
|
from plinth import action_utils
|
||||||
from plinth import app as app_module
|
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.config import DropinConfigs
|
||||||
from plinth.daemon import RelatedDaemon
|
from plinth.daemon import RelatedDaemon
|
||||||
from plinth.diagnostic_check import DiagnosticCheck, Result
|
from plinth.diagnostic_check import DiagnosticCheck, Result
|
||||||
@ -294,17 +295,18 @@ def is_backports_current():
|
|||||||
|
|
||||||
def can_activate_backports():
|
def can_activate_backports():
|
||||||
"""Return whether backports can be activated."""
|
"""Return whether backports can be activated."""
|
||||||
release, _ = get_current_release()
|
if cfg.develop:
|
||||||
if release == 'unstable' or (release == 'testing' and not cfg.develop):
|
return True
|
||||||
return False
|
|
||||||
|
|
||||||
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():
|
def can_enable_dist_upgrade():
|
||||||
"""Return whether dist upgrade can be enabled."""
|
"""Return whether dist upgrade can be enabled."""
|
||||||
release, _ = get_current_release()
|
release, _ = get_current_release()
|
||||||
return release not in ['unstable', 'testing']
|
return release not in ['unstable', 'testing', 'n/a']
|
||||||
|
|
||||||
|
|
||||||
def can_test_dist_upgrade():
|
def can_test_dist_upgrade():
|
||||||
|
|||||||
@ -257,7 +257,7 @@ def _check_and_backports_sources(develop=False):
|
|||||||
return
|
return
|
||||||
|
|
||||||
release, dist = get_current_release()
|
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.')
|
logging.info(f'System release is {release}. Skip enabling backports.')
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ def _check_dist_upgrade(test_upgrade=False) -> tuple[bool, str]:
|
|||||||
|
|
||||||
from plinth.modules.upgrades import get_current_release
|
from plinth.modules.upgrades import get_current_release
|
||||||
release, dist = 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}')
|
return (False, f'already-{release}')
|
||||||
|
|
||||||
check_dists = ['stable']
|
check_dists = ['stable']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user