diff options
author | Johannes Winkelmann <jw@smts.ch> | 2006-09-08 11:59:57 +0000 |
---|---|---|
committer | Johannes Winkelmann <jw@smts.ch> | 2006-09-08 11:59:57 +0000 |
commit | ea9b462d9876f1a8c5a027d3359cf7055d83bb44 (patch) | |
tree | b977b0e4d8854f45a65a270baf2e1d0b262c7839 /src | |
parent | 261cc30ba2e98394ad4037c6bbded8fb85ae91d9 (diff) | |
download | prt-get-ea9b462d9876f1a8c5a027d3359cf7055d83bb44.tar.gz prt-get-ea9b462d9876f1a8c5a027d3359cf7055d83bb44.tar.xz |
prt-get: allow accessing version and port path in dup format separately
git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1836 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
Diffstat (limited to 'src')
-rw-r--r-- | src/prtget.cpp | 21 | ||||
-rw-r--r-- | src/repository.cpp | 11 | ||||
-rw-r--r-- | src/repository.h | 4 |
3 files changed, 20 insertions, 16 deletions
diff --git a/src/prtget.cpp b/src/prtget.cpp index 7d6f7f6..f40ca8a 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -268,21 +268,28 @@ void PrtGet::listShadowed() initRepo( true ); - string format = "%1 > %2\n"; + string format = "%p1 %v1 > %p2 %v2\n"; if (m_parser->otherArgs().size() > 0) format = *(m_parser->otherArgs().begin()); else if (m_parser->verbose() > 0) - format = "* %n\n %1 preceeds over \n %2\n"; + format = "* %n\n %p1 %v1 preceeds over \n %p2 %v2\n"; string output; - map<string, pair<string, string> >::const_iterator it = + Package* p1; + Package* p2; + map<string, pair<Package*, Package*> >::const_iterator it = m_repo->shadowedPackages().begin(); for ( ; it != m_repo->shadowedPackages().end(); ++it ) { output = format; - StringHelper::replaceAll(output, "%n", it->first); - StringHelper::replaceAll(output, "%1", it->second.second); - StringHelper::replaceAll(output, "%2", it->second.first); - + p1 = it->second.second; + p2 = it->second.first; + + StringHelper::replaceAll(output, "%n", p1->name()); + StringHelper::replaceAll(output, "%p1", p1->path() + "/" + p1->name()); + StringHelper::replaceAll(output, "%p2", p2->path() + "/" + p2->name()); + StringHelper::replaceAll(output, "%v1", p1->versionReleaseString()); + StringHelper::replaceAll(output, "%v2", p2->versionReleaseString()); + StringHelper::replaceAll(output, "\\n", "\n"); cout << output; } diff --git a/src/repository.cpp b/src/repository.cpp index f914118..e4e9eb5 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<string, string> >& Repository::shadowedPackages() const +const map<string, pair<Package*, Package*> >& Repository::shadowedPackages() const { return m_shadowedPackages; } @@ -226,12 +226,9 @@ void Repository::initFromFS( const list< pair<string, string> >& rootList, // no such package found, add m_packageMap[name] = p; } else if ( listDuplicate ) { - Package* old = hidden->second; - string ps = p->path() + "/" + p->name() + - " " + p->versionReleaseString(); - string os = old->path() + "/" + old->name() + - " " + old->versionReleaseString(); - m_shadowedPackages[name] = make_pair( ps, os ); + m_shadowedPackages[name] = make_pair( p, hidden->second ); + } else { + delete p; } } } diff --git a/src/repository.h b/src/repository.h index 2f0ce7a..335cc82 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<string, string> >& shadowedPackages() const; + const map<string, pair<Package*, Package*> >& shadowedPackages() const; void searchMatchingPackages( const string& pattern, list<Package*>& target, @@ -74,7 +74,7 @@ private: void parseDependencyList(); - map<string, pair<string, string> > m_shadowedPackages; + map<string, pair<Package*, Package*> > m_shadowedPackages; map<string, Package*> m_packageMap; }; |