added preliminary ebuild for www-apps/gitlab-ce-8.3.2

This commit is contained in:
Manuel Friedli 2015-12-29 23:34:48 +01:00
parent e0230d6b9d
commit e4c0eec423
2 changed files with 372 additions and 0 deletions

View File

@ -18,9 +18,11 @@ DIST gitlab-ce-7.14.3.tar.gz 6393535 SHA256 3814a3bdff9610b269be15b8cf35701fcdd7
DIST gitlab-ce-8.0.5.tar.gz 8238566 SHA256 476185a191bfe8757ca1a981419ff5d31449136e76029daa77e89086539d30c6 SHA512 af9d11f0ed744d0c92c9329ba94fe51534996f18dbb2c110d70912cd3ce9e60c3a127b7c8597c95b010b0e2251f98aabdddc314ddae53ab26a44c19b4ba7a7d7 WHIRLPOOL 6e4bc8c43cbfe215efd21a87a5d0395abde4f9998564fc0295d946ffa6a7021d2b5bc2ea625482fb400088bcc57431b3969a6c9dfa0f2121420356d153d297f0
DIST gitlab-ce-8.1.4.tar.gz 8761954 SHA256 619ac3b8c83ac2e3dfa81054b5ae0e76ae81497cf38587410504d6a603181897 SHA512 3973af3480f7e52dc64aec2ef99ff13cac9296fbbc76bfb59387416ee683099109fce361cd1619b4d3fa55032f7e1029b272e07cd15e0b6e353ac6f6c730f2bd WHIRLPOOL d3ce2dfaf013dbd99b023cf9d7ab3494d54d8628093761dd7b9cfe522ac8fb2c00a53d4534843dc292fa38ca1200f2dbe2c376efbd1c40e6e0ca1f9a31762936
DIST gitlab-ce-8.2.3.tar.gz 9961014 SHA256 470c10f267ad904ebd6228ccc5007092ab0fdc521277cc6f96ac98959a2b35c2 SHA512 77be97245a266536e1065e689b1e3183cda8b1800553a47f32c6e01d740537831898ec2ed86c9626a57c03e507e9d5d108afb5af0aba3623873973b71c842d7f WHIRLPOOL 44dcfeb1e5dc619e7e78fb7328e50bb3a4b0ac03b1ddbb1fa616e1c79491ce610def90c7bf0d1be541ae63870adc622765ce329e5ddbddafb103a810acdf45f5
DIST gitlab-ce-8.3.2.tar.gz 10683322 SHA256 87f6c27043058bba2d879c079f36a81f09f77c8e359ff7cf3bb0f5ebc4dca73e SHA512 a4d05cef4edcdd3ea07858eb52f1fa093a323d6586bcab9e5e2bd78320e56566c496146a89ed24410a551fa5d770a44b018636c11f55eae325cd6ec13de94f77 WHIRLPOOL 2bf74671e58d9f625c385ce2bcd8909bed828108deea17fd4bdbea7bf9d365dda14d1422699582a818fb656ab43cdea7f841c2334de152070dd2acac2f195e05
EBUILD gitlab-ce-7.14.3.ebuild 10996 SHA256 a632476e8fe87ec1a478d2229f9e27cbe9e7cc86351e411d9f15105178a4c69f SHA512 a8646de0798d7dae299e500e0a42e6b093e229cb666614b895b979decb1d4b6b398ec2b2f1d19e07cc115f2acb16536426d1769b65412bc51349ac1b262b3053 WHIRLPOOL 2ba4e53846507899b3e6ebb38063e11ee92904262b8a6e00817ab50d6634ed0f0b1013f4a0d8a1cbb26e18c4008e5ab457d3cbd0fdc5f92e5c6214cb45c692f5
EBUILD gitlab-ce-8.0.5.ebuild 11185 SHA256 1240818953ae8f61b6c88c91c3c1dd32fb7d03c8a62964f5d3ad2e98ff5dad11 SHA512 fd411dd3cd8a4dd1ee0040438fe5da01f81ccf4f97b7b7b3157fcbb35bfacbfd0eda8754fb01e0061e6b0c5bd0e752b0eaff4d663d11b764623e7baafb4f56da WHIRLPOOL 9514cd8f83c7fbaba82b49352cb9b8e62d1a5317a09bfea85ce945abd1402e634a88f6eb033494729519ac6fc1282c18bfc8224b9bbe6f41ac89a1286b1d5d0a
EBUILD gitlab-ce-8.1.4.ebuild 11177 SHA256 6b920132ff2c4926f2ed3edb3fff7cdf3e88c0314f8a0a9c077cdaae9fad4a0e SHA512 617656f6fd52d0c4751e0726983fc7d2c1532e8bc44761dbbe5bfb7f489e18ef66a68769bb0f7736c9d49d536e8103a5486e92869a9bba4d1aa92c4068eedf6e WHIRLPOOL 1c8a0968a1fa7b95ceb47f66610a72585666cc5b2f7f3157d1f5c04f98a2c89d79ac1875a28c57b3116105d2e0af17dabcecaa00159af42166565ae7fa88647e
EBUILD gitlab-ce-8.2.3.ebuild 11149 SHA256 b9ea26478efe2bb798334178589f94c014550360bcce109af55cf9e9431519f1 SHA512 8cb298285f338c2f45a6b2048d597067ecdb51f3c70ab4c893810029b4773a20b7f058c4262019ae9f88cef5cbaf993726b653d5e214005495acb064bc00d83c WHIRLPOOL bbcfa2b53863fe887b2eaf62d1495463f1590eb5f04856dddb2d95f28a9cec377d29eeac04bb90eeaf8be657a7a71c73edac8ee5fc123f905b694aa2a50aeba9
EBUILD gitlab-ce-8.3.2.ebuild 11149 SHA256 1d9041119df27291c6178f3b1cb1a741e2acc2848ec6b2425d6bd79a00fe2328 SHA512 e9e4ec9a83c53dbf84ce577d3edc2ff8c2455eddf1e36bddc3c2f138b9de9382addc5c108a4ef440438f32d120be3fb8aceca6ce9da93661b18bb5deaf4fed00 WHIRLPOOL 76e801ed52e6fdaec63e0962fdfcd54c2a404a9142ded2aab50e16d1876d1d891ce606cb365d25c4e923f0cc08bbca527fc5812a127b8dac62df536f400a847a
EBUILD gitlab-ce-9999.ebuild 10960 SHA256 9d771927fc3fb9e0227bf909eeb1c3376f05c5a9bbf2571dc214535321436cde SHA512 209d42d491e6ed180773ca6b7252ab3aeb0eb103b9ea935e6e23d79e7e132e1485936db0aa9336104fc3bbb94c73b740080c81967523b0c28dbcc0f14e0abbee WHIRLPOOL b7b9fc3112965cd40c12039f73cb8d9e6bfaeae17c1022e5d3838c599e76f83c31882c9676a83b379dca474f142f1e2ffa9443259e0fc1a761b48f0b4e0ba350
MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1

