namespace sat
{ /////////////////////////////////////////////////////////////////
- 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 ( "installsize" );
- const SolvAttr SolvAttr::downloadsize ( "downloadsize" );
+ const SolvAttr SolvAttr::summary ( "solvable:summary" );
+ const SolvAttr SolvAttr::description ( "solvable:description" );
+ const SolvAttr SolvAttr::insnotify ( "solvable:messageins" );
+ const SolvAttr SolvAttr::delnotify ( "solvable:messagedel" );
+ const SolvAttr SolvAttr::vendor ( "solvable:vendor" );
+ const SolvAttr SolvAttr::license ( "solvable:license" );
+ const SolvAttr SolvAttr::size ( "solvable:installsize" );
+ const SolvAttr SolvAttr::downloadsize ( "solvable:downloadsize" );
//package
- const SolvAttr SolvAttr::medianr ( "medianr" );
- const SolvAttr SolvAttr::mediafile ( "mediafile" );
- const SolvAttr SolvAttr::mediadir ( "mediadir" );
- const SolvAttr SolvAttr::eula ( "eula" );
+ const SolvAttr SolvAttr::medianr ( "solvable:medianr" );
+ const SolvAttr SolvAttr::mediafile ( "solvable:mediafile" );
+ const SolvAttr SolvAttr::mediadir ( "solvable:mediadir" );
+ const SolvAttr SolvAttr::eula ( "solvable:eula" );
const SolvAttr SolvAttr::changelog ( "changelog" );
const SolvAttr SolvAttr::buildhost ( "buildhost" );
const SolvAttr SolvAttr::distribution ( "distribution" );
const SolvAttr SolvAttr::packager ( "packager" );
- const SolvAttr SolvAttr::group ( "group" );
- const SolvAttr SolvAttr::keywords ( "keywords" );
+ const SolvAttr SolvAttr::group ( "solvable:group" );
+ const SolvAttr SolvAttr::keywords ( "solvable:keywords" );
const SolvAttr SolvAttr::os ( "os" );
const SolvAttr SolvAttr::prein ( "prein" );
const SolvAttr SolvAttr::postin ( "postin" );
const SolvAttr SolvAttr::preun ( "preun" );
const SolvAttr SolvAttr::postun ( "postun" );
const SolvAttr SolvAttr::sourcesize ( "sourcesize" );
- const SolvAttr SolvAttr::authors ( "authors" );
+ const SolvAttr SolvAttr::authors ( "solvable:authors" );
const SolvAttr SolvAttr::filenames ( "filenames" );
const SolvAttr SolvAttr::srcpkgname ( "srcpkgname" );
const SolvAttr SolvAttr::srcpkgedition( "srcpkgedition" );
//pattern
- const SolvAttr SolvAttr::isvisible ( "isvisible" );
+ const SolvAttr SolvAttr::isvisible ( "solvable:isvisible" );
const SolvAttr SolvAttr::icon ( "icon" );
const SolvAttr SolvAttr::isdefault ( "isdefault" );
- const SolvAttr SolvAttr::category ( "category" ); // FIXME translate
+ const SolvAttr SolvAttr::category ( "solvable:category" ); // FIXME translate
const SolvAttr SolvAttr::script ( "script" );
return repo_lookup_num(this->get(), attr.idStr().id()) > 0;
}
- struct LocCallback
- {
- unsigned medianr;
- const char *mediadir;
- const char *mediafile;
- int trivial;
- };
-
- static int
- location_cb (void *vcbdata, ::Solvable *s, ::Repodata *data, ::Repokey *key, ::KeyValue *kv)
- {
- LocCallback *lc = (LocCallback *)vcbdata;
- switch (key->type)
- {
- case REPOKEY_TYPE_ID:
- if (key->name == SolvAttr::mediadir.idStr().id())
- {
- if (data->localpool)
- lc->mediadir = stringpool_id2str(&data->spool, kv->id);
- else
- lc->mediadir = id2str(data->repo->pool, kv->id);
- }
- break;
- case REPOKEY_TYPE_STR:
- if (key->name == SolvAttr::mediafile.idStr().id())
- lc->mediafile = kv->str;
- break;
- case REPOKEY_TYPE_VOID:
- if (key->name == SolvAttr::mediafile.idStr().id())
- lc->trivial = 1;
- break;
- case REPOKEY_TYPE_CONSTANT:
- if (key->name == SolvAttr::medianr.idStr().id())
- lc->medianr = kv->num;
- break;
- }
- /* continue walking */
- return 0;
- }
-
std::string Solvable::lookupLocation(unsigned &medianr) const
{
NO_SOLVABLE_RETURN( std::string() );
- ::Repo *repo = _solvable->repo;
- ::Pool *pool = repo->pool;
- Id sid = _solvable - pool->solvables;
- ::Repodata *data;
- unsigned i;
- LocCallback lc;
- lc.medianr = 1;
- lc.mediadir = 0;
- lc.mediafile = 0;
- lc.trivial = 0;
- for (i = 0, data = repo->repodata; i < repo->nrepodata; i++, data++)
- {
- if (data->state == REPODATA_STUB || data->state == REPODATA_ERROR)
- continue;
- if (sid < data->start || sid >= data->end)
- continue;
- repodata_search(data, sid - data->start, 0, location_cb, &lc);
- }
- medianr = lc.medianr;
- std::string ret;
-
- if (lc.mediadir)
- {
- ret += std::string( lc.mediadir ) + "/";
- }
- else
- {
- /* If we haven't seen an explicit dirname, then prepend the arch as
- directory. */
- ret += "suse/";
- ret += IdString(_solvable->arch).asString() + "/";
- }
-
- if (!lc.trivial)
- {
- if (lc.mediafile)
- ret += lc.mediafile;
- return ret;
- }
-
- /* Trivial means that we can construct the rpm name from our
- solvable data, as name-evr.arch.rpm . */
- ret += IdString(_solvable->name).asString();
- ret += '-';
- ret += IdString(_solvable->evr).asString();
- ret += '.';
- ret += IdString(_solvable->arch).asString();
- ret += ".rpm";
- return ret;
+ unsigned int nr;
+ char *l = solvable_get_location(_solvable, &nr);
+ medianr = nr;
+ return l ? std::string(l) : std::string();
}
ResKind Solvable::kind() const