Added gitlabhq ebuilds

git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@31818 cbe59ace-07ea-0310-918e-868702b5370d
This commit is contained in:
Torsten Kurbad 2014-11-20 09:36:46 +00:00
parent b000a18712
commit 4ff17bc6cb
20 changed files with 1991 additions and 0 deletions

View File

@ -0,0 +1,5 @@
EBUILD gitlab-shell-1.8.0.ebuild 2500 SHA256 ea37fd4b4b3c526f808be1efbfaa4ea5b8fbd6bbaac13838016882c1df3cb1f6 SHA512 711c2e77ffa1b06c5922fcf47f8c4bb57815ff3168d13f07e15bc929976b074b0d17cfe5c85d4ef223b86e5fca25f0594a3a9666165ca045b0680617eea1e59b WHIRLPOOL 0348ca8b560414b7c2e2a366f8728cf12640dc4985f5633a46228b54d770195378f82a5a5e5476572fe1bfe6e05f9bbe9c73c244e6f11f1c3ee35c682639bf00
EBUILD gitlab-shell-1.9.1.ebuild 2500 SHA256 ea37fd4b4b3c526f808be1efbfaa4ea5b8fbd6bbaac13838016882c1df3cb1f6 SHA512 711c2e77ffa1b06c5922fcf47f8c4bb57815ff3168d13f07e15bc929976b074b0d17cfe5c85d4ef223b86e5fca25f0594a3a9666165ca045b0680617eea1e59b WHIRLPOOL 0348ca8b560414b7c2e2a366f8728cf12640dc4985f5633a46228b54d770195378f82a5a5e5476572fe1bfe6e05f9bbe9c73c244e6f11f1c3ee35c682639bf00
EBUILD gitlab-shell-1.9.4.ebuild 2500 SHA256 ea37fd4b4b3c526f808be1efbfaa4ea5b8fbd6bbaac13838016882c1df3cb1f6 SHA512 711c2e77ffa1b06c5922fcf47f8c4bb57815ff3168d13f07e15bc929976b074b0d17cfe5c85d4ef223b86e5fca25f0594a3a9666165ca045b0680617eea1e59b WHIRLPOOL 0348ca8b560414b7c2e2a366f8728cf12640dc4985f5633a46228b54d770195378f82a5a5e5476572fe1bfe6e05f9bbe9c73c244e6f11f1c3ee35c682639bf00
EBUILD gitlab-shell-1.9.6.ebuild 2500 SHA256 a39c5a44b54c70d16f30de155020ff003fb2e9da22e44360715ada3528bac0fe SHA512 e71bd23c81d1d29c6ebdf58ae480a3ae20b0b66ceffa927e03de10a969a85921ee8088e346ed0e5783d95466d94aca5797e6507409f164d6cf17bc59ff44b843 WHIRLPOOL 93fc131e889553b3b44e7c255eb87e8b30d3941330aa969b054d0b11e6eb741fa5b1c5c2b3143a3284e2bb82443607621aa69979326cf31a412c00167c7facb0
EBUILD gitlab-shell-2.0.1.ebuild 2633 SHA256 5ca86fbf40b7d606d5a456285437b46fd317aa94053a5e108c9830fe149cba5e SHA512 fe036c162fe78aab513aad36439cb41711248a7cc88956eee93974648ff17d973e1cd302fe73453db193eacd97d4bd93c82cb51087dff5b028d7c88793fedb71 WHIRLPOOL 5692ecf2f4e05676dc648b1159e96925b7e261704d4b8180d454e58e47bb6acca009e6e7106a76c1737fad6bb909f5ae75ac04f6a3ca54ebd8121ee78026b11b

View File

@ -0,0 +1,95 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlab-shell.git"
EGIT_COMMIT="v${PV}"
USE_RUBY="ruby19"
inherit eutils git-2 ruby-ng user
DESCRIPTION="GitLab Shell is a free SSH access and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="$(ruby_implementation_depend ruby19 '=' -1.9.3*)[yaml]
dev-vcs/git
virtual/ssh
dev-db/redis"
RDEPEND="${DEPEND}"
GIT_USER="git"
GIT_GROUP="git"
HOME="/var/lib/git"
REPO_DIR="${HOME}/repositories"
AUTH_FILE="${HOME}/.ssh/authorized_keys"
KEY_DIR=$(dirname "${AUTH_FILE}")
DEST_DIR="/var/lib/${PN}"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 "${HOME}" ${GIT_GROUP}
}
all_ruby_unpack() {
git-2_src_unpack
cd ${P}
sed -i \
-e "s|\(user:\).*|\1 ${GIT_USER}|" \
-e "s|\(repos_path:\).*|\1 \"${REPO_DIR}\"|" \
-e "s|\(auth_file:\).*|\1 \"${AUTH_FILE}\"|" \
config.yml.example || die "failed to filter config.example.yml"
}
all_ruby_install() {
rm -Rf .git .gitignore
insinto ${DEST_DIR}
touch gitlab-shell.log
doins -r . || die
dosym ${DEST_DIR}/bin/gitlab-keys /usr/bin/gitlab-keys || die
dosym ${DEST_DIR}/bin/gitlab-projects /usr/bin/gitlab-projects || die
dosym ${DEST_DIR}/bin/gitlab-shell /usr/bin/gitlab-shell || die
dosym ${DEST_DIR}/bin/check /usr/bin/gitlab-check || die
fperms 0755 ${DEST_DIR}/bin/gitlab-keys || die
fperms 0755 ${DEST_DIR}/bin/gitlab-projects || die
fperms 0755 ${DEST_DIR}/bin/gitlab-shell || die
fperms 0755 ${DEST_DIR}/bin/check || die
fperms 0755 ${DEST_DIR}/hooks/update || die
fowners ${GIT_USER} ${DEST_DIR}/gitlab-shell.log
}
pkg_postinst() {
dodir "${REPO_DIR}" || die
if [[ ! -d "${KEY_DIR}" ]] ; then
mkdir "${KEY_DIR}" || die
chmod 0700 "${KEY_DIR}" || die
chown ${GIT_USER}:${GIT_GROUP} "${KEY_DIR}" -R || die
fi
if [[ ! -e "${AUTH_FILE}" ]] ; then
touch "${AUTH_FILE}" || die
chmod 0600 "${AUTH_FILE}" || die
chown ${GIT_USER}:${GIT_GROUP} "${AUTH_FILE}" || die
fi
if [[ ! -d "${REPO_DIR}" ]] ; then
mkdir "${REPO_DIR}"
chmod ug+rwX,o-rwx "${REPO_DIR}" -R || die
chmod ug-s,o-rwx "${REPO_DIR}" -R || die
chown ${GIT_USER}:${GIT_GROUP} "${REPO_DIR}" -R || die
fi
elog "Copy ${DEST_DIR}/config.example.yml to ${DEST_DIR}/config.yml"
elog "and edit this file in order to configure your GitLab-Shell settings."
}

View File

@ -0,0 +1,95 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlab-shell.git"
EGIT_COMMIT="v${PV}"
USE_RUBY="ruby19"
inherit eutils git-2 ruby-ng user
DESCRIPTION="GitLab Shell is a free SSH access and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="$(ruby_implementation_depend ruby19 '=' -1.9.3*)[yaml]
dev-vcs/git
virtual/ssh
dev-db/redis"
RDEPEND="${DEPEND}"
GIT_USER="git"
GIT_GROUP="git"
HOME="/var/lib/git"
REPO_DIR="${HOME}/repositories"
AUTH_FILE="${HOME}/.ssh/authorized_keys"
KEY_DIR=$(dirname "${AUTH_FILE}")
DEST_DIR="/var/lib/${PN}"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 "${HOME}" ${GIT_GROUP}
}
all_ruby_unpack() {
git-2_src_unpack
cd ${P}
sed -i \
-e "s|\(user:\).*|\1 ${GIT_USER}|" \
-e "s|\(repos_path:\).*|\1 \"${REPO_DIR}\"|" \
-e "s|\(auth_file:\).*|\1 \"${AUTH_FILE}\"|" \
config.yml.example || die "failed to filter config.example.yml"
}
all_ruby_install() {
rm -Rf .git .gitignore
insinto ${DEST_DIR}
touch gitlab-shell.log
doins -r . || die
dosym ${DEST_DIR}/bin/gitlab-keys /usr/bin/gitlab-keys || die
dosym ${DEST_DIR}/bin/gitlab-projects /usr/bin/gitlab-projects || die
dosym ${DEST_DIR}/bin/gitlab-shell /usr/bin/gitlab-shell || die
dosym ${DEST_DIR}/bin/check /usr/bin/gitlab-check || die
fperms 0755 ${DEST_DIR}/bin/gitlab-keys || die
fperms 0755 ${DEST_DIR}/bin/gitlab-projects || die
fperms 0755 ${DEST_DIR}/bin/gitlab-shell || die
fperms 0755 ${DEST_DIR}/bin/check || die
fperms 0755 ${DEST_DIR}/hooks/update || die
fowners ${GIT_USER} ${DEST_DIR}/gitlab-shell.log
}
pkg_postinst() {
dodir "${REPO_DIR}" || die
if [[ ! -d "${KEY_DIR}" ]] ; then
mkdir "${KEY_DIR}" || die
chmod 0700 "${KEY_DIR}" || die
chown ${GIT_USER}:${GIT_GROUP} "${KEY_DIR}" -R || die
fi
if [[ ! -e "${AUTH_FILE}" ]] ; then
touch "${AUTH_FILE}" || die
chmod 0600 "${AUTH_FILE}" || die
chown ${GIT_USER}:${GIT_GROUP} "${AUTH_FILE}" || die
fi
if [[ ! -d "${REPO_DIR}" ]] ; then
mkdir "${REPO_DIR}"
chmod ug+rwX,o-rwx "${REPO_DIR}" -R || die
chmod ug-s,o-rwx "${REPO_DIR}" -R || die
chown ${GIT_USER}:${GIT_GROUP} "${REPO_DIR}" -R || die
fi
elog "Copy ${DEST_DIR}/config.example.yml to ${DEST_DIR}/config.yml"
elog "and edit this file in order to configure your GitLab-Shell settings."
}

