deprecate Repository::name() and use alias() to
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 21 May 2008 17:02:01 +0000 (17:02 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 21 May 2008 17:02:01 +0000 (17:02 +0000)
be consistent. Related to (bnc#383553)

VERSION.cmake
package/libzypp.changes
zypp/Repository.cc
zypp/Repository.h
zypp/sat/Pool.cc
zypp/sat/Pool.h
zypp/sat/Solvable.cc
zypp/sat/detail/PoolImpl.cc

index 897ceca..df1f9f8 100644 (file)
@@ -45,6 +45,6 @@
 #
 
 SET(LIBZYPP_MAJOR "4")
-SET(LIBZYPP_MINOR "24")
+SET(LIBZYPP_MINOR "25")
 SET(LIBZYPP_COMPATMINOR "24")
 SET(LIBZYPP_PATCH "0")
index ffd97a0..d591c9a 100644 (file)
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed May 21 13:50:00 CEST 2008 - dmacvicar@suse.de
+
+- deprecate Repository::name() and use alias() to
+  be consistent. Related to (bnc#383553)
+- 4.25.0
+
+-------------------------------------------------------------------
 Wed May 21 11:37:23 CEST 2008 - schubi@suse.de
 
 - added onlyRequires in the testcase (bnc #389184) 
index 1306032..4a6b022 100644 (file)
@@ -50,7 +50,7 @@ namespace zypp
        return( sat::Pool::systemRepoName() == _repo->name );
     }
 
-    std::string Repository::name() const
+    std::string Repository::alias() const
     {
        NO_REPOSITORY_RETURN( std::string() );
        if ( ! _repo->name )
@@ -99,10 +99,10 @@ namespace zypp
     void Repository::setInfo( const RepoInfo & info_r )
     {
        NO_REPOSITORY_THROW( Exception( "Can't set RepoInfo for norepo." ) );
-       if ( info_r.alias() != name() )
+       if ( info_r.alias() != alias() )
        {
-           ZYPP_THROW( Exception( str::form( "RepoInfo alias (%s) does not match repository name (%s)",
-                                             info_r.alias().c_str(), name().c_str() ) ) );
+           ZYPP_THROW( Exception( str::form( "RepoInfo alias (%s) does not match repository alias (%s)",
+                                             info_r.alias().c_str(), alias().c_str() ) ) );
        }
        myPool().setRepoInfo( _repo, info_r );
 
@@ -173,7 +173,7 @@ namespace zypp
        if ( ! obj )
            return str << "noRepository";
 
-       return str << "sat::repo(" << obj.name() << ")"
+       return str << "sat::repo(" << obj.alias() << ")"
                   << "{"
                    << "prio " << obj.get()->priority
                   << ", size " << obj.solvablesSize()
index 8214210..f69baaa 100644 (file)
@@ -56,10 +56,33 @@ namespace zypp
         bool isSystemRepo() const;
 
     public:
-        /** The repos name (alias).
-         * \todo FIXME why is this not called alias if it <b>is</b> alias?
-         */
-        std::string name() const;
+         /** 
+          * Short unique, convenience string to refer to a repo.
+          * ie: openSUSE-10.3
+          *
+          * If you are looking for a label to display
+          * see \ref info() which provides \ref RepoInfo::name()
+          * ie: "openSUSE 10.3 Main repository"
+          *
+          */
+        std::string alias() const;
+
+         /** 
+          * Short unique, convenience string to refer to a repo.
+          * ie: openSUSE-10.3
+          *
+          * The sat solver uses name for what we know as alias
+          * In rpm repositories, name is a label string
+          * ie: "openSUSE 10.3 Main repository"
+          *
+          * We know follow rpm conventions and ignore satsolver
+          * wording for name.
+          *
+          * Use \ref alias() instead
+          */
+        ZYPP_DEPRECATED std::string name() const
+        { return alias(); }
+        
 
         /** Whether \ref Repository contains solvables. */
         bool solvablesEmpty() const;
index 612e524..936135c 100644 (file)
@@ -35,7 +35,7 @@ namespace zypp
   namespace sat
   { /////////////////////////////////////////////////////////////////
 
-    const std::string & Pool::systemRepoName()
+    const std::string & Pool::systemRepoAlias()
     {
       static const std::string _val( "@System" );
       return _val;
@@ -97,40 +97,40 @@ namespace zypp
     Pool::SolvableIterator Pool::solvablesEnd() const
     { return SolvableIterator(); }
 
-    Repository Pool::reposInsert( const std::string & name_r )
+    Repository Pool::reposInsert( const std::string & alias_r )
     {
-      Repository ret( reposFind( name_r ) );
+      Repository ret( reposFind( alias_r ) );
       if ( ret )
         return ret;
 
-      ret = Repository( myPool()._createRepo( name_r ) );
-      if ( name_r == systemRepoName() )
+      ret = Repository( myPool()._createRepo( alias_r ) );
+      if ( alias_r == systemRepoAlias() )
       {
         // autoprovide (dummy) RepoInfo
         ret.setInfo( RepoInfo()
-                     .setAlias( name_r )
-                     .setName( name_r )
+                     .setAlias( alias_r )
+                     .setName( alias_r )
                      .setAutorefresh( true )
                      .setEnabled( true ) );
       }
       return ret;
     }
 
-    Repository Pool::reposFind( const std::string & name_r ) const
+    Repository Pool::reposFind( const std::string & alias_r ) const
     {
       for_( it, reposBegin(), reposEnd() )
       {
-        if ( name_r == it->name() )
+        if ( alias_r == it->alias() )
           return *it;
       }
       return Repository();
     }
 
-    Repository Pool::addRepoSolv( const Pathname & file_r, const std::string & name_r )
+    Repository Pool::addRepoSolv( const Pathname & file_r, const std::string & alias_r )
     {
       // Using a temporay repo! (The additional parenthesis are required.)
       AutoDispose<Repository> tmprepo( (Repository::EraseFromPool()) );
-      *tmprepo = reposInsert( name_r );
+      *tmprepo = reposInsert( alias_r );
       tmprepo->addSolv( file_r );
 
       // no exceptions so we keep it:
index 5766215..7e3f761 100644 (file)
@@ -78,34 +78,39 @@ namespace zypp
         /** Iterator behind the last \ref Repository. */
         RepositoryIterator reposEnd() const;
 
-        /** Return a \ref Repository named \c name_r.
+        /** Return a \ref Repository named \c alias_r.
          * It a such a \ref Repository does not already exist
          * a new empty \ref Repository is created.
          */
-        Repository reposInsert( const std::string & name_r );
+        Repository reposInsert( const std::string & alias_r );
 
-        /** Find a \ref Repository named \c name_r.
+        /** Find a \ref Repository named \c alias_r.
          * Returns \ref norepository if there is no such \ref Repository.
          */
-        Repository reposFind( const std::string & name_r ) const;
+        Repository reposFind( const std::string & alias_r ) const;
 
-        /** Remove a \ref Repository named \c name_r.
+        /** Remove a \ref Repository named \c alias_r.
          * \see \ref Repository::eraseFromPool
          */
-        void reposErase( const std::string & name_r )
-        { reposFind( name_r ).eraseFromPool(); }
+        void reposErase( const std::string & alias_r )
+        { reposFind( alias_r ).eraseFromPool(); }
 
       public:
-        /** Reserved system repository name \c @System. */
-        static const std::string & systemRepoName();
+        /** Reserved system repository alias \c @System. */
+        static const std::string & systemRepoAlias();
+
+        /** Deprecated, use \ref systemRepoAlias() */
+        ZYPP_DEPRECATED static const std::string & systemRepoName()
+        { return systemRepoAlias(); } 
+
 
         /** Return the system repository if it is on the pool. */
         Repository findSystemRepo() const
-        { return reposFind( systemRepoName() ); }
+        { return reposFind( systemRepoAlias() ); }
 
         /** Return the system repository, create it if missing. */
         Repository systemRepo()
-        { return reposInsert( systemRepoName() ); }
+        { return reposInsert( systemRepoAlias() ); }
 
       public:
         /** Load \ref Solvables from a solv-file into a \ref Repository named \c name_r.
index 9c6c4fe..dd9d6d8 100644 (file)
@@ -525,7 +525,7 @@ namespace zypp
       return str << "(" << obj.id() << ")"
           << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
           << '-' << obj.edition() << '.' << obj.arch() << "("
-          << obj.repository().name() << ")";
+          << obj.repository().alias() << ")";
     }
 
     /******************************************************************
index f7bf861..cc2c335 100644 (file)
@@ -208,7 +208,7 @@ namespace zypp
           MIL << "pool_createwhatprovides..." << endl;
 
           // NOTE: Thake care not to ctreate a nonexisting systemRepo
-          Repository sysrepo( sat::Pool::instance().reposFind( sat::Pool::instance().systemRepoName() ) );
+          Repository sysrepo( sat::Pool::instance().reposFind( sat::Pool::instance().systemRepoAlias() ) );
           if ( sysrepo )
           {
             ::pool_addfileprovides( _pool, sysrepo.get() );