View File

@ -0,0 +1,370 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
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"
inherit eutils ruby-ng user systemd
MY_PKGNAME="gitlabhq"
DESCRIPTION="GitLab is a free project and repository management application"
HOMEPAGE="https://about.gitlab.com/"
SRC_URI="https://github.com/${MY_PKGNAME}/${MY_PKGNAME}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RUBY_S="${MY_PKGNAME}-${PV}"
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/ragel
net-libs/nodejs
postgres? ( >=dev-db/postgresql-9.1:* )
mysql? ( virtual/mysql )
kerberos? ( virtual/krb5 )"
CDEPEND="
dev-util/cmake
virtual/pkgconfig"
DEPEND="${GEMS_DEPEND}
>=dev-vcs/gitlab-shell-2.6.9
dev-vcs/git
~dev-vcs/gitlab-workhorse-0.5.1
kerberos? ( !app-crypt/heimdal )
rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/23 )"
RDEPEND="${DEPEND}
dev-db/redis
virtual/mta
systemd? ( sys-apps/systemd:0= )"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
# fix-sendmail-config:
# Fix default settings to work with ssmtp that doesn't know '-t' argument.
#
RUBY_PATCHES=(
"${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,runner,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}
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
rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git
# 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_dounit "${FILESDIR}/gitlab-workhorse.service"
systemd_dounit "${FILESDIR}/gitlab-mailroom.service"
systemd_dotmpfilesd "${FILESDIR}/gitlab.conf"
else
local rcscript=gitlab-sidekiq-8.2.init
use unicorn && rcscript=gitlab-unicorn-8.2.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 "If this is an update from a previous version, stop your GitLab"
elog "instance and issue the following command to perform all required"
elog "migrations:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
elog "PLEASE NOTE: It's HIGHLY recommended to backup your database"
elog "before running the config phase!"
elog
elog "If this was a fresh install, follow these steps:"
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 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 $@"
}