How to use get_package_data method of pts_exdep_generic_parser class

Best Phoronix-test-suite code snippet using pts_exdep_generic_parser.get_package_data

pts_external_dependencies.php

Source:pts_external_dependencies.php Github

copy

Full Screen

...157 $exdep_generic_parser = new pts_exdep_generic_parser();158 $to_report = array();159 foreach(array_keys($required_external_dependencies) as $dependency)160 {161 $dependency_data = $exdep_generic_parser->get_package_data($dependency);162 if($dependency_data['possible_packages'] != null)163 {164 $to_report[] = $dependency_data['title'] . PHP_EOL . 'Possible Package Names: ' . $dependency_data['possible_packages'];165 }166 }167 if(count($to_report) > 0)168 {169 echo PHP_EOL . 'Some additional dependencies are required, but they could not be installed automatically for your operating system.' . PHP_EOL . 'Below are the software packages that must be installed.' . PHP_EOL . PHP_EOL;170 foreach($to_report as $report)171 {172 pts_client::$display->generic_heading($report);173 }174 if(!$no_prompts)175 {176 echo 'The above dependencies should be installed before proceeding. Press any key when you\'re ready to continue.';177 pts_user_io::read_user_input();178 echo PHP_EOL;179 }180 }181 }182 // Find the dependencies that are still missing from the system183 if(!$no_prompts && !defined('PHOROMATIC_PROCESS') && $skip_warning_on_unmet_deps == false)184 {185 $generic_packages_needed = array();186 $required_external_dependencies = $required_external_dependencies_copy;187 $dependencies_to_install = self::check_dependencies_missing_from_system($required_external_dependencies_copy, $generic_packages_needed);188 if(count($generic_packages_needed) > 0)189 {190 echo PHP_EOL . 'There are dependencies still missing from the system:' . PHP_EOL;191 echo pts_user_io::display_text_list(self::generic_names_to_titles($generic_packages_needed));192 $actions = array(193 'IGNORE' => 'Ignore missing dependencies and proceed with installation.',194 'SKIP_TESTS_WITH_MISSING_DEPS' => 'Skip installing the tests with missing dependencies.',195 'REATTEMPT_DEP_INSTALL' => 'Re-attempt to install the missing dependencies.',196 'QUIT' => 'Quit the current Phoronix Test Suite process.'197 );198 $selected_action = pts_user_io::prompt_text_menu('Missing dependencies action', $actions, false, true);199 switch($selected_action)200 {201 case 'IGNORE':202 break;203 case 'SKIP_TESTS_WITH_MISSING_DEPS':204 // Unset the tests that have dependencies still missing205 self::remove_tests_with_missing_dependencies($test_profiles, $generic_packages_needed, $required_external_dependencies);206 break;207 case 'REATTEMPT_DEP_INSTALL':208 self::install_packages_on_system($dependencies_to_install);209 break;210 case 'QUIT':211 exit(0);212 }213 }214 }215 return true;216 }217 protected static function remove_tests_with_missing_dependencies(&$test_profiles, $generic_packages_needed, $required_test_dependencies)218 {219 foreach($generic_packages_needed as $pkg)220 {221 if(isset($required_test_dependencies[$pkg]))222 {223 foreach($required_test_dependencies[$pkg] as $test_with_this_dependency)224 {225 if(($index = array_search($test_with_this_dependency, $test_profiles)) !== false)226 {227 unset($test_profiles[$index]);228 }229 }230 }231 }232 }233 public static function all_dependency_names()234 {235 $exdep_generic_parser = new pts_exdep_generic_parser();236 return $exdep_generic_parser->get_available_packages();237 }238 public static function all_dependency_titles()239 {240 $dependency_names = self::all_dependency_names();241 return self::generic_names_to_titles($dependency_names);242 }243 public static function missing_dependency_names()244 {245 $all_test_dependencies = array();246 $all_missing_dependencies = array();247 foreach(self::all_dependency_names() as $name)248 {249 $all_test_dependencies[$name] = array();250 }251 self::check_dependencies_missing_from_system($all_test_dependencies, $all_missing_dependencies);252 sort($all_missing_dependencies);253 return $all_missing_dependencies;254 }255 public static function missing_dependency_titles()256 {257 $dependency_names = self::missing_dependency_names();258 return self::generic_names_to_titles($dependency_names);259 }260 public static function installed_dependency_names()261 {262 $installed_test_dependencies = array_diff(self::all_dependency_names(), self::missing_dependency_names());263 sort($installed_test_dependencies);264 return $installed_test_dependencies;265 }266 public static function installed_dependency_titles()267 {268 $dependency_names = self::installed_dependency_names();269 return self::generic_names_to_titles($dependency_names);270 }271 private static function check_dependencies_missing_from_system(&$required_test_dependencies, &$generic_names_of_packages_needed = false, &$skip_warning_on_unmet_deps = false)272 {273 $generic_dependencies_parser = new pts_exdep_generic_parser();274 $vendor_dependencies_parser = new pts_exdep_platform_parser(self::vendor_identifier('package-list'));275 $skip_warning_on_unmet_deps = $vendor_dependencies_parser->skip_warning_on_unmet_dependencies();276 $kernel_architecture = phodevi::read_property('system', 'kernel-architecture');277 $needed_os_packages = array();278 foreach($required_test_dependencies as $package => $dependents)279 {280 if($vendor_dependencies_parser->is_package($package))281 {282 $package_data = $vendor_dependencies_parser->get_package_data($package);283 $arch_compliant = empty($package_data['arch_specific']) || in_array($kernel_architecture, $package_data['arch_specific']);284 if(!empty($package_data['file_check']))285 {286 $add_dependency = self::file_missing_check($package_data['file_check']);287 }288 else if($generic_dependencies_parser->is_package($package))289 {290 // If the OS/platform-specific package didn't supply a file check list, obtain it from the generic listing291 $generic_package_data = $generic_dependencies_parser->get_package_data($package);292 $add_dependency = empty($generic_package_data['file_check']) || self::file_missing_check($generic_package_data['file_check']);293 }294 else295 {296 $add_dependency = true;297 }298 if($add_dependency && $arch_compliant && $package_data['os_package'] != null)299 {300 if(!in_array($package_data['os_package'], $needed_os_packages))301 {302 $needed_os_packages[] = $package_data['os_package'];303 }304 if($generic_names_of_packages_needed !== false && !in_array($package, $generic_names_of_packages_needed))305 {306 $generic_names_of_packages_needed[] = $package;307 }308 }309 else310 {311 unset($required_test_dependencies[$package]);312 }313 }314 }315 if(count($required_test_dependencies) > 0)316 {317 foreach($required_test_dependencies as $i => $dependency)318 {319 $package_data = $generic_dependencies_parser->get_package_data($i);320 $file_present = !empty($package_data['file_check']) && !self::file_missing_check($package_data['file_check']);321 if($file_present)322 {323 unset($required_test_dependencies[$i]);324 }325 }326 }327 return $needed_os_packages;328 }329 private static function check_for_missing_system_files(&$required_system_files)330 {331 $kernel_architecture = phodevi::read_property('system', 'kernel-architecture');332 $needed_os_packages = array();333 foreach(array_keys($required_system_files) as $file)334 {335 $present = false;336 if(is_file($file))337 {338 $present = true;339 }340 if(strpos($file, '.h') !== false && is_file('/usr/includes/' . $file))341 {342 $present = true;343 }344 else if(strpos($file, '.so') !== false && is_file('/usr/lib/' . $file))345 {346 $present = true;347 }348 else if(pts_client::executable_in_path($file))349 {350 $present = true;351 }352 if(!$present)353 {354 $processed_pkgs = self::packages_that_provide($file);355 if(!empty($processed_pkgs))356 {357 foreach($processed_pkgs as $pkg)358 {359 $needed_os_packages[] = $pkg;360 }361 }362 }363 }364 return $needed_os_packages;365 }366 private static function file_missing_check($file_arr)367 {368 // Checks if file is missing369 $file_missing = false;370 if(!is_array($file_arr))371 {372 $file_arr = pts_strings::comma_explode($file_arr);373 }374 foreach($file_arr as $file)375 {376 $file_is_there = false;377 $file = explode('OR', $file);378 for($i = 0; $i < count($file) && $file_is_there == false; $i++)379 {380 $file[$i] = trim($file[$i]);381 if(is_file($file[$i]) || is_dir($file[$i]) || is_link($file[$i]))382 {383 $file_is_there = true;384 }385 else if(isset($file[$i][1]) && $file[$i][0] != '/')386 {387 // See if it's some relative command/path388 if(substr($file[$i], -2) == '.h' || substr($file[$i], -4) == '.hpp')389 {390 // May just be a relative header file to look for...391 $possible_paths = array('/usr/local/include/', '/usr/target/include/', '/usr/include/', '/usr/include/x86_64-linux-gnu/', '/usr/include/powerpc64le-linux-gnu/');392 foreach($possible_paths as $path)393 {394 if(is_file($path . $file[$i]) || is_link($path . $file[$i]))395 {396 $file_is_there = true;397 }398 }399 }400 else if(strpos($file[$i], '.so') !== false || substr($file[$i], -2) == '.a')401 {402 // May just be a relative shared library to look for...403 $possible_paths = array('/usr/local/lib/', '/usr/lib/', '/usr/lib64/', '/usr/lib/x86_64-linux-gnu/', '/usr/lib/i386-linux-gnu/', '/usr/lib/arm-linux-gnueabihf/', '/usr/lib/powerpc64le-linux-gnu/');404 if(getenv('LD_LIBRARY_PATH'))405 {406 foreach(explode(':', getenv('LD_LIBRARY_PATH')) as $path)407 {408 $possible_paths[] = $path . '/';409 }410 }411 foreach($possible_paths as $path)412 {413 if(is_file($path . $file[$i]) || is_link($path . $file[$i]))414 {415 $file_is_there = true;416 }417 }418 }419 else if(strpos($file[$i], '/') === false)420 {421 // May just be a command to look for...422 if(pts_client::executable_in_path($file[$i]))423 {424 $file_is_there = true;425 }426 }427 }428 }429 $file_missing = $file_missing || !$file_is_there;430 }431 return $file_missing;432 }433 private static function install_packages_on_system($os_packages_to_install)434 {435 // Do the actual installing process of packages using the distribution's package management system436 $vendor_install_file = pts_exdep_generic_parser::get_external_dependency_path() . 'scripts/install-' . self::vendor_identifier('installer') . '-packages.sh';437 $pkg_vendor = self::vendor_identifier('package-list');438 // Rebuild the array index since some OS package XML tags provide multiple package names in a single string439 $os_packages_to_install = array_unique(explode(' ', implode(' ', $os_packages_to_install)));440 if(is_file($vendor_install_file))441 {442 // hook into pts_client::$display here if it's desired443 echo PHP_EOL . 'The following dependencies are needed and will be installed: ' . PHP_EOL . PHP_EOL;444 echo pts_user_io::display_text_list($os_packages_to_install);445 echo PHP_EOL . 'This process may take several minutes.' . PHP_EOL;446 echo shell_exec('sh ' . $vendor_install_file . ' ' . implode(' ', $os_packages_to_install));447 }448 else if(is_file(pts_exdep_generic_parser::get_external_dependency_path() . 'dependency-handlers/' . $pkg_vendor . '_dependency_handler.php'))449 {450 require_once(pts_exdep_generic_parser::get_external_dependency_path() . 'dependency-handlers/' . $pkg_vendor . '_dependency_handler.php');451 eval("\$installed = {$pkg_vendor}_dependency_handler::install_dependencies(\$os_packages_to_install);");452 return $installed;453 }454 else455 {456 echo 'Distribution install script not found!';457 }458 }459 private static function vendor_identifier($type)460 {461 $os_vendor = phodevi::read_property('system', 'vendor-identifier');462 switch($type)463 {464 case 'package-list':465 $file_check_success = is_file(pts_exdep_generic_parser::get_external_dependency_path() . 'xml/' . $os_vendor . '-packages.xml');466 break;467 case 'installer':468 $file_check_success = is_file(pts_exdep_generic_parser::get_external_dependency_path() . 'scripts/install-' . $os_vendor . '-packages.sh');469 break;470 }471 if($file_check_success == false)472 {473 // Check the aliases to figure out the upstream distribution474 $vend_id = $os_vendor;475 $os_vendor = false;476 $exdep_generic_parser = new pts_exdep_generic_parser();477 foreach($exdep_generic_parser->get_vendors_list() as $this_vendor)478 {479 $exdep_platform_parser = new pts_exdep_platform_parser($this_vendor);480 $aliases = $exdep_platform_parser->get_aliases();481 if(in_array($vend_id, $aliases))482 {483 $os_vendor = $this_vendor;484 break;485 }486 }487 if($os_vendor == false)488 {489 // Attempt to match the current operating system by seeing what package manager matches490 foreach($exdep_generic_parser->get_vendors_list() as $this_vendor)491 {492 $exdep_platform_parser = new pts_exdep_platform_parser($this_vendor);493 $package_manager = $exdep_platform_parser->get_package_manager();494 if($package_manager != null && pts_client::executable_in_path($package_manager))495 {496 $os_vendor = $this_vendor;497 break;498 }499 }500 }501 }502 return $os_vendor;503 }504 private static function generic_names_to_titles($names)505 {506 $titles = array();507 $generic_dependencies_parser = new pts_exdep_generic_parser();508 foreach($generic_dependencies_parser->get_available_packages() as $package)509 {510 if(in_array($package, $names))511 {512 $package_data = $generic_dependencies_parser->get_package_data($package);513 $titles[] = $package_data['title'];514 }515 }516 sort($titles);517 return $titles;518 }519}520?>...

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1$parser = new pts_exdep_generic_parser();2$parser->get_package_data($package_name);3$parser = new pts_exdep_generic_parser();4$parser->get_package_data($package_name);5$parser = new pts_exdep_generic_parser();6$parser->get_package_data($package_name);7$parser = new pts_exdep_generic_parser();8$parser->get_package_data($package_name);9$parser = new pts_exdep_generic_parser();10$parser->get_package_data($package_name);11$parser = new pts_exdep_generic_parser();12$parser->get_package_data($package_name);13$parser = new pts_exdep_generic_parser();14$parser->get_package_data($package_name);15$parser = new pts_exdep_generic_parser();16$parser->get_package_data($package_name);17$parser = new pts_exdep_generic_parser();18$parser->get_package_data($package_name);19$parser = new pts_exdep_generic_parser();20$parser->get_package_data($package_name);21$parser = new pts_exdep_generic_parser();22$parser->get_package_data($package_name);23$parser = new pts_exdep_generic_parser();24$parser->get_package_data($package_name);

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1require_once 'pts_exdep_generic_parser.php';2$parser = new pts_exdep_generic_parser();3$parser->get_package_data('php5');4$parser->print_package_data();5require_once 'pts_exdep_generic_parser.php';6$parser = new pts_exdep_generic_parser();7$parser->get_package_list();8$parser->print_package_list();9require_once 'pts_exdep_generic_parser.php';10$parser = new pts_exdep_generic_parser();11$parser->get_package_list();12$parser->print_package_list();13require_once 'pts_exdep_generic_parser.php';14$parser = new pts_exdep_generic_parser();15$parser->get_package_list();16$parser->print_package_list();17require_once 'pts_exdep_generic_parser.php';18$parser = new pts_exdep_generic_parser();19$parser->get_package_list();20$parser->print_package_list();21require_once 'pts_exdep_generic_parser.php';22$parser = new pts_exdep_generic_parser();23$parser->get_package_list();24$parser->print_package_list();25require_once 'pts_exdep_generic_parser.php';26$parser = new pts_exdep_generic_parser();27$parser->get_package_list();28$parser->print_package_list();29require_once 'pts_exdep_generic_parser.php';30$parser = new pts_exdep_generic_parser();31$parser->get_package_list();32$parser->print_package_list();33require_once 'pts_exdep_generic_parser.php';34$parser = new pts_exdep_generic_parser();35$parser->get_package_list();36$parser->print_package_list();

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1require_once('pts_exdep_generic_parser.php');2$parser = new pts_exdep_generic_parser();3$package_data = $parser->get_package_data('2.0.0');4print_r($package_data);5 (6 (7 (8 (

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1$parser = new pts_exdep_generic_parser();2$parser->get_package_data('php');3$parser = new pts_exdep_generic_parser();4$parser->get_package_data('php5');5$parser = new pts_exdep_generic_parser();6$parser->get_package_data('php-5');7$parser = new pts_exdep_generic_parser();8$parser->get_package_data('php-5.4');9$parser = new pts_exdep_generic_parser();10$parser->get_package_data('php-5.4.0');11$parser = new pts_exdep_generic_parser();12$parser->get_package_data('php-5.4.0-1');13$parser = new pts_exdep_generic_parser();14$parser->get_package_data('php-5.4.0-1.fc20');15$parser = new pts_exdep_generic_parser();16$parser->get_package_data('php-5.4.0-1.fc20.x86_64');17$parser = new pts_exdep_generic_parser();18$parser->get_package_data('php-5.4.0-1.fc20.x86_64.rpm');

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1require_once('pts_exdep_generic_parser.php');2$generic_parser = new pts_exdep_generic_parser;3$generic_parser->get_package_data("2.php");4require_once('pts_exdep_generic_parser.php');5$generic_parser = new pts_exdep_generic_parser;6$generic_parser->get_package_data("2.php");7require_once('pts_exdep_generic_parser.php');8$generic_parser = new pts_exdep_generic_parser;9$generic_parser->get_package_data("2.php");10require_once('pts_exdep_generic_parser.php');11$generic_parser = new pts_exdep_generic_parser;12$generic_parser->get_package_data("2.php");13require_once('pts_exdep_generic_parser.php');14$generic_parser = new pts_exdep_generic_parser;15$generic_parser->get_package_data("2.php");16require_once('pts_exdep_generic_parser.php');17$generic_parser = new pts_exdep_generic_parser;18$generic_parser->get_package_data("2.php");

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1$exdep = new pts_exdep_generic_parser();2$exdep->get_package_data($package_name, $package_version);3$exdep->get_package_data($package_name, $package_version, $package_extension);4$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture);5$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution);6$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version);7$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version, $package_maintainer);8$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version, $package_maintainer, $package_maintainer_url);9$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version, $package_maintainer, $package_maintainer_url, $package_license);10$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version, $package_maintainer, $package_maintainer_url, $package_license, $package_summary);11$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version, $package_maintainer, $package_maintainer_url, $package_license, $package_summary, $package_url);12$exdep->get_package_data($package_name, $package_version, $package_extension, $package_architecture, $package_distribution, $package_distribution_version, $package_maintainer, $package_maintainer_url, $package_license, $package_summary, $package_url, $package_description);13$exdep = new pts_exdep_parser();14$exdep->get_package_data($package_name, $package_version);15$exdep->get_package_data($package_name, $package_version, $package_extension);

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1$package = 'package_name';2$package_data = pts_exdep_generic_parser::get_package_data($package);3print_r($package_data);4$package = 'package_name';5$package_data = pts_exdep_generic_parser::get_package_data($package, 'debian');6print_r($package_data);7$package = 'package_name';8$package_data = pts_exdep_generic_parser::get_package_data($package, 'ubuntu');9print_r($package_data);10$package = 'package_name';11$package_data = pts_exdep_generic_parser::get_package_data($package, 'fedora');12print_r($package_data);13$package = 'package_name';14$package_data = pts_exdep_generic_parser::get_package_data($package, 'opensuse');15print_r($package_data);16$package = 'package_name';17$package_data = pts_exdep_generic_parser::get_package_data($package, 'mageia');18print_r($package_data);19$package = 'package_name';20$package_data = pts_exdep_generic_parser::get_package_data($package, 'arch');21print_r($package_data);22$package = 'package_name';

Full Screen

Full Screen

get_package_data

Using AI Code Generation

copy

Full Screen

1require_once('exdep_generic_parser.php');2$exdep_generic_parser = new pts_exdep_generic_parser();3$package_data = $exdep_generic_parser->get_package_data('php');4$package_dependencies = $exdep_generic_parser->get_package_dependencies('php');5print_r($package_data);6print_r($package_dependencies);

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger get_package_data code on LambdaTest Cloud Grid

Execute automation tests with get_package_data on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful