Merge branch 'feature/cleanup-gitlab' into 'master'

Feature/cleanup gitlab

See merge request !11
This commit is contained in:
Manuel Friedli 2015-09-29 00:38:15 +02:00
commit c385390fb6
35 changed files with 2 additions and 6780 deletions

View File

@ -1,9 +1,5 @@
AUX gitlab-ci-multi-runner.init 640 SHA256 2ec761220c920221b1978b34fc4023f9c1a98cabc18dc30fa6f08d5a1efbc9c3 SHA512 d18d9da295f7fa61bbc978490f67d89eb7e0ee597305b2dacff544c8b22a0b5ef2c02570ac00af3ebf593d5b3f983e464075203b4ef3a8a8ab615a7344be7f37 WHIRLPOOL 943d13f7057498d9584764785be41f0ff1c5ddaf91485aa7c94e1b8373221712bc0544768faae475dd5379d15cb622e8ac89a918b779634cb1af8b3a83db0b0b
DIST gitlab-ci-multi-runner-0.4.2-amd64 11164760 SHA256 f4eebcab008314cdca686c81ce54077a5ffebc47638ce7359d1982b0f27a6796 SHA512 b150515f7da2863974dd9213e5bf4144aee5b039cabaef8790cc8963ded4afecaf23375e8e78d1941b3d4a4cf024cc99846f4a1dcf2922fe9528feeab6a0c187 WHIRLPOOL 2190567da88614b8497046e9578981b1bbfc80fd67f60e5d50497a561f19f4281e66dda20a9863e479e02dec1f8458a01e5c71a7a58f89ebcc8c071f2917e107
DIST gitlab-ci-multi-runner-0.4.2-arm 8940328 SHA256 4e13b2a2c3ea47d8f3bf9a946717b1a1655bd17955c88ea112d88aaa4f3bcbb9 SHA512 8108c3240f29a951fcfb1502cbb4db2bb82053481ca8212f26402078cf98637ed663f7adeeaca696b6fb67bac875673bd40c57074f6e94ffb6dfa99d13d26964 WHIRLPOOL 0e9948de75ad5d4aa81d417456dc8d6275a0355f0e976476e551c4c7acd611f5aea8fba765d2df51a282ba55a67a25dbe76328c52ad79814d9b29fa004629e46
DIST gitlab-ci-multi-runner-0.4.2-x86 8981664 SHA256 be900402515f2c7739566ae39817b9a9f1a5a3418329353edd4d2f2bfbf77d7f SHA512 21884ce24efab2c5954d0b2d8fb5dbeb4d55cfe12143bf338ea58cddc6ef5b23eea6bb3b12290454f42854636155d985a213d4a487f0fbaa7f1e21e1f5a5ac2d WHIRLPOOL 838d7fc935031925e9ce62cf034d4b73450252c253f2e7db2944fe2dcd187babacd46c70f9657fa7995a911b77ffa0cc250acb295d9b5a074171072472e06386
DIST gitlab-ci-multi-runner-0.5.5-amd64 11633640 SHA256 00982b6f9cfea548a3e41fad9f50f2c8b221251ea2e7e8ac64563f62663537a3 SHA512 89a9474b5dc0dfd5bf53e4c60f40c43f8db1288e49960dc58d5283a61c22474c682041b3b04a4b4533536deef63cc06a65f0b5440891c5f7951d45508236563a WHIRLPOOL 1375f34887bc09d29ff2009a8344e6ec7c2a7d16f31ca1d063cce30607c003df99f80dd4d01244e991745d0ccdccce76077e6597e5ccb38a89a6cce59324b2b9
DIST gitlab-ci-multi-runner-0.5.5-arm 9292840 SHA256 0c1641fe1bff208e9166ad1ea3898652989017711e51b38838c48365de2870f5 SHA512 1d9a6c7200614acfa5c3461187ab9df0fe46bead5284d586ea24e2c7c243422ae096dd6faf40ca2b05d3fe567d589a33a87212449fcc7ff56ec1e759955d44c9 WHIRLPOOL 8ea40c13de87cffd1c77dedba64315133106bdfe0cfb8d87da8932d6abde0e88d6577fb9c8ada090b98a0f65d82e105b57a2236fe24385ed72c62a760f36256a
DIST gitlab-ci-multi-runner-0.5.5-x86 9377072 SHA256 d9cfc1fb809a4954b18b9d15cae078c552715ab8d596c5e07db2104131c286fb SHA512 952f60dca6cc5a46bc2906ad38e3f02b97181c48480fd0ea91c00e96a266cf37d105da4af1934b294c72a507cfd8e114c2907df80e4269cb082bc0775e451258 WHIRLPOOL 1d512571520a2901e00f758cdfb33441f885a801c717b06b72b626731b9c7e4637b6796fd21944032a1ab5215228e5f288577c4498a52256321446e8ef7fb8aa
EBUILD gitlab-ci-multi-runner-0.4.2.ebuild 2255 SHA256 ffaa678becd9818a50f331189f4b5803470a50340d3b6ca3136170c3db129157 SHA512 d798be43b50da3484dcae69245659cb2a6356603d7d9c9cddab7a2c031b41f6519c66d5416b124963ddc79364ad28d82c9682e9bc84301b7b8f0ac145e806b2b WHIRLPOOL f78e09faebb49a8c7fe60f26738a225767e32be58a23a9aff005ced2b03ccf2311d5ae6ccd00f52bcea188e1662781c939e96874e008a03c61d90cbf9bef2bb0
EBUILD gitlab-ci-multi-runner-0.5.5.ebuild 2275 SHA256 e1a7a816dd044047343f39cf6f610acbff5ea0ea0fcca15084644f85cbda3523 SHA512 102094e351cbee0d35101b9f3fb9940429b740cdd69a43ab85e261da0b3270b331e60120f66a73a8780ebb7b90fca918a64f12b6005003e40cb9472db1d9acee WHIRLPOOL 17d98021688fe778a082cf2dd22757a38944f41139d57cbdae5f4316bcbbf4616a1609f744bdf55dd4b02fd31601c8ce04e2a3fd67550866ce64f1b8a02332d6

View File

@ -1,95 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
inherit eutils user
DESCRIPTION="GitLab CI Multi Runner is the new build processor needed for GitLab CI >= 7.12"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci-multi-runner"
SRC_URI="x86? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-386 -> ${P}-x86 )
amd64? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-amd64 -> ${P}-amd64 )
arm? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-arm -> ${P}-arm )"
RESTRICT="mirror"
REQUIRED_USE="^^ ( x86 amd64 arm )"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="amd64 arm x86"
DEPEND="dev-vcs/git"
RDEPEND="${DEPEND}
virtual/mta"
MY_NAME="${PN}"
MY_USER="gitlab_ci_multi_runner"
DEST_DIR="/opt/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
pkg_setup() {
enewgroup ${MY_USER}
enewuser ${MY_USER} -1 /bin/bash ${DEST_DIR} ${MY_USER}
}
src_unpack() {
local a="$(usev amd64)$(usev arm)$(usev x86)"
mkdir -p "${S}"
cp "${DISTDIR}/${P}-${a}" "${S}/${PN}"
}
src_prepare() {
chmod +x "${S}/${PN}"
}
src_compile() {
# nothing to compile, binary all-in-one goodness! (?)
:
}
src_install() {
local dest=${DEST_DIR}
diropts -m755
dodir ${dest}
exeinto ${dest}
doexe "${S}/${PN}"
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest}
## RC script ##
local rcscript=gitlab-ci-multi-runner.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "If this is a fresh install of GitLab CI Multi Runner, please configure it"
elog "with the following command:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
}
pkg_config() {
einfo "You need to register the runner with your GitLab CI instance. Please"
einfo "Follow the instructions on"
einfo
einfo "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/linux-manually.md"
einfo
einfo "Perhaps I'll improve the ebuild later ... kthxbye."
}

View File

