diff mbox series

[layerindex-web,1/2] dockersetup: Switch from mysql to mariadb binaries

Message ID 20250224-mathieu-yp-compat-staff-v1-1-9b8d07f00af7@bootlin.com
State New
Headers show
Series layerindex: Allow staff to set Yocto compatibility | expand

Commit Message

Mathieu Dubois-Briand Feb. 24, 2025, 10:59 a.m. UTC
In the last versions of mariadb:lts docker container, the database
management binaries are named mariadb* instead of mysql*. This requires
some small modifications in our scripts.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 README                              | 4 ++--
 dockersetup.py                      | 6 +++---
 layerindex/tools/initial_db_dump.sh | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/README b/README
index 89dbd5b8326b..1335b7a97b36 100644
--- a/README
+++ b/README
@@ -412,12 +412,12 @@  To back up the database within the docker-based setup, you can run the
 following command (no need to substitute ${MYSQL_ROOT_PASSWORD}, it's
 already present within the container environment):
 
-docker-compose exec layersdb /bin/sh -c '/usr/bin/mysqldump -u root --password=${MYSQL_ROOT_PASSWORD} --max_allowed_packet=512M layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz
+docker-compose exec layersdb /bin/sh -c '/usr/bin/mariadb-dump -u root --password=${MYSQL_ROOT_PASSWORD} --max_allowed_packet=512M layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz
 
 To restore one of these backups you would run the following command (take
 care, this will overwrite the data immediately without prompting!):
 
-zcat backupfile.sql.gz | docker-compose exec -T layersdb /bin/sh -c '/usr/bin/mysql -u root --password=${MYSQL_ROOT_PASSWORD} layersdb'
+zcat backupfile.sql.gz | docker-compose exec -T layersdb /bin/sh -c '/usr/bin/mariadb -u root --password=${MYSQL_ROOT_PASSWORD} layersdb'
 
 
 
diff --git a/dockersetup.py b/dockersetup.py
index 21be0dad32a0..bc7478c34bec 100755
--- a/dockersetup.py
+++ b/dockersetup.py
@@ -798,7 +798,7 @@  while True:
     env = os.environ.copy()
     env['MYSQL_PWD'] = dbapassword
     # Dummy command, we just want to establish that the db can be connected to
-    return_code = subprocess.call("echo | docker-compose exec -T -e MYSQL_PWD layersdb mysql -uroot layersdb", shell=True, env=env)
+    return_code = subprocess.call("echo | docker-compose exec -T -e MYSQL_PWD layersdb mariadb -uroot layersdb", shell=True, env=env)
     if return_code == 0:
         break
     else:
@@ -820,7 +820,7 @@  if not args.update:
             catcmd = 'cat'
         env = os.environ.copy()
         env['MYSQL_PWD'] = dbapassword
-        return_code = subprocess.call("%s %s | docker-compose exec -T -e MYSQL_PWD layersdb mysql -uroot layersdb" % (catcmd, quote(args.databasefile)), shell=True, env=env)
+        return_code = subprocess.call("%s %s | docker-compose exec -T -e MYSQL_PWD layersdb mariadb -uroot layersdb" % (catcmd, quote(args.databasefile)), shell=True, env=env)
         if return_code != 0:
             print("Database import failed")
             sys.exit(1)
@@ -848,7 +848,7 @@  if not args.update:
         # (avoids password being visible through ps or /proc/<pid>/cmdline)
         env = os.environ.copy()
         env['MYSQL_PWD'] = dbapassword
-        return_code = subprocess.call("docker-compose exec -T -e MYSQL_PWD layersdb mysql -uroot layersdb < " + quote(sqlscriptfile), shell=True, env=env)
+        return_code = subprocess.call("docker-compose exec -T -e MYSQL_PWD layersdb mariadb -uroot layersdb < " + quote(sqlscriptfile), shell=True, env=env)
         if return_code != 0:
             print("Creating database user failed")
             sys.exit(1)
diff --git a/layerindex/tools/initial_db_dump.sh b/layerindex/tools/initial_db_dump.sh
index 1675092e904e..a8648c637fe3 100755
--- a/layerindex/tools/initial_db_dump.sh
+++ b/layerindex/tools/initial_db_dump.sh
@@ -31,9 +31,9 @@  fi
 # This will ask for the password twice, not much we can really do about
 # that though
 # First, get the structure without data
-mysqldump $1 -u root -p --no-data > $2
+mariadb-dump $1 -u root -p --no-data > $2
 # Second, the data with a number of exclusions
-mysqldump $1 -u root -p --no-create-info \
+mariadb-dump $1 -u root -p --no-create-info \
   --ignore-table=$1.auth_group \
   --ignore-table=$1.auth_group_permissions \
   --ignore-table=$1.auth_permission \