Mailinglist Archive: zypp-commit (268 mails)

< Previous Next >
[zypp-commit] r7921 - in /branches/use-solv/libzypp/zypp: CapSet.h CapSetFwd.h Capability.h TODO.use-solv repo/cached/RepoImpl.cc target/rpm/RpmDb.cc target/store/XMLFilesBackend.cc
  • From: matz@xxxxxxxxxxxxxxxx
  • Date: Mon, 26 Nov 2007 01:15:11 -0000
  • Message-id: <20071126011511.5B61B2448B@xxxxxxxxxxxxxxxx>
Author: matz
Date: Mon Nov 26 02:15:10 2007
New Revision: 7921

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7921&view=rev
Log:
And now CapSet is an immutable set of Capabilities, directly based on
the SOLV data. Very fast and very small. This shoves off about 20MB
memory size and another 0.6 seconds for zypper pch (from 2.6 seconds).
For now the dependencies of the target-store (the XML part) are not
created anymore, i.e. dependencies of installed atoms and patches are
missing, hence zypper will show some superflous patches as not
applicable.

Modified:
branches/use-solv/libzypp/zypp/CapSet.h
branches/use-solv/libzypp/zypp/CapSetFwd.h
branches/use-solv/libzypp/zypp/Capability.h
branches/use-solv/libzypp/zypp/TODO.use-solv
branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc
branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc
branches/use-solv/libzypp/zypp/target/store/XMLFilesBackend.cc

Modified: branches/use-solv/libzypp/zypp/CapSet.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapSet.h?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapSet.h (original)
+++ branches/use-solv/libzypp/zypp/CapSet.h Mon Nov 26 02:15:10 2007
@@ -17,10 +17,70 @@
#include "zypp/Capability.h"
#include "zypp/CapSetFwd.h"

+#include <pooltypes.h>
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////

+ extern Pool *the_pool;
+
+ class CapSet
+ {
+ public:
+ /* This class is usable like a very limited std::set. No modification
+ of elements allowed, and not all std:set members are implemented. */
+ struct const_iterator {
+ /* Some typedefs to make this an iterator suitable for some
+ STL <algorithm> games. */
+ typedef std::forward_iterator_tag iterator_category;
+ typedef Capability value_type;
+ typedef int difference_type;
+ typedef const Capability * pointer;
+ typedef const Capability & reference;
+
+ const_iterator (const Id *_i): i(_i) {};
+ void operator++() { i++; }
+ void operator++(int) { i++; }
+ Capability operator*() const { return *i; }
+ const Capability * operator->() const { cap = Capability(*i); return
&cap; }
+ bool operator != (const_iterator b) const
+ {
+ if (i==b.i)
+ return false;
+ if (i == 0 && *b.i == 0)
+ return false;
+ if (b.i == 0 && *i == 0)
+ return false;
+ return true;
+ }
+ bool operator == (const_iterator b) const
+ { return !(*this != b); }
+
+ private:
+ const Id *i;
+ /* The following is needed for operator-> :-/ */
+ mutable Capability cap;
+ };
+
+ CapSet () : base(0) {}
+ CapSet (const Id * p) : base(p) {}
+ const_iterator begin() const { return base; }
+ const_iterator end() const { return 0; }
+ bool empty() const { return !base || !*base; }
+ int size() const
+ {
+ if (!base)
+ return 0;
+ const Id *p;
+ for (p = base; *p; p++)
+ ;
+ return p - base;
+ }
+ private:
+ const Id * base;
+ };
+
extern std::ostream & operator<<( std::ostream & str, const CapSet & obj );

/////////////////////////////////////////////////////////////////

Modified: branches/use-solv/libzypp/zypp/CapSetFwd.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapSetFwd.h?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapSetFwd.h (original)
+++ branches/use-solv/libzypp/zypp/CapSetFwd.h Mon Nov 26 02:15:10 2007
@@ -20,7 +20,8 @@

class Capability;
class CapOrder;
- typedef std::set<Capability,CapOrder> CapSet;
+ class CapSet;
+
typedef std::set<Capability,CapOrder> SlowCapSet;

/////////////////////////////////////////////////////////////////