@ -1,7 +0,0 @@
AUX gitlab-ci-runner-5.0.0-fix-gemfile.patch 1099 SHA256 80dddabf6c0abf0096a9ba54fe5d4f7408f47c624429ff5ac2bc19afe99b5461 SHA512 208db66cb21e467656a798f8954c474a614d3de406601806e906edbafbacafef7670f2913eae43d897be38bef1f26c70cf2a33901d0667dff4f1b1b89643f08d WHIRLPOOL 5b6e4eabc1d3a7e3320cf4616d9890c221ff306aa246aaefe8b87c9e6a631ebe7c658435225f7e546d34ce21ada063a016dad5080208765879211d2a1df7a26a
AUX gitlab-ci-runner.conf 78 SHA256 3b9e4f922ff53cc57c4c883dd19c1343b2a61ceba7bef303d623aedc5d2651cd SHA512 af0b725e3eea789776962a085f53d8787f91b1c8bdd7aad76aeedad2304885ac890c81d95126ad5de2590ef2b0c93045d4ba50f8bc2ba7e0caeec3b27fa4f6f7 WHIRLPOOL 10563abf39449389e9cf53076fd21a106f555e58b708b679c9cc91213ec0319a7b0dfa15977c187ceedb9a2f7c060424f66891472a2e8e8ca78262e628e05968
AUX gitlab-ci-runner.init 1551 SHA256 83bb581255db1a8bfdf15627ce4d3166e3fab6725a36086a51ab6a69c4b0536a SHA512 d0af95f32af62c6b8758a29af831fbf80310381446c76bac795c767f5c2d6d04ead5329a8c0cc3b0624d83ea500bc48edef288073297b1060eb4df5b7856033c WHIRLPOOL 7fcb1ef8d15742a9800e43496e2802f66e8805510f40e685b7f1ef20ae23bb8d2389480acb11386cff1223ada7981e2a5d9ddaeb4d32fe4d74f88583f55c5311
DIST gitlab-ci-runner-5.0.0.tar.gz 11846 SHA256 7d7f97894ba5ffeb4f06aa8a62d1ec17c2a1cbf84efd20418d74ccfc0f18c1e5 SHA512 cee02d144f37840b215a9cf706a3ca8239fbd2f33561b783b1abfd9ebdfd2eb323ecb57b8545d08f17c50a24e237053c505257279940cef2dce60f160364875f WHIRLPOOL d79a53553221715d3a34a18bce88af5fdf02e162afb1c0ca7212707f2672e0e30f584513ac9a1b7a6b9c46b3695762fd04e2819903b05504b5f482e0047dc337
DIST gitlab-ci-runner-5.2.1.tar.gz 13379 SHA256 b03d63632e891f56b46097e2ca6b8e53dbb60cf82ed6c0b7164eed80c86f27eb SHA512 2a557ed01bd7a2ad9b1b0f6f47d39926d80163f61ba1df26977083d26a0f4346175efa2c9a1ba93df13db130d34a77440a18168e0cec9e9f5b9a7b88b9b48cba WHIRLPOOL 3c7f602cab556596fb1d39ef8b5f68fe1bf050d0af44b08a942ffc5bbab8ceb354ebd226acd18fafff3f88237182cac4b9f31cfa95a0fcbf014c18f308e7593d
EBUILD gitlab-ci-runner-5.0.0.ebuild 3744 SHA256 3cd6c4d1a3df1b06da6365efb8f60ab373561598f47c9c6c38de1e0627dd2c82 SHA512 42e24a2bb8d9bd478e454200c1fec3affb7d824fdae9073627535d12f998378b8247166d821d4473c5f8d3f60e2d2e10dd843ef3a59935c1cf48286d3a9f92a7 WHIRLPOOL ce3b94c8393788c694baf904c794eaeda930b022360cd1ee700562d90dde2f416c655c6277a26714806572c83336d2c878e9bcd6795778fa77fd70029463e736
EBUILD gitlab-ci-runner-5.2.1.ebuild 3751 SHA256 755fe91c75bd70483fd836722074e0d936836ddba234b7bfeb940e262400d022 SHA512 867469996a3847718ed914dbf887436265dcc87bf73bc646327c01a4dbd74808c6505749f04aaf95fcb81c54b1e4680f0e578e66e740fba30b5edefd14e616a9 WHIRLPOOL c48e1dc37ceae10d7882fece78f69d7d11f9f5c0243d78d5d557c48f03a377bd21ed53931d63840c469454bc653abb15ed81617082961bb8bb9f2295b84bfcb5

View File

@ -1,43 +0,0 @@
diff --git a/Gemfile b/Gemfile
index f20b3d7..fce01bf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,7 +2,7 @@ source "http://rubygems.org"
gem 'httparty'
gem 'childprocess', '0.3.6'
-gem 'charlock_holmes', '0.6.9.4'
+gem 'charlock_holmes', git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
gem 'json', '~> 1.7.7'
group :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index 85ef687..5057ceb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,9 +1,15 @@
+GIT
+ remote: https://github.com/brianmario/charlock_holmes.git
+ revision: dde194609b3513b0d2369ce8f916ae52566154b4
+ ref: dde194609b3513b0d2369ce8f916ae52566154b4
+ specs:
+ charlock_holmes (0.6.9.4)
+
GEM
remote: http://rubygems.org/
specs:
addressable (2.3.4)
awesome_print (1.2.0)
- charlock_holmes (0.6.9.4)
childprocess (0.3.6)
ffi (~> 1.0, >= 1.0.6)
coderay (1.0.9)
@@ -75,7 +81,7 @@ PLATFORMS
DEPENDENCIES
awesome_print
- charlock_holmes (= 0.6.9.4)
+ charlock_holmes!
childprocess (= 0.3.6)
coveralls
guard

View File

@ -1,2 +0,0 @@
# specify the number of runners to spawn. Default: 1
# gitlab_ci_runner_num=1

View File

@ -1,58 +0,0 @@
#!/sbin/runscript
name="GitLab CI Runner"
description="GitLab CI Runner, starts runners in the background"
: ${gitlab_ci_runner_user:=@USER@}
: ${gitlab_ci_runner_base:="@GITLAB_CI_RUNNER_BASE@"}
: ${gitlab_ci_runner_pidfile_base:="@RUN_DIR@/gitlab-ci-runner.pid"}
: ${gitlab_ci_runner_logfile:="@LOGS_DIR@/gitlab-ci-runner.log"}
: ${gitlab_ci_runner_num:=1} # number of runners to spawn
bundle_command="/usr/bin/bundle"
bundle_command_args="exec ./bin/runner"
depend() {
provide gitlab-ci-runner
}
start() {
ebegin "Starting ${name}"
for (( i=1; i<=${gitlab_ci_runner_num}; i++ )) ; do
einfo "Starting runner ${i} of ${gitlab_ci_runner_num} ..."
local pidfile="${gitlab_ci_runner_pidfile_base}${i}"
checkpath -d -o ${gitlab_ci_runner_user} -m755 "$(dirname "${pidfile}")"
start-stop-daemon --start \
--chdir "${gitlab_ci_runner_base}" \
--user=${gitlab_ci_runner_user} \
--make-pidfile \
--pidfile="${pidfile}" \
--background \
--exec /bin/bash -- -c "exec ${bundle_command} ${bundle_command_args} >> ${gitlab_ci_runner_logfile} 2>&1"
local success=$?
if [ ${success}!=0 ] ; then
eend ${success}
fi
done
eend 0
}
stop() {
ebegin "Stopping ${name}"
for (( i=1; i<=${gitlab_ci_runner_num}; i++ )) ; do
einfo "Stopping runner ${i} of ${gitlab_ci_runner_num} ..."
local pidfile="${gitlab_ci_runner_pidfile_base}${i}"
start-stop-daemon --stop \
--pidfile="${pidfile}"
# DO WE NEED --exec? or --startas???
local success=$?
if [ ${success}!=0 ] ; then
eend ${success}
fi
done
eend 0
}

View File

