From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1278244-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 6C51C13835A
	for <garchives@archives.gentoo.org>; Tue,  4 May 2021 16:05:23 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7A9E8E075F;
	Tue,  4 May 2021 16:05:22 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 577F7E075F
	for <gentoo-commits@lists.gentoo.org>; Tue,  4 May 2021 16:05:22 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 3DD1E335DBE
	for <gentoo-commits@lists.gentoo.org>; Tue,  4 May 2021 16:05:21 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id B8AC459C
	for <gentoo-commits@lists.gentoo.org>; Tue,  4 May 2021 16:05:19 +0000 (UTC)
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" <asturm@gentoo.org>
Message-ID: <1620143751.26e8ae85e284ba49fef6ac7b2c7e74b697b3c2ed.asturm@gentoo>
Subject: [gentoo-commits] proj/kde:master commit in: media-sound/amarok/
X-VCS-Repository: proj/kde
X-VCS-Files: media-sound/amarok/amarok-9999.ebuild
X-VCS-Directories: media-sound/amarok/
X-VCS-Committer: asturm
X-VCS-Committer-Name: Andreas Sturmlechner
X-VCS-Revision: 26e8ae85e284ba49fef6ac7b2c7e74b697b3c2ed
X-VCS-Branch: master
Date: Tue,  4 May 2021 16:05:19 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 847136de-9585-4525-aeaa-07d69facd7dd
X-Archives-Hash: 3f17266b49f8679cd981056f5e3d452a

commit:     26e8ae85e284ba49fef6ac7b2c7e74b697b3c2ed
Author:     band-a-prend <torokhov-s-a <AT> yandex <DOT> ru>
AuthorDate: Tue Apr 13 21:00:22 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue May  4 15:55:51 2021 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=26e8ae85

media-sound/amarok: Add optfeature and pkg_config to create database

Add optfeature 'kde-apps/audiocd-kio' for Audio CD support.

Add additional pkg_postinst() elog messages with URLs to pages
with preliminary configuration of MySQL/MariaDB Server.

Add elog messages with steps to create Amarok external database
with 'emerge --config amarok' command and switching to use it.

Add simple short pkg_config() to create Amarok external database
with it's default username/password.

Committer-comment: Drop unrelated minor changes and fix mix of ewarn/einfo.

Closes: https://github.com/gentoo/kde/pull/899
Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 media-sound/amarok/amarok-9999.ebuild | 37 +++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/media-sound/amarok/amarok-9999.ebuild b/media-sound/amarok/amarok-9999.ebuild
index 4f26e37cef..397a86c538 100644
--- a/media-sound/amarok/amarok-9999.ebuild
+++ b/media-sound/amarok/amarok-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 ECM_HANDBOOK="forceoptional"
 KFMIN=5.74.0
 QTMIN=5.15.2
-inherit ecm kde.org
+inherit ecm kde.org optfeature
 
 DESCRIPTION="Advanced audio player based on KDE frameworks"
 HOMEPAGE="https://amarok.kde.org/"
@@ -111,11 +111,40 @@ pkg_postinst() {
 		echo "${1} ($(has_version ${1} || echo "not ")installed)"
 	}
 
+	optfeature "Audio CD support" kde-apps/audiocd-kio
+
 	if [[ -z "${REPLACING_VERSIONS}" ]]; then
-		elog "You'll have to configure amarok to use an external db server:"
-		use mariadb && elog "    $(pkg_is_installed dev-db/mariadb)" ||
+		elog "You'll have to configure amarok to use an external database server:"
+		if use mariadb ; then
+			elog "    $(pkg_is_installed dev-db/mariadb)"
+			elog "    For preliminary configuration of MariaDB Server please refer to"
+			elog "    https://wiki.gentoo.org/wiki/MariaDB#Configuration"
+		else
 			elog "    $(pkg_is_installed dev-db/mysql)"
+			elog "    For preliminary configuration of MySQL Server please refer to"
+			elog "    https://wiki.gentoo.org/wiki/MySQL#Configuration"
+		fi
 		elog "Please read https://community.kde.org/Amarok/Community/MySQL for details on how"
-		elog "to configure the external db and migrate your data from the embedded database."
+		elog "to configure the external database and migrate your data from the embedded database."
+		elog "To create external amarok database with default user/password please:"
+		elog "    1. Make sure that MySQL or MariaDB is installed and configured (see above)"
+		elog "    2. Ensure that 'mysql' service is started and then run command 'emerge --config amarok'"
+		elog "    3. On 'Configure Amarok - Database' menu page check 'Use external MySQL database' and press OK"
+	fi
+}
+
+pkg_config() {
+	# Create external mysql database with amarok default user/password
+	local AMAROK_DB_NAME="amarokdb"
+	local AMAROK_DB_USER_NAME="amarokuser"
+	local AMAROK_DB_USER_PWD="password"
+
+	einfo "Initializing ${PN} MySQL database 'amarokdb':"
+	einfo "If prompted for a password, please enter your MySQL root password."
+	einfo
+
+	if [[ -e "${EROOT}"/usr/bin/mysql ]]; then
+		"${EROOT}"/usr/bin/mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS ${AMAROK_DB_NAME}; GRANT ALL PRIVILEGES ON ${AMAROK_DB_NAME}.* TO '${AMAROK_DB_USER_NAME}' IDENTIFIED BY '${AMAROK_DB_USER_PWD}'; FLUSH PRIVILEGES;"
 	fi
+	einfo "${PN} MySQL database 'amarokdb' successfully initialized!"
 }