Changeset 751
- Timestamp:
- 12/01/07 05:42:30 (16 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (1 diff)
- trunk/libffado/SConstruct (modified) (2 diffs)
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (1 diff)
- trunk/libffado/src/libutil/serialize.cpp (modified) (7 diffs)
- trunk/libffado/src/libutil/serialize.h (modified) (2 diffs)
- trunk/libffado/src/SConscript (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r739 r751 21 21 #define PACKAGE_VERSION "$VERSION-$REVISION" 22 22 23 /* Define to the version of the cace. */ 24 #define CACHE_VERSION "$VERSION-$REVISION" 25 23 26 /* Define to the api version */ 24 27 #define FFADO_API_VERSION $FFADO_API_VERSION trunk/libffado/SConstruct
r750 r751 227 227 env['REVISION'] = '' 228 228 229 env['FFADO_API_VERSION']=" 4"229 env['FFADO_API_VERSION']="5" 230 230 231 231 env['PACKAGE'] = "libffado" 232 env['VERSION'] = "1.999. 7"232 env['VERSION'] = "1.999.8" 233 233 env['LIBVERSION'] = "1.0.0" 234 234 … … 242 242 # 243 243 env.ScanReplace( "config.h.in" ) 244 # ensure that the config.h is updated with the version 245 NoCache("config.h") 246 AlwaysBuild("config.h") 244 247 245 248 pkgconfig = env.ScanReplace( "libffado.pc.in" ) trunk/libffado/src/bebob/bebob_avdevice.cpp
r750 r751 442 442 Util::XMLDeserialize deser( sFileName, getDebugLevel() ); 443 443 444 if (!deser.isValid()) { 445 debugOutput( DEBUG_LEVEL_NORMAL, "cache not valid: %s\n", 446 sFileName.c_str() ); 447 return false; 448 } 449 444 450 bool result = deserialize( "", deser ); 445 451 if ( result ) { trunk/libffado/src/libutil/serialize.cpp
r742 r751 21 21 * 22 22 */ 23 #include "config.h" // FOR CACHE_VERSION 23 24 24 25 #include "serialize.h" … … 33 34 : IOSerialize() 34 35 , m_filepath( fileName ) 35 , m_verboseLevel( 0 ) 36 { 36 , m_verboseLevel( DEBUG_LEVEL_NORMAL ) 37 { 38 setDebugLevel( DEBUG_LEVEL_NORMAL ); 37 39 try { 38 40 m_doc.create_root_node( "ffado_cache" ); 41 writeVersion(); 39 42 } catch ( const exception& ex ) { 40 43 cout << "Exception caught: " << ex.what(); 41 44 } 42 45 } 43 44 46 45 47 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName, int verboseLevel ) … … 48 50 , m_verboseLevel( verboseLevel ) 49 51 { 52 setDebugLevel(verboseLevel); 50 53 try { 51 54 m_doc.create_root_node( "ffado_cache" ); 55 writeVersion(); 52 56 } catch ( const exception& ex ) { 53 57 cout << "Exception caught: " << ex.what(); … … 63 67 } 64 68 69 } 70 71 void 72 Util::XMLSerialize::writeVersion() 73 { 74 xmlpp::Node* pNode = m_doc.get_root_node(); 75 xmlpp::Element* pElem = pNode->add_child( "CacheVersion" ); 76 char* valstr; 77 asprintf( &valstr, "%s", CACHE_VERSION ); 78 pElem->set_child_text( valstr ); 79 free( valstr ); 65 80 } 66 81 … … 164 179 : IODeserialize() 165 180 , m_filepath( fileName ) 166 , m_verboseLevel( 0 ) 167 { 181 , m_verboseLevel( DEBUG_LEVEL_NORMAL ) 182 { 183 setDebugLevel(DEBUG_LEVEL_NORMAL); 168 184 try { 169 185 m_parser.set_substitute_entities(); //We just want the text to … … 181 197 , m_verboseLevel( verboseLevel ) 182 198 { 199 setDebugLevel(verboseLevel); 183 200 try { 184 201 m_parser.set_substitute_entities(); //We just want the text to … … 193 210 Util::XMLDeserialize::~XMLDeserialize() 194 211 { 212 } 213 214 bool 215 Util::XMLDeserialize::isValid() 216 { 217 return checkVersion(); 218 } 219 220 bool 221 Util::XMLDeserialize::checkVersion() 222 { 223 Glib::ustring savedVersion; 224 if (read( "CacheVersion", savedVersion )) { 225 Glib::ustring expectedVersion = CACHE_VERSION; 226 debugOutput( DEBUG_LEVEL_NORMAL, "Cache version: %s, expected: %s.\n", savedVersion.c_str(), expectedVersion.c_str() ); 227 if (expectedVersion == savedVersion) { 228 debugOutput( DEBUG_LEVEL_VERBOSE, "Cache version OK.\n" ); 229 return true; 230 } else { 231 debugOutput( DEBUG_LEVEL_VERBOSE, "Cache version not OK.\n" ); 232 return false; 233 } 234 } else return false; 195 235 } 196 236 trunk/libffado/src/libutil/serialize.h
r742 r751 72 72 Glib::ustring str); 73 73 private: 74 void writeVersion(); 75 74 76 Glib::ustring m_filepath; 75 77 xmlpp::Document m_doc; … … 94 96 95 97 virtual bool isExisting( std::string strMemberName ); 96 98 bool isValid(); 99 bool checkVersion(); 97 100 private: 98 101 Glib::ustring m_filepath; trunk/libffado/src/SConscript
r750 r751 171 171 ' ) 172 172 173 # Explicitly make these files dependent on config.h 174 # to make sure they contain the most recent version 175 # #define's 176 version_dependent_files = [ 177 "ffado.os", # external API versioning 178 "libutil/serialize.os", # cache versioning 179 ] 180 181 173 182 source = ffado_source 174 183 pkgdata = [] … … 215 224 ffadolib = libenv.SharedLibrary( "ffado", source ) 216 225 226 for file in version_dependent_files: 227 Depends(file, '#/config.h') 228 NoCache(file) 229 AlwaysBuild(file) 230 231 # FIXME: there has to be a better way 232 AlwaysBuild(ffadolib) 233 NoCache(ffadolib) 234 217 235 # 218 236 # All the following tries to emulate the versioning of installed libs as seen from libtool...