View File

@ -0,0 +1,95 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlab-shell.git"
EGIT_COMMIT="v${PV}"
USE_RUBY="ruby19"
inherit eutils git-2 ruby-ng user
DESCRIPTION="GitLab Shell is a free SSH access and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="$(ruby_implementation_depend ruby19 '=' -1.9.3*)[yaml]
dev-vcs/git
virtual/ssh
dev-db/redis"
RDEPEND="${DEPEND}"
GIT_USER="git"
GIT_GROUP="git"
HOME="/var/lib/git"
REPO_DIR="${HOME}/repositories"
AUTH_FILE="${HOME}/.ssh/authorized_keys"
KEY_DIR=$(dirname "${AUTH_FILE}")
DEST_DIR="/var/lib/${PN}"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 "${HOME}" ${GIT_GROUP}
}
all_ruby_unpack() {
git-2_src_unpack
cd ${P}
sed -i \
-e "s|\(user:\).*|\1 ${GIT_USER}|" \
-e "s|\(repos_path:\).*|\1 \"${REPO_DIR}\"|" \
-e "s|\(auth_file:\).*|\1 \"${AUTH_FILE}\"|" \
config.yml.example || die "failed to filter config.example.yml"
}
all_ruby_install() {
rm -Rf .git .gitignore
insinto ${DEST_DIR}
touch gitlab-shell.log
doins -r . || die
dosym ${DEST_DIR}/bin/gitlab-keys /usr/bin/gitlab-keys || die
dosym ${DEST_DIR}/bin/gitlab-projects /usr/bin/gitlab-projects || die
dosym ${DEST_DIR}/bin/gitlab-shell /usr/bin/gitlab-shell || die
dosym ${DEST_DIR}/bin/check /usr/bin/gitlab-check || die
fperms 0755 ${DEST_DIR}/bin/gitlab-keys || die
fperms 0755 ${DEST_DIR}/bin/gitlab-projects || die
fperms 0755 ${DEST_DIR}/bin/gitlab-shell || die
fperms 0755 ${DEST_DIR}/bin/check || die
fperms 0755 ${DEST_DIR}/hooks/update || die
fowners ${GIT_USER} ${DEST_DIR}/gitlab-shell.log
}
pkg_postinst() {
dodir "${REPO_DIR}" || die
if [[ ! -d "${KEY_DIR}" ]] ; then
mkdir "${KEY_DIR}" || die
chmod 0700 "${KEY_DIR}" || die
chown ${GIT_USER}:${GIT_GROUP} "${KEY_DIR}" -R || die
fi
if [[ ! -e "${AUTH_FILE}" ]] ; then
touch "${AUTH_FILE}" || die
chmod 0600 "${AUTH_FILE}" || die
chown ${GIT_USER}:${GIT_GROUP} "${AUTH_FILE}" || die
fi
if [[ ! -d "${REPO_DIR}" ]] ; then
mkdir "${REPO_DIR}"
chmod ug+rwX,o-rwx "${REPO_DIR}" -R || die
chmod ug-s,o-rwx "${REPO_DIR}" -R || die
chown ${GIT_USER}:${GIT_GROUP} "${REPO_DIR}" -R || die
fi
elog "Copy ${DEST_DIR}/config.example.yml to ${DEST_DIR}/config.yml"
elog "and edit this file in order to configure your GitLab-Shell settings."
}

View File

@ -0,0 +1,95 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlab-shell.git"
EGIT_COMMIT="v${PV}"
USE_RUBY="ruby20"
inherit eutils git-2 ruby-ng user
DESCRIPTION="GitLab Shell is a free SSH access and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="$(ruby_implementation_depend ruby19 '=' -1.9.3*)[yaml]
dev-vcs/git
virtual/ssh
dev-db/redis"
RDEPEND="${DEPEND}"
GIT_USER="git"
GIT_GROUP="git"
HOME="/var/lib/git"
REPO_DIR="${HOME}/repositories"
AUTH_FILE="${HOME}/.ssh/authorized_keys"
KEY_DIR=$(dirname "${AUTH_FILE}")
DEST_DIR="/var/lib/${PN}"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 "${HOME}" ${GIT_GROUP}
}
all_ruby_unpack() {
git-2_src_unpack
cd ${P}
sed -i \
-e "s|\(user:\).*|\1 ${GIT_USER}|" \
-e "s|\(repos_path:\).*|\1 \"${REPO_DIR}\"|" \
-e "s|\(auth_file:\).*|\1 \"${AUTH_FILE}\"|" \
config.yml.example || die "failed to filter config.example.yml"
}
all_ruby_install() {
rm -Rf .git .gitignore
insinto ${DEST_DIR}
touch gitlab-shell.log
doins -r . || die
dosym ${DEST_DIR}/bin/gitlab-keys /usr/bin/gitlab-keys || die
dosym ${DEST_DIR}/bin/gitlab-projects /usr/bin/gitlab-projects || die
dosym ${DEST_DIR}/bin/gitlab-shell /usr/bin/gitlab-shell || die
dosym ${DEST_DIR}/bin/check /usr/bin/gitlab-check || die
fperms 0755 ${DEST_DIR}/bin/gitlab-keys || die
fperms 0755 ${DEST_DIR}/bin/gitlab-projects || die
fperms 0755 ${DEST_DIR}/bin/gitlab-shell || die
fperms 0755 ${DEST_DIR}/bin/check || die
fperms 0755 ${DEST_DIR}/hooks/update || die
fowners ${GIT_USER} ${DEST_DIR}/gitlab-shell.log
}
pkg_postinst() {
dodir "${REPO_DIR}" || die
if [[ ! -d "${KEY_DIR}" ]] ; then
mkdir "${KEY_DIR}" || die
chmod 0700 "${KEY_DIR}" || die
chown ${GIT_USER}:${GIT_GROUP} "${KEY_DIR}" -R || die
fi
if [[ ! -e "${AUTH_FILE}" ]] ; then
touch "${AUTH_FILE}" || die
chmod 0600 "${AUTH_FILE}" || die
chown ${GIT_USER}:${GIT_GROUP} "${AUTH_FILE}" || die
fi
if [[ ! -d "${REPO_DIR}" ]] ; then
mkdir "${REPO_DIR}"
chmod ug+rwX,o-rwx "${REPO_DIR}" -R || die
chmod ug-s,o-rwx "${REPO_DIR}" -R || die
chown ${GIT_USER}:${GIT_GROUP} "${REPO_DIR}" -R || die
fi
elog "Copy ${DEST_DIR}/config.example.yml to ${DEST_DIR}/config.yml"
elog "and edit this file in order to configure your GitLab-Shell settings."
}

View File

