Author: mlandres Date: Tue Jul 17 15:54:13 2007 New Revision: 6047 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6047&view=rev Log: - Fixed OnMediLocation to use safe defaults. Added setLocaltion and additional ctor for convenience. Modified: trunk/libzypp/devel/devel.ma/Parse.cc trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/OnMediaLocation.h trunk/libzypp/zypp/detail/SelectionImplIf.cc trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc trunk/libzypp/zypp/parser/susetags/RepoParser.cc trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc trunk/libzypp/zypp/parser/yum/PatchFileReader.cc trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc trunk/libzypp/zypp/repo/PackageDelta.h trunk/libzypp/zypp/repo/cached/PackageImpl.cc trunk/libzypp/zypp/repo/cached/RepoImpl.cc trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc trunk/libzypp/zypp/repo/susetags/Downloader.cc trunk/libzypp/zypp/repo/yum/Downloader.cc trunk/libzypp/zypp/target/rpm/RpmDb.cc Modified: trunk/libzypp/devel/devel.ma/Parse.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?r... ============================================================================== --- trunk/libzypp/devel/devel.ma/Parse.cc (original) +++ trunk/libzypp/devel/devel.ma/Parse.cc Tue Jul 17 15:54:13 2007 @@ -291,7 +291,7 @@ { RepoInfo & nrepo( *it ); - if ( 0 ) + if ( 1 ) { if ( repoManager.isCached( nrepo ) ) { Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?r... ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Tue Jul 17 15:54:13 2007 @@ -1,8 +1,14 @@ ------------------------------------------------------------------- +Tue Jul 17 15:57:03 CEST 2007 - ma@suse.de + +- Fixed OnMediLocation to use safe defaults. Added setLocaltion and + additional ctor for convenience. + +------------------------------------------------------------------- Tue Jul 17 10:45:39 CEST 2007 - schubi@suse.de -- Evalute update canditate: - Take canditates only which are really installable. Bug 292077 +- Evalute update canditate: + Take canditates only which are really installable. Bug 292077 r 6034 ------------------------------------------------------------------- @@ -123,7 +129,7 @@ ------------------------------------------------------------------- Fri Jun 22 15:28:03 CEST 2007 - schubi@suse.de -- New API calls which provides more information about one +- New API calls which provides more information about one resolvable after a solverrun: isInstalledBy (const PoolItem_Ref item); installs (const PoolItem_Ref item); Modified: trunk/libzypp/zypp/OnMediaLocation.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/OnMediaLocation.h?re... ============================================================================== --- trunk/libzypp/zypp/OnMediaLocation.h (original) +++ trunk/libzypp/zypp/OnMediaLocation.h Tue Jul 17 15:54:13 2007 @@ -14,6 +14,7 @@ #include <iosfwd> +#include "zypp/base/Deprecated.h" #include "zypp/Pathname.h" #include "zypp/ByteCount.h" #include "zypp/CheckSum.h" @@ -27,19 +28,26 @@ // CLASS NAME : OnMediaLocation // /** - * Describes a path ona certain media amongs as the information - * required to download it, like its media number, checksum and - * size. - * it does not specifies the URI of the file. + * Describes a path on a certain media amongs as the information + * required to download it, like its media number, checksum and + * size. It does not specify the URI of the file. + * + * Media number \c 0 usually indicates no media access. */ class OnMediaLocation { friend std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj ); public: - /** Ctor */ + /** Default ctor indicating no media access. */ OnMediaLocation() - : _medianr( 1 ) + : _medianr( 0 ) + {} + + /** Ctor taking a filename and media number (defaults to 1). */ + OnMediaLocation( const Pathname & filename_r, unsigned medianr_r ) + : _medianr( medianr_r ) + , _filename( filename_r ) {} public: @@ -47,16 +55,55 @@ const Pathname & filename() const { return _filename; } const CheckSum & checksum() const { return _checksum; } const ByteCount & downloadSize() const { return _downloadsize; } - const ByteCount & openSize() const { return _opendownloadsize; } - const CheckSum & openChecksum() const { return _openchecksum; } + const ByteCount & openSize() const { return _opendownloadsize; } + const CheckSum & openChecksum() const { return _openchecksum; } public: - OnMediaLocation & setMedianr( unsigned val_r ) { _medianr = val_r; return *this; } - OnMediaLocation & setFilename( const Pathname & val_r ) { _filename = val_r; return *this; } - OnMediaLocation & setChecksum( const CheckSum & val_r ) { _checksum = val_r; return *this; } - OnMediaLocation & setDownloadSize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; } - OnMediaLocation & setOpenChecksum( const CheckSum & val_r ) { _openchecksum = val_r; return *this; } - OnMediaLocation & setOpenSize( const ByteCount & val_r ) { _opendownloadsize = val_r; return *this; } + /** Unset \c filename and set \c medianr to \c 0. */ + OnMediaLocation & unsetLocation() + { _filename = Pathname(); _medianr = 0; return *this; } + + /** Set filename and media number (defaults to \c 1). */ + OnMediaLocation & setLocation( const Pathname & val_r, + unsigned mediaNumber_r ) + { _filename = val_r; _medianr = mediaNumber_r; return *this; } + + /** Set the files size. */ + OnMediaLocation & setDownloadSize( const ByteCount & val_r ) + { _downloadsize = val_r; return *this; } + + /** Set the files checksum. */ + OnMediaLocation & setChecksum( const CheckSum & val_r ) + { _checksum = val_r; return *this; } + + /** Set the files open (uncompressed) size. */ + OnMediaLocation & setOpenSize( const ByteCount & val_r ) + { _opendownloadsize = val_r; return *this; } + + /** Set the files open (uncompressed) checksum. */ + OnMediaLocation & setOpenChecksum( const CheckSum & val_r ) + { _openchecksum = val_r; return *this; } + + public: + /** \deprecated use \ref setLocation or \ref changeMedianr */ + ZYPP_DEPRECATED OnMediaLocation & xsetMedianr( unsigned val_r ) + { return changeMedianr( val_r ); } + /** \deprecated use \ref setLocation or \ref changeFilename */ + ZYPP_DEPRECATED OnMediaLocation & xsetFilename( const Pathname & val_r ) + { return changeFilename( val_r ); } + + /** Individual manipulation of \c medianr. + * Using \ref setLocation is prefered. + */ + OnMediaLocation & changeMedianr( unsigned val_r ) + { _medianr = val_r; return *this; } + + /** Individual manipulation of \c filename. + * Using \ref setLocation is prefered. + */ + OnMediaLocation & changeFilename( const Pathname & val_r ) + { _filename = val_r; return *this; } + private: unsigned _medianr; Pathname _filename; Modified: trunk/libzypp/zypp/detail/SelectionImplIf.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/SelectionImpl... ============================================================================== --- trunk/libzypp/zypp/detail/SelectionImplIf.cc (original) +++ trunk/libzypp/zypp/detail/SelectionImplIf.cc Tue Jul 17 15:54:13 2007 @@ -9,9 +9,10 @@ /** \file zypp/detail/SelectionImplIf.cc * */ +#include <iostream> + #include "zypp/detail/SelectionImplIf.h" #include "zypp/ResTraits.h" -#include <iostream> using namespace std; @@ -50,7 +51,6 @@ const std::setstd::string SelectionImplIf::install_packages( const Locale & lang) const { std::setstd::string result; - #warning does not honor language packs copycaps( result, self()->dep( Dep::REQUIRES ) ); copycaps( result, self()->dep( Dep::RECOMMENDS) ); Modified: trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/Pack... ============================================================================== --- trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc (original) +++ trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc Tue Jul 17 15:54:13 2007 @@ -159,13 +159,13 @@ switch ( str::split( tag_r->value, std::back_inserter(words) ) ) { case 2: // [medianr filename] - _data->repositoryLocation.setMedianr( str::strtonum<unsigned>(words[0]) ); - _data->repositoryLocation.setFilename( Pathname(_data->arch.asString()) / words[1] ); + _data->repositoryLocation.setLocation( Pathname(_data->arch.asString()) / words[1], + str::strtonum<unsigned>(words[0]) ); break; case 3: // [medianr filename dir] - _data->repositoryLocation.setMedianr( str::strtonum<unsigned>(words[0]) ); - _data->repositoryLocation.setFilename( Pathname(words[2]) / words[1] ); + _data->repositoryLocation.setLocation( Pathname(words[2]) / words[1], + str::strtonum<unsigned>(words[0]) ); break; default: Modified: trunk/libzypp/zypp/parser/susetags/RepoParser.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/Repo... ============================================================================== --- trunk/libzypp/zypp/parser/susetags/RepoParser.cc (original) +++ trunk/libzypp/zypp/parser/susetags/RepoParser.cc Tue Jul 17 15:54:13 2007 @@ -169,7 +169,7 @@ void fixLocationPath( const data::Packagebase_Ptr & data_r ) { Pathname tofix( data_r->repositoryLocation.filename() ); - data_r->repositoryLocation.setFilename( _datadir / tofix ); + data_r->repositoryLocation.changeFilename( _datadir / tofix ); } /** Resolve shared data tag. */ Modified: trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileReade... ============================================================================== --- trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc (original) +++ trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc Tue Jul 17 15:54:13 2007 @@ -112,7 +112,7 @@ return true; } - // xpath: //package/packager + // xpath: //package/packager if (reader_r->name() == "packager") { package_ptr->packager = reader_r.nodeText().asString(); @@ -152,7 +152,7 @@ // xpath: //package/location if (reader_r->name() == "location") { - package_ptr->repositoryLocation.setFilename(reader_r->getAttribute("href").asString()); + package_ptr->repositoryLocation.setLocation(reader_r->getAttribute("href").asString(), 1); return true; } @@ -186,7 +186,7 @@ { if (consumeDependency(reader_r, package_ptr->deps)) // this node has been a dependency, which has been handled by - // consumeDependency(), so return right away. + // consumeDependency(), so return right away. return true; // DBG << "format subtag: " << reader_r->name() << endl; @@ -228,7 +228,7 @@ return true; } - //! \todo xpath: //format/rpm:header-range what is this? + //! \todo xpath: //format/rpm:header-range what is this? if (reader_r->name() == "rpm:header-range") { //reader_r->getAttribute("start").asString(), @@ -236,7 +236,7 @@ return true; } - //! \todo xpath: //format/file (*) figure out where to store this and what's it about (in regard to filelists.xml.gz) + //! \todo xpath: //format/file (*) figure out where to store this and what's it about (in regard to filelists.xml.gz) if (reader_r->name() == "file") { // file = reader_r.nodeText().asString(); @@ -311,7 +311,7 @@ if (kind_str.empty()) kind = ResTraits<Package>::kind; else - kind = Resolvable::Kind(kind_str); + kind = Resolvable::Kind(kind_str); // Check whether this is actually a prerequires dependency. // If so, it will be stored in deps_r as Dep::PREREQUIRES Modified: trunk/libzypp/zypp/parser/yum/PatchFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchFile... ============================================================================== --- trunk/libzypp/zypp/parser/yum/PatchFileReader.cc (original) +++ trunk/libzypp/zypp/parser/yum/PatchFileReader.cc Tue Jul 17 15:54:13 2007 @@ -44,8 +44,8 @@ /** * Callback provided to the XML reader. - * - * \param the xml reader object reading the file + * + * \param the xml reader object reading the file * \return true to tell the reader to continue, false to tell it to stop * * \see PrimaryFileReader::consumeNode(xml::Reader) @@ -54,10 +54,10 @@ /** * Process <tt>atoms</tt> node and all of its children. - * + * * \param reader_r XML file reader reading the patch file. * \return true if current node has been completely processed, false - * if additional processing is required outside of the method. + * if additional processing is required outside of the method. */ bool consumeAtomsNode(xml::Reader & reader_r); @@ -65,46 +65,46 @@ * Process <tt>package</tt> node and all of its children. This method * uses \ref FileReaderBase::consumePackageNode(xml::Reader,data::Package_Ptr) * method and adds <tt>pkgfiles</tt> element processing. - * + * * \param reader_r XML file reader reading the patch file. * \return true if current node has been completely processed, false - * if additional processing is required outside of the method. + * if additional processing is required outside of the method. */ bool consumePackageNode(xml::Reader & reader_r); /** * Process <tt>patchrpm</tt> node and all of its children. - * + * * \param reader_r XML file reader reading the patch file. * \return true if current node has been completely processed, false - * if additional processing is required outside of the method. + * if additional processing is required outside of the method. */ bool consumePatchrpmNode(xml::Reader & reader_r); /** * Process <tt>deltarpm</tt> node and all of its children. - * + * * \param reader_r XML file reader reading the patch file. * \return true if current node has been completely processed, false - * if additional processing is required outside of the method. + * if additional processing is required outside of the method. */ bool consumeDeltarpmNode(xml::Reader & reader_r); /** * Process <tt>message</tt> node and all of its children. - * + * * \param reader_r XML file reader reading the patch file. * \return true if current node has been completely processed, false - * if additional processing is required outside of the method. + * if additional processing is required outside of the method. */ bool consumeMessageNode(xml::Reader & reader_r); /** * Process <tt>script</tt> node and all of its children. - * + * * \param reader_r XML file reader reading the patch file. * \return true if current node has been completely processed, false - * if additional processing is required outside of the method. + * if additional processing is required outside of the method. */ bool consumeScriptNode(xml::Reader & reader_r); @@ -123,7 +123,7 @@ void saveAtomInPatch(); /** - * + * */ void copyPackageAtomFromTmpObj(data::Atom_Ptr & atom_ptr) const; @@ -171,10 +171,10 @@ /* * xpath and multiplicity of processed nodes are included in the code * for convenience: - * + * * // xpath: <xpath> (?|*|+) - * - * if multiplicity is ommited, then the node has multiplicity 'one'. + * + * if multiplicity is ommited, then the node has multiplicity 'one'. */ // -------------------------------------------------------------------------- @@ -242,7 +242,7 @@ // dependency block nodes if (consumeDependency(reader_r, _patch->deps)) - return true; + return true; // xpath: /patch/category if (reader_r->name() == "category") @@ -288,7 +288,7 @@ if (reader_r->name() == "patch") { if (!_patch->atoms.size()) - WAR << "No atoms found for patch " << _patch->name << " " << _patch->edition << endl; + WAR << "No atoms found for patch " << _patch->name << " " << _patch->edition << endl; if (_callback) _callback(handoutPatch()); @@ -359,7 +359,7 @@ // xpath: /patch/atoms/package if (reader_r->name() == "package") { - // DBG << "Atom " << _tmpResObj->name << " " << _tmpResObj->edition << " successfully read." << endl; + // DBG << "Atom " << _tmpResObj->name << " " << _tmpResObj->edition << " successfully read." << endl; saveAtomInPatch(); toParentTag(); // back to processing of previous tag (atoms) @@ -510,7 +510,7 @@ // xpath: /patch/atoms/package/patchrpm/location if (reader_r->name() == "location") { - _patchrpm->location.setFilename(reader_r->getAttribute("href").asString()); + _patchrpm->location.setLocation(reader_r->getAttribute("href").asString(), 1); // ignoring attribute 'base' return true; } @@ -586,7 +586,7 @@ // xpath: /patch/atoms/package/deltarpm/location if (reader_r->name() == "location") { - _deltarpm->location.setFilename(reader_r->getAttribute("href").asString()); + _deltarpm->location.setLocation(reader_r->getAttribute("href").asString(), 1); // ignoring attribute 'base' return true; } @@ -763,7 +763,7 @@ // ignoring reader_r->getAttribute("xml:base").asString(); // xsd:anyURI do script file path - script->doScriptLocation.setFilename(reader_r->getAttribute("href").asString()); + script->doScriptLocation.setLocation(reader_r->getAttribute("href").asString(), 1); return true; } @@ -783,7 +783,7 @@ // ignoring reader_r->getAttribute("xml:base").asString(); // xsd:anyURI undo script file path - script->undoScriptLocation.setFilename(reader_r->getAttribute("href").asString()); + script->undoScriptLocation.setLocation(reader_r->getAttribute("href").asString(), 1); return true; } Modified: trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchesFi... ============================================================================== --- trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc (original) +++ trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc Tue Jul 17 15:54:13 2007 @@ -59,7 +59,7 @@ * Callback provided to the XML parser. Don't use it. */ bool consumeNode( Reader & reader_r ); - + private: OnMediaLocation _location; Tag _tag; @@ -103,7 +103,7 @@ if ( reader_r->name() == "location" ) { _tag = tag_Location; - _location.setFilename( reader_r->getAttribute("href").asString() ); + _location.setLocation( reader_r->getAttribute("href").asString(), 1 ); return true; } if ( reader_r->name() == "checksum" ) @@ -141,7 +141,7 @@ const ProcessResource & callback) : _pimpl(new Impl(patches_file, callback)) {} - + PatchesFileReader::~PatchesFileReader() {} Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFil... ============================================================================== --- trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc (original) +++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc Tue Jul 17 15:54:13 2007 @@ -59,7 +59,7 @@ public: /** * CTOR - * + * * \see RepomdFileReader::RepomdFileReader(Pathname,ProcessResource) */ Impl(const Pathname &repomd_file, const ProcessResource & callback); @@ -85,7 +85,7 @@ /** Checksum of metadata file */ CheckSum _checksum; - + /** Type of checksum of metadata file */ std::string _checksum_type; @@ -97,7 +97,7 @@ RepomdFileReader::Impl::Impl( const Pathname &repomd_file, const ProcessResource & callback) : - _tag(tag_NONE), _type(ResourceType::NONE_e), _callback(callback) + _tag(tag_NONE), _type(ResourceType::NONE_e), _callback(callback) { Reader reader( repomd_file ); MIL << "Reading " << repomd_file << endl; @@ -109,10 +109,10 @@ /* * xpath and multiplicity of processed nodes are included in the code * for convenience: - * + * * // xpath: <xpath> (?|*|+) - * - * if multiplicity is ommited, then the node has multiplicity 'one'. + * + * if multiplicity is ommited, then the node has multiplicity 'one'. */ // -------------------------------------------------------------------------- @@ -140,7 +140,7 @@ if ( reader_r->name() == "location" ) { _tag = tag_Location; - _location.setFilename( reader_r->getAttribute("href").asString() ); + _location.setLocation( reader_r->getAttribute("href").asString(), 1 ); // ignoring attribute xml:base return true; } @@ -190,7 +190,7 @@ RepomdFileReader::RepomdFileReader( const Pathname & repomd_file, const ProcessResource & callback) : - _pimpl(new Impl(repomd_file, callback)) + _pimpl(new Impl(repomd_file, callback)) {} RepomdFileReader::~RepomdFileReader() Modified: trunk/libzypp/zypp/repo/PackageDelta.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageDelta.h?... ============================================================================== --- trunk/libzypp/zypp/repo/PackageDelta.h (original) +++ trunk/libzypp/zypp/repo/PackageDelta.h Tue Jul 17 15:54:13 2007 @@ -18,7 +18,6 @@ #include "zypp/OnMediaLocation.h" #include "zypp/Edition.h" #include "zypp/Date.h" -//#include "zypp/Arch.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -41,19 +40,19 @@ public: const OnMediaLocation & location() const { return _location; } - const BaseVersions & baseversions() const { return _baseversions; } - const Date & buildtime() const { return _buildtime;} + const BaseVersions & baseversions() const { return _baseversions; } + const Date & buildtime() const { return _buildtime;} public: PatchRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; } - PatchRpm & setBaseversions( const BaseVersions & val_r ) { _baseversions = val_r; return *this; } - PatchRpm & addBaseversion( const BaseVersion & val_r ) { _baseversions.push_back( val_r ); return *this; } - PatchRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; } + PatchRpm & setBaseversions( const BaseVersions & val_r ){ _baseversions = val_r; return *this; } + PatchRpm & addBaseversion( const BaseVersion & val_r ) { _baseversions.push_back( val_r ); return *this; } + PatchRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; } private: OnMediaLocation _location; - BaseVersions _baseversions; - Date _buildtime; + BaseVersions _baseversions; + Date _buildtime; }; /** \relates PatchRpm Stream output. */ @@ -97,8 +96,8 @@ public: const OnMediaLocation & location() const { return _location; } - const BaseVersion & baseversion() const { return _baseversion; } - const Date & buildtime() const { return _buildtime;} + const BaseVersion & baseversion() const { return _baseversion; } + const Date & buildtime() const { return _buildtime;} public: DeltaRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; } @@ -107,8 +106,8 @@ private: OnMediaLocation _location; - BaseVersion _baseversion; - Date _buildtime; + BaseVersion _baseversion; + Date _buildtime; }; /** \relates DeltaRpm Stream output. */ Modified: trunk/libzypp/zypp/repo/cached/PackageImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PackageI... ============================================================================== --- trunk/libzypp/zypp/repo/cached/PackageImpl.cc (original) +++ trunk/libzypp/zypp/repo/cached/PackageImpl.cc Tue Jul 17 15:54:13 2007 @@ -136,22 +136,20 @@ OnMediaLocation PackageImpl::location() const { - OnMediaLocation loc; + OnMediaLocation loc( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationFilename() ), + _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationMediaNr() ) ); + string chktype = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationChecksumType() ); string chkvalue = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationChecksum() ); loc.setChecksum(CheckSum(chktype, chkvalue)); - - loc.setFilename( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationFilename() ) ); - + loc.setDownloadSize( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationDownloadSize() ) ); loc.setOpenSize( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationOpenSize() ) ); - - loc.setMedianr( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationMediaNr() ) ); - + chktype = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationOpenChecksumType() ); chkvalue = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationOpenChecksum() ); loc.setOpenChecksum(CheckSum(chktype, chkvalue)); - + return loc; } Modified: trunk/libzypp/zypp/repo/cached/RepoImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/RepoImpl... ============================================================================== --- trunk/libzypp/zypp/repo/cached/RepoImpl.cc (original) +++ trunk/libzypp/zypp/repo/cached/RepoImpl.cc Tue Jul 17 15:54:13 2007 @@ -74,7 +74,7 @@ RepoImpl *r = (RepoImpl *)(ptr); if ( r ) return r->progress_handler(ptr); - + return 1; } @@ -100,14 +100,14 @@ _ticks = ProgressData(); _ticks.sendTo(_options.readingResolvablesProgress); _ticks.name(str::form(_( "Reading '%s' repository cache"), info().alias().c_str())); - + debug::Measure m("create resolvables"); CapFactory capfactory; try { sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str()); //con.setprogresshandler(100, global_progress_handler, (void*)this); - + con.executenonquery("PRAGMA cache_size=8000;"); con.executenonquery("BEGIN;"); @@ -115,7 +115,7 @@ // sqlite3_command total_cmd("select count(id) from resolvables where repository_id=:repository_id;"); // total_cmd.bind(":repository_id", _repository_id); // int total = total_cmd.executeint(); - + sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables where repository_id=:repository_id;"); cmd.bind(":repository_id", _options.repository_id); map<data::RecordId, pair<Resolvable::Kind, NVRAD> > nvras; @@ -134,13 +134,13 @@ } MIL << "Done reading resolvables nvra" << endl; - + _ticks.tick(); - + read_capabilities( con, _options.repository_id, nvras ); _ticks.tick(); - + for ( map<data::RecordId, pair<Resolvable::Kind, NVRAD> >::const_iterator it = nvras.begin(); it != nvras.end(); ++it ) { if ( it->second.first == ResTraits<Package>::kind ) @@ -219,7 +219,7 @@ _ticks = ProgressData(); _ticks.sendTo(_options.readingPatchDeltasProgress ); _ticks.name(str::form(_( "Reading patch and delta rpms from '%s' repository cache"), info().alias().c_str())); - + try { sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str()); @@ -249,9 +249,7 @@ sqlite3_reader reader = deltas_cmd.executereader(); while ( reader.read() ) { - zypp::OnMediaLocation on_media; - on_media.setMedianr(reader.getint(1)); - on_media.setFilename(reader.getstring(2)); + zypp::OnMediaLocation on_media( reader.getstring(2), reader.getint(1) ); string checksum_string(reader.getstring(3)); CheckSum checksum = encoded_string_to_checksum(checksum_string); @@ -297,9 +295,7 @@ { long long patch_package_id = reader.getint64(0); - zypp::OnMediaLocation on_media; - on_media.setMedianr( reader.getint(1) ); - on_media.setFilename( reader.getstring(2) ); + zypp::OnMediaLocation on_media( reader.getstring(2), reader.getint(1) ); string checksum_string(reader.getstring(3)); CheckSum checksum = encoded_string_to_checksum(checksum_string); @@ -360,9 +356,9 @@ // } // } sqlite3_command select_named_cmd( con, "select v.refers_kind, n.name, v.version, v.release, v.epoch, v.relation, v.dependency_type, v.resolvable_id from named_capabilities v, names n, resolvables res where v.name_id=n.id and v.resolvable_id=res.id and res.repository_id=:repo_id;"); - + sqlite3_command select_file_cmd( con, "select fc.refers_kind, dn.name, fn.name, fc.dependency_type, fc.resolvable_id from file_capabilities fc, files f, dir_names dn, file_names fn, resolvables res where f.id=fc.file_id and f.dir_name_id=dn.id and f.file_name_id=fn.id and fc.resolvable_id=res.id and res.repository_id=:repo_id;"); - + sqlite3_command select_hal_cmd( con, "select hc.refers_kind, hc.name, hc.value, hc.relation, hc.dependency_type, hc.resolvable_id from hal_capabilities hc, resolvables res where hc.resolvable_id=res.id and res.repository_id=:repo_id;"); sqlite3_command select_modalias_cmd( con, "select mc.refers_kind, mc.name, mc.value, mc.relation, mc.dependency_type, mc.resolvable_id from modalias_capabilities mc, resolvables res where mc.resolvable_id=res.id and res.repository_id=:repo_id;"); @@ -410,7 +406,7 @@ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) ); } } - + { debug::Measure mnf("read hal capabilities"); select_hal_cmd.bind(":repo_id", repo_id); @@ -420,7 +416,7 @@ //select hc.refers_kind, hc.name, hc.value, hc.relation, hc.dependency_type, hc.resolvable_id from hal_capabilities hc Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0)); - + Rel rel = _type_cache.relationFor(reader.getint(3)); capability::HalCap *hcap = new capability::HalCap( refer, reader.getstring(1), rel, reader.getstring(2) ); zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(4)); @@ -435,10 +431,10 @@ sqlite3_reader reader = select_modalias_cmd.executereader(); while ( reader.read() ) { - + //select mc.refers_kind, mc.name, mc.value, mc.relation, mc.dependency_type, mc.resolvable_id from modalias_capabilities mc; Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0)); - + Rel rel = _type_cache.relationFor(reader.getint(3)); capability::ModaliasCap *mcap = new capability::ModaliasCap( refer, reader.getstring(1), rel, reader.getstring(2) ); zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(4)); @@ -457,18 +453,18 @@ Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0)); capability::CapabilityImpl::Ptr cap = capability::parse( refer, reader.getstring(1)); - + if ( !cap ) { ERR << "Invalid capability " << reader.getstring(1) << endl; } - + zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(2)); data::RecordId rid = reader.getint64(3); nvras[rid].second[deptype].insert( capfactory.fromImpl(cap) ); } } - + MIL << nvras.size() << " capabilities" << endl; } Modified: trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/SrcPacka... ============================================================================== --- trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc (original) +++ trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc Tue Jul 17 15:54:13 2007 @@ -99,13 +99,14 @@ OnMediaLocation SrcPackageImpl::location() const { - OnMediaLocation loc; + OnMediaLocation loc( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationFilename() ), + _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrSrcPackageLocationMediaNr() ) ); + string chktype = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationChecksumType() ); string chkvalue = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationChecksum() ); loc.setChecksum(CheckSum(chktype, chkvalue)); - loc.setFilename( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationFilename() ) ); loc.setDownloadSize( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrSrcPackageLocationDownloadSize() ) ); - loc.setMedianr( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrSrcPackageLocationMediaNr() ) ); +#warning FIX REMAINING LOCATION ATTRS return loc; } Modified: trunk/libzypp/zypp/repo/susetags/Downloader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/susetags/Downlo... ============================================================================== --- trunk/libzypp/zypp/repo/susetags/Downloader.cc (original) +++ trunk/libzypp/zypp/repo/susetags/Downloader.cc Tue Jul 17 15:54:13 2007 @@ -16,11 +16,11 @@ { namespace susetags { - + Downloader::Downloader( const Url &url, const Pathname &path ) : _url(url), _path(path) { - + } RepoStatus Downloader::status() @@ -35,35 +35,35 @@ { MediaSetAccess media(_url); Fetcher fetcher; - - fetcher.enqueue( OnMediaLocation().setFilename( "/media.1/media") ); + + fetcher.enqueue( OnMediaLocation( "media.1/media", 1 ) ); fetcher.start( dest_dir, media ); fetcher.reset(); - - + + SignatureFileChecker sigchecker; - + Pathname sig = _path + "/content.asc"; if ( media.doesFileExist(sig) ) { - fetcher.enqueue( OnMediaLocation().setFilename(sig) ); + fetcher.enqueue( OnMediaLocation( sig, 1 ) ); fetcher.start( dest_dir, media ); fetcher.reset(); - + sigchecker = SignatureFileChecker( dest_dir + sig ); } - + Pathname key = _path + "/content.key"; if ( media.doesFileExist(key) ) { - fetcher.enqueue( OnMediaLocation().setFilename(key) ); + fetcher.enqueue( OnMediaLocation( key, 1 ) ); fetcher.start( dest_dir, media ); fetcher.reset(); sigchecker.addPublicKey(dest_dir + key); } - - - fetcher.enqueue( OnMediaLocation().setFilename( _path + "/content"), sigchecker ); + + + fetcher.enqueue( OnMediaLocation( _path + "/content", 1 ), sigchecker ); fetcher.start( dest_dir, media ); fetcher.reset(); @@ -82,7 +82,7 @@ if ( str::split( buffer, std::back_inserter(words) ) != 2 ) { // error - ZYPP_THROW(Exception("bad DESCR line")); + ZYPP_THROW(Exception("bad DESCR line")); } descr_dir = words[1]; } @@ -94,8 +94,8 @@ // error ZYPP_THROW(Exception("bad META line")); } - OnMediaLocation location; - location.setFilename( _path + descr_dir + words[3]).setChecksum( CheckSum( words[1], words[2] ) ); + OnMediaLocation location( _path + descr_dir + words[3], 1 ); + location.setChecksum( CheckSum( words[1], words[2] ) ); fetcher.enqueueDigested(location); } else if (buffer.substr( 0, 3 ) == "KEY") @@ -106,8 +106,8 @@ // error ZYPP_THROW(Exception("bad KEY line")); } - OnMediaLocation location; - location.setFilename( _path + words[3]).setChecksum( CheckSum( words[1], words[2] ) ); + OnMediaLocation location( _path + words[3], 1 ); + location.setChecksum( CheckSum( words[1], words[2] ) ); fetcher.enqueueDigested(location); } } @@ -116,5 +116,5 @@ } }// ns susetags -}// ns source +}// ns source } // ns zypp Modified: trunk/libzypp/zypp/repo/yum/Downloader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/yum/Downloader.... ============================================================================== --- trunk/libzypp/zypp/repo/yum/Downloader.cc (original) +++ trunk/libzypp/zypp/repo/yum/Downloader.cc Tue Jul 17 15:54:13 2007 @@ -52,18 +52,18 @@ bool Downloader::repomd_Callback( const OnMediaLocation &loc, const ResourceType &dtype ) { MIL << dtype << " : " << loc << endl; - + // skip other if ( dtype == ResourceType::OTHER ) { MIL << "Skipping other.xml" << endl; return true; } - + _fetcher.enqueueDigested(loc); - + // We got a patches file we need to read, to add patches listed - // there, so we transfer what we have in the queue, and + // there, so we transfer what we have in the queue, and // queue the patches in the patches callback if ( dtype == ResourceType::PATCHES ) { @@ -71,7 +71,7 @@ // now the patches.xml file must exists PatchesFileReader( _dest_dir + loc.filename(), bind( &Downloader::patches_Callback, this, _1, _2)); } - + return true; } @@ -81,34 +81,34 @@ Pathname repomdpath = "/repodata/repomd.xml"; Pathname keypath = "/repodata/repomd.xml.key"; Pathname sigpath = "/repodata/repomd.xml.asc"; - + ProgressData progress; progress.sendTo(progressrcv); progress.toMin(); _dest_dir = dest_dir; if ( _media.doesFileExist(keypath) ) - _fetcher.enqueue( OnMediaLocation().setFilename(keypath) ); + _fetcher.enqueue( OnMediaLocation(keypath,1) ); if ( _media.doesFileExist(sigpath) ) - _fetcher.enqueue( OnMediaLocation().setFilename(sigpath) ); - + _fetcher.enqueue( OnMediaLocation(sigpath,1) ); + _fetcher.start( dest_dir, _media ); - + if ( ! progress.tick() ) ZYPP_THROW(AbortRequestException()); SignatureFileChecker sigchecker; - + if ( PathInfo( dest_dir + sigpath ).isExist() ) sigchecker = SignatureFileChecker(dest_dir + sigpath); - + if ( PathInfo( dest_dir + keypath ).isExist() ) sigchecker.addPublicKey(dest_dir + keypath ); - - _fetcher.enqueue( OnMediaLocation().setFilename(repomdpath), sigchecker ); + + _fetcher.enqueue( OnMediaLocation(repomdpath,1), sigchecker ); _fetcher.start( dest_dir, _media); - + if ( ! progress.tick() ) ZYPP_THROW(AbortRequestException()); @@ -123,7 +123,7 @@ } }// ns yum -}// ns source +}// ns source } // ns zypp Modified: trunk/libzypp/zypp/target/rpm/RpmDb.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.cc?... ============================================================================== --- trunk/libzypp/zypp/target/rpm/RpmDb.cc (original) +++ trunk/libzypp/zypp/target/rpm/RpmDb.cc Tue Jul 17 15:54:13 2007 @@ -968,7 +968,7 @@ } } // key does not exists, lets import it - + RpmArgVec opts; opts.push_back ( "--import" ); opts.push_back ( "--" ); @@ -1140,7 +1140,7 @@ impl->setRepository( repo ); if (!location.empty()) - impl->setLocation( OnMediaLocation().setFilename(location) ); + impl->setLocation( OnMediaLocation(location,1) ); Edition edition; try @@ -1179,7 +1179,7 @@ list<string> filenames = impl->filenames(); CapFactory capfactory; insertCaps( dataCollect[Dep::PROVIDES], header->tag_provides( filerequires ), capfactory ); - + static str::smatch what; static const str::regex filenameRegex( "/(s?bin|lib(64)?|etc)/|^/usr/(games/|share/(dict/words|magic\.mime)$)|^/opt/gnome/games/", str::regex::optimize|str::regex::nosubs ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org