Skip to content

Commit 77ea0fd

Browse files
committed
feat: display forward library dependencies
1 parent 27be68e commit 77ea0fd

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/sql.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,3 +922,14 @@ ORDER BY
922922
package,
923923
architecture
924924
";
925+
926+
pub const SQL_GET_PACKAGE_LIBRARY_DEP: &str = "
927+
SELECT
928+
package
929+
FROM
930+
v_so_breaks_dep
931+
WHERE
932+
dep_package = $1
933+
ORDER BY
934+
package
935+
";

src/views/package.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ pub async fn packages(RoutePackage { name }: RoutePackage, q: Query, db: Ext) ->
107107
category: &'a String,
108108
section: &'a String,
109109
dependencies: Vec<Dependency>,
110+
library_dependencies: Vec<String>,
110111
errors: Vec<PackageError>,
111112
hasrevdep: bool,
112113
srctype: String,
@@ -347,6 +348,11 @@ pub async fn packages(RoutePackage { name }: RoutePackage, q: Query, db: Ext) ->
347348
None => ("".into(), "".into(), "".into()),
348349
};
349350

351+
let library_deps: Vec<(String,)> = query_as(SQL_GET_PACKAGE_LIBRARY_DEP)
352+
.bind(&name)
353+
.fetch_all(&db.pv)
354+
.await?;
355+
350356
let ctx = Template {
351357
// package
352358
pkg: &pkg,
@@ -361,6 +367,7 @@ pub async fn packages(RoutePackage { name }: RoutePackage, q: Query, db: Ext) ->
361367

362368
// dependencies
363369
dependencies: Dependency::parse_db_dependencies(&pkg.dependency),
370+
library_dependencies: library_deps.into_iter().map(|dep| dep.0).collect(),
364371

365372
// errors
366373
errors,

templates/package.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
<p><b class="pkg-field">Section</b>: {% if !category.is_empty() -%} {{"{}-"|format(category)}} {%- endif %}{{ section }}</p>
1414
{%- endif %}
1515

16-
1716
{% for dep in dependencies -%}
1817
<p>
1918
<b class="pkg-field pkg-dep-rel">{{ dep.relationship }}</b> {% if !dep.arch.is_empty() -%}{{dep.arch}}{%- endif %}:
@@ -23,6 +22,14 @@
2322
{%- endfor %}
2423
{%- endfor %}
2524

25+
{% if !library_dependencies.is_empty() -%}
26+
<p>
27+
<b class="pkg-field pkg-dep-rel">Depends (library)</b>:
28+
{% for name in library_dependencies -%}
29+
{% if loop.index != 1 -%},{%- endif %}
30+
<span class="pkg-dep"><a href="{{ name }}">{{ name }}</a></span>
31+
{%- endfor %}
32+
{%- endif %}
2633

2734
<p><b class="pkg-field">Links</b>:
2835
<a href="/changelog/{{ name|urlencode }}">Changelog</a>,

0 commit comments

Comments
 (0)