diff --git a/metadata/news/2015-10-26-gitlabhq-rename/2015-10-26-gitlabhq-rename.en.txt b/metadata/news/2015-10-26-gitlabhq-rename/2015-10-26-gitlabhq-rename.en.txt new file mode 100644 index 0000000..3d2b153 --- /dev/null +++ b/metadata/news/2015-10-26-gitlabhq-rename/2015-10-26-gitlabhq-rename.en.txt @@ -0,0 +1,22 @@ +Title: Package rename: www-apps/gitlabhq -> www-apps/gitlab-ce +Author: Manuel Friedli +Content-Type: text/plain +Posted: 2015-10-26 +Revision: 3 +News-Item-Format: 1.0 +Display-If-Installed: www-apps/gitlabhq + +The package www-apps/gitlabhq will be renamed to www-apps/gitlab-ce in +the near future (mid-november 2015 or so). The rename should not have +any impact on your installed GitLab instance, as all installation paths +will remain the same as before. + +Please make sure to update your /etc/portage/package.* files, though, +if that doesn't happen automatically. + +If you feel that such a rename is inappropriate, or that it will cause +too much unnecessary trouble, please open an issue on Github at + +https://github.com/fritteli/gentoo-overlay/issues + +Thank you. diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index b47642d..c498070 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -15,8 +15,10 @@ AUX gitlab.conf 27 SHA256 cd9be088bbb67a5400407fc6f63c061eb224f16748b7d0812ff2c1 DIST gitlab-ce-7.14.3.tar.gz 6393535 SHA256 3814a3bdff9610b269be15b8cf35701fcdd78a5a80fb1b366269acc49b23f5e4 SHA512 f2088c151b424cbca0fbc65073c1198ea9c3619570ca3543cf5f0ddd193a6105941608df418eeb506bde83f2c0bbd34cea267caaed70092afcca54219e84004d WHIRLPOOL 70574a135eb426e93086502ad7a0d5b73e1070a19c529852fe2aa60c2081d27bbb4289340b73b469ecfd489779cc409bb56de263e47aaa07859ed0a14dd51f44 DIST gitlab-ce-8.0.5.tar.gz 8238566 SHA256 476185a191bfe8757ca1a981419ff5d31449136e76029daa77e89086539d30c6 SHA512 af9d11f0ed744d0c92c9329ba94fe51534996f18dbb2c110d70912cd3ce9e60c3a127b7c8597c95b010b0e2251f98aabdddc314ddae53ab26a44c19b4ba7a7d7 WHIRLPOOL 6e4bc8c43cbfe215efd21a87a5d0395abde4f9998564fc0295d946ffa6a7021d2b5bc2ea625482fb400088bcc57431b3969a6c9dfa0f2121420356d153d297f0 DIST gitlab-ce-8.1.0.tar.gz 8503954 SHA256 f02e599436737b803482f4554abedd743e2f53c8c610e46115f71682da46276a SHA512 40f984a95f679f7695663e1118b119883a466ef0c65ee5aa4eac5053945a4111243c3aecc6181e0b1acf33c4df446ed7169a2e760a2b48596f314967bb3bff5b WHIRLPOOL ef2d418f167623cd17d2b4773d6cdab5f94d693ae4c785b7a621461b330908a680fb2bb4d720ef6ed1de3d80b1aea2e6a612146f9719f248c38e5588132d52dc +DIST gitlab-ce-8.1.2.tar.gz 8503168 SHA256 ab903b0c487aaf43dca4dfd3ac80e76ef344f403c8a02579a285c2658b80bc6c SHA512 f6c2f304c4be6fea6a36bce1ded5ec4352fb84e93922d152481fcc9788d2a505e843d05947962021ddba9629dbf9d55b8931cf576dccf396a561c55a0a16a883 WHIRLPOOL def94175936275e0b8c18c6238e473dae59f235e14c32cdb5c7a886d0f69538db57aee35844234a05b342925364d86aae9737f7c13a55dd2d74dda233af15a61 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.0.ebuild 11179 SHA256 f26d0655d2b69866961c8dbb25fdf0b7963073de7c93a8852cf6f683b03a1f03 SHA512 887e450adef7000219926fd3d5653a279faeb1c2f48227db652fc3f0b0cb30d337ab64a39f3d8e0154e5d5d3fb354ab8ba7c14942805042c467385d64e5d9299 WHIRLPOOL eb00cf64fd51a7f6e9df11da335c85894bcb95d4c33b034b31356834d9404708d1d78e9b84cced88f4e1bbe2e4c92144d66b597f31fe3c63483b05f89bb57889 +EBUILD gitlab-ce-8.1.2.ebuild 11186 SHA256 12209f6c1a378eb554f3b1452157ce744a3ad185c4d616fca264c5bc6c7032a0 SHA512 fd3d7dcc5055dd4bde3665f9af865f59dc1d075bd7c6158009ad35703caecca81129cb3d0a2b35723723cd09b5691dd30c9ca0b2d65d9b67c1639ad5f3f35c48 WHIRLPOOL 409acb3fe089a1ca069a8a56c4ad3d3fa388feadd772ab30b8c5f82cf45c001cf304a23257436fa80e8e9777cdfa98c1355386d99235d21d07d2fee9aa1ef050 EBUILD gitlab-ce-9999.ebuild 11080 SHA256 f20e17e6f5edc646d6773dea7d303007c4461a9aad82e58e7db0a0d17675037e SHA512 4272e495637acca385055c8aa5b685d6e35fd1b560bb4cf2385dc87a71236150ac567da3a601ff85aad1c7f949096c4bada2493027e1cec44127b84da92bdd8b WHIRLPOOL a9b4d67c55968e2755b04ed55d56e212a81ccdfc676b764ca328c7ee56f5309cb2ffeeff01a42cde617da51e6b0d691efcfc33102953be489a093e2a612e22ff MISC metadata.xml 545 SHA256 1b7fc44d811e1ab7638fe4a40253f49d5f1071872d3020c22c4f67662750cb2f SHA512 86f47d297892bccfefa087d93936296f5647993a9ec8e3f47907a6859cbf385e5bc6f00502d7836c9e8d9efef2b6725bf145b0150924c2082b2bd164469ef6ea WHIRLPOOL 6bfb8a55684d68c8bfa6e025a0be965f7b815394ee0896dd2a13cfb524e3cf3f3149acc9072897e30a1842060389576aac07ea8beb4a8b0bfc3e8eab3723f2a1 diff --git a/www-apps/gitlab-ce/gitlab-ce-8.1.2.ebuild b/www-apps/gitlab-ce/gitlab-ce-8.1.2.ebuild new file mode 100644 index 0000000..2bc4fa6 --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-8.1.2.ebuild @@ -0,0 +1,372 @@ +# 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" +PYTHON_COMPAT=( python2_7 ) + +inherit eutils python-r1 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.5 + dev-vcs/git + ~dev-vcs/gitlab-git-http-server-0.3.0 + 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}-8.1.2-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,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 + 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-git-http.service" + systemd_dounit "${FILESDIR}/gitlab-mailroom.service" + systemd_dotmpfilesd "${FILESDIR}/gitlab.conf" + else + local rcscript=gitlab-sidekiq-8.init + use unicorn && rcscript=gitlab-unicorn-8.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 $@" +}