diff mbox series

[kteam-tools] cranky: generate-update-conf: Add leading ~ or + to BACKPORT_SUFFIX

Message ID 20201104222500.38610-2-seth.forshee@canonical.com
State New
Headers show
Series [kteam-tools] cranky: generate-update-conf: Add leading ~ or + to BACKPORT_SUFFIX | expand

Commit Message

Seth Forshee Nov. 4, 2020, 10:24 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1902957

We currently rely on our packaging to add a ~ character in front
of BACKPORT_SUFFIX in version strings. However we have started
doing forward ports of kernels to the development series as well,
where we want this leading character to be + rather than ~. It's
difficult to figure out which leader is appropriate from our
kernel packaging, whereas when generating update.conf we have the
kernel series info which makes it rather trivial.

Update generate-update-conf to add the leader to BACKPORT_SUFFIX.
This will be a + if the "backport" series is later than the
source series, otherwise it will be a ~.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 cranky/fixes.d/generate-update-conf | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Kleber Sacilotto de Souza Nov. 6, 2020, 5:33 p.m. UTC | #1
On 04.11.20 23:24, Seth Forshee wrote:
> BugLink: https://bugs.launchpad.net/bugs/1902957
> 
> We currently rely on our packaging to add a ~ character in front
> of BACKPORT_SUFFIX in version strings. However we have started
> doing forward ports of kernels to the development series as well,
> where we want this leading character to be + rather than ~. It's
> difficult to figure out which leader is appropriate from our
> kernel packaging, whereas when generating update.conf we have the
> kernel series info which makes it rather trivial.
> 
> Update generate-update-conf to add the leader to BACKPORT_SUFFIX.
> This will be a + if the "backport" series is later than the
> source series, otherwise it will be a ~.
> 
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>

Applied to kteam-tools/master branch.

Thanks,
Kleber

> ---
>   cranky/fixes.d/generate-update-conf | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/cranky/fixes.d/generate-update-conf b/cranky/fixes.d/generate-update-conf
> index 343ef41b2cea..492d0aa569f9 100755
> --- a/cranky/fixes.d/generate-update-conf
> +++ b/cranky/fixes.d/generate-update-conf
> @@ -61,4 +61,10 @@ print("DEBIAN_MASTER=debian." + master_branch)
>   # startnewrelease" will use it to build the new release version
>   # following the format "${PARENT_VERSION}~${BACKPORT_SUFFIX}.N":
>   if source.backport:
> -    print("BACKPORT_SUFFIX={}".format(source.series.name))
> +    series = int(source.series.name.replace('.', ''))
> +    parent_series = int(parent_source.series.name.replace('.', ''))
> +    if series > parent_series:
> +        leader = "+"
> +    else:
> +        leader = "~"
> +    print("BACKPORT_SUFFIX={}{}".format(leader, source.series.name))
>
diff mbox series

Patch

diff --git a/cranky/fixes.d/generate-update-conf b/cranky/fixes.d/generate-update-conf
index 343ef41b2cea..492d0aa569f9 100755
--- a/cranky/fixes.d/generate-update-conf
+++ b/cranky/fixes.d/generate-update-conf
@@ -61,4 +61,10 @@  print("DEBIAN_MASTER=debian." + master_branch)
 # startnewrelease" will use it to build the new release version
 # following the format "${PARENT_VERSION}~${BACKPORT_SUFFIX}.N":
 if source.backport:
-    print("BACKPORT_SUFFIX={}".format(source.series.name))
+    series = int(source.series.name.replace('.', ''))
+    parent_series = int(parent_source.series.name.replace('.', ''))
+    if series > parent_series:
+        leader = "+"
+    else:
+        leader = "~"
+    print("BACKPORT_SUFFIX={}{}".format(leader, source.series.name))