aboutsummaryrefslogtreecommitdiff
blob: 43632e289353ef49890802e0a407e68bf85a4273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
package packages

import "slices"
import "strings"
import "time"
import "soko/pkg/app/utils"
import "soko/pkg/models"

func overviewSlotText(version *models.Version) string {
	if version.Subslot != "" {
		return version.Slot + "/" + version.Subslot
	}
	return version.Slot
}

templ overviewVersionRow(version *models.Version, keywords []string) {
	<tr>
		<td class="kk-version">
			<strong>
				<a
					class="kk-ebuild-link"
					href={ templ.URL("https://gitweb.gentoo.org/repo/gentoo.git/tree/" + version.Atom + "/" + version.Package + "-" + version.Version + ".ebuild") }
				>
					{ version.Version }
				</a>
			</strong>
			<span class="kk-slot" title={ "SLOT=\"" + overviewSlotText(version) + "\"" }> : { overviewSlotText(version) }</span>
			if len(version.Restricts) > 0 {
				<span
					class="badge badge-danger kk-restrict-label"
					title={ "The following features are restricted: " + strings.Join(version.Restricts, " ") }
				>
					{ utils.FormatRestricts(version.Restricts) }
				</span>
			}
			<span class="badge badge-light kk-eapi-label">EAPI { version.EAPI }</span>
		</td>
		for _, arch := range models.ArchesToShow {
			if slices.Contains(keywords, "~"+arch) {
				if len(version.Masks) > 0 {
					<td class="kk-keyword kk-keyword-masked" title={ version.Version + " is masked (testing) on " + arch }>
						<svg height="16" class="octicon octicon-diff-modified" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-mask" xlink:href="#svg-ver-mask"></use></svg>
						<span class="sr-only">~{ arch }</span>
					</td>
				} else {
					<td class="kk-keyword kk-keyword-testing" title={ version.Version + " is testing on " + arch }>
						<svg height="16" class="octicon octicon-diff-modified" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-testing" xlink:href="#svg-ver-testing"></use></svg>
						<span class="sr-only">~{ arch }</span>
					</td>
				}
			} else if slices.Contains(keywords, "-"+arch) {
				<td class="kk-keyword kk-keyword-unavailable" title={ version.Version + " is unavailable on " + arch }>
					<svg height="16" class="octicon octicon-diff-removed" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-unavailable" xlink:href="#svg-ver-unavailable"></use></svg>
					<span class="sr-only">-{ arch }</span>
				</td>
			} else if slices.Contains(keywords, arch) {
				if len(version.Masks) > 0 {
					<td class="kk-keyword kk-keyword-masked" title={ version.Version + " is masked (stable) on " + arch }>
						<svg height="16" class="octicon octicon-diff-added" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-mask" xlink:href="#svg-ver-mask"></use></svg>
						<span class="sr-only">{ arch }</span>
					</td>
				} else {
					<td class="kk-keyword kk-keyword-stable" title={ version.Version + " is stable on " + arch }>
						<svg height="16" class="octicon octicon-diff-added" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-stable" xlink:href="#svg-ver-stable"></use></svg>
						<span class="sr-only">{ arch }</span>
					</td>
				}
			} else if slices.Contains(keywords, "-*") {
				<td class="kk-keyword kk-keyword-unavailable" title={ version.Version + " is unavailable on " + arch }>
					<svg height="16" class="octicon octicon-diff-removed" version="1.1" width="14" aria-hidden="true"><use href="#svg-ver-unavailable" xlink:href="#svg-ver-unavailable"></use></svg>
					<span class="sr-only">-{ arch }</span>
				</td>
			} else {
				<td class="kk-keyword kk-keyword-unkown" title={ version.Version + " is unknown on " + arch }>
					<span class="sr-only">?{ arch }</span>
				</td>
			}
		}
	</tr>
}

templ overviewVersions(pkg *models.Package) {
	<h3 class="mb-2">Available Versions</h3>
	<div class="card mb-4 rounded">
		<svg style="display: none" version="1.1">
			<defs>
				<symbol id="svg-ver-mask" viewBox="0 0 14 16">
					<path fill-rule="evenodd" d="M13 1H1c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V2c0-.55-.45-1-1-1zm0 13H1V2h12v12zm-8.5-2H3v-1.5L9.5 4H11v1.5L4.5 12z"></path>
				</symbol>
				<symbol id="svg-ver-testing" viewBox="0 0 14 16">
					<path fill-rule="evenodd" d="M13 1H1c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V2c0-.55-.45-1-1-1zm0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>
				</symbol>
				<symbol id="svg-ver-unavailable" viewBox="0 0 14 16">
					<path fill-rule="evenodd" d="M13 1H1c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V2c0-.55-.45-1-1-1zm0 13H1V2h12v12zm-2-5H3V7h8v2z"></path>
				</symbol>
				<symbol id="svg-ver-stable" viewBox="0 0 14 16">
					<path fill-rule="evenodd" d="M13 1H1c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V2c0-.55-.45-1-1-1zm0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>
				</symbol>
			</defs>
		</svg>
		<div class="table-responsive border-0">
			<table class="table table-bordered kk-versions-table mb-0 overflow-hidden border-0">
				<thead class="border-0">
					<tr class="border-0">
						<th class="kk-version border-left-0 border-top-0">Version</th>
						for _, arch := range models.ArchesToShow {
							<th class="kk-keyword-header kk-keyword border-left-0 border-top-0">{ arch }</th>
						}
					</tr>
				</thead>
				<tbody>
					for _, version := range pkg.Versions {
						@overviewVersionRow(version, strings.Fields(version.Keywords))
					}
				</tbody>
			</table>
		</div>
	</div>
}

templ maintainersList(maintainers []*models.Maintainer) {
	for i, maintainer := range maintainers {
		if i > 0 {
			,&nbsp;
		}
		<a title={ maintainer.PrintName() } href={ templ.URL("/maintainer/" + maintainer.Email) }>
			{ maintainer.PrintName() }
		</a>
		<a href={ templ.URL("mailto:" + maintainer.Email) }>
			<i class="fa fa-envelope-o" style="font-size: .925em;" aria-hidden="true"></i>
		</a>
	}
}

templ overview(pkg *models.Package) {
	<div class="row">
		<div class="col-md-9">
			if len(pkg.Outdated) > 0 {
				if !pkg.HasVersion(pkg.Outdated[0].NewestVersion) {
					<div class="alert alert-info">
						<strong><span class="fa fa-fw fa-lightbulb-o"></span> Version { pkg.Outdated[0].NewestVersion } is available upstream. Please consider updating!</strong>
						<br/>
						It seems that version { pkg.Outdated[0].NewestVersion } is available upstream, while the latest version in the Gentoo tree is { pkg.Outdated[0].GentooVersion }.
						<br/>
						if pkg.Outdated[0].Source == models.OutdatedSourceRepology {
							<small><i>You think this warning is false? Read more about it <a href="https://archives.gentoo.org/gentoo-dev/message/b793f4da5a5b5e20a063ea431500a820">here</a>.</i></small>
						} else {
							<small>This information is provided from <a href="https://release-monitoring.org">Release-Monitoring</a>, so fix association issues there.</small>
						}
					</div>
				}
			}
			@overviewVersions(pkg)
			if mask := getMask(pkg.Versions); mask != nil {
				<h3 class="pt-3 mb-2">Masks</h3>
				<div class="card kk-mask mb-3">
					<ul class="list-group list-group-flush kk-mask">
						<li class="list-group-item kk-mask">
							if showRemovalNotice(pkg.Versions) {
								<p style="color:#721c24;">
									<strong><span class="fa fa-fw fa-warning"></span> This package is masked and could be removed soon!</strong>
									<br/>
									The mask comment indicates that this package is scheduled for removal from our package repository.
									<br/>
									Please review the mask information below for more details.
								</p>
							}
							<strong class="kk-mask-reason">
								@templ.Raw(mask.Reason)
							</strong>
							<div class="kk-mask-details">
								<div class="row">
									<div class="col-xs-12 col-md-3 kk-metadata-key">
										Affected packages
									</div>
									<div class="col-xs-12 col-md-9 kk-mask-atoms overflow-hidden">
										{ mask.Versions }
									</div>
								</div>
								<div class="row">
									<div class="col-xs-12 col-md-3 kk-metadata-key">
										Author/Date
									</div>
									<div class="col-xs-12 col-md-9">
										{ mask.Author } &lt;{ mask.AuthorEmail }&gt; <span class="text-muted">({ mask.Date.Format(time.DateOnly) })</span>
									</div>
								</div>
							</div>
						</li>
					</ul>
				</div>
			} else if deprecation := getDeprecation(pkg.Versions); deprecation != nil {
				<h3 class="pt-3 mb-2">Deprecation Warning</h3>
				<div class="card bg-warning mb-3">
					<ul class="list-group list-group-flush bg-warning">
						<li class="list-group-item bg-warning">
							<strong class="kk-mask-reason">
								@templ.Raw(deprecation.Reason)
							</strong>
							<div class="kk-mask-details">
								<div class="row">
									<div class="col-xs-12 col-md-3 kk-metadata-key">
										Affected packages
									</div>
									<div class="col-xs-12 col-md-9 kk-mask-atoms overflow-hidden">
										{ deprecation.Versions }
									</div>
								</div>
								<div class="row">
									<div class="col-xs-12 col-md-3 kk-metadata-key">
										Author/Date
									</div>
									<div class="col-xs-12 col-md-9">
										{ deprecation.Author } &lt;{ deprecation.AuthorEmail }&gt; <span class="text-muted">({ deprecation.Date.Format(time.DateOnly) })</span>
									</div>
								</div>
							</div>
						</li>
					</ul>
				</div>
			}
			if len(pkg.Maintainers) == 0 {
				<div class="alert alert-info">
					<strong><span class="fa fa-fw fa-wrench"></span> This package needs a new maintainer!</strong>
					<br/>
					If you are interested in helping with the maintenance of { pkg.Name }, please get in touch with our
					<a href="https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers" class="alert-link">Proxy Maintainers team</a>.
				</div>
			}
			<h3 class="pt-3 mb-2">Package Metadata</h3>
			<div class="card border-0 mb-3">
				<ul class="list-group kk-metadata-list">
					if len(pkg.Versions[0].Homepage) > 1 {
						<li class="kk-metadata-item list-group-item">
							<div class="row">
								<div class="col-xs-12 col-md-3 kk-metadata-key">
									<span class="fa fa-fw fa-home"></span>
									Other homepage(s)
								</div>
								<div class="col-xs-12 col-md-9">
									for i, url := range pkg.Versions[0].Homepage[1:] {
										if i > 0 {
											<br/>
										}
										<a href={ templ.URL(url) }>{ url }</a>
									}
								</div>
							</div>
						</li>
					}
					if len(pkg.Upstream.Doc) > 0 || len(pkg.Upstream.Changelog) > 0 || len(pkg.Upstream.BugsTo) > 0 || len(pkg.Upstream.RemoteIds) > 0 {
						<li class="kk-metadata-item list-group-item">
							<div class="row">
								<div class="col-xs-12 col-md-3 kk-metadata-key">
									<span class="fa fa-fw fa-code-fork"></span>
									Upstream
								</div>
								<div class="col-xs-12 col-md-9">
									<table>
										for i, url := range pkg.Upstream.Doc {
											<tr>
												<td>
													if i == 0 {
														<span class="kk-useflag-group float-right mr-2">Documentation</span>
													}
												</td>
												<td><a href={ templ.URL(url) }>{ url }</a></td>
											</tr>
										}
										for i, url := range pkg.Upstream.Changelog {
											<tr>
												<td>
													if i == 0 {
														<span class="kk-useflag-group float-right mr-2">Changelog</span>
													}
												</td>
												<td><a href={ templ.URL(url) }>{ url }</a></td>
											</tr>
										}
										for i, url := range pkg.Upstream.BugsTo {
											<tr>
												<td>
													if i == 0 {
														<span class="kk-useflag-group float-right mr-2">Bugs-To</span>
													}
												</td>
												<td><a href={ templ.URL(url) }>{ url }</a></td>
											</tr>
										}
										for i, remote := range pkg.Upstream.RemoteIds {
											<tr>
												<td>
													if i == 0 {
														<span class="kk-useflag-group float-right mr-2">Remote-Id</span>
													}
												</td>
												<td>
													if url := remoteIdLink(remote); url != "" {
														<a href={ templ.URL(url) }>{ url }</a>
													} else {
														<a>({ remote.Type }) { remote.Id }</a>
													}
												</td>
											</tr>
										}
									</table>
								</div>
							</div>
						</li>
					}
					if pkg.Longdescription != "" {
						<li class="kk-metadata-item list-group-item">
							<div class="row">
								<div class="col-xs-12 col-md-3 kk-metadata-key">
									<span class="fa fa-fw fa-info"></span>Full description
								</div>
								<div class="col-xs-12 col-md-9">
									{ pkg.Longdescription }
								</div>
							</div>
						</li>
					}
					if localUseflags, globalUseflags, useExpands := getPackageUseflags(pkg); len(localUseflags) > 0 || len(globalUseflags) > 0 || len(useExpands) > 0 {
						<li class="kk-metadata-item list-group-item">
							<div class="row">
								<div class="col-xs-12 col-md-3 kk-metadata-key">
									<span class="fa fa-fw fa-sliders"></span>
									USE flags
								</div>
								<div class="col-xs-12 col-md-9">
									if len(localUseflags) > 0 {
										<span class="kk-useflag-group">Local Use Flags</span>
										<ul class={ "kk-useflag-container", templ.KV("kk-useflag-container-many", len(localUseflags) >= 10), templ.KV("kk-useflag-container-few", len(localUseflags) < 10) }>
											for _, use := range localUseflags {
												<li class="kk-useflag">
													<a title={ use.Description } data-toggle="tooltip" href={ templ.URL("/useflags/" + use.Name) }>{ use.Name }</a>
												</li>
											}
										</ul>
									}
									if len(globalUseflags) > 0 {
										<span class="kk-useflag-group">Global Use Flags</span>
										<ul class={ "kk-useflag-container", templ.KV("kk-useflag-container-many", len(localUseflags) >= 10), templ.KV("kk-useflag-container-few", len(localUseflags) < 10) }>
											for _, use := range globalUseflags {
												<li class="kk-useflag">
													<a title={ use.Description } data-toggle="tooltip" href={ templ.URL("/useflags/" + use.Name) }>{ use.Name }</a>
												</li>
											}
										</ul>
									}
									if len(useExpands) > 0 {
										for groupName, flags := range useExpands {
											<span class="kk-useflag-group">{ groupName } (Use Expand)</span>
											<ul class={ "kk-useflag-container", templ.KV("kk-useflag-container-many", len(localUseflags) >= 10), templ.KV("kk-useflag-container-few", len(localUseflags) < 10) }>
												for _, use := range flags {
													<li class="kk-useflag">
														<a title={ use.Description } data-toggle="tooltip" href={ templ.URL("/useflags/" + use.Name) }>{ strings.TrimPrefix(use.Name, use.UseExpand + "_") }</a>
													</li>
												}
											</ul>
										}
									}
								</div>
							</div>
						</li>
					}
					if pkg.Versions[0].License != "" {
						<li class="kk-metadata-item list-group-item">
							<div class="row">
								<div class="col-xs-12 col-md-3 kk-metadata-key">
									<span class="fa fa-fw fa-legal"></span>
									License
								</div>
								<div class="col-xs-12 col-md-9">
									{ pkg.Versions[0].License }
								</div>
							</div>
						</li>
					}
					if len(pkg.Maintainers) > 0 {
						<li class="kk-metadata-item list-group-item">
							<div class="row">
								<div class="col-xs-12 col-md-3 kk-metadata-key">
									<span class="fa fa-fw fa-user"></span>
									Maintainer(s)
								</div>
								<div class="col-xs-12 col-md-9">
									@maintainersList(pkg.Maintainers)
								</div>
							</div>
						</li>
					}
				</ul>
			</div>
		</div>
		<div class="col-md-3 pl-4 pt-4 mt-2">
			<h4 class="mb-2 ml-1">
				<a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseExternalResources" role="button" aria-expanded="false" aria-controls="collapseExternalResources">
					External Resources
				</a>
			</h4>
			<div class="collapse show" id="collapseExternalResources">
				<dl class="ml-3">
					<dd>
						<span class="fa fa-fw fa-bug"></span>
						<a href={ templ.URL("https://bugs.gentoo.org/buglist.cgi?quicksearch=" + pkg.Atom) } class="" target="_blank">
							Related bugs
						</a>
					</dd>
					<dd>
						<span class="fa fa-fw fa-chain-broken"></span>
						<a href={ templ.URL("https://qa-reports.gentoo.org/output/gentoo-ci/output.html;pkg=" + pkg.Category + ":" + pkg.Name) } title="CI report" target="_blank">CI Report</a>
						(<a href={ templ.URL("https://qa-reports.gentoo.org/output/gentoo-ci/output.verbose.html;pkg=" + pkg.Category + ":" + pkg.Name) } title="Verbose CI report" target="_blank">verbose</a>)
					</dd>
					<dd>
						<span class="fa fa-fw fa-sort-numeric-desc"></span>
						<a href={ templ.URL("https://repology.org/tools/project-by?repo=gentoo&name_type=srcname&target_page=project_versions&name=" + pkg.Atom) } target="_blank">
							Repology
						</a>
					</dd>
					if pkg.AnityaInfo != nil {
						<dd>
							<span class="fa fa-fw fa-sort-numeric-desc"></span>
							<a href={ templ.URL("https://release-monitoring.org/projects/search/?pattern=" + pkg.AnityaInfo.Project) } target="_blank">
								Release-Monitoring
							</a>
						</dd>
					}
					<dd>
						<span class="octicon octicon-git-pull-request opticon-resource-icon ml-1"></span>
						<a href={ templ.URL("https://github.com/gentoo/gentoo/pulls?q=is%3Apr+is%3Aopen+in%3Atitle+" + pkg.Atom) } target="_blank">
							Open Pull Requests
						</a>
					</dd>
					<dd>
						<span class="fa fa-fw fa-book"></span>
						<a href={ templ.URL("https://wiki.gentoo.org/wiki/Special:Search/" + pkg.Name) } target="_blank">
							Documentation
						</a>
					</dd>
					<dd>
						<span class="fa fa-fw fa-comments-o"></span>
						<a href={ templ.URL("https://forums.gentoo.org/search.php?search_terms=all&show_results=topics&search_keywords=" + pkg.Name + "&mode=results") } target="_blank">
							Forums posts
						</a>
					</dd>
					<dd>
						<span class="fa fa-fw fa-code-fork"></span>
						<a href={ templ.URL("https://gitweb.gentoo.org/repo/gentoo.git/tree/" + pkg.Atom) } target="_blank">
							Git repository browser
						</a>
					</dd>
					<dd>
						<span class="fa fa-fw fa-history"></span>
						<a href={ templ.URL("https://gitweb.gentoo.org/repo/gentoo.git/log/" + pkg.Atom + "?showmsg=1") } title="Git log" target="_blank">Git log</a>
						(<a href={ templ.URL("https://gitweb.gentoo.org/repo/gentoo.git/log/" + pkg.Atom) } title="Short git log" target="_blank">short</a>)
					</dd>
					<dd>
						<span class="fa fa-fw fa-rss"></span>
						<a href={ templ.URL("https://gitweb.gentoo.org/repo/gentoo.git/atom/" + pkg.Atom + "?h=master") } target="_blank">
							Changes Feed
						</a>
					</dd>
				</dl>
			</div>
		</div>
	</div>
}