diff --git a/www-apps/gitlabhq/Manifest b/www-apps/gitlabhq/Manifest index 50eff2a..7a99409 100644 --- a/www-apps/gitlabhq/Manifest +++ b/www-apps/gitlabhq/Manifest @@ -56,6 +56,7 @@ DIST gitlabhq-7.4.3.tar.gz 4189957 SHA256 e03092298526bafb65336a14944570083f96e9 DIST gitlabhq-7.5.1.tar.gz 4221894 SHA256 cbaef29b55c35b1428fb4678be76500e7f0c292aa72314fa457d94c61fb5e00d SHA512 fc99100aab666819c06df96fc7979cb108a42249d811482c64473a51ec38e89d325346a4e069666a9130cff9eab21a470e68724cbe53d135bf4dc3b52a6b8930 WHIRLPOOL d86887f196cdc8d2690ff0a788c70994b7192d39b89d47c63a8b0baad8102c22efac3b3dc6556eefba7bb5cb12aaad347e5adb7d9a5a591fd8ca1d7de3a5b493 DIST gitlabhq-7.5.3.tar.gz 4222058 SHA256 533afcf5b9a0683d2f920a436e552af8d8e953c78d03f150cfb8dcfa0da3112d SHA512 18e9d5ee9d39c8e11101d370228b8edd38ccbfc1b7d768977f3cdd575604d7f72f897484749f9d74988b91f8195c0b9452a47a6f83acb6a7890d4aac9dd9f1a7 WHIRLPOOL 0bf347b12c2d2b5d4bf4bbcd0ff790bccfa100d0ff818a77e0843e3ff1ce87a627cd541bd7e5d8160f0954477809c8539ac1c309c3bcbc0e0b517ad3f30193de DIST gitlabhq-7.6.1.tar.gz 4239328 SHA256 96746351fdf05fc39f473930dcef4b25a02d9056c211004fbc14ad796b938cb0 SHA512 fbf807e6d9f5b9c0a6f86c086b6d69f0fd9ff268400432b023093053adf8d8b2e93e32675e0703df5cd00449af308f1fa6f649214d25bb00cd73c62437b60559 WHIRLPOOL 5f252240bf5e6722d7c064c52ce1e79548b2ab908487427aa4fee0dcf74652cd822325f1abb85aff14b83f19417626087fda489180bbbf6c10bdf8035d3ebc01 +DIST gitlabhq-7.6.2.tar.gz 4238734 SHA256 bc8f92dacca6be48c7a34b60a727e0755a44742500164c131dde7b88bedb71f0 SHA512 ecff2159536c72c82e34aadaaa02e2ee29ec494e7caf132665139622dcb6ba94af15295a0a8bbdeb550a9c2777284cd67cf57b7940b49da98e288a48577ba1b0 WHIRLPOOL 8b4fa295e82c9d61cc0c9a0e5e84b65ac2528f4afacada065e37214234b98d6aee90abe9d1599b8827e459f5ad503fccbab00f1d7528b89735f1617f4d55507c EBUILD gitlabhq-6.7.5.ebuild 10973 SHA256 d74d454bd9972f15d21a3454e39a78ab042ccb3444cbbedb25da01d40335361b SHA512 b5494ee857055022da0803277d6a8b84d1fa1d9af66a853eedafdd3fa4993dfe4a66962581234333b16f41b6d605cfe6a207a4d2706c90d921fbc54474deb296 WHIRLPOOL 03026c7b7029c8bc7d5e5ad05c38e4b507be6c4f36b488753120d7d0849522a9e557c5b04adcac4c22eced0fbc1432fd16e7447198092b6691ccc529147d9dcf EBUILD gitlabhq-6.8.2.ebuild 10595 SHA256 24317d99bb9d0e220c11a37709b1b701b9cd7bf7b9fe3adead666c531569dcf0 SHA512 2f3f5e38b33edfdff35f3888e694984e97d897d7c64c0aa6cc35149d253e7211560dbd918b12e891c0d1d009241e53e255a2a3be91beb5a3954d148c4554315e WHIRLPOOL 4dca44d6e271ec14252e3a4690e6736d64133d3d115ec19b77d37cb5a2a3d3a46e9820dae48df5d7fa79dd0ca9c6b178b9dca85811bc0e78b7964580b0696b59 EBUILD gitlabhq-6.9.2.ebuild 10616 SHA256 4221acadb5ac65ca3d662a2a560ff6343e04e0ca14dbd1b5bdd8f6a07812f7be SHA512 161c587d219c0dfd54b92805f7378aa7b1750bb25e632a16b67e3d24b28fab95f8f4272d685dfc70f1d7bfb15449a208fbb8b343dd8f902d8855034ed7f855d1 WHIRLPOOL effe560de13a29de88bf42aa927ddc2781373722a0e9a83ebef8942b0128208e35658a6b43d1bdc2d6e2b80c43b836dc8cc431f5d38912c201c789f70076e245 @@ -73,3 +74,4 @@ EBUILD gitlabhq-7.5.1.ebuild 10904 SHA256 821abc6ca9c2b87f18aa3279068ead6c25ed5d EBUILD gitlabhq-7.5.3-r1.ebuild 10907 SHA256 3c8b8cabc75968beda5a351b746ab53c7e644d16c437bc54af51fd62283a1917 SHA512 e42b3605ab405a798467713f723ddff553ecef81b2f16baad9bd93653da15fb23e47aa7f28d5cc93eaabf3e8eeb70201dc6f8ae6192b42da82be0a754e54704d WHIRLPOOL eae1bb4dc43c178f61fd8fe5784c1e02f385969dc7237ce9c140774266f4a583f911617014602c1e72c0f8f525edc7b6e620c748045419640f0f0bdc8dc6f0d3 EBUILD gitlabhq-7.5.3.ebuild 10904 SHA256 821abc6ca9c2b87f18aa3279068ead6c25ed5d652a0ac725dc5c53a6eb9baf08 SHA512 f0ff1487b022ed7884a4883b4e0fe36229918a3c93ea24ed315da7eda8cbc664974444e4efb7275e26008c5ef75e872d0fe1f76eda43d7aaa2223649faf5d554 WHIRLPOOL a20c720e9ad3a440b89d09df0a02dfef4f63cfab2102a69da20e5f38925daf97f8a8d339e4c9d997e0f0a05b9f71ad3932d6cdc20e6561696d2286bb7d510589 EBUILD gitlabhq-7.6.1.ebuild 10911 SHA256 f0fe0342c47c7e0d6ae10e080f56198c752454bddbe8910092124c290c40e716 SHA512 34ae28951cb92b6c01e21c421a156ffd35c45b75f3e4d4701e46da71f13a921fc291c146ee3436e39d68898ae4ee107aa558d63429aa4f96344502654e8c6ee9 WHIRLPOOL 3a43aa3d336ba926a4d9703b96472eddcadf55bc966e65fcf3eca8ee0070effcc0920a18c4f376f1292c64dcbceccd6733c6010ab03db3dfc98f25d0da5b7c6c +EBUILD gitlabhq-7.6.2.ebuild 10911 SHA256 f0fe0342c47c7e0d6ae10e080f56198c752454bddbe8910092124c290c40e716 SHA512 34ae28951cb92b6c01e21c421a156ffd35c45b75f3e4d4701e46da71f13a921fc291c146ee3436e39d68898ae4ee107aa558d63429aa4f96344502654e8c6ee9 WHIRLPOOL 3a43aa3d336ba926a4d9703b96472eddcadf55bc966e65fcf3eca8ee0070effcc0920a18c4f376f1292c64dcbceccd6733c6010ab03db3dfc98f25d0da5b7c6c diff --git a/www-apps/gitlabhq/gitlabhq-7.6.2.ebuild b/www-apps/gitlabhq/gitlabhq-7.6.2.ebuild new file mode 100644 index 0000000..97dca76 --- /dev/null +++ b/www-apps/gitlabhq/gitlabhq-7.6.2.ebuild @@ -0,0 +1,368 @@ +# 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" +#RUBY_S="${PN}-7.4.0" + +RESTRICT="mirror" + +LICENSE="MIT" +SLOT="6" +KEYWORDS="~amd64 ~x86" +IUSE="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 ) + virtual/krb5 + virtual/pkgconfig" +DEPEND="${GEMS_DEPEND} + >=dev-vcs/gitlab-shell-2.4.0 + dev-vcs/git" +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-project-name-regex: +# Allow project name to contain non-ASCII characters. +# +# fix-sendmail-config: +# Fix default settings to work with ssmtp that doesn't know '-t' argument. +# +RUBY_PATCHES=( + "${P}-fix-gemfile.patch" + "${PN}-7.1.1-fix-project-name-regex.patch" + "${PN}-6.0.2-fix-sendmail-config.patch" + "${PN}-7.0.0-email-custom-reply_to.patch" +) + +MY_NAME="gitlab" +MY_USER="git" # should be same as in gitlab-shell + +DEST_DIR="/opt/${MY_NAME}-${SLOT}" +CONF_DIR="/etc/${MY_NAME}-${SLOT}" +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:).*|/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; 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-6.init + + cp "${FILESDIR}/${rcscript}" "${T}" || die + sed -i \ + -e "s|@USER@|${MY_USER}|" \ + -e "s|@SLOT@|${SLOT}|" \ + -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}-${SLOT}" + 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 $@" +}