From 2d5d75e12f79461bb3f1ee5454aeed32b0eacb8d Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Mon, 16 Jul 2007 10:40:42 +0000 Subject: [PATCH] merge REFACTORING-10_3 back to trunk --- VERSION.cmake | 6 +- cmake/modules/FindSqlite.cmake | 2 +- devel/devel.dmacvicar/CMakeLists.txt | 16 +- devel/devel.dmacvicar/CachedSource_tp.cc | 1 - devel/devel.dmacvicar/RepositoryManager_tp.cc | 22 +- devel/devel.dmacvicar/testbed.cc | 1 - devel/devel.ma/CMakeLists.txt | 2 +- devel/devel.ma/Parse.cc | 301 ++-- devel/devel.ma/Test.cc | 785 ++--------- devel/devel.ma/Tools.h | 16 +- doc/autodoc/Doxyfile.cmake | 6 +- libzypp.spec.cmake | 2 +- package/libzypp.changes | 101 +- tests/cache/CMakeLists.txt | 2 +- tests/cache/CacheInitializer_test.cc | 32 +- tests/cache/CacheStore_test.cc | 340 ++++- tests/repo/CMakeLists.txt | 3 +- tests/repo/susetags/CMakeLists.txt | 4 + tests/repo/susetags/Downloader_test.cc | 100 ++ tests/repo/susetags/data/stable-x86-subset/content | 36 + .../susetags/data/stable-x86-subset/content.asc | 27 + .../susetags/data/stable-x86-subset/content.key | 24 + .../gpg-pubkey-0dfb3188-41ed929b.asc | 17 + .../gpg-pubkey-307e3d54-44201d5d.asc | 13 + .../gpg-pubkey-3d25d3d9-36e12d04.asc | 30 + .../gpg-pubkey-7e2e3b05-44748aba.asc | 20 + .../gpg-pubkey-9c800aca-40d8063e.asc | 37 + .../gpg-pubkey-a1912208-446a0899.asc | 31 + .../data/stable-x86-subset/media.1/directory.yast | 6 + .../data/stable-x86-subset/media.1/info.txt | 38 + .../data/stable-x86-subset/media.1/license.zip | Bin 0 -> 5503 bytes .../susetags/data/stable-x86-subset/media.1/media | 3 + .../data/stable-x86-subset/media.1/products | 1 + .../data/stable-x86-subset/media.1/products.asc | 7 + .../data/stable-x86-subset/media.1/products.key | 37 + .../suse/setup/descr/kde-10.3-71.i586.pat | 178 +++ .../stable-x86-subset/suse/setup/descr/packages | 512 +++++++ .../stable-x86-subset/suse/setup/descr/packages.DU | 498 +++++++ .../stable-x86-subset/suse/setup/descr/packages.en | 47 + .../stable-x86-subset/suse/setup/descr/packages.es | 47 + .../stable-x86-subset/suse/setup/descr/patterns | 2 + tests/zypp/CMakeLists.txt | 6 +- tests/zypp/MediaSetAccessTest.cc | 99 +- tests/zypp/ProgressData_test.cc | 71 + tests/zypp/RepoManager_test.cc | 1 + tests/zypp/TranslatedText.cc | 53 +- tests/zypp/data/mediasetaccess/src1/cd1/dir/file1 | 1 + tests/zypp/data/mediasetaccess/src1/cd1/dir/file2 | 1 + .../data/mediasetaccess/src1/cd1/dir/subdir/file | 1 + tools/CMakeLists.txt | 2 +- tools/registration/zypp-query-pool.cc | 4 +- zypp/CMakeLists.txt | 201 +-- zypp/CapFilters.h | 1 + zypp/Fetcher.cc | 122 +- zypp/FileChecker.h | 2 +- zypp/KeyRing.cc | 2 +- zypp/{parser/yum/YUMParser.h => MediaProducts.cc} | 39 +- zypp/MediaProducts.h | 125 ++ zypp/MediaSetAccess.cc | 168 ++- zypp/MediaSetAccess.h | 38 +- zypp/OnMediaLocation.cc | 2 +- zypp/OnMediaLocation.h | 25 +- zypp/Package.cc | 8 +- zypp/Package.h | 22 +- zypp/Pathname.cc | 13 + zypp/Pathname.h | 6 + zypp/ProgressData.cc | 43 +- zypp/ProgressData.h | 103 +- zypp/RepoInfo.cc | 87 +- zypp/RepoInfo.h | 134 +- zypp/RepoManager.cc | 444 ++++-- zypp/RepoManager.h | 40 + zypp/Repository.cc | 27 +- zypp/Repository.h | 32 +- zypp/RepositoryFactory.cc | 23 - zypp/RepositoryFactory.h | 30 - zypp/ResFilters.h | 17 +- zypp/ResObject.cc | 20 +- zypp/ResObject.h | 31 +- zypp/ResPool.cc | 15 +- zypp/ResPool.h | 36 +- zypp/ResPoolProxy.cc | 18 + zypp/ResPoolProxy.h | 13 + zypp/ResStore.h | 12 +- zypp/Resolvable.cc | 1 - zypp/Source.cc | 209 --- zypp/Source.h | 323 ----- zypp/SourceCache.cc | 145 -- zypp/SourceCache.h | 72 - zypp/SourceFactory.cc | 382 ----- zypp/SourceFactory.h | 116 -- zypp/SourceFeed.cc | 139 -- zypp/SourceFeed.h | 123 -- zypp/SourceManager.cc | 638 --------- zypp/SourceManager.h | 276 ---- zypp/SrcPackage.cc | 7 +- zypp/SrcPackage.h | 9 +- zypp/Target.cc | 6 - zypp/Target.h | 9 - zypp/TranslatedText.cc | 99 +- zypp/VendorAttr.cc | 1 + zypp/ZYpp.cc | 3 - zypp/ZYpp.h | 4 - zypp/ZYppCallbacks.h | 79 +- zypp/ZYppCommitPolicy.h | 8 +- zypp/{source/Builtin.h => base/Easy.h} | 32 +- zypp/cache/Attribute.h | 15 +- zypp/cache/CacheAttributes.h | 118 +- zypp/cache/CacheInitializer.cc | 69 +- zypp/cache/CacheInitializer.h | 14 + zypp/cache/CacheStore.cc | 227 +-- zypp/cache/CacheStore.h | 94 +- zypp/cache/ResolvableQuery.cc | 150 +- zypp/cache/ResolvableQuery.h | 63 +- zypp/cache/schema/schema.sql | 9 +- zypp/cache/sqlite3x/sqlite3x.hpp | 10 +- zypp/cache/sqlite3x/sqlite3x_connection.cpp | 21 +- zypp/cache/sqlite3x/sqlite3x_exception.cpp | 2 + zypp/capability/CapabilityImpl.h | 2 + zypp/data/ResolvableData.cc | 66 - zypp/data/ResolvableData.h | 47 +- zypp/data/ResolvableDataConsumer.h | 2 + zypp/detail/PackageImplIf.cc | 12 +- zypp/detail/PackageImplIf.h | 9 +- zypp/detail/ResObjectImplIf.cc | 27 +- zypp/detail/ResObjectImplIf.h | 18 +- zypp/detail/SrcPackageImplIf.cc | 10 +- zypp/detail/SrcPackageImplIf.h | 6 +- zypp/parser/IniParser.cc | 2 +- zypp/parser/RepoFileReader.cc | 12 + zypp/parser/SAXParser.cc | 200 --- zypp/parser/SAXParser.h | 53 - zypp/parser/TagParser.cc | 6 + zypp/parser/plaindir/RepoParser.cc | 328 +++++ .../plaindir/RepoParser.h} | 86 +- zypp/parser/susetags/ContentFileReader.cc | 8 + zypp/parser/susetags/FileReaderBaseImpl.h | 21 +- zypp/parser/susetags/PackagesFileReader.cc | 44 +- zypp/parser/susetags/PackagesLangFileReader.cc | 5 +- zypp/parser/susetags/PatternFileReader.cc | 2 + zypp/parser/susetags/RepoIndex.cc | 2 + zypp/parser/susetags/RepoParser.cc | 261 +++- zypp/parser/tagfile/.cvsignore | 8 - zypp/parser/tagfile/TagFileParser.cc | 228 --- zypp/parser/tagfile/TagFileParser.h | 101 -- zypp/parser/xmlstore/XMLParserData.h | 2 +- zypp/parser/xmlstore/XMLResObjectParser.cc | 2 +- zypp/parser/xmlstore/XMLSourceCacheParser.cc | 24 +- zypp/parser/xmlstore/XMLSourceCacheParser.h | 12 +- zypp/parser/yum/FileReaderBaseImpl.cc | 8 +- zypp/parser/yum/FileReaderBaseImpl.h | 2 + zypp/parser/yum/PatchFileReader.cc | 32 +- zypp/parser/yum/PatchesFileReader.cc | 4 +- zypp/parser/yum/PrimaryFileReader.cc | 6 + zypp/parser/yum/PrimaryFileReader.h | 2 + zypp/parser/yum/RepoParser.cc | 72 +- zypp/parser/yum/RepomdFileReader.cc | 4 +- zypp/parser/yum/YUMFileListParser.cc | 149 -- zypp/parser/yum/YUMFileListParser.h | 94 -- zypp/parser/yum/YUMGroupParser.cc | 175 --- zypp/parser/yum/YUMGroupParser.h | 74 - zypp/parser/yum/YUMOtherParser.cc | 131 -- zypp/parser/yum/YUMOtherParser.h | 94 -- zypp/parser/yum/YUMParserData.cc | 660 --------- zypp/parser/yum/YUMParserData.h | 555 -------- zypp/parser/yum/YUMPatchParser.cc | 844 ----------- zypp/parser/yum/YUMPatchParser.h | 80 -- zypp/parser/yum/YUMPatchesParser.cc | 96 -- zypp/parser/yum/YUMPatchesParser.h | 67 - zypp/parser/yum/YUMPatternParser.cc | 162 --- zypp/parser/yum/YUMPatternParser.h | 70 - zypp/parser/yum/YUMPrimaryParser.cc | 442 ------ zypp/parser/yum/YUMPrimaryParser.h | 85 -- zypp/parser/yum/YUMProductParser.cc | 192 --- zypp/parser/yum/YUMProductParser.h | 68 - zypp/parser/yum/YUMRepomdParser.cc | 103 -- zypp/parser/yum/YUMRepomdParser.h | 67 - zypp/pool/GetResolvablesToInsDel.cc | 33 +- zypp/pool/PoolImpl.h | 60 +- zypp/pool/PoolTraits.h | 13 +- zypp/{source => repo}/Applydeltarpm.cc | 2 +- zypp/{source => repo}/Applydeltarpm.h | 0 zypp/repo/DeltaCandidates.cc | 10 +- zypp/repo/DeltaCandidates.h | 8 +- zypp/{source => repo}/PackageDelta.cc | 2 +- zypp/{source => repo}/PackageDelta.h | 22 +- zypp/repo/PackageProvider.cc | 31 +- zypp/repo/PackageProvider.h | 2 +- zypp/repo/RepoProvideFile.cc | 4 +- zypp/repo/RepoType.cc | 5 +- zypp/repo/RepoType.h | 14 +- zypp/repo/RepositoryImpl.cc | 26 +- zypp/repo/RepositoryImpl.h | 31 +- zypp/{source => repo}/SUSEMediaVerifier.cc | 4 +- zypp/{source => repo}/SUSEMediaVerifier.h | 2 +- zypp/repo/cached/AtomImpl.cc | 37 +- zypp/repo/cached/AtomImpl.h | 4 +- zypp/repo/cached/MessageImpl.cc | 37 +- zypp/repo/cached/MessageImpl.h | 4 +- zypp/repo/cached/PackageImpl.cc | 98 +- zypp/repo/cached/PackageImpl.h | 14 +- zypp/repo/cached/PatchImpl.cc | 50 +- zypp/repo/cached/PatchImpl.h | 4 +- zypp/repo/cached/PatternImpl.cc | 58 +- zypp/repo/cached/PatternImpl.h | 16 +- zypp/repo/cached/ProductImpl.cc | 60 +- zypp/repo/cached/ProductImpl.h | 8 +- zypp/repo/cached/RepoImpl.cc | 281 +++- zypp/repo/cached/RepoImpl.h | 52 +- zypp/repo/cached/ScriptImpl.cc | 43 +- zypp/repo/cached/ScriptImpl.h | 4 +- zypp/repo/cached/SrcPackageImpl.cc | 77 +- zypp/repo/cached/SrcPackageImpl.h | 44 +- zypp/repo/memory/AtomImpl.cc | 10 - zypp/repo/memory/AtomImpl.h | 4 - zypp/repo/memory/MessageImpl.cc | 44 +- zypp/repo/memory/MessageImpl.h | 20 +- zypp/repo/memory/PackageImpl.cc | 26 +- zypp/repo/memory/PackageImpl.h | 14 +- zypp/repo/memory/PatchImpl.cc | 12 - zypp/repo/memory/PatchImpl.h | 4 - zypp/repo/memory/PatternImpl.cc | 13 - zypp/repo/memory/PatternImpl.h | 4 - zypp/repo/memory/ProductImpl.cc | 12 - zypp/repo/memory/ProductImpl.h | 5 - zypp/repo/memory/ScriptImpl.cc | 19 +- zypp/repo/memory/ScriptImpl.h | 10 +- zypp/repo/memory/SrcPackageImpl.cc | 72 +- zypp/repo/memory/SrcPackageImpl.h | 41 +- zypp/repo/susetags/Downloader.cc | 56 +- zypp/repo/yum/Downloader.cc | 6 +- zypp/solver/detail/InstallOrder.cc | 9 +- zypp/solver/detail/InstallOrder.h | 4 + zypp/solver/detail/Resolver.cc | 4 +- zypp/solver/detail/Resolver.h | 4 +- zypp/solver/detail/ResolverContext.cc | 158 +-- zypp/solver/detail/ResolverContext.h | 6 +- zypp/solver/detail/ResolverInfo.cc | 8 +- zypp/solver/detail/ResolverQueue.cc | 16 +- zypp/solver/detail/Testcase.cc | 36 +- zypp/solver/detail/Testcase.h | 4 +- zypp/source/MediaSet.cc | 217 --- zypp/source/MediaSet.h | 99 -- zypp/source/PackageProvider.cc | 304 ---- zypp/source/PackageProvider.h | 116 -- zypp/source/SourceImpl.cc | 944 ------------- zypp/source/SourceImpl.h | 448 ------ zypp/source/SourceInfo.cc | 161 --- zypp/source/SourceInfo.h | 88 -- zypp/source/SourceProvideFile.cc | 133 -- zypp/source/SourceProvideFile.h | 55 - zypp/source/plaindir/.cvsignore | 8 - zypp/source/plaindir/PlaindirImpl.cc | 131 -- zypp/source/susetags/MediaMetadataParser.cc | 154 -- zypp/source/susetags/MediaMetadataParser.h | 75 - zypp/source/susetags/MediaPatchesMetadataParser.cc | 117 -- zypp/source/susetags/MediaPatchesMetadataParser.h | 75 - zypp/source/susetags/PackagesLangParser.cc | 148 -- zypp/source/susetags/PackagesLangParser.h | 47 - zypp/source/susetags/PackagesParser.cc | 420 ------ zypp/source/susetags/PackagesParser.h | 58 - zypp/source/susetags/PatternTagFileParser.cc | 260 ---- zypp/source/susetags/PatternTagFileParser.h | 74 - zypp/source/susetags/ProductMetadataParser.cc | 436 ------ zypp/source/susetags/ProductMetadataParser.h | 91 -- zypp/source/susetags/SelectionTagFileParser.cc | 275 ---- zypp/source/susetags/SelectionTagFileParser.h | 71 - zypp/source/susetags/SuseTagsImpl.cc | 987 ------------- zypp/source/susetags/SuseTagsImpl.h | 224 --- zypp/source/susetags/SuseTagsPackageImpl.cc | 227 --- zypp/source/susetags/SuseTagsPackageImpl.h | 140 -- zypp/source/susetags/SuseTagsPatternImpl.cc | 92 -- zypp/source/susetags/SuseTagsPatternImpl.h | 70 - zypp/source/susetags/SuseTagsProductImpl.cc | 111 -- zypp/source/susetags/SuseTagsProductImpl.h | 104 -- zypp/source/susetags/SuseTagsSelectionImpl.cc | 95 -- zypp/source/susetags/SuseTagsSelectionImpl.h | 81 -- zypp/source/susetags/SuseTagsSrcPackageImpl.cc | 78 -- zypp/source/susetags/SuseTagsSrcPackageImpl.h | 66 - zypp/source/yum/YUMAtomImpl.cc | 52 - zypp/source/yum/YUMAtomImpl.h | 54 - zypp/source/yum/YUMGroupImpl.cc | 93 -- zypp/source/yum/YUMGroupImpl.h | 74 - zypp/source/yum/YUMMessageImpl.cc | 67 - zypp/source/yum/YUMMessageImpl.h | 67 - zypp/source/yum/YUMPackageImpl.cc | 286 ---- zypp/source/yum/YUMPackageImpl.h | 163 --- zypp/source/yum/YUMPatchImpl.cc | 170 --- zypp/source/yum/YUMPatchImpl.h | 88 -- zypp/source/yum/YUMPatternImpl.cc | 99 -- zypp/source/yum/YUMPatternImpl.h | 80 -- zypp/source/yum/YUMProductImpl.cc | 113 -- zypp/source/yum/YUMProductImpl.h | 73 - zypp/source/yum/YUMScriptImpl.cc | 149 -- zypp/source/yum/YUMScriptImpl.h | 82 -- zypp/source/yum/YUMSourceImpl.cc | 1479 -------------------- zypp/source/yum/YUMSourceImpl.h | 216 --- zypp/target/CommitPackageCacheReadAhead.cc | 20 +- zypp/target/CommitPackageCacheReadAhead.h | 18 +- zypp/target/TargetImpl.cc | 99 +- zypp/target/TargetImpl.h | 9 - zypp/target/rpm/RpmDb.cc | 38 +- zypp/target/rpm/RpmDb.h | 5 +- zypp/target/rpm/RpmHeader.cc | 40 +- zypp/target/rpm/RpmHeader.h | 18 +- zypp/target/rpm/RpmPackageImpl.cc | 16 +- zypp/target/rpm/RpmPackageImpl.h | 24 +- zypp/target/store/Backend.h | 16 - zypp/target/store/PersistentStorage.cc | 22 - zypp/target/store/PersistentStorage.h | 19 - zypp/target/store/XMLFilesBackend.cc | 107 +- zypp/target/store/XMLFilesBackend.h | 17 - zypp/target/store/serialize.cc | 22 +- zypp/target/store/serialize.h | 3 - zypp/target/store/xml/XMLAtomImpl.h | 7 +- zypp/target/store/xml/XMLMessageImpl.h | 6 +- zypp/target/store/xml/XMLPatchImpl.h | 6 +- zypp/target/store/xml/XMLPatternImpl.h | 6 +- zypp/target/store/xml/XMLProductImpl.h | 9 +- zypp/target/store/xml/XMLScriptImpl.h | 6 +- zypp/target/store/xml/XMLSelectionImpl.h | 6 +- zypp/zypp_detail/ZYppImpl.cc | 1 - zypp/zypp_detail/ZYppImpl.h | 7 - 323 files changed, 6536 insertions(+), 21385 deletions(-) create mode 100644 tests/repo/susetags/CMakeLists.txt create mode 100644 tests/repo/susetags/Downloader_test.cc create mode 100644 tests/repo/susetags/data/stable-x86-subset/content create mode 100644 tests/repo/susetags/data/stable-x86-subset/content.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/content.key create mode 100644 tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-0dfb3188-41ed929b.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-307e3d54-44201d5d.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-3d25d3d9-36e12d04.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-7e2e3b05-44748aba.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-9c800aca-40d8063e.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-a1912208-446a0899.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/directory.yast create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/info.txt create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/license.zip create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/media create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/products create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/products.asc create mode 100644 tests/repo/susetags/data/stable-x86-subset/media.1/products.key create mode 100644 tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/kde-10.3-71.i586.pat create mode 100644 tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages create mode 100644 tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.DU create mode 100644 tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.en create mode 100644 tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.es create mode 100644 tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/patterns create mode 100644 tests/zypp/ProgressData_test.cc create mode 100644 tests/zypp/data/mediasetaccess/src1/cd1/dir/file1 create mode 100644 tests/zypp/data/mediasetaccess/src1/cd1/dir/file2 create mode 100644 tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/file rename zypp/{parser/yum/YUMParser.h => MediaProducts.cc} (52%) create mode 100644 zypp/MediaProducts.h delete mode 100644 zypp/RepositoryFactory.cc delete mode 100644 zypp/RepositoryFactory.h delete mode 100644 zypp/Source.cc delete mode 100644 zypp/Source.h delete mode 100644 zypp/SourceCache.cc delete mode 100644 zypp/SourceCache.h delete mode 100644 zypp/SourceFactory.cc delete mode 100644 zypp/SourceFactory.h delete mode 100644 zypp/SourceFeed.cc delete mode 100644 zypp/SourceFeed.h delete mode 100644 zypp/SourceManager.cc delete mode 100644 zypp/SourceManager.h rename zypp/{source/Builtin.h => base/Easy.h} (56%) delete mode 100644 zypp/parser/SAXParser.cc delete mode 100644 zypp/parser/SAXParser.h create mode 100644 zypp/parser/plaindir/RepoParser.cc rename zypp/{source/plaindir/PlaindirImpl.h => parser/plaindir/RepoParser.h} (54%) delete mode 100644 zypp/parser/tagfile/.cvsignore delete mode 100644 zypp/parser/tagfile/TagFileParser.cc delete mode 100644 zypp/parser/tagfile/TagFileParser.h delete mode 100644 zypp/parser/yum/YUMFileListParser.cc delete mode 100644 zypp/parser/yum/YUMFileListParser.h delete mode 100644 zypp/parser/yum/YUMGroupParser.cc delete mode 100644 zypp/parser/yum/YUMGroupParser.h delete mode 100644 zypp/parser/yum/YUMOtherParser.cc delete mode 100644 zypp/parser/yum/YUMOtherParser.h delete mode 100644 zypp/parser/yum/YUMParserData.cc delete mode 100644 zypp/parser/yum/YUMParserData.h delete mode 100644 zypp/parser/yum/YUMPatchParser.cc delete mode 100644 zypp/parser/yum/YUMPatchParser.h delete mode 100644 zypp/parser/yum/YUMPatchesParser.cc delete mode 100644 zypp/parser/yum/YUMPatchesParser.h delete mode 100644 zypp/parser/yum/YUMPatternParser.cc delete mode 100644 zypp/parser/yum/YUMPatternParser.h delete mode 100644 zypp/parser/yum/YUMPrimaryParser.cc delete mode 100644 zypp/parser/yum/YUMPrimaryParser.h delete mode 100644 zypp/parser/yum/YUMProductParser.cc delete mode 100644 zypp/parser/yum/YUMProductParser.h delete mode 100644 zypp/parser/yum/YUMRepomdParser.cc delete mode 100644 zypp/parser/yum/YUMRepomdParser.h rename zypp/{source => repo}/Applydeltarpm.cc (99%) rename zypp/{source => repo}/Applydeltarpm.h (100%) rename zypp/{source => repo}/PackageDelta.cc (98%) rename zypp/{source => repo}/PackageDelta.h (76%) rename zypp/{source => repo}/SUSEMediaVerifier.cc (93%) rename zypp/{source => repo}/SUSEMediaVerifier.h (97%) delete mode 100644 zypp/source/MediaSet.cc delete mode 100644 zypp/source/MediaSet.h delete mode 100644 zypp/source/PackageProvider.cc delete mode 100644 zypp/source/PackageProvider.h delete mode 100644 zypp/source/SourceImpl.cc delete mode 100644 zypp/source/SourceImpl.h delete mode 100644 zypp/source/SourceInfo.cc delete mode 100644 zypp/source/SourceInfo.h delete mode 100644 zypp/source/SourceProvideFile.cc delete mode 100644 zypp/source/SourceProvideFile.h delete mode 100644 zypp/source/plaindir/.cvsignore delete mode 100644 zypp/source/plaindir/PlaindirImpl.cc delete mode 100644 zypp/source/susetags/MediaMetadataParser.cc delete mode 100644 zypp/source/susetags/MediaMetadataParser.h delete mode 100644 zypp/source/susetags/MediaPatchesMetadataParser.cc delete mode 100644 zypp/source/susetags/MediaPatchesMetadataParser.h delete mode 100644 zypp/source/susetags/PackagesLangParser.cc delete mode 100644 zypp/source/susetags/PackagesLangParser.h delete mode 100644 zypp/source/susetags/PackagesParser.cc delete mode 100644 zypp/source/susetags/PackagesParser.h delete mode 100644 zypp/source/susetags/PatternTagFileParser.cc delete mode 100644 zypp/source/susetags/PatternTagFileParser.h delete mode 100644 zypp/source/susetags/ProductMetadataParser.cc delete mode 100644 zypp/source/susetags/ProductMetadataParser.h delete mode 100644 zypp/source/susetags/SelectionTagFileParser.cc delete mode 100644 zypp/source/susetags/SelectionTagFileParser.h delete mode 100644 zypp/source/susetags/SuseTagsImpl.cc delete mode 100644 zypp/source/susetags/SuseTagsImpl.h delete mode 100644 zypp/source/susetags/SuseTagsPackageImpl.cc delete mode 100644 zypp/source/susetags/SuseTagsPackageImpl.h delete mode 100644 zypp/source/susetags/SuseTagsPatternImpl.cc delete mode 100644 zypp/source/susetags/SuseTagsPatternImpl.h delete mode 100644 zypp/source/susetags/SuseTagsProductImpl.cc delete mode 100644 zypp/source/susetags/SuseTagsProductImpl.h delete mode 100644 zypp/source/susetags/SuseTagsSelectionImpl.cc delete mode 100644 zypp/source/susetags/SuseTagsSelectionImpl.h delete mode 100644 zypp/source/susetags/SuseTagsSrcPackageImpl.cc delete mode 100644 zypp/source/susetags/SuseTagsSrcPackageImpl.h delete mode 100644 zypp/source/yum/YUMAtomImpl.cc delete mode 100644 zypp/source/yum/YUMAtomImpl.h delete mode 100644 zypp/source/yum/YUMGroupImpl.cc delete mode 100644 zypp/source/yum/YUMGroupImpl.h delete mode 100644 zypp/source/yum/YUMMessageImpl.cc delete mode 100644 zypp/source/yum/YUMMessageImpl.h delete mode 100644 zypp/source/yum/YUMPackageImpl.cc delete mode 100644 zypp/source/yum/YUMPackageImpl.h delete mode 100644 zypp/source/yum/YUMPatchImpl.cc delete mode 100644 zypp/source/yum/YUMPatchImpl.h delete mode 100644 zypp/source/yum/YUMPatternImpl.cc delete mode 100644 zypp/source/yum/YUMPatternImpl.h delete mode 100644 zypp/source/yum/YUMProductImpl.cc delete mode 100644 zypp/source/yum/YUMProductImpl.h delete mode 100644 zypp/source/yum/YUMScriptImpl.cc delete mode 100644 zypp/source/yum/YUMScriptImpl.h delete mode 100644 zypp/source/yum/YUMSourceImpl.cc delete mode 100644 zypp/source/yum/YUMSourceImpl.h diff --git a/VERSION.cmake b/VERSION.cmake index 18edb68..a8755b9 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -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") diff --git a/cmake/modules/FindSqlite.cmake b/cmake/modules/FindSqlite.cmake index af28dd5..a4248f2 100644 --- a/cmake/modules/FindSqlite.cmake +++ b/cmake/modules/FindSqlite.cmake @@ -12,7 +12,7 @@ FIND_PATH(SQLITE_INCLUDE_DIR sqlite3.h /usr/local/include ) -FIND_LIBRARY(SQLITE_LIBRARY NAMES sqlitezmd3 sqlite3 +FIND_LIBRARY(SQLITE_LIBRARY NAMES sqlite3 PATHS /usr/lib /usr/local/lib diff --git a/devel/devel.dmacvicar/CMakeLists.txt b/devel/devel.dmacvicar/CMakeLists.txt index 8562348..c1d52fc 100644 --- a/devel/devel.dmacvicar/CMakeLists.txt +++ b/devel/devel.dmacvicar/CMakeLists.txt @@ -3,20 +3,20 @@ ADD_DEFINITIONS(-DSRC_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\") 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 ) diff --git a/devel/devel.dmacvicar/CachedSource_tp.cc b/devel/devel.dmacvicar/CachedSource_tp.cc index 3343c76..29e94c5 100644 --- a/devel/devel.dmacvicar/CachedSource_tp.cc +++ b/devel/devel.dmacvicar/CachedSource_tp.cc @@ -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" diff --git a/devel/devel.dmacvicar/RepositoryManager_tp.cc b/devel/devel.dmacvicar/RepositoryManager_tp.cc index 0b203f3..cc5cecb 100644 --- a/devel/devel.dmacvicar/RepositoryManager_tp.cc +++ b/devel/devel.dmacvicar/RepositoryManager_tp.cc @@ -5,13 +5,13 @@ #include #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 @@ int main(int argc, char **argv) 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(res) ) + { + Package::constPtr p = asKind(res); + //cout << p->group() << std::endl; + } + } + m.elapsed(); } catch ( const Exception &e ) { diff --git a/devel/devel.dmacvicar/testbed.cc b/devel/devel.dmacvicar/testbed.cc index 87ee5ed..d9036ba 100644 --- a/devel/devel.dmacvicar/testbed.cc +++ b/devel/devel.dmacvicar/testbed.cc @@ -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" diff --git a/devel/devel.ma/CMakeLists.txt b/devel/devel.ma/CMakeLists.txt index 71dddab..bf16726 100644 --- a/devel/devel.ma/CMakeLists.txt +++ b/devel/devel.ma/CMakeLists.txt @@ -39,7 +39,7 @@ FOREACH( loop_var ScanSource Iorder Xml Main) ENDFOREACH( loop_var ) -FOREACH( loop_var AOUT Parse) +FOREACH( loop_var AOUT Parse Test) ADD_EXECUTABLE( ${loop_var} ${loop_var}.cc ) diff --git a/devel/devel.ma/Parse.cc b/devel/devel.ma/Parse.cc index 220bb39..4ee2d34 100644 --- a/devel/devel.ma/Parse.cc +++ b/devel/devel.ma/Parse.cc @@ -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 @@ static const Pathname sysRoot( "/Local/ROOT" ); /////////////////////////////////////////////////////////////////// +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 + 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::ReceiveReport { virtual void start( const Resolvable::constPtr & script_r, @@ -82,7 +189,7 @@ struct ConvertDbReceive : public callback::ReceiveReport { - virtual Action requestMedia( Source_Ref source + virtual Action requestMedia( Repository source , unsigned mediumNr , Error error , const std::string & description ) @@ -109,7 +216,7 @@ namespace container 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 @@ std::ostream & operator<<( std::ostream & str, const iostr::EachLine & obj ) } /////////////////////////////////////////////////////////////////// -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 @@ int main( int argc, char * argv[] ) //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 ) + if ( 0 ) { - cout << "ups! " << e.msg() << std::endl; + if ( repoManager.isCached( nrepo ) ) + { + SEC << "cleanCache" << endl; + repoManager.cleanCache( nrepo ); + } + SEC << "buildCache" << endl; + repoManager.buildCache( nrepo ); } -#endif + 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 ); + } - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; + USR << "pool: " << pool << endl; - Pathname proot( "lmd/suse/setup/descr" ); + SEC << pool.knownRepositoriesSize() << endl; + std::for_each( pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd(), Print() ); - 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" ); + std::for_each( pool.byNameBegin("glibc"), pool.byNameEnd("glibc"), Xprint() ); - if ( 0 ) - { - Measure x( "lmd.idx" ); - std::ifstream fIndex( "lmd.idx" ); - for( iostr::EachLine in( fIndex ); in; in.next() ) - { - Measure x( *in ); - std::ifstream fIn( (*in).c_str() ); - for( iostr::EachLine l( fIn ); l; l.next() ) - { - ; - } - } - } + /////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; zypp::base::LogControl::instance().logNothing(); return 0; diff --git a/devel/devel.ma/Test.cc b/devel/devel.ma/Test.cc index 815de0d..4368eb7 100644 --- a/devel/devel.ma/Test.cc +++ b/devel/devel.ma/Test.cc @@ -1,6 +1,5 @@ #include "Tools.h" -#include -#include +#include "ExplicitMap.h" #include #include @@ -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 - 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 - { - Depository _type; - Depository _checksum; - Depository _timestamp; - Depository _openChecksum; - }; - - Depository _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::map _idMap; + std::map _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() ) - { - MIL << *this << endl; - //return; - while( nextElement() ) - { - Element el( _reader ); - } - } - - ~Element() + bool hasEntry( const std::string & id_r ) { - while( nextElement() ) - { ; } - DBG << *this << endl; + return _idMap.find( id_r ) != _idMap.end(); } - bool atBegin() const + data::RecordId newId( 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)); + _idMap[id] = ++_lastId; + _reverseMap[_lastId] = id; + MIL << "NEW_ID " << _lastId << " - " << id << endl; + logNew( res_r, kind_r ); + return _lastId; } - bool atEnd() const + data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_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 ); + 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 nextElement() + std::string lookup( data::RecordId id_r ) { - 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 & ) - { - } -} -/////////////////////////////////////////////////////////////////// -class BasicParser -{ - public: - typedef function Consumer; - typedef ExplicitMap 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: - - bool parse( xml::Reader & reader_r ) + if ( _reverseMap.find( id_r ) != _reverseMap.end() ) { - 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; + return _reverseMap[id_r]; } - 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 ) - { - reader().foreachNode( ref(*this) ); - } - - bool operator()( xml::Reader & reader_r ) - { - return parse( reader_r ); - } - - // READER goes here! -}; - -/////////////////////////////////////////////////////////////////// -struct Consume -{ - struct Entry - { - Pathname _location; - CheckSum _checksum; - //unused: Date _timestamp; - //unused: CheckSum _openChecksum; - }; - - typedef void (Consume::*Consumer)( xml::Reader & reader_r ); - - Consume( const InputStream & file_r ) - : _reader( file_r ) - , _consume( &Consume::nop ) - , _centry( NULL ) - { - _consume.set( "data", &Consume::data ); - _reader.foreachNode( ref(*this) ); - } - - bool operator()( xml::Reader & reader_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; + WAR << "Lookup id " << id_r << "failed" << endl; + return std::string(); } - void nop( xml::Reader & reader_r ) - { ; } - - void log( xml::Reader & reader_r ) - { DBG << "NOP " << *_reader << endl; } - - void data( xml::Reader & reader_r ) + void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r ) { - MIL << *_reader << endl; - _result[reader_r->name().asString()] = Entry(); - } - - - - xml::Reader _reader; - ExplicitMap _consume; - std::map _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 + std::string shr( lookup( res_r->shareDataWith ) ); + if ( ! shr.empty() ) { - MIL << file_r << endl; - RepomdParser a( file_r ); - //WAR << a._result << endl; + DBG << " SHR: " << shr << endl; } - catch ( const Exception & ) + //DBG << " SUM: " << res_r->summary << endl; + if ( 0&&kind_r == ResTraits::kind ) { + data::Package_Ptr p = dynamic_pointer_cast(res_r); + DBG << " PKG: " << p << endl; + DBG << " LOC: " << p->repositoryLocation << endl; } -} - -struct Test -{ - struct Mix - { - 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; -}; - -std::ostream & operator<<( std::ostream & str, const Test & obj ) -{ - return str << "Test(" << obj.a << '|' << obj.b - << '|' << obj.c.a << '|' << obj.c.b << ')'; -} - -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; + static unsigned n = 20; + if ( 0&&! --n ) + throw; } - struct File - { - std::string name; - std::string type; - - bool operator<( const File & rhs ) const - { return( name < rhs.name ); } - }; + public: - struct Package - { - std::string pkgid; - std::string name; - std::string epoch; - std::string ver; - std::string rel; - std::string arch; - std::set files; - }; - - shared_ptr pkg; - - void process( xml::Reader & reader_r, bool open_r ) + virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_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 << "" << endl; - outfile << "" << endl; - } - else - { - outfile << "" << endl; - outfile.close(); - } - } - else - { - throw; - } + return newId( res_r, ResTraits::kind ); } - void startPackage( xml::Reader & reader_r ) + virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_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(); + return newId( res_r, ResTraits::kind ); } - void addVersion( xml::Reader & reader_r ) + virtual data::RecordId consumeProduct ( const data::RecordId & repository_id, const data::Product_Ptr & res_r ) { - pkg->epoch = reader_r->getAttribute( "epoch" ).asString(); - pkg->ver = reader_r->getAttribute( "ver" ).asString(); - pkg->rel = reader_r->getAttribute( "rel" ).asString(); + return newId( res_r, ResTraits::kind ); } - void addFile( xml::Reader & reader_r ) + virtual data::RecordId consumePatch ( const data::RecordId & repository_id, const data::Patch_Ptr & res_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 ); + return newId( res_r, ResTraits::kind ); } - void endPackage() + virtual data::RecordId consumePackageAtom ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r ) { - if ( pkg ) - { - writePackage( outfile ); - pkg.reset(); - } + return newId( res_r, ResTraits::kind ); } - static std::ostream & putAttr( std::ostream & stream_r, - const std::string & tag_r, - const std::string & value_r ) + virtual data::RecordId consumeMessage ( const data::RecordId & repository_id, const data::Message_Ptr & res_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() ); + return newId( res_r, ResTraits::kind ); } - void writePackage( std::ostream & stream_r ) + virtual data::RecordId consumeScript ( const data::RecordId & repository_id, const data::Script_Ptr & res_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 << " \n"; + return newId( res_r, ResTraits