mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
COPKGManager: add more error handlers
This commit is contained in:
@@ -154,7 +154,8 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
|
|||||||
if (fileBrowser.exec((*local_dir).c_str()))
|
if (fileBrowser.exec((*local_dir).c_str()))
|
||||||
{
|
{
|
||||||
string pkg_name = fileBrowser.getSelectedFile()->Name;
|
string pkg_name = fileBrowser.getSelectedFile()->Name;
|
||||||
installPackage(pkg_name);
|
if (!installPackage(pkg_name))
|
||||||
|
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
|
||||||
|
|
||||||
*local_dir = fileBrowser.getCurrentDir();
|
*local_dir = fileBrowser.getCurrentDir();
|
||||||
refreshMenu();
|
refreshMenu();
|
||||||
@@ -641,22 +642,25 @@ void COPKGManager::handleShellOutput(string& cur_line)
|
|||||||
//check for collected errors and build a message for screen if errors available
|
//check for collected errors and build a message for screen if errors available
|
||||||
if (has_err){
|
if (has_err){
|
||||||
dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] result: %s\n", __func__, __LINE__, cur_line.c_str());
|
dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] result: %s\n", __func__, __LINE__, cur_line.c_str());
|
||||||
|
|
||||||
size_t pos1 = cur_line.find(" * ");
|
size_t pos1 = cur_line.find(" * ");
|
||||||
if (pos1 != string::npos){
|
|
||||||
|
//trivial errors:
|
||||||
|
//duplicate option cache: option is defined in OPKG_CL_CONFIG_OPTIONS, NOTE: if found first cache option in the opkg.conf file, this will be preferred
|
||||||
|
if (cur_line.find("Duplicate option cache") != string::npos){
|
||||||
|
has_err = true;
|
||||||
|
}
|
||||||
|
else if (pos1 != string::npos){
|
||||||
string str = cur_line.substr(pos1, cur_line.length()-pos1);
|
string str = cur_line.substr(pos1, cur_line.length()-pos1);
|
||||||
err_msg += str.replace(pos1, 3,"") + "\n";
|
err_msg += str.replace(pos1, 3,"") + "\n";
|
||||||
|
has_err = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//find obvious errors
|
//find obvious errors
|
||||||
//download error:
|
//download error:
|
||||||
size_t pos01 = cur_line.find("wget returned 4");
|
else if (cur_line.find("wget returned 4") != string::npos){
|
||||||
if (pos01 != string::npos)
|
|
||||||
err_msg = "Network error! Online update not possible. Please check your network connection!\n";
|
err_msg = "Network error! Online update not possible. Please check your network connection!\n";
|
||||||
|
has_err = true;
|
||||||
//duplicate option cache: option is defined in OPKG_CL_CONFIG_OPTIONS, NOTE: if found first cache option in the opkg.conf file, this will be preferred
|
}
|
||||||
pos01 = cur_line.find("Duplicate option cache");
|
|
||||||
if (pos01 != string::npos)
|
|
||||||
has_err = false;
|
|
||||||
}else{
|
}else{
|
||||||
size_t pos2 = cur_line.find("Collected errors:");
|
size_t pos2 = cur_line.find("Collected errors:");
|
||||||
if (pos2 != string::npos)
|
if (pos2 != string::npos)
|
||||||
@@ -680,7 +684,7 @@ bool COPKGManager::installPackage(const std::string& pkg_name)
|
|||||||
int r = execCmd(pkg_types[OM_INSTALL] + pkg_name, true, true);
|
int r = execCmd(pkg_types[OM_INSTALL] + pkg_name, true, true);
|
||||||
|
|
||||||
if (r){
|
if (r){
|
||||||
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
|
// showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user