- Timestamp:
- Dec 11, 2011, 3:30:43 PM (12 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r597 r598 1 2011-12-11 <rybkin@lal.in2p3.fr> 475 2 3 * source/cmt_error.h: In class CmtError, introduce system_error code 4 * source/cmt_error.cxx: In class TheError, in constructor add introduced 5 system_error code string name 6 * source/cmt_parser.cxx: In class Cmt, in function do_create, check return 7 value of all invoked functions, set error on failure making use of 8 system_error code, and return, so that exit value of "cmt create" command 9 be set according to command success/failure 10 1 11 2011-12-11 <rybkin@lal.in2p3.fr> 474 2 12 -
CMT/HEAD/source/cmt_error.cxx
r530 r598 30 30 error_names.add() = "version conflict"; 31 31 error_names.add() = "file access error"; 32 error_names.add() = "system error"; 32 33 error_names.add() = "configuration error"; 33 34 error_names.add() = "execution error"; -
CMT/HEAD/source/cmt_error.h
r530 r598 31 31 version_conflict, 32 32 file_access_error, 33 system_error, 33 34 configuration_error, 34 35 execution_error, -
CMT/HEAD/source/cmt_parser.cxx
r595 r598 3386 3386 3387 3387 the_path = CmtSystem::pwd (); 3388 if (0 == the_path.size ()) 3389 { 3390 CmtError::set (CmtError::system_error, "pwd empty"); 3391 return; 3392 } 3388 3393 3389 3394 if (offset != "") … … 3420 3425 if (!CmtSystem::mkdir (the_path)) 3421 3426 { 3422 CmtMessage::error ("Cannot create the path directory"); 3423 // cout << "Cannot create the path directory" << endl; 3427 CmtError::set (CmtError::system_error, 3428 "Cannot create path directory " + the_path); 3429 //CmtMessage::error ("Cannot create path directory " + the_path); 3424 3430 return; 3425 3431 } … … 3427 3433 { 3428 3434 if (CmtMessage::active (Info)) 3429 cout << "Installing the path directory" << endl; 3430 } 3431 } 3432 3433 CmtSystem::cd (the_path); 3435 cout << "Installing path directory " << the_path << endl; 3436 } 3437 } 3438 3439 if (!CmtSystem::cd (the_path)) 3440 { 3441 CmtError::set (CmtError::system_error, 3442 "Cannot cd to path directory " + the_path); 3443 return; 3444 } 3434 3445 3435 3446 if (!CmtSystem::test_directory (package)) … … 3437 3448 if (!CmtSystem::mkdir (package)) 3438 3449 { 3439 CmtMessage::error ("Cannot create the package directory"); 3440 // cout << "Cannot create the package directory" << endl; 3450 CmtError::set (CmtError::system_error, 3451 "Cannot create package directory " + package); 3452 // CmtMessage::error ("Cannot create the package directory"); 3441 3453 return; 3442 3454 } … … 3444 3456 { 3445 3457 if (CmtMessage::active (Info)) 3446 cout << "Installing thepackage directory" << endl;3458 cout << "Installing package directory" << endl; 3447 3459 } 3448 3460 } … … 3453 3465 } 3454 3466 3455 CmtSystem::cd (package); 3467 if (!CmtSystem::cd (package)) 3468 { 3469 CmtError::set (CmtError::system_error, 3470 "Cannot cd to package directory " + package); 3471 return; 3472 } 3473 // CmtSystem::cd (package); 3456 3474 3457 3475 Use& current_use = Use::current (); … … 3485 3503 if (!CmtSystem::mkdir (version)) 3486 3504 { 3487 CmtMessage::error ("Cannot create the version directory"); 3488 // cout << "Cannot create the version directory" << endl; 3505 //CmtMessage::error ("Cannot create the version directory"); 3506 CmtError::set (CmtError::system_error, 3507 "Cannot create version directory " + version); 3489 3508 return; 3490 3509 } … … 3492 3511 { 3493 3512 if (CmtMessage::active (Info)) 3494 cout << "Installing theversion directory" << endl;3513 cout << "Installing version directory" << endl; 3495 3514 } 3496 3515 } … … 3501 3520 } 3502 3521 3503 CmtSystem::cd (version); 3522 if (!CmtSystem::cd (version)) 3523 { 3524 CmtError::set (CmtError::system_error, 3525 "Cannot cd to version directory " + version); 3526 return; 3527 } 3528 // CmtSystem::cd (version); 3504 3529 } 3505 3530 else … … 3515 3540 if (!CmtSystem::mkdir ("cmt")) 3516 3541 { 3517 CmtMessage::error ("Cannot create the cmt directory"); 3518 // cout << "Cannot create the cmt directory" << endl; 3542 CmtError::set (CmtError::system_error, 3543 "Cannot create cmt directory"); 3544 //CmtMessage::error ("Cannot create the cmt directory"); 3519 3545 return; 3520 3546 } … … 3533 3559 3534 3560 if (CmtMessage::active (Info)) 3535 cout << "Installing thecmt directory" << endl;3561 cout << "Installing cmt directory" << endl; 3536 3562 } 3537 3563 } … … 3576 3602 if (!CmtSystem::mkdir ("src")) 3577 3603 { 3578 CmtMessage::error ("Cannot create the src directory"); 3579 // cout << "Cannot create the src directory" << endl; 3604 CmtError::set (CmtError::system_error, 3605 "Cannot create src directory"); 3606 //CmtMessage::error ("Cannot create the src directory"); 3580 3607 return; 3581 3608 } … … 3583 3610 { 3584 3611 if (CmtMessage::active (Info)) 3585 cout << "Installing thesrc directory" << endl;3612 cout << "Installing src directory" << endl; 3586 3613 } 3587 3614 } … … 3596 3623 case cmt_style: 3597 3624 // case no_version_style: 3598 CmtSystem::cd ("cmt"); 3625 if (!CmtSystem::cd ("cmt")) 3626 { 3627 CmtError::set (CmtError::system_error, 3628 "Cannot cd to package cmt directory "); 3629 return; 3630 } 3631 //CmtSystem::cd ("cmt"); 3599 3632 break; 3600 3633 case mgr_style: 3601 CmtSystem::cd ("mgr"); 3634 if (!CmtSystem::cd ("mgr")) 3635 { 3636 CmtError::set (CmtError::system_error, 3637 "Cannot cd to package mgr directory "); 3638 return; 3639 } 3640 //CmtSystem::cd ("mgr"); 3602 3641 break; 3603 3642 } … … 3609 3648 // create an empty requirement file. 3610 3649 ofstream f ("requirements"); 3611 if (f) 3612 { 3650 if (!f) 3651 { 3652 CmtError::set (CmtError::file_access_error, "requirements"); 3653 return; 3654 } 3655 f.exceptions (ios::failbit | ios::badbit); 3656 try 3657 { 3613 3658 f << "package " << package << endl; 3614 3659 f << endl; 3615 f.close (); 3616 } 3660 f.close (); // ios_base::failbit 3661 } 3662 catch (const ios::failure& e) 3663 { 3664 CmtSystem::close_ostream (NULL, "requirements: " + cmt_string (e.what ())); 3665 } 3617 3666 } 3618 3667 … … 3621 3670 // ofstream f ("version.cmt"); 3622 3671 ofstream f (Package::get_version_file_name ()); 3623 if (f) 3624 { 3672 if (!f) 3673 { 3674 CmtError::set (CmtError::file_access_error, 3675 Package::get_version_file_name ()); 3676 return; 3677 } 3678 f.exceptions (ios::failbit | ios::badbit); 3679 try 3680 { 3625 3681 f << version << endl; 3626 f.close (); 3627 } 3682 f.close (); // ios_base::failbit 3683 } 3684 catch (const ios::failure& e) 3685 { 3686 CmtSystem::close_ostream (NULL, Package::get_version_file_name () + 3687 + ": " + cmt_string (e.what ())); 3688 } 3628 3689 } 3629 3690 … … 3632 3693 Me.m_current_path = the_path; 3633 3694 Me.m_current_dir = CmtSystem::pwd (); 3695 if (0 == Me.m_current_dir.size ()) 3696 { 3697 CmtError::set (CmtError::system_error, "pwd empty"); 3698 return; 3699 } 3634 3700 3635 3701 do_config (ap);
Note: See TracChangeset
for help on using the changeset viewer.