[zypp-commit] r6353 - in /trunk/libzypp: ./ devel/devel.ma/ zypp/ zypp/detail/ zypp/repo/cached/ zypp/target/ zypp/zypp_detail/
Author: mlandres Date: Tue Jul 31 21:58:43 2007 New Revision: 6353 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6353&view=rev Log: - Added package attributes Package::sourcePkgName and Package::sourcePkgEdition. Name and edition of the source rpm this package was built from. - Added ZYpp::installSrcPackage to install a single source package. Modified: trunk/libzypp/VERSION.cmake trunk/libzypp/devel/devel.ma/Parse.cc trunk/libzypp/zypp/Package.cc trunk/libzypp/zypp/Package.h trunk/libzypp/zypp/ZYpp.cc trunk/libzypp/zypp/ZYpp.h trunk/libzypp/zypp/detail/PackageImplIf.cc trunk/libzypp/zypp/detail/PackageImplIf.h trunk/libzypp/zypp/detail/SrcPackageImplIf.cc trunk/libzypp/zypp/detail/SrcPackageImplIf.h trunk/libzypp/zypp/repo/cached/PackageImpl.cc trunk/libzypp/zypp/repo/cached/PackageImpl.h trunk/libzypp/zypp/target/TargetImpl.cc trunk/libzypp/zypp/target/TargetImpl.h trunk/libzypp/zypp/zypp_detail/ZYppImpl.cc trunk/libzypp/zypp/zypp_detail/ZYppImpl.h Modified: trunk/libzypp/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/VERSION.cmake (original) +++ trunk/libzypp/VERSION.cmake Tue Jul 31 21:58:43 2007 @@ -47,4 +47,4 @@ SET(LIBZYPP_MAJOR "3") SET(LIBZYPP_MINOR "13") SET(LIBZYPP_COMPATMINOR "13") -SET(LIBZYPP_PATCH "3") +SET(LIBZYPP_PATCH "4") Modified: trunk/libzypp/devel/devel.ma/Parse.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/devel/devel.ma/Parse.cc (original) +++ trunk/libzypp/devel/devel.ma/Parse.cc Tue Jul 31 21:58:43 2007 @@ -48,8 +48,11 @@ { bool operator()( const PoolItem & obj_r ) { - MIL << obj_r << " " << obj_r->summary() << endl; - MIL << obj_r << " " << obj_r->description() << endl; + Package::constPtr p( asKind<Package>(obj_r) ); + if ( p ) + { + MIL << p << " \t" << p->sourcePkgName() << '-' << p->sourcePkgEdition() << endl; + } return true; } @@ -264,25 +267,6 @@ //zypp::base::LogControl::instance().logfile( "log.restrict" ); INT << "===[START]==========================================" << endl; - Capability c( CapFactory().parse( ResTraits<Package>::kind, - "modalias(kernel-bigsmp:pci:kfghkskd***k)" ) ); - - capability::ModaliasCap::constPtr mc( capability::asKindcapability::ModaliasCap(c) ); - - DBG << c << endl; - DBG << c.index() << endl; - - MIL << mc << endl; - MIL << mc->name() << endl; - MIL << mc->pkgname() << endl; - - - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; - RepoManager repoManager( makeRepoManager( "/Local/ROOT" ) ); RepoInfoList repos = repoManager.knownRepositories(); SEC << repos << endl; @@ -346,7 +330,7 @@ SEC << pool.knownRepositoriesSize() << endl; std::for_each( pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd(), Print() ); - std::for_each( pool.byNameBegin("glibc"), pool.byNameEnd("glibc"), Xprint() ); + std::for_each( pool.begin(), pool.end(), Xprint() ); /////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; Modified: trunk/libzypp/zypp/Package.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Package.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/Package.cc (original) +++ trunk/libzypp/zypp/Package.cc Tue Jul 31 21:58:43 2007 @@ -111,7 +111,13 @@ OnMediaLocation Package::location() const { return pimpl().location(); } - + + std::string Package::sourcePkgName() const + { return pimpl().sourcePkgName(); } + + Edition Package::sourcePkgEdition() const + { return pimpl().sourcePkgEdition(); } + ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/Package.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Package.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/Package.h (original) +++ trunk/libzypp/zypp/Package.h Tue Jul 31 21:58:43 2007 @@ -40,7 +40,7 @@ typedef std::set<PackageKeyword> Keywords; public: - + /** Get the package change log */ Changelog changelog() const; /** */ @@ -77,19 +77,29 @@ /** Disk usage per directory */ DiskUsage diskusage() const; - + + /** Name of the source rpm this package was built from. + * Empty if unknown. + */ + std::string sourcePkgName() const; + + /** Edition of the source rpm this package was built from. + * Empty if unknown. + */ + Edition sourcePkgEdition() 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/ZYpp.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYpp.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/ZYpp.cc (original) +++ trunk/libzypp/zypp/ZYpp.cc Tue Jul 31 21:58:43 2007 @@ -98,7 +98,7 @@ void ZYpp::initTarget(const Pathname & root, bool commit_only ) { _pimpl->initTarget(root, commit_only); } - + void ZYpp::initializeTarget(const Pathname & root) { _pimpl->initializeTarget(root); } @@ -108,6 +108,9 @@ ZYppCommitResult ZYpp::commit( const ZYppCommitPolicy & policy_r ) { return _pimpl->commit( policy_r ); } + void ZYpp::installSrcPackage( const ResTraits<SrcPackage>::constPtrType & srcPackage_r ) + { _pimpl->installSrcPackage( srcPackage_r ); } + /////////////////////////////////////////////////////////////////// void ZYpp::setTextLocale( const Locale & textLocale_r ) @@ -139,7 +142,7 @@ Pathname ZYpp::tmpPath() const { return _pimpl->tmpPath(); } - + void ZYpp::setHomePath( const Pathname & path ) { _pimpl->setHomePath(path); } Modified: trunk/libzypp/zypp/ZYpp.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYpp.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/ZYpp.h (original) +++ trunk/libzypp/zypp/ZYpp.h Tue Jul 31 21:58:43 2007 @@ -20,6 +20,7 @@ #include "zypp/base/Deprecated.h" #include "zypp/ZYppCommit.h" +#include "zypp/ResTraits.h" #include "zypp/Target.h" #include "zypp/Resolver.h" @@ -59,7 +60,7 @@ public: - /** + /** * Access to the main resolvable pool * \ref zypp::ResPool */ @@ -78,7 +79,7 @@ DiskUsageCounter::MountPointSet diskUsage(); void setPartitions(const DiskUsageCounter::MountPointSet &mp); - + DiskUsageCounter::MountPointSet getPartitions() const; public: @@ -97,8 +98,8 @@ * \throws Exception * if commit_only == true, just init the target, dont populate store or pool */ - ZYPP_DEPRECATED void initTarget(const Pathname & root, bool commit_only = false); - + ZYPP_DEPRECATED void initTarget(const Pathname & root, bool commit_only = false); + /** * \throws Exception */ @@ -115,6 +116,11 @@ */ ZYppCommitResult commit( const ZYppCommitPolicy & policy_r ); + /** Install a source package on the Target. + * \throws Exception + */ + void installSrcPackage( const ResTraits<SrcPackage>::constPtrType & srcPackage_r ); + public: /** */ Resolver_Ptr resolver() const; @@ -154,10 +160,10 @@ public: /** Get the path where zypp related plugins store persistent data and caches */ Pathname homePath() const; - + /** Get the path where zypp related plugins store temp data */ Pathname tmpPath() const; - + /** set the home, if you need to change it */ void setHomePath( const Pathname & path ); Modified: trunk/libzypp/zypp/detail/PackageImplIf.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/PackageImplIf.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/detail/PackageImplIf.cc (original) +++ trunk/libzypp/zypp/detail/PackageImplIf.cc Tue Jul 31 21:58:43 2007 @@ -21,6 +21,9 @@ namespace detail { ///////////////////////////////////////////////////////////////// + ByteCount PackageImplIf::downloadSize() const + { return location().downloadSize(); } + unsigned PackageImplIf::mediaNr() const { return location().medianr(); } @@ -71,9 +74,6 @@ ByteCount PackageImplIf::sourcesize() const { return ByteCount(); } - ByteCount PackageImplIf::downloadSize() const - { return location().downloadSize(); } - OnMediaLocation PackageImplIf::location() const { return OnMediaLocation(); } @@ -92,6 +92,12 @@ std::listPackageImplIf::PatchRpm PackageImplIf::patchRpms() const { return std::list<PatchRpm>(); } + std::string PackageImplIf::sourcePkgName() const + { return std::string(); } + + Edition PackageImplIf::sourcePkgEdition() const + { return Edition(); } + ///////////////////////////////////////////////////////////////// } // namespace detail /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/detail/PackageImplIf.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/PackageImplIf.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/detail/PackageImplIf.h (original) +++ trunk/libzypp/zypp/detail/PackageImplIf.h Tue Jul 31 21:58:43 2007 @@ -49,13 +49,18 @@ typedef packagedelta::PatchRpm PatchRpm; typedef std::set<PackageKeyword> Keywords; - public: - /** Overloaded ResObjectImpl attribute. + public: + /** Overloaded ResObjectImpl attribute. * \return The \ref location media number. */ virtual unsigned mediaNr() const; - public: + /** Overloaded ResObjectImpl attribute. + * \return The \ref location downloadSize. + */ + virtual ByteCount downloadSize() const; + + public: /** \name Rpm Package Attributes. */ //@{ @@ -99,10 +104,18 @@ /** */ virtual std::list<PatchRpm> patchRpms() const PURE_VIRTUAL; - virtual ByteCount downloadSize() const PURE_VIRTUAL; - virtual OnMediaLocation location() const PURE_VIRTUAL; + /** Name of the source rpm this package was built from. + * Empty if unknown. + */ + virtual std::string sourcePkgName() const PURE_VIRTUAL; + + /** Edition of the source rpm this package was built from. + * Empty if unknown. + */ + virtual Edition sourcePkgEdition() const PURE_VIRTUAL; + //@} }; Modified: trunk/libzypp/zypp/detail/SrcPackageImplIf.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/SrcPackageImplIf.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/detail/SrcPackageImplIf.cc (original) +++ trunk/libzypp/zypp/detail/SrcPackageImplIf.cc Tue Jul 31 21:58:43 2007 @@ -21,19 +21,22 @@ namespace detail { ///////////////////////////////////////////////////////////////// + ByteCount SrcPackageImplIf::downloadSize() const + { return location().downloadSize(); } + + unsigned SrcPackageImplIf::mediaNr() const + { return location().medianr(); } + ///////////////////////////////////////////////////////////////// // Default implementation of SrcPackageImplIf attributes, // as far as resonable. ///////////////////////////////////////////////////////////////// - OnMediaLocation SrcPackageImplIf::location() const - { return OnMediaLocation(); } - - ByteCount SrcPackageImplIf::downloadSize() const - { return location().downloadSize(); } + OnMediaLocation SrcPackageImplIf::location() const + { return OnMediaLocation(); } - DiskUsage SrcPackageImplIf::diskusage() const - { return DiskUsage(); } + DiskUsage SrcPackageImplIf::diskusage() const + { return DiskUsage(); } ///////////////////////////////////////////////////////////////// } // namespace detail Modified: trunk/libzypp/zypp/detail/SrcPackageImplIf.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/detail/SrcPackageImplIf.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/detail/SrcPackageImplIf.h (original) +++ trunk/libzypp/zypp/detail/SrcPackageImplIf.h Tue Jul 31 21:58:43 2007 @@ -40,12 +40,22 @@ typedef SrcPackage ResType; public: - virtual OnMediaLocation location() const PURE_VIRTUAL; + /** Overloaded ResObjectImpl attribute. + * \return The \ref location media number. + */ + virtual unsigned mediaNr() const; + + /** Overloaded ResObjectImpl attribute. + * \return The \ref location downloadSize. + */ + virtual ByteCount downloadSize() const; + + public: /** */ - virtual ByteCount downloadSize() const PURE_VIRTUAL; + virtual OnMediaLocation location() const PURE_VIRTUAL; /** */ virtual DiskUsage diskusage() const PURE_VIRTUAL; - + }; /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/repo/cached/PackageImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PackageImpl.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/cached/PackageImpl.cc (original) +++ trunk/libzypp/zypp/repo/cached/PackageImpl.cc Tue Jul 31 21:58:43 2007 @@ -193,6 +193,16 @@ return std::liststd::string(); } +std::string PackageImpl::sourcePkgName() const +{ + return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageSourcePkgName() ); +} + +Edition PackageImpl::sourcePkgEdition() const +{ + return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageSourcePkgEdition() ); +} + ///////////////////////////////////////////////////////////////// } } } // namespace zypp::repo::cached /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/repo/cached/PackageImpl.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/PackageImpl.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/cached/PackageImpl.h (original) +++ trunk/libzypp/zypp/repo/cached/PackageImpl.h Tue Jul 31 21:58:43 2007 @@ -30,7 +30,7 @@ public: PackageImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r ); - + virtual TranslatedText summary() const; virtual TranslatedText description() const; virtual TranslatedText insnotify() const; @@ -41,7 +41,7 @@ virtual bool installOnly() const; virtual Date buildtime() const; virtual Date installtime() const; - + // PACKAGE virtual std::string buildhost() const; virtual std::string distribution() const; @@ -61,12 +61,11 @@ 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 std::string sourcePkgName() const; + virtual Edition sourcePkgEdition() const; + virtual Repository repository() const; - + private: repo::cached::RepoImpl::Ptr _repository; Modified: trunk/libzypp/zypp/target/TargetImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/target/TargetImpl.cc (original) +++ trunk/libzypp/zypp/target/TargetImpl.cc Tue Jul 31 21:58:43 2007 @@ -25,6 +25,7 @@ #include "zypp/Resolvable.h" #include "zypp/ResObject.h" #include "zypp/Package.h" +#include "zypp/SrcPackage.h" #include "zypp/Pattern.h" #include "zypp/Selection.h" #include "zypp/Script.h" @@ -793,6 +794,15 @@ } } + void TargetImpl::installSrcPackage( const SrcPackage::constPtr & srcPackage_r ) + { + ZYPP_THROW( Exception("srcPackage install not yet implemented") ); +#warning IMPLEMENT IT + // Provide srcPackage_r on the local disk and install it using + // _rpm.installPackage( localfile ); + } + + ///////////////////////////////////////////////////////////////// } // namespace target /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/target/TargetImpl.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/target/TargetImpl.h (original) +++ trunk/libzypp/zypp/target/TargetImpl.h Tue Jul 31 21:58:43 2007 @@ -113,6 +113,9 @@ */ PoolItemList commit( const PoolItemList & items_r, const ZYppCommitPolicy & policy_r, const ResPool & pool_r ); + /** Install a source package on the Target. */ + void installSrcPackage( const ResTraits<SrcPackage>::constPtrType & srcPackage_r ); + /** Overload to realize stream output. */ virtual std::ostream & dumpOn( std::ostream & str ) const { @@ -135,12 +138,12 @@ /** return the last modification date of the target */ Date timestamp() const; - - /** + + /** * reload the target in future calls if * needed. * note the loading can actually be delayed, but - * the next call to resolvables must reflect the + * the next call to resolvables must reflect the * status of the system. */ void reset(); Modified: trunk/libzypp/zypp/zypp_detail/ZYppImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/zypp_detail/ZYppImpl.cc?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/zypp_detail/ZYppImpl.cc (original) +++ trunk/libzypp/zypp/zypp_detail/ZYppImpl.cc Tue Jul 31 21:58:43 2007 @@ -273,6 +273,12 @@ return res; } + void ZYppImpl::installSrcPackage( const ResTraits<SrcPackage>::constPtrType & srcPackage_r ) + { + if (! _target) + ZYPP_THROW( Exception("Target not initialized.") ); + _target->_pimpl->installSrcPackage( srcPackage_r ); + } //------------------------------------------------------------------------ // locales Modified: trunk/libzypp/zypp/zypp_detail/ZYppImpl.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/zypp_detail/ZYppImpl.h?rev=6353&r1=6352&r2=6353&view=diff ============================================================================== --- trunk/libzypp/zypp/zypp_detail/ZYppImpl.h (original) +++ trunk/libzypp/zypp/zypp_detail/ZYppImpl.h Tue Jul 31 21:58:43 2007 @@ -21,6 +21,7 @@ #include "zypp/Locale.h" #include "zypp/KeyRing.h" #include "zypp/ZYppCommit.h" +#include "zypp/ResTraits.h" #include "zypp/DiskUsageCounter.h" using namespace zypp::filesystem; @@ -82,13 +83,13 @@ * true, just init the target, dont populate store or pool */ void initializeTarget(const Pathname & root); - + /** * \throws Exception * if commit_only == true, just init the target, dont populate store or pool */ ZYPP_DEPRECATED void initTarget(const Pathname & root, bool commit_only); - + /** * \throws Exception */ @@ -97,6 +98,9 @@ /** Commit changes and transactions. */ ZYppCommitResult commit( const ZYppCommitPolicy & policy_r ); + /** Install a source package on the Target. */ + void installSrcPackage( const ResTraits<SrcPackage>::constPtrType & srcPackage_r ); + public: /** \todo Signal locale change. */ void setTextLocale( const Locale & textLocale_r ) @@ -130,10 +134,10 @@ /** Get the path where zypp related plugins store persistent data and caches */ Pathname homePath() const; - + /** Get the path where zypp related plugins store tmp data */ Pathname tmpPath() const; - + /** set the home, if you need to change it */ void setHomePath( const Pathname & path ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
mlandres@svn.opensuse.org