@ -0,0 +1,100 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlab-shell.git"
EGIT_COMMIT="v${PV}"
USE_RUBY="ruby20"
inherit eutils git-2 ruby-ng user
DESCRIPTION="GitLab Shell is a free SSH access and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="$(ruby_implementation_depend ruby20)
dev-vcs/git
virtual/ssh
dev-db/redis"
RDEPEND="${DEPEND}"
GIT_USER="git"
GIT_GROUP="git"
HOME="/var/lib/git"
REPO_DIR="${HOME}/repositories"
AUTH_FILE="${HOME}/.ssh/authorized_keys"
KEY_DIR=$(dirname "${AUTH_FILE}")
DEST_DIR="/var/lib/${PN}"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 "${HOME}" ${GIT_GROUP}
}
all_ruby_unpack() {
git-2_src_unpack
cd ${P}
sed -i \
-e "s|\(user:\).*|\1 ${GIT_USER}|" \
-e "s|\(repos_path:\).*|\1 \"${REPO_DIR}\"|" \
-e "s|\(auth_file:\).*|\1 \"${AUTH_FILE}\"|" \
config.yml.example || die "failed to filter config.example.yml"
}
all_ruby_install() {
rm -Rf .git .gitignore
insinto ${DEST_DIR}
touch gitlab-shell.log
doins -r . || die
dosym ${DEST_DIR}/bin/gitlab-keys /usr/bin/gitlab-keys || die
dosym ${DEST_DIR}/bin/gitlab-projects /usr/bin/gitlab-projects || die
dosym ${DEST_DIR}/bin/gitlab-shell /usr/bin/gitlab-shell || die
dosym ${DEST_DIR}/bin/check /usr/bin/gitlab-check || die
fperms 0755 ${DEST_DIR}/bin/gitlab-keys || die
fperms 0755 ${DEST_DIR}/bin/gitlab-projects || die
fperms 0755 ${DEST_DIR}/bin/gitlab-shell || die
fperms 0755 ${DEST_DIR}/bin/check || die
fperms 0755 ${DEST_DIR}/bin/create-hooks || die
fperms 0755 ${DEST_DIR}/bin/install || die
fperms 0755 ${DEST_DIR}/hooks/post-receive || die
fperms 0755 ${DEST_DIR}/hooks/pre-receive || die
fowners ${GIT_USER} ${DEST_DIR}/gitlab-shell.log
}
pkg_postinst() {
dodir "${REPO_DIR}" || die
if [[ ! -d "${KEY_DIR}" ]] ; then
mkdir "${KEY_DIR}" || die
chmod 0700 "${KEY_DIR}" || die
chown ${GIT_USER}:${GIT_GROUP} "${KEY_DIR}" -R || die
fi
if [[ ! -e "${AUTH_FILE}" ]] ; then
touch "${AUTH_FILE}" || die
chmod 0600 "${AUTH_FILE}" || die
chown ${GIT_USER}:${GIT_GROUP} "${AUTH_FILE}" || die
fi
if [[ ! -d "${REPO_DIR}" ]] ; then
mkdir "${REPO_DIR}"
chmod ug+rwX,o-rwx "${REPO_DIR}" -R || die
chmod ug-s,o-rwx "${REPO_DIR}" -R || die
chown ${GIT_USER}:${GIT_GROUP} "${REPO_DIR}" -R || die
fi
elog "Copy ${DEST_DIR}/config.example.yml to ${DEST_DIR}/config.yml"
elog "and edit this file in order to configure your GitLab-Shell settings."
}

View File

@ -0,0 +1,13 @@
AUX config.ssh 245 SHA256 5bf5d5a357e88b71e14a12bb28ea68d0286ed29118045aa944484b84b6fa5e4b SHA512 52dbec481cd45136e72370713ab20a41616dccb252e75b884b66e2494aaefe7795719169906dcad5030dcbe33201d021bdad1f7a99120ac40a64611290ff8759 WHIRLPOOL 9b991ad20787e0e7274136ddb8e22e1082360d580f8576feb722730b5c3f3fa22992f671f7916e191052a78d8d688d32044b39059dc7146d14c2da57fa891214
AUX gitlab-support.init 1052 SHA256 e7265ab4237298ed2a849c100c24a76e81c8fcfa726acc1256d5ad623474bab1 SHA512 fe2661d1d0940ca663227156715d2d20147cf500b0129a4a38edd1642e8f8c5c7a8d73d5cfd88f1b1785bd0e0a321eb23f62b2e7f2751b10f392bc6d2d5f905b WHIRLPOOL f72764e19a7aa85c8b82c8e7825c8308bc08579d440d68fbe0086c8670aa1f765289d71baf99cf6057b1fc4b31f15d8544608632271408134bb8fae1dc15335a
AUX gitlab-unicorn.init 1782 SHA256 198814924c71f3de35cec935c2e50c00ecf0f6aeb3129ec829d6aa170f569377 SHA512 b4c00769dd55eeb3b61c8c4cf1155be286cd3269601f80c21e03c9cd0359dc7e13ed8ad6e4421ce5639d21acb8163172f72482ba300523af2ef09d181201d6ce WHIRLPOOL f484373b7e77d8c4a86e46a61ba35b4e4cde69b054fc441d6d7cd4605a63b6e8b65c396fd6ce6001f0d20b28f39c22447a8746b5ec0716332cb5bb581db0bf46
AUX gitlab.logrotate 191 SHA256 9c02c26f5faa443cd576599462c6a8206d62495ab9671098a5f0e379f216541b SHA512 2212a8e5f2d4704256d5abb92b5a1201b20f82b04610758e734d163792a60b78f482017510169666a70ed9352b171177d05237ffe87988cacb764c5ef7ba5443 WHIRLPOOL f61297015311316554e63af4822b8d274f5a2378e829e5c14bb22e642b0d83023446acff45a13aa354f127543ce1552c99488b92ed8f39d86959343c7e67bbee
AUX gitlabhq-6.9.2-fix-checks-gentoo.patch 413 SHA256 5e9358e6670ed6711f171876c46b7222e3fcb66e6cfa1658b3627d2878a92d87 SHA512 50a1e441d9bfcf0f5784fa1b940833653010dca23d96ca9b2cd462b7f659aa5ca6042c7eb8b2b5dd3319e507accd0ccb8d0c5ee2be78aa35749df9c3e924e899 WHIRLPOOL 7452073e202ecf7bb08ee463c088bbe883ba31aeb8f96db18f16af6f119cba6e698fa3a619122b05a69c932434b856d8162ff59c33f66214b7cbb53035a619a3
AUX gitlabhq-6.9.2.init 1920 SHA256 3fe052a74614130c3e8cddc59ef40c05e5249e9714b77201791344ddf933da25 SHA512 6d2ebc5559248696eae55d34b17562262c1ba4faf3be7e58da149addcde77a75137e9cef7c9f2a9a7b5382fa1ad1e79eaab035c74a435b9ba4510dbb10cffe60 WHIRLPOOL 191ee5ebf2b8c4d0552848e2323250073a667fbf04987907f7840435ae9dc862ab4a0b0f8bf157a1adeeb24d6385053ae049592b5b4f06db076a7b31ae63d6a0
AUX gitlabhq-7.0.0-fix-checks-gentoo.patch 413 SHA256 5e9358e6670ed6711f171876c46b7222e3fcb66e6cfa1658b3627d2878a92d87 SHA512 50a1e441d9bfcf0f5784fa1b940833653010dca23d96ca9b2cd462b7f659aa5ca6042c7eb8b2b5dd3319e507accd0ccb8d0c5ee2be78aa35749df9c3e924e899 WHIRLPOOL 7452073e202ecf7bb08ee463c088bbe883ba31aeb8f96db18f16af6f119cba6e698fa3a619122b05a69c932434b856d8162ff59c33f66214b7cbb53035a619a3
AUX gitlabhq-7.0.0.init 1920 SHA256 79bc5cece6bf79b57c9512cfafa72f4791aeb759b81de5ae5daa2f380a2c069a SHA512 5e5601391fb8866782bbaad48d04364b3dc45e06a144931b7b159da98052c93971fd46f3029a1e194b16a8791fbbc35c1b7e858b0453363bf1a5563dbb364036 WHIRLPOOL e81339c047b246a53c63ea5f2da8ba32821afab891b9976b4beab9bff9358d65f335c5936cc6e0fef35314774ea105163f821f9295658639beba2fda9a39c0e7
AUX gitlabhq-7.4.3-fix-checks-gentoo.patch 413 SHA256 5e9358e6670ed6711f171876c46b7222e3fcb66e6cfa1658b3627d2878a92d87 SHA512 50a1e441d9bfcf0f5784fa1b940833653010dca23d96ca9b2cd462b7f659aa5ca6042c7eb8b2b5dd3319e507accd0ccb8d0c5ee2be78aa35749df9c3e924e899 WHIRLPOOL 7452073e202ecf7bb08ee463c088bbe883ba31aeb8f96db18f16af6f119cba6e698fa3a619122b05a69c932434b856d8162ff59c33f66214b7cbb53035a619a3
AUX gitlabhq-7.4.3.init 1920 SHA256 544cf4d927964d38efd016234016e4ac9670cc5c22a702c8fe5c118047822775 SHA512 d297bc4696a571917f3d70222398d12e3fad75f1c7f25ceaf8789c33b0384f31ae34918df392a45a976327f629bac795145f4c377b7c6226e352fe6de96174c7 WHIRLPOOL d2092ea1844e2768847ebfc8bccf732908b30fcf7c7e1a8f1b10cc7f48e6a089540ddc61ebea140f22bf4aae099d65616c4daa258b9f760b8a437a35ea54be6e
EBUILD gitlabhq-6.9.2.ebuild 11730 SHA256 baca492d6634b1e932cf5d1be9a9f56f3aada00ee7e3f10e5fbbb40fd180bf22 SHA512 c1731cb8df63ff9bc04e29ac06a0ec9cd7587ac372460ea0d4ae17735257c19376b9b95e943f46570b3feff541110c96b19de1b1e215655ee28e07f5bdb07846 WHIRLPOOL f916eab9f96e93caba3954079af7f2af5cb3c83bbc5ca2b4f419845c6d84a89148e64a5a7a43c6771bf0590206bc5f2733ec7ba642f74b103a4d142d362b44b8
EBUILD gitlabhq-7.0.0.ebuild 11770 SHA256 319b8321bad5bd01db8cc633733c557643cacf0251a93c2b94e53d6c8cf716ca SHA512 3c8537afbb1b0aa03957cede02747e967088410e782ed35aed8e2f34d4c282312b88a6fb2f60cb87aeda42688af492795d8562345dcdf010f9844516bd419827 WHIRLPOOL b47a85ee57523a67e9ec6fe6dd93231344e358920b1f42796fc60d614d0cad1ae4696f93b474e12ac08922d684b622b493e45ce5cf968ae3374c83d462e7af19
EBUILD gitlabhq-7.4.3.ebuild 12261 SHA256 355978fca0c05f261864a0514cb60379b76d7a943daca390fd96601125da7e28 SHA512 02cb41d7ae7cc29c46dc8b745679e3ee6d1bf39fed035e6e1a773900fca743783f8604a3f3bd70c9673a7f03581410ee32c50808226c55ab390671949a68da58 WHIRLPOOL 095d19b2fe9f0789881ab89ef98cc1f711dc567900e160b1a8a0a4523295ad0a8a49e45beeac62c7698ad0c9f46bccba3e0a24c6a190cf21ece2c9bf0e22325a

