r1836 - in tools/prt-get/trunk: doc src
Author: jw Date: 2006-09-08 13:59:57 +0200 (Fri, 08 Sep 2006) New Revision: 1836 Modified: tools/prt-get/trunk/doc/prt-get.8 tools/prt-get/trunk/src/prtget.cpp tools/prt-get/trunk/src/repository.cpp tools/prt-get/trunk/src/repository.h Log: prt-get: allow accessing version and port path in dup format separately Modified: tools/prt-get/trunk/doc/prt-get.8 =================================================================== --- tools/prt-get/trunk/doc/prt-get.8 2006-09-08 11:35:06 UTC (rev 1835) +++ tools/prt-get/trunk/doc/prt-get.8 2006-09-08 11:59:57 UTC (rev 1836) @@ -236,13 +236,22 @@ .TP \ \ \ \(bu -%1 \-> Port which takes precedence +%p1 \-> Full path (including name) to port taking precendence .TP \ \ \ \(bu -%2 \-> Port which is hidden +%p2 \-> Full path (including name) to port being hidden .TP +\ \ \ \(bu +%v1 \-> Version of port taking precendence + +.TP +\ \ \ \(bu +%v2 \-> Version of port being hidden + + +.TP .B list [\-v|\-vv] [filter] [--path] [--regex] List ports available in the ports tree. It's basically the same as .B ports \-l Modified: tools/prt-get/trunk/src/prtget.cpp =================================================================== --- tools/prt-get/trunk/src/prtget.cpp 2006-09-08 11:35:06 UTC (rev 1835) +++ tools/prt-get/trunk/src/prtget.cpp 2006-09-08 11:59:57 UTC (rev 1836) @@ -268,21 +268,28 @@ 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; } Modified: tools/prt-get/trunk/src/repository.cpp =================================================================== --- tools/prt-get/trunk/src/repository.cpp 2006-09-08 11:35:06 UTC (rev 1835) +++ tools/prt-get/trunk/src/repository.cpp 2006-09-08 11:59:57 UTC (rev 1836) @@ -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<string, string> >& Repository::shadowedPackages() const +const map<string, pair<Package*, Package*> >& Repository::shadowedPackages() const { return m_shadowedPackages; } @@ -226,12 +226,9 @@ // 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; } } } Modified: tools/prt-get/trunk/src/repository.h =================================================================== --- tools/prt-get/trunk/src/repository.h 2006-09-08 11:35:06 UTC (rev 1835) +++ tools/prt-get/trunk/src/repository.h 2006-09-08 11:59:57 UTC (rev 1836) @@ -34,7 +34,7 @@ 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 @@ void parseDependencyList(); - map<string, pair<string, string> > m_shadowedPackages; + map<string, pair<Package*, Package*> > m_shadowedPackages; map<string, Package*> m_packageMap; };
participants (1)
-
crux@crux.nu