added ebuild for www-apps/gitlabhq-7.8.1 and fixed the installation of systemd .service files for ebuilds >=7.5* (again ...)

This commit is contained in:
Manuel Friedli 2015-02-25 13:48:36 +01:00
parent 72df912ace
commit 3e9c505862
9 changed files with 385 additions and 14 deletions

View file

@ -65,6 +65,7 @@ DIST gitlabhq-7.6.2.tar.gz 4238734 SHA256 bc8f92dacca6be48c7a34b60a727e0755a4474
DIST gitlabhq-7.7.1.tar.gz 4438938 SHA256 b3399006bb7b89c1622bee52562bff4ab9681fe4c31c127858c39dfb720e1bb1 SHA512 378ba79ad7d191895fc54b3f99ca2ff1e871e07a4557a0dab3b03f3815dfe6fec069f47da58573ad21acb25ed5d7efb249b79c65655c7607db0f9c4f6a2597bb WHIRLPOOL f87d3a8aeac0a3a6dce39806e5e2df7c9a852578627a1ee5875625795044cbe655fff1ffb7635d7cedda662b55c87959cd14f3e9f2e74e075e72a288c5ad4850
DIST gitlabhq-7.7.2.tar.gz 4439065 SHA256 7c99367be815d231ba4b349a7f0a3d2470ae13ac2910d01d085f46890961b714 SHA512 5853d7989e75c03b7f8df24378bf25d9b49ffc858f6421f809bfcc11177905d9706307d048b880316331c74c79914a3ebdd032682414c76ac6b082e3813be074 WHIRLPOOL eb56dadcda422cfccf263f838ec225359ed9490a3c34df8a3d4a9b1f08ad98900374d81214217f27132b29d104b5102ec3d95f0c6bc10a8eca7088f9e5c9bbbd
DIST gitlabhq-7.8.0.tar.gz 5303213 SHA256 a7b3836b1071ee58f986197b08c3d91fc85524a5ce3050f7ef6697088850a242 SHA512 fff5240f8286a3d084ac158a262ab1c285c1b685769e1a707e0317e67fd0c27205970c51338589a59c8192eb4a87c7e43b2ecbbaa5da8f5f243024f364285983 WHIRLPOOL bd8ed138b888ab46ecfa172045e79520db5f48ce95b119a1af752db4988ee62c73be753773d4cc5dea4fd029d4bf6a78293291e050a7b1e2776b0a84deff2357
DIST gitlabhq-7.8.1.tar.gz 5302130 SHA256 4308a945b605caa369c0cafc22fbf7aa9f6cf9143ab200cde86c9c9308849153 SHA512 ac789c6264e599f44e50edf4ff09187293f1d2a7f4fc9460b3f28d5753a4d868247fe68a443e50c2bcbd75871ed7a124f1d49e84565da954c83f36154b4cc302 WHIRLPOOL ceb7f82f86d31264321fec76b5344d908327546ba9c2ceec7ad81cd8eaba7832450459251cd3e52825ae00f926f8d74205681abc8e867f97d44eea195dca4652
EBUILD gitlabhq-6.7.5.ebuild 10973 SHA256 d74d454bd9972f15d21a3454e39a78ab042ccb3444cbbedb25da01d40335361b SHA512 b5494ee857055022da0803277d6a8b84d1fa1d9af66a853eedafdd3fa4993dfe4a66962581234333b16f41b6d605cfe6a207a4d2706c90d921fbc54474deb296 WHIRLPOOL 03026c7b7029c8bc7d5e5ad05c38e4b507be6c4f36b488753120d7d0849522a9e557c5b04adcac4c22eced0fbc1432fd16e7447198092b6691ccc529147d9dcf
EBUILD gitlabhq-6.8.2.ebuild 10595 SHA256 24317d99bb9d0e220c11a37709b1b701b9cd7bf7b9fe3adead666c531569dcf0 SHA512 2f3f5e38b33edfdff35f3888e694984e97d897d7c64c0aa6cc35149d253e7211560dbd918b12e891c0d1d009241e53e255a2a3be91beb5a3954d148c4554315e WHIRLPOOL 4dca44d6e271ec14252e3a4690e6736d64133d3d115ec19b77d37cb5a2a3d3a46e9820dae48df5d7fa79dd0ca9c6b178b9dca85811bc0e78b7964580b0696b59
EBUILD gitlabhq-6.9.2.ebuild 10616 SHA256 4221acadb5ac65ca3d662a2a560ff6343e04e0ca14dbd1b5bdd8f6a07812f7be SHA512 161c587d219c0dfd54b92805f7378aa7b1750bb25e632a16b67e3d24b28fab95f8f4272d685dfc70f1d7bfb15449a208fbb8b343dd8f902d8855034ed7f855d1 WHIRLPOOL effe560de13a29de88bf42aa927ddc2781373722a0e9a83ebef8942b0128208e35658a6b43d1bdc2d6e2b80c43b836dc8cc431f5d38912c201c789f70076e245
@ -78,10 +79,11 @@ EBUILD gitlabhq-7.3.1.ebuild 10554 SHA256 86eee0c2acc21da9020fc7dcb9383df15ce518
EBUILD gitlabhq-7.3.2.ebuild 10554 SHA256 bc1d484887ce7ad25d1cddeeb46677cc503d74638ddbb631d0afe5457643e47a SHA512 3b7d2220ffe95f6348af09efa62106ab77a89ae16448ea2bfd5b91748c9a5b3853823f24c6626ec53816e2035eff549bca3a4b45a3596cacb36967d2b96fec0e WHIRLPOOL a2bf0e9638fd18444e6534ae433e549e2259d8e30af3b4910392c271178d5a03fcb67a44f2118a69cbe5ec87affd769120c1cafc23b848041f35cf6e9e12e4bd
EBUILD gitlabhq-7.4.2.ebuild 10576 SHA256 7fdcfdfa51e7b2ed8b523879009c0cd19c2734b50e75267132d67b492cc1bcec SHA512 b255d439a4585373023591e352e6b1c9adcd3aa18b7bbf06a2bf18058c95247788b7fcdb80a197c726a96450d711bf5a2b98799673579b52ea255c4fdf2763c3 WHIRLPOOL e844febc7d6e0454bac997cedf5d723983a1f9afa808eaceda3abf8780b2da320883e12eb0dacca1d5a6f35219f7f40472ab9270630cff2718d00f26e628be21
EBUILD gitlabhq-7.4.3.ebuild 10576 SHA256 7fdcfdfa51e7b2ed8b523879009c0cd19c2734b50e75267132d67b492cc1bcec SHA512 b255d439a4585373023591e352e6b1c9adcd3aa18b7bbf06a2bf18058c95247788b7fcdb80a197c726a96450d711bf5a2b98799673579b52ea255c4fdf2763c3 WHIRLPOOL e844febc7d6e0454bac997cedf5d723983a1f9afa808eaceda3abf8780b2da320883e12eb0dacca1d5a6f35219f7f40472ab9270630cff2718d00f26e628be21
EBUILD gitlabhq-7.5.1.ebuild 10928 SHA256 3067cd42e7f2892d49a13f26bdb9b710a6e882395dcbf1c9760229c474f7e378 SHA512 823c547be9a7740c4c4918b24539851bf5c29fc3f74f2ff9d080038cb804caaad5c5e42c998f80478ff635cf6f3ed014bfb1331fc970000a2b4f1c263292d13b WHIRLPOOL 2d56cbd461aede4e4c2f5e876a5448f4272c0f9bb8e5d1ce6494747969aac28aacf79361ebff88cfd1e74d78ad819e60225eff3c021fb6751c16cb4f888b5522
EBUILD gitlabhq-7.5.3-r1.ebuild 10931 SHA256 eee6ed284b21d924330db3dccd28b7f1477b7d167def4ccb2038ad099f456b0e SHA512 46e67731a16cfb242322e3313006afdecff86ff9e32ca11020e375ce167b9398ad39336a56bef6a5a24749dd55646f59c5ac6294f967055020db1ed70ca9586e WHIRLPOOL e3e1aedd2bd45f073fe32dd77ddc953e83564ab7d012f69c7dcab299c675648a1a5770955801607eafd54483c473bf535e71c10c7956888ebdb4462818cdc86f
EBUILD gitlabhq-7.5.3.ebuild 10928 SHA256 3067cd42e7f2892d49a13f26bdb9b710a6e882395dcbf1c9760229c474f7e378 SHA512 823c547be9a7740c4c4918b24539851bf5c29fc3f74f2ff9d080038cb804caaad5c5e42c998f80478ff635cf6f3ed014bfb1331fc970000a2b4f1c263292d13b WHIRLPOOL 2d56cbd461aede4e4c2f5e876a5448f4272c0f9bb8e5d1ce6494747969aac28aacf79361ebff88cfd1e74d78ad819e60225eff3c021fb6751c16cb4f888b5522
EBUILD gitlabhq-7.6.2.ebuild 10955 SHA256 a58b34483b77cddd28416bfc63629afc04dcede958f7c50dd82aa28d08a04e15 SHA512 cd788d93461354e0262048bd2af1f3285e7e4b4e4505884c8f8545c49f34451c91671e55502fb2f18591b3479d80075abcf562b90c5d19f12795150cdb40b17c WHIRLPOOL 5dd6fd64cb468e1949dbd8f4167e32fa64c18586ecb0109288b8074cb53caebe27dc298b4d385da371cbddf3268fb9cbf912d91f6ff65ac3782720675c7eb512
EBUILD gitlabhq-7.7.1.ebuild 10947 SHA256 b9ba497d0da9f2512d8f1eef57b602d78d0c986b350719066ab086ee553fb9ad SHA512 9fe528e9c6d822e10ae0482c9633e946231478653ce584c86cf8e1394767e00f79c1c5d202a9a8f51560d60516b3281955ac56d7ae98e36c7cb0d5153a64b0ab WHIRLPOOL 15457312311918b035436524d50ba22b5f9caaca20ac408c7dcdba83602d0f76f2e376784e04b6279e18a7b8a286bc66bbd6012552ec43bc961d90cab0a72404
EBUILD gitlabhq-7.7.2.ebuild 10962 SHA256 f91909fdeb17cc7087e64875833d40f4740d1510f5ace02c55c4a582cabf3d07 SHA512 1d735bdf193efd2967fba35068daf5a59f4c701d401d4879602d5a3e95178f6bb28cdab1f59a721edcdbea0fb8ddb11a973b5117cf34e2ee7e077ba4acd15ef0 WHIRLPOOL 02ef2869b76bf1f719c3b9ee17911e066f9eac87c3034df1ec224dd6e4f5e82d7d096fc176d5c78dde186143560d1b35b6e22803659a0e1a1fdf57e9796e6dc8
EBUILD gitlabhq-7.8.0.ebuild 10950 SHA256 fca20937bfbe4941eed393eef631e66c2db089ec1c384589faa8f29f1cef819c SHA512 403e3f1b14212f6f3e0d12b3aa2737b258cd57f28edff178b152af0479432765c9f922b2942114a956c4a1223867438c15fd157599e47e4dc2faa127479cc4ba WHIRLPOOL abc7aed257e57105c56152bfc31a84b4dbf72793e8ac9f3f52b2a82e94fa66dbf8554283c5a3e197c87137c66a12470272cd981c84bb6aadcfd6e690befd7606
EBUILD gitlabhq-7.5.1.ebuild 10904 SHA256 821abc6ca9c2b87f18aa3279068ead6c25ed5d652a0ac725dc5c53a6eb9baf08 SHA512 f0ff1487b022ed7884a4883b4e0fe36229918a3c93ea24ed315da7eda8cbc664974444e4efb7275e26008c5ef75e872d0fe1f76eda43d7aaa2223649faf5d554 WHIRLPOOL a20c720e9ad3a440b89d09df0a02dfef4f63cfab2102a69da20e5f38925daf97f8a8d339e4c9d997e0f0a05b9f71ad3932d6cdc20e6561696d2286bb7d510589
EBUILD gitlabhq-7.5.3-r1.ebuild 10907 SHA256 3c8b8cabc75968beda5a351b746ab53c7e644d16c437bc54af51fd62283a1917 SHA512 e42b3605ab405a798467713f723ddff553ecef81b2f16baad9bd93653da15fb23e47aa7f28d5cc93eaabf3e8eeb70201dc6f8ae6192b42da82be0a754e54704d WHIRLPOOL eae1bb4dc43c178f61fd8fe5784c1e02f385969dc7237ce9c140774266f4a583f911617014602c1e72c0f8f525edc7b6e620c748045419640f0f0bdc8dc6f0d3
EBUILD gitlabhq-7.5.3.ebuild 10904 SHA256 821abc6ca9c2b87f18aa3279068ead6c25ed5d652a0ac725dc5c53a6eb9baf08 SHA512 f0ff1487b022ed7884a4883b4e0fe36229918a3c93ea24ed315da7eda8cbc664974444e4efb7275e26008c5ef75e872d0fe1f76eda43d7aaa2223649faf5d554 WHIRLPOOL a20c720e9ad3a440b89d09df0a02dfef4f63cfab2102a69da20e5f38925daf97f8a8d339e4c9d997e0f0a05b9f71ad3932d6cdc20e6561696d2286bb7d510589
EBUILD gitlabhq-7.6.2.ebuild 10931 SHA256 c2a5797b88d035885c4f931e169bbe794c4928cf598948d212044656a07e2506 SHA512 1384abcb7bf73d86da420da3b01504cccdc19244057a0c87232e83e9be1a78408efbfb378b723829b656159ad21eb1430a6cb4e7e183522b4009889ade5bfa02 WHIRLPOOL 6c097ef160efeb4027a6e28bdd962f2fe1917cd1f3cdb9457059449204cf46a31330d37e6a37d9728c14f8e562fe17e1483ab44ec152cead00a445e6b52d6efc
EBUILD gitlabhq-7.7.1.ebuild 10923 SHA256 c92d84d7c2a8a65b5876c39aa80d5c76eac8a2a8981d035638c9c835833a06cd SHA512 ae35bdf266887cad09cac95919aa4cc08faa277d0414955cdea621d8e3eb650a6ddda008c6c2a653d89df95c576dd17c2ab737444149fdb96d77a5ec18149753 WHIRLPOOL 16f34fade989e704fbab6ab2779a363b6f370a4e586adff56022775184fd74fbcd6b7aec4eaa32ef60435b618596e452eb586489731c6bc8cb459a7b3cd76b2a
EBUILD gitlabhq-7.7.2.ebuild 10938 SHA256 4c4336138456d9efe0cc7d6827c6c19be0edfeb874847202e566225e991e5991 SHA512 29d42285a1fdb55813d2811251ccdfd65b9a4eb62055191d038b0d1a2848476f68e639e4fa777260d200f36a8a7ab187b71339eff136126fd41a4478f31ff117 WHIRLPOOL c1657a6bc4d6af99d12ae562edcd84553b68b7996c7088b865c177cdb12236abd8e450e12755713ab42fb4d4418651da4ecaf8415d604de52546da208da93861
EBUILD gitlabhq-7.8.0.ebuild 10952 SHA256 5da8b8804b2bc89755c6be45aa057da0c34af34ac8b01e1a8fc4a95820fb8330 SHA512 cfd53fb5c9f07dc174b4985c66ba781f15eae514e153cf2a5d53e4ae753a23d086ed303b118e750ec4e6cf29a71f4fe486f091f301a06a8863b28d79fb9e5918 WHIRLPOOL 52fa14e9b6bbfacaa23f9629e0aee7c1557f0c913e9ed6ea10fb82fdc6dd3b43a406a05b104729b46448fe491e4d17cc05e12b3a7318f314263415231e687edf
EBUILD gitlabhq-7.8.1.ebuild 10966 SHA256 b5d3b822a4ce401b50909f0663bef4dacf7c9673c51bbbe2f600533f3bf7c365 SHA512 630b0b2bcda6fb7c5b407b4c094e35ad9de74ea9e6fd959f914f9944cd543ced2c3f9b1e8d3f98c6d3f1e0a3f6873e4ca64817ae3fe2aed61c4e656995e8ef62 WHIRLPOOL 3cede9b536a86cce0cc024a957d7b29c472cf60223ba9321bbe9e4b885cb9a58c3438d07708280a76dafb811551c3576559c4e6ec71b2050c3e81e88f460bce4

