diff options
author | Johannes Winkelmann <jw@smts.ch> | 2006-09-08 13:53:58 +0000 |
---|---|---|
committer | Johannes Winkelmann <jw@smts.ch> | 2006-09-08 13:53:58 +0000 |
commit | 35154af881ca4e0b95eab0fa4ac6fb145eb4d98d (patch) | |
tree | f0e2d391423ed66ef9c5933cfce06d54d8ba9b5e | |
parent | 92ca1807ffcbf4f910a17255fc0ff80db128cda9 (diff) | |
download | prt-get-35154af881ca4e0b95eab0fa4ac6fb145eb4d98d.tar.gz prt-get-35154af881ca4e0b95eab0fa4ac6fb145eb4d98d.tar.xz |
prt-get: show multiple dups in 'dup'
git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1838 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
-rw-r--r-- | src/prtget.cpp | 7 | ||||
-rw-r--r-- | src/repository.cpp | 12 | ||||
-rw-r--r-- | src/repository.h | 4 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/prtget.cpp b/src/prtget.cpp index f40ca8a..01af812 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -277,12 +277,13 @@ void PrtGet::listShadowed() 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()); diff --git a/src/repository.cpp b/src/repository.cpp index e4e9eb5..0616096 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -69,7 +69,7 @@ const map<string, Package*>& Repository::packages() const \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,6 +140,11 @@ void Repository::searchMatchingPackages( const string& pattern, } } +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 @@ -226,7 +231,7 @@ void Repository::initFromFS( const list< pair<string, string> >& rootList, // 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 @@ void Repository::initFromFS( const list< pair<string, string> >& rootList, } closedir( d ); } - + + m_shadowedPackages.sort(compareShadowPair); parseDependencyList(); } diff --git a/src/repository.h b/src/repository.h index 335cc82..df6ca4c 100644 --- a/src/repository.h +++ b/src/repository.h @@ -34,7 +34,7 @@ public: 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 @@ private: void parseDependencyList(); - map<string, pair<Package*, Package*> > m_shadowedPackages; + list<pair<Package*, Package*> > m_shadowedPackages; map<string, Package*> m_packageMap; }; |