← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~ruinedyourlife/launchpad:native-pub-launchpad-channel into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/crafts/model/craftrecipebuildjob.py b/lib/lp/crafts/model/craftrecipebuildjob.py
> index 81b4912..2981e0b 100644
> --- a/lib/lp/crafts/model/craftrecipebuildjob.py
> +++ b/lib/lp/crafts/model/craftrecipebuildjob.py
> @@ -829,3 +827,35 @@ class CraftPublishingJob(CraftRecipeBuildJobDerived):
>              log.info("No version found in metadata.yaml, returning 'unknown'.")
>              return "unknown"
>          return str(metadata.get("version"))
> +
> +    def _get_series_name(self) -> str:
> +        """Return the distro series name for this build, or 'unknown'.
> +
> +        We derive the series from the build's `distro_arch_series` to prefix
> +        the channel value.
> +        """
> +        series_name = "unknown"
> +        try:
> +            das = getattr(self.build, "distro_arch_series", None)
> +            if (
> +                das is not None
> +                and getattr(das, "distroseries", None) is not None
> +            ):
> +                series_attr = getattr(das.distroseries, "name", None)
> +                if series_attr:
> +                    series_name = series_attr
> +        except Exception:

Won't this Exception being this general cause us to lose every error information within the try block? Should it not be more specific?

Also, would it be okay to have logging here?

> +            # Best-effort only; keep "unknown" on failure.
> +            pass
> +        return series_name
> +
> +    def _build_channel_value(self, version_str: str) -> str:
> +        """Compose the channel value as '<series>:<version>/stable'.
> +
> +        Falls back to 'unknown' when version or series cannot be resolved.
> +        """
> +        series_name = self._get_series_name()
> +        channel_suffix = (
> +            f"{version_str}/stable" if version_str else "unknown/stable"
> +        )
> +        return f"{series_name}:{channel_suffix}"


-- 
https://code.launchpad.net/~ruinedyourlife/launchpad/+git/launchpad/+merge/494761
Your team Launchpad code reviewers is requested to review the proposed merge of ~ruinedyourlife/launchpad:native-pub-launchpad-channel into launchpad:master.



References