Replaced requirementIsMet by requirementIsInstalledOrUnneeded
[platform/upstream/libzypp.git] / zypp / solver / detail / Testcase.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/solver/detail/Testcase.cc
10  *
11 */
12 #include "zypp/solver/detail/Testcase.h"
13 #include "zypp/base/Logger.h"
14 #include "zypp/base/LogControl.h"
15 #include "zypp/PathInfo.h"
16
17 /////////////////////////////////////////////////////////////////////////
18 namespace zypp
19 { ///////////////////////////////////////////////////////////////////////
20   ///////////////////////////////////////////////////////////////////////
21   namespace solver
22   { /////////////////////////////////////////////////////////////////////
23     /////////////////////////////////////////////////////////////////////
24     namespace detail
25     { ///////////////////////////////////////////////////////////////////
26
27 using namespace std;
28
29 //---------------------------------------------------------------------------
30
31 Testcase::Testcase()
32     :dumpPath("/var/log/YaST2/solverTestcase")
33 {
34 }
35
36 Testcase::Testcase(const std::string & path)
37     :dumpPath(path)
38 {
39 }
40         
41
42 Testcase::~Testcase()
43 {
44 }
45
46 bool Testcase::createTestcase(Resolver & resolver)
47 {
48     PathInfo path (dumpPath);
49
50     if ( !path.isExist() ) {
51         if (zypp::filesystem::mkdir (dumpPath)!=0) {
52             ERR << "Cannot create directory " << dumpPath << endl;
53             return false;
54         }
55     } else {
56         if (!path.isDir()) {
57             ERR << dumpPath << " is not a directory." << endl;
58             return false;
59         }
60     }
61     zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" );
62     zypp::base::LogControl::TmpExcessive excessive; // ZYPP_FULLLOG=1
63     
64     resolver.resolveDependencies();
65     
66     return true;
67 }
68
69       ///////////////////////////////////////////////////////////////////
70     };// namespace detail
71     /////////////////////////////////////////////////////////////////////
72     /////////////////////////////////////////////////////////////////////
73   };// namespace solver
74   ///////////////////////////////////////////////////////////////////////
75   ///////////////////////////////////////////////////////////////////////
76 };// namespace zypp
77 /////////////////////////////////////////////////////////////////////////