Gentoo Archives: gentoo-commits

From: Marc Schiffbauer <mschiff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/mschiff:master commit in: www-apps/gitlabhq/files/, www-apps/gitlabhq/
Date: Wed, 21 May 2014 22:49:41
Message-Id: 1400712423.e7dcf1da9772f20f4a02492c26ff057efbc629f6.mschiff@gentoo
1 commit: e7dcf1da9772f20f4a02492c26ff057efbc629f6
2 Author: Marc Schiffbauer <mschiff <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 21 22:47:03 2014 +0000
4 Commit: Marc Schiffbauer <mschiff <AT> gentoo <DOT> org>
5 CommitDate: Wed May 21 22:47:03 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/mschiff.git;a=commit;h=e7dcf1da
7
8 added gitlabhq ebuidld (based on cvut overlay)
9
10 ---
11 www-apps/gitlabhq/Manifest | 10 +
12 www-apps/gitlabhq/files/gitlab-sidekiq.init | 43 +++
13 www-apps/gitlabhq/files/gitlab-unicorn-6.init | 67 ++++
14 .../files/gitlabhq-6.0.2-fix-sendmail-config.patch | 20 ++
15 .../gitlabhq-6.8.2-email-custom-reply_to.patch | 36 ++
16 .../files/gitlabhq-6.8.2-fix-gemfile.patch | 86 +++++
17 .../gitlabhq-6.8.2-fix-project-name-regex.patch | 30 ++
18 .../files/gitlabhq-6.8.2-ldap-custom-mapping.patch | 99 ++++++
19 www-apps/gitlabhq/gitlabhq-6.8.2.ebuild | 362 +++++++++++++++++++++
20 www-apps/gitlabhq/metadata.xml | 19 ++
21 10 files changed, 772 insertions(+)
22
23 diff --git a/www-apps/gitlabhq/Manifest b/www-apps/gitlabhq/Manifest
24 new file mode 100644
25 index 0000000..e0c345b
26 --- /dev/null
27 +++ b/www-apps/gitlabhq/Manifest
28 @@ -0,0 +1,10 @@
29 +AUX gitlab-sidekiq.init 979 SHA256 f9bc02031b0418e4c765fae37bb40cd9e16dbe5b1a7f5c105a2d7ba3568b0195 SHA512 e3311f1110fca02a378a9f74704d9241884a1973e90be1dbd663809b524528eda25e3ad0ac5d20737f6ccd78343582557ac579adb976473f8aabc0320172921f WHIRLPOOL 365d539cceacb5ff9171aa7316ac061ef4b4a8d63e6d4a26395afb841878a08bdd1b9bf2709602dc90f15a1ed5ff8566a0e8239e8ab9184e84814a16993f3aeb
30 +AUX gitlab-unicorn-6.init 1663 SHA256 ba211c63d559cbca510483d5536d28131e08f67dc8914444a2c85b27c7a92b60 SHA512 a574b3bb5b9af3e3a707045ac6d783bab73bab1db033d07999b3d06789da0853bc3de0bba39a3c154e5b1ab385926ee3ec4487f4c797708a318fa5df22827069 WHIRLPOOL 497cf52ebb4b33cc6bbd81e53d4961878b2ea9dc42bacabf7a32686e52a54c22eed73836705e80714d7b759cfd2ee1929e6aa12083435f265c472270e158f72a
31 +AUX gitlabhq-6.0.2-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60
32 +AUX gitlabhq-6.8.2-email-custom-reply_to.patch 2014 SHA256 7b0a66c3dde960aac805d1b2780be1166135f7b124e1f3a4861fae2f04543c01 SHA512 2c1da90d46ce57dad00df7a55f0af6ab1eca4e09a96580f8482dcff2188d351ce21f1bd366894e64eb1888904f6a8fddc4dec34d88af06e95946c0be834364e2 WHIRLPOOL bf126a9486fab62bdd921459c8d21e13c5de85542dde129e773057ccf9e80662b923f0bc84e2476735c8dafdb5800c6e7249450a37ad04be39d70e766af2ffd3
33 +AUX gitlabhq-6.8.2-fix-gemfile.patch 2263 SHA256 584966eb3efc63a6102754e165c46d50b037e3ea046a2fe1cfc24b53bf03bdea SHA512 9bd6490e86dcc830c759210dc6ceed101c177cee06bc4427398ed03fba8e128413b4cb04317e081b765df5c39987219c2bc1ce5538479ec39d3bcf5d253bb9e0 WHIRLPOOL 8d9dbafd45d61cb23e3126192666e671b8b8d46bc1898c976aa335fb58546c11885b14e370e45ca5dff01a68de7b555a9ae0a8a325f818c54e4e617704c360dd
34 +AUX gitlabhq-6.8.2-fix-project-name-regex.patch 1376 SHA256 71f6c2ebbe3af6012cf523535699001d86c4ad925cc7b78d179a3ec7002ddf9b SHA512 c2fe0959486e2bd05b856a8c9f710a89709fee77bf0c490fffcbf2b014223aed761ad1e1ef42ea3412f595066cf109937fb02135ec4c70c64330c48780bb7655 WHIRLPOOL 8003eb841390e5c5edde24b05a408d9982aeaba0cbccbd7824fbd8d469c445be3bcc46e2d58712fa7de0b8d3aabc9e85a33211071a58b9d2a0f43d97eb8b44ba
35 +AUX gitlabhq-6.8.2-ldap-custom-mapping.patch 3276 SHA256 d335fc980a891a7a24cbb96ec7a4109bb3fc3a89ebc8c797d787e69fff74e7d2 SHA512 7cb523db97986eb94d0feda7be0eb8f400b9df744f25a44a783925059ae97671400bebfbe75b6d803640e4eb828abea193dcde26a2e6d5f103dc9d0913772365 WHIRLPOOL 76d81fd7075bb6dd52b622c6f2147393dd5fcf8e42addb82e9431a019c445f5703a77f31db71a62e05561eb05be8195bf05da0be83cd20db57659a057f7b0481
36 +DIST gitlabhq-6.8.2.tar.gz 10558471 SHA256 db9400d5ffadd3564bbee6e388c90d7f4c8f88450e67213aad11df2d137534ec SHA512 0f57c6bb3b9e89a5bbf7ae4c774e54480518f185f2e50270a7dd921eb2a2322f3e6866ca70741582fad4f99b372ba025fbab15108c291d53ebf04cfaec2f9b75 WHIRLPOOL 73ebd0fb0faef7afd48398ec4e73c8f4175f3dc2a9450ae391b4d3a66b54e0d77f901f518738eb98cc267691559094d4ebecd4c0a7c18fa671c3a1aee4dfe4d2
37 +EBUILD gitlabhq-6.8.2.ebuild 10719 SHA256 cf723823af2609d9918dbe91302d7795ba49d57f2861ba98fb3512c05c6160fc SHA512 292f615eba6d5cd0e5b9789a94d114dc4299663fcfd4a4a839f769ae141a4d9deae030b6f69c7ad66da9b39ae9502cb284259515d5f584138ab7f86fbc5860ad WHIRLPOOL e4ec260a9ceecb8f18c44f0ba5ff5707bb40324d9fb17cdc331cd08de668ae818d11d9db7bf6534c03bcbd3b8c9f4dd91af55b1670b830b95636699436e398b4
38 +MISC metadata.xml 475 SHA256 65a46fa9904c8b7657181e4929f304675a2173e9329aa8fb5d8645515032168f SHA512 b2aa4c167c6287e60bb62a45e3d48fa00a8b080e0f81a966388dd8a1fbc2012f9737d5f02134382e5a0b212b38781c15b0fdf2508fe6b4b7630a8fcebe713065 WHIRLPOOL 5b5f73953ba7b23b7f9590da5f2e22a0930880ceb37eb87c25a8e043943671da1fcf8f561f76d2c262a1f514cb917140c99d77d9f4e448ed260b1a5127603195
39
40 diff --git a/www-apps/gitlabhq/files/gitlab-sidekiq.init b/www-apps/gitlabhq/files/gitlab-sidekiq.init
41 new file mode 100644
42 index 0000000..99b2d17
43 --- /dev/null
44 +++ b/www-apps/gitlabhq/files/gitlab-sidekiq.init
45 @@ -0,0 +1,43 @@
46 +#!/sbin/runscript
47 +
48 +name="GitLab Sidekiq"
49 +description="Sidekiq for GitLab @SLOT@"
50 +
51 +: ${gitlab_user:=@USER@}
52 +: ${gitlab_base:="@GITLAB_BASE@"}
53 +: ${rails_env:=production}
54 +
55 +: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
56 +: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
57 +: ${sidekiq_queues:="@QUEUES@"}
58 +
59 +sidekiq_command="/usr/bin/bundle"
60 +sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
61 +
62 +depend() {
63 + need redis
64 + use net
65 +}
66 +
67 +start() {
68 + checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
69 +
70 + ebegin "Starting ${name} - Sidekiq"
71 +
72 + start-stop-daemon --start \
73 + --background --quiet \
74 + --chdir "${gitlab_base}" \
75 + --user=${gitlab_user} \
76 + --pidfile="${sidekiq_pidfile}" \
77 + --env RAILS_ENV=${rails_env} \
78 + --exec ${sidekiq_command} -- ${sidekiq_command_args}
79 + eend $?
80 +}
81 +
82 +stop() {
83 + ebegin "Stopping ${name} - Sidekiq"
84 + start-stop-daemon --stop \
85 + --pidfile=${sidekiq_pidfile} \
86 + --exec ${sidekiq_command}
87 + eend $?
88 +}
89
90 diff --git a/www-apps/gitlabhq/files/gitlab-unicorn-6.init b/www-apps/gitlabhq/files/gitlab-unicorn-6.init
91 new file mode 100644
92 index 0000000..382be7a
93 --- /dev/null
94 +++ b/www-apps/gitlabhq/files/gitlab-unicorn-6.init
95 @@ -0,0 +1,67 @@
96 +#!/sbin/runscript
97 +
98 +name="GitLab-@SLOT@"
99 +description="GitLab @SLOT@ on Unicorns"
100 +
101 +: ${gitlab_user:=@USER@}
102 +: ${gitlab_base:="@GITLAB_BASE@"}
103 +: ${rails_env:=production}
104 +
105 +: ${server_pidfile:="/run/gitlab/unicorn.pid"}
106 +
107 +: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
108 +: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
109 +: ${sidekiq_queues:="@QUEUES@"}
110 +
111 +server_command="/usr/bin/bundle"
112 +server_command_args="exec unicorn_rails -c ${gitlab_base}/config/unicorn.rb -E ${rails_env} -D"
113 +
114 +sidekiq_command="/usr/bin/bundle"
115 +sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
116 +
117 +depend() {
118 + provide gitlab
119 + need redis
120 + use net
121 +}
122 +
123 +start() {
124 + ebegin "Starting ${name} - Unicorn servers"
125 +
126 + checkpath -d -o ${gitlab_user} -m755 "$(dirname "${server_pidfile}")"
127 + checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
128 +
129 + start-stop-daemon --start \
130 + --chdir "${gitlab_base}" \
131 + --user=${gitlab_user} \
132 + --pidfile="${server_pidfile}" \
133 + --env RAILS_ENV=${rails_env} \
134 + --exec ${server_command} -- ${server_command_args}
135 + eend $?
136 +
137 + ebegin "Starting ${name} - Sidekiq"
138 +
139 + start-stop-daemon --start \
140 + --background --quiet \
141 + --chdir "${gitlab_base}" \
142 + --user=${gitlab_user} \
143 + --pidfile="${sidekiq_pidfile}" \
144 + --env RAILS_ENV=${rails_env} \
145 + --exec ${sidekiq_command} -- ${sidekiq_command_args}
146 + eend $?
147 +}
148 +
149 +stop() {
150 + ebegin "Stopping ${name} - Sidekiq"
151 + start-stop-daemon --stop \
152 + --pidfile=${sidekiq_pidfile} \
153 + --exec ${sidekiq_command}
154 + eend $?
155 +
156 + ebegin "Stopping ${name} - Unicorn servers"
157 + start-stop-daemon --stop \
158 + --signal QUIT \
159 + --pidfile=${server_pidfile} \
160 + --exec ${server_command}
161 + eend $?
162 +}
163
164 diff --git a/www-apps/gitlabhq/files/gitlabhq-6.0.2-fix-sendmail-config.patch b/www-apps/gitlabhq/files/gitlabhq-6.0.2-fix-sendmail-config.patch
165 new file mode 100644
166 index 0000000..0a6e8d9
167 --- /dev/null
168 +++ b/www-apps/gitlabhq/files/gitlabhq-6.0.2-fix-sendmail-config.patch
169 @@ -0,0 +1,20 @@
170 +diff --git a/config/environments/production.rb b/gitlab-6/environments/production.rb
171 +index 82eb250..10e25e5 100644
172 +--- a/config/environments/production.rb
173 ++++ b/config/environments/production.rb
174 +@@ -73,11 +73,10 @@ Gitlab::Application.configure do
175 + # config.active_record.auto_explain_threshold_in_seconds = 0.5
176 +
177 + config.action_mailer.delivery_method = :sendmail
178 +- # Defaults to:
179 +- # # config.action_mailer.sendmail_settings = {
180 +- # # location: '/usr/sbin/sendmail',
181 +- # # arguments: '-i -t'
182 +- # # }
183 ++ config.action_mailer.sendmail_settings = {
184 ++ location: '/usr/sbin/sendmail',
185 ++ arguments: '-i'
186 ++ }
187 + config.action_mailer.perform_deliveries = true
188 + config.action_mailer.raise_delivery_errors = true
189 + end
190
191 diff --git a/www-apps/gitlabhq/files/gitlabhq-6.8.2-email-custom-reply_to.patch b/www-apps/gitlabhq/files/gitlabhq-6.8.2-email-custom-reply_to.patch
192 new file mode 100644
193 index 0000000..319da52
194 --- /dev/null
195 +++ b/www-apps/gitlabhq/files/gitlabhq-6.8.2-email-custom-reply_to.patch
196 @@ -0,0 +1,36 @@
197 +diff -ur gitlabhq-6.8.2.orig/app/mailers/notify.rb gitlabhq-6.8.2/app/mailers/notify.rb
198 +--- gitlabhq-6.8.2.orig/app/mailers/notify.rb 2014-05-12 11:15:38.000000000 +0200
199 ++++ gitlabhq-6.8.2/app/mailers/notify.rb 2014-05-21 21:15:49.607758248 +0200
200 +@@ -16,7 +16,7 @@
201 + default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root
202 +
203 + default from: Proc.new { default_sender_address.format }
204 +- default reply_to: "noreply@#{Gitlab.config.gitlab.host}"
205 ++ default reply_to: Gitlab.config.gitlab.email_reply_to
206 +
207 + # Just send email with 2 seconds delay
208 + def self.delay
209 +diff -ur gitlabhq-6.8.2.orig/config/gitlab.yml.example gitlabhq-6.8.2/config/gitlab.yml.example
210 +--- gitlabhq-6.8.2.orig/config/gitlab.yml.example 2014-05-12 11:15:38.000000000 +0200
211 ++++ gitlabhq-6.8.2/config/gitlab.yml.example 2014-05-21 21:16:46.744345902 +0200
212 +@@ -37,6 +37,9 @@
213 + # Email address used in the "From" field in mails sent by GitLab
214 + email_from: gitlab@localhost
215 +
216 ++ # Email address used in the "Reply-To" field in mails send by GitLab (default: no-reply@<host>)
217 ++ email_reply_to: no-reply@localhost
218 ++
219 + # Email address of your support contact (default: same as email_from)
220 + support_email: support@localhost
221 +
222 +diff -ur gitlabhq-6.8.2.orig/config/initializers/1_settings.rb gitlabhq-6.8.2/config/initializers/1_settings.rb
223 +--- gitlabhq-6.8.2.orig/config/initializers/1_settings.rb 2014-05-12 11:15:38.000000000 +0200
224 ++++ gitlabhq-6.8.2/config/initializers/1_settings.rb 2014-05-21 21:17:24.905406287 +0200
225 +@@ -78,6 +78,7 @@
226 + Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || ''
227 + Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
228 + Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
229 ++Settings.gitlab['email_reply_to'] ||= "no-reply@#{Settings.gitlab.host}"
230 + Settings.gitlab['support_email'] ||= Settings.gitlab.email_from
231 + Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
232 + Settings.gitlab['user'] ||= 'git'
233
234 diff --git a/www-apps/gitlabhq/files/gitlabhq-6.8.2-fix-gemfile.patch b/www-apps/gitlabhq/files/gitlabhq-6.8.2-fix-gemfile.patch
235 new file mode 100644
236 index 0000000..7bc7218
237 --- /dev/null
238 +++ b/www-apps/gitlabhq/files/gitlabhq-6.8.2-fix-gemfile.patch
239 @@ -0,0 +1,86 @@
240 +diff -ur gitlabhq-6.8.2.orig/Gemfile gitlabhq-6.8.2/Gemfile
241 +--- gitlabhq-6.8.2.orig/Gemfile 2014-05-12 11:15:38.000000000 +0200
242 ++++ gitlabhq-6.8.2/Gemfile 2014-05-22 00:21:48.158938691 +0200
243 +@@ -142,6 +142,10 @@
244 + # Sanitize user input
245 + gem "sanitize", '~> 2.0'
246 +
247 ++# The newer revision of charlock_holmes that is finally fixed to
248 ++# be compatible with Gentoo
249 ++gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
250 ++
251 + # Protect against bruteforcing
252 + gem "rack-attack"
253 +
254 +@@ -151,7 +155,6 @@
255 + gem "sass-rails", '~> 4.0.2'
256 + gem "coffee-rails"
257 + gem "uglifier"
258 +-gem "therubyracer"
259 + gem 'turbolinks'
260 + gem 'jquery-turbolinks'
261 +
262 +diff -ur gitlabhq-6.8.2.orig/Gemfile.lock gitlabhq-6.8.2/Gemfile.lock
263 +--- gitlabhq-6.8.2.orig/Gemfile.lock 2014-05-12 11:15:38.000000000 +0200
264 ++++ gitlabhq-6.8.2/Gemfile.lock 2014-05-22 00:24:39.954746019 +0200
265 +@@ -1,3 +1,10 @@
266 ++GIT
267 ++ remote: https://github.com/brianmario/charlock_holmes.git
268 ++ revision: dde194609b3513b0d2369ce8f916ae52566154b4
269 ++ ref: dde194609b3513b0d2369ce8f916ae52566154b4
270 ++ specs:
271 ++ charlock_holmes (0.6.9.4)
272 ++
273 + GEM
274 + remote: https://rubygems.org/
275 + specs:
276 +@@ -60,7 +67,6 @@
277 + json (>= 1.7)
278 + celluloid (0.15.2)
279 + timers (~> 1.1.0)
280 +- charlock_holmes (0.6.9.4)
281 + cliver (0.2.2)
282 + code_analyzer (0.4.3)
283 + sexp_processor
284 +@@ -267,7 +273,6 @@
285 + addressable (~> 2.3)
286 + letter_opener (1.1.2)
287 + launchy (~> 2.2)
288 +- libv8 (3.16.14.3)
289 + listen (2.3.1)
290 + celluloid (>= 0.15.2)
291 + rb-fsevent (>= 0.9.3)
292 +@@ -402,7 +407,6 @@
293 + redis-store (~> 1.1.0)
294 + redis-store (1.1.4)
295 + redis (>= 2.2)
296 +- ref (1.0.5)
297 + require_all (1.3.2)
298 + rest-client (1.6.7)
299 + mime-types (>= 1.16)
300 +@@ -496,9 +500,6 @@
301 + term-ansicolor (1.2.2)
302 + tins (~> 0.8)
303 + test_after_commit (0.2.2)
304 +- therubyracer (0.12.0)
305 +- libv8 (~> 3.16.14.0)
306 +- ref
307 + thin (1.6.1)
308 + daemons (>= 1.0.9)
309 + eventmachine (>= 1.0.0)
310 +@@ -567,6 +568,7 @@
311 + bootstrap-sass (~> 3.0)
312 + capybara
313 + carrierwave
314 ++ charlock_holmes!
315 + coffee-rails
316 + colored
317 + coveralls
318 +@@ -654,7 +656,6 @@
319 + stamp
320 + state_machine
321 + test_after_commit
322 +- therubyracer
323 + thin
324 + tinder (~> 1.9.2)
325 + turbolinks
326
327 diff --git a/www-apps/gitlabhq/files/gitlabhq-6.8.2-fix-project-name-regex.patch b/www-apps/gitlabhq/files/gitlabhq-6.8.2-fix-project-name-regex.patch
328 new file mode 100644
329 index 0000000..8f986c1
330 --- /dev/null
331 +++ b/www-apps/gitlabhq/files/gitlabhq-6.8.2-fix-project-name-regex.patch
332 @@ -0,0 +1,30 @@
333 +diff -ur gitlabhq-6.8.2.orig/app/models/project.rb gitlabhq-6.8.2/app/models/project.rb
334 +--- gitlabhq-6.8.2.orig/app/models/project.rb 2014-05-12 11:15:38.000000000 +0200
335 ++++ gitlabhq-6.8.2/app/models/project.rb 2014-05-21 21:05:09.641976937 +0200
336 +@@ -90,7 +90,7 @@
337 + validates :description, length: { maximum: 2000 }, allow_blank: true
338 + validates :name, presence: true, length: { within: 0..255 },
339 + format: { with: Gitlab::Regex.project_name_regex,
340 +- message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first" }
341 ++ message: "only letters, digits, spaces & '_' '-' '.' ':' allowed. Letter or digit should be first" }
342 + validates :path, presence: true, length: { within: 0..255 },
343 + exclusion: { in: Gitlab::Blacklist.path },
344 + format: { with: Gitlab::Regex.path_regex,
345 +diff -ur gitlabhq-6.8.2.orig/lib/gitlab/regex.rb gitlabhq-6.8.2/lib/gitlab/regex.rb
346 +--- gitlabhq-6.8.2.orig/lib/gitlab/regex.rb 2014-05-12 11:15:38.000000000 +0200
347 ++++ gitlabhq-6.8.2/lib/gitlab/regex.rb 2014-05-21 21:03:43.872609059 +0200
348 +@@ -1,3 +1,5 @@
349 ++# encoding: utf-8
350 ++
351 + module Gitlab
352 + module Regex
353 + extend self
354 +@@ -7,7 +9,7 @@
355 + end
356 +
357 + def project_name_regex
358 +- /\A[a-zA-Z0-9_][a-zA-Z0-9_\-\. ]*\z/
359 ++ /\A\p{Word}[\p{Word}\-:\. ]*\z/
360 + end
361 +
362 + def name_regex
363
364 diff --git a/www-apps/gitlabhq/files/gitlabhq-6.8.2-ldap-custom-mapping.patch b/www-apps/gitlabhq/files/gitlabhq-6.8.2-ldap-custom-mapping.patch
365 new file mode 100644
366 index 0000000..c8c8f55
367 --- /dev/null
368 +++ b/www-apps/gitlabhq/files/gitlabhq-6.8.2-ldap-custom-mapping.patch
369 @@ -0,0 +1,99 @@
370 +diff --git a/Gemfile b/Gemfile
371 +index fe8e54e..b33a74e 100644
372 +--- a/Gemfile
373 ++++ b/Gemfile
374 +@@ -36,7 +36,8 @@ gem "gitlab_git", "~> 4.0.0"
375 + gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
376 +
377 + # LDAP Auth
378 +-gem 'gitlab_omniauth-ldap', '1.0.3', require: "omniauth-ldap"
379 ++# Patched for attributes mapping customization
380 ++gem 'gitlab_omniauth-ldap', '1.0.4', require: 'omniauth-ldap', git: 'https://github.com/jirutka/omniauth-ldap.git', ref: 'b55852bfc9b46ecf790a2c5526386702350eab89'
381 +
382 + # Syntax highlighter
383 + gem "gitlab-pygments.rb", '~> 0.5.4', require: 'pygments.rb'
384 +diff --git a/Gemfile.lock b/Gemfile.lock
385 +index d0f185b..46543e3 100644
386 +--- a/Gemfile.lock
387 ++++ b/Gemfile.lock
388 +@@ -6,6 +6,17 @@ GIT
389 + charlock_holmes (0.6.9.4)
390 +
391 + GIT
392 ++ remote: https://github.com/jirutka/omniauth-ldap.git
393 ++ revision: b55852bfc9b46ecf790a2c5526386702350eab89
394 ++ ref: b55852bfc9b46ecf790a2c5526386702350eab89
395 ++ specs:
396 ++ gitlab_omniauth-ldap (1.0.4)
397 ++ net-ldap (~> 0.3.1)
398 ++ omniauth (~> 1.0)
399 ++ pyu-ruby-sasl (~> 0.0.3.1)
400 ++ rubyntlm (~> 0.1.1)
401 ++
402 ++GIT
403 + remote: https://github.com/gitlabhq/markup.git
404 + revision: 61ade389c1e1c159359338f570d18464a44ddbc4
405 + ref: 61ade389c1e1c159359338f570d18464a44ddbc4
406 +@@ -193,11 +204,6 @@ GEM
407 + gitlab-linguist (~> 2.9.5)
408 + gitlab-pygments.rb (~> 0.5.4)
409 + gitlab_meta (6.0)
410 +- gitlab_omniauth-ldap (1.0.3)
411 +- net-ldap (~> 0.3.1)
412 +- omniauth (~> 1.0)
413 +- pyu-ruby-sasl (~> 0.0.3.1)
414 +- rubyntlm (~> 0.1.1)
415 + gon (5.0.1)
416 + actionpack (>= 2.3.0)
417 + json
418 +@@ -587,7 +593,7 @@ DEPENDENCIES
419 + gitlab-pygments.rb (~> 0.5.4)
420 + gitlab_git (~> 4.0.0)
421 + gitlab_meta (= 6.0)
422 +- gitlab_omniauth-ldap (= 1.0.3)
423 ++ gitlab_omniauth-ldap (= 1.0.4)!
424 + gon (~> 5.0.0)
425 + grape (~> 0.6.1)
426 + grape-entity (~> 0.3.0)
427 +diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
428 +index 776d930..a5b96e4 100644
429 +--- a/config/gitlab.yml.example
430 ++++ b/config/gitlab.yml.example
431 +@@ -130,6 +130,10 @@ production: &base
432 + method: 'ssl' # "ssl" or "plain"
433 + bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
434 + password: '_the_password_of_the_bind_user'
435 ++ mapping:
436 ++ username: 'uid'
437 ++ name: 'cn'
438 ++ email: 'mail'
439 + # If allow_username_or_email_login is enabled, GitLab will ignore everything
440 + # after the first '@' in the LDAP username submitted by the user on login.
441 + #
442 +diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
443 +index 2539097..739de8e 100644
444 +--- a/config/initializers/devise.rb
445 ++++ b/config/initializers/devise.rb
446 +@@ -223,6 +223,7 @@ Devise.setup do |config|
447 + method: Gitlab.config.ldap['method'],
448 + bind_dn: Gitlab.config.ldap['bind_dn'],
449 + password: Gitlab.config.ldap['password'],
450 ++ mapping: Gitlab.config.ldap['mapping'],
451 + name_proc: email_stripping_proc
452 + end
453 +
454 +diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb
455 +index 8afd64f..f1f1bea 100644
456 +--- a/lib/gitlab/ldap/user.rb
457 ++++ b/lib/gitlab/ldap/user.rb
458 +@@ -97,6 +97,10 @@ module Gitlab
459 + 'ldap'
460 + end
461 +
462 ++ def username
463 ++ (auth.info.username || auth.info.nickname).to_s.force_encoding('utf-8')
464 ++ end
465 ++
466 + def raise_error(message)
467 + raise OmniAuth::Error, "(LDAP) " + message
468 + end
469
470 diff --git a/www-apps/gitlabhq/gitlabhq-6.8.2.ebuild b/www-apps/gitlabhq/gitlabhq-6.8.2.ebuild
471 new file mode 100644
472 index 0000000..8c89e5b
473 --- /dev/null
474 +++ b/www-apps/gitlabhq/gitlabhq-6.8.2.ebuild
475 @@ -0,0 +1,362 @@
476 +# Copyright 1999-2014 Gentoo Foundation
477 +# Distributed under the terms of the GNU General Public License v2
478 +# $Header: $
479 +
480 +EAPI="5"
481 +
482 +# Mainteiner notes:
483 +# - This ebuild uses Bundler to download and install all gems in deployment mode
484 +# (i.e. into isolated directory inside application). That's not Gentoo way how
485 +# it should be done, but GitLab has too many dependencies that it will be too
486 +# difficult to maintain them via ebuilds.
487 +#
488 +
489 +USE_RUBY="ruby19 ruby20"
490 +PYTHON_COMPAT=( python{2_7,3_{1,2,3}} )
491 +
492 +inherit eutils python-r1 ruby-ng user
493 +
494 +DESCRIPTION="GitLab is a free project and repository management application"
495 +HOMEPAGE="https://github.com/gitlabhq/gitlabhq"
496 +SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v${PV}.tar.gz -> ${P}.tar.gz"
497 +
498 +RESTRICT="mirror"
499 +
500 +LICENSE="MIT"
501 +SLOT="6"
502 +KEYWORDS="amd64 x86"
503 +IUSE="mysql +postgres +unicorn"
504 +
505 +## Gems dependencies:
506 +# charlock_holmes dev-libs/icu
507 +# grape, capybara dev-libs/libxml2, dev-libs/libxslt
508 +# json dev-util/ragel
509 +# pygments.rb python 2.7+
510 +# execjs net-libs/nodejs, or any other JS runtime
511 +# pg dev-db/postgresql-base
512 +# mysql virtual/mysql
513 +#
514 +GEMS_DEPEND="
515 + dev-libs/icu
516 + dev-libs/libxml2
517 + dev-libs/libxslt
518 + dev-util/ragel
519 + net-libs/nodejs
520 + postgres? ( dev-db/postgresql-base )
521 + mysql? ( virtual/mysql )"
522 +DEPEND="${GEMS_DEPEND}
523 + >=dev-vcs/gitlab-shell-1.8
524 + dev-vcs/git"
525 +RDEPEND="${DEPEND}
526 + dev-db/redis
527 + virtual/mta"
528 +ruby_add_bdepend "
529 + virtual/rubygems
530 + dev-ruby/bundler"
531 +
532 +#
533 +# fix-gemfile:
534 +# Remove therubyracer that doesn't compile well on Gentoo (we're using
535 +# nodejs instead that is faster and better). Also replace broken
536 +# charlock_holmes version with fixed one.
537 +#
538 +# fix-project-name-regex:
539 +# Allow project name to contain non-ASCII characters.
540 +#
541 +# fix-sendmail-config:
542 +# Fix default settings to work with ssmtp that doesn't know '-t' argument.
543 +#
544 +# "${P}-ldap-custom-mapping.patch"
545 +RUBY_PATCHES=(
546 + "${P}-fix-gemfile.patch"
547 + "${P}-fix-project-name-regex.patch"
548 + "${PN}-6.0.2-fix-sendmail-config.patch"
549 + "${P}-email-custom-reply_to.patch"
550 +)
551 +
552 +MY_NAME="gitlab"
553 +MY_USER="git" # should be same as in gitlab-shell
554 +
555 +DEST_DIR="/opt/${MY_NAME}-${SLOT}"
556 +CONF_DIR="/etc/${MY_NAME}-${SLOT}"
557 +LOGS_DIR="/var/log/${MY_NAME}"
558 +TEMP_DIR="/var/tmp/${MY_NAME}"
559 +
560 +# When updating ebuild to newer version, check list of the queues in
561 +# https://github.com/gitlabhq/gitlabhq/blob/v${PV}/script/background_jobs
562 +SIDEKIQ_QUEUES="post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default"
563 +
564 +all_ruby_prepare() {
565 +
566 + # fix paths
567 + local satellites_path="${TEMP_DIR}/repo_satellites"
568 + local repos_path=/var/lib/git/repositories
569 + local shell_path=/usr/share/gitlab-shell
570 + sed -i -E \
571 + -e "/satellites:$/,/\w:$/ s|(\s*path:\s).*|\1${satellites_path}/|" \
572 + -e "/gitlab_shell:$/,/\w:$/ s|(\s*path:\s).*|\1${shell_path}/|" \
573 + -e "/gitlab_shell:$/,/\w:$/ s|(\s*repos_path:\s).*|\1${repos_path}/|" \
574 + -e "/gitlab_shell:$/,/\w:$/ s|(\s*hooks_path:\s).*|\1${shell_path}/hooks/|" \
575 + config/gitlab.yml.example || die "failed to filter gitlab.yml.example"
576 +
577 + local run_path=/run/${MY_NAME}
578 + sed -i -E \
579 + -e "s|/home/git/gitlab/tmp/(pids\|sockets)|${run_path}|" \
580 + -e "s|/home/git/gitlab/log|${LOGS_DIR}|" \
581 + -e "s|/home/git/gitlab|${DEST_DIR}|" \
582 + config/unicorn.rb.example || die "failed to filter unicorn.rb.example"
583 +
584 + sed -i \
585 + -e "s|/home/git/gitlab/tmp/sockets|${run_path}|" \
586 + lib/support/nginx/gitlab || die "failed to filter nginx/gitlab"
587 +
588 + # modify default database settings for PostgreSQL
589 + sed -i -E \
590 + -e 's|(username:).*|\1 gitlab|' \
591 + -e 's|(password:).*|\1 gitlab|' \
592 + -e 's|(socket:).*|/run/postgresql/.s.PGSQL.5432|' \
593 + config/database.yml.postgresql \
594 + || die "failed to filter database.yml.postgresql"
595 +
596 + # rename config files
597 + mv config/gitlab.yml.example config/gitlab.yml
598 + mv config/unicorn.rb.example config/unicorn.rb
599 +
600 + local dbconf=config/database.yml
601 + if use postgres && ! use mysql; then
602 + mv ${dbconf}.postgresql ${dbconf}
603 + rm ${dbconf}.mysql
604 + elif use mysql && ! use postgres; then
605 + mv ${dbconf}.mysql ${dbconf}
606 + rm ${dbconf}.postgresql
607 + fi
608 +
609 + # remove zzet's stupid migration which expetcs that users are so foolish
610 + # to run GitLab with PostgreSQL's superuser...
611 + rm db/migrate/20121009205010_postgres_create_integer_cast.rb
612 +
613 + # remove useless files
614 + rm -r lib/support/{deploy,init.d}
615 + rm -r script/{background_jobs,web}
616 + use unicorn || rm config/unicorn.rb
617 +}
618 +
619 +all_ruby_install() {
620 + local dest=${DEST_DIR}
621 + local conf=${CONF_DIR}
622 + local logs=${LOGS_DIR}
623 + local temp=${TEMP_DIR}
624 +
625 + # prepare directories
626 + diropts -m750
627 + dodir ${logs} ${temp} ${temp}/repo_satellites
628 +
629 + diropts -m755
630 + dodir ${conf} ${dest}/public/uploads
631 +
632 + dosym ${temp} ${dest}/tmp
633 + dosym ${logs} ${dest}/log
634 +
635 + # install configs
636 + insinto ${conf}
637 + doins -r config/*
638 + dosym ${conf} ${dest}/config
639 +
640 + echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
641 +
642 + # remove needless dirs
643 + rm -Rf config tmp log
644 +
645 + # install the rest files
646 + # using cp 'cause doins is slow
647 + cp -Rl * "${D}/${dest}"/
648 +
649 + # install logrotate config
650 + dodir /etc/logrotate.d
651 + cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF
652 + ${logs}/*.log {
653 + missingok
654 + delaycompress
655 + compress
656 + copytruncate
657 + }
658 + EOF
659 +
660 + ## Install gems via bundler ##
661 +
662 + cd "${D}/${dest}"
663 +
664 + local without="development test aws"
665 + local flag; for flag in mysql postgres unicorn; do
666 + without+="$(use $flag || echo ' '$flag)"
667 + done
668 + local bundle_args="--deployment ${without:+--without ${without}}"
669 +
670 + einfo "Running bundle install ${bundle_args} ..."
671 + ${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
672 +
673 + # clean gems cache
674 + rm -Rf vendor/bundle/ruby/*/cache
675 +
676 + # fix permissions
677 + fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
678 + fperms +x script/{rails,check}
679 +
680 + ## RC script ##
681 +
682 + local rcscript=gitlab-sidekiq.init
683 + use unicorn && rcscript=gitlab-unicorn-6.init
684 +
685 + cp "${FILESDIR}/${rcscript}" "${T}" || die
686 + sed -i \
687 + -e "s|@USER@|${MY_USER}|" \
688 + -e "s|@SLOT@|${SLOT}|" \
689 + -e "s|@GITLAB_BASE@|${dest}|" \
690 + -e "s|@LOGS_DIR@|${logs}|" \
691 + -e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \
692 + "${T}/${rcscript}" \
693 + || die "failed to filter ${rcscript}"
694 +
695 + newinitd "${T}/${rcscript}" "${MY_NAME}-${SLOT}"
696 +}
697 +
698 +pkg_postinst() {
699 + elog
700 + elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml."
701 + elog
702 + elog "2. Configure your database settings in ${CONF_DIR}/database.yml"
703 + elog " for \"production\" environment."
704 + elog
705 + elog "3. Then you should create a database for your GitLab instance, if you"
706 + elog "haven't done so already."
707 + elog
708 + if use postgres; then
709 + elog "If you have local PostgreSQL running, just copy&run:"
710 + elog " su postgres"
711 + elog " psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\"
712 + elog " NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\""
713 + elog " createdb -E UTF-8 -O gitlab gitlabhq_production"
714 + elog " Note: You should change your password to something more random..."
715 + elog
716 + fi
717 + elog "4. Finally execute the following command to initlize environment:"
718 + elog " emerge --config \"=${CATEGORY}/${PF}\""
719 + elog " Note: Do not forget to start Redis server first!"
720 + elog
721 + elog "If this is an update from previous version, it's HIGHLY recommended"
722 + elog "to backup your database before running the config phase!"
723 + elog
724 + elog "If you're running GitLab behind an SSL proxy such as nginx or Apache and"
725 + elog "you can't login after the upgrade, be sure to read the section about the"
726 + elog "verification of the CSRF token in GitLab's trouble-shooting guide at"
727 + elog "http://goo.gl/5XGRGv."
728 +}
729 +
730 +pkg_config() {
731 + local shell_conf='/etc/gitlab-shell.yml'
732 +
733 + einfo "Checking configuration files"
734 +
735 + if [ ! -r "${CONF_DIR}/database.yml" ]; then
736 + eerror "Copy ${CONF_DIR}/database.yml.* to"
737 + eerror "${CONF_DIR}/database.yml and edit this file in order to configure your"
738 + eerror "database settings for \"production\" environment."; die
739 + fi
740 +
741 + # check gitlab-shell configuration
742 + if [ -r ${shell_conf} ]; then
743 + local shell_repos_path="$(ryaml ${shell_conf} repos_path)"
744 + local gitlab_repos_path="$(ryaml ${CONF_DIR}/gitlab.yml \
745 + production gitlab_shell repos_path)"
746 +
747 + if [ ! "${shell_repos_path}" -ef "${gitlab_repos_path}" ]; then
748 + eerror "repos_path in ${CONF_DIR}/gitlab.yml and ${shell_conf}"
749 + eerror "must points to the same location! Fix the repos_path location and"
750 + eerror "run this again."; die
751 + fi
752 + else
753 + ewarn "GitLab Shell checks skipped, could not find config file at"
754 + ewarn "${shell_conf}. Make sure that you have gitlab-shell properly"
755 + ewarn "installed and that repos_path is the same as in GitLab."
756 + fi
757 +
758 + local email_from="$(ryaml ${CONF_DIR}/gitlab.yml production gitlab email_from)"
759 + local git_home="$(egethome ${MY_USER})"
760 +
761 + # configure Git global settings
762 + if [ ! -e "${git_home}/.gitconfig" ]; then
763 + einfo "Setting git user"
764 + su -l ${MY_USER} -c "
765 + git config --global user.email '${email_from}';
766 + git config --global user.name 'GitLab'" \
767 + || die "failed to setup git name and email"
768 + fi
769 +
770 + if [ ! -d "${DEST_DIR}/.git" ]; then
771 + # create dummy git repo as workaround for
772 + # https://github.com/bundler/bundler/issues/2039
773 + einfo "Initializing dummy git repository to avoid false errors from bundler"
774 + su -l ${MY_USER} -c "
775 + cd ${DEST_DIR}
776 + git init
777 + git add README.md
778 + git commit -m 'Dummy repository'" >/dev/null
779 + fi
780 +
781 + ## Initialize app ##
782 +
783 + local RAILS_ENV="production"
784 + local RUBY=${RUBY:-/usr/bin/ruby}
785 + local BUNDLE="${RUBY} /usr/bin/bundle"
786 +
787 + local dbname="$(ryaml ${CONF_DIR}/database.yml production database)"
788 +
789 + if [ -f "${DEST_DIR}/.secret" ]; then
790 + local update=true
791 +
792 + einfo "Migrating database ..."
793 + exec_rake db:migrate
794 +
795 + # https://github.com/gitlabhq/gitlabhq/issues/5311#issuecomment-31656496
796 + einfo "Migrating iids ..."
797 + exec_rake migrate_iids
798 +
799 + einfo "Cleaning old precompiled assets ..."
800 + exec_rake assets:clean
801 +
802 + einfo "Cleaning cache ..."
803 + exec_rake cache:clear
804 + else
805 + local update=false
806 +
807 + einfo "Initializing database ..."
808 + exec_rake gitlab:setup
809 + fi
810 +
811 + einfo "Precompiling assests ..."
812 + exec_rake assets:precompile
813 +
814 + if [ "${update}" = 'true' ]; then
815 + ewarn
816 + ewarn "This configuration script runs only common migration tasks."
817 + ewarn "Please read guides on"
818 + ewarn " https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/"
819 + ewarn "for any additional migration tasks specific to your previous GitLab"
820 + ewarn "version."
821 + fi
822 +}
823 +
824 +ryaml() {
825 + ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
826 +}
827 +
828 +exec_rake() {
829 + local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}"
830 +
831 + echo " ${command}"
832 + su -l ${MY_USER} -c "
833 + export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8
834 + cd ${DEST_DIR}
835 + ${command}" \
836 + || die "failed to run rake $@"
837 +}
838
839 diff --git a/www-apps/gitlabhq/metadata.xml b/www-apps/gitlabhq/metadata.xml
840 new file mode 100644
841 index 0000000..d68dded
842 --- /dev/null
843 +++ b/www-apps/gitlabhq/metadata.xml
844 @@ -0,0 +1,19 @@
845 +<?xml version="1.0" encoding="UTF-8"?>
846 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
847 +<pkgmetadata>
848 + <maintainer>
849 + <email>mschiff@g.o</email>
850 + <name>Marc Schiffbauer</name>
851 + </maintainer>
852 + <use>
853 + <flag name="mysql">
854 + Adds support for the MySQL database.
855 + </flag>
856 + <flag name="postgres">
857 + Adds support for the PostgreSQL database.
858 + </flag>
859 + <flag name="unicorn">
860 + Build with bundled Unicorn server.
861 + </flag>
862 + </use>
863 +</pkgmetadata>