View file

@ -204,7 +204,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq.service gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -204,7 +204,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq.service gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -204,7 +204,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq.service gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -206,7 +206,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq.service gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -206,7 +206,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq.service gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -206,7 +206,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq.service gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -206,7 +206,7 @@ all_ruby_install() {
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq-7.service gitlab-sidekiq.service"
systemd_newunit "${FILESDIR}/gitlab-sidekiq-7.service" "gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else

View file

@ -0,0 +1,369 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
# Maintainer 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_RUBY="ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user systemd
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v${PV}.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.4.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="6"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres +unicorn systemd"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# rugged dev-util/cmake, virtual/pkgconfig
# json dev-util/ragel
# pygments.rb python 2.7+
# execjs net-libs/nodejs, or any other JS runtime
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
dev-util/cmake
dev-util/ragel
net-libs/nodejs
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )
virtual/krb5
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.5.4
dev-vcs/git
!app-crypt/heimdal"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
# fix-gemfile:
# Remove therubyracer that doesn't compile well on Gentoo (we're using
# nodejs instead that is faster and better). Also replace broken
# charlock_holmes version with fixed one.
#
# fix-project-name-regex:
# Allow project name to contain non-ASCII characters.
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-7.8.0-fix-gemfile.patch"
"${PN}-7.7.1-fix-project-name-regex.patch"
"${PN}-6.0.2-fix-sendmail-config.patch"
"${PN}-7.8.0-email-custom-reply_to.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}-${SLOT}"
CONF_DIR="/etc/${MY_NAME}-${SLOT}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ce/blob/v${PV}/bin/background_jobs
SIDEKIQ_QUEUES="post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default"
all_ruby_prepare() {
# fix paths
local satellites_path="${TEMP_DIR}/repo_satellites"
local repos_path=/var/lib/git/repositories
local shell_path=/usr/share/gitlab-shell
sed -i -E \
-e "/satellites:$/,/\w:$/ s|(\s*path:\s).*|\1${satellites_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*path:\s).*|\1${shell_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*repos_path:\s).*|\1${repos_path}/|" \
-e "/gitlab_shell:$/,/\w:$/ s|(\s*hooks_path:\s).*|\1${shell_path}/hooks/|" \
config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
local run_path=/run/${MY_NAME}
sed -i -E \
-e "s|/home/git/gitlab/tmp/(pids\|sockets)|${run_path}|" \
-e "s|/home/git/gitlab/log|${LOGS_DIR}|" \
-e "s|/home/git/gitlab|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/git/gitlab/tmp/sockets|${run_path}|" \
lib/support/nginx/gitlab || die "failed to filter nginx/gitlab"
# modify default database settings for PostgreSQL
sed -i -E \
-e 's|(username:).*|\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"
# rename config files
mv config/gitlab.yml.example config/gitlab.yml
mv config/unicorn.rb.example config/unicorn.rb
local dbconf=config/database.yml
if use postgres && ! use mysql; then
mv ${dbconf}.postgresql ${dbconf}
rm ${dbconf}.mysql
elif use mysql && ! use postgres; then
mv ${dbconf}.mysql ${dbconf}
rm ${dbconf}.postgresql
fi
# remove useless files
rm -r lib/support/{deploy,init.d}
use unicorn || rm config/unicorn.rb
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp} ${temp}/repo_satellites
diropts -m755
dodir ${conf} ${dest}/public/uploads
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
# install configs
insinto ${conf}
doins -r config/*
dosym ${conf} ${dest}/config
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# remove needless dirs
rm -Rf config tmp log
# install the rest files
# using cp 'cause doins is slow
cp -Rl * "${D}/${dest}"/
# install logrotate config
dodir /etc/logrotate.d
cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF
${logs}/*.log {
missingok
delaycompress
compress
copytruncate
}
EOF
## Install gems via bundler ##
cd "${D}/${dest}"
local without="development test aws"
local flag; for flag in mysql postgres unicorn; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
# clean gems cache
rm -Rf vendor/bundle/ruby/*/cache
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
## RC script ##
if use systemd ; then
ewarn "Beware: systemd support has not been tested, use at your own risk!"
systemd_newunit "${FILESDIR}/gitlab-sidekiq-7.service" "gitlab-sidekiq.service"
systemd_dounit "${FILESDIR}/gitlab-unicorn.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq.init
use unicorn && rcscript=gitlab-unicorn-7.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@SLOT@|${SLOT}|" \
-e "s|@GITLAB_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}-${SLOT}"
fi
}
pkg_postinst() {
elog
elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Then you should create a database for your GitLab instance, if you"
elog "haven't done so already."
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 gitlabhq_production"
elog " Note: You should change your password to something more random..."
elog
fi
elog "4. Finally execute the following command to initlize environment:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog " Note: Do not forget to start Redis server first!"
elog
elog "If this is an update from previous version, it's HIGHLY recommended"
elog "to backup your database before running the config phase!"
elog
elog "If you're running GitLab behind an SSL proxy such as nginx or Apache and"
elog "you can't login after the upgrade, be sure to read the section about the"
elog "verification of the CSRF token in GitLab's trouble-shooting guide at"
elog "http://goo.gl/5XGRGv."
}
pkg_config() {
local shell_conf='/etc/gitlab-shell.yml'
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
# check gitlab-shell configuration
if [ -r ${shell_conf} ]; then
local shell_repos_path="$(ryaml ${shell_conf} repos_path)"
local gitlab_repos_path="$(ryaml ${CONF_DIR}/gitlab.yml \
production gitlab_shell repos_path)"
if [ ! "${shell_repos_path}" -ef "${gitlab_repos_path}" ]; then
eerror "repos_path in ${CONF_DIR}/gitlab.yml and ${shell_conf}"
eerror "must points to the same location! Fix the repos_path location and"
eerror "run this again."; die
fi
else
ewarn "GitLab Shell checks skipped, could not find config file at"
ewarn "${shell_conf}. Make sure that you have gitlab-shell properly"
ewarn "installed and that repos_path is the same as in GitLab."
fi
local email_from="$(ryaml ${CONF_DIR}/gitlab.yml production gitlab email_from)"
local git_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${git_home}/.gitconfig" ]; then
einfo "Setting git user"
su -l ${MY_USER} -c "
git config --global user.email '${email_from}';
git config --global user.name 'GitLab'" \
|| die "failed to setup git name and email"
fi
if [ ! -d "${DEST_DIR}/.git" ]; then
# create dummy git repo as workaround for
# https://github.com/bundler/bundler/issues/2039
einfo "Initializing dummy git repository to avoid false errors from bundler"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
git init
git add README.md
git commit -m 'Dummy repository'" >/dev/null
fi
## Initialize app ##
local RAILS_ENV="production"
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
local dbname="$(ryaml ${CONF_DIR}/database.yml production database)"
if [ -f "${DEST_DIR}/.secret" ]; then
local update=true
einfo "Migrating database ..."
exec_rake db:migrate
# https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496
einfo "Migrating iids ..."
exec_rake migrate_iids
einfo "Cleaning old precompiled assets ..."
exec_rake assets:clean
einfo "Cleaning cache ..."
exec_rake cache:clear
else
local update=false
einfo "Initializing database ..."
exec_rake gitlab:setup
fi
einfo "Precompiling assests ..."
exec_rake assets:precompile
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/"
ewarn "for any additional migration tasks specific to your previous GitLab"
ewarn "version."
fi
}
ryaml() {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
}
exec_rake() {
local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}"
echo " ${command}"
su -l ${MY_USER} -c "
export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
cd ${DEST_DIR}
${command}" \
|| die "failed to run rake $@"
}