From: Michael Matz Date: Fri, 7 Mar 2008 20:15:03 +0000 (+0000) Subject: Fix fallout after the big SOLV change: new attribute names, and X-Git-Tag: BASE-SuSE-Linux-11_0-Branch~483 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1dcdafbfe6473734401a0b89d2658c719bbfdc3a;p=platform%2Fupstream%2Flibzypp.git Fix fallout after the big SOLV change: new attribute names, and different representation of rpm locations. --- diff --git a/zypp/Package.cc b/zypp/Package.cc index 8d8067b..56a8796 100644 --- a/zypp/Package.cc +++ b/zypp/Package.cc @@ -110,6 +110,9 @@ namespace zypp OnMediaLocation loc; unsigned medianr; std::string filename = lookupLocation( medianr ); + /* XXX This datadir should be part of RepoInfo. */ + if (repoInfo().type().toEnum() == repo::RepoType::YAST2_e) + filename = std::string("suse/") + filename; loc.setLocation(filename, medianr); return loc; } diff --git a/zypp/sat/SolvAttr.cc b/zypp/sat/SolvAttr.cc index 7dfbda6..6047759 100644 --- a/zypp/sat/SolvAttr.cc +++ b/zypp/sat/SolvAttr.cc @@ -23,42 +23,42 @@ namespace zypp 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" ); diff --git a/zypp/sat/Solvable.cc b/zypp/sat/Solvable.cc index 7a92d04..b9460b3 100644 --- a/zypp/sat/Solvable.cc +++ b/zypp/sat/Solvable.cc @@ -89,98 +89,13 @@ namespace zypp 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