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

Feature/gitlab 7.13

Add ebuilds for gitlab{hq,-ci}-7.13.1

See merge request !9
This commit is contained in:
Manuel Friedli 2015-07-23 21:26:39 +02:00
commit f7d38a1a42
5 changed files with 733 additions and 0 deletions

View File

@ -2,6 +2,8 @@ AUX gitlab-ci-unicorn.init 1700 SHA256 ad75c1774db69d2ceae61983ba7227bb840c761d6
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
EBUILD gitlab-ci-7.11.4.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
EBUILD gitlab-ci-7.12.1.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
EBUILD gitlab-ci-7.12.2.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db
EBUILD gitlab-ci-7.13.1.ebuild 8562 SHA256 f0fc6135840cd45cbd6ba5857d9294e4b2f95c9a382e22845033ce295849f087 SHA512 b0068f74167831b05c2d2bd963d3c6c544cf602790c0525b7e04e03f2e1daea37e34bdc4394b8a20fd74601494a25ec197b2fcad514c72df58b2f52bbcc5e11b WHIRLPOOL ec0dbd54ece559cc919a8917d00d740af2caeb0b4b75cf77549fc62fd17e05e95d765cf78e9f08eaeeeff5b2f55935f67e167505effb6280d90fc8c4a97aa1db

View File

@ -0,0 +1,309 @@
# 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-base
# mysql virtual/mysql
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt
postgres? ( dev-db/postgresql-base )
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

@ -3,11 +3,14 @@ AUX gitlab-sidekiq.service 1192 SHA256 3d1bdb5e653448a46ff2530321090ac5c8897121f
AUX gitlab-unicorn.init 1657 SHA256 5fe794938b27d25488affc174e4761f5a3a1f9b15489a05f3839b13e4fd5b5ef SHA512 5e005ec26151afb4cdc8eb83592fad6814bb2a3ac8e9f642de83e70cd8615bdf969803a2479f8f72a70e0ae5ab5559da205965b55b3b4cdfdc9aa74055eef6fe WHIRLPOOL 6c61db597311ac618822fb22d7f51c830e5c011ce8e4c790338b3203a4483f3dd121bbd9cc33d7e1f92a2b0527e59816742f8ef0fd531c4c28c36d886fc94196
AUX gitlab-unicorn.service 917 SHA256 282c1b08ec13b8670018985278a25d013d6336ab23b0ee815cb36b34ba678391 SHA512 6288c7c096fb38976c5b6218e46b7da53dfea73e834d1902876d0b15e1173fc56600c511e5941c2f6f61e2f5ef50a7cca476ee14a19b516599d6eb0594e2b8e7 WHIRLPOOL 33de53ae81af49d02d8e8a4e2e741bbccfa5e657939f433515ee7fe81aa55a706e094062ebcb67b7dbf19d21bd37070f4294e095cd955c2f94dc2c3842a008d5
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-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
EBUILD gitlabhq-7.11.4.ebuild 11204 SHA256 628ea499dbe687ff9d086139a3f9df78551926507fa592c255d8b777de5b1a80 SHA512 89eec325b45024c95794ccae2d7498754d894d1d514c064dc41e1b757a96141f6489c7f394c54112604e53c21df5b178246f28eb3afccc15b5fbdc06fb691ca1 WHIRLPOOL 263f97a5f992a21b6dc64182cceb8598339406e8a8ada4954729989716ea80a47618e4596c58c3d34f9f9e86b3ec0de19047f3b249a8f59b29eca1370057a0a5
EBUILD gitlabhq-7.12.1.ebuild 10832 SHA256 e0528cb58c30189ccb6de155ea6812ec5166f2361dba25c105681ca111c9d9c5 SHA512 36cdc8aabe4fe25cd68d9138598ec0e3f6cca8a6d6d82981a645419abfa729c1b88afd7377dbbff97eebd1686cd9aac280113227516734b882ccd6fb54d9da7e WHIRLPOOL 7c0446ec2c0f08596d4182e41f895a160ebef3151a39d17d81c68e4cb18ab65b0aba84b972df8f4378f29db4c381151485270ad2c158cd8270154feb08968eda
EBUILD gitlabhq-7.12.2.ebuild 10832 SHA256 e0528cb58c30189ccb6de155ea6812ec5166f2361dba25c105681ca111c9d9c5 SHA512 36cdc8aabe4fe25cd68d9138598ec0e3f6cca8a6d6d82981a645419abfa729c1b88afd7377dbbff97eebd1686cd9aac280113227516734b882ccd6fb54d9da7e WHIRLPOOL 7c0446ec2c0f08596d4182e41f895a160ebef3151a39d17d81c68e4cb18ab65b0aba84b972df8f4378f29db4c381151485270ad2c158cd8270154feb08968eda
EBUILD gitlabhq-7.13.1.ebuild 10831 SHA256 c6ab27d9a22e3648161b11d722940abd44729ad051eefd59894c01d55aece8a5 SHA512 3b8800099bea40594d048fb99f5ff8bb261814d744497c49af45382eb2e812a1c7c647e97f02ecf61f953245345abb9318f0489a2a1a3be70cbec42c6838ef49 WHIRLPOOL aad3e5547a634ae2da8ef290719f1a3e069f49d3074f72ea291bd341131c7c4fdc5dc96e8c98c266678f291327a199f79ac884b1a3f6171a1684c21e0a4d3011

View File

@ -0,0 +1,56 @@
diff --git a/Gemfile b/Gemfile
index 9b7fd18..2bcdb94 100644
--- a/Gemfile
+++ b/Gemfile
@@ -173,6 +173,9 @@ 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", '~> 4.3.0'
@@ -182,9 +185,6 @@ gem 'ace-rails-ap'
# Keyboard shortcuts
gem 'mousetrap-rails'
-# Detect and convert string character encoding
-gem 'charlock_holmes'
-
gem "sass-rails", '~> 4.0.5'
gem "coffee-rails"
gem "uglifier"
diff --git a/Gemfile.lock b/Gemfile.lock
index 6e57107..5656ef9 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:
@@ -97,7 +104,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)
@@ -756,7 +762,7 @@ DEPENDENCIES
capybara (~> 2.4.0)
capybara-screenshot (~> 1.0.0)
carrierwave
- charlock_holmes
+ charlock_holmes!
coffee-rails
colored
coveralls (~> 0.8.2)

View File

@ -0,0 +1,363 @@
# 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,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 $@"
}