r1838 - tools/prt-get/trunk/src
Author: jw Date: 2006-09-08 15:53:58 +0200 (Fri, 08 Sep 2006) New Revision: 1838 Modified: tools/prt-get/trunk/src/prtget.cpp tools/prt-get/trunk/src/repository.cpp tools/prt-get/trunk/src/repository.h Log: prt-get: show multiple dups in 'dup' Modified: tools/prt-get/trunk/src/prtget.cpp =================================================================== --- tools/prt-get/trunk/src/prtget.cpp 2006-09-08 12:17:12 UTC (rev 1837) +++ tools/prt-get/trunk/src/prtget.cpp 2006-09-08 13:53:58 UTC (rev 1838) @@ -277,12 +277,13 @@ string output; Package* p1; Package* p2; - map<string, pair<Package*, Package*> >::const_iterator it = + + list<pair<Package*, Package*> >::const_iterator it = m_repo->shadowedPackages().begin(); for ( ; it != m_repo->shadowedPackages().end(); ++it ) { output = format; - p1 = it->second.second; - p2 = it->second.first; + p1 = it->second; + p2 = it->first; StringHelper::replaceAll(output, "%n", p1->name()); StringHelper::replaceAll(output, "%p1", p1->path() + "/" + p1->name()); Modified: tools/prt-get/trunk/src/repository.cpp =================================================================== --- tools/prt-get/trunk/src/repository.cpp 2006-09-08 12:17:12 UTC (rev 1837) +++ tools/prt-get/trunk/src/repository.cpp 2006-09-08 13:53:58 UTC (rev 1838) @@ -69,7 +69,7 @@ \a second is the port which preceeds over \a first \return a map of duplicate packages in the repository */ -const map<string, pair<Package*, Package*> >& Repository::shadowedPackages() const +const list< pair<Package*, Package*> >& Repository::shadowedPackages() const { return m_shadowedPackages; } @@ -140,7 +140,12 @@ } } +int compareShadowPair(pair<Package*, Package*>& p1, pair<Package*, Package*>& p2) +{ + return p1.second->name() < p2.second->name(); +} + /*! init repository by reading the directories passed. Doesn't search recursively, so if you want /dir and /dir/subdir checked, you have to @@ -226,7 +231,7 @@ // no such package found, add m_packageMap[name] = p; } else if ( listDuplicate ) { - m_shadowedPackages[name] = make_pair( p, hidden->second ); + m_shadowedPackages.push_back(make_pair( p, hidden->second )); } else { delete p; } @@ -235,7 +240,8 @@ } closedir( d ); } - + + m_shadowedPackages.sort(compareShadowPair); parseDependencyList(); } Modified: tools/prt-get/trunk/src/repository.h =================================================================== --- tools/prt-get/trunk/src/repository.h 2006-09-08 12:17:12 UTC (rev 1837) +++ tools/prt-get/trunk/src/repository.h 2006-09-08 13:53:58 UTC (rev 1838) @@ -34,7 +34,7 @@ const Package* getPackage( const string& name ) const; const map<string, Package*>& packages() const; - const map<string, pair<Package*, Package*> >& shadowedPackages() const; + const list<pair<Package*, Package*> >& shadowedPackages() const; void searchMatchingPackages( const string& pattern, list<Package*>& target, @@ -74,7 +74,7 @@ void parseDependencyList(); - map<string, pair<Package*, Package*> > m_shadowedPackages; + list<pair<Package*, Package*> > m_shadowedPackages; map<string, Package*> m_packageMap; };
participants (1)
-
crux@crux.nu