diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index c7e617b..bab6f6b 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -20,7 +20,8 @@ DIST gitlab-ce-8.14.2.tar.gz 29715506 SHA256 9d45a0a86c6b01e0c48e7fe2fc442fe774f DIST gitlab-ce-8.14.3.tar.gz 29717697 SHA256 df0b57646af534a874128d6e1903cee215c093a3c6302315cc53a9bddf62582e SHA512 9c7c58d0c6c7df447b0f723c550cb95530e781cf75b915b49e098dc0742cc18dc47e665cfa228dc2867ac5cc4dc40d62b6544d0160738a596d2331628c80304c WHIRLPOOL d96e9cbcbee48ce5f6ceff88756ad7493c0b5a3111ff072996541e5b650f0feb727eceab5e0859873b68d6248d790c4dacb8bc9e2d1f288936fc102de1410052 DIST gitlab-ce-8.14.4.tar.gz 29719940 SHA256 32c8e66e3c5f820874548c0ceab0215a567ca7b58a9ea604adc63878f50f8307 SHA512 426faaa4a4f18e9462d2153f031db8394465581638d259e6e0282a2bfe6c72c8738ca0dc084969f414e61a362bc5792656a07b33592a7f880307613fc152f8ae WHIRLPOOL f3f3a012f26a5a3dcdc5214b039128280e75ddf885b71fdacec13119cc6229dd771db0186b8fb04c5f761e62cf5962867570c6c4bfd47eecca57f1665521b220 DIST gitlab-ce-8.14.5.tar.gz 29722006 SHA256 8e03214c1f741cf813453e7764a0da1d8f0ec957b5395d2e359b9f24bb5f3c8e SHA512 afdc8bcd3022f1b1e5f14c76a5ee696eda462ffeeba94411f3f82ba0b2e0647d017982f0357fe66a1272929569eb0f24e5d18bfda78b88599e91c9486438aaa9 WHIRLPOOL 1eba1abf2543bb8203349fe03e6debf5e837effcf7a23d1f4e7e49900db7d1bc77c62ca6f95c5b26b7c00c396499f3cc8c2ec2d0e5f209bc2d7da99d2f7a4668 -DIST gitlab-ce-8.15.0_rc1.tar.gz 17803212 SHA256 6981763818f2dd1f46d5d8f0c708b7d8d0b780a2bb68852270fc9e6c649bd12c SHA512 24689f4976b7b423359ca36de5e84b82e50f6b1f6b1886437bda4bef2bfd2efd9348fdd5c90b726215cfe9243711f121f61d2bf485c67915a52fdb43524d531b WHIRLPOOL 349a6cafff690aa104cd12d2ad146b83ba2b146c79f8fa10ac48a4a4863b78db8218d0aa5e970f6a22f30c6eeaf25d076d25158c66302e7b76d048980994c278 +DIST gitlab-ce-8.15.0_rc6.tar.gz 19877630 SHA256 dea41bc8eeca350b359a7a7fadab2798fdbd0767bf22eb32c16197aa44164e24 SHA512 573eec3d9476d9e0765c91e558b6604e003b6dff27debc55dfc3cb583a4dc8b67ad710ae15b90e32a862987f512275a37ab5fe30da1a34a4244921e32e5f962a WHIRLPOOL aea5e6add4eefeefbf4ed75db81a105faf03612ee4f24429569bd3d7a032202d47021b377d35e8815f00595265048a3c31cd77b40a4aacb2eb6589cb4f87a927 +DIST gitlab-ce-8.15.4.tar.gz 20029958 SHA256 5d9df84b82e8b453f61f822fce44afb9603d03b3de23d73c855ce12f7629a33a SHA512 1e2315343ba2efb521bc5dc197b63f7b3af895327de76d1823345d6d39921d9a995b65f6211b572c07cf4a4583bcaf7e6f1ef159b38a7b7b1aa731e2f653c3ff WHIRLPOOL c85e4a389dec2d8807a158447eafb1062b2e1c70eb243f898c5155a26af92c99dba7bcf60217a51c26afbcb3e04ce996177b6e90cd4a0199f8fdc2c79c575ed8 EBUILD gitlab-ce-8.13.6.ebuild 11979 SHA256 761411082e2e68f432f913f5c5c969847832d335b1f7843575890ba125542539 SHA512 ab01af577da7a27cee3308c6766a042edbce7f1c472639b9a24b9bef3a7ce37389dd8e32b43cf62b9ce7c20399ccf17fd35f678ea63598b4b06890bfeabded50 WHIRLPOOL cc14b981521f0513108ab4320f2e3d4f210ec0da7373f0f99b35d975003b5e1ff5783c5db5c6b7f29739e795fc73d4744716f81056039eefaf445354bd7cb000 EBUILD gitlab-ce-8.14.0.ebuild 12058 SHA256 ef9893f42bf74b6864d5647c406afb69412cfa88ab89fa3bbc8a69d92f6eabe9 SHA512 182be258e2ede41a056d0ecc6c8691dc89af035474b711c74887b61105e1260fd0cc02556931e713cc256766a8879356ea07ce7bb9aa8f463eedf63925afe52e WHIRLPOOL 69c12e67507d5f27bf5491d06a1f0de7e0bc156b624008977f7150b623728e255ebdcecb100aa3133dc8063f7bdfb5586c0924fa3077c1141090719666d1cb76 EBUILD gitlab-ce-8.14.1.ebuild 12058 SHA256 95df987cfcc654adfff434916f3b3c093bd363f147ce732f2712923c38c6cea1 SHA512 7aac8dd78a3d25eb6a3664f7818188d89dea015cfb88f37c5d54597b9e0351f208d82a96488ec0109769d59b264d0a81f4656e3e95b63fe1ac99290879f28497 WHIRLPOOL 683ca7f8b32b89ebc3f503481ef6891dea756297f4a474efb62791f5b0bfd3e5287498bc0f78b73592b1c1cc8ce7ec67748a439399c601992f300dfcbe190560 @@ -28,7 +29,8 @@ EBUILD gitlab-ce-8.14.2.ebuild 12058 SHA256 d3ceac76fde85644bae8524b94e29c484a12 EBUILD gitlab-ce-8.14.3.ebuild 12058 SHA256 c495099e43d677041f197e70c051ba2e5541b600d8e65a9bfc17de44bd46195a SHA512 bf50743972034453cb3d63563589e768ef2c394e6a119b34ca55b17ff03d34f98d85a09e3411090bee4a821f505a35ac9ea1c89c6fdd241c395b71c8daf671a4 WHIRLPOOL cedad6cb34a050bc052c3827a3f6e95cb5e68346fa3da2a77e7cceabe0b194abc545a5ffef6441e00f55be0d4a701dcab63a0b0907cb81529fd20d34403fb066 EBUILD gitlab-ce-8.14.4.ebuild 12058 SHA256 8f856b037e7f6b299e24725dcc972bd83a0758f7f4d79972eb446a931c240614 SHA512 30c304448c208e20da70dbb4300150aa494a2d4b00e2bf3db6897b1b3c13834ece0a186f29917e05765ac7833be79e13a2513a56705a51351ece6b50ca87d68d WHIRLPOOL e188d79b0322cd6433529ef6d8d157cd09a96c36d6f8161412b2c41c07aabec047acda0e5b7ee8741ea4aa526824dd17e9c823072aeaf584fd6a6dd49e4d8bfd EBUILD gitlab-ce-8.14.5.ebuild 12058 SHA256 ef48879ad31e34e3b451ed39d1a196c1ae37b53296b39fb2f5d9c55f8cb04fc0 SHA512 24b314b35b24712471bf0f9e887a3c8cd434be2d5231f270ea0ef5f4d59377b2ba1049bf3ee7bf5feb54f77bd1d9d4121409640bd562a3a871c6bef1e7a80f45 WHIRLPOOL 7fef550d27617de2176b0f3fadb4575ad15f09e3bc204a82ea0b62c97497d36c1e0154fd18b483ac678ff7b5f8ecb464161a132ecf250bad839f28dd721e5100 -EBUILD gitlab-ce-8.15.0_rc1.ebuild 12035 SHA256 5df513f9cd7d32f7d6435696c39fa0ac920bd0785c913702e7a323257adc5b71 SHA512 7822d3bee4218aa04ddd3e37d6828bb2430e344f91111137e954cad239d3b0133cae05461af048f902e2de516ba76e9b5b9dfbe91f6cd7500a92b9ff944a7304 WHIRLPOOL 794e7235b9ec5d493251f94df9e183421873a04e90d9f0ee76e2ea5820c830ee72084887d6c6f2b101c58df18f1b6ded97aad5711d6ac75278ed4d62c9701af5 +EBUILD gitlab-ce-8.15.0_rc6.ebuild 12035 SHA256 f7fef2775eb434c2cf59ba92eb8fd16ea243fa3eb9a24da924df33aba396f06b SHA512 5f937d30851dc268ef76f15bef4d71aff5afe5b3b1a70a83cb07fc2589466577fdd947f9f381c92c84025261ae9e8bd04ecf625eff9657a5ac688ae0c9692181 WHIRLPOOL c17b8e3838d18cd4768413b2a63aed9071b66a16fe9c51e63de9631596f20b422d438608e64157d7182ce8133144b4f57b215c705ed283baeab70dc22fdb862e +EBUILD gitlab-ce-8.15.4.ebuild 12058 SHA256 6042a9e3d526643813d43133902947935347d25d6840c409f24b69a140c889e1 SHA512 21cf6b3bb9ed4293c51ba0cb7ae2e376031b7faa36e77558cea2a616d86d7e854ccf37c3154aac67e539e1e07163a74e5deea2ec8bfd87e41578c84006cc16d8 WHIRLPOOL 0e6f5de4791a2fce92c7fcc6364fac13e4c1dab27789067402a3b14626db72f61777fb809a8650ebb57ba48ac8fb49c9b8192b57ccb1c86681a6996aadd64daf EBUILD gitlab-ce-9999.ebuild 11913 SHA256 f6e02b9e122033339874bce07dd4b1663a8b3dee9ad86e5793a9dbf7517e78b6 SHA512 43943fc250c810f131bdcfef518373b12bb997b84c12d5ee50b3006ddc9a7df4541a08faf2ea35dcd56ad70a7fd3d5dfc17c529b30df99c426d6418c3e5ee051 WHIRLPOOL ff7cf1a2a82545f16e2c7804ace0a8b2d00acab24233afe293668ab7573131065e1b301979d87563dd235a9fb4bebd3156aa9bddcb547cfb1b837103273686f5 MISC ChangeLog 12134 SHA256 d90c37dd130c4d65cf1fbcf7cc3202e4c0cdc277e8c93f6f504af75cf8569cc0 SHA512 ed221d43270e2f4c3069b796445bf871c7dd6e1def0227be148667410efa0ec3ae122d89a00437520982116ca56daf3ab6f494026ac2ebf8d511c50e97e69f03 WHIRLPOOL e11b0465d4755686d2e1e1136b0f4d3e542a801fb5b2667937cb63f3493e5dfb825603090988b580d55fd5d0448d408836bbc5e878c5b844a26a1f16ec252605 MISC metadata.xml 559 SHA256 6c3f48d3ef57c97bf27790f33ee04bd8de8b01597caa8a2a7a473d6d0a3c5759 SHA512 5aa340b5429795d84cd106ee673fd55a42fd4b0d3299d6b95c6a3e3d50812a9620820a4de5c57d5048af0c3ecec7f575d5856d2f7fadc210aadcbdd4dd040fe1 WHIRLPOOL f3d7b8c0522e09f5156e6bb446bb74e4c75f5da4495ca2ece1eb78afce59307abe01bf3c5dd5344278fcac9e334300d912031c806f51b981591c01bc3588c6f3 diff --git a/www-apps/gitlab-ce/gitlab-ce-8.15.0_rc1.ebuild b/www-apps/gitlab-ce/gitlab-ce-8.15.0_rc6.ebuild similarity index 99% rename from www-apps/gitlab-ce/gitlab-ce-8.15.0_rc1.ebuild rename to www-apps/gitlab-ce/gitlab-ce-8.15.0_rc6.ebuild index 402c608..b4b9134 100644 --- a/www-apps/gitlab-ce/gitlab-ce-8.15.0_rc1.ebuild +++ b/www-apps/gitlab-ce/gitlab-ce-8.15.0_rc6.ebuild @@ -16,7 +16,7 @@ USE_RUBY="ruby21 ruby23" inherit eutils ruby-ng user systemd MY_PV="v${PV/_/-}" -MY_GIT_COMMIT="71683446a77934390038ddd450a90b80b53b990b" +MY_GIT_COMMIT="5f118980e82dd86661d72d2c96053b1da27e048e" DESCRIPTION="GitLab is a free project and repository management application" HOMEPAGE="https://about.gitlab.com/" @@ -54,9 +54,9 @@ CDEPEND=" virtual/pkgconfig" COMMON_DEPEND=" ${GEMS_DEPEND} - ~dev-vcs/gitlab-shell-4.0.3 + ~dev-vcs/gitlab-shell-4.1.1 >=dev-vcs/git-2.7.4 - ~dev-vcs/gitlab-workhorse-1.1.1 + ~dev-vcs/gitlab-workhorse-1.2.1 kerberos? ( !app-crypt/heimdal ) rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/24 )" DEPEND=" diff --git a/www-apps/gitlab-ce/gitlab-ce-8.15.4.ebuild b/www-apps/gitlab-ce/gitlab-ce-8.15.4.ebuild new file mode 100644 index 0000000..74f131c --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-8.15.4.ebuild @@ -0,0 +1,392 @@ +# Copyright 1999-2016 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 ruby23" + +inherit eutils ruby-ng user systemd + +MY_PV="v${PV/_/-}" +MY_GIT_COMMIT="a0b13790d398d1e3b16b049eb39ed901487130cd" + +DESCRIPTION="GitLab is a free project and repository management application" +HOMEPAGE="https://about.gitlab.com/" +SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.gz?ref=${MY_PV} -> ${P}.tar.gz" +RUBY_S="${PN}-${MY_PV}-${MY_GIT_COMMIT}" + +RESTRICT="mirror" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm ~arm64" +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" +COMMON_DEPEND=" + ${GEMS_DEPEND} + ~dev-vcs/gitlab-shell-4.1.1 + >=dev-vcs/git-2.8.4 + ~dev-vcs/gitlab-workhorse-1.2.1 + kerberos? ( !app-crypt/heimdal ) + rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/24 )" +DEPEND=" + ${CDEPEND} + ${COMMON_DEPEND}" +RDEPEND=" + ${COMMON_DEPEND} + >=dev-db/redis-2.8 + virtual/mta + systemd? ( sys-apps/systemd:0= )" +# dev-ruby/bundler should be >=1.13.6, but that doesn't exist yet in the tree. +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. +# fix-redis-config-path: +# Point to the absolute location of redis_config.rb +# +RUBY_PATCHES=( + "01-${PN}-8.7.5-fix-sendmail-config.patch" + "02-${PN}-8.11.0-fix-redis-config-path.patch" + "03-${PN}-8.14.0-database.yml.patch" + "04-${PN}-8.12.7-fix-check-task.patch" + "05-${PN}-8.12.7-replace-sys-filesystem.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}" + +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" + + einfo "Cleaning old gems ..." + ${RUBY} /usr/bin/bundle clean + + # clean gems cache + rm -Rf vendor/bundle/ruby/*/cache + rm -Rf vendor/bundle/ruby/*/bundler/gems/charlock_holmes-dde194609b35/.git + + ## RC script ## + + if use systemd ; then + ewarn "Beware: systemd support has not been tested, use at your own risk!" + systemd_newunit "${FILESDIR}/gitlab-8.13.0-sidekiq.service" "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-8.13.3-sidekiq.init + use unicorn && rcscript=gitlab-8.13.3-unicorn.init + + cp "${FILESDIR}/${rcscript}" "${T}" || die + sed -i \ + -e "s|@USER@|${MY_USER}|" \ + -e "s|@GITLAB_BASE@|${dest}|" \ + -e "s|@LOGS_DIR@|${logs}|" \ + "${T}/${rcscript}" \ + || die "failed to filter ${rcscript}" + + newinitd "${T}/${rcscript}" "${MY_NAME}" + fi + + # fix permissions + fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs} +} + +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. Run these commands (as root):" + elog + elog " cd /opt/gitlab" + elog " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production" + 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 initialize the 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." + if use postgres; then + elog "Please note: As of GitLab 8.6, users of PostgreSQL need to enable the" + elog "`pg_trgm` extension by running the following command as a PostgreSQL" + elog "super user for *every* GitLab database:" + elog " CREATE EXTENSION IF NOT EXISTS pg_trgm;" + elog "For details, see the documentation at the GitLab website." + fi +} + +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}/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 + + su -l ${MY_USER} -c "git config --global repack.writeBitmaps true" + + # determine whether this is an update or a fresh install. we do this by + # checking whether the ${DEST_DIR}/.git directory exists or not + # + if [ -d "${DEST_DIR}/.git" ]; then + local update=true + else + local update=false + fi + + ## Initialize app ## + + local RAILS_ENV="production" + local RUBY=${RUBY:-/usr/bin/ruby} + local BUNDLE="${RUBY} /usr/bin/bundle" + + # FIXME: this line existed in older ebuilds, but the variable is + # never used. what was it for!? + # local dbname="$(ryaml ${CONF_DIR}/database.yml production database)" + + if [ "${update}" = 'true' ]; then + 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 + # 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 + + 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 + elog + elog "If you want to make sure that the install/upgrade was successful, start" + elog "Gitlab now and then run these commands (as root):" + elog + elog " cd /opt/gitlab" + elog " sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production" + elog " sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production" + elog + if ! use systemd ; then + elog "You may also run" + elog " /etc/init.d/gitlab check" + elog " for convenience." + 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 $@" +}