View File

@ -0,0 +1,10 @@
Host localhost
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
BatchMode yes
CheckHostIP no
AddressFamily inet
PreferredAuthentications publickey
ControlMaster auto
ControlPath ~/.ssh/ssh-%r-%h:%p.sock
ControlPersist 24h

View File

@ -0,0 +1,44 @@
#!/sbin/runscript
name="GitLab support"
description="Support for GitLab @SLOT@"
: ${gitlab_user:=@GIT_USER@}
: ${gitlab_group:=@GIT_GROUP@}
: ${gitlab_home:="@DEST_DIR@"}
: ${sidekiq_pidfile:="@DEST_DIR@/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="@LOG_DIR@/sidekiq.log"}
: ${rails_env:=production}
bundle="/usr/bin/bundle"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec rake sidekiq:start RAILS_ENV=${rails_env}"
sidekiq_stop_command_args="exec rake sidekiq:stop RAILS_ENV=${rails_env}"
if [ ${rails_env} = development ]; then
sidekiq_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab @SLOT@ Sidekiq"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab @SLOT@ Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
}

View File

@ -0,0 +1,64 @@
#!/sbin/runscript
name="GitLab"
description="GitLab @SLOT@ on Unicorns"
: ${gitlab_user:=@GIT_USER@}
: ${gitlab_group:=@GIT_GROUP@}
: ${gitlab_home:="@DEST_DIR@"}
: ${server_pidfile:="@DEST_DIR@/tmp/pids/unicorn.pid"}
: ${sidekiq_pidfile:="@DEST_DIR@/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="@LOG_DIR@/sidekiq.log"}
: ${rails_env:=production}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec rake sidekiq:start RAILS_ENV=${rails_env}"
sidekiq_stop_command_args="exec rake sidekiq:stop RAILS_ENV=${rails_env}"
if [ ${rails_env} = development ]; then
sidekiq_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab @SLOT@ Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}" \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab @SLOT@ Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab @SLOT@ Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
ebegin "Stopping GitLab @SLOT@ Unicorn servers"
start-stop-daemon --stop \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}"
eend $?
}

View File

