Author: dmacvicar Date: Tue Aug 7 10:42:42 2007 New Revision: 6504 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6504&view=rev Log: adapt repoparser assertMandatoryFile and getOptionalFile to also look for .gz files. What comes after is transparent for InputStream. Modified: trunk/libzypp/tests/cache/CacheStore_test.cc trunk/libzypp/zypp/parser/susetags/RepoParser.cc Modified: trunk/libzypp/tests/cache/CacheStore_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheStore_test.cc?rev=6504&r1=6503&r2=6504&view=diff ============================================================================== --- trunk/libzypp/tests/cache/CacheStore_test.cc (original) +++ trunk/libzypp/tests/cache/CacheStore_test.cc Tue Aug 7 10:42:42 2007 @@ -386,12 +386,6 @@ cache_write_susetags(repodir); } -void cache_write_susetags_compressed_test(const std::string &dir) -{ - Pathname repodir = Pathname(dir) + "/repo/susetags/data/stable-x86-subset-compressed"; - cache_write_susetags(repodir); -} - test_suite* init_unit_test_suite( int argc, char *argv[] ) { @@ -418,9 +412,7 @@ test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_normal_test, (std::string const*)params, params+1)); - //test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_gz_test, - // (std::string const*)params, params+1)); - test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_compressed_test, + test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_gz_test, (std::string const*)params, params+1)); //test->add(BOOST_PARAM_TEST_CASE(&cache_write_test2, // (std::string const*)params, params+1)); Modified: trunk/libzypp/zypp/parser/susetags/RepoParser.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/RepoParser.cc?rev=6504&r1=6503&r2=6504&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/susetags/RepoParser.cc (original) +++ trunk/libzypp/zypp/parser/susetags/RepoParser.cc Tue Aug 7 10:42:42 2007 @@ -212,8 +212,20 @@ /** Throw \ref ParseException if a required file is not * available below \ref _reporoot on disk. */ - Pathname assertMandatoryFile( const Pathname & file_r ) const + Pathname assertMandatoryFile( const Pathname & file_r, bool lookgz = true ) const { + if ( lookgz ) + { + PathInfo gzinputfile( _reporoot / (file_r.extend(".gz")) ); + if ( !gzinputfile.isFile() ) + { + WAR << _reporoot << ": Skip gz required file (will look for non-gz): " << file_r.extend(".gz").asString() << endl; + } + else + { + return gzinputfile.path(); + } + } PathInfo inputfile( _reporoot / file_r ); if ( ! inputfile.isFile() ) { @@ -225,8 +237,20 @@ /** Print a warning if an optional file is not * available below \ref _reporoot on disk. */ - Pathname getOptionalFile( const Pathname & file_r ) const + Pathname getOptionalFile( const Pathname & file_r, bool lookgz = true ) const { + if ( lookgz ) + { + PathInfo gzinputfile( _reporoot / (file_r.extend(".gz")) ); + if ( !gzinputfile.isFile() ) + { + WAR << _reporoot << ": Skip optional file: " << file_r.extend(".gz").asString() << endl; + } + else + { + return gzinputfile.path(); + } + } PathInfo inputfile( _reporoot / file_r ); if ( ! inputfile.isFile() ) { @@ -238,7 +262,10 @@ bool isPatternFile( const std::string & name_r ) const { - return( name_r.size() > 4 && name_r.substr( name_r.size() - 4 ) == ".pat" ); + return( + (name_r.size() > 4 && name_r.substr( name_r.size() - 4 ) == ".pat" ) + || (name_r.size() > 7 && name_r.substr( name_r.size() - 7 ) == ".pat.gz" ) + ); } /** Test for \c packages.lang in \ref _repoIndex.*/ @@ -259,7 +286,19 @@ else return true; // got it } - } + + if ( it->first == (searchFor+".gz") ) + { + // got it + PathInfo inputfile( _reporoot / _descrdir / (searchFor+".gz") ); + if ( ! inputfile.isFile() ) + { + WAR << "Known and desired file is not on disk: " << inputfile << endl; + } + else + return true; // got it + } + } return false; // not found } @@ -395,7 +434,8 @@ for ( RepoIndex::FileChecksumMap::const_iterator it = _repoIndex->metaFileChecksums.begin(); it != _repoIndex->metaFileChecksums.end(); ++it ) { - jobssize += PathInfo(getOptionalFile(_descrdir / it->first)).size(); + // here the paths already contain the gz extension + jobssize += PathInfo(getOptionalFile(_descrdir / it->first, false)).size(); } MIL << "Total job size: " << jobssize << endl; @@ -443,7 +483,7 @@ { if ( isPatternFile( it->first ) ) { - Pathname inputfile( getOptionalFile( _descrdir / it->first) ); + Pathname inputfile( getOptionalFile( _descrdir / it->first, false /*filename already contains .gz */ ) ); if ( ! inputfile.empty() ) { PatternFileReader reader; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org