From aa44b088425b2fea63fe4d7b5261fd3532e6180d Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Mon, 14 Sep 2015 10:29:23 +0200 Subject: [PATCH] added ebuilds for gitlab{hq,-ci}-7.14.3 --- www-apps/gitlab-ci/Manifest | 2 + www-apps/gitlab-ci/gitlab-ci-7.14.3.ebuild | 309 +++++++++++++++++ www-apps/gitlabhq/Manifest | 2 + www-apps/gitlabhq/gitlabhq-7.14.3.ebuild | 366 +++++++++++++++++++++ 4 files changed, 679 insertions(+) create mode 100644 www-apps/gitlab-ci/gitlab-ci-7.14.3.ebuild create mode 100644 www-apps/gitlabhq/gitlabhq-7.14.3.ebuild diff --git a/www-apps/gitlab-ci/Manifest b/www-apps/gitlab-ci/Manifest index b75a68c..38bc4cb 100644 --- a/www-apps/gitlab-ci/Manifest +++ b/www-apps/gitlab-ci/Manifest @@ -7,6 +7,7 @@ DIST gitlab-ci-7.13.2.tar.gz 754524 SHA256 769521038aec08f9cffb87381e83a46c02d24 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 @@ -15,3 +16,4 @@ EBUILD gitlab-ci-7.13.2.ebuild 8552 SHA256 5a398564d49986ca891a6c3f62cfc08d31b4b 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 +EBUILD gitlab-ci-7.14.3.ebuild 8540 SHA256 82d924f02abdbd68a2b4bafc0b82232ebad5303bb9a9259ec2df70da662a9e40 SHA512 3a9fb89fde76f4e839cfbd23bff299a66d87ecd8e7943f87e4c69e1d25b9679a0fa7feae77264b9d0d5b1f39a529d208fa0d438d7f317b64f1a8b9b509e3e0da WHIRLPOOL 8c985119732f266ab75b901755d2c7f4f3d659767a840487b97fa25f084a136fe287540c0e4a3c19be90e0225561753da6f3979d24d47ca61e74f4ed8f36a67e diff --git a/www-apps/gitlab-ci/gitlab-ci-7.14.3.ebuild b/www-apps/gitlab-ci/gitlab-ci-7.14.3.ebuild new file mode 100644 index 0000000..f8be13b --- /dev/null +++ b/www-apps/gitlab-ci/gitlab-ci-7.14.3.ebuild @@ -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="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 $@" +} diff --git a/www-apps/gitlabhq/Manifest b/www-apps/gitlabhq/Manifest index b2d6c6f..690c38b 100644 --- a/www-apps/gitlabhq/Manifest +++ b/www-apps/gitlabhq/Manifest @@ -14,6 +14,7 @@ DIST gitlabhq-7.13.2.tar.gz 6346829 SHA256 1f1b798dad393e6a6ba5497447af743b11c60 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 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 @@ -22,3 +23,4 @@ EBUILD gitlabhq-7.13.2.ebuild 10852 SHA256 03c4884a314b7bc4e50959ebdc04e844a8454 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 db1848ee02dd3abf7d5824321077c748e5e2627c4803904e996cbfc65191ee35 SHA512 f864f7fe02691a2d2e4fe43600dfd8da73a8059e2666d080ef106ff5079dddb55547929a0623fb93ef17ebf181ff1e72c6b0d2e40cbec1f34bbf34f222c49f39 WHIRLPOOL d2d8fa3321ef5e211835a8870a23255e361fb09f43f7f7339afe9c93c9fda328e31a953117ebc8247f37f86e37cc26efcdfa9ad7ceb321a4e05543c2d04bc412 diff --git a/www-apps/gitlabhq/gitlabhq-7.14.3.ebuild b/www-apps/gitlabhq/gitlabhq-7.14.3.ebuild new file mode 100644 index 0000000..0d06e83 --- /dev/null +++ b/www-apps/gitlabhq/gitlabhq-7.14.3.ebuild @@ -0,0 +1,366 @@ +# 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 $@" +}