diff --git a/dev-vcs/gitlab-workhorse/Manifest b/dev-vcs/gitlab-workhorse/Manifest index 21946e4..17afb2d 100644 --- a/dev-vcs/gitlab-workhorse/Manifest +++ b/dev-vcs/gitlab-workhorse/Manifest @@ -1,9 +1,12 @@ AUX fix-Makefile-0.4.2.patch 508 SHA256 970bb7ce34fd846902ad83394e929f7162d3c33ddf8307f0538e1f3fb9d1b59f SHA512 77ef8cd1781a1dcd86483ec53db72ad31ea00556c96831f6f4af39c010a4075b503cf5c6a62c787139f92ab651f9a8fefecb8bdab6da38f9a139f89e96c15c86 WHIRLPOOL 33ee8956a2497f7a324f6970e3a8ec83ced3a2364593ce1272cc665c761f2d83a2ab6b73062a333216acb9d345108672181323c3228d94fd1630c29ef4c533e3 AUX fix-Makefile-0.5.1.patch 508 SHA256 f63fe5302487d698212b52984f3f51efb3a6768558ae8927044c6a84f1814bc0 SHA512 27916751eda48b5cf4b8a3d650c74ca5031462fec14648a7535def6ebd321d49e1104b84f916109b5fdccdd90f9ee42fdbec587e3ee52f9c649fb49caac283e6 WHIRLPOOL 6f04c95575233eadd8b5f4d3e0ce564591d12e279d9827383292296d118dfc8670e239e2aaa74a3c132cc205b4d6214cb54edc983a5d2270dc005720955c805a +AUX fix-Makefile-0.5.4.patch 508 SHA256 3d0eefeafabef0043d9952ba03890fe241cecdbe20354827e187778cf65aea60 SHA512 16c2ae7f5117590bb4f794ac9aa85aa6e66c2edb01219f339d6db8dc91871bf6331e81bec93ce51d0aee5b5e6ef487d3d33a7f33901aafb036035da2444b9bf2 WHIRLPOOL ed054321aba5c546bda4f15750373546fa0ff9b951ee6d901bb7d73d69b3a933583d5897c2ef397348655a3fe6c0e3d4106e645d3ae2cc9e4348b316df82168f AUX gitlab-workhorse.conf 248 SHA256 6d11d63aa869cfd8c6f77c3a875984c226db633be899ad7ce97fafe94236eee7 SHA512 234213c8361702bdfeea40bd306b5899de19f34ce985e090a86e01aa601cf4ed23da4dfb75f74fe5986bbea5535a7a6a745406b4f67f79d352bd1c863777c7f1 WHIRLPOOL 8ac1134cde3aee942466d206e703ebd5330f83537d7e29641447f812d857bcc57b07fbf82eab086c0d622750694f64fabf8ffca2ba26a725f61b40fd1941e963 AUX gitlab-workhorse.init 653 SHA256 f38c37ed818cb8c25fb800bfcb5448f659e876b78ea33ea7a1ba3c80e73ea95e SHA512 2667997def39e6dc17e6a1d9be06d6e855d5d3e956e64d93bb3e74bbad0a1d427dc034f9c139f3b05e2666abab014404b2c8013c5347f4ec25fbf5ef86e7e88e WHIRLPOOL 63cd7ff80d88676b44c2d6ccdadf74907d5f8e4268f03ee11775c423bf95955f9d3aaeedd79fa6e0486b2d225336eb2ffa165dd7b9ac87ed0c2d403dc7e5afb4 DIST gitlab-workhorse-0.4.2.tar.bz2 14206 SHA256 09bd196334c2cde6e86a905df23ad904aaea7f01915b23c7e36cbff40fd0e14d SHA512 dcd2081786729ebcdd19aa1b5763a3ab4cf3e834ba0198827e354f610cbd338367229c2a57576413a3b18ab09a5fb1467eb0c9fe825830269a8990b662bce01a WHIRLPOOL 749803ad942e58e6dcf55dc4dcddf788591af7fe56729c946991e38c70f54aac65b3ba282e9a0106c9e717213ba70ba9c754257aee6bc5fedb3471eb333db4d6 DIST gitlab-workhorse-0.5.1.tar.bz2 18396 SHA256 fe5170da871cb48136f35f90963242fe64871185cbf3fcf13129a7f98ff1fc97 SHA512 5d46b047f2aeb7cf174bc3cd5d13e9d6595ddfb2cd80fa174733e3948903552995c4b6ebc2da27a24f50bbb00bf7da44a12b71acb49d90abfe245d2f59a6a3e6 WHIRLPOOL 43ee51fe5db55f1459c0e45ab867cb78f055f811be515af2ba272915df0cd894b899ab9ef9b11e8a53803c1156739d3057fb8d09b9bc3cf36973728dd4a44c8a +DIST gitlab-workhorse-0.5.4.tar.bz2 19488 SHA256 aae86bff51ab421a2e529c45c5d3f9223d2ebc23b9a6326416dac9998185488e SHA512 ba555f6aff07826281991cbb66bd2b1f4b92cf3ecb02a6e9f12120e01cd7846eb33eebef3f7fc2e7a531cd498f576d9f2e4529358e0d88b11103f0cd22208d40 WHIRLPOOL 1bbec15e69c674f1fa9205ea74cb8555ff97b3d71dad2815389d8953cc7cfdfdda61bd2e5b36ed871ded913b834546571ab12fee883bfc0f39878d68f84a5135 EBUILD gitlab-workhorse-0.4.2.ebuild 866 SHA256 b4377c171ea120bd743f5f7edd222d45260d6fbc290cb263f2e72944335033ce SHA512 24d2c0cb6b71723e8f6349db1b7a501e77a428455506273dd840f715beaf2cb057da0807677a01cde18e4fe3cf98ed7823e83b88a4f4b7711723eef7eaebe20b WHIRLPOOL ec42a052573f4654f808ad7ecffef8f67eb25599127223cf3690cf3e4156f197fac511c4540412394645186ee45a7f4ffee71aeb1803522d57daaa823217d878 EBUILD gitlab-workhorse-0.5.1.ebuild 866 SHA256 188539bf1d1f156a37f5044058508e9140f80e648fccdba3c438307a73f14fb9 SHA512 6f8dd6210a522a87e72795ea6b78d4b6a825b8ba6c610c30e04676980ffe49db5e5199d780284ff778e7ba75a633406c95762f16d55b5c15e8d881a3ad8ba567 WHIRLPOOL f713e415daaa8d654b334ed6d991446b6d600192867d6f93e02f9196d1c5454abce92022668ab49e2cc1f084c79da43a6b65d120cec6e627a7dc6f5eaccda651 +EBUILD gitlab-workhorse-0.5.4.ebuild 866 SHA256 93c056d8226ecd39b57a00e3df876204675b9f0baf3593a2ad9fbe09156a5f81 SHA512 aeb2b5537e0901418554532ef810597aa40b56aa5755b9d7d38d49c3f30f2ed6c1b59b3ae82c97eda4711c76e113245270f556a58f883a6a9aa5d966d0ed429f WHIRLPOOL 9a20dbc894930bcb10f0dc1cce940fd097ac44929ab1c98dbe46ed57c9b319c761306383a642b094cd84d17737a9433d5775c066344190d45bc18554a6f07f47 MISC metadata.xml 234 SHA256 f35b97f99a26d73cc441e1d93bfe25aaa4e9f7f6d90c8d05a74f7b7bc5b68472 SHA512 59d8156b3ca3e99c40d5a2a32de7edf2eb53279b2424998862589d6bad77617d23fc852afec0a92f8ac5bb54a88ebc504cc0641029c1936412e90ab03dfdd447 WHIRLPOOL 935a1401910a42f888c991e443a49275ea8b87976c5aa977f670053d97d18754231749749bc92d37d4b5f45ecf65914480942a11b5827b6c08fb24313a428431 diff --git a/dev-vcs/gitlab-workhorse/files/fix-Makefile-0.5.4.patch b/dev-vcs/gitlab-workhorse/files/fix-Makefile-0.5.4.patch new file mode 100644 index 0000000..68696bf --- /dev/null +++ b/dev-vcs/gitlab-workhorse/files/fix-Makefile-0.5.4.patch @@ -0,0 +1,16 @@ +diff --git a/Makefile b/Makefile +index c2c8c59..419f4d8 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,8 +1,8 @@ +-PREFIX=/usr/local +-VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S) ++PREFIX=${DESTDIR}/usr ++VERSION=0.5.4-$(shell date -u +%Y%m%d.%H%M%S) + + gitlab-workhorse: $(wildcard *.go) +- go build -ldflags "-X main.Version ${VERSION}" -o gitlab-workhorse ++ go build -ldflags "-X main.Version=${VERSION}" -o gitlab-workhorse + + install: gitlab-workhorse + install gitlab-workhorse ${PREFIX}/bin/ diff --git a/dev-vcs/gitlab-workhorse/gitlab-workhorse-0.5.4.ebuild b/dev-vcs/gitlab-workhorse/gitlab-workhorse-0.5.4.ebuild new file mode 100644 index 0000000..69c08d3 --- /dev/null +++ b/dev-vcs/gitlab-workhorse/gitlab-workhorse-0.5.4.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit eutils user + +DESCRIPTION="This is the new backend for Git-over-HTTP communication needed for GitLab >= 8.2" +HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-workhorse" +SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.bz2?ref=${PV} -> ${P}.tar.bz2" +S="${WORKDIR}/${P}-58957d60b525e83663f48b119b82160be604111c" +RESTRICT="mirror" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND=">=dev-lang/go-1.5.1 + !dev-vcs/gitlab-git-http-server" + +src_prepare() { + epatch "${FILESDIR}/fix-Makefile-${PV}.patch" +} + +src_install() { + local dest=/usr/bin + + diropts -m755 + dodir ${dest} + + exeinto ${dest} + doexe "${S}/${PN}" + + ## RC script ## + newinitd "${FILESDIR}/${PN}.init" "${PN}" + newconfd "${FILESDIR}/${PN}.conf" "${PN}" +} diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index 3bc6c91..a022bc6 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -19,10 +19,12 @@ DIST gitlab-ce-8.0.5.tar.gz 8238566 SHA256 476185a191bfe8757ca1a981419ff5d314491 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 +DIST gitlab-ce-8.3.4.tar.gz 10255543 SHA256 15cc1644c05798deafb81be5ae4c313d2d1dc38475ba4b119a5f1d8e905f2c67 SHA512 ce29dbd0b64eee3353e5ea335a738fd0ccc2910167d1d1c4849e7403b91a3b058edb037746b04988a780937abf4fbc33dd769f89a965ec99e8f7042478016f2e WHIRLPOOL 7ed124eaf9ccc913bb18da6fd5f4702cbe756b7a175da6dade53ceb04f35794bd58c8492052b0074ed1fa82e0258213081900ce9157c1ad13eb6f7a18e7c6e2c 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 11156 SHA256 3bbee882fafa3f1cf16e5e214c87bcadbb64c0abaf1566930aa548e5198cc361 SHA512 2794d6a92dbf5341c46b7b7504b9099fd3f350de0934599d3d8d59fd26c2515a88dbf850ac7e490929ab2cc897225c40696e98192e863549d3d5e677c5c96927 WHIRLPOOL 3083fec80d5cac025b0bc29fe2035e98e37b06bf7e54c5d54519171e052f7435fef38ac7f63030f828713b1af80e949fd7a117d421231fc01fff93837f885a3c +EBUILD gitlab-ce-8.3.4.ebuild 11156 SHA256 6a9d5dffb4228ef4ad3eda9429d9429ab7cc9ce64364d208b38bbd92d2fd5834 SHA512 e9cbfc68f80c737b0f605ac3db4861c50e4a304fec175db699c6eb24a1284180ea83e8a619abc3ba5808374f380d45b42986f646f8feb229af4a329807f2d817 WHIRLPOOL 2afd92aa67b7a8d7495db65830615fd6671b6b8366b2dd0492278e598ea069642c3d394fde77bd4fad6c5f0484f5d2bcb19c4b5a996a1af1db3e390a374653ab EBUILD gitlab-ce-9999.ebuild 11209 SHA256 64550d2d6bb5306df3c60a7e8b77562306ed2b41fb1045aaad3bbc6598916260 SHA512 d8ea512d408505362e464fd626490e676442c319029aaf07f34360b47c724fd017db52e0d3b713590dcc6253cc343e571fc7d9f6d2261445d1ae79e2d3c662db WHIRLPOOL 3e8366d75fe3c739b5a55942afd36acb456fa478500334de9bd8efd4f144bf59cad9c91643e7b99f7046a11c76003d52be1ba52f20fcb7e1802bb16e02080745 MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1 diff --git a/www-apps/gitlab-ce/gitlab-ce-8.3.4.ebuild b/www-apps/gitlab-ce/gitlab-ce-8.3.4.ebuild new file mode 100644 index 0000000..944f881 --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-8.3.4.ebuild @@ -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.4 + kerberos? ( !app-crypt/heimdal ) + rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/23 )" +RDEPEND="${DEPEND} + >=dev-db/redis-2.8 + 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,mailers,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 $@" +}