Author: jkupec Date: Fri Mar 7 19:07:39 2008 New Revision: 9059 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9059&view=rev Log: - fixed location of RPMs in subdirs when parsing plaindir repo recursively (bnc #368218) Modified: branches/SuSE-Linux-10_3-Branch/libzypp/zypp/parser/plaindir/RepoParser.cc Modified: branches/SuSE-Linux-10_3-Branch/libzypp/zypp/parser/plaindir/RepoParser.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_3-Branch/libzypp/zypp/parser/plaindir/RepoParser.cc?rev=9059&r1=9058&r2=9059&view=diff ============================================================================== --- branches/SuSE-Linux-10_3-Branch/libzypp/zypp/parser/plaindir/RepoParser.cc (original) +++ branches/SuSE-Linux-10_3-Branch/libzypp/zypp/parser/plaindir/RepoParser.cc Fri Mar 7 19:07:39 2008 @@ -164,7 +164,8 @@ { _ticks.sendTo( fnc_r ); } - int extract_packages_from_directory( const Pathname & path, + int extract_packages_from_directory( const Pathname & rootpath, + const Pathname & subdir, bool recursive); /** Main entry to parser. */ void parse( const Pathname & reporoot_r ); @@ -186,7 +187,7 @@ // void RepoParser::Impl::parse( const Pathname & reporoot_r ) { - extract_packages_from_directory( reporoot_r, true ); + extract_packages_from_directory( reporoot_r, Pathname(), true ); /*if ( ! _ticks.incr() ) ZYPP_THROW( AbortRequestException() );*/ // Done @@ -194,10 +195,12 @@ ZYPP_THROW( AbortRequestException() ); } -int RepoParser::Impl::extract_packages_from_directory( const Pathname & path, +int RepoParser::Impl::extract_packages_from_directory( const Pathname & rootpath, + const Pathname & subdir, bool recursive) { using target::rpm::RpmHeader; + Pathname path = rootpath / subdir; Pathname filename; PathInfo magic; bool distro_magic, pkginfo_magic; @@ -237,14 +240,16 @@ for (std::liststd::string::const_iterator it = dircontent.begin(); it != dircontent.end(); ++it) { Pathname file_path = path + *it; PathInfo file_info( file_path ); - if (recursive && file_info.isDir()) { - - extract_packages_from_directory( file_path, recursive ); - - } else if (file_info.isFile() && file_path.extension() == ".rpm" ) { + if (recursive && file_info.isDir()) + { + extract_packages_from_directory( rootpath, subdir / *it, recursive ); + } + else if (file_info.isFile() && file_path.extension() == ".rpm" ) + { RpmHeader::constPtr header = RpmHeader::readPackage( file_path, RpmHeader::NOSIGNATURE ); #warning FIX creation of Package from src.rpm header - data::Package_Ptr package = makePackageDataFromHeader( header, NULL, *it, _repositoryId ); + // make up proper location relative to rootpath (bnc #368218) + data::Package_Ptr package = makePackageDataFromHeader( header, NULL, subdir / *it, _repositoryId ); if (package != NULL) { DBG << "Adding package " << *package << endl; _consumer.consumePackage( _repositoryId, package ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org