Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <libzypp> master : Prefer datadir stored as repo attribute, but fallback searching in solvbales.
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Fri, 26 Jun 2009 12:45:55 +0200
  • Message-id: <E1MK8xW-0007AY-Co@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit cf47942933adf6b07340c97544c9723e2e86b8ff
Author: Michael Andres <ma@xxxxxxx>
Date: Fri Jun 26 12:41:30 2009 +0200

Prefer datadir stored as repo attribute, but fallback searching in
solvbales.
---
zypp/sat/Solvable.cc | 52 +++++++++++++++++++++++++++++++++----------------
1 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/zypp/sat/Solvable.cc b/zypp/sat/Solvable.cc
index 4757488..64f6a97 100644
--- a/zypp/sat/Solvable.cc
+++ b/zypp/sat/Solvable.cc
@@ -198,8 +198,30 @@ namespace zypp
return CheckSum( std::string(), s ); // try to autodetect
}

+ ///////////////////////////////////////////////////////////////////
+ namespace
+ {
+ inline Pathname lookupDatadirIn( Repository repor_r )
+ {
+ static const sat::SolvAttr susetagsDatadir( "susetags:datadir" );
+ Pathname ret;
+ // First look for repo attribute "susetags:datadir". If not found,
+ // look into the solvables as Code11 satsolver placed it there.
+ sat::LookupRepoAttr datadir( susetagsDatadir, repor_r );
+ if ( ! datadir.empty() )
+ ret = datadir.begin().asString();
+ else
+ {
+ sat::LookupAttr datadir( susetagsDatadir, repor_r );
+ if ( ! datadir.empty() )
+ ret = datadir.begin().asString();
+ }
+ return ret;
+ }
+ }
+ ///////////////////////////////////////////////////////////////////
+
OnMediaLocation Solvable::lookupLocation() const
- //std::string Solvable::lookupLocation( unsigned & medianr ) const
{
NO_SOLVABLE_RETURN( OnMediaLocation() );
// medianumber and path
@@ -211,27 +233,23 @@ namespace zypp
OnMediaLocation ret;

Pathname path;
- static const sat::SolvAttr susetagsDatadir( "susetags:datadir" );
switch ( repository().info().type().toEnum() )
{
case repo::RepoType::NONE_e:
- {
- sat::LookupAttr datadir( susetagsDatadir, repository() );
- if ( ! datadir.empty() )
- {
- repository().info().setProbedType( repo::RepoType::YAST2_e );
- path = datadir.begin().asString();
- }
- path = datadir.empty() ? "suse" : datadir.begin().c_str();
- }
- break;
+ {
+ path = lookupDatadirIn( repository() );
+ if ( ! path.empty() )
+ repository().info().setProbedType( repo::RepoType::YAST2_e );
+ }
+ break;

case repo::RepoType::YAST2_e:
- {
- sat::LookupAttr datadir( susetagsDatadir, repository() );
- path = datadir.empty() ? "suse" : datadir.begin().c_str();
- }
- break;
+ {
+ path = lookupDatadirIn( repository() );
+ if ( path.empty() )
+ path = "suse";
+ }
+ break;

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

< Previous Next >
This Thread
  • No further messages