commit:     11de29ec44789641b8510bcb3a2219ae8155cdec
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 16 14:36:21 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 14:47:40 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11de29ec

dev-util/buildbot-worker: Improve pkg_config operation

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 dev-util/buildbot-worker/buildbot-worker-0.9.10-r2.ebuild | 14 ++++++++++++--
 dev-util/buildbot-worker/buildbot-worker-0.9.11.ebuild    | 14 ++++++++++++--
 dev-util/buildbot-worker/buildbot-worker-9999.ebuild      | 14 ++++++++++++--
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/dev-util/buildbot-worker/buildbot-worker-0.9.10-r2.ebuild 
b/dev-util/buildbot-worker/buildbot-worker-0.9.10-r2.ebuild
index 7bbef0496bd..419fd619809 100644
--- a/dev-util/buildbot-worker/buildbot-worker-0.9.10-r2.ebuild
+++ b/dev-util/buildbot-worker/buildbot-worker-0.9.10-r2.ebuild
@@ -95,6 +95,8 @@ pkg_postinst() {
 
 pkg_config() {
        local buildworker_path="/var/lib/buildbot_worker"
+       local log_path="/var/log/buildbot_worker"
+
        einfo "This will prepare a new buildbot_worker instance in 
${buildworker_path}."
        einfo "Press Control-C to abort."
 
@@ -103,14 +105,16 @@ pkg_config() {
        [[ -z "${instance_name}" ]] && die "Invalid instance name"
 
        local instance_path="${buildworker_path}/${instance_name}"
+       local instance_log_path="${log_path}/${instance_name}"
+
        if [[ -e "${instance_path}" ]]; then
                eerror "The instance with the specified name already exists:"
                eerror "${instance_path}"
                die "Instance already exists"
        fi
 
-       if [[ ! -d "${buildworker_path}" ]]; then
-               mkdir --parents "${buildworker_path}" || die "Unable to create 
directory ${buildworker_path}"
+       if [[ ! -d "${instance_path}" ]]; then
+               mkdir --parents "${instance_path}" || die "Unable to create 
directory ${buildworker_path}"
        fi
        chown --recursive buildbot "${instance_path}" || die "Setting 
permissions for instance failed"
        cp "${buildworker_path}/buildbot.tac.sample" 
"${instance_path}/buildbot.tac" \
@@ -118,6 +122,12 @@ pkg_config() {
        ln --symbolic --relative "/etc/init.d/buildbot_worker" 
"/etc/init.d/buildbot_worker.${instance_name}" \
                || die "Unable to create link to init file"
 
+       if [[ ! -d "${instance_log_path}" ]]; then
+               mkdir --parents "${instance_log_path}" || die "Unable to create 
directory ${instance_log_path}"
+       fi
+       ln --symbolic --relative "${instance_log_path}/twistd.log" 
"${instance_path}/twistd.log" \
+               || die "Unable to create link to log file"
+
        einfo "Successfully created a buildbot_worker instance at 
${instance_path}."
        einfo "To change the default settings edit the buildbot.tac file in 
this directory."
 }

diff --git a/dev-util/buildbot-worker/buildbot-worker-0.9.11.ebuild 
b/dev-util/buildbot-worker/buildbot-worker-0.9.11.ebuild
index d2bbf60849b..0697e9a2ce0 100644
--- a/dev-util/buildbot-worker/buildbot-worker-0.9.11.ebuild
+++ b/dev-util/buildbot-worker/buildbot-worker-0.9.11.ebuild
@@ -95,6 +95,8 @@ pkg_postinst() {
 
 pkg_config() {
        local buildworker_path="/var/lib/buildbot_worker"
+       local log_path="/var/log/buildbot_worker"
+
        einfo "This will prepare a new buildbot_worker instance in 
${buildworker_path}."
        einfo "Press Control-C to abort."
 
@@ -103,14 +105,16 @@ pkg_config() {
        [[ -z "${instance_name}" ]] && die "Invalid instance name"
 
        local instance_path="${buildworker_path}/${instance_name}"
+       local instance_log_path="${log_path}/${instance_name}"
+
        if [[ -e "${instance_path}" ]]; then
                eerror "The instance with the specified name already exists:"
                eerror "${instance_path}"
                die "Instance already exists"
        fi
 
-       if [[ ! -d "${buildworker_path}" ]]; then
-               mkdir --parents "${buildworker_path}" || die "Unable to create 
directory ${buildworker_path}"
+       if [[ ! -d "${instance_path}" ]]; then
+               mkdir --parents "${instance_path}" || die "Unable to create 
directory ${buildworker_path}"
        fi
        chown --recursive buildbot "${instance_path}" || die "Setting 
permissions for instance failed"
        cp "${buildworker_path}/buildbot.tac.sample" 
"${instance_path}/buildbot.tac" \
@@ -118,6 +122,12 @@ pkg_config() {
        ln --symbolic --relative "/etc/init.d/buildbot_worker" 
"/etc/init.d/buildbot_worker.${instance_name}" \
                || die "Unable to create link to init file"
 
+       if [[ ! -d "${instance_log_path}" ]]; then
+               mkdir --parents "${instance_log_path}" || die "Unable to create 
directory ${instance_log_path}"
+       fi
+       ln --symbolic --relative "${instance_log_path}/twistd.log" 
"${instance_path}/twistd.log" \
+               || die "Unable to create link to log file"
+
        einfo "Successfully created a buildbot_worker instance at 
${instance_path}."
        einfo "To change the default settings edit the buildbot.tac file in 
this directory."
 }

diff --git a/dev-util/buildbot-worker/buildbot-worker-9999.ebuild 
b/dev-util/buildbot-worker/buildbot-worker-9999.ebuild
index d2bbf60849b..0697e9a2ce0 100644
--- a/dev-util/buildbot-worker/buildbot-worker-9999.ebuild
+++ b/dev-util/buildbot-worker/buildbot-worker-9999.ebuild
@@ -95,6 +95,8 @@ pkg_postinst() {
 
 pkg_config() {
        local buildworker_path="/var/lib/buildbot_worker"
+       local log_path="/var/log/buildbot_worker"
+
        einfo "This will prepare a new buildbot_worker instance in 
${buildworker_path}."
        einfo "Press Control-C to abort."
 
@@ -103,14 +105,16 @@ pkg_config() {
        [[ -z "${instance_name}" ]] && die "Invalid instance name"
 
        local instance_path="${buildworker_path}/${instance_name}"
+       local instance_log_path="${log_path}/${instance_name}"
+
        if [[ -e "${instance_path}" ]]; then
                eerror "The instance with the specified name already exists:"
                eerror "${instance_path}"
                die "Instance already exists"
        fi
 
-       if [[ ! -d "${buildworker_path}" ]]; then
-               mkdir --parents "${buildworker_path}" || die "Unable to create 
directory ${buildworker_path}"
+       if [[ ! -d "${instance_path}" ]]; then
+               mkdir --parents "${instance_path}" || die "Unable to create 
directory ${buildworker_path}"
        fi
        chown --recursive buildbot "${instance_path}" || die "Setting 
permissions for instance failed"
        cp "${buildworker_path}/buildbot.tac.sample" 
"${instance_path}/buildbot.tac" \
@@ -118,6 +122,12 @@ pkg_config() {
        ln --symbolic --relative "/etc/init.d/buildbot_worker" 
"/etc/init.d/buildbot_worker.${instance_name}" \
                || die "Unable to create link to init file"
 
+       if [[ ! -d "${instance_log_path}" ]]; then
+               mkdir --parents "${instance_log_path}" || die "Unable to create 
directory ${instance_log_path}"
+       fi
+       ln --symbolic --relative "${instance_log_path}/twistd.log" 
"${instance_path}/twistd.log" \
+               || die "Unable to create link to log file"
+
        einfo "Successfully created a buildbot_worker instance at 
${instance_path}."
        einfo "To change the default settings edit the buildbot.tac file in 
this directory."
 }

Reply via email to