int SQY_h5_link(const char* pSrcFileName, const char* pSrcLinkPath, const char* pSrcLinkName, const char* pTargetFile, const char* pTargetDatasetPath, const char* pTargetDatasetName ){ int rvalue = 1; // H5::Exception::dontPrint(); bfs::path src_p = pSrcFileName; sqy::h5_file src(src_p, bfs::exists(src_p) ? H5F_ACC_RDWR : H5F_ACC_TRUNC); std::stringstream src_path(""); src_path << pSrcLinkPath << "/" << pSrcLinkName; bfs::path dst_p = pTargetFile; sqy::h5_file dest(dst_p); std::stringstream dest_path(""); dest_path << pTargetDatasetPath << "/" << pTargetDatasetName; if(dest.has_h5_item(dest_path.str())) rvalue = src.setup_link(src_path.str(),dest,dest_path.str()); else rvalue = 1; return rvalue; }
//----------------------------------------------------------------------------- bool copy_file( std::string source_path, std::string target_path ) { boost::system::error_code ec; boost::filesystem::path src_path( source_path ); boost::filesystem::path tgt_path( target_path ); copy( src_path, tgt_path, ec ); if( ec != boost::system::errc::success ) { // TODO handle std::cerr << ec.message() << std::endl; return false; } return true; }
void dir_cpi_impl::sync_remove (saga::impl::void_t & ret, saga::url url, int flags) { instance_data idata (this); saga::url dir_url(idata->location_); boost::filesystem::path src_location (idata->location_.get_path(), boost::filesystem::native); // complete paths boost::filesystem::path src_path (url.get_path(), boost::filesystem::native); if ( ! src_path.has_root_path () ) src_location /= src_path; else src_location = src_path; bool is_src_dir = false; if(hdfsExists(fs_, src_location.string().c_str()) != 0) { SAGA_ADAPTOR_THROW("directory::remove: Can't remove directory: " "Does not exist", saga::DoesNotExist); } else { hdfsFileInfo *info; info = hdfsGetPathInfo(fs_, src_location.string().c_str()); if(info == NULL) { SAGA_ADAPTOR_THROW("file_cpi_impl::init failed", saga::NoSuccess); } if(info->mKind == kObjectKindDirectory) is_src_dir = true; else is_src_dir = false; hdfsFreeFileInfo(info, 1); } if (is_src_dir) { if (saga::name_space::Recursive != flags) { SAGA_ADAPTOR_THROW("directory::remove: Can't remove directory. " "Please use recursive mode!", saga::BadParameter); } else { saga_hdfs_delete(fs_, src_location.string().c_str()); } } else { saga_hdfs_delete(fs_, src_location.string().c_str()); } }
bool BundleCompiler::compile(const char* type, const char* name, const char* platform) { StringId64 _type(type); StringId64 _name(name); TempAllocator512 alloc; DynamicString path(alloc); TempAllocator512 alloc2; DynamicString src_path(alloc2); src_path += name; src_path += "."; src_path += type; char res_name[1 + 2*StringId64::STRING_LENGTH]; _type.to_string(res_name); res_name[16] = '-'; _name.to_string(res_name + 17); path::join(CROWN_DATA_DIRECTORY, res_name, path); CE_LOGI("%s <= %s.%s", res_name, name, type); bool success = true; jmp_buf buf; Buffer output(default_allocator()); array::reserve(output, 4*1024*1024); if (!setjmp(buf)) { CompileOptions opts(_source_fs, output, platform, &buf); compile(_type, src_path.c_str(), opts); File* outf = _bundle_fs.open(path.c_str(), FileOpenMode::WRITE); u32 size = array::size(output); u32 written = outf->write(array::begin(output), size); _bundle_fs.close(*outf); success = size == written; } else { success = false; } return success; }
//----------------------------------------------------------------------------- bool copy_directory( std::string source_path, std::string target_path ) { boost::system::error_code ec; // get the directory if( !get_directory( target_path ) ) return false; // clean this directory, i.e. remove all children but not this directory if( !clean_directory( target_path ) ) return false; boost::filesystem::path src_path( source_path ); boost::filesystem::path tgt_path( target_path ); typedef std::vector<boost::filesystem::path> paths_t; paths_t src_paths; copy( boost::filesystem::directory_iterator( src_path ), boost::filesystem::directory_iterator(), back_inserter( src_paths ) ); for( paths_t::const_iterator it = src_paths.begin(); it != src_paths.end(); it++ ) { boost::filesystem::path::iterator rel_path = --it->end(); boost::filesystem::path next_src_path = *it; boost::filesystem::path next_tgt_path = tgt_path; next_tgt_path /= *rel_path; //std::cout << next_src_path << " -> " << next_tgt_path << '\n'; if( boost::filesystem::is_directory( next_src_path, ec ) ) { // if it is a directory, recurse if( !copy_directory( next_src_path.string(), next_tgt_path.string() ) ) { return false; } } else { // otherwise, let boost handle the copy copy( next_src_path, next_tgt_path, ec ); if( ec != boost::system::errc::success ) { std::cerr << ec.message() << std::endl; return false; } } } return true; }
void dir_cpi_impl::sync_make_dir (saga::impl::void_t & ret, saga::url url, int flags) { instance_data idata (this); // verify current working directory is local saga::url dir_url(idata->location_); boost::filesystem::path src_location (idata->location_.get_path(), boost::filesystem::native); // complete paths boost::filesystem::path src_path (url.get_path(), boost::filesystem::native); if ( ! src_path.has_root_path () ) src_location /= src_path; else src_location = src_path; if(hdfsCreateDirectory(fs_, src_location.string().c_str()) != 0) { SAGA_ADAPTOR_THROW("Could not create directory", saga::NoSuccess); } }
//-------------------------------------------------------- void WebSocketDSClass::write_class_property() { // First time, check if database used if (Tango::Util::_UseDb == false) return; Tango::DbData data; string classname = get_name(); string header; string::size_type start, end; // Put title Tango::DbDatum title("ProjectTitle"); string str_title("WebSocket access to tango device-server attributes, pipes and commands"); title << str_title; data.push_back(title); // Put Description Tango::DbDatum description("Description"); vector<string> str_desc; str_desc.push_back("WebSocket access to tango device-server attributes."); str_desc.push_back(""); str_desc.push_back("Configuration should be done via properties:"); str_desc.push_back(""); str_desc.push_back("Port - port to listen incoming ws connections;"); str_desc.push_back("DeviceServer - tango id of a required device server;"); str_desc.push_back("Attributes - list of required DS attributes, you wish to read via WS;"); str_desc.push_back("Commands - list of required DS commandes, you wish to executed via WS;"); str_desc.push_back("AuthDS - Tango web authentication device server (TangoWebAuth ) name."); str_desc.push_back("Secure - It will be used wss connection (websocket secure). (true if you want)"); str_desc.push_back("Certificate - Certificate file name (crt) with full path (if Secure = true)"); str_desc.push_back("Key - Private key file name (if Secure = true)"); str_desc.push_back("Options - Various options for the device server"); str_desc.push_back(""); str_desc.push_back("Then you should set polling to the UpdateData command. (1000 means that all connected clients would read attributes once per second)."); str_desc.push_back(""); str_desc.push_back("Data format: JSON string with array of attrubute objects {atrrtibute name, attribute value, quality, timestamp};"); str_desc.push_back(""); str_desc.push_back("if you want to record in the logs, define uselog in Property ``Options``."); str_desc.push_back("The database (defined in AuthDS) must contain a table `command_history` with columns:"); str_desc.push_back(" // id - autoincrement"); str_desc.push_back(" // argin[0] = timestamp_string UNIX_TIMESTAMP"); str_desc.push_back(" // argin[1] = login"); str_desc.push_back(" // argin[2] = deviceName"); str_desc.push_back(" // argin[3] = IP"); str_desc.push_back(" // argin[4] = commandName"); str_desc.push_back(" // argin[5] = commandJson"); str_desc.push_back(" // argin[6] = statusBool"); str_desc.push_back(" // argin[7] = isGroup"); description << str_desc; data.push_back(description); // put cvs or svn location string filename("WebSocketDS"); filename += "Class.cpp"; // check for cvs information string src_path(CvsPath); start = src_path.find("/"); if (start!=string::npos) { end = src_path.find(filename); if (end>start) { string strloc = src_path.substr(start, end-start); // Check if specific repository start = strloc.find("/cvsroot/"); if (start!=string::npos && start>0) { string repository = strloc.substr(0, start); if (repository.find("/segfs/")!=string::npos) strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); } Tango::DbDatum cvs_loc("cvs_location"); cvs_loc << strloc; data.push_back(cvs_loc); } } // check for svn information else { string src_path(SvnPath); start = src_path.find("://"); if (start!=string::npos) { end = src_path.find(filename); if (end>start) { header = "$HeadURL: "; start = header.length(); string strloc = src_path.substr(start, (end-start)); Tango::DbDatum svn_loc("svn_location"); svn_loc << strloc; data.push_back(svn_loc); } } } // Get CVS or SVN revision tag // CVS tag string tagname(TagName); header = "$Name: "; start = header.length(); string endstr(" $"); end = tagname.find(endstr); if (end!=string::npos && end>start) { string strtag = tagname.substr(start, end-start); Tango::DbDatum cvs_tag("cvs_tag"); cvs_tag << strtag; data.push_back(cvs_tag); } // SVN tag string svnpath(SvnPath); header = "$HeadURL: "; start = header.length(); end = svnpath.find(endstr); if (end!=string::npos && end>start) { string strloc = svnpath.substr(start, end-start); string tagstr ("/tags/"); start = strloc.find(tagstr); if ( start!=string::npos ) { start = start + tagstr.length(); end = strloc.find(filename); string strtag = strloc.substr(start, end-start-1); Tango::DbDatum svn_tag("svn_tag"); svn_tag << strtag; data.push_back(svn_tag); } } // Get URL location string httpServ(HttpServer); if (httpServ.length()>0) { Tango::DbDatum db_doc_url("doc_url"); db_doc_url << httpServ; data.push_back(db_doc_url); } // Put inheritance Tango::DbDatum inher_datum("InheritedFrom"); vector<string> inheritance; inheritance.push_back("TANGO_BASE_CLASS"); inher_datum << inheritance; data.push_back(inher_datum); // Call database and and values get_db_class()->put_property(data); }
//+---------------------------------------------------------------------------- // // method : SimulatorCCDClass::write_class_property // // description : Set class description as property in database // //----------------------------------------------------------------------------- void SimulatorCCDClass::write_class_property() { // First time, check if database used //-------------------------------------------- if (Tango::Util::_UseDb == false) return; Tango::DbData data; string classname = get_name(); string header; string::size_type start, end; // Put title Tango::DbDatum title("ProjectTitle"); string str_title(""); title << str_title; data.push_back(title); // Put Description Tango::DbDatum description("Description"); vector<string> str_desc; str_desc.push_back(" "); description << str_desc; data.push_back(description); // put cvs or svn location string filename(classname); filename += "Class.cpp"; // Create a string with the class ID to // get the string into the binary string class_id(ClassId); // check for cvs information string src_path(CvsPath); start = src_path.find("/"); if (start!=string::npos) { end = src_path.find(filename); if (end>start) { string strloc = src_path.substr(start, end-start); // Check if specific repository start = strloc.find("/cvsroot/"); if (start!=string::npos && start>0) { string repository = strloc.substr(0, start); if (repository.find("/segfs/")!=string::npos) strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); } Tango::DbDatum cvs_loc("cvs_location"); cvs_loc << strloc; data.push_back(cvs_loc); } } // check for svn information else { string src_path(SvnPath); start = src_path.find("://"); if (start!=string::npos) { end = src_path.find(filename); if (end>start) { header = "$HeadURL: "; start = header.length(); string strloc = src_path.substr(start, (end-start)); Tango::DbDatum svn_loc("svn_location"); svn_loc << strloc; data.push_back(svn_loc); } } } // Get CVS or SVN revision tag // CVS tag string tagname(TagName); header = "$Name: "; start = header.length(); string endstr(" $"); end = tagname.find(endstr); if (end!=string::npos && end>start) { string strtag = tagname.substr(start, end-start); Tango::DbDatum cvs_tag("cvs_tag"); cvs_tag << strtag; data.push_back(cvs_tag); } // SVN tag string svnpath(SvnPath); header = "$HeadURL: "; start = header.length(); end = svnpath.find(endstr); if (end!=string::npos && end>start) { string strloc = svnpath.substr(start, end-start); string tagstr ("/tags/"); start = strloc.find(tagstr); if ( start!=string::npos ) { start = start + tagstr.length(); end = strloc.find(filename); string strtag = strloc.substr(start, end-start-1); Tango::DbDatum svn_tag("svn_tag"); svn_tag << strtag; data.push_back(svn_tag); } } // Get URL location string httpServ(HttpServer); if (httpServ.length()>0) { Tango::DbDatum db_doc_url("doc_url"); db_doc_url << httpServ; data.push_back(db_doc_url); } // Put inheritance Tango::DbDatum inher_datum("InheritedFrom"); vector<string> inheritance; inheritance.push_back("Device_4Impl"); inher_datum << inheritance; data.push_back(inher_datum); // Call database and and values //-------------------------------------------- get_db_class()->put_property(data); }
Py::Object pysvn_client::cmd_export( const Py::Tuple &a_args, const Py::Dict &a_kws ) { static argument_description args_desc[] = { { true, name_src_url_or_path }, { true, name_dest_path }, { false, name_force }, { false, name_revision }, #if defined( PYSVN_HAS_CLIENT_EXPORT2 ) { false, name_native_eol }, #endif #if defined( PYSVN_HAS_CLIENT_EXPORT3 ) { false, name_ignore_externals }, { false, name_recurse }, { false, name_peg_revision }, #endif #if defined( PYSVN_HAS_CLIENT_EXPORT4 ) { false, name_depth }, #endif { false, NULL } }; FunctionArguments args( "export", args_desc, a_args, a_kws ); args.check(); std::string src_path( args.getUtf8String( name_src_url_or_path ) ); std::string dest_path( args.getUtf8String( name_dest_path ) ); bool is_url = is_svn_url( src_path ); bool force = args.getBoolean( name_force, false ); svn_opt_revision_t revision; if( is_url ) revision = args.getRevision( name_revision, svn_opt_revision_head ); else revision = args.getRevision( name_revision, svn_opt_revision_working ); #if defined( PYSVN_HAS_CLIENT_EXPORT2 ) const char *native_eol = NULL; if( args.hasArg( name_native_eol ) ) { Py::Object native_eol_obj = args.getArg( name_native_eol ); if( native_eol_obj != Py::None() ) { Py::String eol_py_str( native_eol_obj ); std::string eol_str = eol_py_str.as_std_string( g_utf_8 ); if( eol_str == "CR" ) native_eol = "CR"; else if( eol_str == "CRLF" ) native_eol = "CRLF"; else if( eol_str == "LF" ) native_eol = "LF"; else throw Py::ValueError( "native_eol must be one of None, \"LF\", \"CRLF\" or \"CR\"" ); } } #endif #if defined( PYSVN_HAS_CLIENT_EXPORT3 ) #if defined( PYSVN_HAS_CLIENT_EXPORT4 ) svn_depth_t depth = args.getDepth( name_depth, name_recurse, svn_depth_infinity, svn_depth_infinity, svn_depth_files ); #else bool recurse = args.getBoolean( name_recurse, true ); #endif bool ignore_externals = args.getBoolean( name_ignore_externals, false ); svn_opt_revision_t peg_revision = args.getRevision( name_peg_revision, revision ); revisionKindCompatibleCheck( is_url, peg_revision, name_peg_revision, name_url_or_path ); #endif revisionKindCompatibleCheck( is_url, revision, name_revision, name_url_or_path ); svn_revnum_t revnum = 0; SvnPool pool( m_context ); try { std::string norm_src_path( svnNormalisedIfPath( src_path, pool ) ); checkThreadPermission(); PythonAllowThreads permission( m_context ); #if defined( PYSVN_HAS_CLIENT_EXPORT4 ) svn_error_t * error = svn_client_export4 ( &revnum, norm_src_path.c_str(), dest_path.c_str(), &peg_revision, &revision, force, ignore_externals, depth, native_eol, m_context, pool ); #elif defined( PYSVN_HAS_CLIENT_EXPORT3 ) svn_error_t * error = svn_client_export3 ( &revnum, norm_src_path.c_str(), dest_path.c_str(), &peg_revision, &revision, force, ignore_externals, recurse, native_eol, m_context, pool ); #elif defined( PYSVN_HAS_CLIENT_EXPORT2 ) svn_error_t * error = svn_client_export2 ( &revnum, norm_src_path.c_str(), dest_path.c_str(), &revision, force, native_eol, m_context, pool ); #else svn_error_t * error = svn_client_export ( &revnum, norm_src_path.c_str(), dest_path.c_str(), &revision, force, m_context, pool ); #endif permission.allowThisThread(); if( error != NULL ) throw SvnException( error ); } catch( SvnException &e ) { // use callback error over ClientException m_context.checkForError( m_module.client_error ); throw_client_error( e ); } return Py::asObject( new pysvn_revision( svn_opt_revision_number, 0, revnum ) ); }
void dir_cpi_impl::sync_move (saga::impl::void_t & ret, saga::url src, saga::url dest, int flags) { instance_data idata (this); // verify current working directory is local saga::url url(idata->location_); // handle the files boost::filesystem::path src_location (idata->location_.get_path(), boost::filesystem::native); boost::filesystem::path dst_location (src_location); // complete paths boost::filesystem::path src_path (src.get_path(), boost::filesystem::native); boost::filesystem::path dest_path (dest.get_path(), boost::filesystem::native); if ( ! src_path.has_root_path () ) src_location /= src_path; else src_location = src_path; if ( ! dest_path.has_root_path () ) dst_location /= dest_path; else dst_location = dest_path; bool is_src_dir; bool is_dst_dir; if(hdfsExists(fs_, src_location.string().c_str()) == 0) { //Check to see if it is a directory hdfsFileInfo *info; info = hdfsGetPathInfo(fs_, src_location.string().c_str()); if(info == NULL) { SAGA_ADAPTOR_THROW("file_cpi_impl::init failed", saga::NoSuccess); } if(info->mKind == kObjectKindDirectory) is_src_dir = true; else is_src_dir = false; hdfsFreeFileInfo(info, 1); } bool dst_exists = false; if(hdfsExists(fs_, dst_location.string().c_str()) == 0) { dst_exists = true; //Check to see if it is a directory hdfsFileInfo *info; info = hdfsGetPathInfo(fs_, dst_location.string().c_str()); if(info == NULL) { SAGA_ADAPTOR_THROW("file_cpi_impl::init failed", saga::NoSuccess); } if(info->mKind == kObjectKindDirectory) is_dst_dir = true; else is_dst_dir = false; hdfsFreeFileInfo(info, 1); } if (!is_src_dir && is_dst_dir) dst_location /= src_location.leaf(); if ((flags & saga::name_space::Overwrite) && dst_exists) { /* if (is_dst_dir) fs::remove_all(dst_location);*/ saga_hdfs_delete(fs_, dst_location.string().c_str()); } // if destination still exists raise an error dst_exists = false; if(hdfsExists(fs_, dst_location.string().c_str()) == 0) { SAGA_OSSTREAM strm; strm << "namespace_dir_cpi_impl<Base>::sync_move: " "target file already exists: " << dest.get_url(); SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::AlreadyExists); } if(hdfsMove(fs_, src_location.string().c_str(), fs_, dst_location.string().c_str()) != 0) { SAGA_ADAPTOR_THROW("Unable to move files", saga::NoSuccess); } }
void dir_cpi_impl::sync_copy (saga::impl::void_t & ret, saga::url src, saga::url dst, int flags) { instance_data idata (this); saga::url url(idata->location_); // handle the files boost::filesystem::path src_location (idata->location_.get_path(), boost::filesystem::native); boost::filesystem::path dst_location (src_location); // complete paths boost::filesystem::path src_path (src.get_path(), boost::filesystem::native); boost::filesystem::path dest_path (dst.get_path(), boost::filesystem::native); if ( ! src_path.has_root_path () ) src_location /= src_path; else src_location = src_path; if ( ! dest_path.has_root_path () ) dst_location /= dest_path; else dst_location = dest_path; bool is_src_dir = false; if(hdfsExists(fs_, src_location.string().c_str()) == 0) { //Check to see if it is a directory hdfsFileInfo *info; info = hdfsGetPathInfo(fs_, src_location.string().c_str()); if(info == NULL) { SAGA_ADAPTOR_THROW("file_cpi_impl::init failed", saga::NoSuccess); } if(info->mKind == kObjectKindDirectory) is_src_dir = true; hdfsFreeFileInfo(info, 1); } // src location refers to a is a directory if (is_src_dir) { SAGA_ADAPTOR_THROW("Cannot copy directory at moment.", saga::NotImplemented); } else { //Check to see if dst_location is a directory bool is_dst_dir = false; bool dst_exists = false; if(hdfsExists(fs_, dst_location.string().c_str()) == 0) { dst_exists = true; //Check to see if it is a directory hdfsFileInfo *info; info = hdfsGetPathInfo(fs_, dst_location.string().c_str()); if(info == NULL) { SAGA_ADAPTOR_THROW("file_cpi_impl::init failed", saga::NoSuccess); } if(info->mKind == kObjectKindDirectory) is_dst_dir = true; hdfsFreeFileInfo(info, 1); } else { SAGA_ADAPTOR_THROW("Path does not exists!", saga::NoSuccess); } if (is_dst_dir) dst_location /= src_location.leaf(); // remove the file/directory if it exists and we should overwrite if ((flags & saga::name_space::Overwrite) && dst_exists) { /* if (is_dst_dir) fs::remove_all(dst_location);*/ saga_hdfs_delete(fs_, dst_location.string().c_str()); } if(hdfsExists(fs_, dst_location.string().c_str()) == 0) { SAGA_OSSTREAM strm; strm << "namespace_dir_cpi_impl<Base>::sync_copy: " "target file already exists: " << dst.get_url(); SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::AlreadyExists); } if(hdfsCopy(fs_, src_location.string().c_str(), fs_, dst_location.string().c_str()) != 0) { SAGA_OSSTREAM strm; strm << "namespace_dir_cpi_impl<Base>::sync_copy: " "target file did not copy successfully: " << dst.get_url(); SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::NoSuccess); } } }
void copyFilesToMaster() { /* Removig Temporary trace files */ char str[255]; std::fstream p_file; for ( unsigned int j = 0; j < sys.getNetwork()->getNumNodes(); j++ ) { if ( j == sys.getNetwork()->getNodeNum() ) { p_file.open(_listOfTraceFileNames.c_str()); //size_t found = _traceFinalDirectory.find_last_of("/"); std::string dst = std::string(sys.getNetwork()->getMasterHostname() ); if (p_file.is_open()) { unsigned int thread = 0; while (!p_file.eof() ) { p_file.getline (str, 255); if ( strlen(str) > 0 ) { std::string src_path( str ); std::size_t pos = src_path.size() ; for (unsigned int i = 0; i < 2; i++ ) { pos = src_path.find_last_of('/', pos - 1); } //int pos0 = src_path.find_last_of('/'); //int pos1 = src_path.find_first_of(' '); //std::cerr << "len is " << pos1-pos0 << " pos0: " << pos0 << " total size is " << src_path.size()<< "src_path is " << src_path<< std::endl; //std::string name( src_path.substr( pos0, pos1-pos0 ) ); for (unsigned int i = 0; i < strlen(str); i++) if ( str[i] == ' ' ) str[i] = 0x0; // jbueno: cluster workaround until we get the new extrae //if ( sys.getNetwork()->getNodeNum() > 0 ) { // str[ strlen(str) - 12 ] = '0';// + ( (char) ( sys.getNetwork()->getNodeNum() % 10 ) ); // str[ strlen(str) - 13 ] = '0';// + ( (char) ( sys.getNetwork()->getNodeNum() / 10 ) ); // str[ strlen(str) - 14 ] = '0'; // str[ strlen(str) - 15 ] = '0'; // str[ strlen(str) - 16 ] = '0'; // str[ strlen(str) - 17 ] = '0'; //} //std::cerr << "NAME: " << name << std::endl; secureCopy(str, dst + ":" + src_path.substr( 0, pos + 1 ) /* + name */ ); //Copy the symbol file if ( thread == 0 ) { char sym_file_name[256]; std::size_t dot_pos = src_path.find(".mpit"); std::string myName = src_path.substr( src_path.find_last_of('/') + 1, dot_pos - src_path.find_last_of('/') ); sprintf( sym_file_name, "%s/set-0/%ssym", _traceDirectory.c_str(), myName.c_str() ); secureCopy(sym_file_name, dst + ":" + src_path.substr( 0, pos + 1 ) ); } thread += 1; } } p_file.close(); } else std::cout << "Unable to open " << _listOfTraceFileNames << " file" << std::endl; // copy pcf file too //{ // size_t found = _traceFinalDirectory.find_last_of("/"); // size_t found_pcf = _traceFileName_PCF.find_last_of("/"); // char number[16]; // sprintf(number, "%08d", sys.getNetwork()->getNodeNum() ); // secureCopy( _traceFileName_PCF.c_str(), dst + ":" + _traceFinalDirectory.substr(0,found+1) + number + "." + _traceFileName_PCF.substr(found_pcf+1)); //} } nanos_extrae_instrumentation_barrier(); } }
//-------------------------------------------------------- void ModbusControlRfqAndBuncherClass::write_class_property() { // First time, check if database used if (Tango::Util::_UseDb == false) return; Tango::DbData data; string classname = get_name(); string header; string::size_type start, end; // Put title Tango::DbDatum title("ProjectTitle"); string str_title("Control panel for modbus-tcp communication with PLC (DELTA-DVP28SR11R)"); title << str_title; data.push_back(title); // Put Description Tango::DbDatum description("Description"); vector<string> str_desc; str_desc.push_back("Control panel for modbus-tcp communication with PLC (DELTA-DVP28SR11R)"); str_desc.push_back("This device server read registers and read/write flags from PLC."); description << str_desc; data.push_back(description); // put cvs or svn location string filename("ModbusControlRfqAndBuncher"); filename += "Class.cpp"; // check for cvs information string src_path(CvsPath); start = src_path.find("/"); if (start!=string::npos) { end = src_path.find(filename); if (end>start) { string strloc = src_path.substr(start, end-start); // Check if specific repository start = strloc.find("/cvsroot/"); if (start!=string::npos && start>0) { string repository = strloc.substr(0, start); if (repository.find("/segfs/")!=string::npos) strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); } Tango::DbDatum cvs_loc("cvs_location"); cvs_loc << strloc; data.push_back(cvs_loc); } } // check for svn information else { string src_path(SvnPath); start = src_path.find("://"); if (start!=string::npos) { end = src_path.find(filename); if (end>start) { header = "$HeadURL: "; start = header.length(); string strloc = src_path.substr(start, (end-start)); Tango::DbDatum svn_loc("svn_location"); svn_loc << strloc; data.push_back(svn_loc); } } } // Get CVS or SVN revision tag // CVS tag string tagname(TagName); header = "$Name: "; start = header.length(); string endstr(" $"); end = tagname.find(endstr); if (end!=string::npos && end>start) { string strtag = tagname.substr(start, end-start); Tango::DbDatum cvs_tag("cvs_tag"); cvs_tag << strtag; data.push_back(cvs_tag); } // SVN tag string svnpath(SvnPath); header = "$HeadURL: "; start = header.length(); end = svnpath.find(endstr); if (end!=string::npos && end>start) { string strloc = svnpath.substr(start, end-start); string tagstr ("/tags/"); start = strloc.find(tagstr); if ( start!=string::npos ) { start = start + tagstr.length(); end = strloc.find(filename); string strtag = strloc.substr(start, end-start-1); Tango::DbDatum svn_tag("svn_tag"); svn_tag << strtag; data.push_back(svn_tag); } } // Get URL location string httpServ(HttpServer); if (httpServ.length()>0) { Tango::DbDatum db_doc_url("doc_url"); db_doc_url << httpServ; data.push_back(db_doc_url); } // Put inheritance Tango::DbDatum inher_datum("InheritedFrom"); vector<string> inheritance; inheritance.push_back("TANGO_BASE_CLASS"); inher_datum << inheritance; data.push_back(inher_datum); // Call database and and values get_db_class()->put_property(data); }
Py::Object pysvn_client::cmd_move( const Py::Tuple &a_args, const Py::Dict &a_kws ) { static argument_description args_desc[] = { { true, name_src_url_or_path }, { true, name_dest_url_or_path }, { false, name_force }, { false, NULL } }; FunctionArguments args( "move", args_desc, a_args, a_kws ); args.check(); SvnPool pool( m_context ); pysvn_commit_info_t *commit_info = NULL; std::string type_error_message; try { type_error_message = "expecting string for src_url_or_path (arg 1)"; Py::String src_path( args.getUtf8String( name_src_url_or_path ) ); type_error_message = "expecting string for dest_url_or_path (arg 2)"; Py::String dest_path( args.getUtf8String( name_dest_url_or_path ) ); #ifndef PYSVN_HAS_CLIENT_MOVE2 svn_opt_revision_t revision; revision.kind = svn_opt_revision_head; #endif type_error_message = "expecting boolean for keyword force"; bool force = args.getBoolean( name_force, false ); try { std::string norm_src_path( svnNormalisedIfPath( src_path, pool ) ); std::string norm_dest_path( svnNormalisedIfPath( dest_path, pool ) ); checkThreadPermission(); PythonAllowThreads permission( m_context ); #if defined( PYSVN_HAS_CLIENT_MOVE4 ) // behavior changed svn_error_t *error = svn_client_move4 ( &commit_info, norm_src_path.c_str(), norm_dest_path.c_str(), force, m_context, pool ); #elif defined( PYSVN_HAS_CLIENT_MOVE3 ) svn_error_t *error = svn_client_move3 ( &commit_info, // changed type norm_src_path.c_str(), norm_dest_path.c_str(), force, m_context, pool ); #elif defined( PYSVN_HAS_CLIENT_MOVE2 ) svn_error_t *error = svn_client_move2 ( &commit_info, norm_src_path.c_str(), norm_dest_path.c_str(), force, m_context, pool ); #else svn_error_t *error = svn_client_move ( &commit_info, norm_src_path.c_str(), &revision, norm_dest_path.c_str(), force, m_context, pool ); #endif permission.allowThisThread(); if( error != NULL ) throw SvnException( error ); } catch( SvnException &e ) { // use callback error over ClientException m_context.checkForError( m_module.client_error ); throw_client_error( e ); } } catch( Py::TypeError & ) { throw Py::TypeError( type_error_message ); } return toObject( commit_info ); }
Py::Object pysvn_client::cmd_copy( const Py::Tuple &a_args, const Py::Dict &a_kws ) { static argument_description args_desc[] = { { true, name_src_url_or_path }, { true, name_dest_url_or_path }, { false, name_src_revision }, { false, NULL } }; FunctionArguments args( "copy", args_desc, a_args, a_kws ); args.check(); SvnPool pool( m_context ); pysvn_commit_info_t *commit_info = NULL; std::string type_error_message; try { type_error_message = "expecting string for src_path (arg 1)"; Py::String src_path( args.getUtf8String( name_src_url_or_path ) ); type_error_message = "expecting string for dest_path (arg 2)"; Py::String dest_path( args.getUtf8String( name_dest_url_or_path ) ); type_error_message = "expecting revision for keyword src_revision"; svn_opt_revision_t revision; if( is_svn_url( src_path ) ) revision = args.getRevision( name_src_revision, svn_opt_revision_head ); else revision = args.getRevision( name_src_revision, svn_opt_revision_working ); try { std::string norm_src_path( svnNormalisedIfPath( src_path, pool ) ); std::string norm_dest_path( svnNormalisedIfPath( dest_path, pool ) ); checkThreadPermission(); PythonAllowThreads permission( m_context ); #if defined( PYSVN_HAS_CLIENT_COPY3 ) // behavior changed svn_error_t *error = svn_client_copy3 ( &commit_info, norm_src_path.c_str(), &revision, norm_dest_path.c_str(), m_context, pool ); #elif defined( PYSVN_HAS_CLIENT_COPY2 ) svn_error_t *error = svn_client_copy2 ( &commit_info, // commit info type changed norm_src_path.c_str(), &revision, norm_dest_path.c_str(), m_context, pool ); #else svn_error_t *error = svn_client_copy ( &commit_info, norm_src_path.c_str(), &revision, norm_dest_path.c_str(), m_context, pool ); #endif permission.allowThisThread(); if( error != NULL ) throw SvnException( error ); } catch( SvnException &e ) { // use callback error over ClientException m_context.checkForError( m_module.client_error ); throw_client_error( e ); } } catch( Py::TypeError & ) { throw Py::TypeError( type_error_message ); } return toObject( commit_info ); }