Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-33631 Ubuntu/Debian MYSQL_SERVER_SUFFIX is version+suffix on Mar… #3116

Merged

Conversation

grooverdan
Copy link
Member

  • The Jira issue number for this PR is: MDEV-33631

Description

…iaDB packaged versions

The debian/rules removed sufficient version information from the downstream version, however the mariadb upstream has a + separator from the suffix.

The result is compilation with:
-DMYSQL_SERVER_SUFFIX="-1:10.4.34+maria~deb10" \

Compared to Debian:
-DMYSQL_SERVER_SUFFIX="-1~deb12u1" \

The impact comes into play with SELECT VERSION():
10.4.34-MariaDB-1:10.4.34+maria~deb10

A more abbreviated form of the following is much more human/machine parsable:
10.6.16-MariaDB-1~ubu2004

Release Notes

Removed duplicate version information in VERSION() for MariaDB debian/ubuntu packages.

How can this PR be tested?

TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.
Consult the documentation on "Writing good test cases".

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature and the PR is based against the latest MariaDB development branch.
  • This is a bug fix and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

Notablely I have assumed a Debian -1 suffix beginning.

@grooverdan grooverdan requested a review from ottok March 8, 2024 05:56
@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label Mar 8, 2024
@ottok
Copy link
Contributor

ottok commented Mar 8, 2024 via email

@grooverdan
Copy link
Member Author

sed in PR not quite right yet.

Goal is to take a native DEB_VERSION and an autobake.sh version and generate a suffix that doesn't include the full version.

The current behaviour is:

$ echo -e '1:10.11.4-1~deb12u1\n1:10.6.18+maria~ubu2204' | sed -e 's/^.*-//'
1~deb12u1
1:10.6.18+maria~ubu2204

Native (preserve existing behaviour):
(DEB_VERSION) 1:10.11.4-1~deb12u1

Desired suffix: 1~deb12u1

autobake:
(DEB_VERISON) 1:10.6.18+maria~ubu2204

Desired Suffix: 1~ubu2204

(or does it need a "1" at all).

Test of the best regex I have so far:

$ echo -e '1:10.11.4-1~deb12u1\n1:10.6.18+maria~ubu2204' | sed -e 's/\([0-9]*\):.*\(~.*\)/\1\2/'
1~deb12u1
1~ubu2204

This is taking the leading 1 from the DEB_VERSION rather than the 1~deb12u1 prefix, but I'm having trouble engineering the right regex to capture both.

@ottok
Copy link
Contributor

ottok commented Mar 12, 2024 via email

@grooverdan
Copy link
Member Author

The version number in the package isn't something I want to interfere with, its just the MYSQL_SERVER_SUFFIX that is used to generate the string used by SELECT VERSION(), as can be seen on containers and mariadb.org deb/ubuntu packages:

$ podman exec -ti m1011 mariadb -pbob -e 'select version()'
+-----------------------------------------+
| version()                               |
+-----------------------------------------+
| 10.11.6-MariaDB-1:10.11.6+maria~ubu2204 |
+-----------------------------------------+

Its a bit repetitive. I'm thinking 10.11.6-MariaDB-1~ubu2204 is desired.

A deb package would return be 10.11.6-MariaDB-1~deb12u1 (I think), so I'm just trying to normalize to one version number in the string and an appropriate suffix, with the same sort of format..

@ottok
Copy link
Contributor

ottok commented Mar 13, 2024

Agree, the desired end result for the version query would be:

$ podman exec -ti m1011 mariadb -pbob -e 'select version()'
+-----------------------------------------+
| version()                               |
+-----------------------------------------+
| 10.11.6-MariaDB~ubu2204            |
+-----------------------------------------+

You don't need the Debian/Ubuntu revision -1 in this at all.

Just for reference about the Debian package version:

  • Debian unstable (inherited to both Debian and Ubuntu if package unchanged): 1:10.11.6-2
  • Ubuntu stable updates example: 1:10.11.6-0ubuntu0.23.10.2
  • Debian stable updates example: 1:10.11.4-1~deb12u1

@grooverdan
Copy link
Member Author

So on regex:

$ echo -e '1:10.11.4-1~deb12u1\n1:10.6.18+maria~ubu2204\n1:10.11.6-2\n1:10.11.6-2\n1:10.11.4-1~deb12u1' | sed -e 's/.*[~-]\(.*\)/~\1/'
~deb12u1
~ubu2204
~2
~2
~deb12u1

@grooverdan grooverdan force-pushed the 10.4-MDEV-33631-debian-version-suffix branch 2 times, most recently from 596dc80 to 1ba7599 Compare March 18, 2024 22:23
@ottok
Copy link
Contributor

ottok commented Apr 8, 2024

I tested this in downstream Debian rules file:

diff --git a/debian/rules b/debian/rules
index 45c74f740a5..5a8597113fa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,7 +26,11 @@ ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
 endif
 
 BUILDDIR := builddir
+dumpvar = $(info variable `$1` value is >>>$($1)<<<)
+$(call dumpvar,DEB_VERSION)

The build log contain:

variable `DEB_VERSION` value is >>>1:10.11.7-4<<<
...
echo "server:Version=1:10.11.7-4" >> debian/substvars
...
sed -i 's/__MARIADB_MAJOR_VER__/10.11/g' debian/mariadb-server.post* debian/mariadb-server.preinst
...
    -DMYSQL_SERVER_SUFFIX="-4" \

Also tested manually:

± echo $DEB_VERSION | sed -e 's/^.*-//'
4
± echo $DEB_VERSION | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/'
10.11.7
± echo 10.11.7 | sed -e 's/^\(.*\)\..*$$/\1/'
10.11.7

Not sure why build logs has dash in -4 while the sed output does not have..

Anyway, your suggested new regex would work in Debian downstream equally well:

± echo $DEB_VERSION | sed -e 's/.*[~-]\(.*\)/\1/'
4

…iaDB packaged versions

The debian/rules removed sufficient version information from the
downstream version, however the mariadb upstream has a +
separator from the suffix.

While we are at it, remove the Debian/Ubuntu revision -1.

Other revisions used:
* Debian unstable (inherited to both Debian and Ubuntu if package unchanged): 1:10.11.6-2
* Ubuntu stable updates example: 1:10.11.6-0ubuntu0.23.10.2
* Debian stable updates example: 1:10.11.4-1~deb12u1

The result is compulation with:
    -DMYSQL_SERVER_SUFFIX="-1:10.4.34+maria~deb10" \

Compared to Debian:
    -DMYSQL_SERVER_SUFFIX="-1~deb12u1" \

The impact comes into play with SELECT VERSION():
    10.4.34-MariaDB-1:10.4.34+maria~deb10

A more abbreviated form of the following is much more human/machine parsable:
    10.6.16-MariaDB~ubu2004

Reviewer: Otto Kekäläinen
@grooverdan grooverdan force-pushed the 10.4-MDEV-33631-debian-version-suffix branch from 1ba7599 to 2bc4049 Compare April 30, 2024 13:10
@grooverdan grooverdan changed the base branch from 10.4 to 10.5 April 30, 2024 13:10
@grooverdan grooverdan enabled auto-merge (rebase) April 30, 2024 13:11
@grooverdan grooverdan merged commit e63ed4e into MariaDB:10.5 Apr 30, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MariaDB Foundation Pull requests created by MariaDB Foundation
2 participants