From b7addf9ce9f1797ed32b43cc9635de286665b930 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 9 Mar 2018 22:59:44 +0100 Subject: [PATCH 1/4] dev-vcs/gitlab-shell: Add ebuild for version 6.0.3, dependency of gitlab-ce-10.5.4 Package-Manager: Portage-2.3.19, Repoman-2.3.6 --- dev-vcs/gitlab-shell/ChangeLog | 7 + dev-vcs/gitlab-shell/Manifest | 4 +- .../files/gitlab-shell-6.0.3-Makefile | 3 + .../gitlab-shell/gitlab-shell-6.0.3.ebuild | 132 ++++++++++++++++++ 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 dev-vcs/gitlab-shell/files/gitlab-shell-6.0.3-Makefile create mode 100644 dev-vcs/gitlab-shell/gitlab-shell-6.0.3.ebuild diff --git a/dev-vcs/gitlab-shell/ChangeLog b/dev-vcs/gitlab-shell/ChangeLog index 5fcf83b..6955dfd 100644 --- a/dev-vcs/gitlab-shell/ChangeLog +++ b/dev-vcs/gitlab-shell/ChangeLog @@ -1,3 +1,10 @@ +*gitlab-shell-6.0.3 (09 Mar 2018) + + 09 Mar 2018; Manuel Friedli + +files/gitlab-shell-6.0.3-Makefile, +gitlab-shell-6.0.3.ebuild: + dev-vcs/gitlab-shell: Add ebuild for version 6.0.3, dependency of gitlab- + ce-10.5.4 + 08 Mar 2018; Manuel Friedli -gitlab-shell-5.0.0.ebuild, -gitlab-shell-5.0.2.ebuild, -gitlab-shell-5.0.4.ebuild, -gitlab-shell-5.1.1.ebuild, -gitlab-shell-5.3.1.ebuild: diff --git a/dev-vcs/gitlab-shell/Manifest b/dev-vcs/gitlab-shell/Manifest index b153644..83f55ce 100644 --- a/dev-vcs/gitlab-shell/Manifest +++ b/dev-vcs/gitlab-shell/Manifest @@ -1,6 +1,7 @@ AUX 0001-gitlab-shell-4.1.1-config-paths.patch 2152 SHA256 e789f0c8a8b7ec8a840ce26dd63d6e5386a149f619d7ad5a6788577d897c4826 SHA512 6ae5af0c364061af4c9675804e2f6d6b662ed4891ed4c80bc1be39e9da6343db372e58bf04a0d3c8a4fc218daeb8cda45636e0da0c67ec801168e84004d05b86 WHIRLPOOL b8136b81ef943c15feeca303d1d7f0d55c85ff7f7ec82bfceea026ce334ca24fce0dfb599946562bd0aceb89a2216bcfaa894235c43f41e3031a305f85e756b4 AUX 0002-gitlab-shell-5.1.1-Makefile.patch 252 SHA256 cb45d73d9a2b5a30d2c457d6ddef9953b4a907e4929575709997a3edcb416cc2 SHA512 ce185a66e746e7791ca7ace15757d24a6fe426a986837a3b41c18771c0e3395baa05488735273171d41f764a9cee2517dc64e629f4d9b2aedc0bd57650350d9f WHIRLPOOL d6c6562a9d6efb904580732c43538b86b7ea8fb9dab538ede162018f86974a2e330403b385f636734b67be894063671e17814865de0ae36b8e8eb9ef1199aa3d AUX gitlab-shell-4.1.1-config-paths.patch 2152 SHA256 e789f0c8a8b7ec8a840ce26dd63d6e5386a149f619d7ad5a6788577d897c4826 SHA512 6ae5af0c364061af4c9675804e2f6d6b662ed4891ed4c80bc1be39e9da6343db372e58bf04a0d3c8a4fc218daeb8cda45636e0da0c67ec801168e84004d05b86 WHIRLPOOL b8136b81ef943c15feeca303d1d7f0d55c85ff7f7ec82bfceea026ce334ca24fce0dfb599946562bd0aceb89a2216bcfaa894235c43f41e3031a305f85e756b4 +AUX gitlab-shell-6.0.3-Makefile 41 SHA256 cf9369c20800c5663ecd205a49fcfe1d6d4d12290d1c219823e35c348912ed49 SHA512 de23339a4515975ff272feaaea3bf3028c0b807a87db08e098b290508a01116fd3335345c12bd2e78ba03df0ede3b9633b104dbcf4a3817af02b431eab364c6f WHIRLPOOL 61233d3c2d00c3eea066c40d93bd37bb9741f3927b502bb122ba4c9cc425810a6a966af33fe840da81d36d82328cfdce903f6643b8122872e294b9cf2133a4ee DIST gitlab-shell-5.10.0.tar.gz 712749 SHA256 703d96c71dd507995780c6bd1de88d618df95e92593f099a3505136bd2547337 SHA512 d25e84f97c52aa626c9b8d7c739017dbe9cc13710e23a7257d08ecaa20dafb3af8e78aca8e768d77e9abc741a4078e322194870fb6151356ce5a5004f6f0032f WHIRLPOOL 10727efc8f043b45bb8f8a141684312932e64f28f599e735a2a705d504f4ce75330acbe707e007a9a44ed94d00a546ab041e256434958700b4ae532f00e482c6 DIST gitlab-shell-5.8.0.tar.gz 718927 SHA256 7c6a02e12ec0efcca23b9200dc18be29a8ce2bf70f9802bb188fc22dbf1875d3 SHA512 f17e4ec95dce29608684de27d9a4f7a3fa69cd25fb68223576a4501ef83fc50bfb74668599672edc8c8d670585b47e22825004cba2227bb4ef6f0e3c27d06b59 WHIRLPOOL 941c5c9daf6e319e44c49af627474e87f33e964bbad0b59b84f90f7b7e8ca82b5f0635102964b9fd7b74f8101b6af6539aa966978468105ad9b004cb2fa76222 DIST gitlab-shell-5.9.0.tar.gz 710920 SHA256 5085b531abd1c3ebbc73c7b77c05e674fe42d975c4d9c64bdc54704c51a15907 SHA512 e89a0f2b97e502b003ee62eacfa520dc248b93cf68a0d2eabae5672ee968ca68fd01839c9195422fb680e341756ec399af0a7654fc4e6fbe7d12f3af3643d2c6 WHIRLPOOL 45bd1f044314de3d093fb6689b5c50ca9243aa097e54f75e15485eda6504ab91975a5e8c4df115a94dfe228d98923ebc5f68e85eb050a95fd71f5927d5a89354 @@ -11,5 +12,6 @@ EBUILD gitlab-shell-5.11.0.ebuild 3717 SHA256 f0733e56a42e32de7976321a41cb553e68 EBUILD gitlab-shell-5.8.0.ebuild 3908 SHA256 6f144e30269af1f4b608258da78553f64a1c6fb4e4ad532de4adcc4d93c8962d SHA512 e9131c8d9361a7321837c996b098b515b15cbd93c15067c000a5811d313fb167432bc415a5327a110adc6a92009d52cad78f12311552042c1b214b5df3eae9ba WHIRLPOOL e16d0ea02eceea491c8bc079cd1d4932d83340f1db3a9e249960b57e550ed65903610f0541d89ef616561f83f4c7fc771b1aedd115e48b80c62e72f62d7dbc3a EBUILD gitlab-shell-5.9.0.ebuild 3908 SHA256 91618dfa168fff385eb362572c8e65e1f72464ea4240b03e60cb554f7c872a8d SHA512 c16e5176dcfc866a696c4b1096b17bf15437ee77db92f28de79990688f146fa38ca2d345d1b3138072626086242f6c3e044a345435ea11ebd0455c3115c8bafe WHIRLPOOL 0b3d586d6c991a20c806ca5a53437aa8eb79eabfa64a26fb839d493052ae2d752dc65ec9626c3c7f62d6de9182d31870eb99c6018f6d490a30962f0b823eccd1 EBUILD gitlab-shell-5.9.3.ebuild 3908 SHA256 27290b4d2d5ceacaf991026c149ea2e1eaa270959490d9a8850596c8e7b4afed SHA512 daa5328dd238804860f8aa52cc4b09c484fc1477dfa6e60aa2fb424e27cc69121dea2c677e02832613ce0bc0023b9b23fe91c53dd455cbe689c6c09bb342138e WHIRLPOOL 8fa05924b1405f79656da46cfe7d22f1631a10ef19629f75fafdec11fe7b6d6fbc0db80ae2a31c81d3c11a9b412f39aa25234e7d5e318b6f4ebbd305af3f6781 -MISC ChangeLog 6005 SHA256 3cd5b207f4c40f4f90476b9ddd25c9fa5be708aa20251167fc3f8b32e90123eb SHA512 482c0b3f49d65b55f9e84ad07facb900f3cf32c8bb71e560597e7206bd908255944d9c99d7935cd53d070134fdececef084a4bbea5ee329f2a2b50bb6023ced3 WHIRLPOOL aff16fd4a35b648c156e883b0dfe85cf387f4f6ee10f0e551aaa3f6fe7adc8ee73e14b5080c148f7ec7e62f56921f08b5d3a29a8146a7fe718d0208489c548e7 +EBUILD gitlab-shell-6.0.3.ebuild 3729 SHA256 2a3157091fef0c41760572d75f3ebe8c6e567a5a6484f4e20cc18b0bc9f98885 SHA512 f8d6f08109c9c3ee396d2dd6071c7e2912ea9ac6a079fd1a8b12df44751ade9d0c45f4b0a24e18fe663d53fc0ec9798602bf8eb8cbe50f8ce2cb9b9b3a2cbbac WHIRLPOOL 01ec61d59a4bcd59a4bfb0db612adc97c5cdbfee7a5f7712c2e6faee962ad16b7dda5f29956fe643dc3d0073bd3ca4bac73264a4306ea469ae5817d854fcc2d1 +MISC ChangeLog 6247 SHA256 6edb7aed808db07c2b44b64d50953abe8759b456725a4b077c54f07c285bba2c SHA512 a82e59f99cdfce2324f38b56453ce1f0b5345d01890aa8a14a7012c1671b3f82eeee6804d2af8e17f116d1725f89f2a3842d71b844f831f7b3cb3a47ae077803 WHIRLPOOL 2df0c7e7ec6af196a4f751ae33660f18d593a08bbd74e7dd281d215f2da4c6a800eeb87b46d84464272cbb5935a52ff2d9c1cc8417829b6eb1e33aecd7b5a879 MISC metadata.xml 248 SHA256 7b43be15755627edf5c12cf1b50c607d781558640bf8375d685d51d7ade99a32 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 WHIRLPOOL 993013c9878ead35469db13d3072f694a341ee654182e0c31d0678f5dd6de4bdc8d59a0b7bb6d685dc41ea6b55dac518cd8034131baea8002170c680e50304d1 diff --git a/dev-vcs/gitlab-shell/files/gitlab-shell-6.0.3-Makefile b/dev-vcs/gitlab-shell/files/gitlab-shell-6.0.3-Makefile new file mode 100644 index 0000000..7be3472 --- /dev/null +++ b/dev-vcs/gitlab-shell/files/gitlab-shell-6.0.3-Makefile @@ -0,0 +1,3 @@ +all: + bin/compile + strip -s bin/gitaly-* diff --git a/dev-vcs/gitlab-shell/gitlab-shell-6.0.3.ebuild b/dev-vcs/gitlab-shell/gitlab-shell-6.0.3.ebuild new file mode 100644 index 0000000..8b02c8d --- /dev/null +++ b/dev-vcs/gitlab-shell/gitlab-shell-6.0.3.ebuild @@ -0,0 +1,132 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +USE_RUBY="ruby23" + +EGIT_REPO_URI="https://gitlab.com/gitlab-org/gitlab-shell.git" +EGIT_COMMIT="v${PV}" + +inherit eutils git-r3 user + +DESCRIPTION="SSH access and repository management for GitLab" +HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-shell" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm ~arm64" +IUSE="" + +CDEPEND=" + >=dev-lang/go-1.8.3 + virtual/ruby-ssl" + +DEPEND="" +RDEPEND=" + >=dev-vcs/git-2.7.4 + dev-db/redis + virtual/ssh" + +RESTRICT="mirror" + +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 +} + +src_prepare() { + epatch "${FILESDIR}/0001-${PN}-4.1.1-config-paths.patch" + # 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" + cp "${FILESDIR}/${PN}-6.0.3-Makefile" "${WORKDIR}/${P}/Makefile" + eapply_user +} + +src_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}" + + # Gitaly stupidly hardcodes the path to config.yml :( + MY_CONF_FILE="${DEST_DIR}/config.yml" + dosym "${CONF_FILE}" "${MY_CONF_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}." +} From 3853ee8155d504e31b7c6e2470572e9e18136b19 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 9 Mar 2018 23:14:47 +0100 Subject: [PATCH 2/4] www-servers/gitlab-gitaly: Add ebuild for version 0.81.0, dependency of gitlab-ce-10.5.4 Package-Manager: Portage-2.3.19, Repoman-2.3.6 --- www-servers/gitlab-gitaly/ChangeLog | 6 +++ www-servers/gitlab-gitaly/Manifest | 3 +- .../gitlab-gitaly/gitlab-gitaly-0.81.0.ebuild | 40 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 www-servers/gitlab-gitaly/gitlab-gitaly-0.81.0.ebuild diff --git a/www-servers/gitlab-gitaly/ChangeLog b/www-servers/gitlab-gitaly/ChangeLog index a803e84..966ee5b 100644 --- a/www-servers/gitlab-gitaly/ChangeLog +++ b/www-servers/gitlab-gitaly/ChangeLog @@ -1,3 +1,9 @@ +*gitlab-gitaly-0.81.0 (09 Mar 2018) + + 09 Mar 2018; Manuel Friedli +gitlab-gitaly-0.81.0.ebuild: + www-servers/gitlab-gitaly: Add ebuild for version 0.81.0, dependency of + gitlab-ce-10.5.4 + 08 Mar 2018; Manuel Friedli -files/0001-gitlab-gitaly-0.10.0-fix-Makefile.patch, -files/0002-gitlab-gitaly-0.11.2-fix-config.toml.example.patch, diff --git a/www-servers/gitlab-gitaly/Manifest b/www-servers/gitlab-gitaly/Manifest index f659edd..63ac83b 100644 --- a/www-servers/gitlab-gitaly/Manifest +++ b/www-servers/gitlab-gitaly/Manifest @@ -13,5 +13,6 @@ EBUILD gitlab-gitaly-0.43.1.ebuild 1073 SHA256 594e68b869e53fe6fbdcf8fdade3889f5 EBUILD gitlab-gitaly-0.52.1.ebuild 1073 SHA256 594e68b869e53fe6fbdcf8fdade3889f55883b8b4ab17a2b064b3fd12a1ef739 SHA512 e3e7f045aa0565267bb516f685685c704841b5186dcca1282274ddd9392b734ac7808cb99d587ced3c87a357dc5af02bca99056386f0db0f9ecd07bba9e6e18e WHIRLPOOL 1329e9b461fe5c7386aa127a815602c655f8411a030537de9a247ea033723cfd60eb00a38e39cb775c985607b90b0e30fe55a9ef6856b49204a2ddc8427afa1c EBUILD gitlab-gitaly-0.59.2.ebuild 1073 SHA256 a9899ddb752550e82510d101a93286cb6b872b8faa53d008e55af3ddc2d2e685 SHA512 da7ba77fe0a9234c5e4f5994a3c7fa9c11a93cdd6f9cff3ab5a658f6a9385a0bea8f00cee878a43c9580632c9837c305b293e8609f3e284b958f7b514ef10c81 WHIRLPOOL e4b12a160c2cfc08da4fd36fcbde8dcd1f383acbd5211c50dfcea1610e4e5105ca9720f9f8c34a7ab41fe2c33a77d3129ae527fd94f3b8d0259e9c2e4ec9a027 EBUILD gitlab-gitaly-0.66.0.ebuild 1086 SHA256 bd5b1734d6354c2e7bbf6e815700b38c81f7325bf1d222b9c74576852529dcd3 SHA512 4fe2be263fbf16ab7f9f24f06f82d1a60b3b30322f3f72fc6ddd5a13763f137da3ce122b81d747bb8b4c733e0bb6fa7e53a51f5ce186f1690ae256b8712c41a6 WHIRLPOOL c3e34cda3ef250cefeb761e8b1b1c53fea6e22d7f21269000081f18a7858b8153256c770e01f5df1dfd43ba219172d4f74992f6244fef8ca166fb35fa6a21fc5 -MISC ChangeLog 5738 SHA256 e5fcf5e7943167e8a4c9b429d5dbaf032b718694f4412324c1bd9f7c2b75d6f1 SHA512 bf8b90a7911aa4437658608cc25d42bdfcb96fe225e65f79ec99fcaaea20e421d3cd2a26d441bf20cfd1b70650a51026dcb3c8e8838f50de13f6e24344c2d4bc WHIRLPOOL cfa2f4bf573d5699f00fb93348c08a79ad25de98cc52b64f2ce0302a07100ed25cc93938e70a33ebc801eeeb03709b8a4ca1b5b6f158272639c90977e83225e7 +EBUILD gitlab-gitaly-0.81.0.ebuild 1086 SHA256 bd5b1734d6354c2e7bbf6e815700b38c81f7325bf1d222b9c74576852529dcd3 SHA512 4fe2be263fbf16ab7f9f24f06f82d1a60b3b30322f3f72fc6ddd5a13763f137da3ce122b81d747bb8b4c733e0bb6fa7e53a51f5ce186f1690ae256b8712c41a6 WHIRLPOOL c3e34cda3ef250cefeb761e8b1b1c53fea6e22d7f21269000081f18a7858b8153256c770e01f5df1dfd43ba219172d4f74992f6244fef8ca166fb35fa6a21fc5 +MISC ChangeLog 5951 SHA256 6e37d5bd38c842a5d636cf81ab82ed5314e06d28192c7f070916d9b769525ac2 SHA512 540feebb4f1c2c2364b53616f7b34f5df5eff89c2bec3f38fab0372347894197e10df52ab17850f607c9e6e757f136363f234b46e1e02d5d15ad8913e407ec7a WHIRLPOOL 05168e62c4b892fd03b4adb9560792550ad447d4471251ca092f93843276039cc9df3bc2862b682f7488a6ce7ab5560e6aaca29f0848fe8f5a79b2cbedeef5be MISC metadata.xml 248 SHA256 7b43be15755627edf5c12cf1b50c607d781558640bf8375d685d51d7ade99a32 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 WHIRLPOOL 993013c9878ead35469db13d3072f694a341ee654182e0c31d0678f5dd6de4bdc8d59a0b7bb6d685dc41ea6b55dac518cd8034131baea8002170c680e50304d1 diff --git a/www-servers/gitlab-gitaly/gitlab-gitaly-0.81.0.ebuild b/www-servers/gitlab-gitaly/gitlab-gitaly-0.81.0.ebuild new file mode 100644 index 0000000..42c751f --- /dev/null +++ b/www-servers/gitlab-gitaly/gitlab-gitaly-0.81.0.ebuild @@ -0,0 +1,40 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +EGIT_REPO_URI="https://gitlab.com/gitlab-org/gitaly.git" +EGIT_COMMIT="v${PV}" + +inherit eutils git-r3 user + +DESCRIPTION="Gitaly is a Git RPC service for handling all the git calls made by GitLab." +HOMEPAGE="https://gitlab.com/gitlab-org/gitaly" +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm" + +DEPEND=">=dev-lang/go-1.8.3 + dev-ruby/bundler" +RDEPEND="${DEPEND}" + +src_prepare() { + epatch "${FILESDIR}/0001-${PN}-0.23.0-fix-Makefile.patch" + epatch "${FILESDIR}/0002-${PN}-0.66.0-fix-config.toml.example.patch" + eapply_user +} + +src_install() { + # TODO fowners, fperms on config.toml.example + insinto "/etc/gitlab" + newins "config.toml.example" "gitaly-config.toml" + newconfd "${FILESDIR}/${PN}-0.66.0.conf" "gitlab-gitaly" + newinitd "${FILESDIR}/${PN}-0.66.0.init" "gitlab-gitaly" + into "/usr" + newbin "gitaly" "gitlab-gitaly" + + # install gitaly-ruby + insinto "/var/lib/gitlab-gitaly" + doins -r "ruby" + fperms 0755 /var/lib/gitlab-gitaly/ruby/bin/{gitaly-ruby,ruby-cd} +} From 6c32a5aa6b25dce7081f5bf41f5db79dff4ca1a9 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 9 Mar 2018 23:26:22 +0100 Subject: [PATCH 3/4] www-servers/gitlab-workhorse: Add ebuild for version 3.6.0, dependency of gitlab-ce-10.5.4 Package-Manager: Portage-2.3.19, Repoman-2.3.6 --- www-servers/gitlab-workhorse/ChangeLog | 7 ++++ www-servers/gitlab-workhorse/Manifest | 3 +- .../gitlab-workhorse-3.6.0.ebuild | 42 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 www-servers/gitlab-workhorse/gitlab-workhorse-3.6.0.ebuild diff --git a/www-servers/gitlab-workhorse/ChangeLog b/www-servers/gitlab-workhorse/ChangeLog index 4cfb58a..ebb1d71 100644 --- a/www-servers/gitlab-workhorse/ChangeLog +++ b/www-servers/gitlab-workhorse/ChangeLog @@ -1,3 +1,10 @@ +*gitlab-workhorse-3.6.0 (09 Mar 2018) + + 09 Mar 2018; Manuel Friedli + +gitlab-workhorse-3.6.0.ebuild: + www-servers/gitlab-workhorse: Add ebuild for version 3.6.0, dependency of + gitlab-ce-10.5.4 + 08 Mar 2018; Manuel Friedli -gitlab-workhorse-1.4.2.ebuild, -gitlab-workhorse-1.4.3.ebuild, -gitlab-workhorse-2.0.0.ebuild, -gitlab-workhorse-2.1.1.ebuild, diff --git a/www-servers/gitlab-workhorse/Manifest b/www-servers/gitlab-workhorse/Manifest index 46c3536..2917d87 100644 --- a/www-servers/gitlab-workhorse/Manifest +++ b/www-servers/gitlab-workhorse/Manifest @@ -7,5 +7,6 @@ DIST gitlab-workhorse-3.3.1.tar.bz2 762376 SHA256 2ddbd4e0ad3db85fffdc8b932d1745 EBUILD gitlab-workhorse-3.0.0.ebuild 1012 SHA256 cd7d9f593221b3ef2baeea527060ef56178a71332af7a5bdfcd6285c49c9f329 SHA512 7c9d1bf373e2557b6a01f8fecfacf142322fed91cebc462a249f7cb1e02a953d4fd6bce2e8283adb6a9060c9a0cb2e7cb1b99da8a1926210c3d580589643fe0b WHIRLPOOL 61521ad8c87744395ada1300c5d3d237b2b356dd874232f371eb7ed2a6a90b29155cad810953a3f82d872318bbad6fb164fc9ac80a836a9d42326bb651e2a797 EBUILD gitlab-workhorse-3.2.0.ebuild 1012 SHA256 4dc3f893683d0fab13d4c0d43090df4bdcd5543dff4ca74940999cb797aa7312 SHA512 199d418e6a1e60b183a16f28f08cc20fa67771395d9f2da741227f102d40d71d91a5c27bb8d9741995a2aa117111dbffe6bea9ef854f3c35bb41ed81045ab88d WHIRLPOOL 07f534716e45600c9bb9912c1f7beca402067df7b572965e08e431f922327de541614952b37ec126bcb7bb6ae8d66fe4084f4183d75d2e686fd6888a4b866ea5 EBUILD gitlab-workhorse-3.3.1.ebuild 1012 SHA256 8e4f366570bcb05c2f6ee0d0a10787bea24210325db9b02e19c13188ddb1aded SHA512 0d1342b15450b3220490655e4951230aa168c5ce1bd0d77d4a6a7f25cb507563e9b58d590bc55b74f68bb0ee25c792bf39b90aea3709d2c2bbb42aac473ad5aa WHIRLPOOL 364597c47e6cb0a466b151eab5034eb963123b12d113bc354816521ded1aa48ca66d0d1d8ff310e2af35e3d180f5913dbeefbb757a7a24fe6c795d5bb2d563c8 -MISC ChangeLog 8215 SHA256 8cc84cf2a47a8c288d859139dee30885f559542e208332ff89a4e7a602d3e0e7 SHA512 c2ad7cead0d80427f6650ecd969742549882d5d3b484aa616601634eef137b355f789e038b7a71104503ab8309dbd47cf4c7cbab0ea625aff2fcc5a5d08937a9 WHIRLPOOL b402dccbedc808b881b0be435a25fa6d74c076660943ace7a206d991bfc6b4cff3fa1d7c97758c43b629f96a05a89d126334e0a7ce4969b16c7b39c58ae84a22 +EBUILD gitlab-workhorse-3.6.0.ebuild 906 SHA256 515e048de7cd29e69d2fc5fd3a22cd36ad888728b16e36992f37fc4385c47c51 SHA512 bd0ad38426aa81c91bd50d0e2ffc7e8e5f82442481b1b96d34e8058331d5683c9193e49b250b180369876166f45886c2962e08951d904d122a2aa9f2ad620022 WHIRLPOOL 23db86ad21323083fc5b79772e1c76e7fb08e9dc766d0e31f94323bb9d42a9bcb3315aef1b22828276ffc62e88aa9b2c27f34b87243a72c95ebd51c3e1d8463e +MISC ChangeLog 8436 SHA256 ecaca76a19719827c910fd31344f526bac54a237d45420aaa5c6331482591ed5 SHA512 38b2c48769e4b94764c7ab2d119a932950f863f99d2741065292842a24dbbabb1bbbcf1bb3552ad53e60fa4db0f3ab52642bf60224fe795a87644951a795c7d4 WHIRLPOOL 524137e12a10f8a3675c2c79080920458862a376af1fcf4c9f9b1a67eaf2c5c000aabd334b36d134de8f9857674aa7007a4ba675bcba219ecf689d6ebea3ec85 MISC metadata.xml 248 SHA256 7b43be15755627edf5c12cf1b50c607d781558640bf8375d685d51d7ade99a32 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 WHIRLPOOL 993013c9878ead35469db13d3072f694a341ee654182e0c31d0678f5dd6de4bdc8d59a0b7bb6d685dc41ea6b55dac518cd8034131baea8002170c680e50304d1 diff --git a/www-servers/gitlab-workhorse/gitlab-workhorse-3.6.0.ebuild b/www-servers/gitlab-workhorse/gitlab-workhorse-3.6.0.ebuild new file mode 100644 index 0000000..db8d319 --- /dev/null +++ b/www-servers/gitlab-workhorse/gitlab-workhorse-3.6.0.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +EGIT_REPO_URI="https://gitlab.com/gitlab-org/gitlab-workhorse.git" +EGIT_COMMIT="v${PV}" + +inherit eutils git-r3 user + +DESCRIPTION="This is the new backend for Git-over-HTTP communication needed for GitLab >= 8.4" +HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-workhorse" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm ~arm64" + +DEPEND=">=dev-lang/go-1.8.3" + +RESTRICT="mirror" + +src_prepare() { + epatch "${FILESDIR}/0001-fix-Makefile.patch" + sed -i -e "s/@@VERSION@@/${PV}/" Makefile + eapply_user +} + +src_install() { + local dest=/usr/bin + + diropts -m755 + dodir ${dest} + + exeinto ${dest} + for f in "${PN}" gitlab-zip-cat gitlab-zip-metadata ; do + doexe "${S}/${f}" + done + + ## RC script ## + newinitd "${FILESDIR}/${PN}-0.8.2.init" "${PN}" + newconfd "${FILESDIR}/${PN}-0.8.2.conf" "${PN}" +} From e0d22e8663740963934f9461468e66dd04c530de Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 9 Mar 2018 23:46:53 +0100 Subject: [PATCH 4/4] www-apps/gitlab-ce: Add ebuild for version 10.5.4 Package-Manager: Portage-2.3.19, Repoman-2.3.6 --- www-apps/gitlab-ce/ChangeLog | 5 + www-apps/gitlab-ce/Manifest | 3 +- www-apps/gitlab-ce/gitlab-ce-10.5.4.ebuild | 430 +++++++++++++++++++++ 3 files changed, 437 insertions(+), 1 deletion(-) create mode 100644 www-apps/gitlab-ce/gitlab-ce-10.5.4.ebuild diff --git a/www-apps/gitlab-ce/ChangeLog b/www-apps/gitlab-ce/ChangeLog index a8f48c6..bde425f 100644 --- a/www-apps/gitlab-ce/ChangeLog +++ b/www-apps/gitlab-ce/ChangeLog @@ -1,3 +1,8 @@ +*gitlab-ce-10.5.4 (09 Mar 2018) + + 09 Mar 2018; Manuel Friedli +gitlab-ce-10.5.4.ebuild: + www-apps/gitlab-ce: Add ebuild for version 10.5.4 + *gitlab-ce-10.4.5 (09 Mar 2018) 09 Mar 2018; Manuel Friedli +gitlab-ce-10.4.5.ebuild, diff --git a/www-apps/gitlab-ce/Manifest b/www-apps/gitlab-ce/Manifest index ba3c550..13a2cd1 100644 --- a/www-apps/gitlab-ce/Manifest +++ b/www-apps/gitlab-ce/Manifest @@ -26,6 +26,7 @@ EBUILD gitlab-ce-10.1.7.ebuild 13679 SHA256 9c1bec7e86d46422f87baecaece80197c506 EBUILD gitlab-ce-10.2.8.ebuild 13681 SHA256 0e02e1a51f335872facce2751aa23d8ff5b9cd8aa7359fed1cd0f5a3ed5bd1e7 SHA512 805d6a717b0dcdc6551f549722abb8322a51d6cee1eb807dabac1fe4b98ffd32fcf3667d1de7f845a08e9dfb72afa257c51c6382cbc48f5f23fe15b027724dde WHIRLPOOL 1c48b8ea54d65d1d2ea001c6af45c0a76f0587d815353675ce36245c721f4b2d9c5b48c608fe632743863f5db859c5ee0c96b95fe6b429fcdd7053d4e8fb86e8 EBUILD gitlab-ce-10.3.7.ebuild 14085 SHA256 cbff8442516b815e386974191d48464202b3b4f93e5d4688a71de08fadaeb89c SHA512 311e256f675c6cbb8e374448858e0adcfecd6a5432c4384a5d9c302a3c82dcab0aab0eb9a79d90f8f770dba0d1d984f0b7e3d53ce1e3b2c4c915aaa2facdbdd7 WHIRLPOOL 29674dc1a54311518047df70ecd21971b642bc7b8511d8c6ba3f754b7beae3de10c289704dcd214c7c5cf76f60772117c2649daac4d691b13387d758d2fb3f36 EBUILD gitlab-ce-10.4.5.ebuild 13152 SHA256 69e512b9a7bad02d6d9b848c08f070914ab59c74444c93185bfc05ea08decf18 SHA512 ac8d91aa7b4e8bebc4fbca44d413ff7c8f9549d340de730341ee026328dc25220d6e34b31dac86383d48c8b6cc465eb01a0fb601e944c20966e2016adc7d0024 WHIRLPOOL 6f14b737b117cb43b8551fc5f5fcfb79910db8496ef60b26dff758ce669fc47d910c003222f595e0635c22c16a4d05df0b39d2628ea20f9a46a5bdc3039ebaea +EBUILD gitlab-ce-10.5.4.ebuild 13151 SHA256 e1724882844511b0c8c08f5a107a3c2d07523fa4f8048db82054729da74a8b83 SHA512 f183a12556bd1725dee258c1cab48dae81d4b4b5a709c2500177baf948537875a488c826fbf779db76ef5692253ac7189d6d3f8e8b38082e821df7e68bb812ee WHIRLPOOL d30f3a3071adc297198f7ed762741e45bd0a8ba2d0a8e96ca8a6ab1d0f6311dfec81ac316730907e3c79a96a60b25f27c6f9379508d34e3f246e64781aa614e7 EBUILD gitlab-ce-9.5.10.ebuild 13526 SHA256 6e7c361f31989dd608eff4c8dd01b7301b142b4d38acdf38e61e2eecb2d4b285 SHA512 e33e56c8e49bd2ef03dd9af508b186f7908b8502960cbdb95ca9166631b84d5357c4965c0919e432ee5de9b9eeb33f68773ac405c24430568f9abb0d8e7354a6 WHIRLPOOL 3e866d785e8018096a92a223a2f6cedf4398cc07726a183d805005b3cd718fed2296edd63f5bc9d2b8849fe2298e9a61bf998a2241de2cd5ab4527f8ddaed325 -MISC ChangeLog 27106 SHA256 957db66c97c8d5f5e346ede41e552bfc0eb410cca091c487278b500aa96c220f SHA512 006a5369989cb5bf71dbf637fb1ee8e00ebcd31429dc08583e6039070bdeb4260384f1910991f2a599a06acdd268d973b54173540ab69fe0fdc598a80e3943e4 WHIRLPOOL 8444b3ff899d10ffce2117b938e95224338d573074003cadf8eb0c71b837a8c810509008b80f59973583c455dadcde61388cd90e6f837269b5befab63ab750c3 +MISC ChangeLog 27270 SHA256 d4ee055a78ca09005d0d9ebe5a26c6dc210e5398b4508335154820da2b9a500d SHA512 25c80ba0e6269583cbc1d3815eff9faf2d0f58c566b9dd683ee87b6908f3ef9ece6834a0815da450d16c9ee22bf77d04e7a6b349e9e0aebef65e8f2c587e03e6 WHIRLPOOL 0dd92f0533ef0e5bdbc22cfc30acaf0501551c7ccf1b4aa34bacce4229fce3a1a7a55094c739b01c0f48d68a2b73e2f2944954f0b70f9a5e5ad1ce851c10fbd1 MISC metadata.xml 665 SHA256 2a0cd67ad42f0cc6d8b88391cf6e3153a9883dab31aae8227c57c95f3f68890d SHA512 64b8fbae373d0a057f705f64c1d097dbfab893bd585e1db65ccdb06cda9569211c9b63fa168ac8de9f6d512a17759ecd20b54d818d2790a6f4c99d0ca73fddc3 WHIRLPOOL a81b21bb46aad9757a502628033eba546c686b83bbf1d651ecabba273c454cfb64574affc180db8358ced87eb638e8ad13d7c79c4cfb9a31e72c577d21ab433e diff --git a/www-apps/gitlab-ce/gitlab-ce-10.5.4.ebuild b/www-apps/gitlab-ce/gitlab-ce-10.5.4.ebuild new file mode 100644 index 0000000..2e5c595 --- /dev/null +++ b/www-apps/gitlab-ce/gitlab-ce-10.5.4.ebuild @@ -0,0 +1,430 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +# 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="ruby23" + +EGIT_REPO_URI="https://gitlab.com/gitlab-org/${PN}.git" +EGIT_COMMIT="v${PV}" +EGIT_CHECKOUT_DIR="${WORKDIR}/all" + +inherit eutils git-r3 ruby-ng user systemd + +GITLAB_GITALY_VERSION="0.81.0" +GITLAB_PAGES_VERSION="0.6.1" +GITLAB_SHELL_VERSION="6.0.3" +GITLAB_WORKHORSE_VERSION="3.6.0" + +DESCRIPTION="GitLab is a free project and repository management application" +HOMEPAGE="https://about.gitlab.com/" + +RESTRICT="mirror" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~arm64" +IUSE="kerberos mysql +postgres +unicorn systemd pages 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-libs/re2 + dev-util/ragel + >=net-libs/nodejs-6.0.0 + >=sys-apps/yarn-0.17.0 + postgres? ( >=dev-db/postgresql-9.6:* ) + mysql? ( virtual/mysql ) + kerberos? ( virtual/krb5 )" +CDEPEND=" + dev-util/cmake + virtual/pkgconfig" +COMMON_DEPEND=" + ${GEMS_DEPEND} + ~dev-vcs/gitlab-shell-${GITLAB_SHELL_VERSION} + >=dev-vcs/git-2.8.4 + ~www-servers/gitlab-workhorse-${GITLAB_WORKHORSE_VERSION} + kerberos? ( !app-crypt/heimdal ) + rugged_use_system_libraries? ( net-libs/http-parser dev-libs/libgit2:0/26 ) + pages? ( ~www-servers/gitlab-pages-${GITLAB_PAGES_VERSION} ) + ~www-servers/gitlab-gitaly-${GITLAB_GITALY_VERSION}" +DEPEND=" + ${CDEPEND} + ${COMMON_DEPEND}" +RDEPEND=" + ${COMMON_DEPEND} + >=dev-db/redis-2.8 + virtual/mta + systemd? ( sys-apps/systemd:0= )" +ruby_add_bdepend " + virtual/rubygems + >=dev-ruby/bundler-1.15.4" + +# +# 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 +# +PATCHES=( + "${FILESDIR}/01-${PN}-8.7.5-fix-sendmail-config.patch" + "${FILESDIR}/02-${PN}-9.0.0-fix-redis-config-path.patch" + "${FILESDIR}/03-${PN}-10.2.8-database.yml.patch" + "${FILESDIR}/04-${PN}-9.3.0-fix-check-task.patch" + "${FILESDIR}/05-${PN}-9.0.0-replace-sys-filesystem.patch" + "${FILESDIR}/06-${PN}-8.17.0-fix-webpack-config.patch" + "${FILESDIR}/08-${PN}-10.4.4-general-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}" + +all_ruby_unpack() { + git-r3_fetch + git-r3_checkout +} + +all_ruby_prepare() { + # fix paths + sed -i \ + -e "s|/home/git/gitlab/tmp|/run/${MY_NAME}|g" \ + 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}"/ + 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-10.4.4-sidekiq.init + use unicorn && rcscript=gitlab-10.4.4-unicorn.init + + cp "${FILESDIR}/${rcscript}" "${T}" || die + sed -i \ + -e "s|@USER@|${MY_USER}|g" \ + -e "s|@GITLAB_BASE@|${dest}|g" \ + -e "s|@LOGS_DIR@|${logs}|g" \ + "${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 you're using OpenRC, you can use the following command:" + elog + elog " /etc/init.d/gitlab backup" + 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 + if use mysql ; then + ewarn "You must grant the GitLab user permissions the following on the database:" + ewarn " mysql -u root -p -e \\" + ewarn " \"GRANT TRIGGER ON \`gitlab\`.* TO 'gitlab'@'localhost';\"" + ewarn "PLEASE also read this document about needed migrations on MySQL:" + ewarn + ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md" + ewarn + ewarn "Failing to follow those instructions may make the config phase fail!" + 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 + + if use mysql ; then + ewarn "Please only proceed if you've read and understood the following page:" + ewarn "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md" + if [ "${update}" = 'true' ]; then + ewarn "Failing to follow those instructions may cause the upgrade to fail" + fi + ewarn + fi + + ewarn "Now is a good time to create a backup of your Gitlab installation, just in case." + ewarn "To do so, abort this configuration with Ctrl+C and type the following commands:" + ewarn " cd /opt/gitlab" + ewarn " sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production" + ewarn + ewarn "Press Ctrl+C to abort now or any key to continue." + read + + ## Initialize app ## + + local RAILS_ENV="production" + local RUBY=${RUBY:-/usr/bin/ruby} + local BUNDLE="${RUBY} /usr/bin/bundle" + + if [ "${update}" = 'true' ]; then + einfo "Migrating database ..." + exec_rake db:migrate + + einfo "Compiling GetText PO files ..." + exec_rake gettext:compile + + # https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496 + einfo "Migrating iids ..." + exec_rake migrate_iids + + einfo "Installing npm modules ..." + exec_rake yarn:install + + einfo "Cleaning old precompiled assets ..." + exec_rake gitlab: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 + + einfo "Compiling GetText PO files ..." + exec_rake gettext:pack + exec_rake gettext:po_to_json + + einfo "Installing npm modules ..." + exec_rake yarn:install + fi + + einfo "Precompiling assests ..." + exec_rake gitlab:assets:compile + + 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} NODE_ENV=${RAILS_ENV}" + + echo " ${command}" + su -l ${MY_USER} -c " + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; export NODE_PATH=${DEST_DIR}/node_modules + cd ${DEST_DIR} + ${command}" \ + || die "failed to run rake $@" +}