diff options
author | Colin Smith <colin@pfsense.org> | 2005-03-10 03:37:46 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-03-10 03:37:46 +0000 |
commit | d0e48055dffdf4ad759307b96473d315da9299f8 (patch) | |
tree | 7744f9e51e9bcc45a294c5eecb38375cf8420f76 /etc/inc | |
parent | 7ebb7114cdba25b0c456667ddea36bf9a45b5408 (diff) | |
download | pfsense-d0e48055dffdf4ad759307b96473d315da9299f8.zip pfsense-d0e48055dffdf4ad759307b96473d315da9299f8.tar.gz |
* Update get_package_xml_depends($pkg_name, $format) to output dependencies as filenames or names.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 8479e00..12496e7 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -646,7 +646,9 @@ function reverse_strrchr($haystack, $needle) { } /* - * get_package_xml_depends($pkg_name): Return a package's XML dependencies (additional tabs etc) + * get_package_xml_depends($pkg_name, $format = "files"): Return a package's XML dependencies. + * $format: "files" = filenames + * "names" = stripped filenames */ function get_package_xml_depends($pkg_name) { global $config; @@ -663,16 +665,20 @@ function get_package_xml_depends($pkg_name) { if($pkg_xml['additional_files_needed'] != "") { foreach($pkg_xml['additional_files_needed'] as $item) { $depend_file = substr(strrchr($item['item'], "/"),1); // Strip URLs down to filenames. + $depend_name = reverse_strrchr($depend_file, "."); // Strip filename down to dependency name. if(!preg_match("/\.xml/i", $depend_file)) break; // If the file doesn't end in .xml (case-insensitive) exit the loop. if(!file_exists("/usr/local/pkg/" . $pkg_name)) { - $depend_name = reverse_strrchr($depend_file, "."); // Strip filename down to (guessed) dependency name. log_error("Fetching missing dependency \(" . $depend_name . "\) for " . $pkg_name); mwexec("/usr/bin/fetch -o /usr/local/pkg/" . $depend_file . " " . $item['item']); } - $depends[] = $depend_file; + if ($format = "names") { + $depends[] = $depend_name; + } else { + $depends[] = $depend_file; + } } - } return $depends; + } } /* |