Author: dmacvicar
Date: Mon Jul 16 12:40:42 2007
New Revision: 6017
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6017&view=rev
Log:
merge REFACTORING-10_3 back to trunk
Added:
trunk/libzypp-bindings/examples/ruby/play_with_repos.rb
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/examples/ruby/play_with_repos.rb
trunk/libzypp-bindings/swig/RepoInfo.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/RepoInfo.i
trunk/libzypp-bindings/swig/RepoManager.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/RepoManager.i
trunk/libzypp-bindings/swig/RepoStatus.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/RepoStatus.i
trunk/libzypp-bindings/swig/RepoType.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/RepoType.i
trunk/libzypp-bindings/swig/Repository.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/Repository.i
trunk/libzypp-bindings/swig/std_list.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/std_list.i
trunk/libzypp-bindings/swig/std_set.i
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp-bindings/swig/std_set.i
trunk/libzypp/tests/repo/susetags/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/
trunk/libzypp/tests/repo/susetags/CMakeLists.txt
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/CMakeLists.txt
trunk/libzypp/tests/repo/susetags/Downloader_test.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/Downloader_test.cc
trunk/libzypp/tests/repo/susetags/data/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/content
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/content
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/content.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/content.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/content.key
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/content.key
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-0dfb3188-41ed929b.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-0dfb3188-41ed929b.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-307e3d54-44201d5d.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-307e3d54-44201d5d.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-3d25d3d9-36e12d04.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-3d25d3d9-36e12d04.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-7e2e3b05-44748aba.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-7e2e3b05-44748aba.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-9c800aca-40d8063e.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-9c800aca-40d8063e.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-a1912208-446a0899.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-a1912208-446a0899.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/directory.yast
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/directory.yast
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/info.txt
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/info.txt
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/license.zip
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/license.zip
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/media
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/media
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.asc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.asc
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.key
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.key
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/kde-10.3-71.i586.pat
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/kde-10.3-71.i586.pat
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.DU
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.DU
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.en
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.en
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.es
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.es
trunk/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/patterns
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/patterns
trunk/libzypp/tests/zypp/ProgressData_test.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/zypp/ProgressData_test.cc
trunk/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/
trunk/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file1
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file1
trunk/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file2
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file2
trunk/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/
- copied from r6016, branches/REFACTORING-10_3/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/
trunk/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/file
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/file
trunk/libzypp/zypp/MediaProducts.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.cc
trunk/libzypp/zypp/MediaProducts.h
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.h
trunk/libzypp/zypp/base/Easy.h
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/base/Easy.h
trunk/libzypp/zypp/parser/plaindir/
- copied from r6016, branches/REFACTORING-10_3/libzypp/zypp/parser/plaindir/
trunk/libzypp/zypp/parser/plaindir/RepoParser.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/parser/plaindir/RepoParser.cc
trunk/libzypp/zypp/parser/plaindir/RepoParser.h
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/parser/plaindir/RepoParser.h
trunk/libzypp/zypp/repo/Applydeltarpm.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/repo/Applydeltarpm.cc
trunk/libzypp/zypp/repo/Applydeltarpm.h
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/repo/Applydeltarpm.h
trunk/libzypp/zypp/repo/PackageDelta.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/repo/PackageDelta.cc
trunk/libzypp/zypp/repo/PackageDelta.h
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/repo/PackageDelta.h
trunk/libzypp/zypp/repo/SUSEMediaVerifier.cc
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/repo/SUSEMediaVerifier.cc
trunk/libzypp/zypp/repo/SUSEMediaVerifier.h
- copied unchanged from r6016, branches/REFACTORING-10_3/libzypp/zypp/repo/SUSEMediaVerifier.h
Removed:
trunk/libzypp-bindings/swig/Source.i
trunk/libzypp-bindings/swig/SourceFactory.i
trunk/libzypp/zypp/RepositoryFactory.cc
trunk/libzypp/zypp/RepositoryFactory.h
trunk/libzypp/zypp/Source.cc
trunk/libzypp/zypp/Source.h
trunk/libzypp/zypp/SourceCache.cc
trunk/libzypp/zypp/SourceCache.h
trunk/libzypp/zypp/SourceFactory.cc
trunk/libzypp/zypp/SourceFactory.h
trunk/libzypp/zypp/SourceFeed.cc
trunk/libzypp/zypp/SourceFeed.h
trunk/libzypp/zypp/SourceManager.cc
trunk/libzypp/zypp/SourceManager.h
trunk/libzypp/zypp/parser/SAXParser.cc
trunk/libzypp/zypp/parser/SAXParser.h
trunk/libzypp/zypp/parser/tagfile/
trunk/libzypp/zypp/parser/yum/YUMFileListParser.cc
trunk/libzypp/zypp/parser/yum/YUMFileListParser.h
trunk/libzypp/zypp/parser/yum/YUMGroupParser.cc
trunk/libzypp/zypp/parser/yum/YUMGroupParser.h
trunk/libzypp/zypp/parser/yum/YUMOtherParser.cc
trunk/libzypp/zypp/parser/yum/YUMOtherParser.h
trunk/libzypp/zypp/parser/yum/YUMParser.h
trunk/libzypp/zypp/parser/yum/YUMParserData.cc
trunk/libzypp/zypp/parser/yum/YUMParserData.h
trunk/libzypp/zypp/parser/yum/YUMPatchParser.cc
trunk/libzypp/zypp/parser/yum/YUMPatchParser.h
trunk/libzypp/zypp/parser/yum/YUMPatchesParser.cc
trunk/libzypp/zypp/parser/yum/YUMPatchesParser.h
trunk/libzypp/zypp/parser/yum/YUMPatternParser.cc
trunk/libzypp/zypp/parser/yum/YUMPatternParser.h
trunk/libzypp/zypp/parser/yum/YUMPrimaryParser.cc
trunk/libzypp/zypp/parser/yum/YUMPrimaryParser.h
trunk/libzypp/zypp/parser/yum/YUMProductParser.cc
trunk/libzypp/zypp/parser/yum/YUMProductParser.h
trunk/libzypp/zypp/parser/yum/YUMRepomdParser.cc
trunk/libzypp/zypp/parser/yum/YUMRepomdParser.h
trunk/libzypp/zypp/source/
Modified:
trunk/libzypp-bindings/CMakeLists.txt
trunk/libzypp-bindings/swig/Capability.i
trunk/libzypp-bindings/swig/ResObject.i
trunk/libzypp-bindings/swig/Url.i
trunk/libzypp-bindings/swig/ruby.i
trunk/libzypp-bindings/swig/zypp.i
trunk/libzypp/VERSION.cmake
trunk/libzypp/cmake/modules/FindSqlite.cmake
trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc
trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
trunk/libzypp/devel/devel.dmacvicar/testbed.cc
trunk/libzypp/devel/devel.ma/CMakeLists.txt
trunk/libzypp/devel/devel.ma/Parse.cc
trunk/libzypp/devel/devel.ma/Test.cc
trunk/libzypp/devel/devel.ma/Tools.h
trunk/libzypp/doc/autodoc/Doxyfile.cmake
trunk/libzypp/libzypp.spec.cmake
trunk/libzypp/package/libzypp.changes
trunk/libzypp/tests/cache/CMakeLists.txt
trunk/libzypp/tests/cache/CacheInitializer_test.cc
trunk/libzypp/tests/cache/CacheStore_test.cc
trunk/libzypp/tests/repo/CMakeLists.txt
trunk/libzypp/tests/zypp/CMakeLists.txt
trunk/libzypp/tests/zypp/MediaSetAccessTest.cc
trunk/libzypp/tests/zypp/RepoManager_test.cc
trunk/libzypp/tests/zypp/TranslatedText.cc
trunk/libzypp/tools/CMakeLists.txt
trunk/libzypp/tools/registration/zypp-query-pool.cc
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/CapFilters.h
trunk/libzypp/zypp/Fetcher.cc
trunk/libzypp/zypp/FileChecker.h
trunk/libzypp/zypp/KeyRing.cc
trunk/libzypp/zypp/MediaSetAccess.cc
trunk/libzypp/zypp/MediaSetAccess.h
trunk/libzypp/zypp/OnMediaLocation.cc
trunk/libzypp/zypp/OnMediaLocation.h
trunk/libzypp/zypp/Package.cc
trunk/libzypp/zypp/Package.h
trunk/libzypp/zypp/Pathname.cc
trunk/libzypp/zypp/Pathname.h
trunk/libzypp/zypp/ProgressData.cc
trunk/libzypp/zypp/ProgressData.h
trunk/libzypp/zypp/RepoInfo.cc
trunk/libzypp/zypp/RepoInfo.h
trunk/libzypp/zypp/RepoManager.cc
trunk/libzypp/zypp/RepoManager.h
trunk/libzypp/zypp/Repository.cc
trunk/libzypp/zypp/Repository.h
trunk/libzypp/zypp/ResFilters.h
trunk/libzypp/zypp/ResObject.cc
trunk/libzypp/zypp/ResObject.h
trunk/libzypp/zypp/ResPool.cc
trunk/libzypp/zypp/ResPool.h
trunk/libzypp/zypp/ResPoolProxy.cc
trunk/libzypp/zypp/ResPoolProxy.h
trunk/libzypp/zypp/ResStore.h
trunk/libzypp/zypp/Resolvable.cc
trunk/libzypp/zypp/SrcPackage.cc
trunk/libzypp/zypp/SrcPackage.h
trunk/libzypp/zypp/Target.cc
trunk/libzypp/zypp/Target.h
trunk/libzypp/zypp/TranslatedText.cc
trunk/libzypp/zypp/VendorAttr.cc
trunk/libzypp/zypp/ZYpp.cc
trunk/libzypp/zypp/ZYpp.h
trunk/libzypp/zypp/ZYppCallbacks.h
trunk/libzypp/zypp/ZYppCommitPolicy.h
trunk/libzypp/zypp/cache/Attribute.h
trunk/libzypp/zypp/cache/CacheAttributes.h
trunk/libzypp/zypp/cache/CacheInitializer.cc
trunk/libzypp/zypp/cache/CacheInitializer.h
trunk/libzypp/zypp/cache/CacheStore.cc
trunk/libzypp/zypp/cache/CacheStore.h
trunk/libzypp/zypp/cache/ResolvableQuery.cc
trunk/libzypp/zypp/cache/ResolvableQuery.h
trunk/libzypp/zypp/cache/schema/schema.sql
trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp
trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp
trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_exception.cpp
trunk/libzypp/zypp/capability/CapabilityImpl.h
trunk/libzypp/zypp/data/ResolvableData.cc
trunk/libzypp/zypp/data/ResolvableData.h
trunk/libzypp/zypp/data/ResolvableDataConsumer.h
trunk/libzypp/zypp/detail/PackageImplIf.cc
trunk/libzypp/zypp/detail/PackageImplIf.h
trunk/libzypp/zypp/detail/ResObjectImplIf.cc
trunk/libzypp/zypp/detail/ResObjectImplIf.h
trunk/libzypp/zypp/detail/SrcPackageImplIf.cc
trunk/libzypp/zypp/detail/SrcPackageImplIf.h
trunk/libzypp/zypp/parser/IniParser.cc
trunk/libzypp/zypp/parser/RepoFileReader.cc
trunk/libzypp/zypp/parser/TagParser.cc
trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc
trunk/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h
trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc
trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc
trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc
trunk/libzypp/zypp/parser/susetags/RepoIndex.cc
trunk/libzypp/zypp/parser/susetags/RepoParser.cc
trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h
trunk/libzypp/zypp/parser/xmlstore/XMLResObjectParser.cc
trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.cc
trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.h
trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h
trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h
trunk/libzypp/zypp/parser/yum/RepoParser.cc
trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
trunk/libzypp/zypp/pool/GetResolvablesToInsDel.cc
trunk/libzypp/zypp/pool/PoolImpl.h
trunk/libzypp/zypp/pool/PoolTraits.h
trunk/libzypp/zypp/repo/DeltaCandidates.cc
trunk/libzypp/zypp/repo/DeltaCandidates.h
trunk/libzypp/zypp/repo/PackageProvider.cc
trunk/libzypp/zypp/repo/PackageProvider.h
trunk/libzypp/zypp/repo/RepoProvideFile.cc
trunk/libzypp/zypp/repo/RepoType.cc
trunk/libzypp/zypp/repo/RepoType.h
trunk/libzypp/zypp/repo/RepositoryImpl.cc
trunk/libzypp/zypp/repo/RepositoryImpl.h
trunk/libzypp/zypp/repo/cached/AtomImpl.cc
trunk/libzypp/zypp/repo/cached/AtomImpl.h
trunk/libzypp/zypp/repo/cached/MessageImpl.cc
trunk/libzypp/zypp/repo/cached/MessageImpl.h
trunk/libzypp/zypp/repo/cached/PackageImpl.cc
trunk/libzypp/zypp/repo/cached/PackageImpl.h
trunk/libzypp/zypp/repo/cached/PatchImpl.cc
trunk/libzypp/zypp/repo/cached/PatchImpl.h
trunk/libzypp/zypp/repo/cached/PatternImpl.cc
trunk/libzypp/zypp/repo/cached/PatternImpl.h
trunk/libzypp/zypp/repo/cached/ProductImpl.cc
trunk/libzypp/zypp/repo/cached/ProductImpl.h
trunk/libzypp/zypp/repo/cached/RepoImpl.cc
trunk/libzypp/zypp/repo/cached/RepoImpl.h
trunk/libzypp/zypp/repo/cached/ScriptImpl.cc
trunk/libzypp/zypp/repo/cached/ScriptImpl.h
trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc
trunk/libzypp/zypp/repo/cached/SrcPackageImpl.h
trunk/libzypp/zypp/repo/memory/AtomImpl.cc
trunk/libzypp/zypp/repo/memory/AtomImpl.h
trunk/libzypp/zypp/repo/memory/MessageImpl.cc
trunk/libzypp/zypp/repo/memory/MessageImpl.h
trunk/libzypp/zypp/repo/memory/PackageImpl.cc
trunk/libzypp/zypp/repo/memory/PackageImpl.h
trunk/libzypp/zypp/repo/memory/PatchImpl.cc
trunk/libzypp/zypp/repo/memory/PatchImpl.h
trunk/libzypp/zypp/repo/memory/PatternImpl.cc
trunk/libzypp/zypp/repo/memory/PatternImpl.h
trunk/libzypp/zypp/repo/memory/ProductImpl.cc
trunk/libzypp/zypp/repo/memory/ProductImpl.h
trunk/libzypp/zypp/repo/memory/ScriptImpl.cc
trunk/libzypp/zypp/repo/memory/ScriptImpl.h
trunk/libzypp/zypp/repo/memory/SrcPackageImpl.cc
trunk/libzypp/zypp/repo/memory/SrcPackageImpl.h
trunk/libzypp/zypp/repo/susetags/Downloader.cc
trunk/libzypp/zypp/repo/yum/Downloader.cc
trunk/libzypp/zypp/solver/detail/InstallOrder.cc
trunk/libzypp/zypp/solver/detail/InstallOrder.h
trunk/libzypp/zypp/solver/detail/Resolver.cc
trunk/libzypp/zypp/solver/detail/Resolver.h
trunk/libzypp/zypp/solver/detail/ResolverContext.cc
trunk/libzypp/zypp/solver/detail/ResolverContext.h
trunk/libzypp/zypp/solver/detail/ResolverInfo.cc
trunk/libzypp/zypp/solver/detail/ResolverQueue.cc
trunk/libzypp/zypp/solver/detail/Testcase.cc
trunk/libzypp/zypp/solver/detail/Testcase.h
trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.cc
trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.h
trunk/libzypp/zypp/target/TargetImpl.cc
trunk/libzypp/zypp/target/TargetImpl.h
trunk/libzypp/zypp/target/rpm/RpmDb.cc
trunk/libzypp/zypp/target/rpm/RpmDb.h
trunk/libzypp/zypp/target/rpm/RpmHeader.cc
trunk/libzypp/zypp/target/rpm/RpmHeader.h
trunk/libzypp/zypp/target/rpm/RpmPackageImpl.cc
trunk/libzypp/zypp/target/rpm/RpmPackageImpl.h
trunk/libzypp/zypp/target/store/Backend.h
trunk/libzypp/zypp/target/store/PersistentStorage.cc
trunk/libzypp/zypp/target/store/PersistentStorage.h
trunk/libzypp/zypp/target/store/XMLFilesBackend.cc
trunk/libzypp/zypp/target/store/XMLFilesBackend.h
trunk/libzypp/zypp/target/store/serialize.cc
trunk/libzypp/zypp/target/store/serialize.h
trunk/libzypp/zypp/target/store/xml/XMLAtomImpl.h
trunk/libzypp/zypp/target/store/xml/XMLMessageImpl.h
trunk/libzypp/zypp/target/store/xml/XMLPatchImpl.h
trunk/libzypp/zypp/target/store/xml/XMLPatternImpl.h
trunk/libzypp/zypp/target/store/xml/XMLProductImpl.h
trunk/libzypp/zypp/target/store/xml/XMLScriptImpl.h
trunk/libzypp/zypp/target/store/xml/XMLSelectionImpl.h
trunk/libzypp/zypp/zypp_detail/ZYppImpl.cc
trunk/libzypp/zypp/zypp_detail/ZYppImpl.h
Modified: trunk/libzypp-bindings/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp-bindings/CMakeLists.txt (original)
+++ trunk/libzypp-bindings/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -32,7 +32,7 @@
INCLUDE(CPack)
#FIND_PACKAGE(SWIG REQUIRED)
-
+MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}")
FIND_PROGRAM(SWIG_EXECUTABLE
NAMES swig-1.3 swig
PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
Modified: trunk/libzypp-bindings/swig/Capability.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/Capability.i?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/Capability.i (original)
+++ trunk/libzypp-bindings/swig/Capability.i Mon Jul 16 12:40:42 2007
@@ -44,11 +44,7 @@
/** accessors needed by solver/zmd */
/** Deprecated */
std::string index() const;
- /** Deprecated, defaults to Rel::NONE */
- Rel op() const;
- /** Deprecated, defaults to Edition::noedition */
- Edition edition() const;
-
+
private:
typedef capability::CapabilityImpl Impl;
typedef capability::CapabilityImpl_Ptr Impl_Ptr ;
Modified: trunk/libzypp-bindings/swig/ResObject.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResObject.i?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResObject.i (original)
+++ trunk/libzypp-bindings/swig/ResObject.i Mon Jul 16 12:40:42 2007
@@ -19,8 +19,8 @@
Vendor vendor() const;
ByteCount size() const;
ByteCount archivesize() const;
- Source_Ref source() const;
- unsigned sourceMediaNr() const;
+ Repository repository() const;
+ unsigned mediaNr() const;
bool installOnly() const;
Date buildtime() const;
Date installtime() const;
Modified: trunk/libzypp-bindings/swig/Url.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/Url.i?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/Url.i (original)
+++ trunk/libzypp-bindings/swig/Url.i Mon Jul 16 12:40:42 2007
@@ -10,3 +10,8 @@
%typemap(freearg) const Url & {
delete $1;
}
+
+%typemap(out) Url {
+ VALUE rburlstr = rb_str_new2($1.asString().c_str());
+ $result = rburlstr ;
+}
\ No newline at end of file
Modified: trunk/libzypp-bindings/swig/ruby.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ruby.i?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ruby.i (original)
+++ trunk/libzypp-bindings/swig/ruby.i Mon Jul 16 12:40:42 2007
@@ -1,5 +1,12 @@
-%rename("asString") foo(to_s);
+%rename("asString") to_s;
+
+#define auto_string( cl ) \
+%extend cl { \
+ std::string to_s() { \
+ return self->asString();\
+ } \
+}
#define iter( cl, storetype ) \
%mixin cl "Enumerable"; \
@@ -25,6 +32,19 @@
} \
}
+#define auto_iterator( cl, storetype ) \
+%mixin cl "Enumerable"; \
+%extend cl { \
+ void each() { \
+ cl::iterator i = self->begin(); \
+ while ( i != self->end() ) { \
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(storetype), 0)); \
+ ++i; \
+ } \
+ } \
+}
+
+
%extend Target {
void each_by_kind( const ResObject::Kind & kind_r )
{
Modified: trunk/libzypp-bindings/swig/zypp.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/zypp.i?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/zypp.i (original)
+++ trunk/libzypp-bindings/swig/zypp.i Mon Jul 16 12:40:42 2007
@@ -1,5 +1,4 @@
%module rzypp
-%include std_string.i
%{
/* Includes the header in the wrapper code */
@@ -12,8 +11,6 @@
#include
#include
#include "zypp/base/ReferenceCounted.h"
- #include "zypp/SourceFactory.h"
- #include "zypp/Source.h"
#include "zypp/ResObject.h"
#include "zypp/Target.h"
#include "zypp/target/TargetImpl.h"
@@ -21,19 +18,20 @@
#include "zypp/CapFactory.h"
#include "zypp/Package.h"
#include "zypp/ResFilters.h"
-#include "zypp/source/OnMediaLocation.h"
+#include "zypp/OnMediaLocation.h"
+ #include "zypp/Repository.h"
+ #include "zypp/RepoManager.h"
+ #include "zypp/repo/RepoType.h"
#include "zypp/MediaSetAccess.h"
using namespace boost;
using namespace zypp;
+ using namespace zypp::repo;
using namespace zypp::resfilter;
+ typedef std::set<Url> UrlSet;
%}
-#ifdef SWIGRUBY
-%include "ruby.i"
-#endif
-
%rename("+") "operator+";
%rename("<<") "operator<<";
%rename("!=") "operator!=";
@@ -57,6 +55,13 @@
};
%include "Pathname.i"
+%include "Url.i"
+
+%include std_string.i
+%include "stl.i"
+%include "std_list.i"
+%include "std_set.i"
+
%include "Arch.i"
%include "ResStore.i"
%include "Edition.i"
@@ -64,8 +69,11 @@
%include "Date.i"
%include "Resolvable.i"
%include "ByteCount.i"
-%include "Source.i"
-%include "SourceFactory.i"
+%include "RepoType.i"
+%include "Repository.i"
+%include "RepoInfo.i"
+%include "RepoManager.i"
+%include "RepoStatus.i"
%include "ResObject.i"
%include "TranslatedText.i"
%include "CheckSum.i"
@@ -85,11 +93,18 @@
%include "ResPool.i"
%include "ZYppCommitPolicy.i"
%include "ZYppCommitResult.i"
-%include "Url.i"
%include "MediaSetAccess.i"
+
+#ifdef SWIGRUBY
+%include "ruby.i"
+#endif
+
+
/* define iterators using swig macros */
iter2( ResStore, ResObject::Ptr )
+auto_iterator( std::list<RepoInfo>, RepoInfo )
+%alias Arch::asString "to_s";
class ZYpp
{
Modified: trunk/libzypp/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/VERSION.cmake (original)
+++ trunk/libzypp/VERSION.cmake Mon Jul 16 12:40:42 2007
@@ -45,6 +45,6 @@
#
SET(LIBZYPP_MAJOR "3")
-SET(LIBZYPP_MINOR "4")
-SET(LIBZYPP_COMPATMINOR "3")
-SET(LIBZYPP_PATCH "0")
+SET(LIBZYPP_MINOR "11")
+SET(LIBZYPP_COMPATMINOR "10")
+SET(LIBZYPP_PATCH "8")
Modified: trunk/libzypp/cmake/modules/FindSqlite.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/cmake/modules/FindSqlite.cmake?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/cmake/modules/FindSqlite.cmake (original)
+++ trunk/libzypp/cmake/modules/FindSqlite.cmake Mon Jul 16 12:40:42 2007
@@ -12,7 +12,7 @@
/usr/local/include
)
-FIND_LIBRARY(SQLITE_LIBRARY NAMES sqlitezmd3 sqlite3
+FIND_LIBRARY(SQLITE_LIBRARY NAMES sqlite3
PATHS
/usr/lib
/usr/local/lib
Modified: trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -3,20 +3,20 @@
ADD_EXECUTABLE(mediaaccess mediaaccess.cc)
TARGET_LINK_LIBRARIES(mediaaccess zypp )
-ADD_EXECUTABLE(scansource ScanSource.cc)
-TARGET_LINK_LIBRARIES(scansource zypp )
+#ADD_EXECUTABLE(scansource ScanSource.cc)
+#TARGET_LINK_LIBRARIES(scansource zypp )
-ADD_EXECUTABLE(susetags-downloader SUSETagsDownloader_tp.cc)
-TARGET_LINK_LIBRARIES(susetags-downloader zypp )
+#ADD_EXECUTABLE(susetags-downloader SUSETagsDownloader_tp.cc)
+#TARGET_LINK_LIBRARIES(susetags-downloader zypp )
ADD_EXECUTABLE(cachestore CacheStore_tp.cc)
TARGET_LINK_LIBRARIES(cachestore zypp )
-ADD_EXECUTABLE(testbed testbed.cc)
-TARGET_LINK_LIBRARIES(testbed zypp )
+#ADD_EXECUTABLE(testbed testbed.cc)
+#TARGET_LINK_LIBRARIES(testbed zypp )
-ADD_EXECUTABLE(yum-downloader YUMDownloader_tp.cc)
-TARGET_LINK_LIBRARIES(yum-downloader zypp )
+#ADD_EXECUTABLE(yum-downloader YUMDownloader_tp.cc)
+#TARGET_LINK_LIBRARIES(yum-downloader zypp )
# ADD_EXECUTABLE(yum-reader YUMReader_tp.cc)
# TARGET_LINK_LIBRARIES(yum-reader zypp )
Modified: trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc Mon Jul 16 12:40:42 2007
@@ -10,7 +10,6 @@
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/RepositoryFactory.h"
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/data/ResolvableData.h"
Modified: trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc Mon Jul 16 12:40:42 2007
@@ -5,13 +5,13 @@
#include <fstream>
#include
+#include
#include
#include
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/RepositoryFactory.h"
#include "zypp/RepoInfo.h"
#include "zypp/repo/cached/RepoImpl.h"
@@ -23,7 +23,7 @@
using namespace std;
using namespace zypp;
-using namespace zypp::source;
+using namespace zypp::repo;
int main(int argc, char **argv)
@@ -40,7 +40,25 @@
for ( RepoInfoList::const_iterator it = repos.begin(); it != repos.end(); ++it )
{
cout << *it << endl;
+ Repository repo = manager.createFromCache(*it);
+ z->addResolvables(repo.resolvables());
}
+
+ ResPool pool(z->pool());
+ cout << pool.size() << " resolvables" << endl;
+ debug::Measure m("group call");
+ for ( ResPool::const_iterator it = pool.begin();
+ it != pool.end();
+ ++it )
+ {
+ ResObject::constPtr res = (*it).resolvable();
+ if ( isKind<Package>(res) )
+ {
+ Package::constPtr p = asKind<Package>(res);
+ //cout << p->group() << std::endl;
+ }
+ }
+ m.elapsed();
}
catch ( const Exception &e )
{
Modified: trunk/libzypp/devel/devel.dmacvicar/testbed.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/testbed.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/testbed.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/testbed.cc Mon Jul 16 12:40:42 2007
@@ -10,7 +10,6 @@
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/RepositoryFactory.h"
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/data/ResolvableData.h"
Modified: trunk/libzypp/devel/devel.ma/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.ma/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -39,7 +39,7 @@
ENDFOREACH( loop_var )
-FOREACH( loop_var AOUT Parse)
+FOREACH( loop_var AOUT Parse Test)
ADD_EXECUTABLE( ${loop_var}
${loop_var}.cc
)
Modified: trunk/libzypp/devel/devel.ma/Parse.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Parse.cc (original)
+++ trunk/libzypp/devel/devel.ma/Parse.cc Mon Jul 16 12:40:42 2007
@@ -2,12 +2,12 @@
#include
#include
+#include
#include
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
-#include
-#include
+#include
#include "zypp/ZYppCallbacks.h"
#include "zypp/NVRAD.h"
@@ -21,22 +21,21 @@
#include "zypp/NameKindProxy.h"
#include "zypp/pool/GetResolvablesToInsDel.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
#include "zypp/parser/TagParser.h"
#include "zypp/parser/susetags/PackagesFileReader.h"
#include "zypp/parser/susetags/PackagesLangFileReader.h"
#include "zypp/parser/susetags/PatternFileReader.h"
#include "zypp/parser/susetags/ContentFileReader.h"
#include "zypp/parser/susetags/RepoIndex.h"
-
#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/cache/CacheStore.h"
+#include "zypp/RepoManager.h"
+#include "zypp/RepoInfo.h"
using namespace std;
using namespace zypp;
using namespace zypp::functor;
-using zypp::parser::tagfile::TagFileParser;
using zypp::parser::TagParser;
///////////////////////////////////////////////////////////////////
@@ -45,6 +44,114 @@
///////////////////////////////////////////////////////////////////
+struct Xprint
+{
+ bool operator()( const PoolItem & obj_r )
+ {
+ MIL << obj_r << " " << obj_r->summary() << endl;
+ MIL << obj_r << " " << obj_r->description() << endl;
+ return true;
+ }
+
+ template<class _C>
+ bool operator()( const _C & obj_r )
+ {
+ USR << obj_r << endl;
+ return true;
+ }
+};
+
+///////////////////////////////////////////////////////////////////
+struct SetTransactValue
+{
+ SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
+ : _newVal( newVal_r )
+ , _causer( causer_r )
+ {}
+
+ ResStatus::TransactValue _newVal;
+ ResStatus::TransactByValue _causer;
+
+ bool operator()( const PoolItem & pi ) const
+ {
+ bool ret = pi.status().setTransactValue( _newVal, _causer );
+ if ( ! ret )
+ ERR << _newVal << _causer << " " << pi << endl;
+ return ret;
+ }
+};
+
+struct StatusReset : public SetTransactValue
+{
+ StatusReset()
+ : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
+ {}
+};
+
+struct StatusInstall : public SetTransactValue
+{
+ StatusInstall()
+ : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER )
+ {}
+};
+
+inline bool g( const NameKindProxy & nkp, Arch arch = Arch() )
+{
+ if ( nkp.availableEmpty() )
+ {
+ ERR << "No Item to select: " << nkp << endl;
+ return false;
+ ZYPP_THROW( Exception("No Item to select") );
+ }
+
+ if ( arch != Arch() )
+ {
+ typeof( nkp.availableBegin() ) it = nkp.availableBegin();
+ for ( ; it != nkp.availableEnd(); ++it )
+ {
+ if ( (*it)->arch() == arch )
+ return (*it).status().setTransact( true, ResStatus::USER );
+ }
+ }
+
+ return nkp.availableBegin()->status().setTransact( true, ResStatus::USER );
+}
+
+///////////////////////////////////////////////////////////////////
+
+bool solve( bool establish = false )
+{
+ if ( establish )
+ {
+ bool eres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ eres = getZYpp()->resolver()->establishPool();
+ }
+ if ( ! eres )
+ {
+ ERR << "establish " << eres << endl;
+ return false;
+ }
+ MIL << "establish " << eres << endl;
+ }
+
+ bool rres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ rres = getZYpp()->resolver()->resolvePool();
+ }
+ if ( ! rres )
+ {
+ ERR << "resolve " << rres << endl;
+ return false;
+ }
+ MIL << "resolve " << rres << endl;
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////
+
struct ConvertDbReceive : public callback::ReceiveReporttarget::ScriptResolvableReport
{
virtual void start( const Resolvable::constPtr & script_r,
@@ -82,7 +189,7 @@
struct MediaChangeReceive : public callback::ReceiveReportmedia::MediaChangeReport
{
- virtual Action requestMedia( Source_Ref source
+ virtual Action requestMedia( Repository source
, unsigned mediumNr
, Error error
, const std::string & description )
@@ -109,7 +216,7 @@
struct AddResolvables
{
- bool operator()( const Source_Ref & src ) const
+ bool operator()( const Repository & src ) const
{
getZYpp()->addResolvables( src.resolvables() );
return true;
@@ -127,68 +234,22 @@
}
///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-
-using namespace zypp::parser::susetags;
-#include "zypp/cache/CacheStore.h"
-
-void consumeIndex( const parser::susetags::RepoIndex_Ptr & index_r )
-{
- SEC << "[Index]" << index_r << endl;
-}
-void consumeProd( const data::Product_Ptr & prod_r )
-{
- SEC << "[Prod]" << prod_r << endl;
-}
+#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG; IT != END; ++IT )
-void consumePkg( const data::Package_Ptr & pkg_r )
-{
- //MIL << "[Pkg]" << pkg_r << endl;
-}
-
-void consumeSrcPkg( const data::SrcPackage_Ptr & pkg_r )
-{
- //DBG << "[Src]" << pkg_r << endl;
-}
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
-void consumePat( const data::Pattern_Ptr & pat_r )
-{
- MIL << "[Pat]" << pat_r << endl;
-}
-void pPackages( const Pathname & p )
-{
- Measure x( p.basename() );
- PackagesFileReader tp;
- tp.setPkgConsumer( consumePkg );
- tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-}
-void pPackagesLang( const Pathname & p, const Locale & locale_r )
-{
- Measure x( p.basename() );
- PackagesLangFileReader tp;
- tp.setLocale( locale_r );
- tp.setPkgConsumer( consumePkg );
- tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-}
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
-void pPattern( const Pathname & p )
-{
- Measure x( p.basename() );
- PatternFileReader tp;
- tp.setConsumer( consumePat );
- tp.parse( p );
-}
+using namespace zypp;
- /******************************************************************
+/******************************************************************
**
** FUNCTION NAME : main
** FUNCTION TYPE : int
@@ -198,90 +259,64 @@
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
- Pathname dbdir( "store" );
- Pathname reporoot( "lmd" );
+ RepoManager repoManager;
+ RepoInfoList repos = repoManager.knownRepositories();
+ SEC << repos << endl;
- cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( "foosource" );
+ if ( repos.empty() )
{
- Measure x( "XXXXXXXXXXXXX" );
-
- parser::susetags::RepoParser repo( repositoryId, store );
- repo.parse( reporoot );
-
- store.commit();
+ RepoInfo nrepo;
+ nrepo
+ .setAlias( "factorytest" )
+ .setName( "Test Repo for factory." )
+ .setEnabled( true )
+ .setAutorefresh( false )
+ .addBaseUrl( Url("ftp://dist.suse.de/install/stable-x86/") );
+
+ repoManager.addRepository( nrepo );
+ repos = repoManager.knownRepositories();
+ SEC << "refreshMetadat" << endl;
+ repoManager.refreshMetadata( nrepo );
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
+ SEC << "------" << endl;
}
+ ResPool pool( getZYpp()->pool() );
+ vdumpPoolStats( USR << "Initial pool:" << endl,
+ pool.begin(),
+ pool.end() ) << endl;
-#if 0
- ContentFileReader tp;
- tp.setProductConsumer( consumeProd );
- tp.setRepoIndexConsumer( consumeIndex );
- //tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-
-
- //try
+ for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
{
- //Pathname dbdir( "/Local/ma/zypp-TRUNK/BUILD/libzypp/devel/devel.ma/store" );
-
-
- Pathname dbdir( "store" );
- Pathname metadir( "lmd" );
-
- cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( Url("http://www.google.com"), "/" );
-
- RepoParser( metadir, repositoryId, store );
-
- }
-
- try
- {
- ZYpp::Ptr z = getZYpp();
-
- Pathname dbfile( "data.db" );
- cache::CacheStore store(getenv("PWD"));
+ RepoInfo & nrepo( *it );
- data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://www.google.com"), "/");
-
- PackagesParser parser( repository_id, store);
- Measure m;
- parser.start(argv[1], &progress_function);
- m.elapsed();
- }
- catch ( const Exception &e )
- {
- cout << "ups! " << e.msg() << std::endl;
- }
-#endif
-
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-
- Pathname proot( "lmd/suse/setup/descr" );
-
- pPackages( proot/"packages" );
- //pPackages( proot/"packages.gz" );
- pPackagesLang( proot/"packages.de", Locale("de") );
- //pPackagesLang( proot/"packages.de.gz", Locale("de") );
- pPattern( proot/"base-10.3-30.x86_64.pat" );
-
- if ( 0 )
- {
- Measure x( "lmd.idx" );
- std::ifstream fIndex( "lmd.idx" );
- for( iostr::EachLine in( fIndex ); in; in.next() )
+ if ( 0 )
{
- Measure x( *in );
- std::ifstream fIn( (*in).c_str() );
- for( iostr::EachLine l( fIn ); l; l.next() )
+ if ( repoManager.isCached( nrepo ) )
{
- ;
+ SEC << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
}
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
}
+ SEC << nrepo << endl;
+ Repository nrep( repoManager.createFromCache( nrepo ) );
+ const zypp::ResStore & store( nrep.resolvables() );
+ dumpPoolStats( SEC << "Store: " << endl,
+ store.begin(), store.end() ) << endl;
+ getZYpp()->addResolvables( store );
}
+
+ USR << "pool: " << pool << endl;
+
+ SEC << pool.knownRepositoriesSize() << endl;
+ std::for_each( pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd(), Print() );
+
+ std::for_each( pool.byNameBegin("glibc"), pool.byNameEnd("glibc"), Xprint() );
+
+ ///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
zypp::base::LogControl::instance().logNothing();
return 0;
Modified: trunk/libzypp/devel/devel.ma/Test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Test.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Test.cc (original)
+++ trunk/libzypp/devel/devel.ma/Test.cc Mon Jul 16 12:40:42 2007
@@ -1,6 +1,5 @@
#include "Tools.h"
-#include
-#include
+#include "ExplicitMap.h"
#include
#include <iostream>
@@ -9,719 +8,175 @@
#include
#include
-
-#include "Measure.h"
-
-#include "zypp/parser/xml/Reader.h"
-
-using namespace std;
-using namespace zypp;
-
#include "zypp/base/Exception.h"
#include "zypp/base/InputStream.h"
#include "zypp/base/DefaultIntegral.h"
#include
#include
+
#include
-#include
-#include
#include
#include
#include
-///////////////////////////////////////////////////////////////////
-
-template<class _Cl>
- void ti( const _Cl & c )
- {
- SEC << __PRETTY_FUNCTION__ << endl;
- }
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{
- namespace parser
- {
- namespace yum
- {
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- }
- }
-}
-///////////////////////////////////////////////////////////////////
-
-bool nopNode( xml::Reader & reader_r )
-{
- return true;
-}
-
-bool accNode( xml::Reader & reader_r )
-{
- int i;
- xml::XmlString s;
-#define X(m) reader_r->m()
- i=X(readState);
- i=X(lineNumber);
- i=X(columnNumber);
- i=X(depth);
- i=X(nodeType);
- s=X(name);
- s=X(prefix);
- s=X(localName);
- i=X(hasAttributes);
- i=X(attributeCount);
- i=X(hasValue);
- s=X(value);
-#undef X
- return true;
-}
-
-bool dumpNode( xml::Reader & reader_r )
-{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ATTRIBUTE:
- DBG << *reader_r << endl;
- break;
- case XML_READER_TYPE_ELEMENT:
- MIL << *reader_r << endl;
- break;
- default:
- WAR << *reader_r << endl;
- break;
- }
- return true;
-}
-
-bool dumpNode2( xml::Reader & reader_r )
-{
- dumpNode( reader_r );
- return reader_r.foreachNodeAttribute( dumpNode );
-}
-
-bool dumpEd( xml::Reader & reader_r )
-{
- static int num = 5;
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT
- && reader_r->name() == "version" )
- {
- MIL << *reader_r << endl;
- DBG << reader_r->getAttribute( "rel" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "ver" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "epoch" ) << endl;
- ERR << *reader_r << endl;
- WAR << Edition( reader_r->getAttribute( "ver" ).asString(),
- reader_r->getAttribute( "rel" ).asString(),
- reader_r->getAttribute( "epoch" ).asString() ) << endl;
- --num;
- }
- return num;
-}
+#include "zypp/parser/TagParser.h"
+#include "zypp/parser/susetags/PackagesFileReader.h"
+#include "zypp/parser/susetags/PackagesLangFileReader.h"
+#include "zypp/parser/susetags/PatternFileReader.h"
+#include "zypp/parser/susetags/ContentFileReader.h"
+#include "zypp/parser/susetags/RepoIndex.h"
+#include "zypp/parser/susetags/RepoParser.h"
+#include "zypp/cache/CacheStore.h"
+using namespace std;
+using namespace zypp;
+using namespace zypp::parser;
+using namespace zypp::parser::susetags;
///////////////////////////////////////////////////////////////////
-namespace parser
+struct DummyConsumer : public zypp::data::ResolvableDataConsumer
+ , private base::NonCopyable
{
- namespace consume
+ std::string idString( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- struct Repomd
- {
- struct Data
- {
- Depositorystd::string _type;
- Depository<CheckSum> _checksum;
- Depository<Date> _timestamp;
- Depository<CheckSum> _openChecksum;
- };
-
- Depository<Data> _data;
- };
+ std::string ret( kind_r.asString() );
+ ret += ":";
+ ret += res_r->name;
+ ret += "-";
+ ret += res_r->edition.asString();
+ ret += ".";
+ ret += res_r->arch.asString();
+ return ret;
}
+ data::RecordId _lastId;
+ std::mapstd::string,data::RecordId _idMap;
+ std::mapdata::RecordId,std::string _reverseMap;
-
-}
-
-namespace data
-{
- struct Repomd
- {
- struct Data
- {
- std::string _type;
- CheckSum _checksum;
- Date _timestamp;
- CheckSum _openChecksum;
- };
-
- std::map _data;
- };
-}
-
-///////////////////////////////////////////////////////////////////
-
-
-
-struct Element;
-std::ostream & operator<<( std::ostream & str, const Element & obj );
-
-struct Element : private base::NonCopyable
-{
- Element( xml::Reader & reader_r )
- : _reader( reader_r )
- , _name( _reader->name().asString() )
- , _depth( _reader->depth() )
+ bool hasEntry( const std::string & id_r )
{
- MIL << *this << endl;
- //return;
- while( nextElement() )
- {
- Element el( _reader );
- }
+ return _idMap.find( id_r ) != _idMap.end();
}
- ~Element()
+ data::RecordId newId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- while( nextElement() )
- { ; }
- DBG << *this << endl;
+ std::string id( idString( res_r, kind_r ) );
+ if ( hasEntry( id ) )
+ ZYPP_THROW(Exception(id));
+ _idMap[id] = ++_lastId;
+ _reverseMap[_lastId] = id;
+ MIL << "NEW_ID " << _lastId << " - " << id << endl;
+ logNew( res_r, kind_r );
+ return _lastId;
}
- bool atBegin() const
+ data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- return ( _reader->depth() == _depth
- && _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->name().c_str() == _name );
+ std::string id( idString( res_r, kind_r ) );
+ if ( ! hasEntry( id ) )
+ ZYPP_THROW(Exception(id));
+ data::RecordId ret = _idMap[id];
+ DBG << ret << " " << id << endl;
+ return ret;
}
- bool atEnd() const
+ std::string lookup( data::RecordId id_r )
{
- return ( _reader->depth() == _depth
- && ( _reader->nodeType() == XML_READER_TYPE_END_ELEMENT
- || ( _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->isEmptyElement() ) )
- && _reader->name().c_str() == _name );
- }
-
- bool nextElement()
- {
- while ( ! atEnd() )
- {
- if ( ! _reader.nextNode() )
- return false;
- if ( _reader->nodeType() == XML_READER_TYPE_ELEMENT )
- return true;
- WAR << *_reader << endl;
- }
- return false;
- }
-
-
- xml::Reader & _reader;
- std::string _name;
- int _depth;
-};
-
-std::ostream & operator<<( std::ostream & str, const Element & obj )
-{
- str << ( obj.atBegin() ? 'B' : '_' )
- << ( obj.atEnd() ? 'E' : '_' )
- << obj._depth << ":" << std::string( obj._depth, ' ') << obj._name
- << " {" << *obj._reader << '}';
- return str;
-}
-
-bool dumpEl( xml::Reader & reader_r )
-{
- Element el( reader_r );
- return true;
-}
-
-void parse2( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
+ if ( id_r == data::noRecordId )
{
- MIL << file_r << endl;
- xml::Reader r( file_r );
- MIL << *r << endl;
- Element el( r );
- MIL << *r << endl;
+ return "";
}
- catch ( const Exception & )
+
+ if ( _reverseMap.find( id_r ) != _reverseMap.end() )
{
+ return _reverseMap[id_r];
}
-}
-///////////////////////////////////////////////////////////////////
-class BasicParser
-{
- public:
- typedef function Consumer;
- typedef ExplicitMapstd::string,Consumer ConsumerMap;
- BasicParser( const InputStream & file_r )
- : _reader( file_r )
- , _cmap( nop )
- {}
-
- public:
- xml::Reader & reader()
- { return _reader; }
-
- const xml::Reader & reader() const
- { return _reader; }
-
- ConsumerMap & cmap()
- { return _cmap; }
-
- const ConsumerMap & cmap() const
- { return _cmap; }
-
- public:
+ WAR << "Lookup id " << id_r << "failed" << endl;
+ return std::string();
+ }
- bool parse( xml::Reader & reader_r )
+ void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
+ {
+ std::string shr( lookup( res_r->shareDataWith ) );
+ if ( ! shr.empty() )
{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- case XML_READER_TYPE_TEXT:
- case XML_READER_TYPE_CDATA:
- case XML_READER_TYPE_END_ELEMENT:
- consume( reader_r );
- default:
- ;
- }
- return true;
+ DBG << " SHR: " << shr << endl;
}
+ //DBG << " SUM: " << res_r->summary << endl;
+ if ( 0&&kind_r == ResTraits<Package>::kind )
+ {
+ data::Package_Ptr p = dynamic_pointer_castdata::Package(res_r);
+ DBG << " PKG: " << p << endl;
+ DBG << " LOC: " << p->repositoryLocation << endl;
+ }
+ static unsigned n = 20;
+ if ( 0&&! --n )
+ throw;
+ }
public:
- void consume( xml::Reader & reader_r, const std::string & key_r )
- { _cmap[key_r]( reader_r ); }
-
- void consume( xml::Reader & reader_r )
- { consume( reader_r, reader_r->name().asString() ); }
-
- void consume()
- { consume( _reader ); }
-
- public:
- static void nop( xml::Reader & reader_r )
- { ; }
-
- static void log( xml::Reader & reader_r )
- { DBG << "NOP " << *reader_r << endl; }
-
-
- protected:
- xml::Reader _reader;
- ConsumerMap _cmap;
-};
-///////////////////////////////////////////////////////////////////
-
-struct RepomdParser : private BasicParser
-{
- RepomdParser( const InputStream & file_r )
- : BasicParser( file_r )
+ virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_r )
{
- reader().foreachNode( ref(*this) );
+ return newId( res_r, ResTraits<Package>::kind );
}
- bool operator()( xml::Reader & reader_r )
+ virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_r )
{
- return parse( reader_r );
+ return newId( res_r, ResTraits<SrcPackage>::kind );
}
- // READER goes here!
-};
-
-///////////////////////////////////////////////////////////////////
-struct Consume
-{
- struct Entry
+ virtual data::RecordId consumeProduct ( const data::RecordId & repository_id, const data::Product_Ptr & res_r )
{
- Pathname _location;
- CheckSum _checksum;
- //unused: Date _timestamp;
- //unused: CheckSum _openChecksum;
- };
-
- typedef void (Consume::*Consumer)( xml::Reader & reader_r );
+ return newId( res_r, ResTraits<Product>::kind );
+ }
- Consume( const InputStream & file_r )
- : _reader( file_r )
- , _consume( &Consume::nop )
- , _centry( NULL )
+ virtual data::RecordId consumePatch ( const data::RecordId & repository_id, const data::Patch_Ptr & res_r )
{
- _consume.set( "data", &Consume::data );
- _reader.foreachNode( ref(*this) );
+ return newId( res_r, ResTraits<Patch>::kind );
}
- bool operator()( xml::Reader & reader_r )
+ virtual data::RecordId consumePackageAtom ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r )
{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- (this->*_consume[reader_r->name().asString()])( reader_r );
- //data( reader_r );
- break;
- default:
- WAR << *_reader << endl;
- break;
- }
- return true;
+ return newId( res_r, ResTraits<Atom>::kind );
}
- void nop( xml::Reader & reader_r )
- { ; }
-
- void log( xml::Reader & reader_r )
- { DBG << "NOP " << *_reader << endl; }
-
- void data( xml::Reader & reader_r )
+ virtual data::RecordId consumeMessage ( const data::RecordId & repository_id, const data::Message_Ptr & res_r )
{
- MIL << *_reader << endl;
- _result[reader_r->name().asString()] = Entry();
+ return newId( res_r, ResTraits<Message>::kind );
}
-
-
- xml::Reader _reader;
- ExplicitMapstd::string,Consumer _consume;
- std::mapstd::string,Entry _result;
- Entry * _centry;
-};
-
-std::ostream & operator<<( std::ostream & str, const Consume & obj )
-{
- return str;
-}
-
-std::ostream & operator<<( std::ostream & str, const Consume::Entry & obj )
-{
- return str << "Entry";
-}
-
-void parse( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
- {
- MIL << file_r << endl;
- RepomdParser a( file_r );
- //WAR << a._result << endl;
- }
- catch ( const Exception & )
- {
- }
-}
-
-struct Test
-{
- struct Mix
+ virtual data::RecordId consumeScript ( const data::RecordId & repository_id, const data::Script_Ptr & res_r )
{
- Mix()
- : a( 0 )
- {}
-
- void seta( int v )
- { a = v; }
-
- void setb( const string & v )
- { b = v; }
-
- int a;
- string b;
- };
-
- Test()
- : a( 0 )
- {}
-
- int a;
- string b;
- Mix c;
-};
+ return newId( res_r, ResTraits<Script>::kind );
+ }
-std::ostream & operator<<( std::ostream & str, const Test & obj )
-{
- return str << "Test(" << obj.a << '|' << obj.b
- << '|' << obj.c.a << '|' << obj.c.b << ')';
-}
+ virtual data::RecordId consumePattern ( const data::RecordId & repository_id, const data::Pattern_Ptr & res_r )
+ {
+ return newId( res_r, ResTraits<Pattern>::kind );
+ }
-struct Transform
-{
- Transform()
- : outfile( "susedu.xml", std::ios_base::out )
- {}
-
- static const bool indented = !false;
- static const bool shorttags = !true;
- std::fstream outfile;
-
- bool operator()( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- process( reader_r, true );
- break;
- case XML_READER_TYPE_END_ELEMENT:
- process( reader_r, false );
- break;
- default:
- //WAR << *reader_r << endl;
- break;
- }
- return true;
- }
-
- struct File
- {
- std::string name;
- std::string type;
-
- bool operator<( const File & rhs ) const
- { return( name < rhs.name ); }
- };
-
- struct Package
- {
- std::string pkgid;
- std::string name;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string arch;
- std::set<File> files;
- };
-
- shared_ptr<Package> pkg;
-
- void process( xml::Reader & reader_r, bool open_r )
- {
- if ( reader_r->name() == "file" )
- {
- if ( open_r )
- addFile( reader_r );
- }
- else if ( reader_r->name() == "version" )
- {
- if ( open_r )
- addVersion( reader_r );
- }
- else if ( reader_r->name() == "package" )
- {
- if ( open_r )
- startPackage( reader_r );
- else
- endPackage();
- }
- else if ( reader_r->name() == "filelists" )
- {
- DBG << *reader_r << endl;
- if ( open_r )
- {
- DBG << outfile << endl;
- outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
- outfile << "<susedu>" << endl;
- }
- else
- {
- outfile << "</susedu>" << endl;
- outfile.close();
- }
- }
- else
- {
- throw;
- }
- }
-
- void startPackage( xml::Reader & reader_r )
- {
- endPackage();
- pkg.reset( new Package );
- pkg->pkgid = reader_r->getAttribute( "pkgid" ).asString();
- pkg->name = reader_r->getAttribute( "name" ).asString();
- pkg->arch = reader_r->getAttribute( "arch" ).asString();
- }
-
- void addVersion( xml::Reader & reader_r )
- {
- pkg->epoch = reader_r->getAttribute( "epoch" ).asString();
- pkg->ver = reader_r->getAttribute( "ver" ).asString();
- pkg->rel = reader_r->getAttribute( "rel" ).asString();
- }
-
- void addFile( xml::Reader & reader_r )
- {
- File f;
- f.type = reader_r->getAttribute( "type" ).asString();
- for( reader_r.nextNode();
- reader_r->nodeType() != XML_READER_TYPE_END_ELEMENT;
- reader_r.nextNode() )
- {
- if ( reader_r->nodeType() == XML_READER_TYPE_TEXT )
- {
- f.name = reader_r->value().asString();
- }
- }
- pkg->files.insert( f );
- }
-
- void endPackage()
- {
- if ( pkg )
- {
- writePackage( outfile );
- pkg.reset();
- }
- }
-
- static std::ostream & putAttr( std::ostream & stream_r,
- const std::string & tag_r,
- const std::string & value_r )
- {
- if ( value_r.empty() || tag_r.empty() )
- return stream_r;
- return stream_r
- << str::form( " %s=\"%s\"", tag_r.c_str(), value_r.c_str() );
- }
-
- void writePackage( std::ostream & stream_r )
- {
- stream_r << " pkgid );
- putAttr( stream_r, "name", pkg->name );
- putAttr( stream_r, "arch", pkg->arch );
- stream_r << ">\n";
-
- stream_r << " epoch );
- putAttr( stream_r, "ver", pkg->ver );
- putAttr( stream_r, "rel", pkg->rel );
- stream_r << "/>\n";
-
- writePackageFiles2( stream_r );
-
- stream_r << " </package>\n";
- }
-
- void writePackageFiles( std::ostream & stream_r )
- {
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- stream_r << " type );
- stream_r << ">" << it->name << "</file>\n";
- }
- }
-
- struct Fnode
- {
- Fnode( const std::string & name_r )
- : name( name_r )
- , entry( NULL )
- {}
-
- std::string name;
- mutable const File * entry;
- mutable std::set<Fnode> children;
+ virtual data::RecordId consumeChangelog ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & )
+ { return data::RecordId(); }
- const Fnode * add( const std::string & sub_r ) const
- {
- std::set<Fnode>::iterator i = children.find( sub_r );
- if ( i != children.end() )
- return &(*i);
- return &(*(children.insert( Fnode( sub_r ) ).first));
- }
+ virtual data::RecordId consumeFilelist ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & )
+ { return data::RecordId(); }
- void dump( std::ostream & stream_r, const std::string & pname, unsigned level ) const
+ void updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r )
+ {
+ SEC << lookup( resolvable_id ) << endl;
+ INT << " " << data_r->summary.text() << endl;
+ INT << " " << data_r->summary.text( Locale("en") ) << endl;
+ if ( data_r->licenseToConfirm.locales().size() )
{
- std::string tname;
- if ( pname.empty() )
- {
- tname = name;
- }
- else if ( pname == "/" )
- {
- tname = pname+name;
- }
- else
- {
- tname = pname+"/"+name;
- }
-
- if ( children.size() == 1 )
- {
- children.begin()->dump( stream_r, tname, (indented?level:0) );
- return;
- }
-
- std::string tag;
- stream_r << std::string( level, ' ' );
-
- if ( entry )
- {
- tag = (shorttags ? "f" : "file");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "t" : "type"), entry->type );
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
- else
- {
- tag = (shorttags ? "b" : "base");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
-
- if ( children.empty() )
- {
- stream_r << "/>" << (indented?"\n":"");
- }
- else
- {
- stream_r << ">" << (indented?"\n":"");
- for ( std::set<Fnode>::const_iterator it = children.begin();
- it != children.end(); ++it )
- {
- it->dump( stream_r, "", (indented?level+1:0) );
- }
- stream_r << std::string( level, ' ' ) << "" << tag << ">" << (indented?"\n":"");
- }
+ INT << " " << data_r->licenseToConfirm.text() << endl;
+ INT << " " << data_r->licenseToConfirm.text( Locale("en") ) << endl;
+ INT << " " << data_r->licenseToConfirm.locales() << endl;
}
-
- bool operator<( const Fnode & rhs ) const
- { return( name < rhs.name ); }
- };
-
- void writePackageFiles2( std::ostream & stream_r )
- {
- Fnode root( "" );
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- std::liststd::string words;
- str::split( it->name, std::back_inserter(words), "/" );
-
- const Fnode * c = &root;
- for ( std::liststd::string::const_iterator w = words.begin();
- w != words.end(); ++w )
- {
- c = c->add( *w );
- }
- c->entry = &(*it);
- }
- root.dump( stream_r, "/", (indented?3:0) );
- }
-
+ }
};
/******************************************************************
@@ -732,51 +187,11 @@
int main( int argc, char * argv[] )
{
INT << "===[START]==========================================" << endl;
- {
- Measure x;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- xml::Reader reader( repodata/"filelists.xml" );
- Transform t;
- reader.foreachNode( ref(t) );
- }
- INT << "===[END]============================================" << endl << endl;
- return 0;
- int s;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- InputStream x ( "/Local/PATCHES/repodata" );
- parse2( repodata/"repomd.xml" );
- //parse2( repodata/"primary.xml" );
+ DummyConsumer dummy;
+ RepoParser parser( data::RecordId(), dummy );
- INT << "===[END]============================================" << endl << endl;
- return 0;
- {
- Measure x;
- for ( int i = 1; i; --i )
- {
- parse( repodata/"repomd.xml" );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
- return 0;
- {
- Measure x;
- for ( int i = 20; i; --i )
- {
- parse( (repodata/"repomd.xml").asString() );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
+ parser.parse( "REPO" );
INT << "===[END]============================================" << endl << endl;
return 0;
Modified: trunk/libzypp/devel/devel.ma/Tools.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Tools.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Tools.h (original)
+++ trunk/libzypp/devel/devel.ma/Tools.h Mon Jul 16 12:40:42 2007
@@ -17,8 +17,7 @@
#include
#include
-#include
-#include
+#include
using namespace zypp;
using zypp::debug::Measure;
@@ -91,9 +90,10 @@
}
///////////////////////////////////////////////////////////////////
-inline Source_Ref createSource( const Url & url_r, const std::string & alias_r = std::string() )
+inline Repository createSource( const Url & url_r, const std::string & alias_r = std::string() )
{
- Source_Ref ret;
+ Repository ret;
+#if 0
Measure x( "createSource: " + url_r.asString() );
try
{
@@ -109,7 +109,7 @@
}
catch ( const Exception & )
{
- return Source_Ref::noSource;
+ return Repository::noSource;
}
x.start( "parseSource: " + url_r.asString() );
{
@@ -120,10 +120,10 @@
MIL << "Content " << ret << "{" << endl;
rstats( ret.resolvables() );
MIL << "}" << endl;
-
+#endif
return ret;
}
-inline Source_Ref createSource( const std::string & url_r, const std::string & alias_r = std::string() )
+inline Repository createSource( const std::string & url_r, const std::string & alias_r = std::string() )
{
try
{
@@ -131,7 +131,7 @@
}
catch ( const Exception & )
{
- return Source_Ref::noSource;
+ return Repository::noRepository;
}
}
Modified: trunk/libzypp/doc/autodoc/Doxyfile.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/doc/autodoc/Doxyfile.cmake?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/doc/autodoc/Doxyfile.cmake (original)
+++ trunk/libzypp/doc/autodoc/Doxyfile.cmake Mon Jul 16 12:40:42 2007
@@ -196,15 +196,15 @@
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = @HAVE_DOT@
-CLASS_GRAPH = NO
+CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
-UML_LOOK = NO
+UML_LOOK = YES
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = NO
+GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = NO
DOT_IMAGE_FORMAT = png
DOT_PATH =
Modified: trunk/libzypp/libzypp.spec.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/libzypp.spec.cmake?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/libzypp.spec.cmake (original)
+++ trunk/libzypp/libzypp.spec.cmake Mon Jul 16 12:40:42 2007
@@ -106,7 +106,7 @@
%files -f zypp.lang
%defattr(-,root,root)
-%{prefix}/lib/zypp
+#%{prefix}/lib/zypp
%{prefix}/share/zypp
%{_libdir}/libzypp*so.*
%{prefix}/share/applications/package-manager.desktop
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Mon Jul 16 12:40:42 2007
@@ -1,4 +1,87 @@
-------------------------------------------------------------------
+Mon Jul 16 11:43:33 CEST 2007 - dmacvicar@suse.de
+
+- fix reading of non existant repo
+- r6015
+- first submission to stable
+- version 3.11.8
+
+-------------------------------------------------------------------
+Wed Jul 11 19:14:47 CEST 2007 - jkupec@suse.cz
+
+- make resolvable query complete exceptionless with the database
+- test that packages have some attributes
+- disable progress adaptor for now
+- revision 5977
+- version 3.11.7
+
+-------------------------------------------------------------------
+Wed Jul 11 14:37:02 CEST 2007 - ma@suse.de
+
+- fixed unresolved symbols
+- revision 5972
+- version 3.11.6
+
+-------------------------------------------------------------------
+Wed Jul 11 13:31:39 CEST 2007 - ma@suse.de
+
+- fixed TranslatedText creating unwanted entries.
+- fixed capability processing
+- revision 5964
+- version 3.11.5
+
+-------------------------------------------------------------------
+Tue Jul 10 20:01:18 CEST 2007 - jkupec@suse.cz
+
+- MediaSetAccess::release() added
+- Use attachDesiredMedia in MediaProducts
+- Progress reporting improved
+- revision 5959
+- version 3.11.4
+
+-------------------------------------------------------------------
+Tue Jul 10 14:23:13 CEST 2007 - ma@suse.de
+
+- fixed parsing translated texts.
+- added source packages.
+- revision 5947
+- version 3.11.3
+
+-------------------------------------------------------------------
+Tue Jul 10 13:11:31 CEST 2007 - jkupec@suse.cz
+
+- repo callbacks fixed
+- Fixed YUM parser progress reporting
+- Added CombinedProgressData
+- make RepoImpl::resolvables() load lazy
+- MediaProducts added for scanning products file
+- Implement cache schema versioning and automatic invalidation of
+ cache when schema changes
+- revision 5942
+- version 3.11.2
+
+-------------------------------------------------------------------
+Fri Jul 6 13:51:50 CEST 2007 - ma@suse.de
+
+- Propagate pools repository_iterator to the UI
+- revision 5911
+- version 3.11.1
+
+-------------------------------------------------------------------
+Thu Jul 5 17:02:08 CEST 2007 - ma@suse.de
+
+- Package::location is now returns an OnMediaLocation
+- archivesize() renamed to downloadSize()
+- Allow to iterate all Repositories that contribute
+ Resolvables to the Pool.
+- MediaSetAccess::provideDir added
+- remove useless url check
+- add old-api-style wrapper
+- Add MediaProducts class
+- revision 5892
+- version 3.11.0
+
+-------------------------------------------------------------------
Thu Jul 5 09:31:02 CEST 2007 - schubi@suse.de
- function isInstalledBy/installs
@@ -8,6 +91,22 @@
- Version 3.4.0
-------------------------------------------------------------------
+Tue Jul 3 13:07:31 CEST 2007 - jkupec@suse.cz
+
+- removed unused %{prefix}/lib/zypp from %files in spec file
+- revision 5870
+
+-------------------------------------------------------------------
+Tue Jul 3 10:37:37 CEST 2007 - jkupec@suse.cz
+
+- Old API (SourceManager, metadata parsers) dropped in favor of the
+ new refactored ones (RepoManager, RepoParser(s), cache subtree,
+ repo subtree).
+- Some new API improvements.
+- revision 5868
+- version 3.10.0 (bumped minor to 10 to indicate refactoring branch)
+
+-------------------------------------------------------------------
Fri Jun 22 15:28:03 CEST 2007 - schubi@suse.de
- New API calls which provides more information about one
@@ -32,7 +131,7 @@
- Evaluate ResolverInfoNeededBy for more information in the error
messages
- Enlarge detail description in the error messages
-- Revision 5807
+- Revision 5807
-------------------------------------------------------------------
Tue Jun 19 13:59:09 CEST 2007 - ma@suse.de
Modified: trunk/libzypp/tests/cache/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CMakeLists.txt (original)
+++ trunk/libzypp/tests/cache/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -11,7 +11,7 @@
TARGET_LINK_LIBRARIES(CacheQuery zypp )
ADD_TEST(CacheInitializer ${CMAKE_CURRENT_BINARY_DIR}/CacheInitializer ${CMAKE_CURRENT_SOURCE_DIR}/data )
-ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_CURRENT_SOURCE_DIR}/data )
+ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_SOURCE_DIR}/tests )
# run this test against a YUM repo
ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_SOURCE_DIR}/tests/repo/yum/data/10.2-updates-subset )
Modified: trunk/libzypp/tests/cache/CacheInitializer_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheInitializer_test.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CacheInitializer_test.cc (original)
+++ trunk/libzypp/tests/cache/CacheInitializer_test.cc Mon Jul 16 12:40:42 2007
@@ -28,16 +28,32 @@
void cacheinit_test()
{
- //unit_test_log::instance().set_log_threshold_level(log_messages);
filesystem::TmpDir tmpdir;
- cache::CacheInitializer initializer(tmpdir.path(), "test.db");
+ {
+ //unit_test_log::instance().set_log_threshold_level(log_messages);
+ cache::CacheInitializer initializer(tmpdir.path(), "test.db");
+
+ sqlite3_connection con( (tmpdir.path() + "test.db").asString().c_str());
+ //con.executenonquery(SOURCES_TABLE_SCHEMA);
+ int count = con.executeint("select count(*) from sqlite_master where type='table';");
+ BOOST_CHECK( initializer.justInitialized() );
+ BOOST_CHECK( !initializer.justReinitialized() );
+ // 14 tables need to be created
+ BOOST_CHECK( count > 0);
+ int version = con.executeint("select version from db_info;");
+ BOOST_CHECK_EQUAL( version, ZYPP_CACHE_SCHEMA_VERSION );
+ }
+
+ // now screw up the versioning and check if schema is rebuilt
+ {
+ sqlite3_connection con( (tmpdir.path() + "test.db").asString().c_str());
+ con.executenonquery("update db_info set version=9999 where 1;");
+ cache::CacheInitializer initializer(tmpdir.path(), "test.db");
+ BOOST_CHECK( !initializer.justInitialized() );
+ BOOST_CHECK( initializer.justReinitialized() );
+
+ }
- sqlite3_connection con( (tmpdir.path() + "test.db").asString().c_str());
- //con.executenonquery(SOURCES_TABLE_SCHEMA);
- int count = con.executeint("select count(*) from sqlite_master where type='table';");
- BOOST_CHECK( initializer.justInitialized() );
- // 14 tables need to be created
- BOOST_CHECK( count > 0);
}
test_suite*
Modified: trunk/libzypp/tests/cache/CacheStore_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheStore_test.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CacheStore_test.cc (original)
+++ trunk/libzypp/tests/cache/CacheStore_test.cc Mon Jul 16 12:40:42 2007
@@ -16,54 +16,335 @@
#include "zypp/cache/CacheStore.h"
#include "zypp/RepoInfo.h"
#include "zypp/repo/cached/RepoImpl.h"
+#include "zypp/parser/yum/RepoParser.h"
+#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/Url.h"
#include "zypp/NVRA.h"
#include "zypp/PathInfo.h"
#include "zypp/TmpPath.h"
+#include "zypp/TranslatedText.h"
+#include "zypp/Package.h"
+#include "zypp/Pattern.h"
+#include "zypp/Product.h"
+#include "zypp/Patch.h"
-#include "SimplePackagesParser.h"
+#include "zypp/detail/ImplConnect.h"
using namespace std;
using namespace zypp;
+using namespace zypp::parser;
using namespace zypp::repo;
using namespace zypp::repo::cached;
using namespace boost::unit_test;
+using namespace sqlite3x;
-void cache_write_test(const string &dir)
+/**
+ * \short Asserts a package against a fixed package
+ *
+ * kdelibs3 357-24 i586
+ */
+void check_kdelibs3_package( Package::Ptr p )
{
- data::RecordId repository_id;
- filesystem::TmpDir tmpdir;
+ // check authors and timestamp?
+// =Tim: 1183399094
+// +Aut:
+// The KDE Team
+// -Aut:
+//
+ BOOST_CHECK_EQUAL( p->name(), "kdelibs3");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("3.5.7", "24") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+ BOOST_CHECK_EQUAL( p->summary(), "KDE Base Libraries" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 16), "<!-- DT:Rich -->");
+ //BOOST_CHECK_EQUAL( p->packager(), "http://bugs.opensuse.org");
+ //BOOST_CHECK_EQUAL( p->url(), "http://glabels.sourceforge.net/");
+ BOOST_CHECK_EQUAL( p->group(), "System/GUI/KDE");
+ //BOOST_CHECK_EQUAL( p->buildhost(), "dale.suse.de");
+ //BOOST_CHECK_EQUAL( p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany");
+ BOOST_CHECK_EQUAL( p->license(), "BSD License and BSD-like, GNU General Public License (GPL)");
+ BOOST_CHECK_EQUAL( p->location().checksum(), CheckSum("sha1", "05f0647241433d01636785fd282cc824a6527269"));
+ BOOST_CHECK_EQUAL( p->location().filename(), Pathname("./suse/i586/kdelibs3-3.5.7-24.i586.rpm"));
+ BOOST_CHECK_EQUAL( p->size(), 38850584);
+ BOOST_CHECK_EQUAL( p->location().downloadSize(), 16356019);
+}
+
+/**
+ * \short Asserts a pattern against a fixed pattern
+ *
+ * kde-10.3-71.i586.pat
+ */
+void check_kde_pattern( Pattern::Ptr p )
+{
+ BOOST_CHECK_EQUAL( p->name(), "kde");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("10.3", "71") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+
+// detail::ResImplTraitsResObject::Impl::constPtr pipp( detail::ImplConnect::resimpl( p ) );
+// TranslatedText got = pipp->summary();
+//
+ //DBG<< pipp->summary() << endl;
+// for ( set<Locale>::const_iterator it = got.locales().begin();
+// it != got.locales().end();
+// ++it )
+// {
+// cout << *it << " | " << got.text(*it) << endl;
+// }
+
+ BOOST_CHECK_EQUAL( p->summary(), "KDE Desktop Environment" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 16), "KDE is a powerfu");
+ BOOST_CHECK_EQUAL( p->category(), "Graphical Environments");
+ BOOST_CHECK_EQUAL( p->userVisible(), true);
+ //1520
+}
+
+/**
+ * \short Asserts a product against a fixed product
+ *
+ * openSUSE-factory
+ */
+void check_factory_product( Product::Ptr p )
+{
+ BOOST_CHECK_EQUAL( p->name(), "openSUSE-factory");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("10.3") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i686") );
+
+ BOOST_CHECK_EQUAL( p->distributionName(), "SuSE-Linux-STABLE-X86" );
+ BOOST_CHECK_EQUAL( p->distributionEdition(), Edition("10.2.42-factory") );
+ BOOST_CHECK_EQUAL( p->summary(), "openSUSE FACTORY 10.3" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 16), "NO DESC?");
+// BOOST_CHECK_EQUAL( p->category(), "Graphical Environments");
+// BOOST_CHECK_EQUAL( p->userVisible(), true);
+ //1520
+}
+
+
+/**
+ * \short Asserts a package against a fixed package
+ *
+ * glabels 2.0.4-30.2-0 i586
+ */
+void check_glabels_package( Package::Ptr p )
+{
+ BOOST_CHECK_EQUAL( p->name(), "glabels");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("2.0.4", "30.2", "0") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+ BOOST_CHECK_EQUAL( p->summary(), "A Label Editing and Printing Tool" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 20), "Labels is a powerful");
+ BOOST_CHECK_EQUAL( p->packager(), "http://bugs.opensuse.org");
+ BOOST_CHECK_EQUAL( p->url(), "http://glabels.sourceforge.net/");
+ BOOST_CHECK_EQUAL( p->group(), "Productivity/Office/Other");
+ BOOST_CHECK_EQUAL( p->buildhost(), "dale.suse.de");
+ BOOST_CHECK_EQUAL( p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany");
+ BOOST_CHECK_EQUAL( p->license(), "GNU General Public License (GPL)");
+ BOOST_CHECK_EQUAL( p->location().checksum(), CheckSum("sha1", "34adf06a0c4873b9d53b4634beb8bee458b45767"));
+ BOOST_CHECK_EQUAL( p->location().filename(), Pathname("rpm/i586/glabels-2.0.4-30.2.i586.rpm"));
+ BOOST_CHECK_EQUAL( p->size(), 2257356);
+ BOOST_CHECK_EQUAL( p->location().downloadSize(), 983124);
+}
+
+/**
+ * \short assert that tables are clean after removing a repo
+ *
+ * \note the only tables allowed to keep data are normalized
+ * tables like names, files. Those should be cleaned using
+ * a more smart vacuum
+ */
+void check_tables_clean( filesystem::TmpDir tmpdir )
+{
+ cache::CacheStore store(tmpdir.path());
+ data::RecordId repository_id = store.lookupOrAppendRepository("novell.com");
+ store.cleanRepository(repository_id);
+ store.commit();
+
+ sqlite3_connection con((tmpdir.path() + "zypp.db").c_str());
+ int count;
+
+ sqlite3_command tables_cmd( con, "select name from sqlite_master where type='table';");
+ sqlite3_reader reader = tables_cmd.executereader();
+ list<string> tables;
+ while ( reader.read() )
{
- Pathname nvra_list = Pathname(dir) + "package-set.txt.gz";
- list<MiniResolvable> res_list;
+ string tablename = reader.getstring(0);
+ if (
+ (tablename == "sqlite_sequence" ) ||
+ (tablename == "db_info" ) ||
+ (tablename == "types" ) ||
+ (tablename == "names" ) ||
+ (tablename == "file_names" ) ||
+ (tablename == "dir_names" ) ||
+ (tablename == "files" )
+ )
+ continue;
+
+ tables.push_back(tablename);
+ }
+ reader.close();
+
+ for ( list<string>::const_iterator it = tables.begin();
+ it != tables.end();
+ ++it )
+ {
+ MIL << "Checking table " << *it << endl;
+ string query = (string("select count(*) from ") + (*it) +";");
+ sqlite3_command cmd(con, query.c_str());
+ count = cmd.executeint();
+ string msg = (string("there should be no ") + (*it) +" after cleaning");
+ BOOST_CHECK_MESSAGE( count == 0, msg.c_str());
+ }
+}
+
+/**
+ * \short Write a YUM repo to the cache
+ */
+void write_yum_repo( const string &alias,
+ const Pathname &repodir,
+ filesystem::TmpDir tmpdir )
+{
+ data::RecordId repository_id;
+ cache::CacheStore store(tmpdir.path());
+ repository_id = store.lookupOrAppendRepository(alias);
- parse_mini_file( nvra_list, res_list );
+ zypp::debug::Measure repo_write_timer("store resolvables");
+
+ yum::RepoParser parser( repository_id, store);
+ parser.parse(repodir);
+ store.commit();
+}
+
+/**
+ * \short Write a SUSETAGS repo to the cache
+ */
+void write_susetags_repo( const string &alias,
+ const Pathname &repodir,
+ filesystem::TmpDir tmpdir )
+{
+ data::RecordId repository_id;
+ cache::CacheStore store(tmpdir.path());
+ repository_id = store.lookupOrAppendRepository(alias);
+ zypp::debug::Measure repo_write_timer("store resolvables");
+
+ susetags::RepoParser parser( repository_id, store);
+ parser.parse(repodir);
+ store.commit();
+}
+
+/**
+ * \short get resolvables from the cache
+ */
+ResStore get_resolvables( const string &alias,
+ filesystem::TmpDir tmpdir )
+{
+ MIL << "now read resolvables" << endl;
+
+ data::RecordId repository_id;
+ {
cache::CacheStore store(tmpdir.path());
-
- repository_id = store.lookupOrAppendRepository("novell.com");
-
- zypp::debug::Measure cap_parse_timer("store resolvables");
- for ( list<MiniResolvable>::iterator it = res_list.begin(); it != res_list.end(); it++)
+ repository_id = store.lookupOrAppendRepository(alias);
+ }
+ zypp::debug::Measure repo_read_timer("read resolvables");
+ cached::RepoImpl *repositoryImpl = new cached::RepoImpl( cached::RepoOptions( RepoInfo(),
+ tmpdir.path(),
+ repository_id ));
+ return repositoryImpl->resolvables();
+}
+
+/**
+ * \short Test that a yum repo is cached and restored
+ */
+void cache_write_yum_test(const string &dir)
+{
+ data::RecordId repository_id;
+ Pathname repodir = Pathname(dir) + "/repo/yum/data/10.2-updates-subset";
+ filesystem::TmpDir tmpdir;
+ string alias = "novell.com";
+ write_yum_repo( alias, repodir, tmpdir );
+
+ ResStore dbres = get_resolvables( alias, tmpdir);;;
+ //read_resolvables( alias, tmpdir, std::inserter(dbres, dbres.end()));
+ MIL << dbres.size() << " resolvables" << endl;
+ BOOST_CHECK_EQUAL( dbres.size(), 48);
+
+ bool found_glabels_i586 = false;
+ for ( ResStore::const_iterator it = dbres.begin();
+ it != dbres.end();
+ ++it )
+ {
+ if ( isKind<Package>(*it) )
{
- data::RecordId id = store.appendResolvable( repository_id,
- ResTraits<Package>::kind,
- (*it).nvra,
- (*it).deps );
+ Package::Ptr p = asKind<Package>(*it);
+ if ( (p->name() == "glabels") && p->arch() == Arch("i586") )
+ {
+ found_glabels_i586 = true;
+ check_glabels_package(p);
+ }
}
- store.commit();
}
+ BOOST_CHECK_MESSAGE( found_glabels_i586, "Package glabels i586 should be in cache");
+
+ check_tables_clean(tmpdir);
+}
+
+/**
+ * \short Test that a susetags repo is cached and restored
+ */
+void cache_write_susetags_test(const string &dir)
+{
+ data::RecordId repository_id;
+ Pathname repodir = Pathname(dir) + "/repo/susetags/data/stable-x86-subset";
+ filesystem::TmpDir tmpdir;
+ string alias = "novell.com";
+ write_susetags_repo( alias, repodir, tmpdir );
+
+ ResStore dbres = get_resolvables( alias, tmpdir);;
+ //read_resolvables( alias, tmpdir, std::inserter(dbres, dbres.end()));
+ MIL << dbres.size() << " resolvables" << endl;
+
+ // packages and a patterns
+ BOOST_CHECK_EQUAL( dbres.size(), 7);
+ bool found_kdelibs3_i586 = false;
+ bool found_kde_pat = false;
+ bool found_factory_product = false;
+ for ( ResStore::const_iterator it = dbres.begin();
+ it != dbres.end();
+ ++it )
{
- MIL << "now read resolvables" << endl;
-
- cached::RepoImpl *repositoryImpl = new cached::RepoImpl( RepoInfo(), tmpdir.path(), repository_id);
- //RepositoryFactory factory;
- //Repository_Ref repository = factory.createFrom(repositoryImpl);
- repositoryImpl->createResolvables();
- ResStore dbres = repositoryImpl->resolvables();
-
- MIL << dbres.size() << " resolvables" << endl;
+ MIL << *it << endl;
+ if ( isKind<Package>(*it) )
+ {
+ Package::Ptr p = asKind<Package>(*it);
+ if ( (p->name() == "kdelibs3") && p->arch() == Arch("i586") )
+ {
+ BOOST_CHECK_MESSAGE( !found_kdelibs3_i586, "kdelibs3 i586 only once" );
+ found_kdelibs3_i586 = true;
+ check_kdelibs3_package(p);
+ }
+ }
+ if ( isKind<Pattern>(*it) )
+ {
+ Pattern::Ptr p = asKind<Pattern>(*it);
+ if ( (p->name() == "kde") && p->arch() == Arch("i586") )
+ {
+ BOOST_CHECK_MESSAGE( !found_kde_pat, "kde pattern only once" );
+ found_kde_pat = true;
+ check_kde_pattern(p);
+ }
+ }
+ if ( isKind<Product>(*it) )
+ {
+ Product::Ptr p = asKind<Product>(*it);
+ if ( (p->name() == "openSUSE-factory") )
+ {
+ BOOST_CHECK_MESSAGE( !found_factory_product, "factory product only once" );
+ found_factory_product = true;
+ check_factory_product(p);
+ }
+ }
}
+ BOOST_CHECK_MESSAGE( found_kdelibs3_i586, "Package kdelibs3 i586 should be in cache");
+ BOOST_CHECK_MESSAGE( found_kde_pat, "Pattern kde i586 should be in cache");
+ BOOST_CHECK_MESSAGE( found_factory_product, "Product factory i586 should be in cache");
+ check_tables_clean(tmpdir);
}
test_suite*
@@ -73,7 +354,6 @@
if (argc < 2)
{
datadir = TESTS_SRC_DIR;
- datadir = (Pathname(datadir) + "/cache/data").asString();
cout << "CacheStore_test:"
" path to directory with test data required as parameter. Using " << datadir << endl;
//return (test_suite *)0;
@@ -87,8 +367,12 @@
test_suite* test= BOOST_TEST_SUITE("CacheStore");
std::string const params[] = { datadir };
- test->add(BOOST_PARAM_TEST_CASE(&cache_write_test,
+ test->add(BOOST_PARAM_TEST_CASE(&cache_write_yum_test,
+ (std::string const*)params, params+1));
+ test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_test,
(std::string const*)params, params+1));
+ //test->add(BOOST_PARAM_TEST_CASE(&cache_write_test2,
+ // (std::string const*)params, params+1));
return test;
}
Modified: trunk/libzypp/tests/repo/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/repo/CMakeLists.txt (original)
+++ trunk/libzypp/tests/repo/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -1 +1,2 @@
-ADD_SUBDIRECTORY( yum )
\ No newline at end of file
+ADD_SUBDIRECTORY( yum )
+ADD_SUBDIRECTORY( susetags )
\ No newline at end of file
Modified: trunk/libzypp/tests/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/tests/zypp/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -17,7 +17,7 @@
TARGET_LINK_LIBRARIES(PtrTypes zypp )
ADD_EXECUTABLE(TranslatedText TranslatedText.cc)
-TARGET_LINK_LIBRARIES(TranslatedText zypp )
+TARGET_LINK_LIBRARIES(TranslatedText zypp boost_unit_test_framework)
ADD_EXECUTABLE(CheckSum CheckSum.cc)
TARGET_LINK_LIBRARIES(CheckSum zypp boost_unit_test_framework )
@@ -52,6 +52,9 @@
ADD_EXECUTABLE( RepoInfo RepoInfo_test.cc )
TARGET_LINK_LIBRARIES( RepoInfo zypp boost_unit_test_framework )
+ADD_EXECUTABLE( ProgressData ProgressData_test.cc )
+TARGET_LINK_LIBRARIES( ProgressData zypp boost_unit_test_framework )
+
ADD_TEST(ArchTest ${CMAKE_CURRENT_BINARY_DIR}/Arch)
ADD_TEST(UrlTest ${CMAKE_CURRENT_BINARY_DIR}/Url)
ADD_TEST(Edition ${CMAKE_CURRENT_BINARY_DIR}/Edition)
@@ -69,3 +72,4 @@
ADD_TEST(RepoManagerTest ${CMAKE_CURRENT_BINARY_DIR}/RepoManager ${CMAKE_CURRENT_SOURCE_DIR}/data/RepoManager)
ADD_TEST(RepoInfoTest ${CMAKE_CURRENT_BINARY_DIR}/RepoInfo ${CMAKE_CURRENT_SOURCE_DIR}/data/RepoInfo)
ADD_TEST(FetcherTest ${CMAKE_CURRENT_BINARY_DIR}/Fetcher)
+ADD_TEST(ProgressData_test ${CMAKE_CURRENT_BINARY_DIR}/ProgressData)
Modified: trunk/libzypp/tests/zypp/MediaSetAccessTest.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/MediaSetAccessTest.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/MediaSetAccessTest.cc (original)
+++ trunk/libzypp/tests/zypp/MediaSetAccessTest.cc Mon Jul 16 12:40:42 2007
@@ -11,11 +11,10 @@
using std::endl;
using std::string;
using namespace zypp;
-using namespace zypp::media;
using namespace boost::unit_test;
-class SimpleVerifier : public zypp::media::MediaVerifierBase
+class SimpleVerifier : public media::MediaVerifierBase
{
public:
@@ -127,7 +126,7 @@
// provide file from invalid media
BOOST_CHECK_THROW(setaccess.provideFile("/test.txt", 2),
- zypp::media::MediaNotDesiredException);
+ media::MediaNotDesiredException);
// provide file from media3
Pathname file3 = setaccess.provideFile("/test.txt", 3);
@@ -146,6 +145,61 @@
// provide file from media
Pathname file = setaccess.provideFile("/test.txt", 1);
BOOST_CHECK(check_file_exists(file) == true);
+
+ // provide non-existent file
+ // (default answer from callback should be ABORT)
+ BOOST_CHECK_THROW(setaccess.provideFile("/imnothere", 2),
+ media::MediaFileNotFoundException);
+}
+
+/*
+ * Provide directory from src/cd1.
+ */
+void msa_provide_dir(const string &urlstr)
+{
+ Url url(urlstr);
+ MediaSetAccess setaccess(url);
+
+ Pathname dir = setaccess.provideDir("/dir", false, 1);
+
+ Pathname file1 = dir + "/file1";
+ BOOST_CHECK(check_file_exists(file1) == true);
+
+ Pathname file2 = dir + "/file2";
+ BOOST_CHECK(check_file_exists(file2) == true);
+
+ // provide non-existent dir
+ // (default answer from callback should be ABORT)
+ BOOST_CHECK_THROW(setaccess.provideDir("/imnothere", 2),
+ media::MediaFileNotFoundException);
+
+ // This can't be properly tested with 'dir' schema, probably only curl
+ // schemas (http, ftp) where download is actually needed.
+ // Other schemas just get mounted onto a local dir and the whole subtree
+ // is automatically available that way.
+ // BOOST_CHECK(check_file_exists(dir + "/subdir/file") == false);
+ // BOOST_CHECK(check_file_exists(dir + "/subdir") == false);
+}
+
+
+/*
+ * Provide directory from src/cd1 (recursively).
+ */
+void msa_provide_dirtree(const string &urlstr)
+{
+ Url url(urlstr);
+ MediaSetAccess setaccess(url);
+
+ Pathname dir = setaccess.provideDir("/dir", true, 1);
+
+ Pathname file1 = dir + "/file1";
+ BOOST_CHECK(check_file_exists(file1) == true);
+
+ Pathname file2 = dir + "/file2";
+ BOOST_CHECK(check_file_exists(file2) == true);
+
+ Pathname file3 = dir + "/subdir/file";
+ BOOST_CHECK(check_file_exists(file3) == true);
}
@@ -153,19 +207,21 @@
*
* test data dir structure:
*
- * src1/
- * src1/cd1/
- * src1/cd1/test.txt
- * src1/cd1/.media1
- * src1/cd2/
- * src1/cd2/test.txt
- * src1/cd2/.mediabad
- * src1/cd3/
- * src1/cd3/test.txt
- * src1/cd3/.media3
- * src2
- * src2/test.txt
- * src2/.media
+ * .
+ * |-- src1
+ * | |-- cd1
+ * | | |-- dir
+ * | | | |-- file1
+ * | | | |-- file2
+ * | | | `-- subdir
+ * | | | `-- file
+ * | | `-- test.txt
+ * | |-- cd2
+ * | | `-- test.txt
+ * | `-- cd3
+ * | `-- test.txt
+ * `-- src2
+ * `-- test.txt
*
*/
@@ -175,7 +231,8 @@
if (argc < 2)
{
cout << "mediasetaccesstest:"
- " path to directory with test data required as parameter" << endl;
+ " absolute path to local directory with test data required as parameter"
+ << endl;
return (test_suite *)0;
}
@@ -201,6 +258,14 @@
test->add(BOOST_PARAM_TEST_CASE(&msa_provide_files_single,
(std::string const*)params_single, params_single+1));
+ // provide directory
+ test->add(BOOST_PARAM_TEST_CASE(&msa_provide_dir,
+ (std::string const*)params, params+1));
+
+ // provide directory tree
+ test->add(BOOST_PARAM_TEST_CASE(&msa_provide_dirtree,
+ (std::string const*)params, params+1));
+
return test;
}
Modified: trunk/libzypp/tests/zypp/RepoManager_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/RepoManager_test.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/RepoManager_test.cc (original)
+++ trunk/libzypp/tests/zypp/RepoManager_test.cc Mon Jul 16 12:40:42 2007
@@ -10,6 +10,7 @@
#include "zypp/PublicKey.h"
#include "zypp/TmpPath.h"
#include "zypp/ResStore.h"
+#include "zypp/PathInfo.h"
#include "zypp/RepoManager.h"
Modified: trunk/libzypp/tests/zypp/TranslatedText.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/TranslatedText.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/TranslatedText.cc (original)
+++ trunk/libzypp/tests/zypp/TranslatedText.cc Mon Jul 16 12:40:42 2007
@@ -12,58 +12,55 @@
#include "zypp/ZYppFactory.h"
#include "zypp/ZYpp.h"
+// Boost.Test
+#include
+#include
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
+using boost::test_tools::close_at_tolerance;
+
using namespace std;
using namespace zypp;
-int main( int argc, char * argv[] )
+void test_tt()
{
ZYpp::Ptr god;
- try {
- god = getZYpp();
- }
- catch( const Exception &e )
- {
- return 99;
- }
+ god = getZYpp();
TranslatedText testTT;
MIL << "Locale: en" << std::endl;
god->setTextLocale(Locale("en"));
testTT.setText("default");
- if ( testTT.text() != "default" )
- return 2;
+ MIL << "value: '" << testTT.text() << "'" << std::endl;
+ BOOST_CHECK_EQUAL( testTT.text(), "default" );
testTT.setText("default english", Locale("en"));
- if ( testTT.text() != "default english" )
- return 3;
+ BOOST_CHECK_EQUAL( testTT.text(), "default english" );
MIL << "Locale: es_ES" << std::endl;
god->setTextLocale(Locale("es_ES"));
- if ( testTT.text() != "default english" )
- {
- ERR << testTT.text() << std::endl;
- return 4;
- }
+ BOOST_CHECK_EQUAL( testTT.text(), "default english" );
testTT.setText("hola esto es neutro", Locale("es"));
testTT.setText("this is neutral", Locale("en"));
- if ( testTT.text() != "hola esto es neutro" )
- return 5;
+ BOOST_CHECK_EQUAL( testTT.text(), "hola esto es neutro" );
testTT.setText("hola Spain", Locale("es_ES"));
- if ( testTT.text() != "hola Spain" )
- return 6;
+ BOOST_CHECK_EQUAL( testTT.text(), "hola Spain" );
MIL << "Locale: null" << std::endl;
god->setTextLocale(Locale());
- if ( testTT.text() != "default" )
- {
- ERR << testTT.text() << std::endl;
- return 7;
- }
-
- return 0;
+ BOOST_CHECK_EQUAL( testTT.text(), "default" );
}
+
+test_suite*
+init_unit_test_suite( int, char* [] )
+{
+ test_suite* test= BOOST_TEST_SUITE( "TranslatedText" );
+ test->add( BOOST_TEST_CASE( &test_tt ), 0 /* expected zero error */ );
+ return test;
+}
\ No newline at end of file
Modified: trunk/libzypp/tools/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tools/CMakeLists.txt (original)
+++ trunk/libzypp/tools/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -1,3 +1,3 @@
-ADD_SUBDIRECTORY( registration )
+#ADD_SUBDIRECTORY( registration )
ADD_SUBDIRECTORY( package-manager )
ADD_SUBDIRECTORY( cachetools )
\ No newline at end of file
Modified: trunk/libzypp/tools/registration/zypp-query-pool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/registration/zypp-query-pool.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/tools/registration/zypp-query-pool.cc (original)
+++ trunk/libzypp/tools/registration/zypp-query-pool.cc Mon Jul 16 12:40:42 2007
@@ -5,7 +5,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -80,7 +80,7 @@
MIL << "query_pool kind '" << kind << "', repository '" << repository << "'" << endl;
- SourceManager_Ptr manager = SourceManager::sourceManager();
+ RepoManager manager;
if (!system)
{
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Mon Jul 16 12:40:42 2007
@@ -4,10 +4,6 @@
ADD_DEFINITIONS(-DLOCALEDIR=\\\"/usr/share/libzypp\\\" -DTEXTDOMAIN=\\\"zypp\\\" )
-IF(ZYPP_REFACTORING)
- ADD_DEFINITIONS(-DZYPP_REFACTORING)
-ENDIF(ZYPP_REFACTORING)
-
ADD_EXECUTABLE(mkarray ${CMAKE_SOURCE_DIR}/zypp/cache/schema/mkarray.c )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
#FILE(WRITE filename "message to write"... )
@@ -54,11 +50,6 @@
Package.cc
Pathname.cc
ProgressData.cc
- Source.cc
- SourceFactory.cc
- SourceManager.cc
- SourceCache.cc
- SourceFeed.cc
SrcPackage.cc
SysContent.cc
Target.cc
@@ -95,7 +86,7 @@
RepoInfo.cc
RepoStatus.cc
RepoManager.cc
- RepositoryFactory.cc
+ MediaProducts.cc
)
SET( zypp_HEADERS
@@ -171,11 +162,6 @@
Selection.h
Signature.h
SilentCallbacks.h
- Source.h
- SourceCache.h
- SourceFactory.h
- SourceFeed.h
- SourceManager.h
SrcPackage.h
SysContent.h
SystemResObject.h
@@ -197,7 +183,7 @@
RepoInfo.h
RepoStatus.h
RepoManager.h
- RepositoryFactory.h
+ MediaProducts.h
)
INSTALL( FILES ${zypp_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/zypp" )
@@ -222,6 +208,7 @@
)
SET( zypp_base_HEADERS
+ base/Easy.h
base/Random.h
base/Algorithm.h
base/Counter.h
@@ -433,7 +420,6 @@
parser/IniParser.cc
parser/IniDict.cc
parser/LibXMLHelper.cc
- parser/SAXParser.cc
parser/XMLNodeIterator.cc
parser/RepoFileReader.cc
)
@@ -445,7 +431,6 @@
parser/IniDict.h
parser/LibXMLHelper.h
parser/ParserProgress.h
- parser/SAXParser.h
parser/XMLNodeIterator.h
parser/xml_parser_assert.h
parser/RepoFileReader.h
@@ -481,17 +466,17 @@
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/susetags
)
-SET( zypp_parser_tagfile_SRCS
- parser/tagfile/TagFileParser.cc
+SET( zypp_parser_plaindir_SRCS
+ parser/plaindir/RepoParser.cc
)
-SET( zypp_parser_tagfile_HEADERS
- parser/tagfile/TagFileParser.h
+SET( zypp_parser_plaindir_HEADERS
+ parser/plaindir/RepoParser.h
)
INSTALL( FILES
- ${zypp_parser_tagfile_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/tagfile
+ ${zypp_parser_plaindir_HEADERS}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/plaindir
)
SET( zypp_parser_xml_SRCS
@@ -547,16 +532,6 @@
)
SET( zypp_parser_yum_SRCS
- parser/yum/YUMFileListParser.cc
- parser/yum/YUMGroupParser.cc
- parser/yum/YUMOtherParser.cc
- parser/yum/YUMParserData.cc
- parser/yum/YUMPatchParser.cc
- parser/yum/YUMPatchesParser.cc
- parser/yum/YUMPatternParser.cc
- parser/yum/YUMPrimaryParser.cc
- parser/yum/YUMProductParser.cc
- parser/yum/YUMRepomdParser.cc
parser/yum/RepoParser.cc
parser/yum/FileReaderBaseImpl.cc
parser/yum/RepomdFileReader.cc
@@ -570,17 +545,6 @@
)
SET( zypp_parser_yum_HEADERS
- parser/yum/YUMFileListParser.h
- parser/yum/YUMGroupParser.h
- parser/yum/YUMOtherParser.h
- parser/yum/YUMParser.h
- parser/yum/YUMParserData.h
- parser/yum/YUMPatchParser.h
- parser/yum/YUMPatchesParser.h
- parser/yum/YUMPatternParser.h
- parser/yum/YUMPrimaryParser.h
- parser/yum/YUMProductParser.h
- parser/yum/YUMRepomdParser.h
parser/yum/RepoParser.h
parser/yum/RepoParserOpts.h
parser/yum/FileReaderBase.h
@@ -601,11 +565,6 @@
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/yum
)
-INSTALL( FILES
- ${zypp_parser_yum2_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/yum2
-)
-
SET( zypp_pool_SRCS
pool/GetResolvablesToInsDel.cc
pool/PoolImpl.cc
@@ -704,113 +663,6 @@
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/solver/detail
)
-SET( zypp_source_SRCS
- source/Applydeltarpm.cc
- source/MediaSet.cc
- source/PackageDelta.cc
- source/PackageProvider.cc
- source/SourceImpl.cc
- source/SourceInfo.cc
- source/SourceProvideFile.cc
- source/SUSEMediaVerifier.cc
-)
-
-SET( zypp_source_HEADERS
- source/Applydeltarpm.h
- source/Builtin.h
- source/MediaSet.h
- source/PackageDelta.h
- source/PackageProvider.h
- source/SourceImpl.h
- source/SourceInfo.h
- source/SourceProvideFile.h
- source/SUSEMediaVerifier.h
-)
-
-INSTALL( FILES
- ${zypp_source_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source
-)
-
-SET( zypp_source_plaindir_SRCS
- source/plaindir/PlaindirImpl.cc
-)
-
-SET( zypp_source_plaindir_HEADERS
- source/plaindir/PlaindirImpl.h
-)
-
-INSTALL( FILES
- ${zypp_source_plaindir_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source/plaindir
-)
-
-SET( zypp_source_susetags_SRCS
- source/susetags/MediaMetadataParser.cc
- source/susetags/MediaPatchesMetadataParser.cc
- source/susetags/PackagesLangParser.cc
- source/susetags/PackagesParser.cc
- source/susetags/PatternTagFileParser.cc
- source/susetags/ProductMetadataParser.cc
- source/susetags/SelectionTagFileParser.cc
- source/susetags/SuseTagsImpl.cc
- source/susetags/SuseTagsPackageImpl.cc
- source/susetags/SuseTagsPatternImpl.cc
- source/susetags/SuseTagsProductImpl.cc
- source/susetags/SuseTagsSelectionImpl.cc
- source/susetags/SuseTagsSrcPackageImpl.cc
-)
-
-SET( zypp_source_susetags_HEADERS
- source/susetags/MediaMetadataParser.h
- source/susetags/MediaPatchesMetadataParser.h
- source/susetags/PackagesLangParser.h
- source/susetags/PackagesParser.h
- source/susetags/PatternTagFileParser.h
- source/susetags/ProductMetadataParser.h
- source/susetags/SelectionTagFileParser.h
- source/susetags/SuseTagsImpl.h
- source/susetags/SuseTagsPackageImpl.h
- source/susetags/SuseTagsPatternImpl.h
- source/susetags/SuseTagsProductImpl.h
- source/susetags/SuseTagsSelectionImpl.h
- source/susetags/SuseTagsSrcPackageImpl.h
-)
-
-INSTALL( FILES
- ${zypp_source_susetags_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source/susetags
-)
-
-SET( zypp_source_yum_SRCS
- source/yum/YUMAtomImpl.cc
- source/yum/YUMGroupImpl.cc
- source/yum/YUMMessageImpl.cc
- source/yum/YUMPackageImpl.cc
- source/yum/YUMPatchImpl.cc
- source/yum/YUMPatternImpl.cc
- source/yum/YUMProductImpl.cc
- source/yum/YUMScriptImpl.cc
- source/yum/YUMSourceImpl.cc
-)
-
-SET( zypp_source_yum_HEADERS
- source/yum/YUMAtomImpl.h
- source/yum/YUMGroupImpl.h
- source/yum/YUMMessageImpl.h
- source/yum/YUMPackageImpl.h
- source/yum/YUMPatchImpl.h
- source/yum/YUMPatternImpl.h
- source/yum/YUMProductImpl.h
- source/yum/YUMScriptImpl.h
- source/yum/YUMSourceImpl.h
-)
-
-INSTALL( FILES
- ${zypp_source_yum_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source/yum
-)
-
SET( zypp_target_SRCS
target/CommitLog.cc
target/CommitPackageCache.cc
@@ -1020,6 +872,7 @@
${CMAKE_BINARY_DIR}/zypp/sqlite-schema.h
cache/CacheInitializer.cc
cache/CacheException.cc
+ cache/Attribute.cc
cache/CacheTypes.cc
cache/ResolvableQuery.cc
cache/CacheStore.cc
@@ -1028,6 +881,8 @@
)
SET( zypp_cache_HEADERS
+ cache/Attribute.h
+ cache/CacheAttributes.h
cache/CacheTypes.h
cache/CacheInitializer.h
cache/CacheException.h
@@ -1067,6 +922,9 @@
repo/PackageProvider.cc
repo/RepoProvideFile.cc
repo/DeltaCandidates.cc
+ repo/Applydeltarpm.cc
+ repo/PackageDelta.cc
+ repo/SUSEMediaVerifier.cc
)
SET( zypp_repo_HEADERS
@@ -1076,6 +934,9 @@
repo/PackageProvider.h
repo/RepoProvideFile.h
repo/DeltaCandidates.h
+ repo/Applydeltarpm.h
+ repo/PackageDelta.h
+ repo/SUSEMediaVerifier.h
)
INSTALL( FILES
@@ -1086,6 +947,7 @@
SET( zypp_repo_cached_SRCS
repo/cached/RepoImpl.cc
repo/cached/PackageImpl.cc
+ repo/cached/SrcPackageImpl.cc
repo/cached/PatchImpl.cc
repo/cached/PatternImpl.cc
repo/cached/ProductImpl.cc
@@ -1097,6 +959,7 @@
SET( zypp_repo_cached_HEADERS
repo/cached/RepoImpl.h
repo/cached/PackageImpl.h
+ repo/cached/SrcPackageImpl.h
repo/cached/PatchImpl.h
repo/cached/PatternImpl.h
repo/cached/ProductImpl.h
@@ -1125,6 +988,8 @@
SET( zypp_repo_data_SRCS
+ repo/memory/ScriptImpl.cc
+ repo/memory/MessageImpl.cc
repo/memory/PackageImpl.cc
repo/memory/PatternImpl.cc
repo/memory/ProductImpl.cc
@@ -1150,17 +1015,12 @@
${zypp_cache_SRCS}
${zypp_cache_sqlite3x_SRCS}
${zypp_pool_SRCS}
-${zypp_parser_tagfile_SRCS}
${zypp_parser_susetags_SRCS}
-${zypp_parser_yum2_SRCS}
${zypp_parser_xmlstore_SRCS}
${zypp_parser_xml_SRCS}
${zypp_parser_yum_SRCS}
+${zypp_parser_plaindir_SRCS}
${zypp_parser_SRCS}
-${zypp_source_plaindir_SRCS}
-${zypp_source_yum_SRCS}
-${zypp_source_susetags_SRCS}
-${zypp_source_SRCS}
${zypp_data_SRCS}
${zypp_media_proxyinfo_SRCS}
${zypp_media_SRCS}
@@ -1185,12 +1045,14 @@
)
SET( zypp_lib_HEADERS
-${zypp_source_plaindir_HEADERS}
${zypp_target_store_xml_HEADERS}
+${zypp_target_rpm_HEADERS}
${zypp_parser_tagfile_HEADERS}
${zypp_parser_susetags_HEADERS}
-${zypp_target_rpm_HEADERS}
-${zypp_parser_yum2_HEADERS}
+${zypp_parser_yum_HEADERS}
+${zypp_parser_plaindir_HEADERS}
+${zypp_parser_xml_HEADERS}
+${zypp_parser_HEADERS}
${zypp_capability_HEADERS}
${zypp_cache_HEADERS}
${zypp_cache_sqlite3x_HEADERS}
@@ -1199,15 +1061,11 @@
${zypp_data_HEADERS}
${zypp_media_HEADERS}
${zypp_target_hal_HEADERS}
-${zypp_parser_xml_HEADERS}
${zypp_media_proxyinfo_HEADERS}
-${zypp_source_yum_HEADERS}
${zypp_base_HEADERS}
${zypp_solver_detail_HEADERS}
${zypp_target_store_HEADERS}
${zypp_url_HEADERS}
-${zypp_source_HEADERS}
-${zypp_parser_HEADERS}
${zypp_HEADERS}
${zypp_zypp_detail_HEADERS}
${zypp_thread_HEADERS}
@@ -1215,7 +1073,6 @@
${zypp_source_susetags_HEADERS}
${zypp_target_modalias_HEADERS}
${zypp_target_HEADERS}
-${zypp_parser_yum_HEADERS}
${zypp_detail_HEADERS}
${zypp_pool_HEADERS}
)
@@ -1235,9 +1092,7 @@
SET_LOGGROUP( "zypp" ${zypp_lib_SRCS} )
# override some defaults
-SET_LOGGROUP( "plaindir" ${zypp_source_plaindir_SRCS} )
SET_LOGGROUP( "xmlstore" ${zypp_target_store_xml_SRCS} )
-SET_LOGGROUP( "tagfile" ${zypp_parser_tagfile_SRCS} )
#SET_LOGGROUP( "group" ${zypp_target_rpm_SRCS} )
#SET_LOGGROUP( "group" ${zypp_parser_yum2_SRCS} )
#SET_LOGGROUP( "group" ${zypp_capability_SRCS} )
Modified: trunk/libzypp/zypp/CapFilters.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CapFilters.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/CapFilters.h (original)
+++ trunk/libzypp/zypp/CapFilters.h Mon Jul 16 12:40:42 2007
@@ -14,6 +14,7 @@
#include "zypp/base/Functional.h"
#include "zypp/Capability.h"
+#include "zypp/ResObject.h"
///////////////////////////////////////////////////////////////////
namespace zypp
Modified: trunk/libzypp/zypp/Fetcher.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Fetcher.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Fetcher.cc (original)
+++ trunk/libzypp/zypp/Fetcher.cc Mon Jul 16 12:40:42 2007
@@ -96,12 +96,21 @@
_resources.clear();
_caches.clear();
}
-
+
void Fetcher::Impl::addCachePath( const Pathname &cache_dir )
{
- _caches.push_back(cache_dir);
+ PathInfo info(cache_dir);
+ if ( info.isDir() )
+ {
+ _caches.push_back(cache_dir);
+ }
+ else
+ {
+ // don't add bad cache directory, just log the error
+ ERR << "Not adding cache: '" << cache_dir << "'. Not a direcotry." << endl;
+ }
}
-
+
void Fetcher::Impl::start( const Pathname &dest_dir,
MediaSetAccess &media,
const ProgressData::ReceiverFnc & progress_receiver )
@@ -114,54 +123,37 @@
bool got_from_cache = false;
for ( list<Pathname>::const_iterator it_cache = _caches.begin(); it_cache != _caches.end(); ++it_cache )
{
- // Pathinfos could be cached to avoid too many stats?
- PathInfo info(*it_cache);
- if ( info.isDir() )
+ // does the current file exists in the current cache?
+ Pathname cached_file = *it_cache + (*it_res).location.filename();
+ if ( PathInfo( cached_file ).isExist() )
{
- // does the current file exists in the current cache?
- Pathname cached_file = *it_cache + (*it_res).location.filename();
- if ( PathInfo( cached_file ).isExist() )
+ // check the checksum
+ if ( is_checksum( cached_file, (*it_res).location.checksum() ) )
{
- // check the checksum
- if ( is_checksum( cached_file, (*it_res).location.checksum() ) )
- {
- // cached
- MIL << "file " << (*it_res).location.filename() << " found in previous cache. Using cached copy." << endl;
- // checksum is already checked.
- // we could later implement double failover and try to download if file copy fails.
-
- // replicate the complete path in the target directory
- Pathname dest_full_path = dest_dir + (*it_res).location.filename();
- if ( assert_dir( dest_full_path.dirname() ) != 0 )
- ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
-
- if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
- { //copy_file2dir
- //ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
- ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
- // try next cache
- continue;
- }
-
- got_from_cache = true;
- break;
+ // cached
+ MIL << "file " << (*it_res).location.filename() << " found in previous cache. Using cached copy." << endl;
+ // checksum is already checked.
+ // we could later implement double failover and try to download if file copy fails.
+
+ // replicate the complete path in the target directory
+ Pathname dest_full_path = dest_dir + (*it_res).location.filename();
+ if ( assert_dir( dest_full_path.dirname() ) != 0 )
+ ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
+
+ if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
+ { //copy_file2dir
+ //ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
+ ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
+ // try next cache
+ continue;
}
+
+ got_from_cache = true;
+ break;
}
- else
- {
- // File exists in cache but with a different checksum
- // so just try next cache
- continue;
- }
- }
- else
- {
- // skip bad cache directory and try with next one
- ERR << "Skipping cache : " << *it_cache << endl;
- continue;
}
}
-
+
if ( ! got_from_cache )
{
// try to get the file from the net
@@ -190,27 +182,27 @@
// continue with next file
continue;
}
-
+
// no matter where did we got the file, try to validate it:
- Pathname localfile = dest_dir + (*it_res).location.filename();
- // call the checker function
- try {
- (*it_res).checkers(localfile);
- }
- catch ( const FileCheckException &e )
- {
- ZYPP_RETHROW(e);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
- catch (...)
- {
- ZYPP_THROW(Exception("Unknown error while validating " + (*it_res).location.filename().asString()));
- }
+ Pathname localfile = dest_dir + (*it_res).location.filename();
+ // call the checker function
+ try {
+ (*it_res).checkers(localfile);
+ }
+ catch ( const FileCheckException &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+ catch ( const Exception &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+ catch (...)
+ {
+ ZYPP_THROW(Exception("Unknown error while validating " + (*it_res).location.filename().asString()));
+ }
- if ( ! progress.incr() )
+ if ( ! progress.incr() )
ZYPP_THROW(AbortRequestException());
} // for each job
}
Modified: trunk/libzypp/zypp/FileChecker.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/FileChecker.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/FileChecker.h (original)
+++ trunk/libzypp/zypp/FileChecker.h Mon Jul 16 12:40:42 2007
@@ -16,7 +16,7 @@
#include <list>
#include "zypp/base/Exception.h"
#include "zypp/base/Function.h"
-#include "zypp/Pathname.h"
+#include "zypp/PathInfo.h"
#include "zypp/CheckSum.h"
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/KeyRing.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/KeyRing.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/KeyRing.cc (original)
+++ trunk/libzypp/zypp/KeyRing.cc Mon Jul 16 12:40:42 2007
@@ -21,7 +21,7 @@
#include "zypp/base/Logger.h"
#include "zypp/base/IOStream.h"
#include "zypp/base/String.h"
-#include "zypp/Pathname.h"
+#include "zypp/PathInfo.h"
#include "zypp/KeyRing.h"
#include "zypp/ExternalProgram.h"
#include "zypp/TmpPath.h"
Modified: trunk/libzypp/zypp/MediaSetAccess.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/MediaSetAccess.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/MediaSetAccess.cc (original)
+++ trunk/libzypp/zypp/MediaSetAccess.cc Mon Jul 16 12:40:42 2007
@@ -11,6 +11,7 @@
#include <fstream>
#include "zypp/base/LogTools.h"
+#include "zypp/base/UserRequestException.h"
#include "zypp/ZYppCallbacks.h"
#include "zypp/MediaSetAccess.h"
#include "zypp/PathInfo.h"
@@ -21,6 +22,9 @@
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+IMPL_PTR_TYPE(MediaSetAccess);
+
///////////////////////////////////////////////////////////////////
MediaSetAccess::MediaSetAccess(const Url &url,
@@ -37,6 +41,8 @@
MediaSetAccess::~MediaSetAccess()
{
+#warning TODO call release() here once MediaSetAccess is passed as param in PackageProvider. MediaSetAccess will become like a ManagedFile object.
+ //! \todo call release() here once MediaSetAccess is passed as param in PackageProvider. MediaSetAccess will become like a ManagedFile object.
}
@@ -91,20 +97,20 @@
media::MediaAccessId media = getMediaAccessId( media_nr);
bool exists = false;
-
+
do
{
try
{
DBG << "Cheking if file " << file
- << " from media number " << media_nr << " exists." << endl;
+ << " from media number " << media_nr << " exists." << endl;
// try to attach the media
if ( ! media_mgr.isAttached(media) )
media_mgr.attachDesiredMedia(media);
exists = media_mgr.doesFileExist(media, file);
break;
}
- catch ( Exception & excp )
+ catch ( media::MediaException & excp )
{
ZYPP_CAUGHT(excp);
media::MediaChangeReport::Action user;
@@ -123,7 +129,7 @@
// set up the reason
media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
-
+
if( typeid(excp) == typeid( media::MediaFileNotFoundException ) ||
typeid(excp) == typeid( media::MediaNotAFileException ) )
{
@@ -146,7 +152,7 @@
else if ( user == media::MediaChangeReport::IGNORE )
{
DBG << "Skipping" << endl;
- ZYPP_THROW ( source::SkipRequestedException("User-requested skipping of a file") );
+ ZYPP_THROW ( SkipRequestException("User-requested skipping of a file") );
}
else if ( user == media::MediaChangeReport::EJECT )
{
@@ -199,14 +205,14 @@
try
{
DBG << "Going to try to provide file " << file
- << " from media number " << media_nr << endl;
+ << " from media number " << media_nr << endl;
// try to attach the media
if ( ! media_mgr.isAttached(media) )
media_mgr.attachDesiredMedia(media);
media_mgr.provideFile (media, file, false, false);
break;
}
- catch ( Exception & excp )
+ catch ( media::MediaException & excp )
{
ZYPP_CAUGHT(excp);
media::MediaChangeReport::Action user;
@@ -222,7 +228,7 @@
ZYPP_CAUGHT(excpt_r);
MIL << "Failed to release media " << media << endl;
}
-
+
/*MIL << "Releasing all _medias of all sources" << endl;
try
{
@@ -236,7 +242,7 @@
// set up the reason
media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
-
+
if( typeid(excp) == typeid( media::MediaFileNotFoundException ) ||
typeid(excp) == typeid( media::MediaNotAFileException ) )
{
@@ -250,7 +256,7 @@
user = checkonly ? media::MediaChangeReport::ABORT :
report->requestMedia (
- Source_Ref::noSource,
+ Repository::noRepository,
media_nr,
reason,
excp.asUserString()
@@ -266,7 +272,7 @@
else if ( user == media::MediaChangeReport::IGNORE )
{
DBG << "Skipping" << endl;
- ZYPP_THROW ( source::SkipRequestedException("User-requested skipping of a file") );
+ ZYPP_THROW ( SkipRequestException("User-requested skipping of a file") );
}
else if ( user == media::MediaChangeReport::EJECT )
{
@@ -307,6 +313,136 @@
return media_mgr.localPath( media, file );
}
+
+ Pathname MediaSetAccess::provideDir(const Pathname & dir,
+ bool recursive,
+ unsigned media_nr)
+ {
+ callback::SendReportmedia::MediaChangeReport report;
+ media::MediaManager media_mgr;
+
+ // get the mediaId, but don't try to attach it here
+ media::MediaAccessId _media = getMediaAccessId(media_nr);
+ do
+ {
+ try
+ {
+ DBG << "Going to try provide direcotry " << dir
+ << (recursive ? " (recursively)" : "")
+ << " from media nr. " << media_nr << endl;
+
+ // try to attach the media
+ if (!media_mgr.isAttached(_media))
+ media_mgr.attachDesiredMedia(_media);
+
+ _media = getMediaAccessId(media_nr); // in case of redirect
+
+ if (recursive)
+ media_mgr.provideDirTree(_media, dir);
+ else
+ media_mgr.provideDir(_media, dir);
+
+ break; // quit the retry loop
+ }
+ catch (media::MediaException & excp)
+ {
+ ZYPP_CAUGHT(excp);
+ media::MediaChangeReport::Action user;
+
+ do
+ {
+ DBG << "Media couldn't provide dir " << dir << ", releasing." << endl;
+ try
+ {
+ media_mgr.release (_media, false);
+ }
+ catch (const Exception & excpt_r)
+ {
+ ZYPP_CAUGHT(excpt_r);
+ ERR << "Failed to release media " << _media << endl;
+ }
+
+ //MIL << "Releasing all medias of all sources" << endl;
+ try
+ {
+ //! \todo do we need replacement for this at all?
+ //zypp::SourceManager::sourceManager()->releaseAllSources();
+ }
+ catch (const zypp::Exception& excpt_r)
+ {
+ ZYPP_CAUGHT(excpt_r);
+ ERR << "Failed to release all sources" << endl;
+ }
+
+ // set up the reason
+ media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
+
+ if (typeid(excp) == typeid(media::MediaFileNotFoundException)
+ || typeid(excp) == typeid(media::MediaNotAFileException))
+ {
+ reason = media::MediaChangeReport::NOT_FOUND;
+ }
+ else if (typeid(excp) == typeid( media::MediaNotDesiredException)
+ || typeid(excp) == typeid(media::MediaNotAttachedException))
+ {
+ reason = media::MediaChangeReport::WRONG;
+ }
+
+ user = report->requestMedia(Repository::noRepository,
+ media_nr,
+ reason,
+ excp.asUserString());
+
+ DBG << "ProvideFile exception caught, callback answer: " << user << endl;
+
+ if (user == media::MediaChangeReport::ABORT)
+ {
+ DBG << "Aborting" << endl;
+ ZYPP_RETHROW ( excp );
+ }
+ else if (user == media::MediaChangeReport::EJECT)
+ {
+ DBG << "Eject: try to release" << endl;
+ try
+ {
+ //! \todo do we need replacement for this at all?
+ // zypp::SourceManager::sourceManager()->releaseAllSources();
+ }
+ catch (const zypp::Exception& excpt_r)
+ {
+ ZYPP_CAUGHT(excpt_r);
+ ERR << "Failed to release all sources" << endl;
+ }
+ media_mgr.release (_media, true); // one more release needed for eject
+ // FIXME: this will not work, probably
+ }
+ else if (user == media::MediaChangeReport::RETRY ||
+ user == media::MediaChangeReport::CHANGE_URL)
+ {
+ // retry
+ DBG << "Going to try again" << endl;
+
+ // not attaching, media set will do that for us
+ // this could generate uncaught exception (#158620)
+
+ break;
+ }
+ else
+ {
+ DBG << "Don't know, let's ABORT" << endl;
+
+ ZYPP_RETHROW (excp);
+ }
+ }
+ while (user == media::MediaChangeReport::EJECT);
+ }
+ // retry or change URL
+ }
+ while (true);
+
+ return media_mgr.localPath(_media, dir);
+ }
+
media::MediaAccessId MediaSetAccess::getMediaAccessId (media::MediaNr medianr)
{
media::MediaManager media_mgr;
@@ -343,7 +479,7 @@
ZYPP_CAUGHT(e);
WAR << "Verifier not found" << endl;
}
-
+
return id;
}
@@ -390,6 +526,14 @@
return url_r;
}
+ void MediaSetAccess::release()
+ {
+ DBG << "Releasing all media IDs held by this MediaSetAccess" << endl;
+ media::MediaManager manager;
+ for (MediaMap::const_iterator m = _medias.begin(); m != _medias.end(); ++m)
+ manager.release(m->second);
+ }
+
std::ostream & MediaSetAccess::dumpOn( std::ostream & str ) const
{
str << "MediaSetAccess (URL='" << _url << "', attach_point_hint='" << _prefAttachPoint << "')";
Modified: trunk/libzypp/zypp/MediaSetAccess.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/MediaSetAccess.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/MediaSetAccess.h (original)
+++ trunk/libzypp/zypp/MediaSetAccess.h Mon Jul 16 12:40:42 2007
@@ -92,16 +92,43 @@
* Sets a \ref MediaVerifier verifier for given media number.
*/
void setVerifier( unsigned media_nr, media::MediaVerifierRef verifier );
-
+
/**
* Provides a file from a media location.
+ *
+ * \param on_media_file location of the file on media
+ * \return local pathname of the requested file
+ *
+ * \throws MediaException if a problem occurs,
+ * see \ref media::MediaManager::provideFile()
*/
Pathname provideFile( const OnMediaLocation & on_media_file );
/**
- * Provides \a file from media \a media_nr.
+ * Provides \a file from media \a media_nr.
+ *
+ * \param file path to the file relative to media URL
+ * \param media_nr the media number in the media set
+ * \return local pathname of the requested file
+ *
+ * \throws MediaException if a problem occurs,
+ * see \ref media::MediaManager::provideFile()
*/
Pathname provideFile(const Pathname & file, unsigned media_nr = 1 );
+
+ /**
+ * Provides direcotry \a dir from media number \a media_nr.
+ *
+ * \param dir path to the directory relative to media URL
+ * \param recursive whether to provide the whole directory subtree
+ * \param media_nr the media number in the media set
+ * \return local pathname of the requested directory
+ *
+ * \throws MediaException if a problem occurs,
+ * see \ref media::MediaManager::provideDir()
+ * and \ref media::MediaManager::provideDirTree()
+ */
+ Pathname provideDir(const Pathname & dir, bool recursive, unsigned media_nr = 1);
/**
* check if a file exists on the specified media
@@ -112,6 +139,13 @@
bool doesFileExist(const Pathname & file, unsigned media_nr = 1 );
/**
+ * Release all attached media of this set.
+ *
+ * \throws MediaNotOpenException for invalid access IDs.
+ */
+ void release();
+
+ /**
* Replaces media number in specified url with given \a medianr.
*
* Media number in the URL is searched for with regex
Modified: trunk/libzypp/zypp/OnMediaLocation.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/OnMediaLocation.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/OnMediaLocation.cc (original)
+++ trunk/libzypp/zypp/OnMediaLocation.cc Mon Jul 16 12:40:42 2007
@@ -28,7 +28,7 @@
std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj )
{
return str << "[" << obj.medianr() << "]" << obj.filename()
- << "{" << obj.downloadsize() << "|" << obj.checksum() << "}";
+ << "{" << obj.downloadSize() << "|" << obj.checksum() << "}";
}
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/OnMediaLocation.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/OnMediaLocation.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/OnMediaLocation.h (original)
+++ trunk/libzypp/zypp/OnMediaLocation.h Mon Jul 16 12:40:42 2007
@@ -26,7 +26,7 @@
//
// CLASS NAME : OnMediaLocation
//
- /**
+ /**
* Describes a path ona certain media amongs as the information
* required to download it, like its media number, checksum and
* size.
@@ -43,22 +43,27 @@
{}
public:
- unsigned medianr() const { return _medianr; }
- const Pathname & filename() const { return _filename; }
- const CheckSum & checksum() const { return _checksum; }
- const ByteCount & downloadsize() const { return _downloadsize; }
+ unsigned medianr() const { return _medianr; }
+ 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; }
public:
- OnMediaLocation & medianr( unsigned val_r ) { _medianr = val_r; return *this; }
- OnMediaLocation & filename( const Pathname & val_r ) { _filename = val_r; return *this; }
- OnMediaLocation & checksum( const CheckSum & val_r ) { _checksum = val_r; return *this; }
- OnMediaLocation & downloadsize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; }
-
+ 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; }
private:
unsigned _medianr;
Pathname _filename;
CheckSum _checksum;
ByteCount _downloadsize;
+ ByteCount _opendownloadsize;
+ CheckSum _openchecksum;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/Package.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Package.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Package.cc (original)
+++ trunk/libzypp/zypp/Package.cc Mon Jul 16 12:40:42 2007
@@ -10,7 +10,6 @@
*
*/
#include "zypp/Package.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/base/Exception.h"
using namespace std;
@@ -51,9 +50,6 @@
std::string Package::buildhost() const
{ return pimpl().buildhost(); }
- CheckSum Package::checksum() const
- { return pimpl().checksum(); }
-
/** */
std::string Package::distribution() const
{ return pimpl().distribution(); }
@@ -113,9 +109,9 @@
std::liststd::string Package::filenames() const
{ return pimpl().filenames(); }
- Pathname Package::location() const
+ OnMediaLocation Package::location() const
{ return pimpl().location(); }
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/Package.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Package.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Package.h (original)
+++ trunk/libzypp/zypp/Package.h Mon Jul 16 12:40:42 2007
@@ -40,10 +40,7 @@
typedef std::set<PackageKeyword> Keywords;
public:
- /**
- * Checksum the source says this package should have
- */
- CheckSum checksum() const;
+
/** Get the package change log */
Changelog changelog() const;
/** */
@@ -80,10 +77,19 @@
/** Disk usage per directory */
DiskUsage diskusage() const;
-
- /** location in source */
- Pathname location() const;
-
+
+ /**
+ * Checksum the source says this package should have
+ * \deprecated Use location().checksum()
+ */
+ ZYPP_DEPRECATED CheckSum checksum() const
+ { return location().checksum(); }
+
+ /**
+ * \short Location of the resolvable in the repository
+ */
+ OnMediaLocation location() const;
+
protected:
Package( const NVRAD & nvrad_r );
/** Dtor */
Modified: trunk/libzypp/zypp/Pathname.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Pathname.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Pathname.cc (original)
+++ trunk/libzypp/zypp/Pathname.cc Mon Jul 16 12:40:42 2007
@@ -12,6 +12,7 @@
#include <iostream>
#include "zypp/Pathname.h"
+#include "zypp/Url.h"
using std::string;
@@ -229,6 +230,18 @@
///////////////////////////////////////////////////////////////////
//
+ // METHOD NAME : Pathname::asUrl
+ // METHOD TYPE : Url
+ //
+ Url Pathname::asUrl() const
+ {
+ Url ret( "dir:///" );
+ ret.setPathName( asString() );
+ return ret;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
// METHOD NAME : Pathname::extension
// METHOD TYPE : string
//
Modified: trunk/libzypp/zypp/Pathname.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Pathname.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Pathname.h (original)
+++ trunk/libzypp/zypp/Pathname.h Mon Jul 16 12:40:42 2007
@@ -18,6 +18,9 @@
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+ class Url;
+
///////////////////////////////////////////////////////////////////
namespace filesystem
{ /////////////////////////////////////////////////////////////////
@@ -77,6 +80,9 @@
const std::string & asString() const
{ return name_t; }
+ /** Url representation using \c dir schema. */
+ Url asUrl() const;
+
/** String representation. */
const char * c_str() const
{ return name_t.c_str(); }
Modified: trunk/libzypp/zypp/ProgressData.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ProgressData.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ProgressData.cc (original)
+++ trunk/libzypp/zypp/ProgressData.cc Mon Jul 16 12:40:42 2007
@@ -32,10 +32,6 @@
//
bool ProgressData::report()
{
- // DISABLED to get DBG output from 'if ( doReport )'
- //if ( ! _d->_receiver )
- // return true;
-
bool goOn = true; // continue per default
bool doReport = false;
@@ -75,13 +71,20 @@
if ( _d->_receiver )
{
- goOn = _d->_receiver( _d->_last_val );
+ goOn = _d->_receiver( *this );
}
else
{
- DBG << str::form( "{#%u|%s}(%lld%s)",
- numericId(), name().c_str(),
- _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl;
+ if ( _d->_state != END )
+ {
+ DBG << str::form( "{#%u|%s}(%lld%s)",
+ numericId(), name().c_str(),
+ _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl;
+ }
+ else
+ {
+ DBG << str::form( "{#%u|%s}END", numericId(), name().c_str() ) << endl;
+ }
}
}
@@ -128,6 +131,30 @@
return ret;
}
+ CombinedProgressData::CombinedProgressData( ProgressData &pd,
+ ProgressData::value_type weight )
+ : _weight(weight),
+ _last_value(0),
+ _pd(pd)
+ {
+
+ }
+
+ bool CombinedProgressData::operator()( const ProgressData &progress )
+ {
+ if ( progress.reportAlive() || ( _weight == 0 ) )
+ return _pd.tick();
+
+ // factor [0,1] of increase in subtask ( ie: before 0,2 now 0.5 )
+ float increment = ((float)(progress.val() - _last_value))/(progress.max() - progress.min());
+ // how much the subtask affects the parent task ie: 0,1
+ float parent_factor = (float)(_weight)/(_pd.max() - _pd.min());
+ // real increment of the parent task
+ float real_increment = parent_factor*increment;
+ _last_value = progress.val();
+ return _pd.incr( (int)( (_pd.max()-_pd.min()) * real_increment) );
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/ProgressData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ProgressData.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ProgressData.h (original)
+++ trunk/libzypp/zypp/ProgressData.h Mon Jul 16 12:40:42 2007
@@ -136,10 +136,12 @@
{
public:
typedef long long value_type;
- /** Most simple version of progress reporting - a single value.
+ /** Most simple version of progress reporting
* The percentage in most cases. Sometimes just keepalive.
+ * \p sender ProgressData object who sends the progress info
+ * \p
*/
- typedef function ReceiverFnc;
+ typedef function ReceiverFnc;
private:
enum State { INIT, RUN, END };
@@ -275,6 +277,9 @@
//@}
public:
+ /** \name Progress receiving.
+ */
+ //@{
/** @return Current \c min value. */
value_type min() const
{ return _d->_min; }
@@ -291,6 +296,26 @@
bool hasRange() const
{ return min() != max(); }
+ /** @return Wheter \ref reportValue will return a percent value.
+ * Same as \ref hasRange.
+ * \see \ref reportAlive
+ */
+ bool reportPercent() const
+ { return hasRange(); }
+
+ /** @return Wheter \ref reportValue always returns -1, because we
+ * trigger 'still alive' messages. I.e. \ref hasrange is \c false.
+ * \see \ref reportPercent
+ */
+ bool reportAlive() const
+ { return ! hasRange(); }
+
+ /** @return Either a a percent value or -1.
+ * \see \ref reportPercent and \ref reportAlive.
+ */
+ value_type reportValue() const
+ { return hasRange() ? val() * 100 / ( max() - min() ) : -1; }
+
/** @return The counters name. */
const std::string & name() const
{ return _d->_name; }
@@ -299,6 +324,14 @@
const ReceiverFnc & receiver() const
{ return _d->_receiver; }
+ /** @return Retrun \c true if this the final report sent by the
+ * ProgressData dtor.
+ */
+ bool finalReport() const
+ { return( _d->_state == END ); }
+
+ //@}
+
private:
/** Send report if necessary. */
bool report();
@@ -317,6 +350,72 @@
/** \relates ProgressData Setup from \ref InputStream. */
ProgressData makeProgressData( const InputStream & input_r );
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * \short Progress callback from another progress
+ *
+ * This class allows you to pass a progress callback to a
+ * subtask based on a current progress data, plus a weight
+ * value. Every progress reported by the subtask via
+ * this callback will be forwarded to the main progress
+ * data, with the corresponding weight.
+ *
+ * Example:
+ *
+ * \code
+ *
+ * // receiver for main task
+ * void task_receiver( ProgressData &progress );
+ *
+ * // subtask prototypes
+ * void do_subtask_one( ProgressData::ReceiverFnc &fnc );
+ * void do_subtask_two( ProgressData::ReceiverFnc &fnc );
+ *
+ * // main task
+ * ProgressData progress;
+ * //progress for subtask 1
+ * // which is 80%
+ * CombinedProgressData sub1(pd, 80);
+ * // the second is only 20%
+ * CombinedProgressData sub2(pd, 20);
+ * do_subtask_one( sub1 );
+ * do_subtask_two( sub2 );
+ *
+ * \endcode
+ */
+ class CombinedProgressData
+ {
+ public:
+ /**
+ * \short Ctor
+ *
+ * Creates a \ref ProgressData::ReceiverFnc
+ * from a \ref ProgressData object
+ *
+ * \param pd \ref ProgressData object
+ * \param weight Weight of the subtask
+ * relative to the main task range.
+ *
+ * If weight is 0, or \param pd only reports
+ * keepalives. then only ticks are sent.
+ *
+ */
+ CombinedProgressData( ProgressData &pd,
+ ProgressData::value_type weight = 0 );
+
+ /**
+ * Implements the \ref ProgressData::ReceiverFnc
+ * callback interface
+ */
+ bool operator()( const ProgressData &progress );
+
+ private:
+ ProgressData::value_type _weight;
+ ProgressData::value_type _last_value;
+ ProgressData &_pd;
+ };
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/RepoInfo.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoInfo.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoInfo.cc (original)
+++ trunk/libzypp/zypp/RepoInfo.cc Mon Jul 16 12:40:42 2007
@@ -28,13 +28,13 @@
/** RepoInfo implementation. */
struct RepoInfo::Impl
{
-
+
Impl()
: enabled (indeterminate),
autorefresh(indeterminate),
type(repo::RepoType::NONE_e)
{}
-
+
~Impl()
{
//MIL << std::endl;
@@ -42,9 +42,12 @@
public:
boost::tribool enabled;
boost::tribool autorefresh;
+ boost::tribool gpgcheck;
+ Url gpgkey_url;
repo::RepoType type;
Url mirrorlist_url;
std::set<Url> baseUrls;
+ Pathname path;
std::string alias;
std::string name;
Pathname filepath;
@@ -89,8 +92,6 @@
//MIL << std::endl;
}
-
-
RepoInfo & RepoInfo::setEnabled( boost::tribool enabled )
{
_pimpl->enabled = enabled;
@@ -102,12 +103,24 @@
_pimpl->autorefresh = autorefresh;
return *this;
}
+
+ RepoInfo & RepoInfo::setGpgCheck( boost::tribool check )
+ {
+ _pimpl->gpgcheck = check;
+ return *this;
+ }
RepoInfo & RepoInfo::setMirrorListUrl( const Url &url )
{
_pimpl->mirrorlist_url = url;
return *this;
}
+
+ RepoInfo & RepoInfo::setGpgKeyUrl( const Url &url )
+ {
+ _pimpl->gpgkey_url = url;
+ return *this;
+ }
RepoInfo & RepoInfo::addBaseUrl( const Url &url )
{
@@ -115,6 +128,19 @@
return *this;
}
+ RepoInfo & RepoInfo::setBaseUrl( const Url &url )
+ {
+ _pimpl->baseUrls.clear();
+ addBaseUrl(url);
+ return *this;
+ }
+
+ RepoInfo & RepoInfo::setPath( const Pathname &path )
+ {
+ _pimpl->path = path;
+ return *this;
+ }
+
RepoInfo & RepoInfo::setAlias( const std::string &alias )
{
_pimpl->alias = alias;
@@ -138,12 +164,15 @@
_pimpl->filepath = filepath;
return *this;
}
-
+
tribool RepoInfo::enabled() const
{ return _pimpl->enabled; }
tribool RepoInfo::autorefresh() const
{ return _pimpl->autorefresh; }
+
+ tribool RepoInfo::gpgCheck() const
+ { return _pimpl->gpgcheck; }
std::string RepoInfo::alias() const
{ return _pimpl->alias; }
@@ -153,22 +182,34 @@
Pathname RepoInfo::filepath() const
{ return _pimpl->filepath; }
-
+
repo::RepoType RepoInfo::type() const
{ return _pimpl->type; }
Url RepoInfo::mirrorListUrl() const
{ return _pimpl->mirrorlist_url; }
+
+ Url RepoInfo::gpgKeyUrl() const
+ { return _pimpl->gpgkey_url; }
std::set<Url> RepoInfo::baseUrls() const
{ return _pimpl->baseUrls; }
-
+
+ Pathname RepoInfo::path() const
+ { return _pimpl->path; }
+
RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const
{ return _pimpl->baseUrls.begin(); }
-
+
RepoInfo::urls_const_iterator RepoInfo::baseUrlsEnd() const
{ return _pimpl->baseUrls.end(); }
-
+
+ RepoInfo::urls_size_type RepoInfo::baseUrlsSize() const
+ { return _pimpl->baseUrls.size(); }
+
+ bool RepoInfo::baseUrlsEmpty() const
+ { return _pimpl->baseUrls.empty(); }
+
std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
{
str << "--------------------------------------" << std::endl;
@@ -180,11 +221,14 @@
{
str << "- url : " << *it << std::endl;
}
-
+ str << "- path : " << path() << std::endl;
str << "- type : " << type() << std::endl;
str << "- enabled : " << enabled() << std::endl;
+
str << "- autorefresh : " << autorefresh() << std::endl;
- //str << "- path : " << path() << std::endl;
+ str << "- gpgcheck : " << gpgCheck() << std::endl;
+ str << "- gpgkey : " << gpgKeyUrl() << std::endl;
+
return str;
}
@@ -201,9 +245,24 @@
{
str << *it << endl;
}
- str << "mirrorlist=" << mirrorListUrl() << endl;
+
+ if ( ! path().empty() )
+ str << "path="<< path() << endl;
+
+ if ( ! (mirrorListUrl().asString().empty()) )
+ str << "mirrorlist=" << mirrorListUrl() << endl;
+
str << "type=" << type().asString() << endl;
- str << "enabled=" << (enabled() ? "1" : "0") << endl;
+
+ if ( enabled() != indeterminate )
+ str << "enabled=" << (enabled() ? "1" : "0") << endl;
+ if ( autorefresh() != indeterminate )
+ str << "autorefresh=" << (autorefresh() ? "1" : "0") << endl;
+ if ( autorefresh() != indeterminate )
+ str << "gpgcheck=" << (gpgCheck() ? "1" : "0") << endl;
+ if ( ! (gpgKeyUrl().asString().empty()) )
+ str << "gpgkey=" <http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoInfo.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoInfo.h (original)
+++ trunk/libzypp/zypp/RepoInfo.h Mon Jul 16 12:40:42 2007
@@ -63,12 +63,14 @@
class RepoInfo
{
friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
-
+
public:
RepoInfo();
~RepoInfo();
//RepoInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
-
+
+ typedef unsigned long NumericId;
+
/**
* unique identifier for this source. If not specified
* It should be generated from the base url.
@@ -77,52 +79,85 @@
* ( [somerepo] )
*/
std::string alias() const;
-
+
/**
* A Url under which the metadata are located, or a set of mirrors.
*
* This can't be empty in order the repository to be valid
* unless the download of the mirror list succeeds and it
* contains a valid url.
+ *
+ * \deprecated IMO superfluous as we provide begin/end iterator.
*/
std::set<Url> baseUrls() const;
/**
+ * \short Repository path
+ *
+ * Pathname relative to the base Url where the product/repository
+ * is located
+ *
+ * For medias containing more than one product, or repositories not
+ * located at the root of the media it is important to
+ * know the path of the media root relative to the product directory
+ * so a media verifier can be set for that media.
+ *
+ * It is not mandatory, and the default is /
+ *
+ * \note As a repository can have multiple Urls, the path is unique and
+ * the same for all Urls, so it is assumed all the Urls have the
+ * same media layout.
+ *
+ */
+ Pathname path() const;
+
+ /**
* Url of a file which contains a list of Urls
* If empty, the base url will be used.
*/
Url mirrorListUrl() const;
-
+
typedef std::set<Url>::const_iterator urls_const_iterator;
-
+ typedef std::set<Url>::size_type urls_size_type;
+
/**
* iterator that points at begin of repository urls
*/
urls_const_iterator baseUrlsBegin() const;
-
+
/**
* iterator that points at end of repository urls
*/
urls_const_iterator baseUrlsEnd() const;
-
+
/**
+ * number of repository urls
+ */
+ urls_size_type baseUrlsSize() const;
+
+ /**
+ * whether repository urls are available
+ */
+ bool baseUrlsEmpty() const;
+
+ /**
* If enabled is false, then this repository must be ignored as if does
* not exists, except when checking for duplicate alias.
*/
boost::tribool enabled() const;
-
+
/**
* If true, the repostory must be refreshed before creating resolvables
* from it
*/
boost::tribool autorefresh() const;
-
+
/**
* Type of repository,
- *
+ *
*/
repo::RepoType type() const;
-
+
/**
* \short Repository short label
*
@@ -139,45 +174,77 @@
* infos created in memory.
*/
Pathname filepath() const;
+
+ /**
+ * \short Whether to check or not this repository with gpg
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ boost::tribool gpgCheck() const;
+
+ /**
+ * \short Key to use for gpg checking of this repository
+ *
+ * \param url Url to the key in ASCII armored format
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ Url gpgKeyUrl() const;
/**
* Add a base url. \see baseUrls
* \param url The base url for the repository.
*
- * To edit or remove urls, create a new RepoInfo instead.
+ * To recreate the base URLs list, use \ref setBaseUrl(const Url &) followed
+ * by addBaseUrl().
*/
RepoInfo & addBaseUrl( const Url &url );
+
+ /**
+ * Clears current base URL list and adds \a url.
+ */
+ RepoInfo & setBaseUrl( const Url &url );
+
+ /**
+ * set the product path. \see path()
+ * \param path the path to the product
+ */
+ RepoInfo & setPath( const Pathname &path );
/**
* Set mirror list url. \see mirrorListUrl
* \param url The base url for the list
*/
RepoInfo & setMirrorListUrl( const Url &url );
-
+
/**
* enable or disable the repository \see enabled
* \param enabled
*/
RepoInfo & setEnabled( boost::tribool enabled );
-
+
/**
* enable or disable autorefresh \see autorefresh
* \param enabled
*/
RepoInfo & setAutorefresh( boost::tribool autorefresh );
-
+
/**
* set the repository alias \see alias
* \param alias
*/
RepoInfo & setAlias( const std::string &alias );
-
+
/**
* set the repository type \see type
* \param t
*/
RepoInfo & setType( const repo::RepoType &t );
-
+
/**
* set the repository name \see name
* \param name
@@ -189,9 +256,38 @@
* \param path File path
*/
RepoInfo & setFilepath( const Pathname &filename );
+
+ /**
+ * \short Whether to check or not this repository with gpg
+ *
+ * \param check true (check) or false (dont'check)
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ RepoInfo & setGpgCheck( boost::tribool check );
- std::ostream & dumpOn( std::ostream & str ) const;
+ /**
+ * \short Key to use for gpg checking of this repository
+ *
+ * \param url Url to the key in ASCII armored format
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ RepoInfo & setGpgKeyUrl( const Url &gpgkey );
+ /**
+ * Write a human-readable representation of this RepoInfo object
+ * into the \a str stream. Useful for logging.
+ */
+ std::ostream & dumpOn( std::ostream & str ) const;
+
+ /**
+ * Write this RepoInfo object into \a str in a <tr>.repo</tt> file format.
+ */
std::ostream & dumpRepoOn( std::ostream & str ) const;
class Impl;
@@ -205,7 +301,7 @@
std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
typedef std::list<RepoInfo> RepoInfoList;
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.cc (original)
+++ trunk/libzypp/zypp/RepoManager.cc Mon Jul 16 12:40:42 2007
@@ -16,6 +16,7 @@
#include <algorithm>
#include "zypp/base/InputStream.h"
#include "zypp/base/Logger.h"
+#include "zypp/base/Gettext.h"
#include "zypp/base/Function.h"
#include "zypp/PathInfo.h"
#include "zypp/TmpPath.h"
@@ -25,15 +26,18 @@
#include "zypp/cache/CacheStore.h"
#include "zypp/repo/cached/RepoImpl.h"
+#include "zypp/media/MediaManager.h"
#include "zypp/MediaSetAccess.h"
#include "zypp/parser/RepoFileReader.h"
#include "zypp/repo/yum/Downloader.h"
#include "zypp/parser/yum/RepoParser.h"
-
+#include "zypp/parser/plaindir/RepoParser.h"
#include "zypp/repo/susetags/Downloader.h"
#include "zypp/parser/susetags/RepoParser.h"
+#include "zypp/ZYppCallbacks.h"
+
using namespace std;
using namespace zypp;
using namespace zypp::repo;
@@ -50,7 +54,7 @@
// CLASS NAME : RepoManagerOptions
//
///////////////////////////////////////////////////////////////////
-
+
RepoManagerOptions::RepoManagerOptions()
{
ZConfig globalConfig;
@@ -77,12 +81,12 @@
{
MIL << endl;
}
-
+
~RepoCollector()
{
MIL << endl;
}
-
+
bool collect( const RepoInfo &repo )
{
//MIL << "here in collector: " << repo.alias() << endl;
@@ -90,12 +94,12 @@
//MIL << "added: " << repo.alias() << endl;
return true;
}
-
+
RepoInfoList repos;
};
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Reads RepoInfo's from a repo file.
*
@@ -114,20 +118,20 @@
std::list<RepoInfo> readRepoFile(const Url & repo_file)
{
// no interface to download a specific file, using workaround:
- //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
+ //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
Url url(repo_file);
Pathname path(url.getPathName());
url.setPathName ("/");
MediaSetAccess access(url);
Pathname local = access.provideFile(path);
-
+
DBG << "reading repo file " << repo_file << ", local path: " << local << endl;
-
+
return repositories_in_file(local);
}
////////////////////////////////////////////////////////////////////////////
-
+
/**
* \short List of RepoInfo's from a directory
*
@@ -143,10 +147,10 @@
list<Pathname> entries;
if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
ZYPP_THROW(Exception("failed to read directory"));
-
+
for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
{
- list<RepoInfo> tmp = repositories_in_file( *it );
+ list<RepoInfo> tmp = repositories_in_file( *it );
repos.insert( repos.end(), tmp.begin(), tmp.end() );
//std::copy( collector.repos.begin(), collector.repos.end(), std::back_inserter(repos));
@@ -156,23 +160,23 @@
}
////////////////////////////////////////////////////////////////////////////
-
+
static void assert_alias( const RepoInfo &info )
{
if (info.alias().empty())
ZYPP_THROW(RepoNoAliasException());
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
static void assert_urls( const RepoInfo &info )
{
if (info.baseUrls().empty())
ZYPP_THROW(RepoNoUrlException());
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* \short Calculates the raw cache path for a repository
*/
@@ -187,7 +191,7 @@
// CLASS NAME : RepoManager::Impl
//
///////////////////////////////////////////////////////////////////
-
+
/**
* \short RepoManager implementation.
*/
@@ -196,16 +200,16 @@
Impl( const RepoManagerOptions &opt )
: options(opt)
{
-
+
}
-
+
Impl()
{
-
+
}
-
+
RepoManagerOptions options;
-
+
public:
/** Offer default Impl. */
static shared_ptr<Impl> nullimpl()
@@ -239,36 +243,42 @@
{}
////////////////////////////////////////////////////////////////////////////
-
+
RepoManager::~RepoManager()
{}
-
+
////////////////////////////////////////////////////////////////////////////
std::list<RepoInfo> RepoManager::knownRepositories() const
{
MIL << endl;
- return repositories_in_dir(_pimpl->options.knownReposPath);
+
+ if ( PathInfo(_pimpl->options.knownReposPath).isExist() )
+ return repositories_in_dir(_pimpl->options.knownReposPath);
+ else
+ return std::list<RepoInfo>();
+
MIL << endl;
}
////////////////////////////////////////////////////////////////////////////
-
+
RepoStatus RepoManager::rawMetadataStatus( const RepoInfo &info )
{
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
RepoType repokind = info.type();
RepoStatus status;
+
switch ( repokind.toEnum() )
{
case RepoType::NONE_e:
// unknown, probe the local metadata
- repokind = probe(Url(rawpath.asString()));
+ repokind = probe(rawpath.asUrl());
break;
default:
break;
}
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
@@ -276,25 +286,37 @@
status = RepoStatus( rawpath + "/repodata/repomd.xml");
}
break;
+
case RepoType::YAST2_e :
{
status = RepoStatus( rawpath + "/content");
}
break;
- default:
- ZYPP_THROW(RepoUnknownTypeException());
+
+ case RepoType::RPMPLAINDIR_e :
+ {
+ if ( PathInfo(Pathname(rawpath + "/cookie")).isExist() )
+ status = RepoStatus( rawpath + "/cookie");
+ }
+ break;
+
+ case RepoType::NONE_e :
+ // Return default RepoStatus in case of RepoType::NONE
+ // indicating it should be created?
+ // ZYPP_THROW(RepoUnknownTypeException());
+ break;
}
return status;
}
-
-
+
+
void RepoManager::refreshMetadata( const RepoInfo &info,
RawMetadataRefreshPolicy policy,
const ProgressData::ReceiverFnc & progress )
{
assert_alias(info);
assert_urls(info);
-
+
RepoStatus oldstatus;
RepoStatus newstatus;
// try urls one by one
@@ -304,9 +326,9 @@
{
Url url(*it);
filesystem::TmpDir tmpdir;
-
+
repo::RepoType repokind = info.type();
-
+
// if the type is unknown, try probing.
switch ( repokind.toEnum() )
{
@@ -317,16 +339,16 @@
default:
break;
}
-
+
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
oldstatus = rawMetadataStatus(info);
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
{
yum::Downloader downloader( url, "/" );
-
+
RepoStatus newstatus = downloader.status();
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
@@ -342,7 +364,7 @@
{
refresh = true;
}
-
+
if ( refresh )
downloader.download(tmpdir.path());
else
@@ -353,7 +375,7 @@
case RepoType::YAST2_e :
{
susetags::Downloader downloader( url, "/" );
-
+
RepoStatus newstatus = downloader.status();
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
@@ -369,7 +391,7 @@
{
refresh = true;
}
-
+
if ( refresh )
downloader.download(tmpdir.path());
else
@@ -377,10 +399,45 @@
// no error
}
break;
+
+ case RepoType::RPMPLAINDIR_e :
+ {
+ RepoStatus newstatus = parser::plaindir::dirStatus(url.getPathName());
+ bool refresh = false;
+ if ( oldstatus.checksum() == newstatus.checksum() )
+ {
+ MIL << "repo has not changed" << endl;
+ if ( policy == RefreshForced )
+ {
+ MIL << "refresh set to forced" << endl;
+ refresh = true;
+ }
+ }
+ else
+ {
+ refresh = true;
+ }
+
+ if ( refresh )
+ {
+ std::ofstream file(( tmpdir.path() + "/cookie").c_str());
+ if (!file) {
+ ZYPP_THROW (Exception( "Can't open " + tmpdir.path().asString() + "/cookie" ) );
+ }
+ file << url << endl;
+ file << newstatus.checksum() << endl;
+
+ file.close();
+ }
+ else
+ return;
+ // no error
+ }
+ break;
default:
ZYPP_THROW(RepoUnknownTypeException());
}
-
+
// ok we have the metadata, now exchange
// the contents
TmpDir oldmetadata;
@@ -400,29 +457,30 @@
ERR << "No more urls..." << endl;
ZYPP_THROW(RepoException("Cant refresh metadata"));
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanMetadata( const RepoInfo &info,
const ProgressData::ReceiverFnc & progress )
{
filesystem::recursive_rmdir(rawcache_path_for_repoinfo(_pimpl->options, info));
}
-
- ////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::buildCache( const RepoInfo &info,
CacheBuildPolicy policy,
const ProgressData::ReceiverFnc & progressrcv )
{
- ProgressData progress;
- progress.sendTo(progressrcv);
+ ProgressData progress(100);
+ callback::SendReport<ProgressReport> report;
+ progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
+ progress.name(str::form(_("Building repository '%s' cache"), info.alias().c_str()));
progress.toMin();
+
assert_alias(info);
Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
RepoStatus raw_metadata_status = rawMetadataStatus(info);
if ( store.isCached( info.alias() ) )
{
@@ -438,111 +496,156 @@
return;
}
else {
- MIL << "Build cache is forced" << endl;
+ MIL << info.alias() << " cache rebuild is forced" << endl;
}
}
store.cleanRepository(id);
}
-
+
+ MIL << info.alias() << " building cache..." << endl;
data::RecordId id = store.lookupOrAppendRepository(info.alias());
// do we have type?
repo::RepoType repokind = info.type();
-
- // if the type is unknown, try probing.
- switch ( repokind.toEnum() )
+
+ // if the type is unknown, try probing.
+ switch ( repokind.toEnum() )
+ {
+ case RepoType::NONE_e:
+ // unknown, probe the local metadata
+ repokind = probe(rawpath.asUrl());
+ break;
+ default:
+ break;
+ }
+
+ CombinedProgressData subprogrcv( progress, 100);
+
+ switch ( repokind.toEnum() )
+ {
+ case RepoType::RPMMD_e :
{
- case RepoType::NONE_e:
- // unknown, probe the local metadata
- repokind = probe(Url(rawpath.asString()));
- break;
- default:
- break;
+ parser::yum::RepoParser parser(id, store, parser::yum::RepoParserOpts(), subprogrcv);
+ parser.parse(rawpath);
+ // no error
}
-
- switch ( repokind.toEnum() )
+ break;
+ case RepoType::YAST2_e :
{
- case RepoType::RPMMD_e :
- {
- parser::yum::RepoParser parser(id, store);
- parser.parse(rawpath);
- // no error
- }
- break;
- case RepoType::YAST2_e :
- {
- parser::susetags::RepoParser parser(id, store);
- parser.parse(rawpath);
- // no error
- }
- break;
- default:
- ZYPP_THROW(RepoUnknownTypeException());
+ parser::susetags::RepoParser parser(id, store, subprogrcv);
+ parser.parse(rawpath);
+ // no error
}
-
- // update timestamp and checksum
- store.updateRepositoryStatus(id, raw_metadata_status);
-
- MIL << "Commit cache.." << endl;
- store.commit();
- progress.toMax();
+ break;
+ case RepoType::RPMPLAINDIR_e :
+ {
+ InputStream is(rawpath + "cookie");
+ string buffer;
+ getline( is.stream(), buffer);
+ Url url(buffer);
+ parser::plaindir::RepoParser parser(id, store, subprogrcv);
+ parser.parse(url.getPathName());
+ }
+ break;
+ default:
+ ZYPP_THROW(RepoUnknownTypeException());
+ }
+
+ // update timestamp and checksum
+ store.updateRepositoryStatus(id, raw_metadata_status);
+
+ MIL << "Commit cache.." << endl;
+ store.commit();
+ progress.toMax();
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
repo::RepoType RepoManager::probe( const Url &url )
{
+ if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName() ).isDir() )
+ {
+ // Handle non existing local directory in advance, as
+ // MediaSetAccess does not support it.
+ return repo::RepoType::NONE;
+ }
+
MediaSetAccess access(url);
if ( access.doesFileExist("/repodata/repomd.xml") )
return repo::RepoType::RPMMD;
if ( access.doesFileExist("/content") )
return repo::RepoType::YAST2;
-
- return repo::RepoType("UNKNOWN");
+
+ // if it is a local url of type dir
+ if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
+ {
+ Pathname path = Pathname(url.getPathName());
+ if ( PathInfo(path).isDir() )
+ {
+ // allow empty dirs for now
+ return repo::RepoType::RPMPLAINDIR;
+ }
+ }
+
+ return repo::RepoType::NONE;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
- ProgressData progress;
- progress.sendTo(progressrcv);
-
+ ProgressData progress(100);
+ callback::SendReport<ProgressReport> report;
+ progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
+ progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str()));
+ progress.toMin();
+
cache::CacheStore store(_pimpl->options.repoCachePath);
data::RecordId id = store.lookupRepository(info.alias());
store.cleanRepository(id);
store.commit();
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
bool RepoManager::isCached( const RepoInfo &info ) const
{
cache::CacheStore store(_pimpl->options.repoCachePath);
return store.isCached(info.alias());
}
-
+
Repository RepoManager::createFromCache( const RepoInfo &info,
- const ProgressData::ReceiverFnc & progress )
+ const ProgressData::ReceiverFnc & progressrcv )
{
- cache::CacheStore store(_pimpl->options.repoCachePath);
+ callback::SendReport<ProgressReport> report;
+ ProgressData progress;
+ progress.sendTo(ProgressReportAdaptor( progressrcv, report ));
+ progress.sendTo( progressrcv );
+ progress.name(str::form(_("Reading repository '%s' cache"), info.alias().c_str()));
+ progress.toMin();
+ cache::CacheStore store(_pimpl->options.repoCachePath);
+
if ( ! store.isCached( info.alias() ) )
ZYPP_THROW(RepoNotCachedException());
-
+
MIL << "Repository " << info.alias() << " is cached" << endl;
-
+
data::RecordId id = store.lookupRepository(info.alias());
+
+ repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
+ opts.readingResolvablesProgress = progressrcv;
repo::cached::RepoImpl::Ptr repoimpl =
- new repo::cached::RepoImpl( info, _pimpl->options.repoCachePath, id );
+ new repo::cached::RepoImpl( opts );
+
+ repoimpl->resolvables();
// read the resolvables from cache
- repoimpl->createResolvables();
return Repository(repoimpl);
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Generate a non existing filename in a directory, using a base
* name. For example if a directory contains 3 files
@@ -551,7 +654,7 @@
* |-- foo
* `-- moo
*
- * If you try to generate a unique filename for this directory,
+ * If you try to generate a unique filename for this directory,
* based on "ruu" you will get "ruu", but if you use the base
* "foo" you will get "foo_1"
*
@@ -570,13 +673,19 @@
}
return dir + Pathname(final_filename);
}
-
+
////////////////////////////////////////////////////////////////////////////
void RepoManager::addRepository( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
assert_alias(info);
+
+ ProgressData progress(100);
+ callback::SendReport<ProgressReport> report;
+ progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
+ progress.name(str::form(_("Adding repository '%s'"), info.alias().c_str()));
+ progress.toMin();
std::list<RepoInfo> repos = knownRepositories();
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
@@ -586,21 +695,27 @@
if ( info.alias() == (*it).alias() )
ZYPP_THROW(RepoAlreadyExistsException(info.alias()));
}
+
+ progress.set(50);
+
+ // assert the directory exists
+ filesystem::assert_dir(_pimpl->options.knownReposPath);
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
Pathname(info.alias()).extend(".repo").asString());
// now we have a filename that does not exists
MIL << "Saving repo in " << repofile << endl;
-
+
std::ofstream file(repofile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
}
-
+
info.dumpRepoOn(file);
+ progress.toMax();
MIL << "done" << endl;
}
-
+
void RepoManager::addRepositories( const Url &url,
const ProgressData::ReceiverFnc & progressrcv )
{
@@ -622,21 +737,24 @@
}
}
}
-
+
string filename = Pathname(url.getPathName()).basename();
-
+
if ( filename == Pathname() )
ZYPP_THROW(RepoException("Invalid repo file name at " + url.asString() ));
+
+ // assert the directory exists
+ filesystem::assert_dir(_pimpl->options.knownReposPath);
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename);
// now we have a filename that does not exists
MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl;
-
+
std::ofstream file(repofile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
}
-
+
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
it != repos.end();
++it )
@@ -646,12 +764,14 @@
}
MIL << "done" << endl;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::removeRepository( const RepoInfo & info,
const ProgressData::ReceiverFnc & progressrcv)
{
+ MIL << "Going to delete repo " << info.alias() << endl;
+
std::list<RepoInfo> repos = knownRepositories();
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
it != repos.end();
@@ -662,9 +782,9 @@
// then skip
if ( (!info.alias().empty()) && ( info.alias() != (*it).alias() ) )
continue;
-
+
// TODO match by url
-
+
// we have a matcing repository, now we need to know
// where it does come from.
RepoInfo todelete = *it;
@@ -683,6 +803,7 @@
{
ZYPP_THROW(RepoException("Can't delete " + todelete.filepath().asString()));
}
+ MIL << todelete.alias() << " sucessfully deleted." << endl;
return;
}
else
@@ -691,6 +812,10 @@
// write them back except the deleted one.
//TmpFile tmp;
//std::ofstream file(tmp.path().c_str());
+
+ // assert the directory exists
+ filesystem::assert_dir(todelete.filepath().dirname());
+
std::ofstream file(todelete.filepath().c_str());
if (!file) {
//ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
@@ -703,25 +828,88 @@
if ( (*fit).alias() != todelete.alias() )
(*fit).dumpRepoOn(file);
}
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
if ( store.isCached( todelete.alias() ) ) {
MIL << "repository was cached. cleaning cache" << endl;
store.cleanRepository(todelete.alias());
}
-
+
+ MIL << todelete.alias() << " sucessfully deleted." << endl;
return;
}
} // else filepath is empty
-
+
}
// should not be reached on a sucess workflow
ZYPP_THROW(RepoNotFoundException(info));
}
-
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ void RepoManager::modifyRepository( const std::string &alias,
+ const RepoInfo & newinfo,
+ const ProgressData::ReceiverFnc & progressrcv )
+ {
+ RepoInfo toedit = getRepositoryInfo(alias);
+
+ if (toedit.filepath().empty())
+ {
+ ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
+ }
+ else
+ {
+ // figure how many repos are there in the file:
+ std::list<RepoInfo> filerepos = repositories_in_file(toedit.filepath());
+
+ // there are more repos in the same file
+ // write them back except the deleted one.
+ //TmpFile tmp;
+ //std::ofstream file(tmp.path().c_str());
+
+ // assert the directory exists
+ filesystem::assert_dir(toedit.filepath().dirname());
+
+ std::ofstream file(toedit.filepath().c_str());
+ if (!file) {
+ //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
+ ZYPP_THROW (Exception( "Can't open " + toedit.filepath().asString() ) );
+ }
+ for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
+ fit != filerepos.end();
+ ++fit )
+ {
+ // if the alias is different, dump the original
+ // if it is the same, dump the provided one
+ if ( (*fit).alias() != toedit.alias() )
+ (*fit).dumpRepoOn(file);
+ else
+ newinfo.dumpRepoOn(file);
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ RepoInfo RepoManager::getRepositoryInfo( const std::string &alias,
+ const ProgressData::ReceiverFnc & progressrcv )
+ {
+ std::list<RepoInfo> repos = knownRepositories();
+ for ( std::list<RepoInfo>::const_iterator it = repos.begin();
+ it != repos.end();
+ ++it )
+ {
+ if ( (*it).alias() == alias )
+ return *it;
+ }
+ RepoInfo info;
+ info.setAlias(info.alias());
+ ZYPP_THROW(RepoNotFoundException(info));
+ }
+
////////////////////////////////////////////////////////////////////////////
-
+
std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
{
return str << *obj._pimpl;
Modified: trunk/libzypp/zypp/RepoManager.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.h (original)
+++ trunk/libzypp/zypp/RepoManager.h Mon Jul 16 12:40:42 2007
@@ -169,12 +169,28 @@
/**
* \short Create a repository object from the cache data
*
+ * Creating from cache requires that the repository is
+ * refreshed (metadata downloaded) and cached
+ *
+ * \throws repo::RepoNoAliasException if can't figure an alias to look in cache
* \throw RepoNotCachedException When the source is not cached.
*/
Repository createFromCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
/**
+ * \short Create a repository object from raw metadata
+ *
+ * Creating from cache requires that the repository is
+ * refreshed (metadata downloaded)
+ *
+ * \throw Exception If there are errors parsing the
+ * raw metadata
+ */
+ Repository createFromMetadata( const RepoInfo &info,
+ const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
+ /**
* \short Probe repo metadata type.
*
* \todo FIXME Should this be private?
@@ -217,6 +233,30 @@
void removeRepository( const RepoInfo & info,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+ /**
+ * \short Modify repository attributes
+ *
+ * \throws RepoNotFoundException If no repo match
+ * \throws ParseException If the file parsing fails
+ * \throws Exception On other errors.
+ */
+ void modifyRepository( const std::string &alias,
+ const RepoInfo & newinfo,
+ const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
+ /**
+ * \short Find a matching repository info
+ *
+ * \note if multple repositories incorrectly share the
+ * same alias, the first one found will be returned.
+ *
+ * \throws RepoNotFoundException If no repo match
+ * \throws ParseException If the file parsing fails
+ * \throws Exception On other errors.
+ */
+ RepoInfo getRepositoryInfo( const std::string &alias,
+ const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
protected:
RepoStatus rawMetadataStatus( const RepoInfo &info );
RepoStatus cacheStatus( const RepoInfo &info );
Modified: trunk/libzypp/zypp/Repository.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Repository.cc (original)
+++ trunk/libzypp/zypp/Repository.cc Mon Jul 16 12:40:42 2007
@@ -41,28 +41,41 @@
Repository::NumericId Repository::numericId() const
{ return _pimpl->numericId(); }
- const ResStore & Repository::resolvables()
+ const ResStore & Repository::resolvables() const
{
return _pimpl->resolvables();
}
-
- const RepoInfo Repository::info() const
+
+ const RepoInfo & Repository::info() const
{
return _pimpl->info();
}
-
+
const std::listpackagedelta::PatchRpm &
Repository::patchRpms() const
{
return _pimpl->patchRpms();
}
-
+
const std::listpackagedelta::DeltaRpm &
Repository::deltaRpms() const
{
return _pimpl->deltaRpms();
}
-
-
+
+ std::ostream & operator<<( std::ostream & str, const Repository & obj )
+ {
+ return str << "[" << obj.info().alias() << "]";
+ }
+
+ bool operator==( const Repository & lhs, const Repository & rhs )
+ {
+ return (lhs.info().alias() == rhs.info().alias());
+ }
+
+ bool operator<( const Repository & lhs, const Repository & rhs )
+ {
+ return (lhs.info().alias() < rhs.info().alias());
+ }
}
Modified: trunk/libzypp/zypp/Repository.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Repository.h (original)
+++ trunk/libzypp/zypp/Repository.h Mon Jul 16 12:40:42 2007
@@ -7,11 +7,14 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/base/SafeBool.h"
-#include "zypp/ResStore.h"
+//#include "zypp/ResStore.h"
#include "zypp/RepoInfo.h"
+#include "zypp/repo/PackageDelta.h"
namespace zypp
{
+ class ResStore;
+
namespace repo
{
DEFINE_PTR_TYPE(RepositoryImpl);
@@ -20,24 +23,19 @@
class Repository : private base::SafeBool<Repository>
{
- public:
- friend std::ostream & operator<<( std::ostream & str, const Repository & obj );
- friend bool operator==( const Repository & lhs, const Repository & rhs );
- friend bool operator<( const Repository & lhs, const Repository & rhs );
-
public:
typedef repo::RepositoryImpl Impl;
typedef repo::RepositoryImpl_Ptr Impl_Ptr;
public:
- /**
+ /**
* \short Default ctor: noRepository.
* \see RepoManager::createFromCache.
*/
Repository();
- /**
+ /**
* A dummy Repository (Id \c 0) providing nothing, doing nothing.
*/
static const Repository noRepository;
@@ -56,23 +54,23 @@
/**
* \short Get the resolvables for repo
*/
- const ResStore & resolvables();
+ const zypp::ResStore & resolvables() const;
/**
* \short Repository info used to create this repository
*/
- const RepoInfo info() const;
+ const RepoInfo & info() const;
/**
* \short Patch RPMs the repository provides
*/
const std::listpackagedelta::PatchRpm & patchRpms() const;
-
+
/**
* \short Delta RPMs the repository provides
*/
const std::listpackagedelta::DeltaRpm & deltaRpms() const;
-
+
private:
friend base::SafeBool<Repository>::operator bool_type() const;
/** \ref SafeBool test. */
@@ -94,6 +92,16 @@
RW_pointer _pimpl;
};
+ /** \relates Repository */
+ std::ostream & operator<<( std::ostream & str, const Repository & obj );
+ /** \relates Repository */
+ bool operator==( const Repository & lhs, const Repository & rhs );
+ /** \relates Repository */
+ inline bool operator!=( const Repository & lhs, const Repository & rhs )
+ { return !( lhs == rhs ); }
+ /** \relates Repository */
+ bool operator<( const Repository & lhs, const Repository & rhs );
+
}
#endif
Modified: trunk/libzypp/zypp/ResFilters.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResFilters.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResFilters.h (original)
+++ trunk/libzypp/zypp/ResFilters.h Mon Jul 16 12:40:42 2007
@@ -18,14 +18,15 @@
#include "zypp/Resolvable.h"
#include "zypp/CapFilters.h"
-#include "zypp/Source.h"
-
#include "zypp/PoolItem.h"
#include "zypp/CapAndItem.h"
+//#include "zypp/Repository.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ class Repository;
///////////////////////////////////////////////////////////////////
namespace resfilter
{ /////////////////////////////////////////////////////////////////
@@ -187,19 +188,19 @@
};
- /** Select ResObject by source. */
- struct BySource : public ResObjectFilterFunctor
+ /** Select ResObject by repository. */
+ struct ByRepository : public ResObjectFilterFunctor
{
- BySource( Source_Ref source_r )
- : _source( source_r )
+ ByRepository( Repository repository_r )
+ : _repository( repository_r )
{}
bool operator()( ResObject::constPtr p ) const
{
- return p->source() == _source;
+ return p->repository() == _repository;
}
- Source_Ref _source;
+ Repository _repository;
};
Modified: trunk/libzypp/zypp/ResObject.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResObject.cc (original)
+++ trunk/libzypp/zypp/ResObject.cc Mon Jul 16 12:40:42 2007
@@ -10,7 +10,6 @@
*
*/
#include "zypp/ResObject.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/Repository.h"
#include "zypp/detail/ResObjectImplIf.h"
@@ -45,7 +44,7 @@
//
std::ostream & ResObject::dumpOn( std::ostream & str ) const
{
- str << "[S" << source().numericId() << ":" << sourceMediaNr() << "]";
+ str << "[S" << repository().numericId() << ":" << mediaNr() << "]";
return Resolvable::dumpOn( str );
}
@@ -76,18 +75,12 @@
ByteCount ResObject::size() const
{ return pimpl().size(); }
- ByteCount ResObject::archivesize() const
- { return pimpl().archivesize(); }
-
- Source_Ref ResObject::source() const
- { return pimpl().source(); }
-
- unsigned ResObject::sourceMediaNr() const
- { return pimpl().sourceMediaNr(); }
-
Repository ResObject::repository() const
{ return pimpl().repository(); }
+ ByteCount ResObject::downloadSize() const
+ { return pimpl().downloadSize(); }
+
unsigned ResObject::mediaNr() const
{ return pimpl().mediaNr(); }
@@ -99,10 +92,7 @@
Date ResObject::installtime() const
{ return pimpl().installtime(); }
-
- ZmdId ResObject::zmdid () const
- { return pimpl().zmdid(); }
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/ResObject.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResObject.h (original)
+++ trunk/libzypp/zypp/ResObject.h Mon Jul 16 12:40:42 2007
@@ -18,6 +18,8 @@
#include "zypp/Resolvable.h"
#include "zypp/TranslatedText.h"
#include "zypp/NeedAType.h"
+#include "zypp/Date.h"
+#include "zypp/OnMediaLocation.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -26,7 +28,7 @@
class ImplConnect;
class ResObjectImplIf;
}
- class Source_Ref;
+
class Repository;
class ByteCount;
@@ -95,35 +97,25 @@
ByteCount size() const;
/** Size of the rpm package. */
- ByteCount archivesize() const;
+ ByteCount downloadSize() const;
/**
- * Source providing this resolvable
+ * \short Download size
+ * \deprecated Use downloadSize()
*/
- /*ZYPP_DEPRECATED */ Source_Ref source() const;
+ ZYPP_DEPRECATED ByteCount archivesize() const
+ { return downloadSize(); }
/**
* Source providing this resolvable
*/
Repository repository() const;
-
+
/**
* Media number where the resolvable is located
* 0 if no media access is required.
*/
unsigned mediaNr() const;
-
- /**
- * Media number where the resolvable is located
- * 0 if no media access is required.
- */
- /* ZYPP_DEPRECATED */ unsigned sourceMediaNr() const;
-
- /**
- * \deprecated Use sourceMediaNr
- */
- /* ZYPP_DEPRECATED */ unsigned mediaId() const
- { return sourceMediaNr(); }
/**
* \TODO FIXME what is this?
@@ -141,11 +133,6 @@
*/
Date installtime() const;
- /**
- * \deprecated No replacement.
- */
- ZYPP_DEPRECATED ZmdId zmdid () const;
-
protected:
/** Ctor */
ResObject( const Kind & kind_r,
Modified: trunk/libzypp/zypp/ResPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPool.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPool.cc (original)
+++ trunk/libzypp/zypp/ResPool.cc Mon Jul 16 12:40:42 2007
@@ -87,21 +87,30 @@
ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const
{ return _pimpl->_caphash.end( index_r, depType_r ); }
+ ResPool::size_type ResPool::knownRepositoriesSize() const
+ { return _pimpl->knownRepositories().size(); }
+
+ ResPool::repository_iterator ResPool::knownRepositoriesBegin() const
+ { return _pimpl->knownRepositories().begin(); }
+
+ ResPool::repository_iterator ResPool::knownRepositoriesEnd() const
+ { return _pimpl->knownRepositories().end(); }
+
void ResPool::setAdditionalRequire( const AdditionalCapSet & capset ) const
{ _pimpl->setAdditionalRequire( capset ); }
ResPool::AdditionalCapSet & ResPool::additionalRequire() const
{ return _pimpl->additionalRequire(); }
-
+
void ResPool::setAdditionalConflict( const AdditionalCapSet & capset ) const
{ _pimpl->setAdditionalConflict( capset ); }
ResPool::AdditionalCapSet & ResPool::additionaConflict() const
{ return _pimpl->additionaConflict(); }
-
+
void ResPool::setAdditionalProvide( const AdditionalCapSet & capset ) const
{ _pimpl->setAdditionalProvide( capset ); }
ResPool::AdditionalCapSet & ResPool::additionaProvide() const
{ return _pimpl->additionaProvide(); }
-
+
/******************************************************************
**
Modified: trunk/libzypp/zypp/ResPool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPool.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPool.h (original)
+++ trunk/libzypp/zypp/ResPool.h Mon Jul 16 12:40:42 2007
@@ -46,6 +46,7 @@
typedef pool::PoolTraits::byName_iterator byName_iterator;
typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator;
typedef pool::PoolTraits::AdditionalCapSet AdditionalCapSet;
+ typedef pool::PoolTraits::repository_iterator repository_iterator;
public:
/** Default ctor: empty pool */
@@ -72,7 +73,7 @@
public:
/** \name Iterate through all ResObjects of a certain kind. */
//@{
- typedef resfilter::ByKind ByKind;
+ typedef zypp::resfilter::ByKind ByKind;
typedef filter_iterator byKind_iterator;
byKind_iterator byKindBegin( const ResObject::Kind & kind_r ) const
@@ -110,6 +111,17 @@
//@}
public:
+ /** \name Iterate through all Repositories that contribute ResObjects.
+ */
+ //@{
+ size_type knownRepositoriesSize() const;
+
+ repository_iterator knownRepositoriesBegin() const;
+
+ repository_iterator knownRepositoriesEnd() const;
+ //@}
+
+ public:
/** \name Handling addition capabilities in the pool in order for solving it in
* a solver run. This is used for tasks like needing a package with the name "foo".
* The solver has to evaluate a proper package by his own.
@@ -119,12 +131,12 @@
*/
/**
- * Handling additional requirement. E.G. need package "foo" and package
+ * Handling additional requirement. E.G. need package "foo" and package
* "foo1" which has a greater version than 1.0:
*
* \code
* CapSet capset;
- * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
+ * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo1 > 1.0"));
*
* // The user is setting this capablility
@@ -140,37 +152,37 @@
/**
* Handling additional conflicts. E.G. do not install anything which provides "foo":
*
- * \code
- * CapSet capset;
+ * \code75
+ * CapSet capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
* // The user is setting this capablility
* ResPool::AdditionalCapSet aCapSet;
* aCapSet[ResStatus::USER] = capset;
*
- * setAdditionalConflict( aCapSet );
+ * setAdditionalConflict( aCapSet );
* \endcode
- */
+ */
void setAdditionalConflict( const AdditionalCapSet & capset ) const;
AdditionalCapSet & additionaConflict() const;
-
+
/**
* Handling additional provides. This is used for ignoring a requirement.
* e.G. Do ignore the requirement "foo":
*
* \code
- * CapSet capset;
+ * CapSet capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
* // The user is setting this capablility
* ResPool::AdditionalCapSet aCapSet;
* aCapSet[ResStatus::USER] = capset;
*
- * setAdditionalProvide( aCapSet );
+ * setAdditionalProvide( aCapSet );
* \endcode
- */
+ */
void setAdditionalProvide( const AdditionalCapSet & capset ) const;
- AdditionalCapSet & additionaProvide() const;
+ AdditionalCapSet & additionaProvide() const;
private:
/** */
Modified: trunk/libzypp/zypp/ResPoolProxy.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPoolProxy.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPoolProxy.cc (original)
+++ trunk/libzypp/zypp/ResPoolProxy.cc Mon Jul 16 12:40:42 2007
@@ -176,6 +176,15 @@
const_iterator byKindEnd( const ResObject::Kind & kind_r ) const
{ return _selPool[kind_r].end(); }
+ public:
+ size_type knownRepositoriesSize() const
+ { return _pool.knownRepositoriesSize(); }
+
+ repository_iterator knownRepositoriesBegin() const
+ { return _pool.knownRepositoriesBegin(); }
+
+ repository_iterator knownRepositoriesEnd() const
+ { return _pool.knownRepositoriesEnd(); }
public:
@@ -267,6 +276,15 @@
ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResObject::Kind & kind_r ) const
{ return _pimpl->byKindEnd( kind_r ); }
+ ResPoolProxy::size_type ResPoolProxy::knownRepositoriesSize() const
+ { return _pimpl->knownRepositoriesSize(); }
+
+ ResPoolProxy::repository_iterator ResPoolProxy::knownRepositoriesBegin() const
+ { return _pimpl->knownRepositoriesBegin(); }
+
+ ResPoolProxy::repository_iterator ResPoolProxy::knownRepositoriesEnd() const
+ { return _pimpl->knownRepositoriesEnd(); }
+
void ResPoolProxy::saveState() const
{ _pimpl->saveState(); }
Modified: trunk/libzypp/zypp/ResPoolProxy.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPoolProxy.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPoolProxy.h (original)
+++ trunk/libzypp/zypp/ResPoolProxy.h Mon Jul 16 12:40:42 2007
@@ -46,6 +46,8 @@
typedef SelectableIndex::const_iterator const_iterator;
typedef SelectableIndex::size_type size_type;
+ typedef ResPool::repository_iterator repository_iterator;
+
public:
/** Default ctor: no pool */
ResPoolProxy();
@@ -86,6 +88,17 @@
{ return byKindEnd( ResTraits<_Res>::kind ); }
//@}
+ public:
+ /** \name Iterate through all Repositories that contribute ResObjects.
+ */
+ //@{
+ size_type knownRepositoriesSize() const;
+
+ repository_iterator knownRepositoriesBegin() const;
+
+ repository_iterator knownRepositoriesEnd() const;
+ //@}
+
public:
/** Test whether there is at least one ui::Selectable with
* an installed object.
Modified: trunk/libzypp/zypp/ResStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResStore.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResStore.h (original)
+++ trunk/libzypp/zypp/ResStore.h Mon Jul 16 12:40:42 2007
@@ -39,12 +39,13 @@
/** Type of Resolvable provided by ResStore. */
typedef ResObject ResT;
-
+
private:
typedef std::setResT::Ptr StorageT;
-
+
public:
-
+ typedef StorageT::value_type value_type;
+ typedef StorageT::const_reference const_reference;
typedef StorageT::size_type size_type;
typedef StorageT::iterator iterator;
typedef StorageT::const_iterator const_iterator;
@@ -81,6 +82,11 @@
/** */
iterator insert( const ResT::Ptr & ptr_r )
{ return store().insert( ptr_r ).first; }
+
+ /** */
+ iterator insert( iterator position, const value_type &v )
+ { return store().insert( position, v ); }
+
/** */
template <class _InputIterator>
void insert( _InputIterator first_r, _InputIterator last_r )
Modified: trunk/libzypp/zypp/Resolvable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Resolvable.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Resolvable.cc (original)
+++ trunk/libzypp/zypp/Resolvable.cc Mon Jul 16 12:40:42 2007
@@ -15,7 +15,6 @@
#include "zypp/detail/ResolvableImpl.h"
#include "zypp/ResObject.h"
-#include "zypp/Source.h"
using namespace std;
Modified: trunk/libzypp/zypp/SrcPackage.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/SrcPackage.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/SrcPackage.cc (original)
+++ trunk/libzypp/zypp/SrcPackage.cc Mon Jul 16 12:40:42 2007
@@ -10,7 +10,6 @@
*
*/
#include "zypp/SrcPackage.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/base/Exception.h"
using namespace std;
@@ -44,15 +43,13 @@
//
///////////////////////////////////////////////////////////////////
- ByteCount SrcPackage::archivesize() const
- { return pimpl().archivesize(); }
-
DiskUsage SrcPackage::diskusage() const
{ return pimpl().diskusage(); }
- Pathname SrcPackage::location() const
+ OnMediaLocation SrcPackage::location() const
{ return pimpl().location(); }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/SrcPackage.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/SrcPackage.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/SrcPackage.h (original)
+++ trunk/libzypp/zypp/SrcPackage.h Mon Jul 16 12:40:42 2007
@@ -38,13 +38,12 @@
typedef TraitsType::constPtrType constPtr;
public:
- /** */
- ByteCount archivesize() const;
/** Disk usage per directory */
DiskUsage diskusage() const;
- /** location in source */
- Pathname location() const;
-
+
+ /** location of resolvable in repo */
+ OnMediaLocation location() const;
+
protected:
SrcPackage( const NVRAD & nvrad_r );
/** Dtor */
Modified: trunk/libzypp/zypp/Target.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Target.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Target.cc (original)
+++ trunk/libzypp/zypp/Target.cc Mon Jul 16 12:40:42 2007
@@ -97,12 +97,6 @@
std::ostream & Target::dumpOn( std::ostream & str ) const
{ return _pimpl->dumpOn( str ); }
- void Target::getResolvablesToInsDel ( const ResPool pool_r,
- PoolItemList & dellist_r,
- PoolItemList & instlist_r,
- PoolItemList & srclist_r ) const
- { _pimpl->getResolvablesToInsDel( pool_r, dellist_r, instlist_r, srclist_r ); }
-
bool Target::setInstallationLogfile(const Pathname & path_r)
{ return _pimpl->setInstallationLogfile(path_r); }
Modified: trunk/libzypp/zypp/Target.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Target.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/Target.h (original)
+++ trunk/libzypp/zypp/Target.h Mon Jul 16 12:40:42 2007
@@ -87,15 +87,6 @@
ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
- /** JUST FOR TESTSUITE */
- /** Sort according to prereqs and media numbers
- * \todo provide it as standalone algorithm
- */
- void getResolvablesToInsDel ( const ResPool pool_r,
- PoolItemList & dellist_r,
- PoolItemList & instlist_r,
- PoolItemList & srclist_r ) const;
-
#ifndef STORAGE_DISABLED
/** enables the storage target */
bool isStorageEnabled() const;
Modified: trunk/libzypp/zypp/TranslatedText.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/TranslatedText.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/TranslatedText.cc (original)
+++ trunk/libzypp/zypp/TranslatedText.cc Mon Jul 16 12:40:42 2007
@@ -6,17 +6,15 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/TranslatedText.cc
+/** \file zypp/TranslatedText.cc
*
*/
#include <iostream>
-//#include "zypp/base/Logger.h"
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/ZYpp.h"
#include "zypp/base/String.h"
+
#include "zypp/TranslatedText.h"
+#include "zypp/ZConfig.h"
using std::endl;
@@ -26,11 +24,13 @@
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : TranslatedText::Impl
+ // CLASS NAME : TranslatedText::Impl
//
/** TranslatedText implementation. */
struct TranslatedText::Impl
{
+ typedef std::map TranslationMap;
+
Impl()
{}
@@ -44,52 +44,45 @@
{
return translations.empty();
}
-
- std::string text( const Locale &lang = Locale() ) const
+
+ std::string text( const Locale &lang ) const
{
- Locale empty_locale;
- // if there are no translation for the requested locale
- // or the passed locale is a empty one, we activate the
- // fallback mechanism, otherwise (else case), we just provide
- // the (existant) requested locale)
- if ( translations[lang].empty() || (lang == empty_locale))
+ // Traverse fallback list and return the 1st nonempty match.
+ // Take care NOT to create new map entries in queries.
+ Locale toReturn( lang );
+ if ( lang == Locale::noCode )
{
- // first, detect the locale
- ZYpp::Ptr z = getZYpp();
- Locale detected_lang( z->getTextLocale() );
- if ( translations[detected_lang].empty() )
- {
- Locale fallback_locale = detected_lang.fallback();
- while ( fallback_locale != empty_locale )
- {
- if ( ! translations[fallback_locale].empty() )
- return translations[fallback_locale];
-
- fallback_locale = fallback_locale.fallback();
- }
- // we gave up, there are no translations with fallbacks
- // last try, emtpy locale
-
- if ( ! translations[empty_locale].empty() )
- return translations[empty_locale];
- else
- return std::string();
- }
- else
- {
- return translations[detected_lang];
- }
+ toReturn = ZConfig().defaultTextLocale();
}
- else
+
+ do
{
- return translations[lang];
- }
+ TranslationMap::const_iterator it = translations.find( toReturn );
+ if ( it != translations.end()
+ && ! it->second.empty() )
+ {
+ return it->second;
+ }
+
+ if ( toReturn != Locale::noCode )
+ {
+ // retry using next fallback:
+ toReturn = toReturn.fallback();
+ }
+ else
+ {
+ // there are no further fallbacks
+ return std::string();
+ }
+ } while( true );
+ // not reached.
+ return std::string();
}
std::set<Locale> locales() const
{
std::set<Locale> lcls;
- for(std::map::const_iterator it = translations.begin(); it != translations.end(); ++it)
+ for( TranslationMap::const_iterator it = translations.begin(); it != translations.end(); ++it )
{
lcls.insert((*it).first);
}
@@ -109,7 +102,7 @@
}
private:
- mutable std::map translations;
+ mutable TranslationMap translations;
public:
/** Offer default Impl. */
@@ -129,7 +122,7 @@
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : TranslatedText
+ // CLASS NAME : TranslatedText
//
///////////////////////////////////////////////////////////////////
@@ -137,8 +130,8 @@
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::TranslatedText
- // METHOD TYPE : Ctor
+ // METHOD NAME : TranslatedText::TranslatedText
+ // METHOD TYPE : Ctor
//
TranslatedText::TranslatedText()
: _pimpl( Impl::nullimpl() )
@@ -146,8 +139,8 @@
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::TranslatedText
- // METHOD TYPE : Ctor
+ // METHOD NAME : TranslatedText::TranslatedText
+ // METHOD TYPE : Ctor
//
TranslatedText::TranslatedText( const std::string &text,
const Locale &lang )
@@ -156,8 +149,8 @@
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::TranslatedText
- // METHOD TYPE : Ctor
+ // METHOD NAME : TranslatedText::TranslatedText
+ // METHOD TYPE : Ctor
//
TranslatedText::TranslatedText( const std::liststd::string &text,
const Locale &lang )
@@ -166,8 +159,8 @@
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::~TranslatedText
- // METHOD TYPE : Dtor
+ // METHOD NAME : TranslatedText::~TranslatedText
+ // METHOD TYPE : Dtor
//
TranslatedText::~TranslatedText()
{}
Modified: trunk/libzypp/zypp/VendorAttr.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/VendorAttr.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/VendorAttr.cc (original)
+++ trunk/libzypp/zypp/VendorAttr.cc Mon Jul 16 12:40:42 2007
@@ -25,6 +25,7 @@
#include "zypp/base/IOStream.h"
#include "zypp/base/String.h"
+#include "zypp/PathInfo.h"
#include "zypp/VendorAttr.h"
#include "zypp/ZYppFactory.h"
Modified: trunk/libzypp/zypp/ZYpp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYpp.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYpp.cc (original)
+++ trunk/libzypp/zypp/ZYpp.cc Mon Jul 16 12:40:42 2007
@@ -81,9 +81,6 @@
//
///////////////////////////////////////////////////////////////////
- //SourceFeed_Ref ZYpp::sourceFeed() const
- //{ return _pimpl->sourceFeed(); }
-
void ZYpp::addResolvables (const ResStore& store, bool installed)
{
_pimpl->addResolvables (store, installed);
Modified: trunk/libzypp/zypp/ZYpp.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYpp.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYpp.h (original)
+++ trunk/libzypp/zypp/ZYpp.h Mon Jul 16 12:40:42 2007
@@ -38,7 +38,6 @@
class ZYppFactory;
class ResPool;
class ResPoolProxy;
- class SourceFeed_Ref;
class ResStore;
class Locale;
class KeyRing;
@@ -72,9 +71,6 @@
*/
ResPoolProxy poolProxy() const;
- /** */
- //SourceFeed_Ref sourceFeed() const;
-
void addResolvables (const ResStore& store, bool installed = false);
void removeResolvables (const ResStore& store);
Modified: trunk/libzypp/zypp/ZYppCallbacks.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppCallbacks.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYppCallbacks.h (original)
+++ trunk/libzypp/zypp/ZYppCallbacks.h Mon Jul 16 12:40:42 2007
@@ -14,16 +14,75 @@
#include "zypp/Callback.h"
#include "zypp/Resolvable.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/Pathname.h"
#include "zypp/Message.h"
#include "zypp/Url.h"
+#include "zypp/ProgressData.h"
#include "zypp/media/MediaUserAuth.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
- namespace source
+
+ struct ProgressReport : public callback::ReportBase
+ {
+ virtual void start( const ProgressData &/*task*/ )
+ {}
+
+ virtual bool progress( const ProgressData &/*task*/ )
+ { return true; }
+
+// virtual Action problem(
+// Repository /*source*/
+// , Error /*error*/
+// , const std::string &/*description*/ )
+// { return ABORT; }
+
+ virtual void finish( const ProgressData &/*task*/ )
+ {}
+
+ };
+
+ struct ProgressReportAdaptor
+ {
+
+ ProgressReportAdaptor( const ProgressData::ReceiverFnc &fnc,
+ callback::SendReport<ProgressReport> &report )
+ : _fnc(fnc)
+ , _report(report)
+ , _first(true)
+ {
+ }
+
+ bool operator()( const ProgressData &progress )
+ {
+ if ( _first )
+ {
+ _report->start(progress);
+ _first = false;
+ }
+
+ _report->progress(progress);
+ bool value = true;
+ if ( _fnc )
+ value = _fnc(progress);
+
+ if ( progress.val() == progress.max() )
+ {
+ _report->finish(progress);
+ }
+ return value;
+ }
+
+ ProgressData::ReceiverFnc _fnc;
+ callback::SendReport<ProgressReport> &_report;
+ bool _first;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ namespace repo
{
// progress for downloading a resolvable
struct DownloadResolvableReport : public callback::ReportBase
@@ -114,7 +173,7 @@
};
// progress for probing a source
- struct ProbeSourceReport : public callback::ReportBase
+ struct ProbeRepoReport : public callback::ReportBase
{
enum Action {
ABORT, // abort and return error
@@ -140,7 +199,7 @@
virtual Action problem( const Url &/*url*/, Error /*error*/, const std::string &/*description*/ ) { return ABORT; }
};
- struct SourceCreateReport : public callback::ReportBase
+ struct RepoCreateReport : public callback::ReportBase
{
enum Action {
ABORT, // abort and return error
@@ -174,7 +233,7 @@
{}
};
- struct SourceReport : public callback::ReportBase
+ struct RepoReport : public callback::ReportBase
{
enum Action {
ABORT, // abort and return error
@@ -189,18 +248,18 @@
INVALID // th source is invalid
};
- virtual void start( Source_Ref /*source*/, const std::string &/*task*/ ) {}
- virtual bool progress( int /*value*/ )
+ virtual void start( const ProgressData &/*task*/, const RepoInfo /*repo*/ ) {}
+ virtual bool progress( const ProgressData &/*task*/ )
{ return true; }
virtual Action problem(
- Source_Ref /*source*/
+ Repository /*source*/
, Error /*error*/
, const std::string &/*description*/ )
{ return ABORT; }
virtual void finish(
- Source_Ref /*source*/
+ Repository /*source*/
, const std::string &/*task*/
, Error /*error*/
, const std::string &/*reason*/ )
@@ -236,7 +295,7 @@
};
virtual Action requestMedia(
- Source_Ref /*source*/
+ Repository /*source*/
, unsigned /*mediumNr*/
, Error /*error*/
, const std::string &/*description*/
Modified: trunk/libzypp/zypp/ZYppCommitPolicy.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppCommitPolicy.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYppCommitPolicy.h (original)
+++ trunk/libzypp/zypp/ZYppCommitPolicy.h Mon Jul 16 12:40:42 2007
@@ -47,11 +47,13 @@
{ return _syncPoolAfterCommit; }
public:
- /** Restrict commit to a certain media number
- * \deprecated
+ /** Restrict commit to media 1.
+ * Fake outstanding YCP fix: Honour restriction to media 1
+ * at installation, but install all remaining packages if
+ * post-boot (called with <tt>mediaNr_r > 1</tt>).
*/
ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r )
- { _restrictToMedia = mediaNr_r; return *this; }
+ { _restrictToMedia = ( mediaNr_r == 1 ) ? 1 : 0; return *this; }
/** Process all media (default) */
ZYppCommitPolicy & allMedia()
Modified: trunk/libzypp/zypp/cache/Attribute.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/Attribute.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/Attribute.h (original)
+++ trunk/libzypp/zypp/cache/Attribute.h Mon Jul 16 12:40:42 2007
@@ -31,14 +31,25 @@
* \ref Attribute defines the klass and name value \ref CacheStore
* uses to write an attribute to the database. The same pair is
* required to query the attributes value.
+ *
+ * \c evalShared tells whether the resolvables \c :shared_id should
+ * be evaluated in queries, in case no attribute value is defined.
+ * Some attributes like e.g. \c Summary can be shared between packages
+ * that differ in architecture only. *
*/
struct Attribute
{
- Attribute( const std::string & klass_r, const std::string & name_r )
- : klass(klass_r), name(name_r)
+ enum ShareType { UNIQUE, SHARED };
+
+ Attribute( const std::string & klass_r, const std::string & name_r,
+ ShareType shareType_r = UNIQUE )
+ : klass (klass_r)
+ , name (name_r)
+ , evalShared( shareType_r == SHARED )
{}
std::string klass;
std::string name;
+ bool evalShared;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/cache/CacheAttributes.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheAttributes.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheAttributes.h (original)
+++ trunk/libzypp/zypp/cache/CacheAttributes.h Mon Jul 16 12:40:42 2007
@@ -14,6 +14,17 @@
#include "zypp/cache/Attribute.h"
+/** Define OnMediaLocation attributes using a common prefix for all attributes. */
+#define defineOnMediaLocationAttr(OMLATTRPREFIX,KLASS,ATTRNAMEPREFIX ) \
+ inline const Attribute & OMLATTRPREFIX##MediaNr() { static Attribute a(KLASS,#ATTRNAMEPREFIX"MediaNr"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##Filename() { static Attribute a(KLASS,#ATTRNAMEPREFIX"Filename"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##DownloadSize() { static Attribute a(KLASS,#ATTRNAMEPREFIX"DownloadSize"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##Checksum() { static Attribute a(KLASS,#ATTRNAMEPREFIX"Checksum"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##ChecksumType() { static Attribute a(KLASS,#ATTRNAMEPREFIX"ChecksumType"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##OpenSize() { static Attribute a(KLASS,#ATTRNAMEPREFIX"OpenSize"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##OpenChecksum() { static Attribute a(KLASS,#ATTRNAMEPREFIX"OpenChecksum"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##OpenChecksumType() { static Attribute a(KLASS,#ATTRNAMEPREFIX"OpenChecksumType"); return a; }
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -27,64 +38,67 @@
*/
//@{
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrMessageText() { static Attribute a("Message","text"); return a; }
+ inline const Attribute & attrMessageText() { static Attribute a("Message","text"); return a; }
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrPackageAuthors() { static Attribute a("Package","authors", Attribute::SHARED); return a; }
+ inline const Attribute & attrPackageBuildhost() { static Attribute a("Package","buildhost"); return a; }
+ inline const Attribute & attrPackageChecksumType() { static Attribute a("Package","checksumType"); return a; }
+ inline const Attribute & attrPackageDistribution() { static Attribute a("Package","distribution"); return a; }
+ inline const Attribute & attrPackageGroup() { static Attribute a("Package","group"); return a; }
+ inline const Attribute & attrPackagePackager() { static Attribute a("Package","packager"); return a; }
+ inline const Attribute & attrPackageKeywords() { static Attribute a("Package","keywords"); return a; }
+ inline const Attribute & attrPackageLicense() { static Attribute a("Package","license"); return a; }
+ inline const Attribute & attrPackageOperatingSystem() { static Attribute a("Package","operatingSystem"); return a; }
+ inline const Attribute & attrPackagePostin() { static Attribute a("Package","postin"); return a; }
+ inline const Attribute & attrPackagePostun() { static Attribute a("Package","postun"); return a; }
+ inline const Attribute & attrPackagePrein() { static Attribute a("Package","prein"); return a; }
+ inline const Attribute & attrPackagePreun() { static Attribute a("Package","preun"); return a; }
+ inline const Attribute & attrPackageUrl() { static Attribute a("Package","url"); return a; }
+ inline const Attribute & attrPackageSourcePkgName() { static Attribute a("Package","sourcePkgName"); return a; }
+ inline const Attribute & attrPackageSourcePkgEdition() { static Attribute a("Package","sourcePkgEdition"); return a; }
+ // define attrPackageLocationMediaNr, attrPackageLocationFilename, etc.
+ defineOnMediaLocationAttr( attrPackageLocation, "Package", "location" )
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrPatchAffectsPkgManager() { static Attribute a("Patch","affectsPkgManager"); return a; }
+ inline const Attribute & attrPatchCategory() { static Attribute a("Patch","category"); return a; }
+ inline const Attribute & attrPatchRebootNeeded() { static Attribute a("Patch","rebootNeeded"); return a; }
+ inline const Attribute & attrPatchTimestamp() { static Attribute a("Patch","timestamp"); return a; }
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrPatternCategory() { static Attribute a("Pattern","category"); return a; }
+ inline const Attribute & attrPatternIcon() { static Attribute a("Pattern","icon"); return a; }
+ inline const Attribute & attrPatternIsDefault() { static Attribute a("Pattern","isDefault"); return a; }
+ inline const Attribute & attrPatternOrder() { static Attribute a("Pattern","order"); return a; }
+ inline const Attribute & attrPatternUserVisible() { static Attribute a("Pattern","userVisible"); return a; }
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrProductDistributionEdition() { static Attribute a("Product","distributionEdition"); return a; }
+ inline const Attribute & attrProductDistributionName() { static Attribute a("Product","distributionName"); return a; }
+ inline const Attribute & attrProductExtraUrls() { static Attribute a("Product","extraUrls"); return a; }
+ inline const Attribute & attrProductFlags() { static Attribute a("Product","flags"); return a; }
+ inline const Attribute & attrProductLongName() { static Attribute a("Product","longName"); return a; }
+ inline const Attribute & attrProductOptionalUrls() { static Attribute a("Product","optionalUrls"); return a; }
+ inline const Attribute & attrProductReleasenotesUrl() { static Attribute a("Product","releasenotesUrl"); return a; }
+ inline const Attribute & attrProductShortName() { static Attribute a("Product","shortName"); return a; }
+ inline const Attribute & attrProductUpdateUrls() { static Attribute a("Product","updateUrls"); return a; }
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrResObjectBuildTime() { static Attribute a("ResObject","buildTime"); return a; }
+ inline const Attribute & attrResObjectDelnotify() { static Attribute a("ResObject","delnotify", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectDescription() { static Attribute a("ResObject","description", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectInsnotify() { static Attribute a("ResObject","insnotify", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectInstallOnly() { static Attribute a("ResObject","installOnly"); return a; }
+ inline const Attribute & attrResObjectInstalledSize() { static Attribute a("ResObject","installedSize"); return a; }
+ inline const Attribute & attrResObjectLicenseToConfirm() { static Attribute a("ResObject","licenseToConfirm", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectSummary() { static Attribute a("ResObject","summary", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectVendor() { static Attribute a("ResObject","vendor"); return a; }
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrScriptDoScript() { static Attribute a("Script","doScript"); return a; }
+ // define attrScriptDoScriptLocationMediaNr, attrLocationFilename, etc.
+ defineOnMediaLocationAttr( attrScriptDoScriptLocation, "Script", "doScriptLocation" )
+ inline const Attribute & attrScriptUndoScript() { static Attribute a("Script","undoScript"); return a; }
+ // define attrScriptUndoScriptLocationMediaNr, attrLocationFilename, etc.
+ defineOnMediaLocationAttr( attrScriptUndoScriptLocation, "Script", "undoScriptLocation" )
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrPackageAuthors() { static Attribute a("Package","authors"); return a; }
- inline const Attribute & attrPackageBuildhost() { static Attribute a("Package","buildhost"); return a; }
- inline const Attribute & attrPackageChecksum() { static Attribute a("Package","checksum"); return a; }
- inline const Attribute & attrPackageChecksumType() { static Attribute a("Package","checksumType"); return a; }
- inline const Attribute & attrPackageDistribution() { static Attribute a("Package","distribution"); return a; }
- inline const Attribute & attrPackageGroup() { static Attribute a("Package","group"); return a; }
- inline const Attribute & attrPackageKeywords() { static Attribute a("Package","keywords"); return a; }
- inline const Attribute & attrPackageLicense() { static Attribute a("Package","license"); return a; }
- inline const Attribute & attrPackageLocation() { static Attribute a("Package","location"); return a; }
- inline const Attribute & attrPackageOperatingSystem() { static Attribute a("Package","operatingSystem"); return a; }
- inline const Attribute & attrPackagePostin() { static Attribute a("Package","postin"); return a; }
- inline const Attribute & attrPackagePostun() { static Attribute a("Package","postun"); return a; }
- inline const Attribute & attrPackagePrein() { static Attribute a("Package","prein"); return a; }
- inline const Attribute & attrPackagePreun() { static Attribute a("Package","preun"); return a; }
- inline const Attribute & attrPackageUrl() { static Attribute a("Package","url"); return a; }
- ///////////////////////////////////////////////////////////////////
- inline const Attribute & attrPatchAffectsPkgManager() { static Attribute a("Patch","affectsPkgManager"); return a; }
- inline const Attribute & attrPatchCategory() { static Attribute a("Patch","category"); return a; }
- inline const Attribute & attrPatchRebootNeeded() { static Attribute a("Patch","rebootNeeded"); return a; }
- inline const Attribute & attrPatchTimestamp() { static Attribute a("Patch","timestamp"); return a; }
- ///////////////////////////////////////////////////////////////////
- inline const Attribute & attrPatternCategory() { static Attribute a("Pattern","category"); return a; }
- inline const Attribute & attrPatternIcon() { static Attribute a("Pattern","icon"); return a; }
- inline const Attribute & attrPatternIsDefault() { static Attribute a("Pattern","isDefault"); return a; }
- inline const Attribute & attrPatternOrder() { static Attribute a("Pattern","order"); return a; }
- inline const Attribute & attrPatternUserVisible() { static Attribute a("Pattern","userVisible"); return a; }
- ///////////////////////////////////////////////////////////////////
- inline const Attribute & attrProductDistributionEdition() { static Attribute a("Product","distributionEdition"); return a; }
- inline const Attribute & attrProductDistributionName() { static Attribute a("Product","distributionName"); return a; }
- inline const Attribute & attrProductExtraUrls() { static Attribute a("Product","extraUrls"); return a; }
- inline const Attribute & attrProductFlags() { static Attribute a("Product","flags"); return a; }
- inline const Attribute & attrProductLongName() { static Attribute a("Product","longName"); return a; }
- inline const Attribute & attrProductOptionalUrls() { static Attribute a("Product","optionalUrls"); return a; }
- inline const Attribute & attrProductReleasenotesUrl() { static Attribute a("Product","releasenotesUrl"); return a; }
- inline const Attribute & attrProductShortName() { static Attribute a("Product","shortName"); return a; }
- inline const Attribute & attrProductUpdateUrls() { static Attribute a("Product","updateUrls"); return a; }
- ///////////////////////////////////////////////////////////////////
- inline const Attribute & attrResObjectArchiveSize() { static Attribute a("ResObject","archiveSize"); return a; }
- inline const Attribute & attrResObjectBuildTime() { static Attribute a("ResObject","buildTime"); return a; }
- inline const Attribute & attrResObjectDelnotify() { static Attribute a("ResObject","delnotify"); return a; }
- inline const Attribute & attrResObjectDescription() { static Attribute a("ResObject","description"); return a; }
- inline const Attribute & attrResObjectInsnotify() { static Attribute a("ResObject","insnotify"); return a; }
- inline const Attribute & attrResObjectInstallOnly() { static Attribute a("ResObject","installOnly"); return a; }
- inline const Attribute & attrResObjectInstalledSize() { static Attribute a("ResObject","installedSize"); return a; }
- inline const Attribute & attrResObjectLicenseToConfirm() { static Attribute a("ResObject","licenseToConfirm"); return a; }
- inline const Attribute & attrResObjectSummary() { static Attribute a("ResObject","summary"); return a; }
- inline const Attribute & attrResObjectVendor() { static Attribute a("ResObject","vendor"); return a; }
- ///////////////////////////////////////////////////////////////////
- inline const Attribute & attrScriptDoScript() { static Attribute a("Script","doScript"); return a; }
- inline const Attribute & attrScriptDoScriptChecksum() { static Attribute a("Script","doScriptChecksum"); return a; }
- inline const Attribute & attrScriptDoScriptChecksumType() { static Attribute a("Script","doScriptChecksumType"); return a; }
- inline const Attribute & attrScriptDoScriptLocation() { static Attribute a("Script","doScriptLocation"); return a; }
- inline const Attribute & attrScriptUndoScript() { static Attribute a("Script","undoScript"); return a; }
- inline const Attribute & attrScriptUndoScriptChecksum() { static Attribute a("Script","undoScriptChecksum"); return a; }
- inline const Attribute & attrScriptUndoScriptChecksumType(){ static Attribute a("Script","undoScriptChecksumType"); return a; }
- inline const Attribute & attrScriptUndoScriptLocation() { static Attribute a("Script","undoScriptLocation"); return a; }
+ // define attrSrcPackageLocationMediaNr, attrSrcPackageLocationFilename, etc.
+ defineOnMediaLocationAttr( attrSrcPackageLocation, "SrcPackage", "location" )
///////////////////////////////////////////////////////////////////
//@}
Modified: trunk/libzypp/zypp/cache/CacheInitializer.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheInitializer.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheInitializer.cc (original)
+++ trunk/libzypp/zypp/cache/CacheInitializer.cc Mon Jul 16 12:40:42 2007
@@ -17,11 +17,9 @@
#include "zypp/cache/CacheInitializer.h"
#include "zypp/target/store/PersistentStorage.h"
#include "zypp/cache/Utils.h"
-
+#include "zypp/PathInfo.h"
#include "sqlite-schema.h"
-#define ZYPP_DB_FILE "/var/lib/zypp/zypp.db"
-
using namespace sqlite3x;
using namespace std;
using zypp::debug::Measure;
@@ -36,13 +34,15 @@
struct CacheInitializer::Impl
{
Impl( const Pathname &root_r )
- : root(root_r), just_initialized(false)
+ : root(root_r), just_initialized(false),
+ just_reinitialized(false)
{
}
//typedef std::map MediaMap
shared_ptrsqlite3x::sqlite3_connection con;
Pathname root;
bool just_initialized;
+ bool just_reinitialized;
};
CacheInitializer::CacheInitializer( const Pathname &root_r, const Pathname &db_file )
@@ -51,17 +51,47 @@
try
{
_pimpl->con.reset( new sqlite3_connection( ( _pimpl->root + db_file).asString().c_str()) );
-
+ _pimpl->con->executenonquery("begin;");
if( ! tablesCreated() )
{
createTables();
_pimpl->just_initialized = true;
- _pimpl->con->close();
- MIL << "Source cache initialized" << std::endl;
+ //_pimpl->con->close();
+ MIL << "Repository cache initialized" << std::endl;
}
else
{
- MIL << "Source cache already initialized" << std::endl;
+ int version = _pimpl->con->executeint("select version from db_info;");
+ if ( version != ZYPP_CACHE_SCHEMA_VERSION )
+ {
+ WAR << "cache schema version is different from ZYpp cache version" << endl;
+ // FIXME should this code ask first?
+ sqlite3_command tables_cmd( *_pimpl->con, "select name from sqlite_master where type='table';");
+ sqlite3_reader reader = tables_cmd.executereader();
+ list<string> tables;
+ while ( reader.read() )
+ {
+ string tablename = reader.getstring(0);
+ if ( tablename != "sqlite_sequence" )
+ tables.push_back(tablename);
+ }
+ reader.close();
+
+ for ( list<string>::const_iterator it = tables.begin();
+ it != tables.end();
+ ++it )
+ {
+ MIL << "Removing table " << *it << endl;
+ _pimpl->con->execute("drop table " + (*it) + ";");
+ }
+
+ createTables();
+ _pimpl->just_reinitialized = true;
+ MIL << "Repository cache re-initialized" << std::endl;
+ return;
+ }
+
+ MIL << "Repository cache already initialized" << std::endl;
}
}
catch( const exception &ex )
@@ -69,7 +99,8 @@
ZYPP_RETHROW(Exception(ex.what()));
//ERR << "Exception Occured: " << ex.what() << endl;
}
-
+ _pimpl->con->executenonquery("commit;");
+ _pimpl->con->close();
}
bool CacheInitializer::justInitialized() const
@@ -77,6 +108,11 @@
return _pimpl->just_initialized;
}
+bool CacheInitializer::justReinitialized() const
+{
+ return _pimpl->just_reinitialized;
+}
+
CacheInitializer::~CacheInitializer()
{
@@ -92,17 +128,20 @@
void CacheInitializer::createTables()
{
- Measure timer("Create database tables");
+ //Measure timer("Create database tables");
MIL << "Initializing cache schema..." << endl;
- sqlite3_transaction trans(*_pimpl->con);
- {
+ //sqlite3_transaction trans(*_pimpl->con);
+ //{
string sql( schemaData, _schemaData_size);
//ERR << "Executing " << statements[i] << endl;
MIL << "Schema size: " << sql.size() << endl;
_pimpl->con->execute(sql.c_str());
- }
- trans.commit();
- timer.elapsed();
+ sqlite3_command version_cmd( *_pimpl->con, "insert into db_info (version) values(:version);");
+ version_cmd.bind(":version", ZYPP_CACHE_SCHEMA_VERSION);
+ version_cmd.executenonquery();
+ //}
+ //trans.commit();
+ //timer.elapsed();
}
std::ostream & CacheInitializer::dumpOn( std::ostream & str ) const
Modified: trunk/libzypp/zypp/cache/CacheInitializer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheInitializer.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheInitializer.h (original)
+++ trunk/libzypp/zypp/cache/CacheInitializer.h Mon Jul 16 12:40:42 2007
@@ -19,6 +19,8 @@
#include "zypp/Pathname.h"
#include "zypp/cache/sqlite3x/sqlite3x.hpp"
+#define ZYPP_CACHE_SCHEMA_VERSION 1000
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -43,10 +45,22 @@
virtual ~CacheInitializer();
/**
+ * \short Has the cache been reinitialized?
+ *
* only true when cache was not initialized before
* and was just initialized with success
*/
bool justInitialized() const;
+
+ /**
+ * \short Has the cache been reinitialized?
+ *
+ * This is true when the cache was already initialized
+ * but an old schema was detected, so the cache
+ * was reinitialized in order to get the new schema
+ */
+ bool justReinitialized() const;
+
protected:
bool tablesCreated() const;
void createTables();
Modified: trunk/libzypp/zypp/cache/CacheStore.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheStore.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheStore.cc (original)
+++ trunk/libzypp/zypp/cache/CacheStore.cc Mon Jul 16 12:40:42 2007
@@ -10,6 +10,7 @@
#include "zypp/cache/CacheInitializer.h"
#include "zypp/cache/CacheStore.h"
#include "zypp/cache/CacheException.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp;
@@ -20,6 +21,22 @@
using zypp::debug::Measure;
+/** Append OnMediaLocation attributes to resolvable with ID.
+ * Pass the OnMediaLocation attributes common prefix as 2nd arg. This macro
+ * assumes that the attribute names follow this schema:
+*/
+#define appendOnMediaLocation(ID,OMLATTRPREFIX,OML) \
+do { \
+ appendNumericAttribute( ID, OMLATTRPREFIX##MediaNr(), OML.medianr() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##Filename(), OML.filename().asString() ); \
+ appendNumericAttribute( ID, OMLATTRPREFIX##DownloadSize(), OML.downloadSize() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##ChecksumType(), OML.checksum().type() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##Checksum(), OML.checksum().checksum() ); \
+ appendNumericAttribute( ID, OMLATTRPREFIX##OpenSize(), OML.openSize() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##OpenChecksumType(), OML.openChecksum().type() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##OpenChecksum(), OML.openChecksum().checksum() );\
+} while(false)
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -90,7 +107,7 @@
append_other_dependency_cmd.reset( new sqlite3_command( con, "insert into other_capabilities ( resolvable_id, dependency_type, refers_kind, value ) values ( :resolvable_id, :dependency_type, :refers_kind, :value );" ));
- append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :repository_id );" ));
+ append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, shared_id, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :shared_id, :repository_id );" ));
count_shared_cmd.reset( new sqlite3_command( con, "select count(id) from resolvables where shared_id=:rid;" ));
@@ -201,45 +218,52 @@
void CacheStore::appendResObjectAttributes( const data::RecordId &rid,
const data::ResObject_Ptr & res )
{
- appendTranslatedStringAttribute( rid, "ResObject", "description", res->description );
- appendTranslatedStringAttribute( rid, "ResObject", "summary", res->summary );
- appendNumericAttribute( rid, "ResObject", "installedSize", res->installedSize );
- appendNumericAttribute( rid, "ResObject", "buildTime", res->buildTime );
- appendBooleanAttribute( rid, "ResObject", "installOnly", res->installOnly );
- appendStringAttribute( rid, "ResObject", "vendor", res->vendor );
- appendTranslatedStringAttribute( rid, "ResObject", "licenseToConfirm", res->licenseToConfirm );
- appendTranslatedStringAttribute( rid, "ResObject", "insnotify", res->insnotify );
- appendTranslatedStringAttribute( rid, "ResObject", "delnotify", res->delnotify );
+ appendTranslatedStringAttribute( rid, attrResObjectDescription(), res->description );
+ appendTranslatedStringAttribute( rid, attrResObjectSummary(), res->summary );
+ appendNumericAttribute( rid, attrResObjectInstalledSize(), res->installedSize );
+ appendNumericAttribute( rid, attrResObjectBuildTime(), res->buildTime );
+ appendBooleanAttribute( rid, attrResObjectInstallOnly(), res->installOnly );
+ appendStringAttribute( rid, attrResObjectVendor(), res->vendor );
+ appendTranslatedStringAttribute( rid, attrResObjectLicenseToConfirm(), res->licenseToConfirm );
+ appendTranslatedStringAttribute( rid, attrResObjectInsnotify(), res->insnotify );
+ appendTranslatedStringAttribute( rid, attrResObjectDelnotify(), res->delnotify );
}
void CacheStore::appendPackageBaseAttributes( const RecordId & pkgid,
const data::Packagebase_Ptr & package )
{
- appendStringAttribute( pkgid, "Package", "checksum", package->repositoryLocation.fileChecksum.checksum() );
- appendStringAttribute( pkgid, "Package", "checksumType", package->repositoryLocation.fileChecksum.type() );
- appendStringAttribute( pkgid, "Package", "buildhost", package->buildhost );
- appendStringAttribute( pkgid, "Package", "distribution", package->distribution );
- appendStringAttribute( pkgid, "Package", "license", package->license );
- appendStringAttribute( pkgid, "Package", "group", package->packager );
- appendStringAttribute( pkgid, "Package", "url", package->url );
- appendStringAttribute( pkgid, "Package", "operatingSystem", package->operatingSystem );
- appendStringAttribute( pkgid, "Package", "prein", package->prein );
- appendStringAttribute( pkgid, "Package", "postin", package->postin );
- appendStringAttribute( pkgid, "Package", "preun", package->preun );
- appendStringAttribute( pkgid, "Package", "postun", package->postun );
- appendStringContainerAttribute( pkgid, "Package", "keywords", package->keywords.begin(), package->keywords.end() );
- appendStringContainerAttribute( pkgid, "Package", "authors", package->authors.begin(), package->authors.end() );
- appendStringAttribute( pkgid, "Package", "location", package->repositoryLocation.filePath.asString() );
+ appendStringAttribute( pkgid, attrPackageBuildhost(), package->buildhost );
+ appendStringAttribute( pkgid, attrPackageDistribution(), package->distribution );
+ appendStringAttribute( pkgid, attrPackageLicense(), package->license );
+ appendStringAttribute( pkgid, attrPackageGroup(), package->group );
+ appendStringAttribute( pkgid, attrPackagePackager(), package->packager );
+ appendStringAttribute( pkgid, attrPackageUrl(), package->url );
+ appendStringAttribute( pkgid, attrPackageOperatingSystem(), package->operatingSystem );
+ appendStringAttribute( pkgid, attrPackagePrein(), package->prein );
+ appendStringAttribute( pkgid, attrPackagePostin(), package->postin );
+ appendStringAttribute( pkgid, attrPackagePreun(), package->preun );
+ appendStringAttribute( pkgid, attrPackagePostun(), package->postun );
+ appendStringContainerAttribute( pkgid, attrPackageKeywords(), package->keywords.begin(), package->keywords.end() );
+ appendStringContainerAttribute( pkgid, attrPackageAuthors(), package->authors.begin(), package->authors.end() );
+
+ appendOnMediaLocation( pkgid, attrPackageLocation, package->repositoryLocation );
}
RecordId CacheStore::consumePackage( const RecordId & repository_id,
- const data::Package_Ptr & package )
+ const data::Package_Ptr & package )
{
RecordId id = appendResolvable( repository_id, ResTraits<Package>::kind,
NVRA( package->name, package->edition, package->arch ), package->deps );
appendResObjectAttributes( id, package );
appendPackageBaseAttributes( id, package );
+
+ if ( ! package->srcPackageIdent.name.empty() )
+ {
+ appendStringAttribute( id, attrPackageSourcePkgName(), package->srcPackageIdent.name );
+ appendStringAttribute( id, attrPackageSourcePkgEdition(), package->srcPackageIdent.edition.asString() );
+ }
+
return id;
}
@@ -249,8 +273,8 @@
RecordId id = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
NVRA( package->name, package->edition, package->arch ), package->deps );
appendResObjectAttributes( id, package );
- appendPackageBaseAttributes( id, package );
-#warning TBD WRONG IMPLEMENTATION
+
+ appendOnMediaLocation( id, attrSrcPackageLocation, package->repositoryLocation );
return id;
}
@@ -264,10 +288,10 @@
appendResObjectAttributes( id, patch );
// patch attributes
- appendNumericAttribute( id, "Patch", "timestamp", patch->timestamp );
- appendStringAttribute( id, "Patch", "category", patch->category );
- appendBooleanAttribute( id, "Patch", "rebootNeeded", patch->rebootNeeded );
- appendBooleanAttribute( id, "Patch", "affectsPkgManager", patch->affectsPkgManager );
+ appendNumericAttribute( id, attrPatchTimestamp(), patch->timestamp );
+ appendStringAttribute( id, attrPatchCategory(), patch->category );
+ appendBooleanAttribute( id, attrPatchRebootNeeded(), patch->rebootNeeded );
+ appendBooleanAttribute( id, attrPatchAffectsPkgManager(), patch->affectsPkgManager );
DBG << "got patch " << patch->name << ", atoms: ";
@@ -333,7 +357,7 @@
NVRA( message->name, message->edition, message->arch ), message->deps );
appendResObjectAttributes( id, message );
- appendTranslatedStringAttribute( id, "Message", "text", message->text );
+ appendTranslatedStringAttribute( id, attrMessageText(), message->text );
return id;
}
@@ -344,14 +368,10 @@
NVRA( script->name, script->edition, script->arch ), script->deps );
appendResObjectAttributes( id, script );
- appendStringAttribute( id, "Script", "doScript", script->doScript );
- appendStringAttribute( id, "Script", "doScriptLocation", script->doScriptLocation.filePath.asString() );
- appendStringAttribute( id, "Script", "doScriptChecksum", script->doScriptLocation.fileChecksum.checksum() );
- appendStringAttribute( id, "Script", "doScriptChecksumType", script->doScriptLocation.fileChecksum.type() );
- appendStringAttribute( id, "Script", "undoScript", script->undoScript );
- appendStringAttribute( id, "Script", "undoScriptLocation", script->undoScriptLocation.filePath.asString() );
- appendStringAttribute( id, "Script", "undoScriptChecksum", script->undoScriptLocation.fileChecksum.checksum() );
- appendStringAttribute( id, "Script", "undoScriptChecksumType", script->undoScriptLocation.fileChecksum.type() );
+ appendStringAttribute( id, attrScriptDoScript(), script->doScript );
+ appendOnMediaLocation( id, attrScriptDoScriptLocation, script->doScriptLocation );
+ appendStringAttribute( id, attrScriptUndoScript(), script->undoScript );
+ appendOnMediaLocation( id, attrScriptUndoScriptLocation, script->undoScriptLocation );
return id;
}
@@ -362,11 +382,11 @@
NVRA( pattern->name, pattern->edition, pattern->arch ), pattern->deps );
appendResObjectAttributes( id, pattern );
- appendBooleanAttribute( id, "Pattern", "isDefault", pattern->isDefault );
- appendBooleanAttribute( id, "Pattern", "userVisible", pattern->userVisible );
- appendTranslatedStringAttribute( id, "Pattern", "category", pattern->category );
- appendStringAttribute( id, "Pattern", "icon", pattern->icon );
- appendStringAttribute( id, "Pattern", "order", pattern->order );
+ appendBooleanAttribute( id, attrPatternIsDefault(), pattern->isDefault );
+ appendBooleanAttribute( id, attrPatternUserVisible(), pattern->userVisible );
+ appendTranslatedStringAttribute( id, attrPatternCategory(), pattern->category );
+ appendStringAttribute( id, attrPatternIcon(), pattern->icon );
+ appendStringAttribute( id, attrPatternOrder(), pattern->order );
return id;
}
@@ -377,15 +397,15 @@
NVRA( product->name, product->edition, product->arch ), product->deps );
appendResObjectAttributes( id, product );
- appendTranslatedStringAttribute( id, "Product", "shortName", product->shortName );
- appendTranslatedStringAttribute( id, "Product", "longName", product->longName );
- appendStringContainerAttribute( id, "Product", "flags", product->flags.begin(), product->flags.end() );
- appendStringAttribute( id, "Product", "releasenotesUrl", product->releasenotesUrl.asString() );
- appendStringContainerAttribute( id, "Product", "updateUrls", product->updateUrls );
- appendStringContainerAttribute( id, "Product", "extraUrls", product->extraUrls );
- appendStringContainerAttribute( id, "Product", "optionalUrls", product->optionalUrls );
- appendStringAttribute( id, "Product", "distributionName", product->distributionName );
- appendStringAttribute( id, "Product", "distributionEdition", product->distributionEdition.asString() );
+ appendTranslatedStringAttribute( id, attrProductShortName(), product->shortName );
+ appendTranslatedStringAttribute( id, attrProductLongName(), product->longName );
+ appendStringContainerAttribute( id, attrProductFlags(), product->flags.begin(), product->flags.end() );
+ appendStringAttribute( id, attrProductReleasenotesUrl(), product->releasenotesUrl.asString() );
+ appendStringContainerAttribute( id, attrProductUpdateUrls(), product->updateUrls );
+ appendStringContainerAttribute( id, attrProductExtraUrls(), product->extraUrls );
+ appendStringContainerAttribute( id, attrProductOptionalUrls(), product->optionalUrls );
+ appendStringAttribute( id, attrProductDistributionName(), product->distributionName );
+ appendStringAttribute( id, attrProductDistributionEdition(), product->distributionEdition.asString() );
return id;
}
@@ -407,11 +427,35 @@
return data::noRecordId;
}
+void CacheStore::updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r )
+{
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectSummary(), data_r->summary );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectDescription(), data_r->description );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectLicenseToConfirm(), data_r->licenseToConfirm );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectInsnotify(), data_r->insnotify );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectDelnotify(), data_r->delnotify );
+}
+
RecordId CacheStore::appendResolvable( const RecordId &repository_id,
const Resolvable::Kind &kind,
const NVRA &nvra,
const data::Dependencies &deps )
{
+ return appendResolvable( repository_id,
+ kind,
+ nvra,
+ deps,
+ data::noRecordId );
+}
+
+data::RecordId
+ CacheStore::appendResolvable( const data::RecordId &repository_id,
+ const Resolvable::Kind &kind,
+ const NVRA &nvra,
+ const data::Dependencies &deps,
+ const data::RecordId &shared_id )
+{
_pimpl->append_resolvable_cmd->bind( ":name", nvra.name );
_pimpl->append_resolvable_cmd->bind( ":version", nvra.edition.version() );
_pimpl->append_resolvable_cmd->bind( ":release", nvra.edition.release() );
@@ -420,6 +464,11 @@
_pimpl->append_resolvable_cmd->bind( ":kind", lookupOrAppendType("kind", kind.asString()) );
_pimpl->append_resolvable_cmd->bind( ":repository_id", repository_id );
+ if ( shared_id == data::noRecordId )
+ _pimpl->append_resolvable_cmd->bind(":shared_id");
+ else
+ _pimpl->append_resolvable_cmd->bind( ":shared_id", shared_id );
+
_pimpl->append_resolvable_cmd->executenonquery();
long long id = _pimpl->con.insertid();
@@ -430,8 +479,7 @@
_pimpl->insert_resolvable_in_repository_cmd->bind(":resolvable_id", id);
_pimpl->insert_resolvable_in_repository_cmd->executenonquery();*/
- return static_cast<RecordId>(id);
- return 1;
+ return id;
}
void CacheStore::appendDependencies( const RecordId &resolvable_id, const data::Dependencies &deps )
@@ -481,31 +529,6 @@
}
}
-// RecordId CacheStore::lookupOrAppendNamedDependencyEntry( const RecordId name_id, const Edition &edition, const zypp::Rel &rel )
-// {
-// _pimpl->select_named_dependency_cmd->bind( ":name_id", name_id);
-// _pimpl->select_named_dependency_cmd->bind( ":version", edition.version() );
-// _pimpl->select_named_dependency_cmd->bind( ":release", edition.release() );
-// _pimpl->select_named_dependency_cmd->bind( ":epoch", static_cast<int>( edition.epoch() ) );
-// _pimpl->select_named_dependency_cmd->bind( ":relation", zypp_rel2db_rel( rel ) );
-// long long id = 0;
-// try {
-// id = _pimpl->select_named_dependency_cmd->executeint64();
-// }
-// catch ( const sqlite3x::database_error &e )
-// {
-// // does not exist
-// _pimpl->append_named_dependency_entry_cmd->bind( ":name_id", name_id);
-// _pimpl->append_named_dependency_entry_cmd->bind( ":version", edition.version() );
-// _pimpl->append_named_dependency_entry_cmd->bind( ":release", edition.release() );
-// _pimpl->append_named_dependency_entry_cmd->bind( ":epoch", static_cast<int>( edition.epoch() ) );
-// _pimpl->append_named_dependency_entry_cmd->bind( ":relation", zypp_rel2db_rel( rel ) );
-// _pimpl->append_named_dependency_entry_cmd->executenonquery();
-// id = _pimpl->con.insertid();
-// return static_cast<RecordId>(id);
-// }
-// return static_cast<RecordId>(id);
-// }
void CacheStore::appendNamedDependency( const RecordId &resolvable_id, zypp::Dep deptype, capability::NamedCap::Ptr cap )
{
@@ -558,6 +581,9 @@
if ( !cap )
ZYPP_THROW(Exception("Null HAL capability"));
+ MIL << "HAL cap [ rid: " << resolvable_id << " | deptype: " << deptype << " | cap: "
+ << cap << endl;
+
_pimpl->append_hal_dependency_cmd->bind( ":resolvable_id", resolvable_id );
_pimpl->append_hal_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
_pimpl->append_hal_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
@@ -603,7 +629,7 @@
_pimpl->append_other_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
_pimpl->append_other_dependency_cmd->bind( ":value", cap->encode());
- _pimpl->append_hal_dependency_cmd->executenonquery();
+ _pimpl->append_other_dependency_cmd->executenonquery();
//delete cmd;
}
@@ -615,10 +641,10 @@
//! \todo what's this? _pimpl->insert_patchrpm_cmd->bind(":media_nr", ???);
_pimpl->insert_patchrpm_cmd->bind(":repository_id", repository_id);
- _pimpl->insert_patchrpm_cmd->bind(":location", prpm->location.filePath.asString());
- _pimpl->insert_patchrpm_cmd->bind(":checksum", prpm->location.fileChecksum.checksum());
+ _pimpl->insert_patchrpm_cmd->bind(":location", prpm->location.filename().asString());
+ _pimpl->insert_patchrpm_cmd->bind(":checksum", prpm->location.checksum().checksum());
//! \todo checksum type
- _pimpl->insert_patchrpm_cmd->bind(":download_size", static_castByteCount::SizeType(prpm->location.fileSize));
+ _pimpl->insert_patchrpm_cmd->bind(":download_size", static_castByteCount::SizeType(prpm->location.downloadSize()));
_pimpl->insert_patchrpm_cmd->bind(":build_time", prpm->buildTime.asSeconds());
_pimpl->insert_patchrpm_cmd->executenonquery();
@@ -645,10 +671,10 @@
//! \todo what's this? _pimpl->insert_deltarpm_cmd->bind(":media_nr", ???);
_pimpl->insert_deltarpm_cmd->bind(":repository_id", repository_id);
- _pimpl->insert_deltarpm_cmd->bind(":location", drpm->location.filePath.asString());
- _pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.fileChecksum.checksum());
+ _pimpl->insert_deltarpm_cmd->bind(":location", drpm->location.filename().asString());
+ _pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.checksum().checksum());
//! \todo checksum type
- _pimpl->insert_deltarpm_cmd->bind(":download_size", static_castByteCount::SizeType(drpm->location.fileSize));
+ _pimpl->insert_deltarpm_cmd->bind(":download_size", static_castByteCount::SizeType(drpm->location.downloadSize()));
_pimpl->insert_deltarpm_cmd->bind(":build_time", drpm->buildTime.asSeconds());
_pimpl->insert_deltarpm_cmd->bind(":baseversion_version", drpm->baseVersion.edition.version());
@@ -665,26 +691,6 @@
}
-// RecordId CacheStore::appendDependencyEntry( const RecordId &resolvable_id, zypp::Dep deptype, const Resolvable::Kind &refers )
-// {
-// //DBG << "rid: " << resolvable_id << " deptype: " << deptype << " " << "refers: " << refers << endl;
-// _pimpl->insert_dependency_entry_cmd->bind( ":resolvable_id", resolvable_id );
-//
-// db::DependencyType dt = zypp_deptype2db_deptype(deptype);
-// if ( dt == db::DEP_TYPE_UNKNOWN )
-// {
-// ZYPP_THROW(Exception("Unknown depenency type"));
-// }
-//
-// _pimpl->insert_dependency_entry_cmd->bind( ":dependency_type", zypp_deptype2db_deptype(deptype) );
-// _pimpl->insert_dependency_entry_cmd->bind( ":refers_kind", zypp_kind2db_kind(refers) );
-//
-// _pimpl->insert_dependency_entry_cmd->executenonquery();
-// //delete cmd;
-// long long id = _pimpl->con.insertid();
-// return static_cast<RecordId>(id);
-// }
-
RecordId CacheStore::lookupOrAppendFile( const Pathname &path )
{
RecordId dir_name_id = lookupOrAppendDirName(path.dirname().asString());
@@ -1029,8 +1035,7 @@
// don't bother with writing if the string is empty
if (text.empty()) return;
- RecordId lang_id = lookupOrAppendType("lang",
- locale.code().empty() ? "none" : locale.code() );
+ RecordId lang_id = lookupOrAppendType("lang", locale.code() );
RecordId type_id = lookupOrAppendType( klass, name );
appendStringAttribute( resolvable_id, lang_id, type_id, text );
}
Modified: trunk/libzypp/zypp/cache/CacheStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheStore.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheStore.h (original)
+++ trunk/libzypp/zypp/cache/CacheStore.h Mon Jul 16 12:40:42 2007
@@ -28,6 +28,7 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/RepoStatus.h"
#include "zypp/ProgressData.h"
+#include "zypp/cache/Attribute.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -72,8 +73,10 @@
*/
void commit();
+ /** \name Implementation of the \ref ResolvableDataConsumer interface. */
+ //@{
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a package, inserting it in the cache, under
* \param repository_id ownership.
@@ -83,7 +86,7 @@
const data::Package_Ptr & package);
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a source package, inserting it in the cache, under
* \param catalog_id ownership.
@@ -93,7 +96,7 @@
const data::SrcPackage_Ptr & srcpackage );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a patch, inserting it in the cache, under
* \param repository_id ownership.
@@ -103,7 +106,7 @@
const data::Patch_Ptr & patch );
/**
- * Implementation of the \ref ResolvableConsumer interface.
+ * Implementation of the \ref ResolvableDataConsumer interface.
*
* Consume a package atom, inserting it in the cache, under
* \a repository_id ownership.
@@ -118,7 +121,7 @@
const data::PackageAtom_Ptr & atom );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a message, inserting it in the cache, under
* \param repository_id ownership.
@@ -128,7 +131,7 @@
const data::Message_Ptr & message);
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a script, inserting it in the cache, under
* \param repository_id ownership.
@@ -138,7 +141,7 @@
const data::Script_Ptr & script);
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a pattern, inserting it in the cache, under
* \param repository_id ownership.
@@ -148,7 +151,7 @@
const data::Pattern_Ptr & pattern );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a product, inserting it in the cache, under
* \param repository_id ownership.
@@ -158,7 +161,7 @@
const data::Product_Ptr & product );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume changelog of a resolvable, inserting it in the cache.
* \param repository_id ownership.
@@ -171,7 +174,7 @@
const Changelog & changelog );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume filelist of a resolvable, inserting it in the cache.
* \param repository_id ownership.
@@ -184,6 +187,18 @@
const data::Filenames & filenames );
/**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Update a packages language specific data (summary, description,
+ * EULA, ins/delnotify).
+ * \param resolvable_id resolvable to be updated
+ * \param data_r Package data
+ */
+ virtual void updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r );
+ //@}
+ public:
+ /**
* Appends a resolvable to the store.
*
* You have to specify with \a kind of resolvable are you inserting
@@ -213,6 +228,21 @@
const data::Dependencies &deps );
/**
+ * \short Appends a resolvable, and sets shared data with another one
+ *
+ * \see appendResolvable
+ * \param shared_id Resolvable that provides data in case
+ * this one does not provide an attribute
+ *
+ * \note Not all attributes can be shared. \ref shared_id is just
+ * a hint for the queries.
+ */
+ data::RecordId appendResolvable( const data::RecordId &repository_id,
+ const Resolvable::Kind &kind,
+ const NVRA &nvra,
+ const data::Dependencies &deps,
+ const data::RecordId &shared_id );
+ /**
* Adds dependencies to the store
*
* A map of dependency lists has to be specified. The map contains
@@ -385,6 +415,9 @@
*/
data::RecordId lookupOrAppendType( const std::string &klass,
const std::string &name );
+ /** \overload */
+ data::RecordId lookupOrAppendType( const Attribute &attr )
+ { return lookupOrAppendType( attr.klass, attr.name ); }
/**
* Returns the record id of a repository (Source)
@@ -426,6 +459,11 @@
const std::string &klass,
const std::string &name,
int value );
+ /** \overload */
+ void appendNumericAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ int value )
+ { appendNumericAttribute( resolvable_id, attr.klass, attr.name, value ); }
/**
* Append a translated string value to a resolvable
@@ -438,6 +476,11 @@
const std::string &klass,
const std::string &name,
const TranslatedText &text );
+ /** \overload */
+ void appendTranslatedStringAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ const TranslatedText &text )
+ { appendTranslatedStringAttribute( resolvable_id, attr.klass, attr.name, text ); }
/**
* Append a string value to a resolvable
@@ -452,6 +495,12 @@
const std::string &klass,
const std::string &name,
const std::string &text );
+ /** \overload */
+ void appendStringAttributeTranslation( const data::RecordId &resolvable_id,
+ const Locale &locale,
+ const Attribute& attr,
+ const std::string &text )
+ { appendStringAttributeTranslation( resolvable_id, locale, attr.klass, attr.name, text ); }
/**
* Append a string value to a resolvable
@@ -464,6 +513,11 @@
const std::string &klass,
const std::string &name,
const std::string &value );
+ /** \overload */
+ void appendStringAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ const std::string &value )
+ { appendStringAttribute( resolvable_id, attr.klass, attr.name, value ); }
/**
* Append a string value to a resolvable
@@ -475,7 +529,6 @@
const data::RecordId &type_id,
const std::string &value );
-
/**
* Append strings from _Iterator to a resolvable.
*
@@ -501,6 +554,13 @@
std::string value = str::join(begin, end, ZConfig().cacheDBSplitJoinSeparator());
appendStringAttribute( resolvable_id, klass, name, value );
}
+ /** \overload */
+ template <class _Iterator>
+ void appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ _Iterator begin,
+ _Iterator end )
+ { appendStringContainerAttribute( resolvable_id, attr.klass, attr.name, begin, end ); }
/**
* Append strings from a _Container to a resolvable.
@@ -516,6 +576,12 @@
const std::string &name,
const _Container & container )
{ appendStringContainerAttribute( resolvable_id, klass, name, container.begin(), container.end() ); }
+ /** \overload */
+ template <class _Container>
+ void appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ const _Container & container )
+ { appendStringContainerAttribute( resolvable_id, attr.klass, attr.name, container ); }
/**
* Update a known repository checksum and timestamp
@@ -676,6 +742,12 @@
const std::string & klass,
const std::string & name,
bool value);
+ /** \overload */
+ void appendBooleanAttribute( const data::RecordId & resolvable_id,
+ const Attribute& attr,
+ bool value)
+ { appendBooleanAttribute( resolvable_id, attr.klass, attr.name, value ); }
+
/** \name Detail Attributes Inserters
* These functions are used by ResolvableConsumer interface functions
Modified: trunk/libzypp/zypp/cache/ResolvableQuery.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/ResolvableQuery.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/ResolvableQuery.cc (original)
+++ trunk/libzypp/zypp/cache/ResolvableQuery.cc Mon Jul 16 12:40:42 2007
@@ -1,6 +1,7 @@
#include <iterator>
#include <algorithm>
-
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/Logger.h"
#include "zypp/cache/CacheTypes.h"
#include "zypp/cache/ResolvableQuery.h"
#include "zypp/Package.h"
@@ -8,25 +9,44 @@
using namespace sqlite3x;
using namespace std;
+using namespace zypp;
-namespace zypp { namespace cache {
+typedef shared_ptr sqlite3_command_ptr;
+namespace zypp { namespace cache {
struct ResolvableQuery::Impl
{
Pathname _dbdir;
string _fields;
CacheTypes _type_cache;
-
+ sqlite3_connection _con;
+ sqlite3_command_ptr _cmd_attr_str;
+ sqlite3_command_ptr _cmd_attr_tstr;
+ sqlite3_command_ptr _cmd_attr_num;
+
Impl( const Pathname &dbdir)
: _dbdir(dbdir)
- , _type_cache(dbdir)
+ , _type_cache(dbdir)
{
+ _con.open((dbdir + "zypp.db").asString().c_str());
+ _con.executenonquery("PRAGMA cache_size=8000;");
+
+ _cmd_attr_tstr.reset( new sqlite3_command( _con, "select a.text, l.name from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and t.class=:tclass and t.name=:tname;") );
+
+
+ _cmd_attr_str.reset( new sqlite3_command( _con, "select a.text from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and l.name=:lname and t.class=:tclass and t.name=:tname;"));
+
+
+ _cmd_attr_num.reset( new sqlite3_command( _con, "select a.value from numeric_attributes a,types t where a.weak_resolvable_id=:rid and a.attr_id=t.id and t.class=:tclass and t.name=:tname;"));
+
+ MIL << "Creating Resolvable query impl" << endl;
_fields = "id, name, version, release, epoch, arch, kind, installed_size, archive_size, install_only, build_time, install_time, repository_id";
}
~Impl()
{
+ MIL << "Destroying Resolvable query impl" << endl;
}
data::ResObject_Ptr fromRow( sqlite3_reader &reader )
@@ -83,14 +103,8 @@
const std::string &name,
const std::string &default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryStringAttributeTranslationInternal( con, record_id, Locale(), klass, name, default_value);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ string value;
+ return queryStringAttributeTranslationInternal( _con, record_id, Locale(), klass, name, default_value);
}
@@ -100,14 +114,7 @@
const std::string &name,
const std::string &default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryStringAttributeTranslationInternal( con, record_id, locale, klass, name, default_value );
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return queryStringAttributeTranslationInternal( _con, record_id, locale, klass, name, default_value );
}
@@ -116,14 +123,7 @@
const std::string &name,
const TranslatedText &default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryTranslatedStringAttributeInternal( con, record_id, klass, name, default_value );
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return queryTranslatedStringAttributeInternal( _con, record_id, klass, name, default_value );
}
@@ -132,14 +132,7 @@
const std::string &name,
bool default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryNumericAttributeInternal( con, record_id, klass, name, default_value);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return ( queryNumericAttributeInternal( _con, record_id, klass, name, default_value) > 0 );
}
int queryNumericAttribute( const data::RecordId &record_id,
@@ -147,14 +140,7 @@
const std::string &name,
int default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryNumericAttributeInternal( con, record_id, klass, name, default_value);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return queryNumericAttributeInternal( _con, record_id, klass, name, default_value);
}
private:
@@ -165,19 +151,17 @@
const std::string &name,
int default_value )
{
- con.executenonquery("BEGIN;");
- sqlite3_command cmd( con, "select a.value from numeric_attributes a,types t where a.weak_resolvable_id=:rid and a.attr_id=t.id and t.class=:tclass and t.name=:tname;");
+ //con.executenonquery("BEGIN;");
+ _cmd_attr_num->bind(":rid", record_id);
- cmd.bind(":rid", record_id);
+ _cmd_attr_num->bind(":tclass", klass);
+ _cmd_attr_num->bind(":tname", name);
- cmd.bind(":tclass", klass);
- cmd.bind(":tname", name);
-
- sqlite3_reader reader = cmd.executereader();
+ sqlite3_reader reader = _cmd_attr_num->executereader();
if ( reader.read() )
return reader.getint(0);
- else
- return default_value;
+
+ return default_value;
}
TranslatedText queryTranslatedStringAttributeInternal( sqlite3_connection &con,
@@ -187,24 +171,28 @@
const TranslatedText &default_value )
{
//con.executenonquery("PRAGMA cache_size=8000;");
- con.executenonquery("BEGIN;");
- sqlite3_command cmd( con, "select a.text, l.name from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and t.class=:tclass and t.name=:tname;");
+ //con.executenonquery("BEGIN;");
- cmd.bind(":rid", record_id);
- cmd.bind(":lclass", "lang");
+ _cmd_attr_tstr->bind(":rid", record_id);
+ _cmd_attr_tstr->bind(":lclass", "lang");
- cmd.bind(":tclass", klass);
- cmd.bind(":tname", name);
+ _cmd_attr_tstr->bind(":tclass", klass);
+ _cmd_attr_tstr->bind(":tname", name);
TranslatedText result;
- sqlite3_reader reader = cmd.executereader();
- if ( reader.read() )
+ sqlite3_reader reader = _cmd_attr_tstr->executereader();
+
+ int c = 0;
+ while(reader.read())
{
result.setText( reader.getstring(0), Locale( reader.getstring(1) ) );
- return result;
+ c++;
}
- else
- return default_value;
+
+ if ( c>0 )
+ return result;
+
+ return default_value;
}
std::string queryStringAttributeInternal( sqlite3_connection &con,
@@ -213,7 +201,7 @@
const std::string &name,
const std::string &default_value )
{
- return queryStringAttributeTranslationInternal( con, record_id, Locale(), klass, name, default_value);
+ return queryStringAttributeTranslationInternal( con, record_id, Locale(), klass, name, default_value );
}
std::string queryStringAttributeTranslationInternal( sqlite3_connection &con,
@@ -221,27 +209,25 @@
const Locale &locale,
const std::string &klass,
const std::string &name,
- const std::string &default_value )
+ const std::string &default_value )
{
- //con.executenonquery("PRAGMA cache_size=8000;");
- con.executenonquery("BEGIN;");
- sqlite3_command cmd( con, "select a.text from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and l.name=:lname and t.class=:tclass and t.name=:tname;");
-
- cmd.bind(":rid", record_id);
- cmd.bind(":lclass", "lang");
+ //con.executenonquery("BEGIN;");
+ _cmd_attr_str->bind(":rid", record_id);
+ _cmd_attr_str->bind(":lclass", "lang");
if (locale == Locale() )
- cmd.bind(":lname", "none");
+ _cmd_attr_str->bind(":lname", "none");
else
- cmd.bind(":lname", locale.code());
+ _cmd_attr_str->bind(":lname", locale.code());
- cmd.bind(":tclass", klass);
- cmd.bind(":tname", name);
+ _cmd_attr_str->bind(":tclass", klass);
+ _cmd_attr_str->bind(":tname", name);
- sqlite3_reader reader = cmd.executereader();
+ sqlite3_reader reader = _cmd_attr_str->executereader();
+
if ( reader.read() )
return reader.getstring(0);
- else
- return default_value;
+
+ return default_value;
}
};
@@ -252,6 +238,12 @@
ResolvableQuery::ResolvableQuery( const Pathname &dbdir)
: _pimpl(new Impl(dbdir))
{
+ //MIL << "Creating Resolvable query" << endl;
+}
+
+ResolvableQuery::~ResolvableQuery()
+{
+ //MIL << "Destroying Resolvable query" << endl;
}
//////////////////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/cache/ResolvableQuery.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/ResolvableQuery.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/ResolvableQuery.h (original)
+++ trunk/libzypp/zypp/cache/ResolvableQuery.h Mon Jul 16 12:40:42 2007
@@ -8,6 +8,7 @@
#include "zypp/Pathname.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/data/RecordId.h"
+#include "zypp/cache/Attribute.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -15,7 +16,7 @@
///////////////////////////////////////////////////////////////////
namespace cache
{ /////////////////////////////////////////////////////////////////
-
+
/**
* The resolvable query class allows you to query for resolvable
* data and properties from the cache.
@@ -28,9 +29,9 @@
* first parameter is the resolvable id.
* second parameter is a \ref data::ResObjectData object with the resource
*/
- typedef function ProcessResolvable;
-
+
/**
* Constructor
*
@@ -38,6 +39,8 @@
*/
ResolvableQuery( const Pathname &dbdir );
+ ~ResolvableQuery();
+
/**
* Query by record id
* \param record_id Resolvable id to query
@@ -45,7 +48,7 @@
*/
void query( const data::RecordId &record_id,
ProcessResolvable fnc );
-
+
/**
* Query by matching text
* \param text text to match
@@ -53,7 +56,7 @@
*/
void query( const std::string &text,
ProcessResolvable fnc );
-
+
/**
* Queries a specifc attribute for a resolvable
*
@@ -68,6 +71,11 @@
const std::string &klass,
const std::string &name,
int default_value = -1 );
+ /** \overload */
+ int queryNumericAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ int default_value = -1 )
+ { return queryNumericAttribute( record_id, attr.klass, attr.name, default_value ); }
/**
@@ -84,6 +92,11 @@
const std::string &klass,
const std::string &name,
bool default_value = false );
+ /** \overload */
+ bool queryBooleanAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ bool default_value = false )
+ { return queryBooleanAttribute( record_id, attr.klass, attr.name, default_value ); }
/**
@@ -100,7 +113,12 @@
const std::string &klass,
const std::string &name,
const std::string &default_value = std::string() );
-
+ /** \overload */
+ std::string queryStringAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ const std::string &default_value = std::string() )
+ { return queryStringAttribute( record_id, attr.klass, attr.name, default_value ); }
+
/**
* Queries a specifc attribute translation
* for a resolvable.
@@ -118,7 +136,13 @@
const std::string &klass,
const std::string &name,
const std::string &default_value = std::string() );
-
+ /** \overload */
+ std::string queryStringAttributeTranslation( const data::RecordId &record_id,
+ const Locale &locale,
+ const Attribute& attr,
+ const std::string &default_value = std::string() )
+ { return queryStringAttributeTranslation( record_id, locale, attr.klass, attr.name, default_value ); }
+
/**
* Queries all translations for a specific attribute
* in a resolvable.
@@ -127,14 +151,19 @@
* \param klass Attribute Class
* \param name Attribute Name
*
- * \return all attribute translations or a empty
+ * \return all attribute translations or a empty
* \ref TranslatedString if no record is found.
*/
TranslatedText queryTranslatedStringAttribute( const data::RecordId &record_id,
const std::string &klass,
const std::string &name,
- const TranslatedText &default_vaue = TranslatedText() );
-
+ const TranslatedText &default_value = TranslatedText() );
+ /** \overload */
+ TranslatedText queryTranslatedStringAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ const TranslatedText &default_value = TranslatedText() )
+ { return queryTranslatedStringAttribute( record_id, attr.klass, attr.name, default_value ); }
+
/**
* Queries for a specific container attribute
* in a resolvable.
@@ -152,14 +181,20 @@
const std::string &name,
_OutputIterator result )
{
-
+
std::string all = queryStringAttribute( record_id, klass, name);
//FIXME use zypp separator
str::split( all, result );
}
-
-
-
+ /** \overload */
+ template<class _OutputIterator>
+ void queryStringContainerAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ _OutputIterator result )
+ { queryStringContainerAttribute( record_id, attr.klass, attr.name, result ); }
+
+
+
private:
/** Implementation. */
class Impl;
Modified: trunk/libzypp/zypp/cache/schema/schema.sql
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/schema/schema.sql?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/schema/schema.sql (original)
+++ trunk/libzypp/zypp/cache/schema/schema.sql Mon Jul 16 12:40:42 2007
@@ -40,7 +40,7 @@
CREATE TABLE db_info (
version INTEGER
);
---INSERT INTO db_info (version) VALUES ('
+
------------------------------------------------
-- Basic types like archs, attributes, languages
------------------------------------------------
@@ -170,6 +170,7 @@
, baseversion_sequence_info TEXT
, repository_id INTEGER REFERENCES repositories(id)
);
+CREATE INDEX delta_package_repository_id ON delta_packages(repository_id);
CREATE TABLE patch_packages (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
@@ -180,6 +181,7 @@
, build_time INTEGER
, repository_id INTEGER REFERENCES repositories(id)
);
+CREATE INDEX patch_package_repository_id ON patch_packages(repository_id);
CREATE TABLE patch_packages_baseversions (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
@@ -266,6 +268,9 @@
DELETE FROM file_capabilities WHERE resolvable_id = old.id;
DELETE FROM split_capabilities WHERE resolvable_id = old.id;
DELETE FROM other_capabilities WHERE resolvable_id = old.id;
+
+ DELETE FROM text_attributes WHERE weak_resolvable_id = old.id;
+ DELETE FROM numeric_attributes WHERE weak_resolvable_id = old.id;
END;
------------------------------------------------
@@ -287,6 +292,8 @@
AFTER DELETE ON repositories
BEGIN
DELETE FROM resolvables WHERE repository_id = old.id;
+ DELETE FROM delta_packages WHERE repository_id = old.id;
+ DELETE FROM patch_packages WHERE repository_id = old.id;
END;
CREATE TRIGGER remove_patch_packages_baseversions
Modified: trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp (original)
+++ trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp Mon Jul 16 12:40:42 2007
@@ -39,13 +39,14 @@
private:
friend class sqlite3_command;
friend class database_error;
-
struct sqlite3 *db;
-
public:
sqlite3_connection();
sqlite3_connection(const char *db);
sqlite3_connection(const wchar_t *db);
+
+ void setprogresshandler( int, int(*)(void *), void* );
+
~sqlite3_connection();
void open(const char *db);
@@ -56,7 +57,7 @@
void setbusytimeout(int ms);
void execute(const std::string &sql);
-
+
void executenonquery(const char *sql);
void executenonquery(const wchar_t *sql);
void executenonquery(const std::string &sql);
@@ -99,6 +100,7 @@
{
public:
database_error(const char *msg);
+ database_error(const std::string & msg);
database_error(sqlite3_connection &con);
};
@@ -174,7 +176,7 @@
void bind(int index, const void *data, int datalen);
void bind(int index, const std::string &data);
void bind(int index, const std::wstring &data);
-
+
void bind(const std::string ¶m);
void bind(const std::string ¶m, int data);
void bind(const std::string ¶m, long long data);
Modified: trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp (original)
+++ trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp Mon Jul 16 12:40:42 2007
@@ -23,11 +23,11 @@
$Revision: 1.1 $
*/
-/*
+/*
this source contains modifications by Novell Inc.
-
+
Changes:
-
+
* dmacvicar@novell.com
Wrap sqlite3_exec
@@ -57,10 +57,19 @@
if (this->db) sqlite3_close(this->db);
}
+void sqlite3_connection::setprogresshandler( int n, int(*fnc)(void*), void* ptr )
+{
+ sqlite3_progress_handler(db, n, fnc, ptr);
+}
+
void sqlite3_connection::open(const char *db)
{
if (sqlite3_open(db, &this->db)!=SQLITE_OK)
- SQLITE3X_THROW(database_error("unable to open database"));
+ {
+ std::string msg( "unable to open database at " );
+ msg += ( db ? db : "NULL" );
+ SQLITE3X_THROW(database_error(msg));
+ }
}
void sqlite3_connection::open(const wchar_t *db)
@@ -264,9 +273,9 @@
void sqlite3_connection::execute(const std::string &sql)
{
if (!this->db) SQLITE3X_THROW(database_error("database is not open"));
-
+
char *err_msg;
-
+
if ( sqlite3_exec( this->db, sql.c_str(), NULL, NULL, &err_msg ) != SQLITE_OK )
{
std::string err(err_msg);
Modified: trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_exception.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_exception.cpp?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_exception.cpp (original)
+++ trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_exception.cpp Mon Jul 16 12:40:42 2007
@@ -31,6 +31,8 @@
database_error::database_error(const char *msg) : zypp::Exception(msg)
{}
+database_error::database_error(const std::string & msg) : zypp::Exception(msg)
+{}
database_error::database_error(sqlite3_connection &con) : zypp::Exception(sqlite3_errmsg(con.db))
{}
Modified: trunk/libzypp/zypp/capability/CapabilityImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/CapabilityImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/capability/CapabilityImpl.h (original)
+++ trunk/libzypp/zypp/capability/CapabilityImpl.h Mon Jul 16 12:40:42 2007
@@ -309,6 +309,8 @@
}
};
+ typedef std::setCapabilityImpl::Ptr CapabilityImplPtrSet;
+
/////////////////////////////////////////////////////////////////
} // namespace capability
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/data/ResolvableData.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.cc (original)
+++ trunk/libzypp/zypp/data/ResolvableData.cc Mon Jul 16 12:40:42 2007
@@ -49,71 +49,5 @@
// << " enhances:" << endl << enhances << endl
}
-
-// COMMENT BLOCK BELOW:
-// Overload 'virtual std::ostream & dumpOn' to realize 'std::ostream & operator<<'.
-// That's the intended way for ReferenceCounted objects.
-//
-/*
-std::ostream& operator<<(std::ostream& out, const zypp::shared_ptr<AtomBase> data)
-{
- out << "Atom data" << endl;
- switch (data->atomType())
- {
- case AtomBase::TypePackage:
- out << " atom type: " << "package" << endl
- << *zypp::dynamic_pointer_cast<Patch>(data);
- break;
- case AtomBase::TypeMessage:
- out << " atom type: " << "message" << endl
- << *zypp::dynamic_pointer_cast<Message>(data);
- break;
- case AtomBase::TypeScript:
- out << " atom type: " << "script" << endl
- << *zypp::dynamic_pointer_cast<Script>(data);
- break;
- default:
- out << "Unknown atom type" << endl;
- }
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const Script& data)
-{
- out << " do script: " << data.do_script << endl
- << " undo script: " << data.undo_script << endl
- << " do script location: " << data.do_location << endl
- << " undo script location: " << data.undo_location << endl
- << " do script media: " << data.do_media << endl
- << " undo script media: " << data.undo_media << endl
- << " do checksum type: " << data.do_checksum_type << endl
- << " do checksum: " << data.do_checksum << endl
- << " undo checksum type: " << data.undo_checksum_type << endl
- << " undo checksum: " << data.undo_checksum << endl;
- return out;
-}
-
-
-std::ostream& operator<<(std::ostream& out, const Message& data)
-{
- out << "Message Data: " << endl
- << " name: " << data.name << endl
- << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl
- << " provides: " << data.provides << endl
- << " conflicts: " << data.conflicts << endl
- << " obsoletes: " << data.obsoletes << endl
- << " freshens: " << data.freshens << endl
- << " requires: " << data.requires << endl
- << " recommends:" << endl << data.recommends << endl
- << " suggests:" << endl << data.suggests << endl
- << " supplements:" << endl << data.supplements << endl
- << " enhances:" << endl << data.enhances << endl
- << " text: " << data.text << endl;
- return out;
-}
-*/
-
} // namespace cache
} // namespace zypp
Modified: trunk/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.h (original)
+++ trunk/libzypp/zypp/data/ResolvableData.h Mon Jul 16 12:40:42 2007
@@ -31,6 +31,7 @@
#include "zypp/Url.h"
#include "zypp/Date.h"
#include "zypp/TranslatedText.h"
+#include "zypp/OnMediaLocation.h"
namespace zypp
{
@@ -45,28 +46,6 @@
/** List of files contained in a package (info for UI) */
typedef std::liststd::string Filenames;
-
- /** Data to retrieve a file from some media. */
- struct Location
- {
- Location()
- : fileSize( -1 ), gzSize( -1 )
- {}
-
- /** Media number (0==no media access required). */
- MediaNr mediaNr;
- /** Path on the media. */
- Pathname filePath;
- /** The uncompressed files size. */
- ByteCount fileSize;
- /** The uncompressed files checksum. */
- CheckSum fileChecksum;
- /** The compressed (gz) files size. */
- ByteCount gzSize;
- /** The compressed (gz) files checksum. */
- CheckSum gzChecksum;
- };
-
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Resolvable);
@@ -99,6 +78,8 @@
ResObject()
{}
+ /** Raw data to determine \ref shareDataWith */
+ std::string sharedDataTag;
/** Share some data with another resolvable.*/
RecordId shareDataWith;
@@ -129,7 +110,6 @@
// Repository related:
/** Repository providing this resolvable. */
RecordId repository;
-
protected:
/** Overload to realize std::ostream & operator\<\<. */
virtual std::ostream & dumpOn( std::ostream & str ) const;
@@ -161,12 +141,12 @@
/** Inlined doScript. */
std::string doScript;
/** Location of doScript on the repositories media. */
- Location doScriptLocation;
+ OnMediaLocation doScriptLocation;
/** Inlined undoScript. */
std::string undoScript;
/** Location of undoScript on the repositories media. */
- Location undoScriptLocation;
+ OnMediaLocation undoScriptLocation;
};
///////////////////////////////////////////////////////////////////
@@ -182,8 +162,6 @@
/** Inlined Text. */
TranslatedText text;
- /** Location od textfile on the repositories media. */
- //Location repositoryLoaction;
};
///////////////////////////////////////////////////////////////////
@@ -203,7 +181,7 @@
Date timestamp;
/** Patch category (recommended, security,...) */
std::string category;
-
+
// Flags:
/** Does the system need to reboot to finish the update process? */
DefaultIntegral rebootNeeded;
@@ -306,9 +284,6 @@
virtual PackageType packageType() const = 0;
public:
- /** Location on the repositories media. */
- Location repositoryLocation;
-
/** Rpm group.*/
std::string group;
/** PackageDb keywors (tags). */
@@ -333,7 +308,7 @@
/** operating system **/
std::string operatingSystem;
-
+
/** Pre install script. */
std::string prein;
/** Post install script. */
@@ -342,6 +317,8 @@
std::string preun;
/** Post uninstall script. */
std::string postun;
+
+ OnMediaLocation repositoryLocation;
};
DEFINE_PTR_TYPE(Package);
@@ -391,7 +368,7 @@
// Shared RPM data
- Location location;
+ OnMediaLocation location;
Date buildTime;
Date fileTime;
ByteCount archiveSize; // ??
@@ -415,13 +392,13 @@
std::string sequenceInfo;
};
- DeltaBaseVersion baseVersion;
+ DeltaBaseVersion baseVersion;
};
DEFINE_PTR_TYPE(PackageAtom);
/**
* Data Object for YUM package atom.
- *
+ *
* \see zypp/parser/yum/schema/patch.rng
*/
struct PackageAtom : public Package
Modified: trunk/libzypp/zypp/data/ResolvableDataConsumer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableDataConsumer.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableDataConsumer.h (original)
+++ trunk/libzypp/zypp/data/ResolvableDataConsumer.h Mon Jul 16 12:40:42 2007
@@ -39,6 +39,8 @@
virtual data::RecordId consumeChangelog ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & ) = 0;
virtual data::RecordId consumeFilelist ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & ) = 0;
+
+ virtual void updatePackageLang( const data::RecordId & resolvable_id, const data::Packagebase_Ptr & data_r ) = 0;
};
} // namespace parser
Modified: trunk/libzypp/zypp/detail/PackageImplIf.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/PackageImplIf.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/detail/PackageImplIf.cc (original)
+++ trunk/libzypp/zypp/detail/PackageImplIf.cc Mon Jul 16 12:40:42 2007
@@ -26,9 +26,6 @@
// as far as resonable.
/////////////////////////////////////////////////////////////////
- CheckSum PackageImplIf::checksum() const
- { return CheckSum(); }
-
std::string PackageImplIf::buildhost() const
{ return std::string(); }
@@ -50,9 +47,6 @@
Changelog PackageImplIf::changelog() const
{ return Changelog(); }
- Pathname PackageImplIf::location() const
- { return Pathname(); }
-
std::string PackageImplIf::url() const
{ return std::string(); }
@@ -73,7 +67,13 @@
ByteCount PackageImplIf::sourcesize() const
{ return ByteCount(); }
-
+
+ ByteCount PackageImplIf::downloadSize() const
+ { return location().downloadSize(); }
+
+ OnMediaLocation PackageImplIf::location() const
+ { return OnMediaLocation(); }
+
DiskUsage PackageImplIf::diskusage() const
{ return DiskUsage(); }
Modified: trunk/libzypp/zypp/detail/PackageImplIf.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/PackageImplIf.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/detail/PackageImplIf.h (original)
+++ trunk/libzypp/zypp/detail/PackageImplIf.h Mon Jul 16 12:40:42 2007
@@ -21,7 +21,7 @@
#include "zypp/Changelog.h"
#include "zypp/DiskUsage.h"
#include "zypp/PackageKeyword.h"
-#include "zypp/source/PackageDelta.h"
+#include "zypp/repo/PackageDelta.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -53,8 +53,6 @@
/** \name Rpm Package Attributes. */
//@{
- virtual CheckSum checksum() const PURE_VIRTUAL;
- /** */
virtual std::string buildhost() const PURE_VIRTUAL;
/** */
virtual std::string distribution() const PURE_VIRTUAL;
@@ -69,7 +67,6 @@
/** */
virtual Changelog changelog() const PURE_VIRTUAL;
/** */
- virtual Pathname location() const PURE_VIRTUAL;
/** Don't ship it as class Url, because it might be
* in fact anything but a legal Url. */
virtual std::string url() const PURE_VIRTUAL;
@@ -95,6 +92,10 @@
virtual std::list<DeltaRpm> deltaRpms() const PURE_VIRTUAL;
/** */
virtual std::list<PatchRpm> patchRpms() const PURE_VIRTUAL;
+
+ virtual ByteCount downloadSize() const PURE_VIRTUAL;
+
+ virtual OnMediaLocation location() const PURE_VIRTUAL;
//@}
Modified: trunk/libzypp/zypp/detail/ResObjectImplIf.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/ResObjectImplIf.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/detail/ResObjectImplIf.cc (original)
+++ trunk/libzypp/zypp/detail/ResObjectImplIf.cc Mon Jul 16 12:40:42 2007
@@ -10,8 +10,6 @@
*
*/
#include "zypp/detail/ResObjectImplIf.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/SourceFactory.h"
#include "zypp/Repository.h"
///////////////////////////////////////////////////////////////////
@@ -44,24 +42,9 @@
Vendor ResObjectImplIf::vendor() const
{ return Vendor(); }
- ByteCount ResObjectImplIf::size() const
- { return ByteCount(); }
-
- ByteCount ResObjectImplIf::archivesize() const
- { return ByteCount(); }
-
- Source_Ref ResObjectImplIf::source() const
- { return Source_Ref::noSource; }
-
Repository ResObjectImplIf::repository() const
{ return Repository::noRepository; }
- unsigned ResObjectImplIf::mediaNr() const
- { return 0; }
-
- unsigned ResObjectImplIf::sourceMediaNr() const
- { return 0; }
-
bool ResObjectImplIf::installOnly() const
{ return false; }
@@ -70,10 +53,16 @@
Date ResObjectImplIf::installtime() const
{ return Date(); }
-
- ZmdId ResObjectImplIf::zmdid() const
+
+ unsigned ResObjectImplIf::mediaNr() const
{ return 0; }
+
+ ByteCount ResObjectImplIf::size() const
+ { return ByteCount(); }
+ ByteCount ResObjectImplIf::downloadSize() const
+ { return ByteCount(); }
+
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/detail/ResObjectImplIf.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/ResObjectImplIf.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/detail/ResObjectImplIf.h (original)
+++ trunk/libzypp/zypp/detail/ResObjectImplIf.h Mon Jul 16 12:40:42 2007
@@ -18,7 +18,7 @@
#include "zypp/base/Deprecated.h"
#include "zypp/detail/ResImplTraits.h"
#include "zypp/detail/ResObjectFactory.h"
-
+#include "zypp/Repository.h"
#include "zypp/Locale.h"
#include "zypp/ByteCount.h"
#include "zypp/Date.h"
@@ -34,7 +34,6 @@
{ /////////////////////////////////////////////////////////////////
class Resolvable;
- class Source_Ref;
class Repository;
///////////////////////////////////////////////////////////////////
@@ -82,7 +81,7 @@
virtual ByteCount size() const PURE_VIRTUAL;
/** */
- virtual ByteCount archivesize() const PURE_VIRTUAL;
+ virtual ByteCount downloadSize() const PURE_VIRTUAL;
/** Backlink to the source providing this. */
virtual Repository repository() const PURE_VIRTUAL;
@@ -93,15 +92,6 @@
*/
virtual unsigned mediaNr() const PURE_VIRTUAL;
- /** Backlink to the source providing this. */
- virtual Source_Ref source() const PURE_VIRTUAL;
-
- /** Number of the source media that provides the data
- * required for installation. Zero, if no media access
- * is required.
- */
- virtual unsigned sourceMediaNr() const PURE_VIRTUAL;
-
/** */
virtual bool installOnly() const PURE_VIRTUAL;
@@ -110,9 +100,7 @@
/** Time of installation, or \c 0 */
virtual Date installtime() const;
-
- /** Id used inside ZMD */
- ZYPP_DEPRECATED virtual ZmdId zmdid() const PURE_VIRTUAL;
+
//@}
public:
Modified: trunk/libzypp/zypp/detail/SrcPackageImplIf.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/SrcPackageImplIf.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/detail/SrcPackageImplIf.cc (original)
+++ trunk/libzypp/zypp/detail/SrcPackageImplIf.cc Mon Jul 16 12:40:42 2007
@@ -26,15 +26,15 @@
// as far as resonable.
/////////////////////////////////////////////////////////////////
- ByteCount SrcPackageImplIf::archivesize() const
- { return ByteCount(); }
+ OnMediaLocation SrcPackageImplIf::location() const
+ { return OnMediaLocation(); }
+
+ ByteCount SrcPackageImplIf::downloadSize() const
+ { return location().downloadSize(); }
DiskUsage SrcPackageImplIf::diskusage() const
{ return DiskUsage(); }
- Pathname SrcPackageImplIf::location() const
- { return Pathname(); }
-
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/detail/SrcPackageImplIf.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/SrcPackageImplIf.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/detail/SrcPackageImplIf.h (original)
+++ trunk/libzypp/zypp/detail/SrcPackageImplIf.h Mon Jul 16 12:40:42 2007
@@ -40,12 +40,12 @@
typedef SrcPackage ResType;
public:
+ virtual OnMediaLocation location() const PURE_VIRTUAL;
/** */
- virtual ByteCount archivesize() const PURE_VIRTUAL;
+ virtual ByteCount downloadSize() const PURE_VIRTUAL;
/** */
virtual DiskUsage diskusage() const PURE_VIRTUAL;
- /** */
- virtual Pathname location() const PURE_VIRTUAL;
+
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/parser/IniParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/IniParser.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/IniParser.cc (original)
+++ trunk/libzypp/zypp/parser/IniParser.cc Mon Jul 16 12:40:42 2007
@@ -69,7 +69,7 @@
void IniParser::parse( const InputStream & input_r, const ProgressData::ReceiverFnc & progress )
{
boost::regex rxSection("^\\[(.+)\\]$");
- boost::regex rxKeyValue("^(.+)[[:space:]]*=[[:space:]]*(.+)$");
+ boost::regex rxKeyValue("^(.*[^[:space:]])[ [:space:]]*=[[:space:]]*(.+)$");
MIL << "Start parsing " << input_r << endl;
_inputname = input_r.name();
Modified: trunk/libzypp/zypp/parser/RepoFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/RepoFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/RepoFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/RepoFileReader.cc Mon Jul 16 12:40:42 2007
@@ -58,8 +58,20 @@
info.setEnabled( it->second == "1" );
else if ( it->first == "baseurl" )
info.addBaseUrl( Url(it->second) );
+ else if ( it->first == "path" )
+ info.setPath( Pathname(it->second) );
else if ( it->first == "type" )
info.setType(repo::RepoType(it->second));
+ else if ( it->first == "autorefresh" )
+ info.setAutorefresh( it->second == "1" );
+ else if ( it->first == "mirrorlist" )
+ info.setMirrorListUrl(Url(it->second));
+ else if ( it->first == "gpgkey" )
+ info.setGpgKeyUrl( Url(it->second) );
+ else if ( it->first == "gpgcheck" )
+ info.setGpgCheck( it->second == "1" );
+ else
+ ERR << "Unknown attribute " << it->second << " ignored" << endl;
}
MIL << "Linking repo info with file " << file << endl;
info.setFilepath(file);
Modified: trunk/libzypp/zypp/parser/TagParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/TagParser.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/TagParser.cc (original)
+++ trunk/libzypp/zypp/parser/TagParser.cc Mon Jul 16 12:40:42 2007
@@ -199,6 +199,12 @@
void TagParser::parse( const InputStream & input_r, const ProgressData::ReceiverFnc & fnc_r )
{
MIL << "Start parsing " << input_r << endl;
+ if ( ! input_r.stream() )
+ {
+ std::ostringstream s;
+ s << "Can't read bad stream: " << input_r;
+ ZYPP_THROW( ParseException( s.str() ) );
+ }
_inputname = input_r.name();
beginParse();
Modified: trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/ContentFileReader.cc Mon Jul 16 12:40:42 2007
@@ -26,6 +26,8 @@
#include "zypp/ZConfig.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -289,6 +291,12 @@
const ProgressData::ReceiverFnc & fnc_r )
{
MIL << "Start parsing " << input_r << endl;
+ if ( ! input_r.stream() )
+ {
+ std::ostringstream s;
+ s << "Can't read bad stream: " << input_r;
+ ZYPP_THROW( ParseException( s.str() ) );
+ }
beginParse();
_pimpl->_inputname = input_r.name();
Modified: trunk/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h (original)
+++ trunk/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h Mon Jul 16 12:40:42 2007
@@ -20,6 +20,7 @@
#include "zypp/parser/susetags/FileReaderBase.h"
#include "zypp/parser/ParseException.h"
#include "zypp/data/ResolvableData.h"
+#include "zypp/PathInfo.h"
using std::endl;
@@ -33,6 +34,21 @@
namespace susetags
{ /////////////////////////////////////////////////////////////////
+ inline std::string makeSharedIdent( ResolvableTraits::KindType kind_r,
+ const std::string & name_r,
+ const Edition & edition_r,
+ const Arch & arch_r )
+ {
+ std::string ret( kind_r.asString() );
+ ret += ":";
+ ret += name_r;
+ ret += "-";
+ ret += edition_r.asString();
+ ret += ".";
+ ret += arch_r.asString();
+ return ret;
+ }
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : FileReaderBase::BaseImpl
@@ -48,7 +64,10 @@
{}
public:
-
+ /** Parsing Capabilities from string is quite expensive. So we
+ * maintain a little chache to check whether we already parsed some
+ * raw string. If so, we can reuse the result.
+ */
struct CapImplCache
{
template<class _Res>
Modified: trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc Mon Jul 16 12:40:42 2007
@@ -16,6 +16,8 @@
#include "zypp/parser/susetags/FileReaderBaseImpl.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -106,7 +108,7 @@
{
ZYPP_THROW( error( tag_r, "Expected [type checksum]") );
}
- _data->repositoryLocation.fileChecksum = CheckSum( words[0], words[1] );
+ _data->repositoryLocation.setChecksum(CheckSum( words[0], words[1] ));
}
/** Consume =Grp:. */
@@ -157,16 +159,14 @@
switch ( str::split( tag_r->value, std::back_inserter(words) ) )
{
case 2: // [medianr filename]
- str::strtonum( words[0], _data->repositoryLocation.mediaNr.get() );
- _data->repositoryLocation.filePath = _data->arch.asString();
- _data->repositoryLocation.filePath /= words[1];
+ _data->repositoryLocation.setMedianr( str::strtonum<unsigned>(words[0]) );
+ _data->repositoryLocation.setFilename( Pathname(_data->arch.asString()) / words[1] );
break;
case 3: // [medianr filename dir]
- str::strtonum( words[0], _data->repositoryLocation.mediaNr.get() );
- _data->repositoryLocation.filePath = words[2];
- _data->repositoryLocation.filePath /= words[1];
- break;
+ _data->repositoryLocation.setMedianr( str::strtonum<unsigned>(words[0]) );
+ _data->repositoryLocation.setFilename( Pathname(words[2]) / words[1] );
+ break;
default:
ZYPP_THROW( error( tag_r, "Expected [medianr filename dir]") );
@@ -182,14 +182,36 @@
{
ZYPP_THROW( error( tag_r, "Expected [archivesize size]") );
}
- _data->repositoryLocation.fileSize = str::strtonumByteCount::SizeType( words[0] );
+ _data->repositoryLocation.setDownloadSize(str::strtonumByteCount::SizeType( words[0] ));
_data->installedSize = str::strtonumByteCount::SizeType( words[1] );
}
- /** Consume =Shr:. */
+ /** Consume =Shr:.
+ * Raw data to identify the object is the string
+ * <tt>kind:name-version-realease.arch</tt>.
+ */
void consumeShr( const SingleTagPtr & tag_r )
{
-#warning TBD
+ std::vectorstd::string words;
+ if ( str::split( tag_r->value, std::back_inserter(words) ) != 4 )
+ {
+ ZYPP_THROW( error( tag_r, "Expected [name version release arch]") );
+ }
+
+ if ( words[3] == "src" || words[3] == "nosrc")
+ {
+ _data->sharedDataTag = makeSharedIdent( ResTraits<SrcPackage>::kind,
+ words[0],
+ Edition( words[1], words[2] ),
+ Arch() );
+ }
+ else
+ {
+ _data->sharedDataTag = makeSharedIdent( ResTraits<Package>::kind,
+ words[0],
+ Edition( words[1], words[2] ),
+ Arch( words[3] ) );
+ }
}
public: // multi tags
Modified: trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc Mon Jul 16 12:40:42 2007
@@ -10,12 +10,15 @@
*
*/
#include <iostream>
+#include "zypp/base/Easy.h"
#include "zypp/base/Logger.h"
-
+#include "zypp/base/LogTools.h"
#include "zypp/parser/susetags/PackagesLangFileReader.h"
#include "zypp/parser/susetags/FileReaderBaseImpl.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
Modified: trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc Mon Jul 16 12:40:42 2007
@@ -16,6 +16,8 @@
#include "zypp/parser/susetags/FileReaderBaseImpl.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
Modified: trunk/libzypp/zypp/parser/susetags/RepoIndex.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/RepoIndex.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/RepoIndex.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/RepoIndex.cc Mon Jul 16 12:40:42 2007
@@ -15,6 +15,8 @@
#include "zypp/parser/susetags/RepoIndex.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
Modified: trunk/libzypp/zypp/parser/susetags/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/RepoParser.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/RepoParser.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/RepoParser.cc Mon Jul 16 12:40:42 2007
@@ -10,10 +10,14 @@
*
*/
#include <iostream>
+#include "zypp/base/Easy.h"
#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/String.h"
+#include "zypp/base/Gettext.h"
+#include "zypp/parser/susetags/FileReaderBaseImpl.h"
#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/parser/susetags/ContentFileReader.h"
#include "zypp/parser/susetags/PackagesFileReader.h"
@@ -25,6 +29,8 @@
#include "zypp/ZConfig.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -60,41 +66,150 @@
/** \name FileReader callbacks delivering data. */
//@{
+ ///////////////////////////////////////////////////////////////////
void consumeIndex( const RepoIndex_Ptr & data_r )
{
- SEC << "[Index]" << data_r << endl;
+ //SEC << "[Index]" << data_r << endl;
_repoIndex = data_r;
}
+ ///////////////////////////////////////////////////////////////////
void consumeProd( const data::Product_Ptr & data_r )
{
- SEC << "[Prod]" << data_r << endl;
+ MIL << "[Product] " << data_r << endl;
+ ++_stats.prod;
_prodData = data_r;
+ _defaultVendor = data_r->vendor;
_consumer.consumeProduct( _repositoryId, data_r );
}
+ ///////////////////////////////////////////////////////////////////
void consumePkg( const data::Package_Ptr & data_r )
{
- SEC << "[Package]" << data_r << endl;
- _consumer.consumePackage( _repositoryId, data_r );
+ fixVendor( data_r );
+ fixLocationPath( data_r );
+ resolveSharedDataTag( data_r );
+
+ ++_stats.pack;
+ data::RecordId newid = _consumer.consumePackage( _repositoryId, data_r );
+
+ // remember for later reference
+ idMapAdd( makeSharedIdent( ResTraits<Package>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ),
+ newid );
}
+ ///////////////////////////////////////////////////////////////////
void consumeSrcPkg( const data::SrcPackage_Ptr & data_r )
{
- SEC << "[SrcPackage]" << data_r << endl;
- _consumer.consumeSourcePackage( _repositoryId, data_r );
+ fixVendor( data_r );
+ fixLocationPath( data_r );
+ resolveSharedDataTag( data_r );
+
+ ++_stats.srcp;
+ data::RecordId newid = _consumer.consumeSourcePackage( _repositoryId, data_r );
+
+ // remember for later reference
+ idMapAdd( makeSharedIdent( ResTraits<SrcPackage>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ),
+ newid );
}
+ ///////////////////////////////////////////////////////////////////
+ void consumePkgLang( const data::Package_Ptr & data_r )
+ {
+ data::RecordId id = idMapGet( makeSharedIdent( ResTraits<Package>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ) );
+ if ( id != data::noRecordId )
+ {
+ _consumer.updatePackageLang( id, data_r );
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ void consumeSrcPkgLang( const data::SrcPackage_Ptr & data_r )
+ {
+ data::RecordId id = idMapGet( makeSharedIdent( ResTraits<SrcPackage>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ) );
+ if ( id != data::noRecordId )
+ {
+ _consumer.updatePackageLang( id, data_r );
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////
void consumePat( const data::Pattern_Ptr & data_r )
{
- SEC << "[Pattern]" << data_r << endl;
+ //SEC << "[Pattern]" << data_r << endl;
+ fixVendor( data_r );
+ ++_stats.patt;
_consumer.consumePattern( _repositoryId, data_r );
}
//@}
- public:
+ public:
+ /** Use products vendor if vendor was not specified. */
+ void fixVendor( const data::ResObject_Ptr & data_r )
+ {
+ if ( data_r->vendor.empty() && ! _defaultVendor.empty() )
+ {
+ data_r->vendor = _defaultVendor;
+ }
+ }
+
+ /** Prepend location with 'datadir'. */
+ void fixLocationPath( const data::Packagebase_Ptr & data_r )
+ {
+ Pathname tofix( data_r->repositoryLocation.filename() );
+ data_r->repositoryLocation.setFilename( _datadir / tofix );
+ }
+
+ /** Resolve shared data tag. */
+ void resolveSharedDataTag( const data::Packagebase_Ptr & data_r )
+ {
+ if ( ! data_r->sharedDataTag.empty() )
+ {
+ data_r->shareDataWith = idMapGet( data_r->sharedDataTag );
+ }
+ }
- bool isPatternFile( const std::string & name_r ) const
+ public:
+ /** Throw \ref ParseException if a required file is not
+ * available below \ref _reporoot on disk.
+ */
+ Pathname assertMandatoryFile( const Pathname & file_r ) const
+ {
+ PathInfo inputfile( _reporoot / file_r );
+ if ( ! inputfile.isFile() )
+ {
+ ZYPP_THROW( ParseException( _reporoot.asString() + ": " + _("Required file is missing: ") + file_r.asString() ) );
+ }
+ return inputfile.path();
+ }
+
+ /** Print a warning if an optional file is not
+ * available below \ref _reporoot on disk.
+ */
+ Pathname getOptionalFile( const Pathname & file_r ) const
+ {
+ PathInfo inputfile( _reporoot / file_r );
+ if ( ! inputfile.isFile() )
+ {
+ WAR << _reporoot << ": Skip optional file: " << file_r.asString() << endl;
+ return Pathname();
+ }
+ return inputfile.path();
+ }
+
+ bool isPatternFile( const std::string & name_r ) const
{
return( name_r.size() > 4 && name_r.substr( name_r.size() - 4 ) == ".pat" );
}
@@ -107,7 +222,16 @@
it != _repoIndex->metaFileChecksums.end(); ++it )
{
if ( it->first == searchFor )
- return true; // got it
+ {
+ // got it
+ PathInfo inputfile( _reporoot / _descrdir / searchFor );
+ if ( ! inputfile.isFile() )
+ {
+ WAR << "Known and desired file is not on disk: " << inputfile << endl;
+ }
+ else
+ return true; // got it
+ }
}
return false; // not found
}
@@ -137,18 +261,42 @@
{
return; // now return...
}
-
// ...or parse
_parsedLocales.insert( toParse ); // don't try again.
- PackagesLangFileReader reader;
- reader.setLocale( toParse );
- reader.setPkgConsumer( bind( &Impl::consumePkg, this, _1 ) );
- reader.setSrcPkgConsumer( bind( &Impl::consumeSrcPkg, this, _1 ) );
- reader.parse( _descrdir / ("packages." + toParse.code()) );
+ Pathname inputfile( getOptionalFile( _descrdir / ("packages." + toParse.code()) ) );
+ if ( ! inputfile.empty() )
+ {
+ PackagesLangFileReader reader;
+ reader.setLocale( toParse );
+ reader.setPkgConsumer( bind( &Impl::consumePkgLang, this, _1 ) );
+ reader.setSrcPkgConsumer( bind( &Impl::consumeSrcPkgLang, this, _1 ) );
+ reader.parse( inputfile );
+ }
- if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );
+ if ( ! _ticks.incr( PathInfo(inputfile).size() ) )
+ ZYPP_THROW( AbortRequestException() );
+ }
+
+ private:
+ void idMapAdd( const std::string & key_r, data::RecordId value_r )
+ {
+ if ( _idMap[key_r] != data::noRecordId )
+ {
+ WAR << "Multiple record ids for " << key_r
+ << " (first " << _idMap[key_r] << ", now " << value_r << ")" << endl;
+ }
+ _idMap[key_r] = value_r;
+ }
+
+ data::RecordId idMapGet( const std::string & key_r )
+ {
+ data::RecordId ret = _idMap[key_r];
+ if ( ret == data::noRecordId )
+ {
+ WAR << "No record id for " << key_r << endl;
+ }
+ return ret;
}
private:
@@ -159,11 +307,24 @@
private: // these (and _ticks) are actually scoped per parse() run.
RepoIndex_Ptr _repoIndex;
data::Product_Ptr _prodData;
- Pathname _descrdir; // full path
- Pathname _datadir; // full path
+ std::string _defaultVendor;
+ Pathname _reporoot; // full path
+ Pathname _descrdir; // path below reporoot
+ Pathname _datadir; // path below reporoot
/** Translations processed by \ref parseLocaleIf so far.*/
std::set<Locale> _parsedLocales;
+
+ /** Remember the record ids of created packages and soucepackages. */
+ std::mapstd::string,data::RecordId _idMap;
+
+ struct Stats {
+ DefaultIntegral prod;
+ DefaultIntegral patt;
+ DefaultIntegral pack;
+ DefaultIntegral srcp;
+ };
+ Stats _stats;
};
///////////////////////////////////////////////////////////////////
@@ -176,15 +337,18 @@
{
_prodData = 0;
_repoIndex = 0;
+ _defaultVendor.clear();
+ _reporoot = reporoot_r;
_descrdir = _datadir = Pathname();
_parsedLocales.clear();
// Content file first to get the repoindex
{
+ Pathname inputfile( assertMandatoryFile( "content" ) );
ContentFileReader content;
content.setProductConsumer( bind( &Impl::consumeProd, this, _1 ) );
content.setRepoIndexConsumer( bind( &Impl::consumeIndex, this, _1 ) );
- content.parse( reporoot_r / "content" );
+ content.parse( inputfile );
}
if ( ! _repoIndex )
{
@@ -193,29 +357,44 @@
DBG << _repoIndex << endl;
// Prepare parsing
- _descrdir = reporoot_r / _repoIndex->descrdir;
- _datadir = reporoot_r / _repoIndex->datadir;
+ _descrdir = _repoIndex->descrdir; // path below reporoot
+ _datadir = _repoIndex->datadir; // path below reporoot
_ticks.name( "Parsing susetags repo at " + reporoot_r.asString() );
- _ticks.range( _repoIndex->metaFileChecksums.size() );
+
+ // calculate progress range based on file sizes to parse
+ int jobssize = 0;
+ for ( RepoIndex::FileChecksumMap::const_iterator it = _repoIndex->metaFileChecksums.begin();
+ it != _repoIndex->metaFileChecksums.end(); ++it )
+ {
+ jobssize += PathInfo(getOptionalFile(_descrdir / it->first)).size();
+
+ }
+ MIL << "Total job size: " << jobssize << endl;
+
+ _ticks.range(jobssize);
+
if ( ! _ticks.toMin() )
ZYPP_THROW( AbortRequestException() );
// Start with packages
{
+ Pathname inputfile( assertMandatoryFile( _descrdir / "packages" ) );
PackagesFileReader reader;
reader.setPkgConsumer( bind( &Impl::consumePkg, this, _1 ) );
reader.setSrcPkgConsumer( bind( &Impl::consumeSrcPkg, this, _1 ) );
- reader.parse( _descrdir / "packages" );
+
+ CombinedProgressData packageprogress( _ticks, PathInfo(inputfile).size() );
+ reader.parse( inputfile, packageprogress );
}
- if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );
- // Now process packages.lang
- // Always parse 'en'. For each wanted locale at least
- // some fallback, if locale is not present.
+ // Now process packages.lang. Always parse 'en'.
+ // At least packages.en is mandatory, because the file might
+ // contain license texts.
+ assertMandatoryFile( _descrdir / "packages.en" );
parseLocaleIf( Locale("en") );
- parseLocaleIf( Locale("de_DE") );
+ // For each wanted locale at least
+ // some fallback, if locale is not present.
parseLocaleIf( ZConfig().defaultTextLocale() );
// Now process the rest of RepoIndex
@@ -224,18 +403,26 @@
{
if ( isPatternFile( it->first ) )
{
- PatternFileReader reader;
- reader.setConsumer( bind( &Impl::consumePat, this, _1 ) );
- reader.parse( _descrdir / it->first );
+ Pathname inputfile( getOptionalFile( _descrdir / it->first) );
+ if ( ! inputfile.empty() )
+ {
+ PatternFileReader reader;
+ reader.setConsumer( bind( &Impl::consumePat, this, _1 ) );
+ CombinedProgressData patternprogress( _ticks, PathInfo(inputfile).size() );
+ reader.parse( inputfile, patternprogress );
+ }
}
-
- if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );
}
// Done
if ( ! _ticks.toMax() )
ZYPP_THROW( AbortRequestException() );
+
+ MIL << "DONE " << reporoot_r << "("
+ << _stats.prod << " products, "
+ << _stats.patt << " patterns, "
+ << _stats.pack << " packages, "
+ << _stats.srcp << " srcpackages)" << endl;
}
///////////////////////////////////////////////////////////////////
//
Modified: trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h (original)
+++ trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h Mon Jul 16 12:40:42 2007
@@ -77,7 +77,7 @@
TranslatedText license_to_confirm;
std::string vendor;
ByteCount size;
- ByteCount archive_size;
+ ByteCount downloadSize;
bool install_only;
Date build_time;
Date install_time;
Modified: trunk/libzypp/zypp/parser/xmlstore/XMLResObjectParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xmlstore/XMLResObjectParser.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/xmlstore/XMLResObjectParser.cc (original)
+++ trunk/libzypp/zypp/parser/xmlstore/XMLResObjectParser.cc Mon Jul 16 12:40:42 2007
@@ -83,7 +83,7 @@
dataPtr->size = str::strtonumByteCount::SizeType(_helper.content(child));
}
else if (name == "archive-size") {
- dataPtr->archive_size = str::strtonumByteCount::SizeType(_helper.content(child));
+ dataPtr->downloadSize = str::strtonumByteCount::SizeType(_helper.content(child));
}
else if (name == "install-only") {
dataPtr->install_only = (_helper.content(child) == "true") ? true : false;
Modified: trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.cc (original)
+++ trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.cc Mon Jul 16 12:40:42 2007
@@ -18,7 +18,7 @@
#include
#include
#include
-
+#include "zypp/repo/RepoType.h"
#include "XMLSourceCacheParser.h"
using namespace std;
@@ -30,8 +30,8 @@
XMLSourceCacheParser::XMLSourceCacheParser()
{ }
- XMLSourceCacheParser::XMLSourceCacheParser(SourceInfo_Ptr &entry)
- : zypp::parser::XMLNodeIterator(entry)
+ XMLSourceCacheParser::XMLSourceCacheParser(RepoInfo_Ptr &entry)
+ : zypp::parser::XMLNodeIterator(entry)
{ }
@@ -47,11 +47,11 @@
}
// do the actual processing
- SourceInfo_Ptr
+ RepoInfo_Ptr
XMLSourceCacheParser::process(const xmlTextReaderPtr reader)
{
assert(reader);
- SourceInfo_Ptr dataPtr( new source::SourceInfo );
+ RepoInfo_Ptr dataPtr( new RepoInfo );
xmlNodePtr dataNode = xmlTextReaderExpand(reader);
assert(dataNode);
@@ -80,15 +80,7 @@
}
else if (name == "type")
{
- dataPtr->setType(_helper.content(child));
- }
- else if (name == "product-dir")
- {
- dataPtr->setPath(_helper.content(child));
- }
- else if (name == "cache-dir")
- {
- dataPtr->setCacheDir(_helper.content(child));
+ dataPtr->setType(repo::RepoType(_helper.content(child)));
}
else if (name == "alias")
{
@@ -96,7 +88,7 @@
}
else if (name == "url")
{
- dataPtr->setUrl(_helper.content(child));
+ dataPtr->addBaseUrl(_helper.content(child));
}
else
{
@@ -110,7 +102,7 @@
XMLSourceCacheParser::XMLSourceCacheParser(std::istream &is, const std::string &baseUrl)
- : zypp::parser::XMLNodeIterator(is, baseUrl, SOURCESCHEMA)
+ : zypp::parser::XMLNodeIterator(is, baseUrl, SOURCESCHEMA)
{
fetchNext();
}
Modified: trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.h (original)
+++ trunk/libzypp/zypp/parser/xmlstore/XMLSourceCacheParser.h Mon Jul 16 12:40:42 2007
@@ -13,7 +13,7 @@
#ifndef XMLSourceCacheParser_h
#define XMLSourceCacheParser_h
-#include
+#include
#include
#include
#include <list>
@@ -24,7 +24,7 @@
{
namespace xmlstore
{
- typedef shared_ptrsource::SourceInfo SourceInfo_Ptr;
+ typedef shared_ptr<RepoInfo> RepoInfo_Ptr;
/*
* Use this class as an iterator that produces, one after one,
@@ -46,18 +46,18 @@
* You can query the exit status with errorStatus().
*/
- class XMLSourceCacheParser : public zypp::parser::XMLNodeIterator
+ class XMLSourceCacheParser : public zypp::parser::XMLNodeIterator
{
public:
XMLSourceCacheParser(std::istream &is, const std::string &baseUrl);
XMLSourceCacheParser();
- XMLSourceCacheParser(SourceInfo_Ptr & entry);
+ XMLSourceCacheParser(RepoInfo_Ptr & entry);
virtual ~XMLSourceCacheParser();
private:
virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual SourceInfo_Ptr process(const xmlTextReaderPtr reader);
- void parseSourceList(SourceInfo_Ptr dataPtr, xmlNodePtr node);
+ virtual RepoInfo_Ptr process(const xmlTextReaderPtr reader);
+ void parseSourceList(RepoInfo_Ptr dataPtr, xmlNodePtr node);
zypp::parser::LibXMLHelper _helper;
};
} // namespace parser
Modified: trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc (original)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc Mon Jul 16 12:40:42 2007
@@ -87,9 +87,9 @@
// xpath: //package/checksum
if (reader_r->name() == "checksum")
{
- package_ptr->repositoryLocation.fileChecksum = CheckSum(
+ package_ptr->repositoryLocation.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
// ignoring pkgid attribute
return true;
}
@@ -144,7 +144,7 @@
package_ptr->installedSize = str::strtonumByteCount::SizeType( reader_r->getAttribute("installed").asString() );
// rpm package size
- package_ptr->repositoryLocation.fileSize = str::strtonumByteCount::SizeType( reader_r->getAttribute("package").asString() );
+ package_ptr->repositoryLocation.setDownloadSize(str::strtonumByteCount::SizeType( reader_r->getAttribute("package").asString() ));
return true;
}
@@ -152,7 +152,7 @@
// xpath: //package/location
if (reader_r->name() == "location")
{
- package_ptr->repositoryLocation.filePath = reader_r->getAttribute("href").asString();
+ package_ptr->repositoryLocation.setFilename(reader_r->getAttribute("href").asString());
return true;
}
Modified: trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h (original)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h Mon Jul 16 12:40:42 2007
@@ -97,6 +97,7 @@
*
* \return true if the package node or current subnode has been consumed
* (no further processing is required), false otherwise.
+ * \throws ParseException if a serious error is encountered while parsing
*/
bool consumePackageNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr);
@@ -112,6 +113,7 @@
* Processes RPM dependency tags (rpm:entry, rpm:requires, ...).
*
* \return true if a dependency tag has been encountered, false otherwise.
+ * \throws ParseException if a serious error is encountered while parsing
*/
bool consumeDependency(xml::Reader & reader_r, data::Dependencies & deps_r);
Modified: trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PatchFileReader.cc Mon Jul 16 12:40:42 2007
@@ -510,7 +510,7 @@
// xpath: /patch/atoms/package/patchrpm/location
if (reader_r->name() == "location")
{
- _patchrpm->location.filePath = reader_r->getAttribute("href").asString();
+ _patchrpm->location.setFilename(reader_r->getAttribute("href").asString());
// ignoring attribute 'base'
return true;
}
@@ -518,9 +518,9 @@
// xpath: /patch/atoms/package/patchrpm/checksum
if (reader_r->name() == "checksum")
{
- _patchrpm->location.fileChecksum = CheckSum(
+ _patchrpm->location.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
@@ -540,8 +540,8 @@
if (reader_r->name() == "size")
{
// size of the rpm file
- _patchrpm->location.fileSize = str::strtonumByteCount::SizeType(
- reader_r->getAttribute("package").asString());
+ _patchrpm->location.setDownloadSize(str::strtonumByteCount::SizeType(
+ reader_r->getAttribute("package").asString()));
// size of ??
_patchrpm->archiveSize = str::strtonumByteCount::SizeType(
@@ -586,7 +586,7 @@
// xpath: /patch/atoms/package/deltarpm/location
if (reader_r->name() == "location")
{
- _deltarpm->location.filePath = reader_r->getAttribute("href").asString();
+ _deltarpm->location.setFilename(reader_r->getAttribute("href").asString());
// ignoring attribute 'base'
return true;
}
@@ -594,9 +594,9 @@
// xpath: /patch/atoms/package/deltarpm/checksum
if (reader_r->name() == "checksum")
{
- _deltarpm->location.fileChecksum = CheckSum(
+ _deltarpm->location.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
@@ -616,8 +616,8 @@
if (reader_r->name() == "size")
{
// size of the rpm file
- _deltarpm->location.fileSize = str::strtonumByteCount::SizeType(
- reader_r->getAttribute("package").asString());
+ _deltarpm->location.setDownloadSize(str::strtonumByteCount::SizeType(
+ reader_r->getAttribute("package").asString()));
// size of ??
_deltarpm->archiveSize = str::strtonumByteCount::SizeType(
@@ -763,16 +763,16 @@
// ignoring reader_r->getAttribute("xml:base").asString();
// xsd:anyURI do script file path
- script->doScriptLocation.filePath = reader_r->getAttribute("href").asString();
+ script->doScriptLocation.setFilename(reader_r->getAttribute("href").asString());
return true;
}
// xpath: /patch/atoms/script/do-checksum
if (reader_r->name() == "do-checksum")
{
- script->doScriptLocation.fileChecksum = CheckSum(
+ script->doScriptLocation.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
@@ -783,16 +783,16 @@
// ignoring reader_r->getAttribute("xml:base").asString();
// xsd:anyURI undo script file path
- script->undoScriptLocation.filePath = reader_r->getAttribute("href").asString();
+ script->undoScriptLocation.setFilename(reader_r->getAttribute("href").asString());
return true;
}
// xpath: /patch/atoms/script/undo-checksum
if (reader_r->name() == "undo-checksum")
{
- script->undoScriptLocation.fileChecksum = CheckSum(
+ script->undoScriptLocation.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
}
Modified: trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc Mon Jul 16 12:40:42 2007
@@ -103,7 +103,7 @@
if ( reader_r->name() == "location" )
{
_tag = tag_Location;
- _location.filename( reader_r->getAttribute("href").asString() );
+ _location.setFilename( reader_r->getAttribute("href").asString() );
return true;
}
if ( reader_r->name() == "checksum" )
@@ -111,7 +111,7 @@
_tag = tag_CheckSum;
string checksum_type = reader_r->getAttribute("type").asString() ;
string checksum_vaue = reader_r.nodeText().asString();
- _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
+ _location.setChecksum( CheckSum( checksum_type, checksum_vaue ) );
return true;
}
if ( reader_r->name() == "timestamp" )
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc Mon Jul 16 12:40:42 2007
@@ -53,6 +53,8 @@
*
* \param the xml reader object reading the file
* \return true to tell the reader to continue, false to tell it to stop
+ * \throws AbortRequestException if user request for aborting the parsing
+ * has been received through progress reporting callback.
*
* \note Semantics of this method's return value also differs from other
* consume* methods. While this method's return value tells the the
@@ -113,6 +115,7 @@
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
+ // xpath: /metadata
if (reader_r->name() == "metadata")
{
unsigned total_packages;
@@ -122,6 +125,7 @@
return true;
}
+ // xpath: /metdata/package (+)
if (reader_r->name() == "package")
{
tag(tag_package);
@@ -134,6 +138,7 @@
else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
{
+ // xpath: /metdata/package (+)
if (reader_r->name() == "package")
{
if (_package && _callback)
@@ -146,6 +151,7 @@
return true;
}
+ // xpath: /metdata
if (reader_r->name() == "metadata")
{
_ticks.toMax();
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h Mon Jul 16 12:40:42 2007
@@ -59,6 +59,8 @@
* \param primary_file the primary.xml.gz file you want to read
* \param callback function to process \ref _package data.
* \param progress progress reporting function
+ * \throws AbortRequestException if user request for aborting the parsing
+ * has been received through progress reporting callback.
*
* \see PrimaryFileReader::ProcessPackage
*/
Modified: trunk/libzypp/zypp/parser/yum/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepoParser.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepoParser.cc (original)
+++ trunk/libzypp/zypp/parser/yum/RepoParser.cc Mon Jul 16 12:40:42 2007
@@ -13,7 +13,7 @@
#include "zypp/ZConfig.h"
#include "zypp/base/Logger.h"
-
+#include "zypp/PathInfo.h"
#include "zypp/base/UserRequestException.h"
#include "zypp/repo/yum/ResourceType.h"
@@ -42,16 +42,6 @@
namespace yum
{
-
- /** \todo make this through ZYppCallbacks.h */
- bool progress_function(ProgressData::value_type p)
- {
- cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
-// cout << "\rParsing $name_would_come_in_handy [" << p << "%]" << flush;
- return true;
- }
-
-
/**
* Structure encapsulating YUM parser data type and filename.
*/
@@ -192,7 +182,7 @@
:
_repository_id(repository_id), _consumer(consumer), _options(options)
{
- _ticks.name("RepoParser");
+ _ticks.name("YUM RepoParser");
_ticks.sendTo(progress);
}
@@ -316,10 +306,18 @@
cache_dir + "/repodata/repomd.xml",
bind(&RepoParser::Impl::repomd_CB, this, _1, _2));
+ long long totalsize = 0;
+ for(list<RepoParserJob>::const_iterator it = _jobs.begin();
+ it != _jobs.end(); ++it)
+ {
+ RepoParserJob job = *it;
+ totalsize += PathInfo(cache_dir + job.filename()).size();
+ }
- _ticks.range(_jobs.size());
+ MIL << "Total files size: " << totalsize << endl;
+ _ticks.range(totalsize);
_ticks.toMin();
-
+
doJobs(cache_dir);
_ticks.toMax();
@@ -333,18 +331,22 @@
it != _jobs.end(); ++it)
{
RepoParserJob job = *it;
-
- MIL << "going to parse " << job.type() << " file " << job.filename() << endl;
-
+ // FIXME better way to do progress here?
+ int jobsize = PathInfo(cache_dir + job.filename()).size();
+
+ MIL << "going to parse " << job.type() << " file "
+ << job.filename() << " (" << jobsize << " bytes)" << endl;
+
switch(job.type().toEnum())
{
// parse primary.xml.gz
case ResourceType::PRIMARY_e:
{
+ CombinedProgressData jobrcv( _ticks, jobsize );
PrimaryFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::primary_CB, this, _1),
- &progress_function);
+ jobrcv);
break;
}
@@ -355,7 +357,10 @@
bind(&RepoParser::Impl::patches_CB, this, _1, _2));
// reset progress reporter max value (number of jobs changed if
// there are patches to parse)
- _ticks.range(_jobs.size());
+ _ticks.range( _ticks.max() + jobsize );
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
@@ -364,6 +369,9 @@
PatchFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::patch_CB, this, _1));
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
@@ -371,13 +379,19 @@
{
if (!_options.skipOther)
{
+ CombinedProgressData jobrcv( _ticks, jobsize );
OtherFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::other_CB, this, _1, _2),
- &progress_function);
+ jobrcv);
}
else
+ {
MIL << "skipping other.xml.gz";
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
+ }
break;
}
@@ -385,14 +399,19 @@
{
if (!_options.skipFilelists)
{
+ CombinedProgressData jobrcv( _ticks, jobsize );
FilelistsFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::filelist_CB, this, _1, _2),
- &progress_function);
+ jobrcv);
}
else
+ {
MIL << "skipping filelists.xml.gz";
-
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
+ }
break;
}
@@ -401,6 +420,9 @@
PatternFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::pattern_CB, this, _1));
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
@@ -409,6 +431,9 @@
ProductFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::product_CB, this, _1));
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
@@ -419,9 +444,6 @@
<< job.filename() << endl;
}
}
-
- if (!_ticks.incr())
- ZYPP_THROW(AbortRequestException());
}
}
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc Mon Jul 16 12:40:42 2007
@@ -137,7 +137,7 @@
if ( reader_r->name() == "location" )
{
_tag = tag_Location;
- _location.filename( reader_r->getAttribute("href").asString() );
+ _location.setFilename( reader_r->getAttribute("href").asString() );
// ignoring attribute xml:base
return true;
}
@@ -148,7 +148,7 @@
_tag = tag_CheckSum;
string checksum_type = reader_r->getAttribute("type").asString() ;
string checksum_vaue = reader_r.nodeText().asString();
- _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
+ _location.setChecksum( CheckSum( checksum_type, checksum_vaue ) );
return true;
}
Modified: trunk/libzypp/zypp/pool/GetResolvablesToInsDel.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/GetResolvablesToInsDel.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/pool/GetResolvablesToInsDel.cc (original)
+++ trunk/libzypp/zypp/pool/GetResolvablesToInsDel.cc Mon Jul 16 12:40:42 2007
@@ -208,7 +208,7 @@
for ( PoolItemList items = order.computeNextSet(); ! items.empty(); items = order.computeNextSet() )
{
- MIL << "order.computeNextSet: " << items.size() << " resolvables" << endl;
+ XXX << "order.computeNextSet: " << items.size() << " resolvables" << endl;
///////////////////////////////////////////////////////////////////
// items contains all objects we could install now. Pick all objects
// from current media, or best media if none for current. Alwayys pick
@@ -225,15 +225,15 @@
if (!cobj)
continue;
- if ( ! cobj->sourceMediaNr() ) {
+ if ( ! cobj->mediaNr() ) {
XXX << "No media access required for " << *cit << endl;
order.setInstalled( *cit );
other_list.push_back( *cit );
continue;
}
- if ( cobj->source().numericId() == last_prio &&
- cobj->sourceMediaNr() == last_medianum ) {
+ if ( cobj->repository().numericId() == last_prio &&
+ cobj->mediaNr() == last_medianum ) {
// prefer packages on current media.
XXX << "Stay with current media " << *cit << endl;
last_list.push_back( *cit );
@@ -247,12 +247,12 @@
if ( order_r == ORDER_BY_MEDIANR )
{
- if ( cobj->sourceMediaNr() < best_medianum ) {
+ if ( cobj->mediaNr() < best_medianum ) {
best_list.clear(); // new best
- } else if ( cobj->sourceMediaNr() == best_medianum ) {
- if ( cobj->source().numericId() < best_prio ) {
+ } else if ( cobj->mediaNr() == best_medianum ) {
+ if ( cobj->repository().numericId() < best_prio ) {
best_list.clear(); // new best
- } else if ( cobj->source().numericId() == best_prio ) {
+ } else if ( cobj->repository().numericId() == best_prio ) {
XXX << "Add to best list " << *cit << endl;
best_list.push_back( *cit ); // same as best -> add
continue;
@@ -265,12 +265,12 @@
}
else // default: ORDER_BY_SOURCE
{
- if ( cobj->source().numericId() < best_prio ) {
+ if ( cobj->repository().numericId() < best_prio ) {
best_list.clear(); // new best
- } else if ( cobj->source().numericId() == best_prio ) {
- if ( cobj->sourceMediaNr() < best_medianum ) {
+ } else if ( cobj->repository().numericId() == best_prio ) {
+ if ( cobj->mediaNr() < best_medianum ) {
best_list.clear(); // new best
- } else if ( cobj->sourceMediaNr() == best_medianum ) {
+ } else if ( cobj->mediaNr() == best_medianum ) {
XXX << "Add to best list " << *cit << endl;
best_list.push_back( *cit ); // same as best -> add
continue;
@@ -285,10 +285,10 @@
if ( best_list.empty() )
{
- XXX << "NEW BEST LIST [S" << cobj->source().numericId() << ":" << cobj->sourceMediaNr()
+ XXX << "NEW BEST LIST [S" << cobj->repository().numericId() << ":" << cobj->mediaNr()
<< "] (last [S" << best_prio << ":" << best_medianum << "])" << endl;
- best_prio = cobj->source().numericId();
- best_medianum = cobj->sourceMediaNr();
+ best_prio = cobj->repository().numericId();
+ best_medianum = cobj->mediaNr();
// first package or new best
XXX << "Add to best list " << *cit << endl;
best_list.push_back( *cit );
@@ -311,7 +311,7 @@
}
else
{
- MIL << "SET CONTINUE [S" << best_prio << ":" << best_medianum << "]" << endl;
+ XXX << "SET CONTINUE [S" << best_prio << ":" << best_medianum << "]" << endl;
}
for ( PoolItemList::iterator it = take_list.begin(); it != take_list.end(); ++it )
@@ -327,6 +327,7 @@
} // for all sets computed
+ MIL << "order done" << endl;
if ( instbackup_r.size() != instlist_r.size() )
{
ERR << "***************** Lost packages in InstallOrder sort." << endl;
Modified: trunk/libzypp/zypp/pool/PoolImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/PoolImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/pool/PoolImpl.h (original)
+++ trunk/libzypp/zypp/pool/PoolImpl.h Mon Jul 16 12:40:42 2007
@@ -15,6 +15,7 @@
#include <iosfwd>
#include <map>
+#include "zypp/base/Easy.h"
#include "zypp/pool/PoolTraits.h"
#include "zypp/ResPoolProxy.h"
#include "zypp/ZYppFactory.h"
@@ -26,7 +27,6 @@
namespace pool
{ /////////////////////////////////////////////////////////////////
-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : NameHash
@@ -191,7 +191,8 @@
typedef PoolTraits::size_type size_type;
typedef PoolTraits::Inserter Inserter;
typedef PoolTraits::Deleter Deleter;
- typedef PoolTraits::AdditionalCapSet AdditionalCapSet;
+ typedef PoolTraits::AdditionalCapSet AdditionalCapSet;
+ typedef PoolTraits::RepoContainerT KnownRepositories;
public:
/** Default ctor */
@@ -233,11 +234,11 @@
{ return _store.end(); }
/**
- * Handling additional requirement. E.G. need package "foo" and package
+ * Handling additional requirement. E.G. need package "foo" and package
* "foo1" which has a greater version than 1.0:
*
* Capset capset;
- * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
+ * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo1 > 1.0"));
*
* setAdditionalRequire( capset );
@@ -250,25 +251,25 @@
/**
* Handling additional conflicts. E.G. do not install anything which provides "foo":
*
- * Capset capset;
+ * Capset capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
- * setAdditionalConflict( capset );
- */
+ * setAdditionalConflict( capset );
+ */
void setAdditionalConflict( const AdditionalCapSet & capset ) const
- { _additionaConflict = capset; }
+ { _additionaConflict = capset; }
AdditionalCapSet & additionaConflict() const
{ return _additionaConflict; }
-
+
/**
* Handling additional provides. This is used for ignoring a requirement.
* e.G. Do ignore the requirement "foo":
*
- * Capset capset;
+ * Capset capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
- * setAdditionalProvide( cap );
- */
+ * setAdditionalProvide( cap );
+ */
void setAdditionalProvide( const AdditionalCapSet & capset ) const
{ _additionaProvide = capset; }
AdditionalCapSet & additionaProvide() const
@@ -282,7 +283,8 @@
_additionalRequire.clear();
_additionaConflict.clear();
_additionaProvide.clear();
-
+ // don't miss to invalidate ResPoolProxy
+ invalidateProxy();
return;
}
@@ -290,6 +292,27 @@
void eraseInstalled() const;
public:
+ /** Access list of Repositories that contribute ResObjects.
+ * Built on demand.
+ */
+ const KnownRepositories & knownRepositories() const
+ {
+ if ( ! _knownRepositoriesPtr )
+ {
+ _knownRepositoriesPtr.reset( new KnownRepositories );
+ for_( it, _store.begin(), _store.end() )
+ {
+ if ( (*it)->repository() != Repository::noRepository )
+ {
+ _knownRepositoriesPtr->insert( (*it)->repository() );
+ }
+ }
+ }
+
+ return *_knownRepositoriesPtr;
+ }
+
+ public:
/** \name Save and restore state. */
//@{
void SaveState( const ResObject::Kind & kind_r );
@@ -314,9 +337,18 @@
return *_poolProxy;
}
void invalidateProxy()
- { _poolProxy.reset(); }
+ {
+ _poolProxy.reset();
+ _knownRepositoriesPtr.reset();
+ }
mutable shared_ptr<ResPoolProxy> _poolProxy;
+
+ private:
+ /** Set of known repositories built on demand.
+ * Invalidated on any Pool content change. Rebuilt on next access.
+ */
+ mutable scoped_ptr<KnownRepositories> _knownRepositoriesPtr;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/pool/PoolTraits.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/PoolTraits.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/pool/PoolTraits.h (original)
+++ trunk/libzypp/zypp/pool/PoolTraits.h Mon Jul 16 12:40:42 2007
@@ -17,13 +17,16 @@
#include "zypp/PoolItem.h"
#include "zypp/Capability.h"
-#include "zypp/CapAndItem.h"
#include "zypp/Dep.h"
#include "zypp/ResStatus.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+ class CapAndItem;
+ class Repository;
+
///////////////////////////////////////////////////////////////////
namespace pool
{ /////////////////////////////////////////////////////////////////
@@ -77,7 +80,7 @@
typedef ItemContainerT::const_iterator byName_iterator;
// internal organization
- typedef std::list<CapAndItem> CapItemContainerT; // (why,who) pairs
+ typedef std::listzypp::CapAndItem CapItemContainerT; // (why,who) pairs
typedef std::mapstd::string,CapItemContainerT CapItemStoreT; // capability.index -> (why,who) pairs
typedef std::map DepCapItemContainerT; // Dep -> (capability.index -> (why,who) pairs)
@@ -87,6 +90,10 @@
/** hashed by capability index */
typedef const_capitemiterator byCapabilityIndex_iterator;
+ /* list of known Repositories */
+ typedef std::set<Repository> RepoContainerT;
+ typedef RepoContainerT::const_iterator repository_iterator;
+
typedef PoolImpl Impl;
typedef shared_ptr<PoolImpl> Impl_Ptr;
typedef shared_ptr<const PoolImpl> Impl_constPtr;
@@ -95,7 +102,7 @@
/** Map of CapSet and "who" has set it*/
typedef std::mapResStatus::TransactByValue,CapSet AdditionalCapSet;
-
+
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/DeltaCandidates.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/DeltaCandidates.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/DeltaCandidates.cc (original)
+++ trunk/libzypp/zypp/repo/DeltaCandidates.cc Mon Jul 16 12:40:42 2007
@@ -28,7 +28,7 @@
public:
- Impl( const std::set<Repository> & repos )
+ Impl( const std::list<Repository> & repos )
: repos(repos)
{
@@ -39,7 +39,7 @@
Impl * clone() const
{ return new Impl( *this ); }
- std::set<Repository> repos;
+ std::list<Repository> repos;
};
///////////////////////////////////////////////////////////////////
@@ -49,7 +49,7 @@
return str << "DeltaCandidates::Impl";
}
- DeltaCandidates::DeltaCandidates(const std::set<Repository> & repos)
+ DeltaCandidates::DeltaCandidates(const std::list<Repository> & repos)
: _pimpl( new Impl(repos) )
{}
@@ -61,7 +61,7 @@
std::list<PatchRpm> candidates;
// query all repos
- for ( std::set<Repository>::const_iterator it = _pimpl->repos.begin();
+ for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
it != _pimpl->repos.end();
++it )
{
@@ -83,7 +83,7 @@
std::list<DeltaRpm> candidates;
// query all repos
- for ( std::set<Repository>::const_iterator it = _pimpl->repos.begin();
+ for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
it != _pimpl->repos.end();
++it )
{
Modified: trunk/libzypp/zypp/repo/DeltaCandidates.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/DeltaCandidates.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/DeltaCandidates.h (original)
+++ trunk/libzypp/zypp/repo/DeltaCandidates.h Mon Jul 16 12:40:42 2007
@@ -11,7 +11,7 @@
#define ZYPP_REPO_DELTACANDIDATES_H
#include <iosfwd>
-#include <set>
+#include <list>
#include "zypp/base/PtrTypes.h"
#include "zypp/base/Function.h"
@@ -28,6 +28,10 @@
/**
* \short Candidate delta and patches for a package
+ *
+ * Basically a container that given N repositories,
+ * gets all patches and deltas from them for a given
+ * package.
*/
class DeltaCandidates
{
@@ -43,7 +47,7 @@
* \param repos Set of repositories providing patch and delta packages
* \param installed_callback Will be used to ask if a package is installed or not
*/
- DeltaCandidates( const std::set<Repository> & repos );
+ DeltaCandidates( const std::list<Repository> & repos );
/** Dtor */
~DeltaCandidates();
Modified: trunk/libzypp/zypp/repo/PackageProvider.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageProvider.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/PackageProvider.cc (original)
+++ trunk/libzypp/zypp/repo/PackageProvider.cc Mon Jul 16 12:40:42 2007
@@ -18,8 +18,8 @@
#include "zypp/Repository.h"
#include "zypp/repo/PackageProvider.h"
#include "zypp/repo/RepoProvideFile.h"
-#include "zypp/source/Applydeltarpm.h"
-#include "zypp/source/PackageDelta.h"
+#include "zypp/repo/Applydeltarpm.h"
+#include "zypp/repo/PackageDelta.h"
#include "zypp/detail/ImplConnect.h"
#include "zypp/RepoInfo.h"
@@ -113,7 +113,7 @@
}
} while ( _retry );
- report()->finish( _package, source::DownloadResolvableReport::NO_ERROR, std::string() );
+ report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
MIL << "provided Package " << _package << " at " << ret << endl;
return ret;
}
@@ -181,12 +181,8 @@
// no patch/delta -> provide full package
ManagedFile ret;
- OnMediaLocation loc;
- loc.medianr( _package->mediaNr() )
- .filename( _package->location() )
- .checksum( _package->checksum() )
- .downloadsize( _package->archivesize() );
-
+ OnMediaLocation loc = _package->location();
+
ProvideFilePolicy policy;
policy.progressCB( bind( &PackageProvider::progressPackageDownload, this, _1 ) );
policy.failOnChecksumErrorCB( bind( &PackageProvider::failOnChecksumError, this ) );
@@ -204,7 +200,7 @@
return ManagedFile();
report()->startDeltaDownload( delta_r.location().filename(),
- delta_r.location().downloadsize() );
+ delta_r.location().downloadSize() );
ManagedFile delta;
try
{
@@ -228,8 +224,9 @@
Pathname destination( Pathname::dirname( delta ) / defRpmFileName( _package ) );
/* just to ease testing with non remote sources */
- if ( ! _package->source().remote() )
- destination = Pathname("/tmp") / defRpmFileName( _package );
+ // FIXME removed API
+ //if ( ! _package->source().remote() )
+ // destination = Pathname("/tmp") / defRpmFileName( _package );
/**/
if ( ! applydeltarpm::provide( delta, destination,
@@ -254,7 +251,7 @@
return ManagedFile();
report()->startPatchDownload( patch_r.location().filename(),
- patch_r.location().downloadsize() );
+ patch_r.location().downloadSize() );
ManagedFile patch;
try
{
@@ -302,12 +299,12 @@
std::string package_str = _package->name() + "-" + _package->edition().asString();
// TranslatorExplanation %s = package being checked for integrity
- switch ( report()->problem( _package, source::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry?"), package_str.c_str() ) ) )
+ switch ( report()->problem( _package, repo::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry?"), package_str.c_str() ) ) )
{
- case source::DownloadResolvableReport::RETRY:
+ case repo::DownloadResolvableReport::RETRY:
_retry = true;
break;
- case source::DownloadResolvableReport::IGNORE:
+ case repo::DownloadResolvableReport::IGNORE:
ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
break;
default:
@@ -321,7 +318,7 @@
/////////////////////////////////////////////////////////////////
- } // namespace source
+ } // namespace repo
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace zypp
Modified: trunk/libzypp/zypp/repo/PackageProvider.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageProvider.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/PackageProvider.h (original)
+++ trunk/libzypp/zypp/repo/PackageProvider.h Mon Jul 16 12:40:42 2007
@@ -65,7 +65,7 @@
class PackageProvider : private base::NonCopyable
{
typedef shared_ptr<void> ScopedGuard;
- typedef callback::SendReportsource::DownloadResolvableReport Report;
+ typedef callback::SendReportrepo::DownloadResolvableReport Report;
typedef detail::ResImplTraitsPackage::Impl::constPtr PackageImpl_constPtr;
typedef packagedelta::DeltaRpm DeltaRpm;
Modified: trunk/libzypp/zypp/repo/RepoProvideFile.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoProvideFile.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoProvideFile.cc (original)
+++ trunk/libzypp/zypp/repo/RepoProvideFile.cc Mon Jul 16 12:40:42 2007
@@ -43,7 +43,7 @@
* We redirect the static report triggered from Repository::provideFile
* to feed the ProvideFilePolicy callbacks.
*/
- struct DownloadFileReportHack : public callback::ReceiveReportsource::SourceReport
+ struct DownloadFileReportHack : public callback::ReceiveReportrepo::RepoReport
{
virtual bool progress( int value )
{
@@ -89,7 +89,7 @@
DownloadFileReportHack dumb;
dumb._redirect = bind( mem_fun_ref( &ProvideFilePolicy::progress ),
ref( policy_r ), _1 );
- callback::TempConnectsource::SourceReport temp( dumb );
+ callback::TempConnectrepo::RepoReport temp( dumb );
Url url;
RepoInfo info = repo_r.info();
Modified: trunk/libzypp/zypp/repo/RepoType.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoType.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoType.cc (original)
+++ trunk/libzypp/zypp/repo/RepoType.cc Mon Jul 16 12:40:42 2007
@@ -21,7 +21,8 @@
const RepoType RepoType::RPMMD(RepoType::RPMMD_e);
const RepoType RepoType::YAST2(RepoType::YAST2_e);
- //const RepoType RepoType::NONE(RepoType::NONE_e);
+ const RepoType RepoType::RPMPLAINDIR(RepoType::RPMPLAINDIR_e);
+ const RepoType RepoType::NONE(RepoType::NONE_e);
RepoType::RepoType(const std::string & strval_r)
: _type(parse(strval_r))
@@ -39,6 +40,7 @@
_table["susetags"] = RepoType::YAST2_e;
_table["yast"] = RepoType::YAST2_e;
_table["yast2"] = RepoType::YAST2_e;
+ _table["plaindir"] = RepoType::RPMPLAINDIR_e;
_table["NONE"] = _table["none"] = RepoType::NONE_e;
}
@@ -61,6 +63,7 @@
// initialize it
_table[RPMMD_e] = "rpm-md";
_table[YAST2_e] = "yast2";
+ _table[RPMPLAINDIR_e] = "plaindir";
_table[NONE_e] = "NONE";
}
return _table[_type];
Modified: trunk/libzypp/zypp/repo/RepoType.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoType.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoType.h (original)
+++ trunk/libzypp/zypp/repo/RepoType.h Mon Jul 16 12:40:42 2007
@@ -17,7 +17,7 @@
{
namespace repo
{
-
+
/**
* \short Repository type enumeration
*
@@ -28,21 +28,25 @@
{
static const RepoType RPMMD;
static const RepoType YAST2;
- //static const RepoType NONE;
-
+ static const RepoType RPMPLAINDIR;
+ static const RepoType NONE;
+
enum Type
{
NONE_e,
RPMMD_e,
- YAST2_e
+ YAST2_e,
+ RPMPLAINDIR_e,
};
+ RepoType() : _type(NONE_e) {}
+
RepoType(Type type) : _type(type) {}
explicit RepoType(const std::string & strval_r);
const Type toEnum() const { return _type; }
-
+
RepoType::Type parse(const std::string & strval_r);
const std::string & asString() const;
Modified: trunk/libzypp/zypp/repo/RepositoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepositoryImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepositoryImpl.cc (original)
+++ trunk/libzypp/zypp/repo/RepositoryImpl.cc Mon Jul 16 12:40:42 2007
@@ -1,17 +1,22 @@
+#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
+using namespace zypp;
+using namespace std;
+
namespace zypp { namespace repo {
IMPL_PTR_TYPE(RepositoryImpl)
RepositoryImpl::RepositoryImpl( const RepoInfo &info )
- : _info(info)
+ : _restore_lazy_initialized(false),
+ _info(info)
{
}
-const RepoInfo RepositoryImpl::info() const
+const RepoInfo & RepositoryImpl::info() const
{
return _info;
}
@@ -28,15 +33,30 @@
const ResStore & RepositoryImpl::resolvables() const
{
+ if ( ! _restore_lazy_initialized )
+ {
+ const_cast(this)->createResolvables();
+ const_cast(this)->_restore_lazy_initialized = true;
+ }
return _store;
}
+void RepositoryImpl::createResolvables()
+{
+ WAR << "createResolvables() not implemented" << endl;
+}
+
+void RepositoryImpl::createPatchAndDeltas()
+{
+ WAR << "createPatchAndDeltas() not implemented" << endl;
+}
+
const std::listpackagedelta::PatchRpm &
RepositoryImpl::patchRpms() const
{
return _patchRpms;
}
-
+
const std::listpackagedelta::DeltaRpm &
RepositoryImpl::deltaRpms() const
{
Modified: trunk/libzypp/zypp/repo/RepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepositoryImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepositoryImpl.h (original)
+++ trunk/libzypp/zypp/repo/RepositoryImpl.h Mon Jul 16 12:40:42 2007
@@ -29,34 +29,36 @@
{
friend std::ostream & operator<<( std::ostream & str, const RepositoryImpl & obj );
public:
-
+
/**
* \short Ctor.
* \param info What is known about this source at construction time.
*
*/
RepositoryImpl( const RepoInfo &info = RepoInfo() );
-
+
+ /**
+ * \short Dtor
+ */
+ ~RepositoryImpl();
+
/**
* \short Information about this repository
* You can't change this information after creation.
* Use \ref RepoManager for that.
*/
- const RepoInfo info() const;
-
- /**
- * \short Dtor
- */
- ~RepositoryImpl();
+ const RepoInfo & info() const;
const ResStore & resolvables() const;
- struct null {};
-
const std::listpackagedelta::PatchRpm & patchRpms() const;
const std::listpackagedelta::DeltaRpm & deltaRpms() const;
-
+
+ virtual void createResolvables();
+ virtual void createPatchAndDeltas();
public:
+ struct null {};
+
/** Offer default Impl. */
static RepositoryImpl_Ptr nullimpl()
{
@@ -68,13 +70,14 @@
Repository selfRepository()
{ return Repository( this ); }
+
protected:
- RepoInfo _info;
-
ResStore _store;
-
std::listpackagedelta::PatchRpm _patchRpms;
std::listpackagedelta::DeltaRpm _deltaRpms;
+ bool _restore_lazy_initialized;
+ private:
+ RepoInfo _info;
};
}
}
Modified: trunk/libzypp/zypp/repo/cached/AtomImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/AtomImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/AtomImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/AtomImpl.cc Mon Jul 16 12:40:42 2007
@@ -12,11 +12,11 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "AtomImpl.h"
-
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp::detail;
-using namespace::zypp::repo;
+//using namespace::zypp::repo;
///////////////////////////////////////////////////////////////////
namespace zypp { namespace repo { namespace cached {
@@ -46,53 +46,47 @@
TranslatedText AtomImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText AtomImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText AtomImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText AtomImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText AtomImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor AtomImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
-
ByteCount AtomImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount AtomImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool AtomImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date AtomImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date AtomImpl::installtime() const
@@ -100,15 +94,6 @@
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref AtomImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned AtomImpl::mediaNr() const
{
return 1;
Modified: trunk/libzypp/zypp/repo/cached/AtomImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/AtomImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/AtomImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/AtomImpl.h Mon Jul 16 12:40:42 2007
@@ -38,17 +38,15 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/MessageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/MessageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/MessageImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/MessageImpl.cc Mon Jul 16 12:40:42 2007
@@ -12,6 +12,7 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "MessageImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
@@ -46,53 +47,48 @@
TranslatedText MessageImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText MessageImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText MessageImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText MessageImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText MessageImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor MessageImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount MessageImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount MessageImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool MessageImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date MessageImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date MessageImpl::installtime() const
@@ -100,15 +96,6 @@
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref MessageImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned MessageImpl::mediaNr() const
{
return 1;
@@ -120,14 +107,14 @@
TranslatedText MessageImpl::text() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Message", "text" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrMessageText() );
}
Patch::constPtr MessageImpl::patch() const
{
return 0;
}
-
+
/////////////////////////////////////////////////////////////////
} } } // namespace zypp::repo::cached
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/cached/MessageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/MessageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/MessageImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/MessageImpl.h Mon Jul 16 12:40:42 2007
@@ -38,12 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
// MESSAGE
@@ -52,7 +50,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/PackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PackageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/PackageImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/PackageImpl.cc Mon Jul 16 12:40:42 2007
@@ -15,7 +15,7 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "PackageImpl.h"
-
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp::detail;
@@ -49,53 +49,47 @@
TranslatedText PackageImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText PackageImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText PackageImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText PackageImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText PackageImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor PackageImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
-
ByteCount PackageImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount PackageImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool PackageImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date PackageImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date PackageImpl::installtime() const
@@ -103,59 +97,35 @@
return Date();
}
-unsigned PackageImpl::repositoryMediaNr() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "repositoryMediaNr" );
-}
-
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref PackageImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned PackageImpl::mediaNr() const
-{
- return 1;
-}
-
-CheckSum PackageImpl::checksum() const
-{
- return CheckSum();
-}
-
std::string PackageImpl::buildhost() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "buildhost" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageBuildhost() );
}
std::string PackageImpl::distribution() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "distribution" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageDistribution() );
}
Label PackageImpl::license() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "license" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLicense() );
}
std::string PackageImpl::packager() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "packager" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePackager() );
}
PackageGroup PackageImpl::group() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "group" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageGroup() );
}
PackageImpl::Keywords PackageImpl::keywords() const
{
PackageImpl::Keywords keywords;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Package", "keywords", std::inserter(keywords, keywords.begin()) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrPackageKeywords(), std::inserter(keywords, keywords.begin()) );
return keywords;
}
@@ -164,39 +134,55 @@
return Changelog();
}
-Pathname PackageImpl::location() const
+OnMediaLocation PackageImpl::location() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "location" );
+ OnMediaLocation loc;
+ 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;
}
std::string PackageImpl::url() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "url" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageUrl() );
}
std::string PackageImpl::os() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "operatingSystem" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageOperatingSystem() );
}
Text PackageImpl::prein() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "prein" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePrein() );
}
Text PackageImpl::postin() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "postin" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePostin() );
}
Text PackageImpl::preun() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "preun" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePreun() );
}
Text PackageImpl::postun() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "postun" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePostun() );
}
ByteCount PackageImpl::sourcesize() const
@@ -212,7 +198,7 @@
list<string> PackageImpl::authors() const
{
list<string> authors;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Package", "authors", back_inserter(authors) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrPackageAuthors(), back_inserter(authors) );
return authors;
}
@@ -225,7 +211,7 @@
// {
// return std::list<DeltaRpm>();
// }
-//
+//
// std::list<PatchRpm> PackageImpl::patchRpms() const
// {
// return std::list<PatchRpm>();
Modified: trunk/libzypp/zypp/repo/cached/PackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PackageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/PackageImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/PackageImpl.h Mon Jul 16 12:40:42 2007
@@ -38,16 +38,11 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
// PACKAGE
- virtual CheckSum checksum() const;
virtual std::string buildhost() const;
virtual std::string distribution() const;
virtual Label license() const;
@@ -55,7 +50,6 @@
virtual PackageGroup group() const;
virtual Keywords keywords() const;
virtual Changelog changelog() const;
- virtual Pathname location() const;
virtual std::string url() const;
virtual std::string os() const;
virtual Text prein() const;
@@ -66,15 +60,15 @@
virtual DiskUsage diskusage() const;
virtual std::liststd::string authors() const;
virtual std::liststd::string filenames() const;
+ virtual OnMediaLocation location() const;
+
/*virtual std::list<DeltaRpm> deltaRpms() const;
virtual std::list<PatchRpm> patchRpms() const;
- */
- virtual unsigned repositoryMediaNr() const;
-
+ */
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/PatchImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PatchImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/PatchImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/PatchImpl.cc Mon Jul 16 12:40:42 2007
@@ -15,6 +15,7 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "PatchImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
@@ -49,53 +50,48 @@
TranslatedText PatchImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText PatchImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText PatchImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText PatchImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText PatchImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor PatchImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount PatchImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount PatchImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool PatchImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date PatchImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date PatchImpl::installtime() const
@@ -103,15 +99,6 @@
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref PatchImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned PatchImpl::mediaNr() const
{
return 1;
@@ -123,36 +110,41 @@
std::string PatchImpl::id() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Patch", "id" );
+#warning DUBIOUS ATTRIBUTE
+ return "";
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatchId() );
}
Date PatchImpl::timestamp() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "Patch", "timestamp" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPatchTimestamp() );
}
std::string PatchImpl::category() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Patch", "category" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatchCategory() );
}
bool PatchImpl::reboot_needed() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Patch", "rebootNeeded" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatchRebootNeeded() );
}
bool PatchImpl::affects_pkg_manager() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Patch", "affectsPkgManager" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatchAffectsPkgManager() );
}
bool PatchImpl::interactive() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Patch", "interactive" );
+#warning DUBIOUS ATTRIBUTE
+ return false;
+ //return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatchInteractive() );
}
PatchImpl::AtomList PatchImpl::all_atoms() const
{
+#warning DUBIOUS ATTRIBUTE
return PatchImpl::AtomList();
}
Modified: trunk/libzypp/zypp/repo/cached/PatchImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PatchImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/PatchImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/PatchImpl.h Mon Jul 16 12:40:42 2007
@@ -38,12 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
// PATCH
@@ -57,7 +55,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/PatternImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PatternImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/PatternImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/PatternImpl.cc Mon Jul 16 12:40:42 2007
@@ -15,6 +15,7 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "PatternImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
@@ -49,53 +50,48 @@
TranslatedText PatternImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText PatternImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText PatternImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText PatternImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText PatternImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor PatternImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount PatternImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount PatternImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool PatternImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date PatternImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date PatternImpl::installtime() const
@@ -104,62 +100,50 @@
}
//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref PatternImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned PatternImpl::mediaNr() const
-{
- return 1;
-}
-
-//////////////////////////////////////////
// PATTERN
/////////////////////////////////////////
bool PatternImpl::isDefault() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Pattern", "isDefault" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatternIsDefault() );
}
bool PatternImpl::userVisible() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Pattern", "userVisible" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatternUserVisible() );
}
TranslatedText PatternImpl::category() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Pattern", "isDefault" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrPatternCategory() );
}
Pathname PatternImpl::icon() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Pattern", "icon" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternIcon() );
}
Pathname PatternImpl::script() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Pattern", "script" );
+#warning DUBIOUS ATTRIBUTE
+ return "";
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternScript() );
}
Label PatternImpl::order() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Pattern", "order" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternOrder() );
}
//std::setstd::string install_packages( const Locale & lang = Locale("") ) const;
// const CapSet & PatternImpl::includes() const
// {
-//
+//
// }
-//
+//
// const CapSet & PatternImpl::extends() const
// {
-//
+//
// }
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/cached/PatternImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PatternImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/PatternImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/PatternImpl.h Mon Jul 16 12:40:42 2007
@@ -30,7 +30,7 @@
public:
PatternImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
-
+
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
virtual TranslatedText insnotify() const;
@@ -38,14 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// PATTERN
virtual bool isDefault() const;
virtual bool userVisible() const;
@@ -56,11 +52,11 @@
//virtual std::setstd::string install_packages( const Locale & lang = Locale("") ) const;
// virtual const CapSet & includes() const;
// virtual const CapSet & extends() const;
-
-
+
+
virtual Repository repository() const;
-
- protected:
+
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/ProductImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/ProductImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/ProductImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/ProductImpl.cc Mon Jul 16 12:40:42 2007
@@ -12,6 +12,7 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "ProductImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
@@ -46,53 +47,48 @@
TranslatedText ProductImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText ProductImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText ProductImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText ProductImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText ProductImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor ProductImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount ProductImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount ProductImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool ProductImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date ProductImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date ProductImpl::installtime() const
@@ -101,74 +97,64 @@
}
//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref ProductImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned ProductImpl::mediaNr() const
-{
- return 1;
-}
-
-//////////////////////////////////////////
// PRODUCT
/////////////////////////////////////////
std::string ProductImpl::category() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "category" );
+#warning DUBIOUS ATTRIBUTE
+ return "";
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductCategory() );
}
Url ProductImpl::releaseNotesUrl() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "releaseNotesUrl" );
+#warning DUBIOUS ATTRIBUTE
+ return Url();
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductReleaseNotesUrl() );
}
std::list<Url> ProductImpl::updateUrls() const
{
std::list<Url> urls;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "updateUrls", back_inserter(urls) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductUpdateUrls(), back_inserter(urls) );
return urls;
}
std::list<Url> ProductImpl::extraUrls() const
{
std::list<Url> urls;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "extraUrls", back_inserter(urls) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductExtraUrls(), back_inserter(urls) );
return urls;
}
std::list<Url> ProductImpl::optionalUrls() const
{
std::list<Url> urls;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "optionalUrls", back_inserter(urls) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductOptionalUrls(), back_inserter(urls) );
return urls;
}
list<string> ProductImpl::flags() const
{
list<string> flags;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "flags", back_inserter(flags) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductFlags(), back_inserter(flags) );
return flags;
}
TranslatedText ProductImpl::shortName() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Product", "shortName" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrProductShortName() );
}
std::string ProductImpl::distributionName() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "distributionName" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductDistributionName() );
}
Edition ProductImpl::distributionEdition() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "distributionEdition" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductDistributionEdition() );
}
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/cached/ProductImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/ProductImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/ProductImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/ProductImpl.h Mon Jul 16 12:40:42 2007
@@ -38,14 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// PRODUCT
virtual std::string category() const;
virtual Url releaseNotesUrl() const;
@@ -58,7 +54,7 @@
virtual Edition distributionEdition() const;
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/RepoImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/RepoImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/RepoImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/RepoImpl.cc Mon Jul 16 12:40:42 2007
@@ -10,6 +10,7 @@
#include <iostream>
#include <map>
+#include "zypp/base/Gettext.h"
#include "zypp/base/Logger.h"
#include "zypp/base/Measure.h"
#include "zypp/capability/Capabilities.h"
@@ -18,6 +19,8 @@
#include "zypp/CapFactory.h"
#include "zypp/Package.h"
+#include "zypp/SrcPackage.h"
+#include "zypp/Product.h"
#include "zypp/Pattern.h"
#include "zypp/Patch.h"
#include "zypp/Message.h"
@@ -26,11 +29,14 @@
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/repo/cached/PackageImpl.h"
+#include "zypp/repo/cached/SrcPackageImpl.h"
+#include "zypp/repo/cached/ProductImpl.h"
#include "zypp/repo/cached/PatternImpl.h"
#include "zypp/repo/cached/PatchImpl.h"
#include "zypp/repo/cached/MessageImpl.h"
#include "zypp/repo/cached/ScriptImpl.h"
#include "zypp/repo/cached/AtomImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace zypp::detail;
using namespace zypp::cache;
@@ -47,44 +53,73 @@
namespace cached
{ /////////////////////////////////////////////////////////////////
-RepoImpl::RepoImpl( const RepoInfo &repoinfo, const Pathname &dbdir, const data::RecordId &repository_id )
- : RepositoryImpl(repoinfo),
- _dbdir(dbdir),
- _type_cache(dbdir),
- _repository_id(repository_id),
- _rquery(dbdir)
+RepoImpl::RepoImpl( const RepoOptions &opts )
+ : RepositoryImpl(opts.repoinfo)
+ , _type_cache(opts.dbdir)
+ , _rquery(opts.dbdir)
+ , _options(opts)
{
}
RepoImpl::~RepoImpl()
{
-
+ MIL << "Destroying repo '" << info().alias() << "'" << endl;
}
+static int global_progress_handler(void* ptr)
+{
+ MIL << "BOOOOOOOOOH" << std::endl;
+ //RepoImpl *r = dynamic_cast(ptr);
+ RepoImpl *r = (RepoImpl *)(ptr);
+ if ( r )
+ return r->progress_handler(ptr);
+
+ return 1;
+}
void RepoImpl::factoryInit()
{
MIL << "Plaindir repository initialized." << std::endl;
}
-void read_capabilities( sqlite3_connection &con, map &nvras );
+void read_capabilities( sqlite3_connection &con,
+ map &nvras,
+ ProgressData &progress );
+int RepoImpl::progress_handler(void* ptr)
+{
+ if ( _ticks.tick() )
+ return 1;
+ return 1;
+}
+
void RepoImpl::createResolvables()
{
+ _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((_dbdir + "zypp.db").asString().c_str());
+ {
+ 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;");
+// We could use this to calculate total resolvables
+// 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", _repository_id);
+ cmd.bind(":repository_id", _options.repository_id);
map > nvras;
-
+
sqlite3_reader reader = cmd.executereader();
while(reader.read())
{
@@ -97,10 +132,14 @@
_type_cache.archFor(reader.getint(5)),
deps ) );
}
-
+
MIL << "Done reading resolvables nvra" << endl;
- read_capabilities( con, nvras);
+ _ticks.tick();
+
+ read_capabilities( con, _options.repository_id, nvras );
+
+ _ticks.tick();
for ( map >::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
{
@@ -108,46 +147,58 @@
{
ResImplTraitscached::PackageImpl::Ptr impl = new cached::PackageImpl(it->first, this);
Package::Ptr package = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (package);
+ _store.insert( package );
+ }
+ else if ( it->second.first == ResTraits<SrcPackage>::kind )
+ {
+ ResImplTraitscached::SrcPackageImpl::Ptr impl = new cached::SrcPackageImpl(it->first, this);
+ SrcPackage::Ptr srcpackage = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert( srcpackage );
+ }
+ else if ( it->second.first == ResTraits<Product>::kind )
+ {
+ ResImplTraitscached::ProductImpl::Ptr impl = new cached::ProductImpl(it->first, this);
+ Product::Ptr product = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert( product );
}
else if ( it->second.first == ResTraits<Pattern>::kind )
{
ResImplTraitscached::PatternImpl::Ptr impl = new cached::PatternImpl(it->first, this);
Pattern::Ptr pattern = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (pattern);
+ _store.insert( pattern );
}
else if ( it->second.first == ResTraits<Patch>::kind )
{
ResImplTraitscached::PatchImpl::Ptr impl = new cached::PatchImpl(it->first, this);
Patch::Ptr patch = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (patch);
+ _store.insert( patch );
}
else if ( it->second.first == ResTraits<Message>::kind )
{
ResImplTraitscached::MessageImpl::Ptr impl = new cached::MessageImpl(it->first, this);
Message::Ptr message = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (message);
+ _store.insert( message );
}
else if ( it->second.first == ResTraits<Script>::kind )
{
ResImplTraitscached::ScriptImpl::Ptr impl = new cached::ScriptImpl(it->first, this);
Script::Ptr script = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (script);
+ _store.insert( script );
}
else if ( it->second.first == ResTraits<Atom>::kind )
{
ResImplTraitscached::AtomImpl::Ptr impl = new cached::AtomImpl(it->first, this);
Atom::Ptr atom = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (atom);
+ _store.insert( atom );
}
}
con.executenonquery("COMMIT;");
+ con.setprogresshandler(00, NULL, NULL);
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
}
//extract_packages_from_directory( _store, thePath, selfRepositoryRef(), true );
-
}
static CheckSum encoded_string_to_checksum( const std::string &encoded )
@@ -165,9 +216,14 @@
void RepoImpl::createPatchAndDeltas()
{
+ _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((_dbdir + "zypp.db").asString().c_str());
+ {
+ sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
+ //con.setprogresshandler(500, global_progress_handler, (void*)this);
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
@@ -179,24 +235,24 @@
string pp_bv_query =
"SELECT version, release, epoch "
"FROM patch_packages_baseversions WHERE patch_package_id = :patch_package_id";
-
+
string delta_query =
// 0 1 2 3 4 5 6 7 8 9 10
"SELECT id, media_nr, location, checksum, download_size, build_time, baseversion_version, baseversion_release, baseversion_epoch, baseversion_checksum, baseversion_build_time "
// 11
", baseversion_sequence_info "
"FROM delta_packages WHERE repository_id=:repository_id;";
-
+
// bind the master repo id to the query
sqlite3_command deltas_cmd( con, delta_query);
- deltas_cmd.bind(":repository_id", _repository_id);
+ deltas_cmd.bind(":repository_id", _options.repository_id);
sqlite3_reader reader = deltas_cmd.executereader();
while ( reader.read() )
{
zypp::OnMediaLocation on_media;
- on_media.medianr(reader.getint(1));
- on_media.filename(reader.getstring(2));
-
+ on_media.setMedianr(reader.getint(1));
+ on_media.setFilename(reader.getstring(2));
+
string checksum_string(reader.getstring(3));
CheckSum checksum = encoded_string_to_checksum(checksum_string);
if ( checksum.empty() )
@@ -204,12 +260,12 @@
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
- on_media.checksum(checksum);
- on_media.downloadsize(reader.getint(4));
-
+ on_media.setChecksum(checksum);
+ on_media.setDownloadSize(reader.getint(4));
+
packagedelta::DeltaRpm::BaseVersion baseversion;
- baseversion.edition( Edition(reader.getstring(6), reader.getstring(7), reader.getstring(8) ) );
-
+ baseversion.setEdition( Edition(reader.getstring(6), reader.getstring(7), reader.getstring(8) ) );
+
checksum_string = reader.getstring(9);
checksum = encoded_string_to_checksum(checksum_string);
if ( checksum.empty() )
@@ -217,34 +273,34 @@
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
- baseversion.checksum(checksum);
- baseversion.buildtime(reader.getint(10));
- baseversion.sequenceinfo(reader.getstring(11));
-
+ baseversion.setChecksum(checksum);
+ baseversion.setBuildtime(reader.getint(10));
+ baseversion.setSequenceinfo(reader.getstring(11));
+
zypp::packagedelta::DeltaRpm delta;
- delta.location( on_media );
- delta.baseversion( baseversion );
- delta.buildtime(reader.getint(5));
-
- //impl->addDeltaRpm(delta);
+ delta.setLocation( on_media );
+ delta.setBaseversion( baseversion );
+ delta.setBuildtime(reader.getint(5));
+
+ _deltaRpms.push_back(delta);
}
-
+
// patch rpms
// bind the master package id to the query
// bind the master repo id to the query
sqlite3_command pp_cmd( con, pp_query);
sqlite3_command pp_bv_cmd( con, pp_bv_query);
- pp_cmd.bind(":repository_id", _repository_id);
+ pp_cmd.bind(":repository_id", _options.repository_id);
reader = pp_cmd.executereader();
while ( reader.read() )
{
long long patch_package_id = reader.getint64(0);
-
+
zypp::OnMediaLocation on_media;
- on_media.medianr( reader.getint(1) );
- on_media.filename( reader.getstring(2) );
-
+ on_media.setMedianr( reader.getint(1) );
+ on_media.setFilename( reader.getstring(2) );
+
string checksum_string(reader.getstring(3));
CheckSum checksum = encoded_string_to_checksum(checksum_string);
if ( checksum.empty() )
@@ -252,44 +308,47 @@
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
- on_media.checksum(checksum);
- on_media.downloadsize(reader.getint(4));
-
+ on_media.setChecksum(checksum);
+ on_media.setDownloadSize(reader.getint(4));
+
zypp::packagedelta::PatchRpm patch;
- patch.location( on_media );
- patch.buildtime(reader.getint(5));
-
+ patch.setLocation( on_media );
+ patch.setBuildtime(reader.getint(5));
+
pp_bv_cmd.bind( ":patch_package_id", patch_package_id );
-
+
sqlite3_reader bv_reader = pp_bv_cmd.executereader();
while (bv_reader.read())
{
packagedelta::PatchRpm::BaseVersion baseversion = packagedelta::PatchRpm::BaseVersion( bv_reader.getstring(0) , bv_reader.getstring(1), bv_reader.getint(2) );
- patch.baseversion(baseversion);
+ patch.addBaseversion(baseversion);
}
-
- //impl->addPatchRpm(patch);
+
+ _patchRpms.push_back(patch);
}
+ con.setprogresshandler(0, NULL, NULL);
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
}
}
-
+
ResolvableQuery RepoImpl::resolvableQuery()
{
return _rquery;
}
-void RepoImpl::read_capabilities( sqlite3_connection &con, map > &nvras )
+void RepoImpl::read_capabilities( sqlite3_connection &con,
+ data::RecordId repo_id,
+ map > &nvras )
{
CapFactory capfactory;
-
-
+
+
// precompile statements
-
-
-
+
+
+
// map named_caps;
// sqlite3_command select_named_cmd( con, "select v.id, c.refers_kind, n.name, v.version, v.release, v.epoch, v.relation named_capabilities v, capabilities c, names n where v.name_id=n.id and c.id=ncc.capability_id and ncc.named_capability_id=v.id;");
// {
@@ -297,40 +356,50 @@
// sqlite3_reader reader = select_named_cmd.executereader();
// while ( reader.read() )
// {
-//
+//
// }
// }
- 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 where v.name_id=n.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 where f.id=fc.file_id and f.dir_name_id=dn.id and f.file_name_id=fn.id;");
+ 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;");
+
+ sqlite3_command select_other_cmd( con, "select oc.refers_kind, oc.value, oc.dependency_type, oc.resolvable_id from other_capabilities oc, resolvables res where oc.resolvable_id=res.id and res.repository_id=:repo_id;");
+
+
{
debug::Measure mnc("read named capabilities");
+ select_named_cmd.bind(":repo_id", repo_id);
sqlite3_reader reader = select_named_cmd.executereader();
while ( reader.read() )
{
-
+
Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
Rel rel = _type_cache.relationFor(reader.getint(5));
-
+
data::RecordId rid = reader.getint64(7);
-
+
if ( rel == zypp::Rel::NONE )
{
capability::NamedCap *ncap = new capability::NamedCap( refer, reader.getstring(1) );
- zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
- nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
}
else
{
capability::VersionedCap *vcap = new capability::VersionedCap( refer, reader.getstring(1), /* rel */ rel, Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ) );
zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
- nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
}
}
}
-
+
{
debug::Measure mnf("read file capabilities");
+ select_file_cmd.bind(":repo_id", repo_id);
sqlite3_reader reader = select_file_cmd.executereader();
while ( reader.read() )
{
@@ -338,7 +407,65 @@
capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(3));
data::RecordId rid = reader.getint64(4);
- nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
+ 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);
+ sqlite3_reader reader = select_hal_cmd.executereader();
+ while ( reader.read() )
+ {
+ //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));
+ data::RecordId rid = reader.getint64(5);
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(hcap) ) );
+ }
+ }
+
+ {
+ debug::Measure mnf("read modalias capabilities");
+ select_modalias_cmd.bind(":repo_id", repo_id);
+ 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));
+ data::RecordId rid = reader.getint64(5);
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(mcap) ) );
+ }
+ }
+
+ {
+ debug::Measure mnf("read other capabilities");
+ select_other_cmd.bind(":repo_id", repo_id);
+ sqlite3_reader reader = select_other_cmd.executereader();
+ while ( reader.read() )
+ {
+ //select oc.refers_kind, oc.value, oc.dependency_type, oc.resolvable_id from other_capabilities oc;
+
+ 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) );
}
}
Modified: trunk/libzypp/zypp/repo/cached/RepoImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/RepoImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/RepoImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/RepoImpl.h Mon Jul 16 12:40:42 2007
@@ -16,6 +16,7 @@
#include "zypp/Arch.h"
#include "zypp/Rel.h"
#include "zypp/Pathname.h"
+#include "zypp/ProgressData.h"
#include "zypp/data/RecordId.h"
#include "zypp/repo/RepositoryImpl.h"
#include "zypp/ResStore.h"
@@ -34,11 +35,30 @@
namespace cached
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : RepoImpl
- //
- /** */
+ struct RepoOptions
+ {
+ RepoOptions( const RepoInfo &repoinfo_,
+ const Pathname &dbdir_,
+ const data::RecordId &repository_id_ )
+
+ : repoinfo(repoinfo_)
+ , dbdir(dbdir_)
+ , repository_id(repository_id_)
+ {}
+
+
+ ProgressData::ReceiverFnc readingResolvablesProgress;
+ ProgressData::ReceiverFnc readingPatchDeltasProgress;
+ RepoInfo repoinfo;
+ Pathname dbdir;
+ data::RecordId repository_id;
+ };
+
+ /**
+ * \short Cached repository implementation
+ *
+ * Reads attributes on demand from cache
+ */
class RepoImpl : public repo::RepositoryImpl
{
public:
@@ -47,22 +67,26 @@
public:
/** Default ctor */
- RepoImpl( const RepoInfo &repoinfo, const Pathname &dbdir, const data::RecordId &repository_id );
+ RepoImpl( const RepoOptions &opts );
/** Dtor */
~RepoImpl();
void factoryInit();
public:
+ virtual void createResolvables();
+ virtual void createPatchAndDeltas();
cache::ResolvableQuery resolvableQuery();
- void createResolvables();
- void createPatchAndDeltas();
- protected:
- void read_capabilities( sqlite3x::sqlite3_connection &con, std::map > &nvras );
- Pathname _dbdir;
- cache::CacheTypes _type_cache;
- data::RecordId _repository_id;
-
+ private:
+ void read_capabilities( sqlite3x::sqlite3_connection &con,
+ data::RecordId repo_id,
+ std::map > &nvras );
+ cache::CacheTypes _type_cache;
cache::ResolvableQuery _rquery;
+ RepoOptions _options;
+ ProgressData _ticks;
+ public:
+ int progress_handler(void*);
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/cached/ScriptImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/ScriptImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/ScriptImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/ScriptImpl.cc Mon Jul 16 12:40:42 2007
@@ -12,6 +12,7 @@
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "ScriptImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
@@ -46,53 +47,48 @@
TranslatedText ScriptImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText ScriptImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText ScriptImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText ScriptImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText ScriptImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor ScriptImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount ScriptImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount ScriptImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool ScriptImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date ScriptImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date ScriptImpl::installtime() const
@@ -100,15 +96,6 @@
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref ScriptImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned ScriptImpl::mediaNr() const
{
return 1;
@@ -120,19 +107,21 @@
Pathname ScriptImpl::do_script() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Script", "doScript" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrScriptDoScript() );
}
Pathname ScriptImpl::undo_script() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Script", "undoScript" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrScriptUndoScript() );
}
bool ScriptImpl::undo_available() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Script", "undoAvailable", false );
+#warning DUBIOUS ATTRIBUTE
+ return false;
+ //return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrScriptUndoAvailable(), false );
}
-
+
/////////////////////////////////////////////////////////////////
} } } // namespace zypp::repo::cached
Modified: trunk/libzypp/zypp/repo/cached/ScriptImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/ScriptImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/ScriptImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/ScriptImpl.h Mon Jul 16 12:40:42 2007
@@ -38,12 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
// SCRIPT
@@ -53,7 +51,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc (original)
+++ trunk/libzypp/zypp/repo/cached/SrcPackageImpl.cc Mon Jul 16 12:40:42 2007
@@ -6,15 +6,14 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zmd/backend/dbsource/SrcPackageImpl.h
- *
+/** \file zypp/repo/cached/SrcPackageImpl.cc
*/
#include "SrcPackageImpl.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/TranslatedText.h"
#include "zypp/base/String.h"
#include "zypp/base/Logger.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp::detail;
@@ -30,66 +29,84 @@
/** Default ctor
*/
-SrcPackageImpl::SrcPackageImpl (Source_Ref source_r)
- : _source (source_r)
- , _install_only(false)
- , _size_installed(0)
- , _size_archive(0)
- , _data_loaded(false)
+SrcPackageImpl::SrcPackageImpl ( const data::RecordId & id, repo::cached::RepoImpl::Ptr repository_r )
+ : _repository( repository_r )
+ , _id( id )
{}
-Source_Ref
-SrcPackageImpl::source() const
+Repository SrcPackageImpl::repository() const
{
- return _source;
+ return _repository->selfRepository();
}
-/** Package summary */
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
TranslatedText SrcPackageImpl::summary() const
{
- return _summary;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
-/** Package description */
TranslatedText SrcPackageImpl::description() const
{
- return _description;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
-PackageGroup SrcPackageImpl::group() const
+TranslatedText SrcPackageImpl::insnotify() const
{
- return _group;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
-Pathname SrcPackageImpl::location() const
+TranslatedText SrcPackageImpl::delnotify() const
{
- return _location;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
-ByteCount SrcPackageImpl::size() const
+TranslatedText SrcPackageImpl::licenseToConfirm() const
+{
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
+}
+
+Vendor SrcPackageImpl::vendor() const
{
- return _size_installed;
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
-/** */
-ByteCount SrcPackageImpl::archivesize() const
+ByteCount SrcPackageImpl::size() const
{
- return _size_archive;
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool SrcPackageImpl::installOnly() const
{
- return _install_only;
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
-unsigned SrcPackageImpl::mediaNr() const
+Date SrcPackageImpl::buildtime() const
{
- return _media_nr;
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
-Vendor SrcPackageImpl::vendor() const
+Date SrcPackageImpl::installtime() const
+{
+ return Date();
+}
+
+////////////////////////////////////////////////////////
+// SRC PACKAGE
+////////////////////////////////////////////////////////
+
+OnMediaLocation SrcPackageImpl::location() const
{
- return "suse";
+ OnMediaLocation loc;
+ 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() ) );
+ return loc;
}
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/cached/SrcPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/SrcPackageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/cached/SrcPackageImpl.h (original)
+++ trunk/libzypp/zypp/repo/cached/SrcPackageImpl.h Mon Jul 16 12:40:42 2007
@@ -10,51 +10,43 @@
#ifndef CachedRepoSrcPackageImpl_H
#define CachedRepoSrcPackageImpl_H
-#include "zypp/detail/PackageImpl.h"
-#include "zypp/Source.h"
-//#include
+#include "zypp/detail/SrcPackageImpl.h"
+#include "zypp/repo/cached/RepoImpl.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
namespace repo
-{
+{ /////////////////////////////////////////////////////////////////
namespace cached
{
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : CachedSourcePackageImpl
+ // CLASS NAME : SourcePackageImpl
//
class SrcPackageImpl : public detail::SrcPackageImplIf
{
public:
- SrcPackageImpl( Source_Ref source_r );
+ SrcPackageImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
+
+ virtual Repository repository() const;
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
+ virtual TranslatedText insnotify() const;
+ virtual TranslatedText delnotify() const;
+ virtual TranslatedText licenseToConfirm() const;
+ virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual PackageGroup group() const;
- virtual ByteCount archivesize() const;
- virtual Pathname location() const;
virtual bool installOnly() const;
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
- virtual Vendor vendor() const;
-
- protected:
- Source_Ref _source;
- TranslatedText _summary;
- TranslatedText _description;
- PackageGroup _group;
- Pathname _location;
- bool _install_only;
- unsigned _media_nr;
-
- ByteCount _size_installed;
- ByteCount _size_archive;
-
- bool _data_loaded;
+ virtual Date buildtime() const;
+ virtual Date installtime() const;
+
+ virtual OnMediaLocation location() const;
+ private:
+ repo::cached::RepoImpl::Ptr _repository;
+ data::RecordId _id;
};
/////////////////////////////////////////////////////////////////
} // ns cached
Modified: trunk/libzypp/zypp/repo/memory/AtomImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/AtomImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/AtomImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/AtomImpl.cc Mon Jul 16 12:40:42 2007
@@ -78,11 +78,6 @@
return _size;
}
-ByteCount AtomImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool AtomImpl::installOnly() const
{
return _install_only;
@@ -98,11 +93,6 @@
return _installtime;
}
-unsigned AtomImpl::mediaNr() const
-{
- return _media_nr;
-}
-
/////////////////////////////////////////////////////////////////
} } } // namespace zypp::repo::memory
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/memory/AtomImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/AtomImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/AtomImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/AtomImpl.h Mon Jul 16 12:40:42 2007
@@ -38,13 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
-
virtual Repository repository() const;
protected:
@@ -58,7 +55,6 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
Modified: trunk/libzypp/zypp/repo/memory/MessageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/MessageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/MessageImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/MessageImpl.cc Mon Jul 16 12:40:42 2007
@@ -29,9 +29,20 @@
/** Default ctor
*/
-MessageImpl::MessageImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
- : _repository (repository_r),
- _id(id)
+MessageImpl::MessageImpl ( memory::RepoImpl::Ptr repo, data::Message_Ptr ptr)
+ : _repository(repo),
+
+ _summary(ptr->summary),
+ _description(ptr->description),
+ _insnotify(ptr->insnotify),
+ _delnotify(ptr->delnotify),
+ _license_to_confirm(ptr->licenseToConfirm),
+ _vendor(ptr->vendor),
+ _size(ptr->installedSize),
+ _install_only(false),
+ _buildtime(ptr->buildTime),
+
+ _text(ptr->text)
{}
Repository
@@ -79,11 +90,6 @@
return _size;
}
-ByteCount MessageImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool MessageImpl::installOnly() const
{
return _install_only;
@@ -99,33 +105,13 @@
return _installtime;
}
-unsigned MessageImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref MessageImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned MessageImpl::mediaNr() const
-{
- return 1;
-}
-
//////////////////////////////////////////
// MESSAGE
/////////////////////////////////////////
TranslatedText MessageImpl::text() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Message", "text" );
+ return _text;
}
Patch::constPtr MessageImpl::patch() const
Modified: trunk/libzypp/zypp/repo/memory/MessageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/MessageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/MessageImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/MessageImpl.h Mon Jul 16 12:40:42 2007
@@ -29,8 +29,8 @@
{
public:
- MessageImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
-
+ MessageImpl( memory::RepoImpl::Ptr repo, data::Message_Ptr ptr);
+
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
virtual TranslatedText insnotify() const;
@@ -38,23 +38,19 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// MESSAGE
virtual TranslatedText text() const;
virtual Patch::constPtr patch() const;
-
+
virtual Repository repository() const;
-
+
protected:
repo::memory::RepoImpl::Ptr _repository;
-
+
//ResObject
TranslatedText _summary;
TranslatedText _description;
@@ -63,11 +59,11 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
+
+ TranslatedText _text;
};
/////////////////////////////////////////////////////////////////
} // namespace memory
Modified: trunk/libzypp/zypp/repo/memory/PackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/PackageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/PackageImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/PackageImpl.cc Mon Jul 16 12:40:42 2007
@@ -38,18 +38,15 @@
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- _archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime),
- _media_nr(ptr->repositoryLocation.mediaNr),
-
+
_group(ptr->group),
_keywords(),
_authors(ptr->authors),
_license(ptr->license),
- _location(ptr->repositoryLocation.filePath),
_diskusage(),
- _checksum(ptr->repositoryLocation.fileChecksum)
+ _location(ptr->repositoryLocation)
{
}
@@ -106,11 +103,6 @@
return _size;
}
-ByteCount PackageImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool PackageImpl::installOnly() const
{
return _install_only;
@@ -126,19 +118,14 @@
return _installtime;
}
-unsigned PackageImpl::mediaNr() const
+OnMediaLocation PackageImpl::location() const
{
- return _media_nr;
+ return _location;
}
////////////////////////////////////////////////////
-CheckSum PackageImpl::checksum() const
-{
- return _checksum;
-}
-
string PackageImpl::buildhost() const
{
return string();
@@ -174,11 +161,6 @@
return Changelog();
}
-Pathname PackageImpl::location() const
-{
- return _location;
-}
-
string PackageImpl::url() const
{
return string();
Modified: trunk/libzypp/zypp/repo/memory/PackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/PackageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/PackageImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/PackageImpl.h Mon Jul 16 12:40:42 2007
@@ -13,7 +13,6 @@
#define ZYPP_SOURCE_MEMORYPACKAGEIMPL_H
#include "zypp/detail/PackageImplIf.h"
-#include "zypp/Source.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/DiskUsage.h"
#include "zypp/CheckSum.h"
@@ -45,13 +44,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
-
- virtual CheckSum checksum() const;
+
virtual std::string buildhost() const;
virtual std::string distribution() const;
virtual Label license() const;
@@ -59,7 +55,7 @@
virtual PackageGroup group() const;
virtual Keywords keywords() const;
virtual Changelog changelog() const;
- virtual Pathname location() const;
+ virtual OnMediaLocation location() const;
virtual std::string url() const;
virtual std::string os() const;
virtual Text prein() const;
@@ -81,19 +77,17 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
+
PackageGroup _group;
Keywords _keywords;
std::liststd::string _authors;
Label _license;
- Pathname _location;
DiskUsage _diskusage;
- CheckSum _checksum;
+ OnMediaLocation _location;
private:
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/memory/PatchImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/PatchImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/PatchImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/PatchImpl.cc Mon Jul 16 12:40:42 2007
@@ -30,10 +30,8 @@
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- //_archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime),
- //_media_nr(ptr->repositoryLocation.mediaNr),
_patch_id(ptr->id),
_timestamp(ptr->timestamp),
@@ -87,11 +85,6 @@
return _size;
}
-ByteCount PatchImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool PatchImpl::installOnly() const
{
return _install_only;
@@ -107,11 +100,6 @@
return _installtime;
}
-unsigned PatchImpl::mediaNr() const
-{
- return _media_nr;
-}
-
//////////////////////////////////////////
// PATCH
/////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/memory/PatchImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/PatchImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/PatchImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/PatchImpl.h Mon Jul 16 12:40:42 2007
@@ -35,11 +35,9 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
// PATCH
virtual std::string id() const;
@@ -62,11 +60,9 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
// patch
std::string _patch_id;
Modified: trunk/libzypp/zypp/repo/memory/PatternImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/PatternImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/PatternImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/PatternImpl.cc Mon Jul 16 12:40:42 2007
@@ -29,10 +29,8 @@
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- //_archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime)
- //_media_nr(ptr->repositoryLocation.mediaNr)
//TODO pattern attrs
{
@@ -87,11 +85,6 @@
return _size;
}
-ByteCount PatternImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool PatternImpl::installOnly() const
{
return _install_only;
@@ -107,12 +100,6 @@
return _installtime;
}
-unsigned PatternImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-
///////////////////////////////////////
TranslatedText PatternImpl::category() const
Modified: trunk/libzypp/zypp/repo/memory/PatternImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/PatternImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/PatternImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/PatternImpl.h Mon Jul 16 12:40:42 2007
@@ -41,11 +41,9 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
virtual TranslatedText category() const;
virtual bool userVisible() const;
@@ -63,11 +61,9 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
// Pattern
TranslatedText _category;
Modified: trunk/libzypp/zypp/repo/memory/ProductImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/ProductImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/ProductImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/ProductImpl.cc Mon Jul 16 12:40:42 2007
@@ -30,10 +30,8 @@
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- //_archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime)
- //_media_nr(ptr->repositoryLocation.mediaNr)
// TODO products attrs
{}
@@ -85,11 +83,6 @@
return _size;
}
-ByteCount ProductImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool ProductImpl::installOnly() const
{
return _install_only;
@@ -105,11 +98,6 @@
return _installtime;
}
-unsigned ProductImpl::mediaNr() const
-{
- return _media_nr;
-}
-
///////////////////////////////////////////
std::string ProductImpl::category() const
Modified: trunk/libzypp/zypp/repo/memory/ProductImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/ProductImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/ProductImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/ProductImpl.h Mon Jul 16 12:40:42 2007
@@ -17,7 +17,6 @@
#include "zypp/CheckSum.h"
#include "zypp/CapSet.h"
#include "zypp/detail/ProductImplIf.h"
-#include "zypp/Source.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/TranslatedText.h"
@@ -48,11 +47,9 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
virtual std::string category() const;
virtual Url releaseNotesUrl() const;
@@ -74,11 +71,9 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
std::string _category;
std::string _dist_name;
Modified: trunk/libzypp/zypp/repo/memory/ScriptImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/ScriptImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/ScriptImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/ScriptImpl.cc Mon Jul 16 12:40:42 2007
@@ -29,8 +29,8 @@
/** Default ctor
*/
-ScriptImpl::ScriptImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
- : _repository (repository_r),
+ScriptImpl::ScriptImpl ( memory::RepoImpl::Ptr repo, data::Script_Ptr ptr)
+ : _repository (repo),
_summary(ptr->summary),
_description(ptr->description),
_insnotify(ptr->insnotify),
@@ -38,10 +38,8 @@
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- _archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
- _buildtime(ptr->buildTime),
- _media_nr(ptr->repositoryLocation.mediaNr)
+ _buildtime(ptr->buildTime)
//TODO script attrs
{}
@@ -90,11 +88,6 @@
return _size;
}
-ByteCount ScriptImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool ScriptImpl::installOnly() const
{
return _install_only;
@@ -110,12 +103,6 @@
return _installtime;
}
-unsigned ScriptImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-
//////////////////////////////////////////
// MESSAGE
/////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/memory/ScriptImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/ScriptImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/ScriptImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/ScriptImpl.h Mon Jul 16 12:40:42 2007
@@ -29,7 +29,7 @@
{
public:
- ScriptImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
+ ScriptImpl( memory::RepoImpl::Ptr repo, data::Script_Ptr ptr);
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
@@ -38,14 +38,10 @@
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// SCRIPT
virtual Pathname do_script() const;
virtual Pathname undo_script() const;
@@ -64,11 +60,9 @@
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
};
/////////////////////////////////////////////////////////////////
} // namespace memory
Modified: trunk/libzypp/zypp/repo/memory/SrcPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/SrcPackageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/SrcPackageImpl.cc (original)
+++ trunk/libzypp/zypp/repo/memory/SrcPackageImpl.cc Mon Jul 16 12:40:42 2007
@@ -27,8 +27,20 @@
// METHOD NAME : SrcPackageImpl::SrcPackageImpl
// METHOD TYPE : Ctor
//
-SrcPackageImpl::SrcPackageImpl(data::SrcPackage_Ptr ptr)
- : _media_number( 1 )
+SrcPackageImpl::SrcPackageImpl( memory::RepoImpl::Ptr repo, data::SrcPackage_Ptr ptr)
+ : _repository(repo),
+
+ _summary(ptr->summary),
+ _description(ptr->description),
+ _insnotify(ptr->insnotify),
+ _delnotify(ptr->delnotify),
+ _license_to_confirm(ptr->licenseToConfirm),
+ _vendor(ptr->vendor),
+ _size(ptr->installedSize),
+ _install_only(false),
+ _buildtime(ptr->buildTime),
+
+ _location(ptr->repositoryLocation)
{}
///////////////////////////////////////////////////////////////////
@@ -39,25 +51,69 @@
SrcPackageImpl::~SrcPackageImpl()
{}
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
-Pathname SrcPackageImpl::location() const
+TranslatedText SrcPackageImpl::summary() const
{
- return _location;
+ return _summary;
+}
+
+TranslatedText SrcPackageImpl::description() const
+{
+ return _description;
+}
+
+TranslatedText SrcPackageImpl::insnotify() const
+{
+ return _insnotify;
+}
+
+TranslatedText SrcPackageImpl::delnotify() const
+{
+ return _delnotify;
+}
+
+TranslatedText SrcPackageImpl::licenseToConfirm() const
+{
+ return _license_to_confirm;
}
-ByteCount SrcPackageImpl::archivesize() const
+Vendor SrcPackageImpl::vendor() const
{
- return _archivesize;
+ return _vendor;
}
+ByteCount SrcPackageImpl::size() const
+{
+ return _size;
+}
+
+bool SrcPackageImpl::installOnly() const
+{
+ return _install_only;
+}
+
+Date SrcPackageImpl::buildtime() const
+{
+ return _buildtime;
+}
+
+Date SrcPackageImpl::installtime() const
+{
+ return _installtime;
+}
+
+
DiskUsage SrcPackageImpl::diskusage() const
{
return _diskusage;
}
-unsigned SrcPackageImpl::sourceMediaNr() const
+OnMediaLocation SrcPackageImpl::location() const
{
- return _media_number;
+ return _location;
}
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/memory/SrcPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/memory/SrcPackageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/memory/SrcPackageImpl.h (original)
+++ trunk/libzypp/zypp/repo/memory/SrcPackageImpl.h Mon Jul 16 12:40:42 2007
@@ -15,6 +15,7 @@
#include "zypp/detail/SrcPackageImplIf.h"
#include "zypp/DiskUsage.h"
#include "zypp/data/ResolvableData.h"
+#include "zypp/repo/memory/RepoImpl.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -33,22 +34,38 @@
*/
struct SrcPackageImpl : public zypp::detail::SrcPackageImplIf
{
- SrcPackageImpl(data::SrcPackage_Ptr ptr);
+ SrcPackageImpl( memory::RepoImpl::Ptr repo, data::SrcPackage_Ptr ptr);
virtual ~SrcPackageImpl();
- /** */
- virtual Pathname location() const;
- /** */
- virtual ByteCount archivesize() const;
- /** */
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual TranslatedText insnotify() const;
+ virtual TranslatedText delnotify() const;
+ virtual TranslatedText licenseToConfirm() const;
+ virtual Vendor vendor() const;
+ virtual ByteCount size() const;
+ virtual bool installOnly() const;
+ virtual Date buildtime() const;
+ virtual Date installtime() const;
+
virtual DiskUsage diskusage() const;
- /** */
- virtual unsigned sourceMediaNr() const;
-
+ virtual OnMediaLocation location() const;
private:
- ByteCount _archivesize;
- unsigned _media_number;
- Pathname _location;
+ repo::memory::RepoImpl::Ptr _repository;
+
+ //ResObject
+ TranslatedText _summary;
+ TranslatedText _description;
+ TranslatedText _insnotify;
+ TranslatedText _delnotify;
+ TranslatedText _license_to_confirm;
+ Vendor _vendor;
+ ByteCount _size;
+ bool _install_only;
+ Date _buildtime;
+ Date _installtime;
+
+ OnMediaLocation _location;
DiskUsage _diskusage;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/repo/susetags/Downloader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/susetags/Downloader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/susetags/Downloader.cc (original)
+++ trunk/libzypp/zypp/repo/susetags/Downloader.cc Mon Jul 16 12:40:42 2007
@@ -33,18 +33,46 @@
void Downloader::download( const Pathname &dest_dir,
const ProgressData::ReceiverFnc & progress )
{
- MediaSetAccess media(_url, _path);
+ MediaSetAccess media(_url);
Fetcher fetcher;
- fetcher.enqueue( OnMediaLocation().filename("/content") );
+
+ fetcher.enqueue( OnMediaLocation().setFilename( "/media.1/media") );
+ fetcher.start( dest_dir, media );
+ fetcher.reset();
+
+
+ SignatureFileChecker sigchecker;
+
+ Pathname sig = _path + "/content.asc";
+ if ( media.doesFileExist(sig) )
+ {
+ fetcher.enqueue( OnMediaLocation().setFilename(sig) );
+ 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.start( dest_dir, media );
+ fetcher.reset();
+ sigchecker.addPublicKey(dest_dir + key);
+ }
+
+
+ fetcher.enqueue( OnMediaLocation().setFilename( _path + "/content"), sigchecker );
fetcher.start( dest_dir, media );
fetcher.reset();
- std::ifstream file((dest_dir + "/content").asString().c_str());
+ std::ifstream file((dest_dir + _path + "/content").asString().c_str());
std::string buffer;
Pathname descr_dir;
- // Note this code assumes DESCR comes before as META
-
+ // FIXME Note this code assumes DESCR comes before as META
+ string value;
while (file && !file.eof())
{
getline(file, buffer);
@@ -64,11 +92,23 @@
if ( str::split( buffer, std::back_inserter(words) ) != 4 )
{
// error
- ZYPP_THROW(Exception("bad DESCR line"));
+ ZYPP_THROW(Exception("bad META line"));
+ }
+ OnMediaLocation location;
+ location.setFilename( _path + descr_dir + words[3]).setChecksum( CheckSum( words[1], words[2] ) );
+ fetcher.enqueueDigested(location);
+ }
+ else if (buffer.substr( 0, 3 ) == "KEY")
+ {
+ std::vectorstd::string words;
+ if ( str::split( buffer, std::back_inserter(words) ) != 4 )
+ {
+ // error
+ ZYPP_THROW(Exception("bad KEY line"));
}
OnMediaLocation location;
- location.filename( descr_dir + words[3]).checksum( CheckSum( words[1], words[2] ) );
- fetcher.enqueue(location);
+ location.setFilename( _path + words[3]).setChecksum( CheckSum( words[1], words[2] ) );
+ fetcher.enqueueDigested(location);
}
}
file.close();
Modified: trunk/libzypp/zypp/repo/yum/Downloader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/yum/Downloader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/yum/Downloader.cc (original)
+++ trunk/libzypp/zypp/repo/yum/Downloader.cc Mon Jul 16 12:40:42 2007
@@ -88,10 +88,10 @@
_dest_dir = dest_dir;
if ( _media.doesFileExist(keypath) )
- _fetcher.enqueue( OnMediaLocation().filename(keypath) );
+ _fetcher.enqueue( OnMediaLocation().setFilename(keypath) );
if ( _media.doesFileExist(sigpath) )
- _fetcher.enqueue( OnMediaLocation().filename(sigpath) );
+ _fetcher.enqueue( OnMediaLocation().setFilename(sigpath) );
_fetcher.start( dest_dir, _media );
@@ -106,7 +106,7 @@
if ( PathInfo( dest_dir + keypath ).isExist() )
sigchecker.addPublicKey(dest_dir + keypath );
- _fetcher.enqueue( OnMediaLocation().filename(repomdpath), sigchecker );
+ _fetcher.enqueue( OnMediaLocation().setFilename(repomdpath), sigchecker );
_fetcher.start( dest_dir, _media);
if ( ! progress.tick() )
Modified: trunk/libzypp/zypp/solver/detail/InstallOrder.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/InstallOrder.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/InstallOrder.cc (original)
+++ trunk/libzypp/zypp/solver/detail/InstallOrder.cc Mon Jul 16 12:40:42 2007
@@ -296,7 +296,14 @@
{
if (must_visit != item)
{
- WAR << "** dependency loop: " << ITEMNAME(item) << " -> " << ITEMNAME(must_visit) << endl;
+ // log only the 1st occurrence.
+ std::string lstr( ITEMNAME(item) );
+ lstr += " -> ";
+ lstr += ITEMNAME(must_visit);
+ if ( _logset.insert( lstr ).second )
+ {
+ WAR << "** dependency loop: " << lstr << endl;
+ }
}
}
else
Modified: trunk/libzypp/zypp/solver/detail/InstallOrder.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/InstallOrder.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/InstallOrder.h (original)
+++ trunk/libzypp/zypp/solver/detail/InstallOrder.h Mon Jul 16 12:40:42 2007
@@ -30,8 +30,10 @@
#ifndef ZYPP_SOLVER_DETAIL_INSTALLORDER_H
#define ZYPP_SOLVER_DETAIL_INSTALLORDER_H
+#include <string>
#include <list>
#include <map>
+#include <set>
#include "zypp/PoolItem.h"
#include "zypp/ResPool.h"
@@ -98,6 +100,8 @@
unsigned _numrun;
+ std::setstd::string _logset;
+
private:
void rdfsvisit (PoolItem_Ref item);
Modified: trunk/libzypp/zypp/solver/detail/Resolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resolver.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Resolver.cc (original)
+++ trunk/libzypp/zypp/solver/detail/Resolver.cc Mon Jul 16 12:40:42 2007
@@ -301,9 +301,9 @@
//---------------------------------------------------------------------------
void
-Resolver::addSubscribedSource (Source_Ref source)
+Resolver::addSubscribedSource (Repository repo)
{
- _subscribed.insert(source);
+ _subscribed.insert(repo);
}
void
Modified: trunk/libzypp/zypp/solver/detail/Resolver.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resolver.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Resolver.h (original)
+++ trunk/libzypp/zypp/solver/detail/Resolver.h Mon Jul 16 12:40:42 2007
@@ -150,7 +150,7 @@
ResolverContext_Ptr _establish_context;
bool _timed_out;
- std::set _subscribed;
+ std::set<Repository> _subscribed;
Arch _architecture;
@@ -206,7 +206,7 @@
ResPool pool (void) const;
void setPool (const ResPool & pool) { _pool = pool; }
- void addSubscribedSource (Source_Ref source);
+ void addSubscribedSource (Repository source);
void addPoolItemToInstall (PoolItem_Ref item);
void addPoolItemsToInstallFromList (PoolItemList & rl);
Modified: trunk/libzypp/zypp/solver/detail/ResolverContext.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/ResolverContext.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/ResolverContext.cc (original)
+++ trunk/libzypp/zypp/solver/detail/ResolverContext.cc Mon Jul 16 12:40:42 2007
@@ -267,7 +267,7 @@
misc_info->setOtherPoolItem (otherItem);
if (NVRA(item.resolvable()) == NVRA(otherItem.resolvable())
&& status.isBySolver() && statusOtherItem.isBySolver()) {
- // If there has already been selected another item by the solver (e.g. from another source)
+ // If there has already been selected another item by the solver (e.g. from another repo)
// we will take that.
// Bug 224698
addInfo( misc_info );
@@ -291,7 +291,7 @@
Package::constPtr pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
- _download_size += pkg->archivesize();
+ _download_size += pkg->downloadSize();
_install_size += pkg->size();
}
@@ -302,7 +302,7 @@
priority = 0;
else {
#endif
- priority = getSourcePriority (item->source());
+ priority = getRepoPriority (item->repository());
// }
if (priority < _min_priority) _min_priority = priority;
@@ -350,7 +350,7 @@
misc_info->setOtherPoolItem (otherItem);
if (NVRA(item.resolvable()) == NVRA(otherItem.resolvable())
&& status.isBySolver() && statusOtherItem.isBySolver()) {
- // If there has already been selected another item by the solver (e.g. from another source)
+ // If there has already been selected another item by the solver (e.g. from another repo)
// we will take that.
// Bug 224698
addInfo( misc_info );
@@ -393,7 +393,7 @@
pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
- _download_size += pkg->archivesize();
+ _download_size += pkg->downloadSize();
_install_size += pkg->size();
}
@@ -404,7 +404,7 @@
priority = 0;
else {
#endif
- priority = getSourcePriority (item->source());
+ priority = getRepoPriority (item->repository());
// }
if (priority < _min_priority) _min_priority = priority;
@@ -1753,11 +1753,13 @@
int
-ResolverContext::getSourcePriority (Source_Ref source) const
+ResolverContext::getRepoPriority (Repository repo) const
{
- if (source.subscribed())
- return source.priority();
- return source.priorityUnsubscribed();
+#warning fix repo priority
+ return 0;
+// if (repo.subscribed())
+// return repo.priority();
+// return repository.priorityUnsubscribed();
}
//---------------------------------------------------------------------------
@@ -1782,17 +1784,17 @@
void
ResolverContext::collectCompareInfo (int & cmpVersion, // Version compare of ACCUMULATED items
- int & cmpSource, // compare of Sources
+ int & cmpRepo, // compare of Repositories
ResolverContext_Ptr compareContext)
{
- Source_Ref userSource; // Source Id of items which have been selected by the user for installation
- // It is empty, if there are different sources
- bool differentUserSources = false;
- Source_Ref userSourceCompare; // Source Id of items which have been selected by the user for installation
- // It is empty, if there are different sources
- bool differentUserCompareSources = false;
- SourceCounter thisMap; // Map of to be installed sources with an item counter
- SourceCounter compareMap; // Map of to be installed sources with an item counter
+ Repository userRepo; // Repo Id of items which have been selected by the user for installation
+ // It is empty, if there are different repos
+ bool differentUserRepos = false;
+ Repository userRepoCompare; // Repo Id of items which have been selected by the user for installation
+ // It is empty, if there are different repos
+ bool differentUserCompareRepos = false;
+ RepositoryCounter thisMap; // Map of to be installed repositorys with an item counter
+ RepositoryCounter compareMap; // Map of to be installed repositorys with an item counter
PoolItemList installList = getMarked(1);
PoolItemList compareList = compareContext->getMarked(1);; // List of comparing items which has to be installed
@@ -1801,30 +1803,30 @@
for ( PoolItemList::const_iterator thisIt = installList.begin();
thisIt != installList.end(); thisIt++ )
{
- // evaluate, if the user selected packages (items) has the same source
+ // evaluate, if the user selected packages (items) has the same repository
ResStatus status = getStatus (*thisIt);
if (status.isByUser()
|| thisIt->status().isByUser())
{
- if (userSource == Source_Ref::noSource
- && !differentUserSources)
+ if (userRepo == Repository::noRepository
+ && !differentUserRepos)
{
- userSource = thisIt->resolvable()->source();
+ userRepo = thisIt->resolvable()->repository();
}
- else if (userSource != thisIt->resolvable()->source())
+ else if (userRepo != thisIt->resolvable()->repository())
{
- differentUserSources = true; // there are other items of other sources which have been set by the user
+ differentUserRepos = true; // there are other items of other repositorys which have been set by the user
}
}
// collecting relationship between channels and installed items
- if (thisMap.find (thisIt->resolvable()->source()) == thisMap.end()) {
- thisMap[thisIt->resolvable()->source()] = 1;
+ if (thisMap.find (thisIt->resolvable()->repository()) == thisMap.end()) {
+ thisMap[thisIt->resolvable()->repository()] = 1;
}
else {
- thisMap[thisIt->resolvable()->source()] += 1;
+ thisMap[thisIt->resolvable()->repository()] += 1;
}
- _XDEBUG ("Count of left " << thisIt->resolvable()->source() << ": " << thisMap[thisIt->resolvable()->source()] << " : " << *(thisIt->resolvable()));
+ _XDEBUG ("Count of left " << thisIt->resolvable()->repository() << ": " << thisMap[thisIt->resolvable()->repository()] << " : " << *(thisIt->resolvable()));
// Comparing versions
while (itCompare != compareList.end() )
@@ -1836,29 +1838,29 @@
// Testcase: freshen-tests/exercise-7f-test
// Testcase: freshen-tests/exercise-7-test
cmpVersion += thisIt->resolvable()->edition().compare( itCompare->resolvable()->edition());
- _XDEBUG ("Version: " << *(thisIt->resolvable()) << "[" << thisIt->resolvable()->source() << "]" << endl
+ _XDEBUG ("Version: " << *(thisIt->resolvable()) << "[" << thisIt->resolvable()->repository() << "]" << endl
<< " <--> " << endl
- << "Version: " << *(itCompare->resolvable()) << "[" << itCompare->resolvable()->source() << "]"
+ << "Version: " << *(itCompare->resolvable()) << "[" << itCompare->resolvable()->repository() << "]"
<< " --> cmpVersion : " << cmpVersion);
- // evaluate if the user selected packages (items) has the same source
- ResObject::constPtr sourceItem = itCompare->resolvable();
+ // evaluate if the user selected packages (items) has the same repository
+ ResObject::constPtr repositoryItem = itCompare->resolvable();
ResStatus compStatus = compareContext->getStatus(*itCompare);
if (compStatus.isByUser()
|| itCompare->status().isByUser())
{
- if (userSourceCompare == Source_Ref::noSource
- && !differentUserCompareSources)
- userSourceCompare = sourceItem->source();
- else if (userSourceCompare != sourceItem->source())
- differentUserCompareSources = true; // there are other items of other sources which have been set by the user
+ if (userRepoCompare == Repository::noRepository
+ && !differentUserCompareRepos)
+ userRepoCompare = repositoryItem->repository();
+ else if (userRepoCompare != repositoryItem->repository())
+ differentUserCompareRepos = true; // there are other items of other repositorys which have been set by the user
}
// collecting relationship between channels and installed items
- if (compareMap.find (sourceItem->source()) == compareMap.end())
- compareMap[sourceItem->source()] = 1;
+ if (compareMap.find (repositoryItem->repository()) == compareMap.end())
+ compareMap[repositoryItem->repository()] = 1;
else
- compareMap[sourceItem->source()] += 1;
- _XDEBUG ("Count of right " << sourceItem->source() << ": " << compareMap[sourceItem->source()] << " : " << *(itCompare->resolvable()));
+ compareMap[repositoryItem->repository()] += 1;
+ _XDEBUG ("Count of right " << repositoryItem->repository() << ": " << compareMap[repositoryItem->repository()] << " : " << *(itCompare->resolvable()));
itCompare++;
} else if (cmp > 0 )
itCompare++;
@@ -1869,66 +1871,66 @@
// comparing the rest of the other install list
while (itCompare != compareList.end() )
{
- // evaluate if the user selected packages (items) has the same source
- ResObject::constPtr sourceItem = itCompare->resolvable();
+ // evaluate if the user selected packages (items) has the same repository
+ ResObject::constPtr repositoryItem = itCompare->resolvable();
ResStatus compStatus = compareContext->getStatus(*itCompare);
if (compStatus.isByUser()
|| itCompare->status().isByUser())
{
- if (userSourceCompare == Source_Ref::noSource
- && !differentUserCompareSources)
- userSourceCompare = sourceItem->source();
- else if (userSourceCompare != sourceItem->source())
- differentUserCompareSources = true; // there are other items of other sources which have been set by the user
+ if (userRepoCompare == Repository::noRepository
+ && !differentUserCompareRepos)
+ userRepoCompare = repositoryItem->repository();
+ else if (userRepoCompare != repositoryItem->repository())
+ differentUserCompareRepos = true; // there are other items of other repositorys which have been set by the user
}
// collecting relationship between channels and installed items
- if (compareMap.find (sourceItem->source()) == compareMap.end())
- compareMap[sourceItem->source()] = 1;
+ if (compareMap.find (repositoryItem->repository()) == compareMap.end())
+ compareMap[repositoryItem->repository()] = 1;
else
- compareMap[sourceItem->source()] += 1;
- _XDEBUG ("Count of right" << sourceItem->source() << ": " << compareMap[sourceItem->source()] << " : "
+ compareMap[repositoryItem->repository()] += 1;
+ _XDEBUG ("Count of right" << repositoryItem->repository() << ": " << compareMap[repositoryItem->repository()] << " : "
<< *(itCompare->resolvable()));
itCompare++;
}
- // evaluate cmpSource
- cmpSource = 0;
+ // evaluate cmpRepo
+ cmpRepo = 0;
int cmpCompare = 0;
- if (!differentUserSources)
+ if (!differentUserRepos)
{
// user selected items which has to be installed has only one channel;
- // cmpSource = number of items of that channel
- cmpSource = thisMap[userSource];
+ // cmpRepo = number of items of that channel
+ cmpRepo = thisMap[userRepo];
}
- if (!differentUserCompareSources) {
+ if (!differentUserCompareRepos) {
// user selected items which has to be installed has only one channel;
// cmpCompare = number of items of that channel
- cmpCompare = compareMap[userSourceCompare];
+ cmpCompare = compareMap[userRepoCompare];
}
- _XDEBUG ("cmpSource = " << cmpSource << " ; cmpCompare = " << cmpCompare << " ; sizeof compareMap:" << compareMap.size());
+ _XDEBUG ("cmpRepo = " << cmpRepo << " ; cmpCompare = " << cmpCompare << " ; sizeof compareMap:" << compareMap.size());
if (compareMap.size() == 1
&& thisMap.size() == 1
- && userSource == userSourceCompare) {
- // We have only one source from which all items will be instaled.
+ && userRepo == userRepoCompare) {
+ // We have only one repository from which all items will be instaled.
// So we will regards the complete amount of installed/updated packages
// Testcase basic-exercises/exercise-14-test
- cmpSource = 0;
+ cmpRepo = 0;
} else {
// The solutions has different channels with user selected items.
// Take the solution with the greater account of items in this channel
// Testcase basic-exercises/exercise-solution-order-test
- cmpSource = cmpSource - cmpCompare;
+ cmpRepo = cmpRepo - cmpCompare;
}
- if (cmpSource == 0)
+ if (cmpRepo == 0)
{
// less amount of channels are better
- cmpSource = compareMap.size() - thisMap.size();
+ cmpRepo = compareMap.size() - thisMap.size();
}
- _XDEBUG ("End comparing two solutions-------- Version compare: " << cmpVersion << " Source compare: "<< cmpSource);
+ _XDEBUG ("End comparing two solutions-------- Version compare: " << cmpVersion << " Repo compare: "<< cmpRepo);
}
int
@@ -1939,16 +1941,16 @@
// collecting all data for comparing both resultion results
int cmpVersion = 0; // Version compare of ACCUMULATED items
- int cmpSource = 0; // compare of Sources
+ int cmpRepo = 0; // compare of Repos
- collectCompareInfo (cmpVersion, cmpSource, context);
+ collectCompareInfo (cmpVersion, cmpRepo, context);
if (_preferHighestVersion) {
// comparing versions
cmp = cmpVersion;
DBG << "Comparing versions returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are good... we don't want solutions containing low-priority channels.
- // Source priority which has been set externally
+ // Repo priority which has been set externally
cmp = num_cmp (_min_priority, context->_min_priority);
DBG << "Comparing priority returned :" << cmp << endl;
if (cmp == 0) {
@@ -1956,9 +1958,9 @@
cmp = rev_num_cmp (churn_factor (this), churn_factor (context));
DBG << "Comparing churn_factor returned :" << cmp << endl;
if (cmp == 0) {
- // Comparing sources regarding the items which has to be installed
- cmp = cmpSource;
- DBG << "Comparing sources returned :" << cmp << endl;
+ // Comparing repositorys regarding the items which has to be installed
+ cmp = cmpRepo;
+ DBG << "Comparing repositorys returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are bad. Bigger #s means more penalties.
cmp = rev_num_cmp (_other_penalties, context->_other_penalties);
@@ -1974,16 +1976,16 @@
DBG << "Comparing churn_factor returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are good... we don't want solutions containing low-priority channels.
- // Source priority which has been set externally
+ // Repo priority which has been set externally
cmp = num_cmp (_min_priority, context->_min_priority);
DBG << "Comparing priority returned :" << cmp << endl;
if (cmp == 0) {
cmp = cmpVersion;
DBG << "Comparing versions returned :" << cmp << endl;
if (cmp == 0) {
- // Comparing sources regarding the items which has to be installed
- cmp = cmpSource;
- DBG << "Comparing sources returned :" << cmp << endl;
+ // Comparing repositorys regarding the items which has to be installed
+ cmp = cmpRepo;
+ DBG << "Comparing repositorys returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are bad. Bigger #s means more penalties.
cmp = rev_num_cmp (_other_penalties, context->_other_penalties);
Modified: trunk/libzypp/zypp/solver/detail/ResolverContext.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/ResolverContext.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/ResolverContext.h (original)
+++ trunk/libzypp/zypp/solver/detail/ResolverContext.h Mon Jul 16 12:40:42 2007
@@ -29,7 +29,7 @@
#include "zypp/ResPool.h"
#include "zypp/PoolItem.h"
#include "zypp/Capability.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/solver/detail/Types.h"
#include "zypp/solver/detail/ResolverInfo.h"
@@ -48,7 +48,7 @@
typedef void (*MarkedPoolItemFn) (PoolItem_Ref item, const ResStatus & status, void *data);
typedef void (*MarkedPoolItemPairFn) (PoolItem_Ref item1, const ResStatus & status1, PoolItem_Ref item2, const ResStatus & status2, void *data);
typedef std::multimap IgnoreMap;
-typedef std::map SourceCounter;
+typedef std::map RepositoryCounter;
///////////////////////////////////////////////////////////////////
//
@@ -319,7 +319,7 @@
void spew (void);
void spewInfo (void) const;
- int getSourcePriority (Source_Ref source) const;
+ int getRepoPriority (Repository source) const;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/solver/detail/ResolverInfo.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/ResolverInfo.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/ResolverInfo.cc (original)
+++ trunk/libzypp/zypp/solver/detail/ResolverInfo.cc Mon Jul 16 12:40:42 2007
@@ -23,7 +23,7 @@
#include <sstream>
#include "zypp/solver/detail/ResolverInfo.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/Capability.h"
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
@@ -149,13 +149,13 @@
if (item->arch() != "") {
os << '.' << item->arch();
}
- Source_Ref s = item->source();
+ Repository s = item->repository();
if (s) {
- string alias = s.alias();
+ string alias = s.info().alias();
if (!alias.empty()
&& alias != "@system")
{
- os << '[' << s.alias() << ']';
+ os << '[' << s.info().alias() << ']';
}
}
return os.str();
Modified: trunk/libzypp/zypp/solver/detail/ResolverQueue.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/ResolverQueue.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/ResolverQueue.cc (original)
+++ trunk/libzypp/zypp/solver/detail/ResolverQueue.cc Mon Jul 16 12:40:42 2007
@@ -319,10 +319,10 @@
QueueItemInstall_Ptr install_qitem = dynamic_pointer_cast<QueueItemInstall>(new_qitem);
/* Penalties are negative priorities */
- int penalty;
- Source_Ref src = install_qitem->item()->source();
- penalty = - src.priority();
-
+#warning FIX priorities
+ int penalty = 0;
+ Repository repo = install_qitem->item()->repository();
+ //penalty = - src.priority();
install_qitem->setOtherPenalty (penalty);
}
@@ -375,12 +375,12 @@
if (qitem->isInstall() && qitem2->isInstall()) {
PoolItem_Ref r = (dynamic_pointer_cast<QueueItemInstall>(qitem))->item();
PoolItem_Ref r2 = (dynamic_pointer_cast<QueueItemInstall>(qitem2))->item();
- Source_Ref source = r->source();
- Source_Ref source2 = r2->source();
+ Repository repo1 = r->repository();
+ Repository repo2 = r2->repository();
int priority, priority2;
- priority = _context->getSourcePriority( source );
- priority2 = _context->getSourcePriority( source2 );
+ priority = _context->getRepoPriority( repo1 );
+ priority2 = _context->getRepoPriority( repo2 );
if (priority != priority2 && r->name() == r2->name()) {
if (r->edition().compare(r2->edition()) == 0
Modified: trunk/libzypp/zypp/solver/detail/Testcase.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Testcase.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Testcase.cc (original)
+++ trunk/libzypp/zypp/solver/detail/Testcase.cc Mon Jul 16 12:40:42 2007
@@ -222,7 +222,7 @@
zypp::base::LogControl::instance().logfile( "/var/log/YaST2/y2log" );
ResPool pool = resolver.pool();
- SourceTable sourceTable;
+ RepositoryTable repoTable;
PoolItemList items_to_install;
PoolItemList items_to_remove;
HelixResolvable system (dumpPath + "/solver-system.xml");
@@ -235,15 +235,15 @@
// system channel
system.addResolvable (res);
} else {
- // source channels
- ResObject::constPtr sourceItem = it->resolvable();
- Source_Ref source = sourceItem->source();
- if (sourceTable.find (source) == sourceTable.end()) {
- sourceTable[source] = new HelixResolvable(dumpPath + "/"
- + numstring(source.numericId())
+ // repo channels
+ ResObject::constPtr repoItem = it->resolvable();
+ Repository repo = repoItem->repository();
+ if (repoTable.find (repo) == repoTable.end()) {
+ repoTable[repo] = new HelixResolvable(dumpPath + "/"
+ + numstring(repo.numericId())
+ "-package.xml");
}
- sourceTable[source]->addResolvable (res);
+ repoTable[repo]->addResolvable (res);
}
if ( it->status().isToBeInstalled()
@@ -259,7 +259,7 @@
// writing control file "*-test.xml"
HelixControl control (dumpPath + "/solver-test.xml",
- sourceTable,
+ repoTable,
resolver.architecture());
for (PoolItemList::const_iterator iter = items_to_install.begin(); iter != items_to_install.end(); iter++) {
@@ -300,7 +300,7 @@
//---------------------------------------------------------------------------
HelixControl::HelixControl(const std::string & controlPath,
- const SourceTable & sourceTable,
+ const RepositoryTable & repoTable,
const Arch & systemArchitecture,
const std::string & systemPath)
:dumpFile (controlPath)
@@ -315,11 +315,11 @@
<< "<test>" << endl
<< "" << endl
<< TAB << "" << endl;
- for ( SourceTable::const_iterator it = sourceTable.begin();
- it != sourceTable.end(); ++it ) {
- Source_Ref source = it->first;
- *file << TAB << "first;
+ *file << TAB << "" << endl;
}
*file << "</setup>" << endl
@@ -343,8 +343,8 @@
void HelixControl::installResolvable(const ResObject::constPtr &resObject)
{
- Source_Ref source = resObject->source();
- *file << "kind().asString()) << "\""
+ Repository repo = resObject->repository();
+ *file << "kind().asString()) << "\""
<< " name=\"" << resObject->name() << "\"" << " arch=\"" << resObject->arch().asString() << "\""
<< " version=\"" << resObject->edition().version() << "\"" << " release=\"" << resObject->edition().release() << "\""
<< " edition=\"" << resObject->edition().asString() << "\"" << "/>" << endl;
@@ -352,7 +352,7 @@
void HelixControl::deleteResolvable(const ResObject::constPtr &resObject)
{
- Source_Ref source = resObject->source();
+ Repository repo = resObject->repository();
*file << "kind().asString()) << "\""
<< " name=\"" << resObject->name() << "\"" << "/>" << endl;
}
Modified: trunk/libzypp/zypp/solver/detail/Testcase.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Testcase.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Testcase.h (original)
+++ trunk/libzypp/zypp/solver/detail/Testcase.h Mon Jul 16 12:40:42 2007
@@ -76,7 +76,7 @@
};
DEFINE_PTR_TYPE(HelixResolvable);
-typedef std::map SourceTable;
+typedef std::map RepositoryTable;
///////////////////////////////////////////////////////////////////
//
@@ -93,7 +93,7 @@
public:
HelixControl (const std::string & controlPath,
- const SourceTable & sourceTable,
+ const RepositoryTable & sourceTable,
const Arch & systemArchitecture,
const std::string & systemPath = "solver-system.xml");
HelixControl ();
Modified: trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.cc (original)
+++ trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.cc Mon Jul 16 12:40:42 2007
@@ -13,7 +13,7 @@
#include "zypp/base/Logger.h"
#include "zypp/base/Exception.h"
-
+#include "zypp/PathInfo.h"
#include "zypp/target/CommitPackageCacheReadAhead.h"
using std::endl;
@@ -33,8 +33,8 @@
std::ostream & operator<<( std::ostream & str, const IMediaKey & obj )
{
- return str << "[S" << obj._source.numericId() << ":" << obj._mediaNr << "]"
- << " " << obj._source.alias();
+ return str << "[S" << obj._repository.numericId() << ":" << obj._mediaNr << "]"
+ << " " << obj._repository.info().alias();
}
///////////////////////////////////////////////////////////////////
@@ -64,10 +64,12 @@
//
bool CommitPackageCacheReadAhead::onInteractiveMedia( const PoolItem & pi ) const
{
- if ( pi->sourceMediaNr() == 0 ) // no media access at all
+ if ( pi->mediaNr() == 0 ) // no media access at all
return false;
- std::string scheme( pi->source().url().getScheme() );
- return ( scheme == "dvd" || scheme == "cd" );
+ //std::string scheme( pi->source().url().getScheme() );
+ //return ( scheme == "dvd" || scheme == "cd" );
+#warning "FIX CommitPackageCacheReadAhead::onInteractiveMedia"
+ return false;
}
///////////////////////////////////////////////////////////////////
@@ -110,7 +112,7 @@
if ( _cacheMap.find( *it ) == _cacheMap.end() )
{
addToCache[*it];
- addSize += it->resolvable()->archivesize();
+ addSize += it->resolvable()->downloadSize();
}
}
}
@@ -158,8 +160,8 @@
// copy it to the cachedir
std::string destName( str::form( "S%lu_%u_%s",
- it->first->source().numericId(),
- it->first->sourceMediaNr(),
+ it->first->repository().numericId(),
+ it->first->mediaNr(),
fromSource.value().basename().c_str() ) );
ManagedFile fileInCache( _cacheDir->path() / destName,
Modified: trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.h (original)
+++ trunk/libzypp/zypp/target/CommitPackageCacheReadAhead.h Mon Jul 16 12:40:42 2007
@@ -18,7 +18,7 @@
#include "zypp/base/Exception.h"
#include "zypp/base/DefaultIntegral.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/TmpPath.h"
#include "zypp/target/CommitPackageCacheImpl.h"
@@ -41,29 +41,29 @@
explicit
IMediaKey( const ResObject::constPtr & obj_r )
- : _source( obj_r->source() )
- , _mediaNr( obj_r->sourceMediaNr() )
+ : _repository( obj_r->repository() )
+ , _mediaNr( obj_r->mediaNr() )
{}
- IMediaKey( const Source_Ref & source_r, unsigned mediaNr_r )
- : _source( source_r )
+ IMediaKey( const Repository & repo, unsigned mediaNr_r )
+ : _repository( repo )
, _mediaNr( mediaNr_r )
{}
bool operator==( const IMediaKey & rhs ) const
- { return( _source == rhs._source && _mediaNr == rhs._mediaNr ); }
+ { return( _repository == rhs._repository && _mediaNr == rhs._mediaNr ); }
bool operator!=( const IMediaKey & rhs ) const
{ return ! operator==( rhs ); }
bool operator<( const IMediaKey & rhs ) const
{
- return( _source.numericId() < rhs._source.numericId()
- || ( _source.numericId() == rhs._source.numericId()
+ return( _repository.numericId() < rhs._repository.numericId()
+ || ( _repository.numericId() == rhs._repository.numericId()
&& _mediaNr < rhs._mediaNr ) );
}
- Source_Ref _source;
+ Repository _repository;
DefaultIntegral _mediaNr;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/target/TargetImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/TargetImpl.cc (original)
+++ trunk/libzypp/zypp/target/TargetImpl.cc Mon Jul 16 12:40:42 2007
@@ -19,6 +19,8 @@
#include "zypp/base/Exception.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/Gettext.h"
+#include "zypp/base/UserRequestException.h"
+
#include "zypp/PoolItem.h"
#include "zypp/Resolvable.h"
#include "zypp/ResObject.h"
@@ -27,7 +29,6 @@
#include "zypp/Selection.h"
#include "zypp/Script.h"
#include "zypp/Message.h"
-#include "zypp/Source.h"
#include "zypp/Url.h"
#include "zypp/CapMatchHelper.h"
@@ -41,12 +42,8 @@
#include "zypp/pool/GetResolvablesToInsDel.h"
#include "zypp/solver/detail/Helper.h"
-#ifdef ZYPP_REFACTORING
#include "zypp/repo/DeltaCandidates.h"
#include "zypp/repo/PackageProvider.h"
-#else
-#include "zypp/source/PackageProvider.h"
-#endif
using namespace std;
using namespace zypp;
@@ -224,31 +221,45 @@
}
};
- /** Let the Source provide the package.
+ /**
+ * \short Let the Source provide the package.
+ * \p pool_r \ref ResPool used to get candidates
+ * \p pi item to be commited
*/
- static ManagedFile sourceProvidePackage( const PoolItem & pi )
+ struct RepoProvidePackage
{
- // Redirect PackageProvider queries for installed editions
- // (in case of patch/delta rpm processing) to rpmDb.
-#ifdef ZYPP_REFACTORING
- repo::PackageProviderPolicy packageProviderPolicy;
-#else
- source::PackageProviderPolicy packageProviderPolicy;
-#endif
- packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() );
-
- Package::constPtr p = asKind<Package>(pi.resolvable());
-#ifdef ZYPP_REFACTORING
- // FIXME no repo list
- std::set<Repository> repos;
- repo::DeltaCandidates deltas(repos);
- repo::PackageProvider pkgProvider( p, deltas, packageProviderPolicy );
-#else
- source::PackageProvider pkgProvider( p, packageProviderPolicy );
-#endif
- return pkgProvider.providePackage();
- }
-
+ ResPool _pool;
+ RepoProvidePackage( ResPool pool_r )
+ : _pool(pool_r)
+ {
+
+ }
+
+ ManagedFile operator()( const PoolItem & pi )
+ {
+ // Redirect PackageProvider queries for installed editions
+ // (in case of patch/delta rpm processing) to rpmDb.
+ repo::PackageProviderPolicy packageProviderPolicy;
+ packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() );
+
+ Package::constPtr p = asKind<Package>(pi.resolvable());
+
+
+ // Build a repository list for repos
+ // contributing to the pool
+ std::list<Repository> repos;
+ for ( ResPool::repository_iterator it = _pool.knownRepositoriesBegin();
+ it != _pool.knownRepositoriesEnd();
+ ++it )
+ {
+ repos.push_back(*it);
+ }
+
+ repo::DeltaCandidates deltas(repos);
+ repo::PackageProvider pkgProvider( p, deltas, packageProviderPolicy );
+ return pkgProvider.providePackage();
+ }
+ };
///////////////////////////////////////////////////////////////////
IMPL_PTR_TYPE(TargetImpl);
@@ -432,7 +443,7 @@
ResObject::constPtr res( it->resolvable() );
if ( hitUnwantedMedia
- || ( res->sourceMediaNr() && res->sourceMediaNr() != policy_r.restrictToMedia() ) )
+ || ( res->mediaNr() && res->mediaNr() != policy_r.restrictToMedia() ) )
{
hitUnwantedMedia = true;
result._remaining.push_back( *it );
@@ -450,9 +461,9 @@
{
Resolvable::constPtr res( it->resolvable() );
Package::constPtr pkg( asKind<Package>(res) );
- if (pkg && policy_r.restrictToMedia() != pkg->sourceMediaNr()) // check medianr for packages only
+ if (pkg && policy_r.restrictToMedia() != pkg->mediaNr()) // check medianr for packages only
{
- XXX << "Package " << *pkg << ", wrong media " << pkg->sourceMediaNr() << endl;
+ XXX << "Package " << *pkg << ", wrong media " << pkg->mediaNr() << endl;
result._srcremaining.push_back( *it );
}
else
@@ -482,11 +493,12 @@
bool abort = false;
// remember the last used source (if any)
- Source_Ref lastUsedSource;
+ Repository lastUsedRepo;
+ RepoProvidePackage repoProvidePackage(pool_r);
// prepare the package cache.
CommitPackageCache packageCache( items_r.begin(), items_r.end(),
- root() / "tmp", sourceProvidePackage );
+ root() / "tmp", repoProvidePackage );
for (TargetImpl::PoolItemList::const_iterator it = items_r.begin(); it != items_r.end(); it++)
{
@@ -500,14 +512,14 @@
{
localfile = packageCache.get( it );
}
- catch ( const source::SkipRequestedException & e )
+ catch ( const SkipRequestException &e )
{
ZYPP_CAUGHT( e );
WAR << "Skipping package " << p << " in commit" << endl;
continue;
}
- lastUsedSource = p->source(); // remember the package source
+ lastUsedRepo = p->repository(); // remember the package source
#warning Exception handling
// create a installation progress report proxy
@@ -718,9 +730,9 @@
// In the case of 'commit any media', end of commit means we're completely
// done and don't need the source's media anyways.
- if (lastUsedSource)
+ if (lastUsedRepo)
{ // if a source was used
- lastUsedSource.release(); // release their medias
+ //lastUsedRepo.release(); // release their medias
}
if ( abort )
@@ -764,19 +776,6 @@
return true;
}
- void
- TargetImpl::getResolvablesToInsDel ( const ResPool pool_r,
- TargetImpl::PoolItemList & dellist_r,
- TargetImpl::PoolItemList & instlist_r,
- TargetImpl::PoolItemList & srclist_r ) const
- {
- pool::GetResolvablesToInsDel collect( pool_r );
- MIL << "GetResolvablesToInsDel: " << endl << collect << endl;
- dellist_r.swap( collect._toDelete );
- instlist_r.swap( collect._toInstall );
- srclist_r.swap( collect._toSrcinstall );
- }
-
Date TargetImpl::timestamp() const
{
Date ts_rpm;
Modified: trunk/libzypp/zypp/target/TargetImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/TargetImpl.h (original)
+++ trunk/libzypp/zypp/target/TargetImpl.h Mon Jul 16 12:40:42 2007
@@ -61,15 +61,6 @@
typedef std::set PoolItemSet;
public:
- /** JUST FOR TESTSUITE */
- /** Sort according to prereqs and media numbers */
- void getResolvablesToInsDel ( const ResPool pool_r,
- PoolItemList & dellist_r,
- PoolItemList & instlist_r,
- PoolItemList & srclist_r ) const;
-
-
- public:
/** Ctor. */
TargetImpl(const Pathname & root_r = "/");
/** Dtor. */
Modified: trunk/libzypp/zypp/target/rpm/RpmDb.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmDb.cc (original)
+++ trunk/libzypp/zypp/target/rpm/RpmDb.cc Mon Jul 16 12:40:42 2007
@@ -1104,12 +1104,23 @@
return empty_list;
}
+inline static void insertCaps( CapSet &capset, capability::CapabilityImplPtrSet ptrset, CapFactory &factory )
+{
+ for ( capability::CapabilityImplPtrSet::const_iterator it = ptrset.begin();
+ it != ptrset.end();
+ ++it )
+ {
+ capset.insert( factory.fromImpl(*it) );
+ }
+}
//
// make Package::Ptr from RpmHeader
// return NULL on error
//
-Package::Ptr RpmDb::makePackageFromHeader( const RpmHeader::constPtr header, set<string> * filerequires, const Pathname & location, Source_Ref source )
+Package::Ptr RpmDb::makePackageFromHeader( const RpmHeader::constPtr header,
+ set<string> * filerequires,
+ const Pathname & location, Repository repo )
{
if ( ! header )
return 0;
@@ -1127,9 +1138,9 @@
// create dataprovider
detail::ResImplTraits<RPMPackageImpl>::Ptr impl( new RPMPackageImpl( header ) );
- impl->setSource( source );
+ impl->setRepository( repo );
if (!location.empty())
- impl->setLocation( location );
+ impl->setLocation( OnMediaLocation().setFilename(location) );
Edition edition;
try
@@ -1166,9 +1177,9 @@
arch );
list<string> filenames = impl->filenames();
- dataCollect[Dep::PROVIDES] = header->tag_provides ( filerequires );
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 );
@@ -1181,7 +1192,7 @@
{
try
{
- dataCollect[Dep::PROVIDES].insert( capfactory.parse(ResTraits<Package>::kind, *filename) );
+ dataCollect[Dep::PROVIDES].insert(capfactory.fromImpl(capability::buildFile(ResTraits<Package>::kind, *filename) ));
}
catch (Exception & excpt_r)
{
@@ -1191,12 +1202,12 @@
}
}
- dataCollect[Dep::REQUIRES] = header->tag_requires( filerequires );
- dataCollect[Dep::PREREQUIRES] = header->tag_prerequires( filerequires );
- dataCollect[Dep::CONFLICTS] = header->tag_conflicts( filerequires );
- dataCollect[Dep::OBSOLETES] = header->tag_obsoletes( filerequires );
- dataCollect[Dep::ENHANCES] = header->tag_enhances( filerequires );
- dataCollect[Dep::SUPPLEMENTS] = header->tag_supplements( filerequires );
+ insertCaps( dataCollect[Dep::REQUIRES], header->tag_requires( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::PREREQUIRES], header->tag_prerequires( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::CONFLICTS], header->tag_conflicts( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::OBSOLETES], header->tag_obsoletes( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::ENHANCES], header->tag_enhances( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::SUPPLEMENTS], header->tag_supplements( filerequires ), capfactory );
try
{
@@ -1212,7 +1223,6 @@
return pptr;
}
-
const listPackage::Ptr & RpmDb::doGetPackages(callback::SendReport<ScanDBReport> & report)
{
if ( packagesValid() )
@@ -1248,7 +1258,7 @@
continue;
}
- Package::Ptr pptr = makePackageFromHeader( *iter, &_filerequires, location, Source_Ref() );
+ Package::Ptr pptr = makePackageFromHeader( *iter, &_filerequires, location, Repository() );
if ( ! pptr )
{
WAR << "Failed to make package from database header '" << name << "'" << endl;
Modified: trunk/libzypp/zypp/target/rpm/RpmDb.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmDb.h (original)
+++ trunk/libzypp/zypp/target/rpm/RpmDb.h Mon Jul 16 12:40:42 2007
@@ -24,7 +24,6 @@
#include "zypp/ExternalProgram.h"
#include "zypp/Package.h"
-#include "zypp/Source.h"
#include "zypp/KeyRing.h"
#include "zypp/target/rpm/RpmHeader.h"
@@ -340,7 +339,9 @@
* return NULL on error
**/
- static Package::Ptr makePackageFromHeader( const RpmHeader::constPtr header, std::setstd::string * filerequires, const Pathname & location, Source_Ref source );
+ static Package::Ptr makePackageFromHeader( const RpmHeader::constPtr header,
+ std::setstd::string * filerequires,
+ const Pathname & location, Repository repo );
///////////////////////////////////////////////////////////////////
//
Modified: trunk/libzypp/zypp/target/rpm/RpmHeader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmHeader.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmHeader.cc (original)
+++ trunk/libzypp/zypp/target/rpm/RpmHeader.cc Mon Jul 16 12:40:42 2007
@@ -26,6 +26,7 @@
#include "zypp/base/Exception.h"
using namespace std;
+using namespace zypp::capability;
namespace zypp
{
@@ -272,9 +273,9 @@
//
// DESCRIPTION :
//
-CapSet RpmHeader::PkgRelList_val( tag tag_r, bool pre, set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::PkgRelList_val( tag tag_r, bool pre, set<string> * freq_r ) const
{
- CapSet ret;
+ CapabilityImplPtrSet ret;
int_32 kindFlags = 0;
int_32 kindVersion = 0;
@@ -370,10 +371,9 @@
if ((pre && (f & RPMSENSE_PREREQ))
|| ((! pre) && !(f & RPMSENSE_PREREQ)))
{
- CapFactory _f;
try
{
- Capability cap = _f.parse(
+ CapabilityImpl::Ptr cap = capability::buildVersioned(
ResTraits<Package>::kind,
n,
op,
@@ -397,11 +397,11 @@
//
//
// METHOD NAME : RpmHeader::tag_provides
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_provides( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_provides( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_PROVIDENAME, false, freq_r );
}
@@ -410,11 +410,11 @@
//
//
// METHOD NAME : RpmHeader::tag_requires
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_requires( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_requires( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_REQUIRENAME, false, freq_r );
}
@@ -423,11 +423,11 @@
//
//
// METHOD NAME : RpmHeader::tag_requires
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_prerequires( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_prerequires( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_REQUIRENAME, true, freq_r );
}
@@ -436,11 +436,11 @@
//
//
// METHOD NAME : RpmHeader::tag_conflicts
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_conflicts( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_conflicts( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_CONFLICTNAME, false, freq_r );
}
@@ -449,11 +449,11 @@
//
//
// METHOD NAME : RpmHeader::tag_obsoletes
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_obsoletes( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_obsoletes( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_OBSOLETENAME, false, freq_r );
}
@@ -462,16 +462,16 @@
//
//
// METHOD NAME : RpmHeader::tag_enhances
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_enhances( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_enhances( set<string> * freq_r ) const
{
#ifdef HAVE_RPM_ENHANCES
return PkgRelList_val( RPMTAG_ENHANCESNAME, false, freq_r );
#else
- return CapSet();
+ return CapabilityImplPtrSet();
#endif
}
@@ -479,13 +479,13 @@
//
//
// METHOD NAME : RpmHeader::tag_supplements
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_supplements( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_supplements( set<string> * freq_r ) const
{
- return CapSet();
+ return CapabilityImplPtrSet();
#warning NEEDS RPMTAG_SUPPLEMENTSNAME
#if 0
return PkgRelList_val( RPMTAG_SUPPLEMENTSNAME, false, freq_r );
Modified: trunk/libzypp/zypp/target/rpm/RpmHeader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmHeader.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmHeader.h (original)
+++ trunk/libzypp/zypp/target/rpm/RpmHeader.h Mon Jul 16 12:40:42 2007
@@ -22,6 +22,8 @@
#include "zypp/CapSetFwd.h"
#include "zypp/Pathname.h"
#include "zypp/DiskUsage.h"
+#include "zypp/capability/CapabilityImpl.h"
+
namespace zypp
{
@@ -68,7 +70,7 @@
private:
- CapSet PkgRelList_val( tag tag_r, bool pre, std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet PkgRelList_val( tag tag_r, bool pre, std::setstd::string * freq_r = 0 ) const;
public:
@@ -107,31 +109,31 @@
/**
* If <code>freq_r</code> is not NULL, file dependencies found are inserted.
**/
- CapSet tag_provides ( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_provides ( std::setstd::string * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_requires ( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_requires ( std::setstd::string * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_prerequires ( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_prerequires ( std::setstd::string * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_conflicts( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_conflicts( std::setstd::string * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_obsoletes( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_obsoletes( std::setstd::string * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_enhances( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_enhances( std::setstd::string * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_supplements( std::setstd::string * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_supplements( std::setstd::string * freq_r = 0 ) const;
ByteCount tag_size() const;
ByteCount tag_archivesize() const;
Modified: trunk/libzypp/zypp/target/rpm/RpmPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmPackageImpl.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmPackageImpl.cc (original)
+++ trunk/libzypp/zypp/target/rpm/RpmPackageImpl.cc Mon Jul 16 12:40:42 2007
@@ -52,12 +52,12 @@
_type("rpm"), // FIXME in the future
_filenames(data->tag_filenames()),
// _disk_usage(data->diskusage),
- _size(data->tag_size()),
- _archivesize(data->tag_archivesize())
+ _size(data->tag_size())
{
// we know we are reading english.
_description.setText(data->tag_description(), Locale("en"));
data->tag_du(_disk_usage);
+ _location.setDownloadSize(data->tag_archivesize());
}
/** Package summary */
@@ -133,7 +133,7 @@
}
/** */
-Pathname RPMPackageImpl::location() const
+OnMediaLocation RPMPackageImpl::location() const
{
return _location;
}
@@ -188,12 +188,6 @@
}
/** */
-ByteCount RPMPackageImpl::archivesize() const
-{
- return _archivesize;
-}
-
-/** */
std::liststd::string RPMPackageImpl::filenames() const
{
return _filenames;
@@ -212,9 +206,9 @@
}
/** */
-Source_Ref RPMPackageImpl::source() const
+Repository RPMPackageImpl::repository() const
{
- return _source;
+ return _repository;
}
} // namespace rpm
Modified: trunk/libzypp/zypp/target/rpm/RpmPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmPackageImpl.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmPackageImpl.h (original)
+++ trunk/libzypp/zypp/target/rpm/RpmPackageImpl.h Mon Jul 16 12:40:42 2007
@@ -13,7 +13,6 @@
#define ZYPP_TARGET_RPM_RPMPACKAGEIMPL_H
#include "zypp/detail/PackageImplIf.h"
-#include "zypp/Source.h"
#include "zypp/Changelog.h"
#include "zypp/target/rpm/RpmHeader.h"
@@ -65,8 +64,7 @@
virtual PackageGroup group() const;
/** */
virtual Changelog changelog() const;
- /** */
- virtual Pathname location() const;
+
/** Don't ship it as class Url, because it might be
* in fact anything but a legal Url. */
virtual std::string url() const;
@@ -83,24 +81,25 @@
/** */
virtual ByteCount sourcesize() const;
/** */
- virtual ByteCount archivesize() const;
- /** */
virtual std::liststd::string filenames() const;
/** */
virtual std::string type() const;
/** */
virtual DiskUsage diskUsage() const;
/** */
- virtual Source_Ref source() const;
+ virtual Repository repository() const;
/** for 'local' RPMs */
- void setLocation (const Pathname & pathname)
+ void setLocation (const OnMediaLocation &loc)
{
- _location = pathname;
+ _location = loc;
}
- void setSource (Source_Ref source)
+
+ OnMediaLocation location() const;
+
+ void setRepository (Repository repo)
{
- _source = source;
+ _repository = repo;
}
protected:
@@ -115,13 +114,12 @@
std::string _packager;
PackageGroup _group;
Changelog _changelog;
- Pathname _location; // for 'local' rpms
std::string _type;
std::liststd::string _filenames;
DiskUsage _disk_usage;
ByteCount _size;
- ByteCount _archivesize;
- Source_Ref _source;
+ Repository _repository;
+ OnMediaLocation _location;
};
///////////////////////////////////////////////////////////////////
} // namespace rpm
Modified: trunk/libzypp/zypp/target/store/Backend.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/store/Backend.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/store/Backend.h (original)
+++ trunk/libzypp/zypp/target/store/Backend.h Mon Jul 16 12:40:42 2007
@@ -99,22 +99,6 @@
virtual std::setstd::string flags( const std::string &key ) const = 0;
virtual bool hasFlag( const std::string &key, const std::string &flag ) const = 0;
- /////////////////////////////////////////////////////////
- // SOURCES API
- ////////////////////////////////////////////////////////
- /**
- * Query for installed Sources
- */
- virtual source::SourceInfoList storedSources() const = 0;
- /**
- * Query for installed Sources
- */
- virtual void storeSource(const source::SourceInfo &data) = 0;
- /**
- * Query for installed Sources
- */
- virtual void deleteSource(const std::string &alias) = 0;
-
private:
/** Pointer to implementation */
class Private;
Modified: trunk/libzypp/zypp/target/store/PersistentStorage.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/store/PersistentStorage.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/store/PersistentStorage.cc (original)
+++ trunk/libzypp/zypp/target/store/PersistentStorage.cc Mon Jul 16 12:40:42 2007
@@ -165,28 +165,6 @@
return d->backend->hasFlag(key, flag);
}
-/////////////////////////////////////////////////////////
-// SOURCES API
-////////////////////////////////////////////////////////
-
-source::SourceInfoList
-PersistentStorage::storedSources() const
-{
- return d->backend->storedSources();
-}
-
-void
-PersistentStorage::storeSource(const source::SourceInfo &data)
-{
- d->backend->storeSource(data);
-}
-
-void
-PersistentStorage::deleteSource(const std::string &alias)
-{
- d->backend->deleteSource(alias);
-}
-
/******************************************************************
**
** FUNCTION NAME : operator<<
Modified: trunk/libzypp/zypp/target/store/PersistentStorage.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/store/PersistentStorage.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/store/PersistentStorage.h (original)
+++ trunk/libzypp/zypp/target/store/PersistentStorage.h Mon Jul 16 12:40:42 2007
@@ -21,9 +21,6 @@
#include
#include
#include
-#include
-
-using namespace zypp::source;
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -116,22 +113,6 @@
std::setstd::string flags( const std::string &key ) const;
bool hasFlag( const std::string &key, const std::string &flag ) const;
- /////////////////////////////////////////////////////////
- // SOURCES API
- ////////////////////////////////////////////////////////
- /**
- * Query for installed Sources
- */
- std::list<SourceInfo> storedSources() const;
- /**
- * Add a new installed source
- */
- void storeSource(const SourceInfo &data);
- /**
- * Delete an installed source
- */
- void deleteSource(const std::string &alias);
-
private:
class Private;
shared_ptr<Private> d;
Modified: trunk/libzypp/zypp/target/store/XMLFilesBackend.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/store/XMLFilesBackend.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/store/XMLFilesBackend.cc (original)
+++ trunk/libzypp/zypp/target/store/XMLFilesBackend.cc Mon Jul 16 12:40:42 2007
@@ -17,11 +17,9 @@
#include "zypp/base/Logger.h"
#include "zypp/base/Exception.h"
#include "zypp/base/Random.h"
-
+#include "zypp/base/Gettext.h"
#include "zypp/CapFactory.h"
#include "zypp/Digest.h"
-#include "zypp/Source.h"
-#include "zypp/SourceManager.h"
#include "zypp/ExternalProgram.h"
#include "zypp/target/store/xml/XMLPatchImpl.h"
@@ -49,8 +47,6 @@
#include
#include
-#include "zypp/parser/xmlstore/XMLSourceCacheParser.h"
-
#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
#include "boost/filesystem/fstream.hpp" // ditto
@@ -812,7 +808,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -902,7 +898,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -937,7 +933,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -989,7 +985,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -1044,7 +1040,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -1186,7 +1182,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -1228,7 +1224,7 @@
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
@@ -1343,93 +1339,6 @@
return str;
}
-/////////////////////////////////////////////////////////
-// SOURCES API
-////////////////////////////////////////////////////////
-
-source::SourceInfoList
-XMLFilesBackend::storedSources() const
-{
- path source_p = path(d->root.asString()) / path(ZYPP_DB_DIR) / path ("sources");
- source::SourceInfoList sources;
- DBG << "Reading source cache in " << source_p.string() << std::endl;
- directory_iterator end_iter;
- // return empty list if the dir does not exist
- if ( !exists( source_p ) )
- {
- ERR << "path " << source_p.string() << " does not exists. Required to read source cache " << std::endl;
- return source::SourceInfoList();
- }
-
- for ( directory_iterator dir_itr( source_p ); dir_itr != end_iter; ++dir_itr )
- {
- DBG << "[source-list] - " << dir_itr->leaf() << std::endl;
- //sources.insert( sourceDataFromCacheFile( source_p + "/" + dir_itr->leaf() ) );
- std::string full_path = (source_p / dir_itr->leaf()).string();
- std::ifstream anIstream(full_path.c_str());
- zypp::parser::xmlstore::XMLSourceCacheParser iter(anIstream, "");
- for (; ! iter.atEnd(); ++iter) {
- source::SourceInfo data = **iter;
- sources.push_back(data);
- }
- }
- MIL << "done reading source cache" << std::endl;
- return sources;
-
-}
-
-void
-XMLFilesBackend::storeSource(const source::SourceInfo &data)
-{
- // serialize and save a file
- std::string xml = toXML(data);
- path source_p = path(d->root.asString()) / path(ZYPP_DB_DIR) / path ("sources");
-
- // generate a filename
- if (data.alias().size() == 0)
- {
- ZYPP_THROW(Exception("Cant save source with empty alias"));
- }
-
- //DBG << std::endl << xml << std::endl;
- std::ofstream file;
- //DBG << filename << std::endl;
- try
- {
- std::stringstream message_stream(data.alias());
- std::string full_path = (source_p / Digest::digest("MD5", message_stream)).string();
-
- file.open(full_path.c_str());
- file << xml;
- file.close();
- }
- catch ( std::exception &e )
- {
- ERR << "Error saving source " << data.alias() << " in the cache" << std::endl;
- ZYPP_THROW(Exception(e.what()));
- }
- updateTimestamp();
-}
-
-void
-XMLFilesBackend::deleteSource(const std::string &alias)
-{
- // just delete the files
- path source_p = path(d->root.asString()) / path(ZYPP_DB_DIR) / path ("sources");
- try
- {
- std::stringstream message_stream(alias);
- std::string full_path = (source_p / Digest::digest("MD5", message_stream)).string();
- remove(full_path);
- }
- catch ( std::exception &e )
- {
- ERR << "Error deleting source " << alias << " in the cache" << std::endl;
- ZYPP_THROW(Exception(e.what()));
- }
- updateTimestamp();
-}
-
/////////////////////////////////////////////////////////////////
} // namespace storage
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/target/store/XMLFilesBackend.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/store/XMLFilesBackend.h?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/store/XMLFilesBackend.h (original)
+++ trunk/libzypp/zypp/target/store/XMLFilesBackend.h Mon Jul 16 12:40:42 2007
@@ -116,23 +116,6 @@
std::setstd::string flagsFromFile( const std::string &filename ) const;
void updateTimestamp() const;
- /////////////////////////////////////////////////////////
- // SOURCES API
- ////////////////////////////////////////////////////////
- public:
- /**
- * Query for installed Sources
- */
- virtual source::SourceInfoList storedSources() const;
- /**
- * Query for installed Sources
- */
- virtual void storeSource(const source::SourceInfo &data);
- /**
- * Query for installed Sources
- */
- virtual void deleteSource(const std::string &alias);
-
protected:
Modified: trunk/libzypp/zypp/target/store/serialize.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/store/serialize.cc?rev=6017&r1=6016&r2=6017&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/store/serialize.cc (original)
+++ trunk/libzypp/zypp/target/store/serialize.cc Mon Jul 16 12:40:42 2007
@@ -17,7 +17,6 @@
#include "zypp/base/Logger.h"
#include "zypp/CapFactory.h"
-#include "zypp/Source.h"
#include "zypp/Url.h"
#include "zypp/ResObject.h"
@@ -187,7 +186,7 @@
out << translatedTextToXML(pipp->licenseToConfirm(), "license-to-confirm");
out << " <vendor>" << xml_escape(obj->vendor()) << "</vendor>" << endl;
out << " <size>" << static_castByteCount::SizeType(obj->size()) << "</size>" << endl;
- out << " <archive-size>" << static_castByteCount::SizeType(obj->archivesize()) << "</archive-size>" << endl;
+ out << " <archive-size>" << static_castByteCount::SizeType(obj->downloadSize()) << "</archive-size>" << endl;
out << " <install-only>" << ( obj->installOnly() ? "true" : "false" ) << "</install-only>" << endl;
out << " <build-time>" << obj->buildtime().asSeconds() << "</build-time>" << endl;
// we assume we serialize on storeObject, set install time to NOW
@@ -350,7 +349,7 @@
out << " <distribution-name>" << xml_escape(obj->distributionName()) << "</distribution-name>" << endl;
out << " <distribution-edition>" << xml_escape(obj->distributionEdition().asString()) << "</distribution-edition>" << endl;
- out << " <source>" << xml_escape(obj->source().alias()) << "</source>" << endl;
+ out << " <source>" << xml_escape(obj->repository().info().alias()) << "</source>" << endl;
out << " <release-notes-url>" << xml_escape(obj->releaseNotesUrl().asString()) << "</release-notes-url>" << endl;
out << " <update-urls>" << endl;
@@ -459,23 +458,6 @@
return out.str();
}
-template<>
-string toXML( const source::SourceInfo &obj )
-{
- stringstream out;
- out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
- out << "