@ -0,0 +1,10 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
@LOG_DIR@/*.log {
missingok
delaycompress
compress
copytruncate
}

View File

@ -0,0 +1,11 @@
--- lib/tasks/gitlab/check.rake.orig 2013-11-16 21:51:59.570000000 +0100
+++ lib/tasks/gitlab/check.rake 2013-11-16 21:52:40.900000000 +0100
@@ -20,8 +20,6 @@
check_gitlab_config_not_outdated
check_log_writable
check_tmp_writable
- check_init_script_exists
- check_init_script_up_to_date
check_projects_have_namespace
check_satellites_exist
check_redis_version

View File

@ -0,0 +1,64 @@
#!/sbin/runscript
name="GitLab"
description="GitLab 6.9 on Unicorns"
: ${gitlab_user:=git}
: ${gitlab_group:=git}
: ${gitlab_home:="/opt/gitlabhq-6.9"}
: ${server_pidfile:="/opt/gitlabhq-6.9/tmp/pids/unicorn.pid"}
: ${sidekiq_pidfile:="/opt/gitlabhq-6.9/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="/var/log/gitlabhq-6.9/sidekiq.log"}
: ${rails_env:=production}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e ${rails_env} -P ${sidekiq_pidfile} -d -L ${sidekiq_log} >> ${sidekiq_log}"
sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
if [ ${rails_env} = development ]; then
sidekiq_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab 6.9 Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}" \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab 6.9 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab 6.9 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
ebegin "Stopping GitLab 6.9 Unicorn servers"
start-stop-daemon --stop \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}"
eend $?
}

View File

@ -0,0 +1,11 @@
--- lib/tasks/gitlab/check.rake.orig 2013-11-16 21:51:59.570000000 +0100
+++ lib/tasks/gitlab/check.rake 2013-11-16 21:52:40.900000000 +0100
@@ -20,8 +20,6 @@
check_gitlab_config_not_outdated
check_log_writable
check_tmp_writable
- check_init_script_exists
- check_init_script_up_to_date
check_projects_have_namespace
check_satellites_exist
check_redis_version

View File

@ -0,0 +1,64 @@
#!/sbin/runscript
name="GitLab"
description="GitLab 7.0 on Unicorns"
: ${gitlab_user:=git}
: ${gitlab_group:=git}
: ${gitlab_home:="/opt/gitlabhq-7.0"}
: ${server_pidfile:="/opt/gitlabhq-7.0/tmp/pids/unicorn.pid"}
: ${sidekiq_pidfile:="/opt/gitlabhq-7.0/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="/var/log/gitlabhq-7.0/sidekiq.log"}
: ${rails_env:=production}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e ${rails_env} -P ${sidekiq_pidfile} -d -L ${sidekiq_log} >> ${sidekiq_log}"
sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
if [ ${rails_env} = development ]; then
sidekiq_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab 7.0 Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}" \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab 7.0 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab 7.0 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
ebegin "Stopping GitLab 7.0 Unicorn servers"
start-stop-daemon --stop \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}"
eend $?
}

View File

@ -0,0 +1,11 @@
--- lib/tasks/gitlab/check.rake.orig 2013-11-16 21:51:59.570000000 +0100
+++ lib/tasks/gitlab/check.rake 2013-11-16 21:52:40.900000000 +0100
@@ -20,8 +20,6 @@
check_gitlab_config_not_outdated
check_log_writable
check_tmp_writable
- check_init_script_exists
- check_init_script_up_to_date
check_projects_have_namespace
check_satellites_exist
check_redis_version

View File

@ -0,0 +1,64 @@
#!/sbin/runscript
name="GitLab"
description="GitLab 7.4 on Unicorns"
: ${gitlab_user:=git}
: ${gitlab_group:=git}
: ${gitlab_home:="/opt/gitlabhq-7.4"}
: ${server_pidfile:="/opt/gitlabhq-7.4/tmp/pids/unicorn.pid"}
: ${sidekiq_pidfile:="/opt/gitlabhq-7.4/tmp/pids/sidekiq.pid"}
: ${sidekiq_log:="/var/log/gitlabhq-7.4/sidekiq.log"}
: ${rails_env:=production}
server_command="/usr/bin/bundle"
server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D"
sidekiq_command="/usr/bin/bundle"
sidekiq_start_command_args="exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e ${rails_env} -P ${sidekiq_pidfile} -d -L ${sidekiq_log} >> ${sidekiq_log}"
sidekiq_stop_command_args="exec sidekiqctl stop ${sidekiq_pidfile} >> ${sidekiq_log}"
if [ ${rails_env} = development ]; then
sidekiq_command_args+=" VVERBOSE=1"
fi
depend() {
provide gitlab
need redis
use net
}
start() {
ebegin "Starting GitLab 7.4 Unicorn servers"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")"
checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${sidekiq_pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}" \
--exec ${server_command} -- ${server_command_args}
eend $?
ebegin "Starting GitLab 7.4 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_start_command_args}
eend $?
}
stop() {
ebegin "Stopping GitLab 7.4 Sidekiq"
cd "${gitlab_home}"
sudo -u git -H ${sidekiq_command} ${sidekiq_stop_command_args}
eend $?
ebegin "Stopping GitLab 7.4 Unicorn servers"
start-stop-daemon --stop \
--chdir "${gitlab_home}" \
--user="${gitlab_user}:${gitlab_group}" \
--pidfile="${server_pidfile}"
eend $?
}

View File

@ -0,0 +1,375 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
# Mainteiner notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab has too many dependencies that it will be too
# difficult to maintain them via ebuilds.
# - USE flags analytics and public-projects applies our custom patches, see
# https://github.com/cvut/gitlabhq for more information.
#
USE_RUBY="ruby20"
PYTHON_DEPEND="2:2.5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlabhq.git"
EGIT_COMMIT="v${PV}"
inherit eutils git-2 python ruby-ng versionator user
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
LICENSE="MIT"
SLOT=$(get_version_component_range 1-2)
KEYWORDS="~amd64 ~x86"
IUSE="memcached mysql +postgres +unicorn"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# json dev-util/ragel
# yajl-ruby dev-libs/yajl
# pygments.rb python 2.5+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql-base
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/ragel
dev-libs/yajl
net-libs/nodejs
postgres? ( dev-db/postgresql-base )
mysql? ( virtual/mysql )
memcached? ( net-misc/memcached )"
DEPEND="${GEMS_DEPEND}
$(ruby_implementation_depend ruby19 '=' -1.9.3*)[readline,ssl,yaml]
>=dev-vcs/git-1.8.1.5
>=dev-vcs/gitlab-shell-1.9.4
net-misc/curl
virtual/ssh"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
RUBY_PATCHES=(
"${P}-fix-checks-gentoo.patch"
)
GIT_USER="git"
GIT_GROUP="git"
GIT_HOME=$(getent passwd $GIT_USER | cut -d: -f6)
DEST_DIR="/opt/${PN}-${SLOT}"
CONF_DIR="/etc/${PN}-${SLOT}"
GIT_REPOS="${GIT_HOME}/repositories"
GIT_SATELLITES="${GIT_HOME}/gitlab-satellites"
GITLAB_SHELL="/var/lib/gitlab-shell"
GITLAB_SHELL_HOOKS="${GITLAB_SHELL}/hooks"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 ${DEST_DIR} "$GIT_GROUP}"
}
all_ruby_unpack() {
git-2_src_unpack
}
each_ruby_prepare() {
# fix path to repo and gitlab-shell hooks
test -d "${GITLAB_SHELL_HOOKS}" || die "Gitlab Shell hooks directory not found: \"${GITLAB_SHELL_HOOKS}. Have you properly installed dev-vcs/gitlab-shell"?
sed -i \
-e "s|\(\s*repos_path:\s\)/.*|\1 ${GIT_REPOS}/|" \
-e "s|\(\s*hooks_path:\s\)/.*|\1 ${GITLAB_SHELL_HOOKS}/|" \
-e "s|\(\s*path:\s\)/.*/gitlab-satellites/|\1 ${GIT_SATELLITES}/|" \
-e "s|\(\s*GITLAB_SHELL:\s*\)|\1\n\tpath: \"${GITLAB_SHELL}\"|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
# modify database settings
sed -i \
-e 's|\(username:\) postgres.*|\1 gitlab|' \
-e 's|\(password:\).*|\1 gitlab|' \
-e 's|\(socket:\).*|/run/postgresql/.s.PGSQL.5432|' \
config/database.yml.postgresql \
|| die "failed to filter database.yml.postgresql"
# replace "secret" token with random one
local randpw=$(echo ${RANDOM}|sha512sum|cut -c 1-128)
sed -i -e "/secret_token =/ s/=.*/= '${randpw}'/" \
config/initializers/secret_token.rb \
|| die "failed to filter secret_token.rb"
# remove needless files
#rm -r .git Satisfy gitlab::check.
rm .foreman .gitignore Procfile .travis.yml
use unicorn || rm config/unicorn.rb.example
use postgres || rm config/database.yml.postgresql
use mysql || rm config/database.yml.mysql
# remove dependency on therubyracer and libv8 (we're using nodejs instead)
local tfile; for tfile in Gemfile{,.lock}; do
sed -i \
-e '/therubyracer/d' \
-e '/libv8/d' \
"${tfile}" || die "failed to filter ${tfile}"
done
# change thin and unicorn dependencies to be optional
sed -i \
-e '/^gem "thin"/ s/$/, group: :thin/' \
-e '/^gem "unicorn"/ s/$/, group: :unicorn/' \
Gemfile || die "failed to modify Gemfile"
# change cache_store
if use memcached; then
sed -i \
-e "/\w*config.cache_store / s/=.*/= :dalli_store, { namespace: 'gitlab' }/" \
config/environments/production.rb \
|| die "failed to modify production.rb"
fi
# Update pathes for unicorn
if use unicorn; then
sed -i \
-e "s#/home/git/gitlab#${DEST_DIR}#" \
config/unicorn.rb.example \
|| die "failed to modify unicorn.rb.example"
fi
}
each_ruby_install() {
local dest="${DEST_DIR}"
local conf="/etc/${PN}-${SLOT}"
local temp="/var/tmp/${PN}-${SLOT}"
local logs="/var/log/${PN}-${SLOT}"
local uploads="${DEST_DIR}/public/uploads"
## Prepare directories ##
diropts -m750
keepdir "${logs}"
dodir "${temp}"
diropts -m755
keepdir "${conf}"
dodir "${dest}"
dodir "${uploads}"
dosym "${temp}" "${dest}/tmp"
dosym "${logs}" "${dest}/log"
## Link gitlab-shell into git home
dosym "${GITLAB_SHELL}" "${GIT_HOME}/gitlab-shell"
## Install configs ##
insinto "${conf}"
doins -r config/*
dosym "${conf}" "${dest}/config"
insinto "${dest}/.ssh"
newins "${FILESDIR}/config.ssh" config
echo "export RAILS_ENV=production" > "${D}/${dest}/.profile"
## Install all others ##
# remove needless dirs
rm -Rf config tmp log
insinto "${dest}"
doins -r ./
## Install logrotate config ##
dodir /etc/logrotate.d
sed -e "s|@LOG_DIR@|${logs}|" \
"${FILESDIR}"/gitlab.logrotate > "${D}"/etc/logrotate.d/${PN}-${SLOT} \
|| die "failed to filter gitlab.logrotate"
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test thin"
local flag; for flag in memcached mysql postgres unicorn; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
# Fix invalid ldflags for charlock_holmes,
# see https://github.com/brianmario/charlock_holmes/issues/32
${RUBY} /usr/bin/bundle config build.charlock_holmes --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -lz -licuuc'
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
## Clean ##
local gemsdir=vendor/bundle/ruby/$(ruby_rbconfig_value 'ruby_version')
# remove gems cache
rm -Rf ${gemsdir}/cache
# fix permissions
fowners -R ${GIT_USER}:${GIT_GROUP} "${dest}" "${conf}" "${temp}" "${logs}"
fperms +x script/rails
fperms o+Xr "${temp}" # Let nginx access the unicorn socket
## RC scripts ##
local rcscript=${P}.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@GIT_USER@|${GIT_USER}|" \
-e "s|@GIT_GROUP@|${GIT_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@DEST_DIR@|${dest}|" \
-e "s|@LOG_DIR@|${logs}|" \
-e "s|@RESQUE_QUEUE@|${resque_queue}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
if use memcached; then
sed -i -e '/^depend/,// {/need / s/$/ memcached/}' \
"${T}/${rcscript}" || die "failed to filter ${rcscript}"
fi
newinitd "${T}/${rcscript}" "${PN}-${SLOT}"
}
pkg_postinst() {
if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then
einfo "Generating SSH key for git user"
su -l ${GIT_USER} -s /bin/sh -c "
ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \
|| die "failed to generate SSH key"
fi
if [ ! -e "${GIT_HOME}/.gitconfig" ]; then
einfo "Setting git user in ${GIT_HOME}/.gitconfig, feel free to "
einfo "modify this file according to your needs!"
su -l ${GIT_USER} -s /bin/sh -c "
git config --global user.email 'gitlab@localhost';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
elog
elog "1. Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
elog " and edit this file in order to configure your GitLab settings."
elog
elog "2. Copy ${CONF_DIR}/database.yml.* to ${CONF_DIR}/database.yml"
elog " and edit this file in order to configure your database settings"
elog " for \"production\" environment."
elog
elog "3. If this is a new installation, you should create database for your GitLab instance."
elog
if use postgres; then
elog " If you have local PostgreSQL running, just copy&run:"
elog " su postgres"
elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab gitlab_production"
elog " Note: You should change your password to something more random..."
elog
elog " GitLab uses polymorphic associations which are not SQL-standard friendly."
elog " To get it work you must use this ugly workaround:"
elog " psql -U postgres -d gitlab"
elog " CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;"
elog
fi
elog "4. Finally execute the following command to initlize or update the environment:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server."
elog
}
pkg_config() {
## Check config files existence ##
einfo "Checking configuration files"
if [ ! -r "${CONF_DIR}/database.yml" ] ; then
eerror "Copy ${CONF_DIR}/database.yml.* to"
eerror "${CONF_DIR}/database.yml and edit this file in order to configure your"
eerror "database settings for \"production\" environment."
die
fi
if [ ! -r "${CONF_DIR}/gitlab.yml" ]; then
eerror "Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
eerror "and edit this file in order to configure your GitLab settings"
eerror "for \"production\" environment."
die
fi
## Initialize app ##
local RAILS_ENV=${RAILS_ENV:-production}
local RUBY=${RUBY:-ruby20}
local BUNDLE="${RUBY} /usr/bin/bundle"
# Ask user whether this is the first installation
einfon "Do you want to upgrade an existing installation? [Y|n] "
do_upgrade=""
while true
do
read -r do_upgrade
if [[ $do_upgrade == "n" || $do_upgrade == "N" ]] ; then do_upgrade="" && break
elif [[ $do_upgrade == "y" || $do_upgrade == "Y" || $do_upgrade == "" ]] ; then do_upgrade=1 && break
else eerrorn "Please type either \"Y\" or \"N\" ... " ; fi
done
if [[ $do_upgrade ]] ; then
einfo "Migration database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake db:migrate RAILS_ENV=production
${BUNDLE} exec rake gitlab:satellites:create RAILS_ENV=production" \
|| die "failed to migrate database."
einfo "Clear redis cache ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake cache:clear RAILS_ENV=production" \
|| die "failed to run cache:clear"
einfo "Clear and precompile assets ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake assets:clean RAILS_ENV=production
${BUNDLE} exec rake assets:precompile RAILS_ENV=production" \
|| die "failed to run assets:precompile"
else
einfo "Initializing database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake gitlab:setup RAILS_ENV=${RAILS_ENV}" \
|| die "failed to run rake gitlab:setup"
fi
einfo "You might want to run the following in order to check your application status:"
einfo "# cd ${DEST_DIR}"
einfo "# ${BUNDLE} exec rake gitlab:check RAILS_ENV=production"
einfo ""
einfo "GitLab is prepared, now you should configure your web server."
}

View File

@ -0,0 +1,375 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
# Mainteiner notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab has too many dependencies that it will be too
# difficult to maintain them via ebuilds.
# - USE flags analytics and public-projects applies our custom patches, see
# https://github.com/cvut/gitlabhq for more information.
#
USE_RUBY="ruby20"
PYTHON_DEPEND="2:2.5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlabhq.git"
EGIT_COMMIT="v${PV}"
inherit eutils git-2 python ruby-ng versionator user
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
LICENSE="MIT"
SLOT=$(get_version_component_range 1-2)
KEYWORDS="~amd64 ~x86"
IUSE="memcached mysql +postgres +unicorn"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# json dev-util/ragel
# yajl-ruby dev-libs/yajl
# pygments.rb python 2.5+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql-base
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/ragel
dev-libs/yajl
net-libs/nodejs
postgres? ( dev-db/postgresql-base )
mysql? ( virtual/mysql )
memcached? ( net-misc/memcached )"
DEPEND="${GEMS_DEPEND}
$(ruby_implementation_depend ruby19 '=' -1.9.3*)[readline,ssl,yaml]
>=dev-vcs/git-1.8.1.5
>=dev-vcs/gitlab-shell-1.9.6
net-misc/curl
virtual/ssh"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
RUBY_PATCHES=(
"${P}-fix-checks-gentoo.patch"
)
GIT_USER="git"
GIT_GROUP="git"
GIT_HOME=$(getent passwd $GIT_USER | cut -d: -f6)
DEST_DIR="/opt/${PN}-${SLOT}"
CONF_DIR="/etc/${PN}-${SLOT}"
GIT_REPOS="${GIT_HOME}/repositories"
GIT_SATELLITES="${GIT_HOME}/gitlab-satellites"
GITLAB_SHELL="/var/lib/gitlab-shell"
GITLAB_SHELL_HOOKS="${GITLAB_SHELL}/hooks"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 ${DEST_DIR} "$GIT_GROUP}"
}
all_ruby_unpack() {
git-2_src_unpack
}
each_ruby_prepare() {
# fix path to repo and gitlab-shell hooks
test -d "${GITLAB_SHELL_HOOKS}" || die "Gitlab Shell hooks directory not found: \"${GITLAB_SHELL_HOOKS}. Have you properly installed dev-vcs/gitlab-shell"?
sed -i \
-e "s|\(\s*path:\s\)/.*/gitlab-shell/|\1 ${GITLAB_SHELL}/|" \
-e "s|\(\s*repos_path:\s\)/.*|\1 ${GIT_REPOS}/|" \
-e "s|\(\s*hooks_path:\s\)/.*|\1 ${GITLAB_SHELL_HOOKS}/|" \
-e "s|\(\s*path:\s\)/.*/gitlab-satellites/|\1 ${GIT_SATELLITES}/|" \
-e "s|\(\s*GITLAB_SHELL:\s*\)|\1\n\tpath: \"${GITLAB_SHELL}\"|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
# modify database settings
sed -i \
-e 's|\(username:\) postgres.*|\1 gitlab|' \
-e 's|\(password:\).*|\1 gitlab|' \
-e 's|\(socket:\).*|/run/postgresql/.s.PGSQL.5432|' \
config/database.yml.postgresql \
|| die "failed to filter database.yml.postgresql"
# replace "secret" token with random one
local randpw=$(echo ${RANDOM}|sha512sum|cut -c 1-128)
sed -i -e "/secret_token =/ s/=.*/= '${randpw}'/" \
config/initializers/secret_token.rb \
|| die "failed to filter secret_token.rb"
# remove needless files
#rm -r .git Satisfy gitlab::check.
rm .foreman .gitignore Procfile .travis.yml
use unicorn || rm config/unicorn.rb.example
use postgres || rm config/database.yml.postgresql
use mysql || rm config/database.yml.mysql
# remove dependency on therubyracer and libv8 (we're using nodejs instead)
local tfile; for tfile in Gemfile{,.lock}; do
sed -i \
-e '/therubyracer/d' \
-e '/libv8/d' \
"${tfile}" || die "failed to filter ${tfile}"
done
# change thin and unicorn dependencies to be optional
sed -i \
-e '/^gem "thin"/ s/$/, group: :thin/' \
-e '/^gem "unicorn"/ s/$/, group: :unicorn/' \
Gemfile || die "failed to modify Gemfile"
# change cache_store
if use memcached; then
sed -i \
-e "/\w*config.cache_store / s/=.*/= :dalli_store, { namespace: 'gitlab' }/" \
config/environments/production.rb \
|| die "failed to modify production.rb"
fi
# Update pathes for unicorn
if use unicorn; then
sed -i \
-e "s#/home/git/gitlab#${DEST_DIR}#" \
config/unicorn.rb.example \
|| die "failed to modify unicorn.rb.example"
fi
}
each_ruby_install() {
local dest="${DEST_DIR}"
local conf="/etc/${PN}-${SLOT}"
local temp="/var/tmp/${PN}-${SLOT}"
local logs="/var/log/${PN}-${SLOT}"
local uploads="${DEST_DIR}/public/uploads"
## Prepare directories ##
diropts -m750
keepdir "${logs}"
dodir "${temp}"
diropts -m755
keepdir "${conf}"
dodir "${dest}"
dodir "${uploads}"
dosym "${temp}" "${dest}/tmp"
dosym "${logs}" "${dest}/log"
## Link gitlab-shell into git home
dosym "${GITLAB_SHELL}" "${GIT_HOME}/gitlab-shell"
## Install configs ##
insinto "${conf}"
doins -r config/*
dosym "${conf}" "${dest}/config"
insinto "${dest}/.ssh"
newins "${FILESDIR}/config.ssh" config
echo "export RAILS_ENV=production" > "${D}/${dest}/.profile"
## Install all others ##
# remove needless dirs
rm -Rf config tmp log
insinto "${dest}"
doins -r ./
## Install logrotate config ##
dodir /etc/logrotate.d
sed -e "s|@LOG_DIR@|${logs}|" \
"${FILESDIR}"/gitlab.logrotate > "${D}"/etc/logrotate.d/${PN}-${SLOT} \
|| die "failed to filter gitlab.logrotate"
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test thin"
local flag; for flag in memcached mysql postgres unicorn; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
# Fix invalid ldflags for charlock_holmes,
# see https://github.com/brianmario/charlock_holmes/issues/32
${RUBY} /usr/bin/bundle config build.charlock_holmes --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -lz -licuuc'
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
## Clean ##
local gemsdir=vendor/bundle/ruby/$(ruby_rbconfig_value 'ruby_version')
# remove gems cache
rm -Rf ${gemsdir}/cache
# fix permissions
fowners -R ${GIT_USER}:${GIT_GROUP} "${dest}" "${conf}" "${temp}" "${logs}"
fperms o+Xr "${temp}" # Let nginx access the unicorn socket
## RC scripts ##
local rcscript=${P}.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@GIT_USER@|${GIT_USER}|" \
-e "s|@GIT_GROUP@|${GIT_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@DEST_DIR@|${dest}|" \
-e "s|@LOG_DIR@|${logs}|" \
-e "s|@RESQUE_QUEUE@|${resque_queue}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
if use memcached; then
sed -i -e '/^depend/,// {/need / s/$/ memcached/}' \
"${T}/${rcscript}" || die "failed to filter ${rcscript}"
fi
newinitd "${T}/${rcscript}" "${PN}-${SLOT}"
}
pkg_postinst() {
if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then
einfo "Generating SSH key for git user"
su -l ${GIT_USER} -s /bin/sh -c "
ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \
|| die "failed to generate SSH key"
fi
if [ ! -e "${GIT_HOME}/.gitconfig" ]; then
einfo "Setting git user in ${GIT_HOME}/.gitconfig, feel free to "
einfo "modify this file according to your needs!"
su -l ${GIT_USER} -s /bin/sh -c "
git config --global user.email 'gitlab@localhost';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
elog
elog "1. Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
elog " and edit this file in order to configure your GitLab settings."
elog
elog "2. Copy ${CONF_DIR}/database.yml.* to ${CONF_DIR}/database.yml"
elog " and edit this file in order to configure your database settings"
elog " for \"production\" environment."
elog
elog "3. If this is a new installation, you should create database for your GitLab instance."
elog
if use postgres; then
elog " If you have local PostgreSQL running, just copy&run:"
elog " su postgres"
elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab gitlab_production"
elog " Note: You should change your password to something more random..."
elog
elog " GitLab uses polymorphic associations which are not SQL-standard friendly."
elog " To get it work you must use this ugly workaround:"
elog " psql -U postgres -d gitlab"
elog " CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;"
elog
fi
elog "4. Finally execute the following command to initlize or update the environment:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server."
elog
}
pkg_config() {
## Check config files existence ##
einfo "Checking configuration files"
if [ ! -r "${CONF_DIR}/database.yml" ] ; then
eerror "Copy ${CONF_DIR}/database.yml.* to"
eerror "${CONF_DIR}/database.yml and edit this file in order to configure your"
eerror "database settings for \"production\" environment."
die
fi
if [ ! -r "${CONF_DIR}/gitlab.yml" ]; then
eerror "Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
eerror "and edit this file in order to configure your GitLab settings"
eerror "for \"production\" environment."
die
fi
## Initialize app ##
local RAILS_ENV=${RAILS_ENV:-production}
local RUBY=${RUBY:-ruby20}
local BUNDLE="${RUBY} /usr/bin/bundle"
# Ask user whether this is the first installation
einfon "Do you want to upgrade an existing installation? [Y|n] "
do_upgrade=""
while true
do
read -r do_upgrade
if [[ $do_upgrade == "n" || $do_upgrade == "N" ]] ; then do_upgrade="" && break
elif [[ $do_upgrade == "y" || $do_upgrade == "Y" || $do_upgrade == "" ]] ; then do_upgrade=1 && break
else eerrorn "Please type either \"Y\" or \"N\" ... " ; fi
done
if [[ $do_upgrade ]] ; then
einfo "Migration database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake db:migrate RAILS_ENV=production
${BUNDLE} exec rake gitlab:satellites:create RAILS_ENV=production" \
|| die "failed to migrate database."
einfo "Clear redis cache ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake cache:clear RAILS_ENV=production" \
|| die "failed to run cache:clear"
einfo "Clear and precompile assets ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake assets:clean RAILS_ENV=production
${BUNDLE} exec rake assets:precompile RAILS_ENV=production" \
|| die "failed to run assets:precompile"
else
einfo "Initializing database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake gitlab:setup RAILS_ENV=${RAILS_ENV}" \
|| die "failed to run rake gitlab:setup"
fi
einfo "You might want to run the following in order to check your application status:"
einfo "# cd ${DEST_DIR}"
einfo "# ${BUNDLE} exec rake gitlab:check RAILS_ENV=production"
einfo ""
einfo "GitLab is prepared, now you should configure your web server."
}

View File

@ -0,0 +1,390 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
# Mainteiner notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab has too many dependencies that it will be too
# difficult to maintain them via ebuilds.
# - USE flags analytics and public-projects applies our custom patches, see
# https://github.com/cvut/gitlabhq for more information.
#
USE_RUBY="ruby20"
PYTHON_DEPEND="2:2.5"
EGIT_REPO_URI="https://github.com/gitlabhq/gitlabhq.git"
EGIT_COMMIT="v${PV}"
inherit eutils git-2 python ruby-ng versionator user
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
LICENSE="MIT"
SLOT=$(get_version_component_range 1-2)
KEYWORDS="~amd64 ~x86"
IUSE="memcached mysql +postgres +unicorn"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# json dev-util/ragel
# yajl-ruby dev-libs/yajl
# rugged net-libs/http-parser
# pygments.rb python 2.5+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql-base
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libgit2[ssh]
dev-libs/libxml2
dev-libs/libxslt
dev-util/ragel
dev-libs/yajl
net-libs/http-parser
net-libs/nodejs
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )
memcached? ( net-misc/memcached )"
DEPEND="${GEMS_DEPEND}
$(ruby_implementation_depend ruby20 '=' -2.0.0*)[readline,ssl]
>=dev-vcs/git-1.8.1.5
>=dev-vcs/gitlab-shell-2.0.1
net-misc/curl
virtual/ssh"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
RUBY_PATCHES=(
"${P}-fix-checks-gentoo.patch"
)
GIT_USER="git"
GIT_GROUP="git"
GIT_HOME=$(getent passwd $GIT_USER | cut -d: -f6)
DEST_DIR="/opt/${PN}-${SLOT}"
CONF_DIR="/etc/${PN}-${SLOT}"
GIT_REPOS="${GIT_HOME}/repositories"
GIT_SATELLITES="${GIT_HOME}/gitlab-satellites"
GITLAB_SHELL="/var/lib/gitlab-shell"
GITLAB_SHELL_HOOKS="${GITLAB_SHELL}/hooks"
RAILS_ENV=${RAILS_ENV:-production}
RUBY=${RUBY:-ruby20}
BUNDLE="${RUBY} /usr/bin/bundle"
pkg_setup() {
enewgroup ${GIT_GROUP}
enewuser ${GIT_USER} -1 -1 ${DEST_DIR} "$GIT_GROUP}"
}
all_ruby_unpack() {
git-2_src_unpack
}
each_ruby_prepare() {
# fix path to repo and gitlab-shell hooks
test -d "${GITLAB_SHELL_HOOKS}" || die "Gitlab Shell hooks directory not found: \"${GITLAB_SHELL_HOOKS}. Have you properly installed dev-vcs/gitlab-shell"?
sed -i \
-e "s|\(\s*path:\s\)/.*/gitlab-shell/|\1 ${GITLAB_SHELL}/|" \
-e "s|\(\s*repos_path:\s\)/.*|\1 ${GIT_REPOS}/|" \
-e "s|\(\s*hooks_path:\s\)/.*|\1 ${GITLAB_SHELL_HOOKS}/|" \
-e "s|\(\s*path:\s\)/.*/gitlab-satellites/|\1 ${GIT_SATELLITES}/|" \
-e "s|\(\s*GITLAB_SHELL:\s*\)|\1\n\tpath: \"${GITLAB_SHELL}\"|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
# modify database settings
sed -i \
-e 's|\(username:\) postgres.*|\1 gitlab|' \
-e 's|\(password:\).*|\1 gitlab|' \
-e 's|\(socket:\).*|/run/postgresql/.s.PGSQL.5432|' \
config/database.yml.postgresql \
|| die "failed to filter database.yml.postgresql"
# replace "secret" token with random one
local randpw=$(echo ${RANDOM}|sha512sum|cut -c 1-128)
sed -i -e "/secret_token =/ s/=.*/= '${randpw}'/" \
config/initializers/secret_token.rb \
|| die "failed to filter secret_token.rb"
# remove needless files
#rm -r .git Satisfy gitlab::check.
rm .foreman .gitignore Procfile
use unicorn || rm config/unicorn.rb.example
use postgres || rm config/database.yml.postgresql
use mysql || rm config/database.yml.mysql
# remove dependency on therubyracer and libv8 (we're using nodejs instead)
local tfile; for tfile in Gemfile{,.lock}; do
sed -i \
-e '/therubyracer/d' \
-e '/libv8/d' \
"${tfile}" || die "failed to filter ${tfile}"
done
# change thin and unicorn dependencies to be optional
sed -i \
-e '/^gem "thin"/ s/$/, group: :thin/' \
-e '/^gem "unicorn"/ s/$/, group: :unicorn/' \
Gemfile || die "failed to modify Gemfile"
# change cache_store
if use memcached; then
sed -i \
-e "/\w*config.cache_store / s/=.*/= :dalli_store, { namespace: 'gitlab' }/" \
config/environments/production.rb \
|| die "failed to modify production.rb"
fi
# Update pathes for unicorn
if use unicorn; then
sed -i \
-e "s#/home/git/gitlab#${DEST_DIR}#" \
config/unicorn.rb.example \
|| die "failed to modify unicorn.rb.example"
fi
}
each_ruby_install() {
local dest="${DEST_DIR}"
local conf="/etc/${PN}-${SLOT}"
local temp="/var/tmp/${PN}-${SLOT}"
local logs="/var/log/${PN}-${SLOT}"
local uploads="${DEST_DIR}/public/uploads"
## Prepare directories ##
diropts -m750
keepdir "${logs}"
dodir "${temp}"
diropts -m755
keepdir "${conf}"
dodir "${dest}"
dodir "${uploads}"
dosym "${temp}" "${dest}/tmp"
dosym "${logs}" "${dest}/log"
## Link gitlab-shell into git home
dosym "${GITLAB_SHELL}" "${GIT_HOME}/gitlab-shell"
## Install configs ##
insinto "${conf}"
doins -r config/*
dosym "${conf}" "${dest}/config"
insinto "${dest}/.ssh"
newins "${FILESDIR}/config.ssh" config
echo "export RAILS_ENV=production" > "${D}/${dest}/.profile"
## Install all others ##
# remove needless dirs
rm -Rf config tmp log
insinto "${dest}"
doins -r ./
## Install logrotate config ##
dodir /etc/logrotate.d
sed -e "s|@LOG_DIR@|${logs}|" \
"${FILESDIR}"/gitlab.logrotate > "${D}"/etc/logrotate.d/${PN}-${SLOT} \
|| die "failed to filter gitlab.logrotate"
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test thin"
local flag; for flag in memcached mysql postgres unicorn; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
# Use systemlibs for rugged
${BUNDLE} config build.rugged --use-system-libraries
# Use systemlibs for nokogiri as suggested
${BUNDLE} config build.nokogiri --use-system-libraries
# Fix invalid ldflags for charlock_holmes,
# see https://github.com/brianmario/charlock_holmes/issues/32
${BUNDLE} config build.charlock_holmes --with-ldflags='-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -lz -licuuc'
einfo "Running bundle install ${bundle_args} ..."
${BUNDLE} install ${bundle_args} || die "bundler failed"
## Clean ##
local gemsdir=vendor/bundle/ruby/$(ruby_rbconfig_value 'ruby_version')
# remove gems cache
rm -Rf ${gemsdir}/cache
# fix permissions
fowners -R ${GIT_USER}:${GIT_GROUP} "${dest}" "${conf}" "${temp}" "${logs}"
fperms o+Xr "${temp}" # Let nginx access the unicorn socket
## RC scripts ##
local rcscript=${P}.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@GIT_USER@|${GIT_USER}|" \
-e "s|@GIT_GROUP@|${GIT_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@DEST_DIR@|${dest}|" \
-e "s|@LOG_DIR@|${logs}|" \
-e "s|@RESQUE_QUEUE@|${resque_queue}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
if use memcached; then
sed -i -e '/^depend/,// {/need / s/$/ memcached/}' \
"${T}/${rcscript}" || die "failed to filter ${rcscript}"
fi
newinitd "${T}/${rcscript}" "${PN}-${SLOT}"
}
pkg_postinst() {
if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then
einfo "Generating SSH key for git user"
su -l ${GIT_USER} -s /bin/sh -c "
ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \
|| die "failed to generate SSH key"
fi
if [ ! -e "${GIT_HOME}/.gitconfig" ]; then
einfo "Setting git user in ${GIT_HOME}/.gitconfig, feel free to "
einfo "modify this file according to your needs!"
su -l ${GIT_USER} -s /bin/sh -c "
git config --global user.email 'gitlab@localhost';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
elog
elog "1. Copy ${CONF_DIR}/gitlab.yml.example to ${CONF_DIR}/gitlab.yml"
elog " and edit this file in order to configure your GitLab settings."
elog
elog "2. Copy ${CONF_DIR}/database.yml.* to ${CONF_DIR}/database.yml"
elog " and edit this file in order to configure your database settings"
elog " for \"production\" environment."
elog
elog "3. If this is a new installation, you should create database for your GitLab instance."
elog
if use postgres; then
elog " If you have local PostgreSQL running, just copy&run:"
elog " su postgres"
elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab gitlab_production"
elog " Note: You should change your password to something more random..."
elog
elog " GitLab uses polymorphic associations which are not SQL-standard friendly."
elog " To get it work you must use this ugly workaround:"
elog " psql -U postgres -d gitlab"
elog " CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;"
elog
fi
elog "4. Finally execute the following command to initlize or update the environment:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server."
elog
}
pkg_config() {
## Check config files existence ##
einfo "Checking configuration files ..."
if [ ! -r "${CONF_DIR}/database.yml" ] ; then
eerror "Copy \"${CONF_DIR}/database.yml.*\" to \"${CONF_DIR}/database.yml\""
eerror "and edit this file in order to configure your database settings for"
eerror "\"production\" environment."
die
fi
if [ ! -r "${CONF_DIR}/gitlab.yml" ]; then
eerror "Copy \"${CONF_DIR}/gitlab.yml.example\" to \"${CONF_DIR}/gitlab.yml\""
eerror "and edit this file in order to configure your GitLab settings"
eerror "for \"production\" environment."
die
fi
# Ask user whether this is the first installation
einfo "Do you want to upgrade an existing installation? [Y|n] "
do_upgrade=""
while true
do
read -r do_upgrade
if [[ $do_upgrade == "n" || $do_upgrade == "N" ]] ; then do_upgrade="" && break
elif [[ $do_upgrade == "y" || $do_upgrade == "Y" || $do_upgrade == "" ]] ; then do_upgrade=1 && break
else eerrorn "Please type either \"Y\" or \"N\" ... " ; fi
done
if [[ $do_upgrade ]] ; then
einfo "Make sure that you've stopped any running Gitlab instance and"
einfo "that you've created a backup from your existing database: "
elog "\$ cd ${DEST_DIR} && ${BUNDLE} exec rake gitlab:backup:create RAILS_ENV=production"
elog ""
einfo "Press ENTER to continue, STRG-C to cancel"
read
einfo "Migration database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake db:migrate RAILS_ENV=production
${BUNDLE} exec rake gitlab:satellites:create RAILS_ENV=production" \
|| die "failed to migrate database."
einfo "Clear redis cache ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake cache:clear RAILS_ENV=production" \
|| die "failed to run cache:clear"
einfo "Clear and precompile assets ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake assets:clean RAILS_ENV=production
${BUNDLE} exec rake assets:precompile RAILS_ENV=production" \
|| die "failed to run assets:precompile"
else
einfo "Initializing database ..."
su -l ${GIT_USER} -s /bin/sh -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${BUNDLE} exec rake gitlab:setup RAILS_ENV=${RAILS_ENV}" \
|| die "failed to run rake gitlab:setup"
fi
einfo "You might want to run the following in order to check your application status:"
einfo "# cd ${DEST_DIR}"
einfo "# ${BUNDLE} exec rake gitlab:check RAILS_ENV=production"
einfo ""
einfo "GitLab is prepared, now you should configure your web server."
}