📄 cdl_exec.cxx
字号:
if (ignore_errors || (0 == config->get_all_conflicts().size())) { status = true; } } catch (CdlStringException exception) { exception_handler (exception); } catch (...) { exception_handler (); } delete_cdl_data (); return status;}// ----------------------------------------------------------------------------boolcdl_exec::cmd_add (const std::vector<std::string> cdl_packages){ bool status = false; try { init(true); for (unsigned int n = 0; n < cdl_packages.size (); n++) { config->load_package (resolve_package_alias (cdl_packages [n]), "", &diagnostic_handler, &diagnostic_handler); } if (debug_level_set) { this->update_debug_level(); } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); } report_conflicts(); if (!no_updates) { config->save (savefile); } if (ignore_errors || (0 == config->get_all_conflicts().size())) { status = true; } } catch (CdlStringException exception) { exception_handler (exception); } catch (...) { exception_handler (); } delete_cdl_data (); return status;}// ----------------------------------------------------------------------------boolcdl_exec::cmd_remove (const std::vector<std::string> cdl_packages){ unsigned int n; bool status = false; try { init(true); for (n = 0; n < cdl_packages.size (); n++) { if (! config->lookup (resolve_package_alias (cdl_packages [n]))) { throw CdlStringException ("Unknown package " + cdl_packages [n]); } } for (n = 0; n < cdl_packages.size (); n++) { config->unload_package (resolve_package_alias (cdl_packages [n])); } if (debug_level_set) { this->update_debug_level(); } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); } report_conflicts(); if (!no_updates) { config->save (savefile); } if (ignore_errors || (0 == config->get_all_conflicts().size())) { status = true; } } catch (CdlStringException exception) { exception_handler (exception); } catch (...) { exception_handler (); } delete_cdl_data (); return status;}// ----------------------------------------------------------------------------boolcdl_exec::cmd_version (const std::string cdl_version, const std::vector<std::string> cdl_packages){ bool status = false; try { init(true); for (unsigned int n = 0; n < cdl_packages.size (); n++) { config->change_package_version(resolve_package_alias (cdl_packages [n]), cdl_version, &diagnostic_handler, &diagnostic_handler, true); } if (debug_level_set) { this->update_debug_level(); } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); } report_conflicts(); if (!no_updates) { config->save (savefile); } if (ignore_errors || (0 == config->get_all_conflicts().size())) { status = true; } } catch (CdlStringException exception) { exception_handler (exception); } catch (...) { exception_handler (); } delete_cdl_data (); return status;}// ----------------------------------------------------------------------------boolcdl_exec::cmd_tree (){ bool status = false; try { init(true); if (debug_level_set) { this->update_debug_level(); } if (!no_resolve) { CdlTransactionBody::set_callback_fn(&transaction_callback); config->resolve_all_conflicts(); } report_conflicts(); if (!no_updates) { config->save (savefile); } // A build tree should only be generated if there are no conflicts, // and suppressed if -n is given. if (no_updates) { // Do nothing } else if (ignore_errors || (0 == config->get_all_conflicts().size())) {#ifdef _MSC_VER char cwd [_MAX_PATH + 1];#else char cwd [PATH_MAX + 1];#endif getcwd (cwd, sizeof cwd);#ifdef __CYGWIN__ char cwd_win32 [MAXPATHLEN + 1]; cygwin_conv_to_win32_path (cwd, cwd_win32); generate_build_tree (config, cwd_win32, install_prefix);#else generate_build_tree (config, cwd, install_prefix);#endif config->generate_config_headers (install_prefix.empty () ? "install/include/pkgconf" : install_prefix + "/include/pkgconf"); status = true;#ifdef __CYGWIN__ char buf[100]; strcpy(buf, "mount.exe -f -t -u x: /ecos-x"); //printf("Cwd_win32: %s\n", cwd_win32); if ( cwd_win32[1] == ':' ) { buf[19] = tolower(cwd_win32[0]); buf[28] = tolower(cwd_win32[0]); system(buf); } //printf("Repository: %s\n", repository.c_str()); if ( repository[1] == ':' ) { buf[19] = tolower(repository[0]); buf[28] = tolower(repository[0]); system(buf); } if ( !install_prefix.empty() ) { //printf("Install prefix: %s\n", install_prefix.c_str()); if ( install_prefix[1] == ':' ) { buf[19] = tolower(install_prefix[0]); buf[28] = tolower(install_prefix[0]); system(buf); } }#endif } else { printf("\nUnable to generate build tree, this configuration still contains conflicts.\n"); printf("Either resolve the conflicts or use --ignore-errors\n"); } } catch (CdlStringException exception) { exception_handler (exception); } catch (...) { exception_handler (); } delete_cdl_data (); return status;}// ----------------------------------------------------------------------------boolcdl_exec::cmd_list (){ bool status = false; try { init(false); // list the installed packages std::vector<std::string> packages = pkgdata->get_packages (); std::sort (packages.begin (), packages.end ()); for (unsigned int package = 0; package < packages.size (); package++) { const std::vector<std::string> & aliases = pkgdata->get_package_aliases (packages [package]); printf ("Package %s (%s):\n aliases:", packages [package].c_str (), aliases [0].c_str ()); for (unsigned int alias = 1; alias < aliases.size (); alias++) { printf (" %s", aliases [alias].c_str ()); } const std::vector<std::string> & versions = pkgdata->get_package_versions (packages [package]); printf ("\n versions:"); for (unsigned int version = 0; version < versions.size (); version++) { printf (" %s", versions [version].c_str ()); } printf ("\n"); } // list the available targets std::vector<std::string> targets = pkgdata->get_targets (); std::sort (targets.begin (), targets.end ()); for (unsigned int target = 0; target < targets.size (); target++) { const std::vector<std::string> & aliases = pkgdata->get_target_aliases (targets [target]); printf ("Target %s (%s):\n aliases:", targets [target].c_str (), aliases [0].c_str ()); for (unsigned int alias = 1; alias < aliases.size (); alias++) { printf (" %s", aliases [alias].c_str ()); } printf ("\n"); } // list the available templates std::vector<std::string> templates = pkgdata->get_templates (); std::sort (templates.begin (), templates.end ()); for (unsigned int templ = 0; templ < templates.size (); templ++) { const std::vector<std::string> & versions = pkgdata->get_template_versions (templates [templ]); printf ("Template %s:\n versions:", templates [templ].c_str ()); for (unsigned int version = 0; version < versions.size (); version++) { printf (" %s", versions [version].c_str ()); } printf ("\n"); } status = true; } catch (CdlStringException exception) { exception_handler (exception); } catch (...) { exception_handler (); } delete_cdl_data (); return status;}// ----------------------------------------------------------------------------boolcdl_exec::cmd_check (){ bool status = false; unsigned int n; try { init(true); // check() should never invoke the inference engine. The user // wants to determine the current status, which should not // change. // However, updating the savefile is worthwhile because it // will now contain more accurate information about the state. // Enabling/disabling debugs is allowed for now because that // is unlikely to introduce conflicts. if (debug_level_set) { this->update_debug_level(); } if (!no_updates) { config->save (savefile); } // report current target and template printf ("Target: %s\n", config->get_hardware ().c_str ()); printf ("Template: %s\n", config->get_template ().c_str ()); std::vector<std::string> template_packages = pkgdata->get_template_packages (config->get_template ()); const std::vector<std::string> & hardware_packages = pkgdata->get_target_packages (config->get_hardware ()); for (n = 0; n < hardware_packages.size (); n++) { template_packages.push_back (hardware_packages [n]); } // report loaded packages not in the templates const std::vector<CdlLoadable> & loadables = config->get_loadables (); std::vector<std::string> added_packages; std::vector<CdlLoadable>::const_iterator loadable_i; for (loadable_i = loadables.begin (); loadable_i != loadables.end (); loadable_i++) { const CdlNode & node = dynamic_cast<CdlNode> (* loadable_i); if (template_packages.end () == std::find (template_packages.begin (), template_packages.end (), node->get_name ())) { added_packages.push_back (node->get_name ()); } } if (added_packages.size ()) { printf ("Added:\n"); } for (n = 0; n < added_packages.size (); n++) { printf (" %s\n", added_packages [n].c_str ()); } // report template packages not in the configuration std::vector<std::string> removed_packages;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -