public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: /
Date: Fri, 12 Jul 2013 14:03:39 +0000 (UTC)	[thread overview]
Message-ID: <1373637694.ad9c06ed19a4af7ef245c54feb3bd4f0a15cccf3.dywi@gentoo> (raw)

commit:     ad9c06ed19a4af7ef245c54feb3bd4f0a15cccf3
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 12 14:01:34 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 12 14:01:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ad9c06ed

ebuild: set up roverlay via pkg_config()

---
 roverlay-9999.ebuild | 146 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 141 insertions(+), 5 deletions(-)

diff --git a/roverlay-9999.ebuild b/roverlay-9999.ebuild
index bcc4cec..0e21409 100644
--- a/roverlay-9999.ebuild
+++ b/roverlay-9999.ebuild
@@ -8,9 +8,10 @@ EAPI=4
 PYTHON_COMPAT="python2_7 python3_1 python3_2"
 PYTHON_USE="ssl"
 
-inherit base python-distutils-ng git-2
+inherit base python-distutils-ng git-2 user
 
 EGIT_REPO_URI='git://git.overlays.gentoo.org/proj/R_overlay.git'
+#EGIT_BRANCH='gsoc13/next'
 
 DESCRIPTION="Automatically generated overlay of R packages (SoC2012)"
 HOMEPAGE="http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary"
@@ -18,15 +19,15 @@ SRC_URI=""
 
 LICENSE="GPL-2+"
 SLOT="0"
-IUSE="bzip2 +prebuilt-documentation"
+IUSE="-bzip2 +prebuilt-documentation"
 
 KEYWORDS=""
 
-DEPEND="
-	dev-python/setuptools
+_CDEPEND="dev-python/setuptools"
+DEPEND="${_CDEPEND}
 	!prebuilt-documentation? ( >=dev-python/docutils-0.9 )
 "
-RDEPEND="
+RDEPEND="${_CDEPEND}
 	sys-apps/portage
 	virtual/python-argparse
 "
@@ -60,3 +61,138 @@ python_install_all() {
 	#  (due to the default config file)
 	keepdir /etc/${PN}/{files,package-rules.d}
 }
+
+pkg_setup() {
+	enewgroup roverlay
+}
+
+pkg_config() {
+	## vars
+	local DEFAULT_CONF_ROOT="${ROOT}etc/${PN}"
+
+	local roverlay_user="roverlay"
+	local roverlay_group="roverlay"
+	#local user_is_root
+	local want_conf_import
+
+	local data_root="${ROOT}usr/share/${PN}"
+	local conf_root
+	local work_root
+
+	local input
+
+	## get user input
+	einfo "Enter user/uid that will run ${PN} (user has to exist!) ['${roverlay_user}']:"
+	# input= not strictly needed
+	input=; read input
+	[[ -z "${input}" ]] || roverlay_user="${input}"
+
+	egetent passwd "${roverlay_user}" 1>/dev/null || \
+		die "no such user/uid: ${roverlay_user}"
+
+	case "${roverlay_user}" in
+		'0'|'root')
+			#user_is_root=y
+
+			work_root="${ROOT}var/${PN}"
+			conf_root="${DEFAULT_CONF_ROOT}"
+			config_file="${conf_root}/R-overlay.conf"
+
+			einfo "config root is ${conf_root}"
+			want_conf_import=n
+		;;
+		*)
+			#user_is_root=n
+
+			# get user config location
+			input="$(egethome ${roverlay_user})"
+			[[ -d "${input}" ]] || die "user has no home directory: ${input}"
+
+			work_root="${input}/${PN}"
+			conf_root="${work_root}/config"
+			config_file="${work_root}/R-overlay.conf"
+
+			if [[ ! -e "${conf_root}" ]]; then
+				einfo "config root is ${conf_root} (will be created)"
+				want_conf_import=y
+			else
+				einfo "config root is ${conf_root} (already exists)"
+				want_conf_import=n
+			fi
+
+			einfo "Import default config (${DEFAULT_CONF_ROOT})? (y/n) ['${want_conf_import}']"
+			input=; read input
+			case "${input}" in
+				'')
+					true
+				;;
+				'y'|'n')
+					want_conf_import="${input}"
+				;;
+				*)
+					die "answer '${input}' not understood."
+				;;
+			esac
+		;;
+	esac
+
+	if [[ -e "${config_file}" ]]; then
+		einfo "This will overwrite ${config_file}!"
+		echo
+	fi
+
+	einfo "Enter the directory for 'work' data (overlay, distfiles, mirror) ['${work_root}']:"
+
+	input=; read input
+	[[ -z "${input}" ]] || work_root="${input}"
+
+	einfo "Enter additional variables (VAR=VALUE) [optional]:"
+	input=; read input
+
+	## print what would be done
+	local noconf="(not configurable)"
+	echo
+	einfo "Configuration:"
+	einfo "- user/uid             : ${roverlay_user}"
+	einfo "- group/gid            : ${roverlay_group} ${noconf}"
+	einfo "- work root            : ${work_root}"
+	einfo "- data root            : ${data_root} ${noconf}"
+	einfo "- config root          : ${conf_root}"
+	einfo "- import config        : ${want_conf_import}"
+	einfo "- additional variables : ${input:-<none>}"
+	einfo
+	einfo "Press Enter to continue..."
+	read
+
+	## do it
+	ebegin "Creating temporary config file"
+	/usr/bin/roverlay-mkconfig -O "${T}/${PF}.config" \
+		-W "${work_root}" -D "${data_root}" -C "${conf_root}" -- ${input-}
+	eend $? || die
+
+	if [[ "${want_conf_import}" == "y" ]]; then
+		[[ -d "${conf_root}" ]] || mkdir -p "${conf_root}" || \
+			die "cannot create ${conf_root}"
+
+		ebegin "Importing default config (${DEFAULT_CONF_ROOT})"
+		cp -dRu --preserve=mode,timestamps \
+			"${DEFAULT_CONF_ROOT}"/* "${conf_root}"/ && \
+			chown -Rh --from="root:root" \
+				"${roverlay_user}:${roverlay_group}" "${conf_root}"
+		eend $? || die
+	fi
+
+	ebegin "Creating directories"
+	/usr/bin/roverlay --config "${T}/${PF}.config" \
+		--target-uid ${roverlay_user} --target-gid ${roverlay_group} setupdirs
+	eend $? || die
+
+	ebegin "Copying new config file to ${config_file}"
+	cp --preserve=mode,timestamps "${T}/${PF}.config" "${config_file}" && \
+	chown "${roverlay_user}:${roverlay_group}" "${config_file}"
+	eend $? || die
+
+	echo
+	einfo "Configuration for user '${roverlay_user}' is complete."
+	einfo "You can run '${PN} --print-config' (as user) to verify it."
+}


WARNING: multiple messages have this Message-ID (diff)
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: /
Date: Fri, 12 Jul 2013 14:03:39 +0000 (UTC)	[thread overview]
Message-ID: <1373637694.ad9c06ed19a4af7ef245c54feb3bd4f0a15cccf3.dywi@gentoo> (raw)
Message-ID: <20130712140339.WvJKE7v5G0r2pvYE4wQBmQPZO9fpSd_oNYCLNTFGmZA@z> (raw)

commit:     ad9c06ed19a4af7ef245c54feb3bd4f0a15cccf3
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 12 14:01:34 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 12 14:01:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ad9c06ed

ebuild: set up roverlay via pkg_config()

---
 roverlay-9999.ebuild | 146 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 141 insertions(+), 5 deletions(-)

diff --git a/roverlay-9999.ebuild b/roverlay-9999.ebuild
index bcc4cec..0e21409 100644
--- a/roverlay-9999.ebuild
+++ b/roverlay-9999.ebuild
@@ -8,9 +8,10 @@ EAPI=4
 PYTHON_COMPAT="python2_7 python3_1 python3_2"
 PYTHON_USE="ssl"
 
-inherit base python-distutils-ng git-2
+inherit base python-distutils-ng git-2 user
 
 EGIT_REPO_URI='git://git.overlays.gentoo.org/proj/R_overlay.git'
+#EGIT_BRANCH='gsoc13/next'
 
 DESCRIPTION="Automatically generated overlay of R packages (SoC2012)"
 HOMEPAGE="http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary"
@@ -18,15 +19,15 @@ SRC_URI=""
 
 LICENSE="GPL-2+"
 SLOT="0"
-IUSE="bzip2 +prebuilt-documentation"
+IUSE="-bzip2 +prebuilt-documentation"
 
 KEYWORDS=""
 
-DEPEND="
-	dev-python/setuptools
+_CDEPEND="dev-python/setuptools"
+DEPEND="${_CDEPEND}
 	!prebuilt-documentation? ( >=dev-python/docutils-0.9 )
 "
-RDEPEND="
+RDEPEND="${_CDEPEND}
 	sys-apps/portage
 	virtual/python-argparse
 "
@@ -60,3 +61,138 @@ python_install_all() {
 	#  (due to the default config file)
 	keepdir /etc/${PN}/{files,package-rules.d}
 }
+
+pkg_setup() {
+	enewgroup roverlay
+}
+
+pkg_config() {
+	## vars
+	local DEFAULT_CONF_ROOT="${ROOT}etc/${PN}"
+
+	local roverlay_user="roverlay"
+	local roverlay_group="roverlay"
+	#local user_is_root
+	local want_conf_import
+
+	local data_root="${ROOT}usr/share/${PN}"
+	local conf_root
+	local work_root
+
+	local input
+
+	## get user input
+	einfo "Enter user/uid that will run ${PN} (user has to exist!) ['${roverlay_user}']:"
+	# input= not strictly needed
+	input=; read input
+	[[ -z "${input}" ]] || roverlay_user="${input}"
+
+	egetent passwd "${roverlay_user}" 1>/dev/null || \
+		die "no such user/uid: ${roverlay_user}"
+
+	case "${roverlay_user}" in
+		'0'|'root')
+			#user_is_root=y
+
+			work_root="${ROOT}var/${PN}"
+			conf_root="${DEFAULT_CONF_ROOT}"
+			config_file="${conf_root}/R-overlay.conf"
+
+			einfo "config root is ${conf_root}"
+			want_conf_import=n
+		;;
+		*)
+			#user_is_root=n
+
+			# get user config location
+			input="$(egethome ${roverlay_user})"
+			[[ -d "${input}" ]] || die "user has no home directory: ${input}"
+
+			work_root="${input}/${PN}"
+			conf_root="${work_root}/config"
+			config_file="${work_root}/R-overlay.conf"
+
+			if [[ ! -e "${conf_root}" ]]; then
+				einfo "config root is ${conf_root} (will be created)"
+				want_conf_import=y
+			else
+				einfo "config root is ${conf_root} (already exists)"
+				want_conf_import=n
+			fi
+
+			einfo "Import default config (${DEFAULT_CONF_ROOT})? (y/n) ['${want_conf_import}']"
+			input=; read input
+			case "${input}" in
+				'')
+					true
+				;;
+				'y'|'n')
+					want_conf_import="${input}"
+				;;
+				*)
+					die "answer '${input}' not understood."
+				;;
+			esac
+		;;
+	esac
+
+	if [[ -e "${config_file}" ]]; then
+		einfo "This will overwrite ${config_file}!"
+		echo
+	fi
+
+	einfo "Enter the directory for 'work' data (overlay, distfiles, mirror) ['${work_root}']:"
+
+	input=; read input
+	[[ -z "${input}" ]] || work_root="${input}"
+
+	einfo "Enter additional variables (VAR=VALUE) [optional]:"
+	input=; read input
+
+	## print what would be done
+	local noconf="(not configurable)"
+	echo
+	einfo "Configuration:"
+	einfo "- user/uid             : ${roverlay_user}"
+	einfo "- group/gid            : ${roverlay_group} ${noconf}"
+	einfo "- work root            : ${work_root}"
+	einfo "- data root            : ${data_root} ${noconf}"
+	einfo "- config root          : ${conf_root}"
+	einfo "- import config        : ${want_conf_import}"
+	einfo "- additional variables : ${input:-<none>}"
+	einfo
+	einfo "Press Enter to continue..."
+	read
+
+	## do it
+	ebegin "Creating temporary config file"
+	/usr/bin/roverlay-mkconfig -O "${T}/${PF}.config" \
+		-W "${work_root}" -D "${data_root}" -C "${conf_root}" -- ${input-}
+	eend $? || die
+
+	if [[ "${want_conf_import}" == "y" ]]; then
+		[[ -d "${conf_root}" ]] || mkdir -p "${conf_root}" || \
+			die "cannot create ${conf_root}"
+
+		ebegin "Importing default config (${DEFAULT_CONF_ROOT})"
+		cp -dRu --preserve=mode,timestamps \
+			"${DEFAULT_CONF_ROOT}"/* "${conf_root}"/ && \
+			chown -Rh --from="root:root" \
+				"${roverlay_user}:${roverlay_group}" "${conf_root}"
+		eend $? || die
+	fi
+
+	ebegin "Creating directories"
+	/usr/bin/roverlay --config "${T}/${PF}.config" \
+		--target-uid ${roverlay_user} --target-gid ${roverlay_group} setupdirs
+	eend $? || die
+
+	ebegin "Copying new config file to ${config_file}"
+	cp --preserve=mode,timestamps "${T}/${PF}.config" "${config_file}" && \
+	chown "${roverlay_user}:${roverlay_group}" "${config_file}"
+	eend $? || die
+
+	echo
+	einfo "Configuration for user '${roverlay_user}' is complete."
+	einfo "You can run '${PN} --print-config' (as user) to verify it."
+}


             reply	other threads:[~2013-07-12 14:03 UTC|newest]

Thread overview: 147+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 14:03 André Erdmann [this message]
2013-07-12 14:03 ` [gentoo-commits] proj/R_overlay:gsoc13/next commit in: / André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2020-11-24 10:41 [gentoo-commits] proj/R_overlay:master " Benda XU
2015-11-05  5:15 Benda XU
2015-01-26 17:41 André Erdmann
2014-07-16 15:14 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-06-05 22:09 André Erdmann
2014-04-01 16:38 André Erdmann
2014-04-01 16:38 André Erdmann
2014-02-22 14:56 André Erdmann
2014-02-22 14:56 André Erdmann
2014-02-21 18:15 André Erdmann
2014-02-16  3:44 Benda XU
2014-01-25 18:14 André Erdmann
2013-12-11 18:40 André Erdmann
2013-09-23 15:30 André Erdmann
2013-09-23 15:30 André Erdmann
2013-09-23 15:30 André Erdmann
2013-09-23 15:30 André Erdmann
2013-09-18 14:00 André Erdmann
2013-09-18 14:00 André Erdmann
2013-09-16  8:56 André Erdmann
2013-09-13 15:10 André Erdmann
2013-09-12 16:36 André Erdmann
2013-09-12  8:27 André Erdmann
2013-09-12  8:27 André Erdmann
2013-09-11 14:59 André Erdmann
2013-09-11 14:59 André Erdmann
2013-09-11 10:27 André Erdmann
2013-09-11 10:19 André Erdmann
2013-09-11 10:19 André Erdmann
2013-09-04 15:36 André Erdmann
2013-08-29 15:22 André Erdmann
2013-08-16 10:58 André Erdmann
2013-08-16 10:57 André Erdmann
2013-08-16 10:53 André Erdmann
2013-08-16 10:43 André Erdmann
2013-08-16 10:43 André Erdmann
2013-08-14 14:56 André Erdmann
2013-08-14 14:56 André Erdmann
2013-08-12  8:18 André Erdmann
2013-08-09 10:18 André Erdmann
2013-08-05 11:44 André Erdmann
2013-08-01 12:44 André Erdmann
2013-08-01 12:44 André Erdmann
2013-07-25 13:25 André Erdmann
2013-07-23 18:34 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-23 18:34 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-23 14:57 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-23 14:57 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-12 17:11 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-12 17:11 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-11 16:44 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-11 16:29 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-11 10:36 André Erdmann
2013-07-10 16:16 André Erdmann
2013-07-10 16:16 André Erdmann
2013-07-10 15:10 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-10 16:16 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-03 10:05 André Erdmann
2013-06-22 15:24 André Erdmann
2013-06-22 15:24 André Erdmann
2013-02-09 21:23 André Erdmann
2013-02-09 20:45 André Erdmann
2013-02-03 19:32 André Erdmann
2013-01-28 23:56 André Erdmann
2013-01-27 16:51 Denis Dupeyron
2013-01-25 23:27 Denis Dupeyron
2013-01-25 17:44 Denis Dupeyron
2013-01-09 19:15 André Erdmann
2012-08-20 10:39 André Erdmann
2012-08-20 10:39 André Erdmann
2012-08-17 17:26 André Erdmann
2012-08-10 15:16 André Erdmann
2012-08-10 15:16 André Erdmann
2012-08-10 15:16 André Erdmann
2012-08-10 15:16 André Erdmann
2012-08-08 23:46 André Erdmann
2012-08-08 23:46 André Erdmann
2012-08-07  8:50 André Erdmann
2012-08-06 19:01 André Erdmann
2012-08-03 15:04 André Erdmann
2012-08-03 15:04 André Erdmann
2012-08-03 15:04 André Erdmann
2012-08-03 15:04 André Erdmann
2012-08-03 13:59 André Erdmann
2012-08-03 13:38 André Erdmann
2012-08-03 13:38 André Erdmann
2012-08-01 21:10 André Erdmann
2012-08-01  7:38 André Erdmann
2012-07-30 15:53 André Erdmann
2012-07-30 15:53 André Erdmann
2012-07-16 16:15 André Erdmann
2012-07-11 18:43 André Erdmann
2012-07-11 18:43 André Erdmann
2012-07-10 18:03 André Erdmann
2012-07-09 17:19 André Erdmann
2012-07-09 17:19 André Erdmann
2012-07-09 17:19 André Erdmann
2012-07-09 17:19 André Erdmann
2012-07-06 22:19 André Erdmann
2012-07-06 22:19 André Erdmann
2012-07-06  8:15 André Erdmann
2012-07-05 16:01 André Erdmann
2012-07-05 16:00 André Erdmann
2012-07-04 18:21 André Erdmann
2012-07-04 18:21 André Erdmann
2012-07-04 18:21 André Erdmann
2012-07-03 17:48 André Erdmann
2012-07-03 17:48 André Erdmann
2012-06-29 22:48 André Erdmann
2012-06-29 22:48 André Erdmann
2012-06-27 14:46 André Erdmann
2012-06-27 14:46 André Erdmann
2012-06-26 15:42 André Erdmann
2012-06-26 15:42 André Erdmann
2012-06-25 18:19 André Erdmann
2012-06-22 18:13 André Erdmann
2012-06-22 18:13 André Erdmann
2012-06-22 18:13 André Erdmann
2012-06-21 16:55 André Erdmann
2012-06-20 19:03 André Erdmann
2012-06-20 19:03 André Erdmann
2012-06-15 20:34 André Erdmann
2012-06-15 20:34 André Erdmann
2012-06-15 20:34 André Erdmann
2012-06-15 20:34 André Erdmann
2012-06-13 16:34 André Erdmann
2012-06-13 16:34 André Erdmann
2012-06-12 17:17 André Erdmann
2012-06-11 18:31 André Erdmann
2012-06-11 18:31 André Erdmann
2012-06-11 18:31 André Erdmann
2012-06-08 17:48 André Erdmann
2012-06-06 19:52 André Erdmann
2012-06-06 19:52 André Erdmann
2012-06-06 19:52 André Erdmann
2012-06-01 15:46 André Erdmann
2012-06-01 15:46 André Erdmann
2012-05-31 18:24 André Erdmann
2012-05-31 18:24 André Erdmann
2012-05-30 19:36 André Erdmann
2012-05-30 16:09 André Erdmann
2012-05-30 10:58 André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373637694.ad9c06ed19a4af7ef245c54feb3bd4f0a15cccf3.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox