Skip to content

Commit

Permalink
When pkg-plist shows a .so file, use that as a sample lib dependency
Browse files Browse the repository at this point in the history
fixes #112
  • Loading branch information
dlangille committed Apr 6, 2019
1 parent 1a2d407 commit 92d8d5e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion classes/port-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,14 @@ function Display($verbosity_level = 1) {
$HTML .= '<br>' . $this->ShowConfigurePlist();
}

$HTML .= '<p><b>Dependency line</b>: <span class="file">' . $port->package_name . '>0:' . $this->DisplayPlainText() . '</span></p>';
$HTML .= '<b>Dependency lines</b>:<ul>';
$HTML .= '<li><span class="file">' . $port->package_name . '>0:' . $this->DisplayPlainText() . '</span></li>';
// pkg_plist_libray_matches is a JSON array
$lib_depends = json_decode($port->pkg_plist_libray_matches, true);
foreach($lib_depends as $library) {
$HTML .= '<li><span class="file">' . preg_replace('/^lib\//', '', $library) . ':' . $this->DisplayPlainText() . '</span></li>';
}
$HTML .= '</ul>';

# if there are conflicts
if ($this->ShowEverything && ($port->conflicts || $port->conflicts_build || $port->conflicts_install)) {
Expand Down
8 changes: 8 additions & 0 deletions classes/ports.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class Port {
var $vulnerable_current;
var $vulnerable_past;

var $pkg_plist_libray_matches; // items from pkg-plist which match: 'lib/[[:alpha:]]*?\.so'
// used for listing LIB_DEPENDS

// not always present/set
var $update_description;

Expand Down Expand Up @@ -180,6 +183,8 @@ function _PopulateValues($myrow) {
$this->vulnerable_current = $myrow["vulnerable_current"];
$this->vulnerable_past = $myrow["vulnerable_past"];

$this->pkg_plist_libray_matches = $myrow["pkg_plist_libray_matches"];

// We might be looking at category lang. japanese/gawk is listed in both japanese and lang.
// So when looking at lang, we don't want to say, Also listed in lang...
//
Expand Down Expand Up @@ -258,6 +263,7 @@ function FetchByElementID($element_id, $UserID = 0) {
categories.name as category,
ports_vulnerable.current as vulnerable_current,
ports_vulnerable.past as vulnerable_past,
array_to_json(regexp_match(pkg_plist, 'lib/[[:alpha:]]*?\.so')) AS pkg_plist_libray_matches,
commit_log.commit_date - SystemTimeAdjust() AS last_commit_date,
commit_log.svn_revision,
R.svn_hostname,
Expand Down Expand Up @@ -375,6 +381,7 @@ function FetchByID($id, $UserID = 0) {
categories.name as category,
ports_vulnerable.current as vulnerable_current,
ports_vulnerable.past as vulnerable_past,
array_to_json(regexp_match(pkg_plist, 'lib/[[:alpha:]]*?\.so')) AS pkg_plist_libray_matches,
commit_log.commit_date - SystemTimeAdjust() AS last_commit_date,
commit_log.svn_revision,
R.svn_hostname,
Expand Down Expand Up @@ -514,6 +521,7 @@ function FetchByCategoryInitialise($CategoryName, $UserID = 0, $PageSize = 0, $P
PRIMARY_CATEGORY.name as category,
ports_vulnerable.current as vulnerable_current,
ports_vulnerable.past as vulnerable_past,
array_to_json(regexp_match(pkg_plist, 'lib/[[:alpha:]]*?\.so')) AS pkg_plist_libray_matches,
NULL AS needs_refresh,
NULL AS updated,
NULL AS last_commit_date,
Expand Down

0 comments on commit 92d8d5e

Please sign in to comment.