Author: dmacvicar
Date: Wed Feb 6 03:15:58 2008
New Revision: 8490
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8490&view=rev
Log:
- retrieving attributes, 1st version... does not support translations yet
Modified:
branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/CMakeLists.txt
branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/testbed.cc
branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc
branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.h
branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc
branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc
branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h
branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc
branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.h
Modified: branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/CMakeLists.txt?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/CMakeLists.txt Wed Feb 6 03:15:58 2008
@@ -21,8 +21,6 @@
# ADD_EXECUTABLE(yum-reader YUMReader_tp.cc)
# TARGET_LINK_LIBRARIES(yum-reader zypp )
-ADD_EXECUTABLE(cachedsource CachedSource_tp.cc)
-TARGET_LINK_LIBRARIES(cachedsource zypp )
ADD_EXECUTABLE(repomanager RepositoryManager_tp.cc)
TARGET_LINK_LIBRARIES(repomanager zypp )
Modified: branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc Wed Feb 6 03:15:58 2008
@@ -10,7 +10,6 @@
#include
#include "zypp/Product.h"
-#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
#include "zypp/RepoInfo.h"
@@ -40,7 +39,7 @@
for ( RepoInfoList::const_iterator it = repos.begin(); it != repos.end(); ++it )
{
cout << *it << endl;
- Repository repo = manager.createFromCache(*it);
+ manager.loadFromCache(it->alias());
//z->addResolvables(repo.resolvables());
}
Modified: branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/testbed.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/testbed.cc?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/testbed.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/devel/devel.dmacvicar/testbed.cc Wed Feb 6 03:15:58 2008
@@ -8,16 +8,15 @@
#include
#include "zypp/Product.h"
-#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/repo/cached/RepoImpl.h"
-#include "zypp/data/ResolvableData.h"
#include "zypp/TmpPath.h"
#include "zypp/ProgressData.h"
#include "zypp/parser/yum/RepoParser.h"
#include "zypp/repo/yum/Downloader.h"
+#include "zypp/sat/Pool.h"
+
using namespace std;
using namespace zypp;
using namespace zypp::repo;
@@ -29,7 +28,19 @@
ZYpp::Ptr z = getZYpp();
z->initializeTarget("/");
- z->target()->load();
+ //z->target()->load();
+
+ sat::Pool::instance().addRepoSolv("./foo.solv");
+
+ for ( ResPool::const_iterator it = z->pool().begin(); it != z->pool().end(); ++it )
+ {
+ ResObject::constPtr res = it->resolvable();
+ if ( res->name() == "kde4-kcolorchooser")
+ {
+ cout << res << endl;
+ cout << res->summary() << " | " << res->size() << endl;
+ }
+ }
}
catch ( const Exception &e )
{
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc Wed Feb 6 03:15:58 2008
@@ -15,6 +15,7 @@
#include <fstream>
#include <sstream>
#include <list>
+#include <map>
#include <algorithm>
#include "zypp/base/InputStream.h"
#include "zypp/base/Logger.h"
@@ -250,6 +251,8 @@
RepoManagerOptions options;
+ map _repoinfos;
+
public:
/** Offer default Impl. */
static shared_ptr<Impl> nullimpl()
@@ -892,20 +895,12 @@
status.saveToCookieFile(cookiefile);
}
-#warning whats this map for
- map repo2solv;
-
void RepoManager::loadFromCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
assert_alias(info);
- loadFromCache( info.alias(), progressrcv );
- }
-
- void RepoManager::loadFromCache( const std::string &alias,
- const ProgressData::ReceiverFnc & progressrcv )
- {
sat::Pool satpool( sat::Pool::instance() );
+ string alias = info.alias();
Pathname solvfile = (_pimpl->options.repoCachePath + alias).extend(".solv");
@@ -915,7 +910,6 @@
sat::Repo repo = satpool.addRepoSolv(solvfile, alias );
}
-
////////////////////////////////////////////////////////////////////////////
/**
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.h?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.h Wed Feb 6 03:15:58 2008
@@ -264,10 +264,6 @@
*/
void loadFromCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
- /** \overload */
- void loadFromCache( const std::string &alias,
- const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
-
/**
* \short Probe repo metadata type.
*
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc Wed Feb 6 03:15:58 2008
@@ -9,16 +9,38 @@
/** \file zypp/ResObject.cc
*
*/
+
+#include
#include "zypp/ResObject.h"
#include "zypp/Repository.h"
#include "zypp/sat/SolvAttr.h"
+#include "zypp/sat/Solvable.h"
+#include "zypp/sat/Repo.h"
+
extern "C"
{
#include "satsolver/repo.h"
}
+using namespace zypp;
+using namespace std;
+
class SearchQuery
{
+ public:
+
+ SearchQuery( const sat::Solvable &solvable_r )
+ : _solvable(solvable_r)
+ {
+
+ }
+
+ void lookup( const sat::SolvAttr &attr )
+ {
+ //search( _solvable.repo().get(), _solvable.id(), attr.idStr().id(), 0, 0 );
+ //return repo_lookup_str(_solvable.get(), attr.idStr().id());
+ }
+
void search(Repo *repo, Id p, Id key, const char *match, int flags)
{
repo_search( repo, p, key, match, flags, SearchQuery::repo_search_cb, (void*) this);
@@ -26,8 +48,28 @@
static int repo_search_cb(void *cbdata, ::Solvable *s, ::Repodata *data, ::Repokey *key, ::KeyValue *kv)
{
+ cout << "found attribute" << endl;
SearchQuery *q = (SearchQuery *) cbdata;
+ const char *keyname;
+ keyname = id2str(data->repo->pool, key->name);
+ switch(key->type)
+ {
+ case TYPE_ID:
+ //if (data->localpool)
+ // kv->str = stringpool_id2str(&data->spool, kv->id);
+ //else
+ // kv->str = id2str(data->repo->pool, kv->id);
+ // printf("%s: %s\n", keyname, kv->str);
+ break;
+ case TYPE_STR:
+ q->_result = kv->str;
+ break;
+ }
+ return 1;
}
+
+ sat::Solvable _solvable;
+ std::string _result;
};
///////////////////////////////////////////////////////////////////
@@ -70,34 +112,36 @@
///////////////////////////////////////////////////////////////////
Text ResObject::summary() const
- { return Text(); }
+ {
+ return lookupStrAttribute( sat::SolvAttr::summary );
+ }
Text ResObject::description() const
- { return Text(); }
+ { return lookupStrAttribute( sat::SolvAttr::description ); }
Text ResObject::insnotify() const
- { return Text(); }
+ { return lookupStrAttribute( sat::SolvAttr::insnotify ); }
Text ResObject::delnotify() const
- { return Text(); }
+ { return lookupStrAttribute( sat::SolvAttr::delnotify ); }
License ResObject::licenseToConfirm() const
- { return License(); }
+ { return lookupStrAttribute( sat::SolvAttr::license ); }
Vendor ResObject::vendor() const
- { return Vendor(); }
+ { return lookupStrAttribute( sat::SolvAttr::vendor ); }
ByteCount ResObject::size() const
- { return ByteCount(); }
+ { return lookupNumAttribute( sat::SolvAttr::size ); }
Repository ResObject::repository() const
{ return Repository(); }
ByteCount ResObject::downloadSize() const
- { return ByteCount(); }
+ { return lookupNumAttribute( sat::SolvAttr::downloadsize ); }
unsigned ResObject::mediaNr() const
- { return 0; }
+ { return 1; }
bool ResObject::installOnly() const
{ return false; }
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc Wed Feb 6 03:15:58 2008
@@ -25,7 +25,12 @@
const SolvAttr SolvAttr::summary ( "summary" );
const SolvAttr SolvAttr::description ( "description" );
-
+ const SolvAttr SolvAttr::insnotify ( "insnotify" );
+ const SolvAttr SolvAttr::delnotify ( "delnotify" );
+ const SolvAttr SolvAttr::vendor ( "vendor" );
+ const SolvAttr SolvAttr::license ( "license" );
+ const SolvAttr SolvAttr::size ( "size" );
+ const SolvAttr SolvAttr::downloadsize ( "downloadsize" );
} // namespace sat
/////////////////////////////////////////////////////////////////
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h Wed Feb 6 03:15:58 2008
@@ -43,6 +43,12 @@
static const SolvAttr noAttr;
static const SolvAttr summary;
static const SolvAttr description;
+ static const SolvAttr insnotify;
+ static const SolvAttr delnotify;
+ static const SolvAttr vendor;
+ static const SolvAttr license;
+ static const SolvAttr size;
+ static const SolvAttr downloadsize;
//@}
public:
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc Wed Feb 6 03:15:58 2008
@@ -71,6 +71,17 @@
return IdString( _solvable->name );
}
+ std::string Solvable::lookupStrAttribute( const SolvAttr &attr ) const
+ {
+ const char *s = repo_lookup_str(this->get(), attr.idStr().id());
+ return s ? s : std::string();
+ }
+
+ int Solvable::lookupNumAttribute( const SolvAttr &attr ) const
+ {
+ return repo_lookup_num(this->get(), attr.idStr().id());
+ }
+
ResKind Solvable::kind() const
{
NO_SOLVABLE_RETURN( ResKind() );
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.h?rev=8490&r1=8489&r2=8490&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.h Wed Feb 6 03:15:58 2008
@@ -17,6 +17,7 @@
#include "zypp/base/SafeBool.h"
#include "zypp/sat/detail/PoolMember.h"
+#include "zypp/sat/SolvAttr.h"
#include "zypp/ResTraits.h"
#include "zypp/IdString.h"
@@ -77,6 +78,20 @@
Repo repo() const;
public:
+
+ /**
+ * returns the string attribute value for \ref attr
+ * or an empty string if it does not exists.
+ */
+ std::string lookupStrAttribute( const SolvAttr &attr ) const;
+
+ /**
+ * returns the numeric attribute value for \ref attr
+ * or 0 if it does not exists.
+ */
+ int lookupNumAttribute( const SolvAttr &attr ) const;
+
+ public:
/** The identifier.
* This is the solvables \ref name, \b except for packages and
* source packes, prefixed by it's \ref kind.
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org