Note: This issue was drafted by an AI assistant (GitHub Copilot CLI) on behalf of @lengau, based on investigation of a spread test failure in canonical/imagecraft.
Bug Description
ProjectService.is_effective_base_eol() does not handle a build-base/base of devel (or any base unrecognized by distro-support) the same way its sibling methods do, causing an unhandled UnknownVersionError crash.
Both check_base_is_supported() and base_eol_soon_date() already special-case or defensively catch this:
check_base_is_supported() explicitly treats a devel series as always-supported:
if build_base.series == "devel":
build_base = None
base_eol_soon_date() catches the error and assumes the base is supported:
except (UnknownDistributionError, UnknownVersionError):
# If distro-support doesn't know about this base, assume it's supported.
return None
However, is_effective_base_eol() has neither protection:
def is_effective_base_eol(self) -> bool:
"""Determine whether the base on which to build is end-of-life."""
base = craft_platforms.DistroBase.from_str(self.get().effective_base)
return not self._is_supported_on(base=base, date=datetime.date.today())
This method is called from commands/lifecycle.py::_check_supported_base() specifically on the --ignore=unmaintained path:
if "unmaintained" in ignore_items:
if project_service.is_effective_base_eol():
...
So any project with build-base: devel (or base: devel) that runs pack --ignore=unmaintained crashes with:
distro_support.errors.UnknownVersionError: Unknown version ubuntu devel
This is closely related to #986, but that issue was about an outdated pinned distro-support version for a real series (ubuntu@26.04), fixed by bumping the dependency. This case is different: devel is never going to be a version distro-support recognizes, so bumping the dependency won't fix it — the code path itself needs the same devel/UnknownVersionError handling used elsewhere.
To Reproduce
- Create a project with:
base: bare
build-base: devel
- Run
<app> pack --ignore=unmaintained.
Relevant log output
imagecraft internal error: UnknownVersionError('Unknown version ubuntu devel')
Traceback (most recent call last):
...
File ".../craft_application/commands/lifecycle.py", line 227, in _check_supported_base
if project_service.is_effective_base_eol():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../craft_application/services/project.py", line 761, in is_effective_base_eol
base = craft_platforms.DistroBase.from_str(self.get().effective_base)
File ".../craft_application/services/project.py", line 694, in _is_supported_on
support_range = distro_support.get_support_range(base.distribution, base.series)
File ".../distro_support/__init__.py", line 19, in get_support_range
raise UnknownVersionError(distribution, version)
distro_support.errors.UnknownVersionError: Unknown version ubuntu devel
Suggested fix
Give is_effective_base_eol() the same treatment as check_base_is_supported()/base_eol_soon_date(): treat a devel series as always-supported (not EOL), and/or catch (UnknownDistributionError, UnknownVersionError) and assume the base is supported when distro-support doesn't recognize it.
Bug Description
ProjectService.is_effective_base_eol()does not handle abuild-base/baseofdevel(or any base unrecognized bydistro-support) the same way its sibling methods do, causing an unhandledUnknownVersionErrorcrash.Both
check_base_is_supported()andbase_eol_soon_date()already special-case or defensively catch this:check_base_is_supported()explicitly treats adevelseries as always-supported:base_eol_soon_date()catches the error and assumes the base is supported:However,
is_effective_base_eol()has neither protection:This method is called from
commands/lifecycle.py::_check_supported_base()specifically on the--ignore=unmaintainedpath:So any project with
build-base: devel(orbase: devel) that runspack --ignore=unmaintainedcrashes with:This is closely related to #986, but that issue was about an outdated pinned
distro-supportversion for a real series (ubuntu@26.04), fixed by bumping the dependency. This case is different:develis never going to be a versiondistro-supportrecognizes, so bumping the dependency won't fix it — the code path itself needs the samedevel/UnknownVersionErrorhandling used elsewhere.To Reproduce
<app> pack --ignore=unmaintained.Relevant log output
Suggested fix
Give
is_effective_base_eol()the same treatment ascheck_base_is_supported()/base_eol_soon_date(): treat adevelseries as always-supported (not EOL), and/or catch(UnknownDistributionError, UnknownVersionError)and assume the base is supported whendistro-supportdoesn't recognize it.