# Do NOT list 'devel' in subdirs. It's developers playgound
# and must not prevent anything from building.
-SUBDIRS = zypp zypp2 testsuite po doc
+SUBDIRS = zypp zypp2 examples testsuite po doc
## ##################################################
testsuite/target/tests/Makefile \
testsuite/media/Makefile \
testsuite/media/tests/Makefile \
- zypp/Makefile \
+ examples/Makefile \
+ zypp/Makefile \
zypp/base/Makefile \
zypp/thread/Makefile \
zypp/detail/Makefile \
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <streambuf>
-
-#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
-#include "boost/filesystem/fstream.hpp" // ditto
-
-#include <boost/iostreams/device/file_descriptor.hpp>
-
#include <zypp/base/Logger.h>
-#include <zypp/Locale.h>
#include <zypp/ZYpp.h>
#include <zypp/ZYppFactory.h>
-#include <zypp/TranslatedText.h>
-///////////////////////////////////////////////////////////////////
-
-#include <zypp/base/Logger.h>
-
-#include <map>
-#include <set>
-
-#include "zypp/CapFactory.h"
-#include "zypp/KeyRing.h"
#include "zypp/Product.h"
-#include "zypp/Selection.h"
#include "zypp/Package.h"
-#include "zypp/PublicKey.h"
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/MediaSetAccess.h"
#include "zypp/SourceFactory.h"
-#include "zypp2/source/yum/YUMSourceCacher.h"
-
#include "testsuite/src/utils/TestUtils.h"
using namespace zypp::detail;
zypp::Package::Ptr res = asKind<zypp::Package>( *it );
MIL << res->name() << " " << res->edition() << " " << res->location() << std::endl;
}
-
- /*for (ResStore::resfilter_const_iterator it = z->target()->byKindBegin(ResTraits<TestKind>::kind); it != z->target()->byKindEnd(ResTraits<TestKind>::kind); ++it)
- {
- zypp::TestKind::constPtr res = asKind<const zypp::TestKind>( *it );
- MIL << res->name() << " " << res->edition() << std::endl;
- }*/
-
+
}
catch ( const Exception &e )
{
--- /dev/null
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+noinst_PROGRAMS = read_plaindir_source
+
+## ##################################################
+
+INCLUDES = -I$(oldincludedir)/libxml2
+AM_LDFLAGS =
+
+AM_CXXFLAGS =
+# gperf: -pg
+
+LDADD = -L$(top_srcdir)/zypp/.libs -lzypp -lboost_regex -lxml2 -lz $(top_srcdir)/testsuite/src/utils/lib@PACKAGE@_testsuite_utils.la
+
+## ##################################################
+
+read_plaindir_source_SOURCES = read_plaindir_source.cc
+read_plaindir_source_LDFLAGS = -static
+
+.PHONY: always
+
+$(noinst_PROGRAMS): $(top_srcdir)/zypp/lib@PACKAGE@.la
+
+$(top_srcdir)/zypp/lib@PACKAGE@.la: always
+ $(MAKE) -C $(top_srcdir)/zypp
+
+## ##################################################
--- /dev/null
+
+ZyPP Examples
+=============
+
+* read_plaindir_source.cc
+ Read a sirectory with rpm files (no metadata) and loop over the resolvables.
+
+
\ No newline at end of file
--- /dev/null
+// ZyPP Example
+// Read a directory with rpms as a source
+// No need for metadata, it is read from the rpms
+
+#include <zypp/base/Logger.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+
+#include "zypp/Product.h"
+#include "zypp/Package.h"
+
+#include "zypp/SourceFactory.h"
+#include "testsuite/src/utils/TestUtils.h"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::source;
+
+int
+main (int argc, char **argv)
+{
+ if (argc < 2) {
+ cerr << "1|usage: " << argv[0] << " <dir:/somepath>" << endl;
+ return 1;
+ }
+
+ try
+ {
+ ZYpp::Ptr z = getZYpp();
+
+ // plaindir sources are not signed so we don't need to initialize the
+ // target to import the system public keys.
+ //z->initializeTarget("/");
+
+ Source_Ref source = SourceFactory().createFrom( Url(argv[1]), "/", "testsource", Pathname() );
+ ResStore store = source.resolvables();
+ //zypp::testsuite::utils::dump(store, true, true);
+
+ for (ResStore::const_iterator it = store.begin(); it != store.end(); ++it)
+ {
+ zypp::Package::Ptr res = asKind<zypp::Package>( *it );
+ MIL << res->name() << " " << res->edition() << " " << res->location() << std::endl;
+ }
+
+ }
+ catch ( const Exception &e )
+ {
+ MIL << "Exception ocurred, bye" << endl;
+ }
+}
+
+
+