@ -1,160 +0,0 @@
# 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 CI Runner has too many dependencies that it
# will be too difficult to maintain them via ebuilds.
#
USE_RUBY="ruby19 ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user
DESCRIPTION="GitLab CI Runner is the build processor needed for GitLab CI"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci-runner"
SRC_URI="https://github.com/gitlabhq/gitlab-ci-runner/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~x86"
# IUSE=""
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
RUBY_PATCHES=(
"${P}-fix-gemfile.patch"
)
MY_NAME="gitlab-ci-runner"
MY_USER="gitlab_ci_runner"
DEST_DIR="/opt/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
pkg_setup() {
enewgroup ${MY_USER}
enewuser ${MY_USER} -1 /bin/bash ${DEST_DIR} ${MY_USER}
}
all_ruby_prepare() {
# remove useless files
rm -r lib/support/{init.d,logrotate.d}
}
all_ruby_install() {
local dest=${DEST_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
diropts -m755
dodir ${dest}
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# install the 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 bundle_args="--deployment"
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 and conf.d file ##
local rcscript=gitlab-ci-runner.init
local rcconf=gitlab-ci-runner.conf
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_RUNNER_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
newconfd "${FILESDIR}/${rcconf}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "If this is a fresh install of GitLab CI Runner, please configure it"
elog "with the following command:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
}
pkg_config() {
einfo "You need to register the runner with your GitLab CI instance. In"
einfo "order to do so, you need to know the URL of GitLab CI and the"
einfo "authentication token."
einfo
einfo "You can find the token on your GitLab CI website at"
einfo
einfo " http://<GITLAB-CI-HOST>/admin/runners"
einfo
einfo "Now please follow the instructions on the screen."
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
${BUNDLE} exec ./bin/setup" \
|| die "failed to run ${BUNDLE} exec ./bin/setup"
}

View File

@ -1,160 +0,0 @@
# 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 CI Runner has too many dependencies that it
# will be too difficult to maintain them via ebuilds.
#
USE_RUBY="ruby19 ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user
DESCRIPTION="GitLab CI Runner is the build processor needed for GitLab CI"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci-runner"
SRC_URI="https://github.com/gitlabhq/gitlab-ci-runner/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~x86"
# IUSE=""
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
RUBY_PATCHES=(
"${PN}-5.0.0-fix-gemfile.patch"
)
MY_NAME="gitlab-ci-runner"
MY_USER="gitlab_ci_runner"
DEST_DIR="/opt/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
pkg_setup() {
enewgroup ${MY_USER}
enewuser ${MY_USER} -1 /bin/bash ${DEST_DIR} ${MY_USER}
}
all_ruby_prepare() {
# remove useless files
rm -r lib/support/{init.d,logrotate.d}
}
all_ruby_install() {
local dest=${DEST_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
diropts -m755
dodir ${dest}
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# install the 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 bundle_args="--deployment"
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 and conf.d file ##
local rcscript=gitlab-ci-runner.init
local rcconf=gitlab-ci-runner.conf
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_RUNNER_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
newconfd "${FILESDIR}/${rcconf}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "If this is a fresh install of GitLab CI Runner, please configure it"
elog "with the following command:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
}
pkg_config() {
einfo "You need to register the runner with your GitLab CI instance. In"
einfo "order to do so, you need to know the URL of GitLab CI and the"
einfo "authentication token."
einfo
einfo "You can find the token on your GitLab CI website at"
einfo
einfo " http://<GITLAB-CI-HOST>/admin/runners"
einfo
einfo "Now please follow the instructions on the screen."
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
${BUNDLE} exec ./bin/setup" \
|| die "failed to run ${BUNDLE} exec ./bin/setup"
}

View File

@ -1,15 +1,3 @@
AUX gitlab-shell-2.0.0-config-paths.patch 1356 SHA256 442a8e18b4d8e6092db0d39659cba5e41404e90f21070ed50b5460177f28f1b2 SHA512 0445cd42086b2d77825c487d604ddcb11f8fdf4eb8dcdfa1fe1b8e8c24d7b8f273834dbec0bfbb763a35a74605d558cc8d3feaa056eb02a113d18124a764551e WHIRLPOOL 0e3367b229ea4f13818fe2e485dc8da83ad695aec496881cb5eb918b183029b0013518ca64acba1568d93dc418dfaf083c2a86b9f2e3adf9fe15cad038011b30
DIST gitlab-shell-2.4.1.tar.gz 21776 SHA256 9b656a8662b1e8d95e30470209c613d6a7b4f9bb6141185fa6013934f56a3d8d SHA512 1afcbb45e2b4fb39eac2903d28614ea101bd52b9032d2cd59ec9c60f005a9991dd1cfbfd4cae2444d05e63fe2f08b931e95f95edb41ee933825290b6faf9aa64 WHIRLPOOL 56725a5732d3be5e429504137073ff24e5f0bc5181b2615b38a6ff6eacb62b607e03c42c87bfae6515d625c102fb99b4d64c27ae2f91d1291d89c6d2e7c9cc30
DIST gitlab-shell-2.4.3.tar.gz 22930 SHA256 16bdda3a3b2fe933c48f74a79a4e604fd28eb7c8d0baea60177dff19ffd7f7ca SHA512 b2884bf4fb329cd0e82233dfd8712ced193d20edd271a980ddf0c9ce8496ae09d9bd14d927876a1075165733c0ab247ab25239a6769d49cf9845a438fddd864c WHIRLPOOL bdb6dd267d94488eb57c690849d7aa60a0c8502319a4c34af477941bfdb3b905566e70f199f1a1ee929ef3c7fb3d176fdbef0b2d3227d85b01e75be6579e385f
DIST gitlab-shell-2.5.4.tar.gz 31787 SHA256 d27d5c5d73724d68af99783f8fc561b9398582188d0ecee4265b310cd41e3a5b SHA512 40d687707a3c65b91f9a7f9db257993618e09d7ad9ceb5636e926690795053f62664ac1a19b90c6aebc0d97c709aa4c6be17fab52a8378a74238168b36c238d5 WHIRLPOOL c89fcada281844d3552ed992f56cb31a2bded8c6e8db6bc564ddb91ae3aa566c2a8493306707c2b726c36de284a308f30e74ffe7a2212db3c58e7578e985e0c2
DIST gitlab-shell-2.6.2.tar.gz 32108 SHA256 4e9885379af546ad50165f3c95110f130f8a4b2bddfae1a746f225df19960826 SHA512 353a25a391ad6818f631437cbd6735491e7ae61e0184f5ee52a69eb9a1f24354fc7c6752896c91dbf7ff6dd5f9df6ae8cb4cb0f022ac3d838fa693aa5244410a WHIRLPOOL c32642442b3a1d0519aa563261cd353ee8bc2cfc115d868a3179f56d947be0fdbbd3bb6bea8a4b2e1077f8de890b430a534f1135b59e2562d06c41ce0b995db0
DIST gitlab-shell-2.6.3.tar.gz 32152 SHA256 1c5582aa1f5552c2299b186fe12bf1ee5bafcf2bf855ecc193b1ca346d25ae9d SHA512 bac120eef30b7c6c2ee59a0a1063eed3416bc1eaea99df7a61bcb98d2b64528f948944f3daab44af186f9383e740b6746955d2a0425b5e8cebaf0836c853b235 WHIRLPOOL 94b5c3d7ca26601a1bdad19187b2694895ef932b175a1cd3a6295ac3f66f50588120e077c313f7b488ab4ae5b76749c673a4234fee3f85cad82e10c89e2dc436
DIST gitlab-shell-2.6.4.tar.gz 33163 SHA256 27b7d9c73353ed1370c38e75d85f1e6c569de3a2dc45fe684391b6802abd0d29 SHA512 0fe2377e74957b37cd7ab5126551e4cb1e3ac76355883a23ef9bb0b1c100e09aabaad8b27826e9f961bdeae8b6e56fd0d54789804d53d672f069397487aad8ef WHIRLPOOL 3981c346fe14162b9248f20165c4c2014f211dd0066481cf43adae04b173642d8f5eaafd37a328a1fb5e4deceec220e0679b6697d1f01e0a1bf77ca588b64384
DIST gitlab-shell-2.6.5.tar.gz 33445 SHA256 586092a62b053adf0b046372aa5983b1170446456cd24e63c145460acc927648 SHA512 52f5c1db5b813dcd68183c6ca02e1fa0eb693040d2e6dedbb903743c285feaddd2a2836726228673eb6da99da07fcd04103e9207443b9f4fb42ba6d1bd4e29db WHIRLPOOL f52937b73942bd2064bc4414f9d4c8b34366dac59912ee926347ba02b7d44c28630a8f530beea82c3df5b6b801db5249080269a9a4e2f8daf33c484a3d203754
EBUILD gitlab-shell-2.4.1.ebuild 3501 SHA256 7df2653edb6213906f9c51f96b1516029df2bba7fed1b11468b1029e6b3f17bd SHA512 8b647a6b4513631c385f7d0b84f58f6fc4e29409512bcf7ff6a0f10c8b9cb292afa13f5ff6a1c35898a0a3f207866472f3aee1f85f77796648f1fb055281f3bd WHIRLPOOL 20d1c0545db9a11a99e6d81dfee08f39d08759534178c2fcca2a74146954cdd292bb071e53a876905cb7446bbe699b78ef26d7349611221453cfee644cafb561
EBUILD gitlab-shell-2.4.3.ebuild 3502 SHA256 6c604db35e20522c499f45d5994c421ea08b25313f630af8349441ddae96d757 SHA512 8d492097a53e1314212c263730b5f00f8f53c8d52b1fdc8b6c5d8abed86927f4ff56c2bf04a430dd6aa0b155d4531881d5fbbd7d8948131ec609dc2d7eb41080 WHIRLPOOL 2b491377ffe21cd0706e6c8422e1c5b52530460b08abbc315cb7e172a052f1acfdabc335575b284bd8a9107cc83d4d1411e3afe1294710d4064d14025acf1bb4
EBUILD gitlab-shell-2.5.4.ebuild 3502 SHA256 6c604db35e20522c499f45d5994c421ea08b25313f630af8349441ddae96d757 SHA512 8d492097a53e1314212c263730b5f00f8f53c8d52b1fdc8b6c5d8abed86927f4ff56c2bf04a430dd6aa0b155d4531881d5fbbd7d8948131ec609dc2d7eb41080 WHIRLPOOL 2b491377ffe21cd0706e6c8422e1c5b52530460b08abbc315cb7e172a052f1acfdabc335575b284bd8a9107cc83d4d1411e3afe1294710d4064d14025acf1bb4
EBUILD gitlab-shell-2.6.2.ebuild 3500 SHA256 8de274d1be0c80ad57639ade47a6ca9d4446aed136a8cf75d6d821a3e9c414cf SHA512 10f1720fdcdbf96f95b9c5c5e2d396d49b1012bb7dc41c8cea3d9b9d3add0c7dc9574b47a90790e189e755ca8097c076a92cb279291f7112af1bfe5c6fd15fdd WHIRLPOOL affb0799af07ee36201eb5594296a74eb279d176b1713f6566cec067db5b4749057c5189b291f9fe28d94bb35e1e8e7d5baa6f00915ef9fa220199b3ed2b66c6
EBUILD gitlab-shell-2.6.3.ebuild 3500 SHA256 8de274d1be0c80ad57639ade47a6ca9d4446aed136a8cf75d6d821a3e9c414cf SHA512 10f1720fdcdbf96f95b9c5c5e2d396d49b1012bb7dc41c8cea3d9b9d3add0c7dc9574b47a90790e189e755ca8097c076a92cb279291f7112af1bfe5c6fd15fdd WHIRLPOOL affb0799af07ee36201eb5594296a74eb279d176b1713f6566cec067db5b4749057c5189b291f9fe28d94bb35e1e8e7d5baa6f00915ef9fa220199b3ed2b66c6
EBUILD gitlab-shell-2.6.4.ebuild 3500 SHA256 8de274d1be0c80ad57639ade47a6ca9d4446aed136a8cf75d6d821a3e9c414cf SHA512 10f1720fdcdbf96f95b9c5c5e2d396d49b1012bb7dc41c8cea3d9b9d3add0c7dc9574b47a90790e189e755ca8097c076a92cb279291f7112af1bfe5c6fd15fdd WHIRLPOOL affb0799af07ee36201eb5594296a74eb279d176b1713f6566cec067db5b4749057c5189b291f9fe28d94bb35e1e8e7d5baa6f00915ef9fa220199b3ed2b66c6
EBUILD gitlab-shell-2.6.5.ebuild 3500 SHA256 8de274d1be0c80ad57639ade47a6ca9d4446aed136a8cf75d6d821a3e9c414cf SHA512 10f1720fdcdbf96f95b9c5c5e2d396d49b1012bb7dc41c8cea3d9b9d3add0c7dc9574b47a90790e189e755ca8097c076a92cb279291f7112af1bfe5c6fd15fdd WHIRLPOOL affb0799af07ee36201eb5594296a74eb279d176b1713f6566cec067db5b4749057c5189b291f9fe28d94bb35e1e8e7d5baa6f00915ef9fa220199b3ed2b66c6

View File

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab-6/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab-6/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab-6/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,126 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
USE_RUBY="ruby20 ruby21"
inherit eutils ruby-ng user
DESCRIPTION="SSH access and repository management for GitLab"
HOMEPAGE="https://github.com/gitlabhq/gitlab-shell"
SRC_URI="https://github.com/gitlabhq/gitlab-shell/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="
dev-vcs/git
dev-db/redis
virtual/ssh"
ruby_add_bdepend "
virtual/ruby-ssl"
MERGE_TYPE="binary"
RUBY_PATCHES=(
"${PN}-2.0.0-config-paths.patch"
)
GIT_USER="git"
DEST_DIR="/usr/share/${PN}"
DATA_DIR="/var/lib/git"
LOGS_DIR="/var/log/gitlab"
CONF_FILE="/etc/gitlab-shell.yml"
pkg_setup() {
enewgroup ${GIT_USER}
enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}"
local git_shell=$(egetshell ${GIT_USER})
if [ ! ${git_shell} -ef '/bin/bash' ]; then
ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}."
ewarn "Changing shell to /bin/bash ..."
usermod -s /bin/bash ${GIT_USER} \
|| die "failed to change login shell for ${GIT_USER}"
fi
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|/home/git|${DATA_DIR}|" \
-e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \
config.yml.example || die "failed to filter config.yml.example"
sed -i \
-e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \
lib/gitlab_config.rb || die "failed to filter gitlab_config.rb"
}
all_ruby_install() {
# install lib
insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION
# install scripts
exeinto ${DEST_DIR}/bin; doexe bin/*
exeinto ${DEST_DIR}/hooks; doexe hooks/*
exeinto ${DEST_DIR}/support; doexe support/*
# create symlinks to bin
local name; for name in $(basename -a bin/gitlab-*); do
dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}"
done
insinto $(dirname ${CONF_FILE})
newins config.yml.example $(basename ${CONF_FILE})
# create symlink for .gitlab_shell_secret
einfo "creating symlink for .gitlab_shell_secret"
TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret"
dosym /opt/gitlab/.gitlab_shell_secret "$TOKEN_FILE"
# prepare directories
diropts -m750; dodir ${DATA_DIR}
diropts -m770; keepdir ${DATA_DIR}/repositories
diropts -m755; dodir ${LOGS_DIR}
# GitLab stupidly expects that gitlab-shell is in home of git user...
dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell
# fix permissions
fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR}
}
pkg_postinst() {
# check git home directory
local git_home=$(egethome ${GIT_USER})
if [ ! "${git_home}" -ef ${DATA_DIR} ]; then
ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh,"
ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must"
ewarn "either change the authorized_keys location in ${CONF_FILE},"
ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}"
ewarn "and move ${git_home}/.ssh here."
ewarn
fi
local auth_dir="${git_home}/.ssh"
elog "Initializing authorized_keys file in ${auth_dir}"
mkdir -p ${auth_dir}
touch ${auth_dir}/authorized_keys
chmod -R u=rwX,go=- ${auth_dir}
chown -R ${GIT_USER}:${GIT_USER} ${auth_dir}
elog
elog "GitLab Shell was initialized. Repositories are located in"
elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin."
elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path."
elog
elog "You should change your gitlab_url in: ${CONF_FILE}."
}

View File

@ -1,19 +1,5 @@
AUX gitlab-ci-unicorn.init 1700 SHA256 ad75c1774db69d2ceae61983ba7227bb840c761d69eb387eaba120553fcd038a SHA512 fc2005db1523777f96867a3983efcb256ee8a3f62146dfc58af5536c0c869d665870b2f6710fe1d2f014fcb921ec3c79066b67b0189a6b525a7aea7f1afff78a WHIRLPOOL c80e72eb0c8f14c56662f91f2f1b51d1bbc83d956dcd3915c354e95ca5c1231c575b1fec91398c345fa71af61efe654e78f85e9d75be3b5624e65021e7102c28
DIST gitlab-ci-7.11.4.tar.gz 949764 SHA256 a7217c4a68eced99d8d77333c2c2d2f236fc435cd9b944b14873b99507fc7cb9 SHA512 954cabcf17044851c5bad4a34f9119cea01c6682a69f4512d61e25ba5660c5badb1d47d054cf88a30e67dd2e5b028ddf22dae4ca7ec3ea74734cb2430ba5d9dd WHIRLPOOL f41d617f4626fef4a6b5aeafa703bda090ceaa0270c48ce8ec54a27849025cf188c7945224eed2434f32e768b043fc1d182cf1bdcd42c59174a9935a829d5f0a
DIST gitlab-ci-7.12.1.tar.gz 741319 SHA256 20bcacb1b51b50feac3bed510fc6bfe120f0a244e4a04b02e4b2c857c2003530 SHA512 13d2b50c9cdc43bfe57f8771bfd1bafab26330b9ff94f62b5596a617777613002df8b92570231836d426950fdc738664222a475abfdbf68479751c2a26ff0c6a WHIRLPOOL d01d3ccebfc69d713c4e080cc098b68a9a0fb5a112e8318b5d7ab188cb6764f4835f6a514f7efe8cc0fa9b0aceb11820729161a106f9f0352e3a498b88b5576f
DIST gitlab-ci-7.12.2.tar.gz 741122 SHA256 d1e7f4b106a48d53a54942a2b543dd08097402bab3e379ef9daeecd9790e26f6 SHA512 a1197ba30d4bee985554cd54efefd46d278a22071a52cd2c367934f274bc268af5f42960c268792e8aa09f481f40fe6a6da640f69f63cae7c778af2c778bc86c WHIRLPOOL 57338dc79edfaeec0702cd75f74c2d89bf2cb6f41657a4aa1e36dd5427648783dcfad2c7ee534fd9fb8d20e1991dd3f7cef15234f7e96600f4c89cc2eb5dec62
DIST gitlab-ci-7.13.1.tar.gz 754531 SHA256 5b0b05503c7d38ff35c5ccd6bbe81be97460e060ee78b541804dcc8e18ffa319 SHA512 36faebfbd86333d518bee91d33498f6bb850a0e9987a462e5d66ae1d4cdea463e871f505943474aab9cf9e455bf0c4621379f51f1736adc5c6104f4e8d0cf1a3 WHIRLPOOL 34b27c1a71b14681d35e2e62faa7d93bea169daf2612f875250dd5b30ebaab5deba6f4d2d8a23da1db84d85fb1477188d33a658b60f76c30736b318840d5f99a
DIST gitlab-ci-7.13.2.tar.gz 754524 SHA256 769521038aec08f9cffb87381e83a46c02d24bd6a94132cf7111a905002673f8 SHA512 9ff28524923ffea7ec7b218c58ac3c5e1141e6f22b9f92b78da86d5e2ed9aadd72fd82693c5b35a1bab9c21706fd1336f7063c0cf50bb6b0fa1a562a5cdebd8e WHIRLPOOL d4ac82c93707b0ff23bffaf28fa3bb2397a891b732f6419dcef097c03b158ca7d40472acdeffb3d160c0b637492904c1171eb2ff8e4acdb7f51e298aa46ce4c8
DIST gitlab-ci-7.13.4.tar.gz 754607 SHA256 041ccd2f6a72d0501085b6141f3131f246e4b98ae22eadf6c651405736a4112d SHA512 49fc134a03408b7d60600a2bca4053d2c63bf7257afdd4b5d8133615c8c5eda3638fac7f4682a204f058ac04bd0c849f1c951eba38111f6abd287be6fea017ff WHIRLPOOL 576cdccc308c1ace7fb88c5371816a10864631c58f4713b9a669ffc81e15b75906e202d17a40e349d9d023cb8628246fb66a1483149e77bbac14f39045fc6d0b
DIST gitlab-ci-7.13.5.tar.gz 754582 SHA256 2318640561cca55d0dc54db6dcbe1320628438c42e3a4e23015168e2150d5444 SHA512 cf0f7a586e83872b483a29522cd8143ccd9cbecba99e5c1c9842d4a29434e04a607e20238fdec523d515ac7a905b160a12c15598d838eb27e2f8bacdca9b52b3 WHIRLPOOL 29f73a3f9c02e66d04e9b257ce18d3250b51e96df2ad7d0bc61979dd9bf0179e594d9c39a02a39fb8564fc923cb8592a967152dadd20597dfbe536dfe6291520
DIST gitlab-ci-7.14.1.tar.gz 1103265 SHA256 4f856217ac395d296395f42943dc1b3561a49df4a43635860a204a1b3a8b763c SHA512 85283ddacdb4bfec60a479793d0380aa0db542e642c37a64b7eff6153e99105e1e26f11990bd767a996eb8d1deffe243c8eaa59ecd942cd5b37c85e940b3113b WHIRLPOOL c60506ea1a3399215fa2a39af55728d340054ef45f1886e57e110703a93a3fb8b6fb9d5cea1bb34ad112a58fad1d84c03e6b3c243a089cec08a7e2cd0c450c15
DIST gitlab-ci-7.14.3.tar.gz 1103513 SHA256 89731e2338b08a811472e0e1b64966789021e1c88f880fea9c38e90cc807651b SHA512 74c96c36d892f88f204466e99020dcf1438605bf85714484cdac442b04e6590cd79af2e97c1f738a2c2d32f81e1007d5563e6a32f2f165c6f42e76f4f53da479 WHIRLPOOL 37f13ccfae347d3e67b8de2ebacedcd5ca18edc5149326dbc5a512d3f3531df6b4b87a8430fdfe7280ded1ea694da4898504786a1b157f967214cf52ca72a58b
EBUILD gitlab-ci-7.11.4.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.12.1.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.12.2.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.13.1.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.13.2.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.13.4.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.13.5.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b56d96f71c9d89f333f582f9f967 SHA512 9f4aa8569954e28e9081262560192e224d4a1bf80ca73dca6349d0b08f14218e7841d516b9a0d93dca2923e7a49e0093a5d397a224f7e417cf5d65ff498e74f3 WHIRLPOOL 8d27bb147d1f858259ff2b9bd208c7a05bad8cb2057ce5ee56462fb4a9fb2eb9c417ca344cfd66a9a715aeec429988c34ca4dd9495bf1f6529082d3ba509d358
EBUILD gitlab-ci-7.14.1.ebuild 8545 SHA256 1aa8d73cb86eaf49d1d9e540d1b842ca823e1e2634312611b2cf0caf92536556 SHA512 c2b3e4c17bebcbae5c98db6458099bba05f881772a322893e06797592001a49178bc8f2a2c970a8d2276f3be568c288f821b640470581a0b1b8067c9fbae897a WHIRLPOOL 0dcbd3385b7c75d78afc4329231ec1a5a4e593a7aa9f8a1aad38ac82b281e2ea6c135fdff2a9be90ace9af0c4927fdbc4c2d5253c1c34e85e3e389c7e46f7dec
DIST gitlab-ci-8.0.2.tar.gz 1110587 SHA256 002b0df9c1adf8958626e86d965035c7cba33e2e0d9503f624c75f70d31aa306 SHA512 e32245e3ff54ed9b22d43e1164e0f5b289458c27f6993937ae7c30c9a22ba59d587925723822428e8a692cbd5c7542269fdc6db4d0906ab8a319975311fd2b25 WHIRLPOOL f0528f67d4fbe41449c41726d0f3c2bf7d26a2f218ddeb4eaa94f0845854d8684e0a74e63b1c6b65ccc1aeed5dc8e611e48d626329b4eec5ce02289ac16f8a2e
EBUILD gitlab-ci-7.14.3.ebuild 8540 SHA256 82d924f02abdbd68a2b4bafc0b82232ebad5303bb9a9259ec2df70da662a9e40 SHA512 3a9fb89fde76f4e839cfbd23bff299a66d87ecd8e7943f87e4c69e1d25b9679a0fa7feae77264b9d0d5b1f39a529d208fa0d438d7f317b64f1a8b9b509e3e0da WHIRLPOOL 8c985119732f266ab75b901755d2c7f4f3d659767a840487b97fa25f084a136fe287540c0e4a3c19be90e0225561753da6f3979d24d47ca61e74f4ed8f36a67e
EBUILD gitlab-ci-8.0.2.ebuild 8540 SHA256 82d924f02abdbd68a2b4bafc0b82232ebad5303bb9a9259ec2df70da662a9e40 SHA512 3a9fb89fde76f4e839cfbd23bff299a66d87ecd8e7943f87e4c69e1d25b9679a0fa7feae77264b9d0d5b1f39a529d208fa0d438d7f317b64f1a8b9b509e3e0da WHIRLPOOL 8c985119732f266ab75b901755d2c7f4f3d659767a840487b97fa25f084a136fe287540c0e4a3c19be90e0225561753da6f3979d24d47ca61e74f4ed8f36a67e

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -1,309 +0,0 @@
# 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="ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user
DESCRIPTION="GitLab CI is a continuous integration server that is tightly integrated with GitLab"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci"
SRC_URI="https://github.com/gitlabhq/gitlab-ci/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mysql +postgres"
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
# pg dev-db/postgresql
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql )
mysql? ( virtual/mysql )"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
# no patches needed so far ...
#RUBY_PATCHES=(
#)
MY_NAME="gitlab-ci"
MY_USER="gitlab_ci"
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
# When updating ebuild to newer version, check list of the queues in
# https://gitlab.com/gitlab-org/gitlab-ci/blob/v${PV}/script/background_jobs
SIDEKIQ_QUEUES="runner,common,default"
pkg_setup() {
enewgroup gitlab_ci
enewuser gitlab_ci -1 /bin/bash ${DEST_DIR} "gitlab_ci,cron,redis"
}
all_ruby_prepare() {
# fix paths
sed -i -E \
-e "s|redis://redis.example.com:6379|unix:/run/redis/redis.sock|" \
config/resque.yml.example || die "failed to filter resque.yml.example"
sed -i -E \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/(pids\|sockets)|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/log|${LOGS_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci|${DEST_DIR}|" \
config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
sed -i \
-e "s|/home/gitlab_ci/gitlab-ci/tmp/sockets|${RUN_DIR}|" \
-e "s|/home/gitlab_ci/gitlab-ci/public|${DEST_DIR}/public|" \
lib/support/nginx/gitlab_ci || die "failed to filter nginx/gitlab_ci"
# 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"
# modify default database settings for MySQL
sed -i -E \
-e "s|/tmp/mysql.sock|/run/mysqld/mysqld.sock|" \
config/database.yml.mysql || die "failed to filter database.yml.mysql"
# rename config files
mv config/application.yml.example config/application.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/init.d
}
all_ruby_install() {
local dest=${DEST_DIR}
local conf=${CONF_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
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; 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}
fowners ${MY_USER}:${MY_USER} ${conf}/database.yml
fperms 640 ${conf}/database.yml
## RC script ##
local rcscript=gitlab-ci-unicorn.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "1. Configure your GitLab CI's settings in ${CONF_DIR}/application.yml."
elog
elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
elog " for \"production\" environment."
elog
elog "3. Adjust the webserver settings in ${CONF_DIR}/unicorn.rb"
elog
elog "4. Then you should create a database for your GitLab CI 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_ci PASSWORD 'gitlab_ci' \\"
elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
elog " createdb -E UTF-8 -O gitlab_ci gitlab_ci_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!"
}
pkg_config() {
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
local email_from="$(ryaml ${CONF_DIR}/application.yml production gitlab_ci email_from)"
local gitlab_ci_home="$(egethome ${MY_USER})"
# configure Git global settings
if [ ! -e "${gitlab_ci_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 CI'" \
|| 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
else
local update=false
einfo "Initializing database ..."
exec_rake setup
einfo "Setting up cron schedules ..."
exec_rake whenever -w
fi
if [ "${update}" = 'true' ]; then
ewarn
ewarn "This configuration script runs only common migration tasks."
ewarn "Please read guides on"
ewarn " https://gitlab.com/gitlab-org/gitlab-ci/tree/v${PV}/doc/update"
ewarn "for any additional migration tasks specific to your previous GitLab CI"
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 $@"
}

View File

@ -7,25 +7,8 @@ AUX gitlab-unicorn.service 917 SHA256 282c1b08ec13b8670018985278a25d013d6336ab23
AUX gitlab.conf 137 SHA256 e0cceea29f2c3e1f7c94a9ab37640a31d4966b106cc01f47fc77b5c721aa9489 SHA512 7d41510eb288e47676d1bf60e92cedd04ec07e1af12cfcfcb5b75d4eed5ee320f41d3369831f9a2361c570289b885f4f00cb365e418a0d66bee6a5a78060582d WHIRLPOOL 27ea7e1109ed34367664c0e4d7cc968d300e6e2bdc3a66f0eba87023a1659f14115cf25535f438f7947a19b1c51c1452d3bb23db120442ba3be20b310a87317f
AUX gitlabhq-7.13.1-fix-gemfile.patch 1478 SHA256 99050e17841670f03e9430e1f0409cb0194b49ef3235b90c13a4bd66a2648ad6 SHA512 9b0ef71867d4049970295f1ac015e3a4917a24c61edab3452f75f9652e21b94f3dd859247bb28622cd032fe33d4ebcec7b262488841540b48e387f11399c9a8b WHIRLPOOL 9db14e3339e1038dbaff9344f3472c6e23209fa6edbeca35c3108723fd39cb93420361ffdade21fc7019a1e873283524db6e38868ee247ca11a5814832083aa0
AUX gitlabhq-8.0.2-fix-gemfile.patch 1586 SHA256 c91945e0e639b1297519d7165a3aa03fe203a29cde1d195f277be6cba71c67e1 SHA512 6eb15935292902b3090e856e00a972ee2e442eadbf2e42fbde1e4727d75d65e0e06c6be54be8fcd7aeebb5e0616c8d5123f60ebabebd7e02531f0fbc7b03d760 WHIRLPOOL 985e86c5bcb1ea059b41f1f08d3528afd3ab31d71eb81df79a2b454a0e2fb24dbf08b4a1c9197e56864550842baa60599db631bbd2a3603caaea9b7d6743e3d1
AUX gitlabhq-fix-gemfile.patch 1456 SHA256 ad7deb355b74a156ef04c031ff45946a4852d273b30c4bae2be5b2cb11d0d683 SHA512 f0535f57338833f734701ab9c64a1a1dc9f7d6e7c634756c18e98bd5c6811876e2cbc7d64bd93297d5717d1d1e4f9213c7982c32770000698dc7a718a7b00155 WHIRLPOOL dfc2083e7c3c7895a01f4e1e588610f542a38a636ce9af1165b5c0fa4301fa91a6b58f24833ab9e754ea3024e48894b6b58ee9e3d2acec6cddcc1ecc515b097b
AUX gitlabhq-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60
DIST gitlabhq-7.11.4.tar.gz 5731377 SHA256 42e3326a44828bde722e344b85bea6b46cefa803feb754b4a0b50582480af5c8 SHA512 5a98a9bd0e102403a5d528d87b8e7aede114e37f32141a1bfe259e1efb4a7c63d57f18b32d290cc3631170619c06602e0e4252ba04045f25cc35e23ec66772ef WHIRLPOOL fbb6ff540bee4eb2d2985ff4dd58cfdb82689d58cde29e3bf233943b2c018ab0c1c4c902fb763c2f72d35bf0a1d0a13365e78995310aa23756f6d909f1ff711a
DIST gitlabhq-7.12.1.tar.gz 6095871 SHA256 ed14b4e81c548d0e56b2c872db76f3e9fa5a903a98a1ec80bcb580ba281b6a09 SHA512 6c4766e306c02367f5e03206b2febfd660464d1f55319d2fef9f6d29eae64237ff9d6a0c2891a8a9646bc479dc1704f60bbfbc66634475b88d766402c1c10c19 WHIRLPOOL 5c1e5d42ec2aa91eeafbe75d90b4c1a7b01221321e8b1cf8f08af656800237d3656b373703a7df117763ed639e7d90f659e41b40295f0a43f2ad8fc806b624f7
DIST gitlabhq-7.12.2.tar.gz 6096090 SHA256 270f0c5a03a1e7ddb7cf7556f2b13c81c1def54ef90f8919419ffa3fa0c95e05 SHA512 b1996a88e6aadfbfcaef21953db914667cfe59c090be6f6dc1b14c69e1afae2c23baae1e5af06fa2bd8a38ab86b225d7c931d1ae9c18def7e0eafe291c5e96a1 WHIRLPOOL f365922e9532e42d8553e7073ed226b4d177afe3ff9597cbd11b37615028b2e046b25fb41ed80ea0cdc086348accdb633c1f3aedb56908d2ba987b9af27f4b60
DIST gitlabhq-7.13.1.tar.gz 6364607 SHA256 ee1d57ae4daf78cd27603f9c53a20481b18cb6e0e2afad1cd73f91007d4f363d SHA512 8b2225344977b9804db54022546dc204da6ff3030253db3cc92a57ea041e916776f6de9fc99a36ebde909fd7063d0e97e6ac8377b6f957d0d67abe1481f431e2 WHIRLPOOL 3d43121c6091d95d07e07d45ba83aa3e16b0450408fae626c49543e353354687301a58603a1ffd279ab5897dbeac250457093bca9a9a787d3495ab47399a7ddd
DIST gitlabhq-7.13.2.tar.gz 6346829 SHA256 1f1b798dad393e6a6ba5497447af743b11c60866933c276304f5c3ce81795353 SHA512 58fbed4f32ff2351a90b42609cdb0907465456248e6ac39c25f1dda57fe6b0a39e42af46a973f03f1d36fbb5c62028cbe316627776bf0dc5892cfec432ada27b WHIRLPOOL 471e45674c15892233153f45da30177fa0791194524f7b10b2c0c135a5fe5895f6d89907be5a2292f38f218584b04bb7b570335d4db2319bd0c53357781b6ad3
DIST gitlabhq-7.13.4.tar.gz 6350001 SHA256 4d6c653d7f2535f909f5783511da54b57c8a3a79966dfd923d43119ccf9b1c4a SHA512 ec4fa8ab4e8e853d515253ac2482756e4ecc8d5727a64f1644c427153e7cba78ef8cdc2d9214329207976c6d62c76993938cf8d114754c93e609f435768c6f99 WHIRLPOOL 839ca10a2cd638490cd8090fb1f7c41ab8066f97ce7c8f1eafa1e60cb4a37734070bb5a636000ae43d775905df34ed36c7c8cb0902af335dc070c8e166ea3630
DIST gitlabhq-7.13.5.tar.gz 6350133 SHA256 d49e8812b84c3411fe5d246822e5c6fd3fd755e1605ef3a143daf4863ac56d61 SHA512 4df9969c0983ba069c242cf52d495abe5f6f687072c31922240cc046192f8b16a09b45249ffd7ea49bc601537d8f96c5ae6c7cc545f4a62ba1f75b92c9dae672 WHIRLPOOL 95a24c0e3525f052998b38f426348b5b23a9b9317ef2ee5cf193fcc96547047a30c29857af5bfcc9c067a4e936148924a31d64c37aeb0fb0f295e9e0bede6ed8
DIST gitlabhq-7.14.1.tar.gz 6393565 SHA256 a906fb35aaff415e0ca6ff053fecf6c97c0a9a2afc3a2da7b45b8bbb61aca75a SHA512 09912a4da7d64f0a6f26935e4ef73108908822ff0239fabbe36631f27389a02153ec4b116c0624336460971d5bd3f1e1c33214068e4513a86bd39cd29422ff70 WHIRLPOOL 9600dcad2d52a5494a44078dce46a00353134b8b727430ac264713489d982d4bb57d9e8a156cf86f3d297d8d6fe66f8aa3ea4d39e7b50b4a7f7ac3cadfcd62a0
DIST gitlabhq-7.14.3.tar.gz 6393535 SHA256 3814a3bdff9610b269be15b8cf35701fcdd78a5a80fb1b366269acc49b23f5e4 SHA512 f2088c151b424cbca0fbc65073c1198ea9c3619570ca3543cf5f0ddd193a6105941608df418eeb506bde83f2c0bbd34cea267caaed70092afcca54219e84004d WHIRLPOOL 70574a135eb426e93086502ad7a0d5b73e1070a19c529852fe2aa60c2081d27bbb4289340b73b469ecfd489779cc409bb56de263e47aaa07859ed0a14dd51f44
DIST gitlabhq-8.0.2.tar.gz 8238940 SHA256 e17a889f33c85b86744ea7be7cabb69feb340b82a4f01706360a985ceb6fd0f3 SHA512 901d0841075514af6e5f1a5a1064f81347769d024b1d0a5527de069ba29de1746ec3c27045529acd7fd993ad53ea65a08d24f3fc3fcbb2fafebc4b7c75490f97 WHIRLPOOL 19e9c1f4ea7e0106dea552bc875e2bfd1f518fe6aeefa6934772ebb29ba388eaad0715e36fa53f22fdc7e90203eea380ae62fc0dc8b7ce999efb2ee05d0cc63b
EBUILD gitlabhq-7.11.4.ebuild 11217 SHA256 7c477ab21bc72ba0ebd9f2279cb168b30756b171ac5b0469c6225d7fb46f86ef SHA512 502c220cbb551d6fa66ce773ace9e4d7ef3f4a70bcd79bfbd535ccfa1845571b3d1ee8fd60dca086c24f58f573bda4ffd91583896d25dbd592f598a7cde182e5 WHIRLPOOL f35ae007f5c12521d983f18847182ce097af595052c7598e4667b2606c901cab46fe46e13b5e2c7bd83960dd9538c4753ffbb1bde71ec60230d98cf9a3423f63
EBUILD gitlabhq-7.12.1.ebuild 10845 SHA256 0d70e40a3ba00e3d073ba5c0c0af3ad29b6a2acb0304406fc05ee80ee7783333 SHA512 6fccf6a9cb8047896d97153e2e64da6200f3cbb7ba9428eae11a2b8c0b05bc3c97363c3c306a649528c56efabfdc1771ab3b5daee840da5c1b7a522697f9b243 WHIRLPOOL 0b4088bcd4fe62ff84ff159a34560e49b761c060ad60da9726e7261f8a88ff0336f0403fb160a995254c64322fb40b35ab5378d593f6a15f89e45c10a6645984
EBUILD gitlabhq-7.12.2.ebuild 10845 SHA256 0d70e40a3ba00e3d073ba5c0c0af3ad29b6a2acb0304406fc05ee80ee7783333 SHA512 6fccf6a9cb8047896d97153e2e64da6200f3cbb7ba9428eae11a2b8c0b05bc3c97363c3c306a649528c56efabfdc1771ab3b5daee840da5c1b7a522697f9b243 WHIRLPOOL 0b4088bcd4fe62ff84ff159a34560e49b761c060ad60da9726e7261f8a88ff0336f0403fb160a995254c64322fb40b35ab5378d593f6a15f89e45c10a6645984
EBUILD gitlabhq-7.13.1.ebuild 10844 SHA256 8abfb869da634a1741bc913f9a62067f4d5571cc1a151b71c0069d4ead2eae9e SHA512 6b47cb1a07ef72eadfab9d934c877b8088b08a5d1441bcd46ba03d12e4bdc143eb188cab8816a84bd2d4b50244a34f34697f7a6fda6f3bbfe0f0eae6f7c2df07 WHIRLPOOL bc641956ca056e0df56033e372b63f935319af35576008212895830e6d634b307ce9ee085db3e163c5cb9bb8c0c3441ede028f0360e73b7ba0d0938a2f525b99
EBUILD gitlabhq-7.13.2.ebuild 10852 SHA256 03c4884a314b7bc4e50959ebdc04e844a845477e01bfae59a96c1c21a12bed43 SHA512 c19fd85ae870961620c592a3138997f08cc97f346b7d528820d735df4430dea04baca58bfbb5522c6a880bb7a4b05b60e82e2dd9f6ec40d8562a036d34a323a5 WHIRLPOOL 93b8600cb228e429831fb3c61d57dba204605b02f9048b7b89158268abe146e56b9185cd911c1ba9422214495e89eea39eadab1a8a97dce657ba9221352e23a2
EBUILD gitlabhq-7.13.4.ebuild 11040 SHA256 7c92176dfe88c544de7f9ffa2fb4ca848ff567a55feee25e70c1a267c00f51d8 SHA512 62cf7b697be431e09f1c4e3e0df3f31be1dab098a508f1cce295cf814143baaf39d240039d7db0370d7e74f5388066abd25b6d4ca5e9976daa25fbcc5f95fc6d WHIRLPOOL 561406c358fb868bed26a989915a6bd6987a318f23e5d5ec06e9ed6d920b7a796819290bdfeb4608394afc21d10c28176c7754bcf19692933ba22a845287b86a
EBUILD gitlabhq-7.13.5.ebuild 11040 SHA256 7c92176dfe88c544de7f9ffa2fb4ca848ff567a55feee25e70c1a267c00f51d8 SHA512 62cf7b697be431e09f1c4e3e0df3f31be1dab098a508f1cce295cf814143baaf39d240039d7db0370d7e74f5388066abd25b6d4ca5e9976daa25fbcc5f95fc6d WHIRLPOOL 561406c358fb868bed26a989915a6bd6987a318f23e5d5ec06e9ed6d920b7a796819290bdfeb4608394afc21d10c28176c7754bcf19692933ba22a845287b86a
EBUILD gitlabhq-7.14.1.ebuild 11048 SHA256 920c664266dd9374f5dc9d64c91b97a2b83b2266f3f0e6bdcd5f857216dd10c3 SHA512 cae87189e3aa3689885df98a5f63e1001f4d11d8bdd934a70a9733e2ff1c17febd45175417c54c341b115abda8a36f97f34acb3eaf700aa8348812915ab609fb WHIRLPOOL 8211cdb92cf1e4696baa6292220ebac0f094440516bf865d2df9da842c06afae12a84eb7f693310ea8ade74b976398c853a0bf8b8f40c336e8afa9efe5e7d22f
EBUILD gitlabhq-7.14.3.ebuild 11046 SHA256 f9af41cfd01aaa0312323a6da4dea126f1bd0c7e88aee4e143c541829eb6fdbc SHA512 dd5d4a4495f46edf66b33126659dbf4c11da7274a069a02227f1404cbc7e07f2c7bd48dc019b3c3d7239e29000204be3fba57b27d27c7b06d84cbb16ef0e1ad2 WHIRLPOOL 1ce529cf76c7b712789c6c67619afc79e8ad0f99ac9354c3428733578fdc9842c75963a73803530c22634e8c1eb5267b24f7251133c82087d397a77e9eac3edf
EBUILD gitlabhq-8.0.2.ebuild 11066 SHA256 cf03c063dfc12e120a960fb22201c4593341152b2a6df3c97dff29567a250c48 SHA512 c015f35603cf8401db46f638dc583c869a21e9cfe4c076fa1c43871b2fcdf0fb2c3ce08883461d4020062e5ee88ad737d178120c2a3c6cfc5367ad1ffa719818 WHIRLPOOL 6a20a1d9f2389d0b4b0710d536dcd3053a19f8165fbe8215202114d89e026640c021737a06496a13023b21aa741a5164da5cffa6d5df47d767eb4446aaa69365

View File

@ -1,57 +0,0 @@
diff --git a/Gemfile b/Gemfile
index f697f09..d557a18 100644
--- a/Gemfile
+++ b/Gemfile
@@ -168,6 +168,10 @@ gem "underscore-rails", "~> 1.4.4"
# Sanitize user input
gem "sanitize", '~> 2.0'
+# The newer revision of charlock_holmes that is finally fixed to
+# be compatible with Gentoo
+gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
+
# Protect against bruteforcing
gem "rack-attack"
@@ -177,9 +181,6 @@ gem 'ace-rails-ap'
# Keyboard shortcuts
gem 'mousetrap-rails'
-# Detect and convert string character encoding
-gem 'charlock_holmes'
-
gem "sass-rails", '~> 4.0.2'
gem "coffee-rails"
gem "uglifier"
diff --git a/Gemfile.lock b/Gemfile.lock
index c38daf6..067fc86 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,10 @@
+GIT
+ remote: https://github.com/brianmario/charlock_holmes.git
+ revision: dde194609b3513b0d2369ce8f916ae52566154b4
+ ref: dde194609b3513b0d2369ce8f916ae52566154b4
+ specs:
+ charlock_holmes (0.6.9.4)
+
GEM
remote: https://rubygems.org/
specs:
@@ -91,7 +98,6 @@ GEM
json (>= 1.7)
celluloid (0.16.0)
timers (~> 4.0.0)
- charlock_holmes (0.6.9.4)
cliver (0.3.2)
coderay (1.1.0)
coercible (1.0.0)
@@ -672,7 +678,7 @@ DEPENDENCIES
cal-heatmap-rails (~> 0.0.1)
capybara (~> 2.2.1)
carrierwave
- charlock_holmes
+ charlock_holmes!
coffee-rails
colored
coveralls

View File

@ -1,371 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
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.6.3
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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,system_hook,project_web_hook,gitlab_shell,common,default"
all_ruby_prepare() {
ewarn "Please note: This version of the Gitlab ebuild is unslotted, unlike older"
ewarn "versions (<7.8.4). Therefore, some directories have changed. Please update"
ewarn "your configuration accordingly. The changed directories as as follows:"
ewarn "- /etc/gitlab-6 -> /etc/gitlab"
ewarn "- /opt/gitlab-6 -> /opt/gitlab"
ewarn "If you feel uncomfortable with this change, please abort the build now."
sleep 5
# 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:).*|\1 /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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,363 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.3
dev-vcs/git
kerberos? ( !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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,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:).*|\1 /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 kerberos; 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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,363 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.3
dev-vcs/git
kerberos? ( !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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,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:).*|\1 /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 kerberos; 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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,363 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.3
dev-vcs/git
kerberos? ( !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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${P}-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,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:).*|\1 /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 kerberos; 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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,363 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.3
dev-vcs/git
kerberos? ( !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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-7.13.1-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,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:).*|\1 /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 kerberos; 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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,366 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos mysql +postgres +unicorn systemd rugged_use_system_libraries"
## 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.3
dev-vcs/git
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser =dev-libs/libgit2-0.22* )"
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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-7.13.1-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,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:).*|\1 /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 kerberos; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,366 +0,0 @@
# 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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos mysql +postgres +unicorn systemd rugged_use_system_libraries"
## 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.3
dev-vcs/git
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser =dev-libs/libgit2-0.22* )"
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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-7.13.1-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,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:).*|\1 /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 kerberos; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}

View File

@ -1,366 +0,0 @@
# 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="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"
#SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v7.11.0.rc2.tar.gz -> ${P}.tar.gz"
#RUBY_S="${PN}-7.11.0"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kerberos mysql +postgres +unicorn systemd rugged_use_system_libraries"
## 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 )
kerberos? ( virtual/krb5 )
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.4
dev-vcs/git
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser =dev-libs/libgit2-0.22* )"
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-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${PN}-7.13.1-fix-gemfile.patch"
"${PN}-fix-sendmail-config.patch"
)
MY_NAME="gitlab"
MY_USER="git" # should be same as in gitlab-shell
DEST_DIR="/opt/${MY_NAME}"
CONF_DIR="/etc/${MY_NAME}"
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,archive_repo,system_hook,project_web_hook,gitlab_shell,incoming_email,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:).*|\1 /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 kerberos; do
without+="$(use $flag || echo ' '$flag)"
done
local bundle_args="--deployment ${without:+--without ${without}}"
use "rugged_use_system_libraries" && export RUGGED_USE_SYSTEM_LIBRARIES="YES"
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_dounit "${FILESDIR}/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.init
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-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}"
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 $@"
}