ref: refs/heads/ma-tmp-pqt
commit 96d9a1f5c35f8ae5a53f298eadfd33ad23e73b48
Author: Michael Andres
Date: Tue Apr 14 15:27:39 2009 +0200
backup
---
devel/devel.ma/NewPool.cc | 4 +-
devel/devel.ma/Test.cc | 104 +++------------------------------------------
2 files changed, 9 insertions(+), 99 deletions(-)
diff --git a/devel/devel.ma/NewPool.cc b/devel/devel.ma/NewPool.cc
index af44b4b..0bc829c 100644
--- a/devel/devel.ma/NewPool.cc
+++ b/devel/devel.ma/NewPool.cc
@@ -614,8 +614,8 @@ try {
//querycompare( q );
q.addString(search);
- //q.addAttribute(sat::SolvAttr::name, "foo" );
- q.addAttribute(sat::SolvAttr::summary);
+ q.addAttribute(sat::SolvAttr::name, "foo" );
+ //q.addAttribute(sat::SolvAttr::summary);
q.setMatchSubstring();
//q.setMatchExact();
q.setCaseSensitive( true );
diff --git a/devel/devel.ma/Test.cc b/devel/devel.ma/Test.cc
index 05cafb8..646fb69 100644
--- a/devel/devel.ma/Test.cc
+++ b/devel/devel.ma/Test.cc
@@ -4,74 +4,7 @@
#include
#include
-static std::string pidAndAppname()
-{
- static std::string _val;
- if ( _val.empty() )
- {
- pid_t mypid = getpid();
- Pathname p( "/proc/"+str::numstring(mypid)+"/exe" );
- Pathname myname( filesystem::readlink( p ) );
-
- _val += str::numstring(mypid);
- _val += ":";
- _val += myname.basename();
- }
- return _val;
-}
-
-bool solve()
-{
- static unsigned run = 0;
- USR << "Solve " << run++ << endl;
- bool rres = false;
- {
- //zypp::base::LogControl::TmpLineWriter shutUp;
- getZYpp()->resolver()->setOnlyRequires( true );
- getZYpp()->resolver()->setIgnoreAlreadyRecommended( true );
- rres = getZYpp()->resolver()->resolvePool();
- }
- if ( ! rres )
- {
- ERR << "resolve " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
-
- return true;
-}
-
-typedef sat::ArrayAttrstd::string,std::string FileList;
-
-#include "zypp/base/IOStream.h"
-bool isProcessRunning(pid_t pid_r)
-{
- std::string _locker_name;
- // it is another program, not me, see if it is still running
- Pathname procdir( Pathname("/proc")/str::numstring(pid_r) );
- PathInfo status( procdir );
- MIL << "Checking " << status << endl;
-
- if ( ! status.isDir() )
- {
- DBG << "No such process." << endl;
- return false;
- }
-
- static char buffer[513];
- buffer[0] = buffer[512] = 0;
- // man proc(5): /proc/[pid]/cmdline is empty if zombie.
- if ( std::ifstream( (procdir/"cmdline").c_str() ).read( buffer, 512 ).gcount() > 0 )
- {
- _locker_name = buffer;
- DBG << "Is running: " << _locker_name << endl;
- return true;
- }
-
- DBG << "In zombie state." << endl;
- return false;
- }
-
+static TestSetup test( Arch_x86_64 ); // use x86_64 as system arch
/******************************************************************
**
@@ -81,40 +14,17 @@ bool isProcessRunning(pid_t pid_r)
int main( int argc, char * argv[] )
{
INT << "===[START]==========================================" << endl;
+ test.loadRepo( "/Local/ROOT/cache/solv/@System/solv" );
- INT << isProcessRunning( 26992 ) << endl;
- INT << isProcessRunning( getpid() ) << endl;;
- INT << isProcessRunning( 10430 ) << endl;
- INT << isProcessRunning( 55 ) << endl;
- INT << "===[END]============================================" << endl << endl;
- return 0;
-
-
- Pathname mroot( "/tmp/ToolScanRepos" );
- TestSetup test( mroot, Arch_i686, TSO_CLEANROOT );
- test.loadRepo( "/schnell/CD-ARCHIVE/11.1/FTP" );
- test.loadRepo( "/suse/ma/bug-481836_test.solv" );
- //test.loadRepos();
-
- ResPool pool( test.pool() );
- Resolver & resolver( test.resolver() );
+ PoolQuery q;
+ q.addString("foo*|k?");
+ q.setMatchRegex();
- //dumpRange( USR, pool.begin(), pool.end() );
-
- resolver.addRequire( Capability("filesystem") );
- resolver.addRequire( Capability("glibc-locale") );
- resolver.addRequire( Capability("glibc.i586 = 2.9-2.8") );
- resolver.addRequire( Capability("xorg-x11-driver-video-openchrome") );
- resolver.addRequire( Capability("zypper") );
-
- if ( solve() )
+ for_( it, q.nbegin(), q.nend() )
{
- vdumpPoolStats( USR << "Transacting:"<< endl,
- make_filter_beginresfilter::ByTransact(pool),
- make_filter_endresfilter::ByTransact(pool) ) << endl;
+ ;
}
-
INT << "===[END]============================================" << endl << endl;
return 0;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org