4 #include <zypp/base/Logger.h>
6 #include <zypp/Package.h>
7 #include <zypp/detail/PackageImpl.h>
8 #include <zypp/CapFactory.h>
9 #include <zypp/CapSet.h>
14 // refine parsing and add it to lib
16 template<typename _Res>
17 struct CapSetInsert : public std::unary_function<const std::string &, void>
21 CapSetInsert( CapSet & x )
24 void operator()( const std::string & v )
25 { _x.insert( _f.parse( ResTraits<_Res>::kind, v ) ); }
28 inline std::list<std::string> parseDeps()
30 const char * init[] = {
31 "xextra:/usr/X11R6/bin/Xvfb"
33 "rpmlib(PayloadFilesHavePrefix) <= 4.0-1",
34 "rpmlib(CompressedFileNames) <= 3.0.4-1",
37 "libc.so.6(GLIBC_2.0)",
38 "libc.so.6(GLIBC_2.3.4)",
41 "rpmlib(PayloadIsBzip2) <= 3.0.5-1",
43 const char ** begin = init;
44 const char ** end = init + ( sizeof(init) / sizeof(const char *) );
46 std::list<std::string> ret( begin, end );
50 /******************************************************************
53 ** FUNCTION NAME : main
54 ** FUNCTION TYPE : int
58 int main( int argc, char * argv[] )
60 INT << "===[START]==========================================" << endl;
62 // Collect basic Resolvable data
66 dataCollect.name = "foo";
67 dataCollect.edition = Edition("1.0","42");
68 dataCollect.arch = Arch_i386;
71 std::list<std::string> depList( parseDeps() );
74 for_each( depList.begin(), depList.end(),
75 CapSetInsert<Package>(dataCollect[Dep::PROVIDES]) );
79 INT << dataCollect[Dep::PROVIDES] << endl;
81 // ...parse other deps
84 detail::ResImplTraits<detail::PackageImpl>::Ptr pkgImpl;
85 Package::Ptr pkg( detail::makeResolvableAndImpl( dataCollect, pkgImpl ) );
87 DBG << pkg->deps() << endl;
90 // finalize implementation class construction
91 // ... aditional data ...
95 DBG << pkg->deps() << endl;
98 INT << "===[END]============================================" << endl;