Modified: branches/use-solv/libzypp/zypp/Capability.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/Capability.h?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/Capability.h (original)
+++ branches/use-solv/libzypp/zypp/Capability.h Mon Nov 26 02:15:10 2007
@@ -74,6 +74,7 @@
{
/** Ordering for use in CapSet */
friend class CapOrder;
+ friend class CapSet;
friend bool operator==( const Capability & lhs, const Capability & rhs );
friend std::ostream & operator<<( std::ostream & str, const Capability &
obj );


Modified: branches/use-solv/libzypp/zypp/TODO.use-solv
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/TODO.use-solv?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/TODO.use-solv (original)
+++ branches/use-solv/libzypp/zypp/TODO.use-solv Mon Nov 26 02:15:10 2007
@@ -45,3 +45,8 @@
other members
CapFactory.cc : encode() needs to emit a string representation of Cap
which can be parsed back.
+pool/GetResolvablesToInsDel.cc : strip_obsoleted_to_delete needs a writable
CapSet.
+target/store/XMLFilesBackend.cc : createDependencies needs writable CapSet.
+solver/detail/InstallOrder.cc : rdfsvisit needs mergable CapSet
+solver/detail/Resolver.cc : _extra_caps and _extra_conflicts are writable
CapSets
+solver/detail/Testcase.cc : addDependencies needs same CapSet type as
_extra_caps and _extra_provides

Modified: branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc (original)
+++ branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc Mon Nov 26 02:15:10
2007
@@ -169,12 +169,10 @@
add_deps (CapFactory &factory, Pool *pool, CapSet &caps, Repo *repo, Offset
ofs)
{
Id *ids;
- Id id;
if (!ofs)
return;
ids = repo->idarraydata + ofs;
- while((id = *ids++) != 0)
- caps.insert (factory.fromId (id));
+ caps = CapSet (ids);
}

void RepoImpl::createResFromRepo()

Modified: branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc (original)
+++ branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc Mon Nov 26 02:15:10 2007
@@ -1337,12 +1337,10 @@
add_deps (CapFactory &factory, Pool *pool, CapSet &caps, Repo *repo, Offset
ofs)
{
Id *ids;
- Id id;
if (!ofs)
return;
ids = repo->idarraydata + ofs;
- while((id = *ids++) != 0)
- caps.insert (factory.fromId (id));
+ caps = CapSet (ids);
}

const list<Package::Ptr> &
RpmDb::doGetPackages(callback::SendReport<ScanDBReport> & report)

Modified: branches/use-solv/libzypp/zypp/target/store/XMLFilesBackend.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/target/store/XMLFilesBackend.cc?rev=7921&r1=7920&r2=7921&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/target/store/XMLFilesBackend.cc (original)
+++ branches/use-solv/libzypp/zypp/target/store/XMLFilesBackend.cc Mon Nov 26
02:15:10 2007
@@ -1282,46 +1282,46 @@
Dependencies _deps;
for (std::list<XMLDependency>::const_iterator it = parsed.provides.begin();
it != parsed.provides.end(); it++)
{
- _deps[Dep::PROVIDES].insert(createCapability(*it, my_kind));
+ // _deps[Dep::PROVIDES].insert(createCapability(*it, my_kind));
}
for (std::list<XMLDependency>::const_iterator it = parsed.conflicts.begin();
it != parsed.conflicts.end(); it++)
{
- _deps[Dep::CONFLICTS].insert(createCapability(*it, my_kind));
+ // _deps[Dep::CONFLICTS].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it = parsed.obsoletes.begin();
it != parsed.obsoletes.end(); it++)
{
- _deps[Dep::OBSOLETES].insert(createCapability(*it, my_kind));
+ // _deps[Dep::OBSOLETES].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it = parsed.freshens.begin();
it != parsed.freshens.end(); it++)
{
- _deps[Dep::FRESHENS].insert(createCapability(*it, my_kind));
+ // _deps[Dep::FRESHENS].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it =
parsed.recommends.begin(); it != parsed.recommends.end(); it++)
{
- _deps[Dep::RECOMMENDS].insert(createCapability(*it, my_kind));
+ // _deps[Dep::RECOMMENDS].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it = parsed.suggests.begin();
it != parsed.suggests.end(); it++)
{
- _deps[Dep::SUGGESTS].insert(createCapability(*it, my_kind));
+ // _deps[Dep::SUGGESTS].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it = parsed.enhances.begin();
it != parsed.enhances.end(); it++)
{
- _deps[Dep::ENHANCES].insert(createCapability(*it, my_kind));
+ // _deps[Dep::ENHANCES].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it = parsed.requires.begin();
it != parsed.requires.end(); it++)
{
- _deps[Dep::REQUIRES].insert(createCapability(*it, my_kind));
+ // _deps[Dep::REQUIRES].insert(createCapability(*it, my_kind));
}

for (std::list<XMLDependency>::const_iterator it =
parsed.prerequires.begin(); it != parsed.prerequires.end(); it++)
{
- _deps[Dep::PREREQUIRES].insert(createCapability(*it, my_kind));
+ // _deps[Dep::PREREQUIRES].insert(createCapability(*it, my_kind));
}
return _deps;
}

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages