From 8c5351ef810b7566c0b0fb33bd80793c21170cca Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Mon, 13 Mar 2017 18:15:22 +0100 Subject: [PATCH] dev-vcs/gitlab-shell: added ebuild for gitlab-shell-5.0.0; support for git-annex has been removed. Package-Manager: portage-2.3.3 --- dev-vcs/gitlab-shell/ChangeLog | 6 + dev-vcs/gitlab-shell/Manifest | 4 +- .../gitlab-shell/gitlab-shell-5.0.0.ebuild | 130 ++++++++++++++++++ 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 dev-vcs/gitlab-shell/gitlab-shell-5.0.0.ebuild diff --git a/dev-vcs/gitlab-shell/ChangeLog b/dev-vcs/gitlab-shell/ChangeLog index 12cc089..ab2a7e3 100644 --- a/dev-vcs/gitlab-shell/ChangeLog +++ b/dev-vcs/gitlab-shell/ChangeLog @@ -1,3 +1,9 @@ +*gitlab-shell-5.0.0 (13 Mar 2017) + + 13 Mar 2017; Manuel Friedli +gitlab-shell-5.0.0.ebuild: + dev-vcs/gitlab-shell: added ebuild for gitlab-shell-5.0.0; support for git- + annex has been removed. + 14 Feb 2017; Manuel Friedli -files/gitlab-shell-3.2.0-config-paths.patch, -gitlab-shell-4.0.3.ebuild: dev-vcs/gitlab-shell: deleted old ebuild diff --git a/dev-vcs/gitlab-shell/Manifest b/dev-vcs/gitlab-shell/Manifest index 2996ecd..9259bad 100644 --- a/dev-vcs/gitlab-shell/Manifest +++ b/dev-vcs/gitlab-shell/Manifest @@ -1,5 +1,7 @@ AUX gitlab-shell-4.1.1-config-paths.patch 2152 SHA256 e789f0c8a8b7ec8a840ce26dd63d6e5386a149f619d7ad5a6788577d897c4826 SHA512 6ae5af0c364061af4c9675804e2f6d6b662ed4891ed4c80bc1be39e9da6343db372e58bf04a0d3c8a4fc218daeb8cda45636e0da0c67ec801168e84004d05b86 WHIRLPOOL b8136b81ef943c15feeca303d1d7f0d55c85ff7f7ec82bfceea026ce334ca24fce0dfb599946562bd0aceb89a2216bcfaa894235c43f41e3031a305f85e756b4 DIST gitlab-shell-4.1.1.tar.gz 78829 SHA256 61f684b4528b0b789aad80efbfd8f9870d113f6e2794e589e0db9e74e6737e1d SHA512 17b929da1c6148a9af2787ca4a18081e3108622a40c6fb3f02f36f4ba41f2a1d61cf83509ace849093334af8f4ad74d8a36393bf9fca7ab21163d2f48b499879 WHIRLPOOL cfd258e93abeae4a33c1578114d56186c81a7c5894a3ccb9b690dd9a78051746916f3bac2b7146b8378534d5e177ba4cacb4c2011b64011328b056d4d397967e +DIST gitlab-shell-5.0.0.tar.gz 78585 SHA256 7611fdf0b64592365bdb6ba442a4263d129b05c280d5105ea641baec7a0b45ab SHA512 84c86c42e0ff6029ddcdd9a93410b261f4f5a1e8cdb0fd114db2eab56b1fc63f4f8ed6d0cc0c6016d0f02413d6d213aab7a995adadb186c0dfe49e49b762e904 WHIRLPOOL ddaf25f837dbbdbfd6578062b89a8102ffbe0dc88f51890a38f59add61653368b0ad0ea146a8a7eac52fa482f7316aae712f53075f750db02fa8e8ce370f76e6 EBUILD gitlab-shell-4.1.1.ebuild 3653 SHA256 06702f4658b8ac1bada6b322b833f65270656730417d8c9bb000ab1fb23af8f0 SHA512 dc63160d98dabfcbaa9982fe841fd581a1b1b2a968e7c7bd1ee336e449214fa89da33477f0d4744941ee3ecb8688386883a5923e78025bdcfd1556e68ea7371c WHIRLPOOL cd59e133d1d02f082f10312b358c6c8718898aa008a967fc85934656500ceefc44a6affae286123c481aa902fa51cdb7e7f98788057fdd08304ed99f643ef27c -MISC ChangeLog 2747 SHA256 fffb08ba51e2f70696e59273c2bcdeca86124eb0dc8dca8ecf6b6fd207230066 SHA512 a7145a9d4e8eaa3918866f266a33436c80cb29f37f3b8f51dc17c7d2deed051fe96a670686bac071ca92309a9aa731446dda70d6ae0963685f4adff15bca6cec WHIRLPOOL 46d5804bb630a61f2879a1e840dedc4eb05ca5162e7575a1bcf5ce344da945d8d5bd959eef2d565a3209684453cf3aecde8fe7cd6a6d9f8415d11c8d3574d2db +EBUILD gitlab-shell-5.0.0.ebuild 3653 SHA256 47e19d88939c146c5a7826ca538dba2caee3bc32944eab5b80d54ddbd4c196fc SHA512 1765624d95c14e2888f3e12be05ee727bae036265fc3c9bcfe17b509c0656de72728dcb580952d2a666b3fc99c3640f43862a9ea449599aeaa7cdb2509406347 WHIRLPOOL 2b935404098f288e729c3957007cc663afc3e76a4e04f536d5c7373cbae6857abb5a5cbd2d226355777e4af954a032e9b17211657d83a71bd2eef847028aea64 +MISC ChangeLog 2968 SHA256 d1febc13ae1f441766c488effc41cb4d3434d2c8874ce6f8665c71f3f7a94f55 SHA512 e67b8f8785660a0b9d9fb6849f0b14880ca90532b6b22a1ab7efc1be70ca166918364f938b3b1ad8efcb12e544ab9cdac7e0f279df9651dd51ba729ad435f233 WHIRLPOOL fb16d2699a95323ef28c2f97fd67f1882172688b11d1a63c29e5d8e01737b2af0dcf02d96122e0d2a0a751cf5acfa9ca5f0e487a2b2fa8ad4f4ff8f333c5093b MISC metadata.xml 248 SHA256 7b43be15755627edf5c12cf1b50c607d781558640bf8375d685d51d7ade99a32 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 WHIRLPOOL 993013c9878ead35469db13d3072f694a341ee654182e0c31d0678f5dd6de4bdc8d59a0b7bb6d685dc41ea6b55dac518cd8034131baea8002170c680e50304d1 diff --git a/dev-vcs/gitlab-shell/gitlab-shell-5.0.0.ebuild b/dev-vcs/gitlab-shell/gitlab-shell-5.0.0.ebuild new file mode 100644 index 0000000..bbb25b4 --- /dev/null +++ b/dev-vcs/gitlab-shell/gitlab-shell-5.0.0.ebuild @@ -0,0 +1,130 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +USE_RUBY="ruby21 ruby23" + +inherit eutils ruby-ng user + +MY_PV="v${PV/_/-}" +MY_GIT_COMMIT="199e2d62ebea9939e48d442c6a866d26d0aede4f" + +DESCRIPTION="SSH access and repository management for GitLab" +HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-shell" +SRC_URI="https://gitlab.com/gitlab-org/gitlab-shell/repository/archive.tar.gz?ref=${MY_PV} -> ${P}.tar.gz" +RUBY_S="${PN}-${MY_PV}-${MY_GIT_COMMIT}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm ~arm64" +IUSE="" + +DEPEND="" +RDEPEND=" + >=dev-vcs/git-2.7.4 + dev-db/redis + virtual/ssh" +ruby_add_bdepend " + virtual/ruby-ssl" + +MERGE_TYPE="binary" + +RUBY_PATCHES=( + "${PN}-4.1.1-config-paths.patch" +) + +GIT_USER="git" +DEST_DIR="/usr/share/${PN}" +DATA_DIR="/var/lib/git" +LOGS_DIR="/var/log/gitlab" +CONF_FILE="/etc/gitlab-shell.yml" + +pkg_setup() { + enewgroup ${GIT_USER} + enewuser ${GIT_USER} -1 /bin/bash ${DATA_DIR} "${GIT_USER}" + + local git_shell=$(egetshell ${GIT_USER}) + if [ ! ${git_shell} -ef '/bin/bash' ]; then + ewarn "User ${GIT_USER} already exists, but with the shell ${git_shell}." + ewarn "Changing shell to /bin/bash ..." + + usermod -s /bin/bash ${GIT_USER} \ + || die "failed to change login shell for ${GIT_USER}" + fi +} + +all_ruby_prepare() { + # fix paths + sed -i -E \ + -e "s|/home/git|${DATA_DIR}|" \ + -e "s|[\# ]*(log_file: ).*|\1\"${LOGS_DIR}/gitlab-shell.log\"|" \ + config.yml.example || die "failed to filter config.yml.example" + + sed -i \ + -e "s|File\.join(ROOT_PATH, 'config.yml')|'${CONF_FILE}'|" \ + lib/gitlab_config.rb || die "failed to filter gitlab_config.rb" +} + +all_ruby_install() { + # install lib + insinto ${DEST_DIR}; doins -r lib LICENSE README.md VERSION + + # install scripts + exeinto ${DEST_DIR}/bin; doexe bin/* + exeinto ${DEST_DIR}/hooks; doexe hooks/* + exeinto ${DEST_DIR}/support; doexe support/* + + # create symlinks to bin + local name; for name in $(basename -a bin/gitlab-*); do + dosym "${DEST_DIR}/bin/${name}" "/usr/bin/${name}" + done + + insinto $(dirname ${CONF_FILE}) + newins config.yml.example $(basename ${CONF_FILE}) + + # create symlink for .gitlab_shell_secret + einfo "creating symlink for .gitlab_shell_secret" + TOKEN_FILE="${DEST_DIR}/.gitlab_shell_secret" + dosym /opt/gitlab/.gitlab_shell_secret "$TOKEN_FILE" + + # prepare directories + diropts -m750; dodir ${DATA_DIR} + diropts -m770; keepdir ${DATA_DIR}/repositories + diropts -m755; dodir ${LOGS_DIR} + + # GitLab stupidly expects that gitlab-shell is in home of git user... + dosym ${DEST_DIR} ${DATA_DIR}/gitlab-shell + + # fix permissions + fowners -R ${GIT_USER}:${GIT_USER} ${DATA_DIR} ${LOGS_DIR} +} + +pkg_postinst() { + # check git home directory + local git_home=$(egethome ${GIT_USER}) + if [ ! "${git_home}" -ef ${DATA_DIR} ]; then + ewarn "An authorized_keys is configured to be inside ${DATA_DIR}/.ssh," + ewarn "but HOME of ${GIT_USER} user is located in ${git_home}. You must" + ewarn "either change the authorized_keys location in ${CONF_FILE}," + ewarn "or change home directory of ${GIT_USER} user to ${DATA_DIR}" + ewarn "and move ${git_home}/.ssh here." + ewarn + fi + + local auth_dir="${git_home}/.ssh" + + elog "Initializing authorized_keys file in ${auth_dir}" + mkdir -p ${auth_dir} + touch ${auth_dir}/authorized_keys + chmod -R u=rwX,go=- ${auth_dir} + chown -R ${GIT_USER}:${GIT_USER} ${auth_dir} + + elog + elog "GitLab Shell was initialized. Repositories are located in" + elog "${DATA_DIR}/repositories, scripts in ${DEST_DIR}/bin." + elog "All gitlab-* scripts was symlinked to /usr/bin to be on your path." + elog + elog "You should change your gitlab_url in: ${CONF_FILE}." +}