Author: dmacvicar
Date: Tue Jul 31 16:31:42 2007
New Revision: 6335
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6335&view=rev
Log:
- add error reporting to track bug.
- add a parse from file accessor to remove the
amazing duplicated code to parse from memory
Modified:
trunk/libzypp-testsuite/solver/src/deptestomatic.cc
trunk/libzypp-testsuite/src/helix/Buffer.cc
trunk/libzypp-testsuite/src/helix/Buffer.h
trunk/libzypp-testsuite/src/helix/HelixExtract.cc
trunk/libzypp-testsuite/src/helix/HelixExtract.h
trunk/libzypp-testsuite/src/helix/HelixParser.cc
trunk/libzypp-testsuite/src/helix/HelixParser.h
trunk/libzypp-testsuite/src/helix/HelixSourceImpl.cc
Modified: trunk/libzypp-testsuite/solver/src/deptestomatic.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/solver/src/deptestomatic.cc?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/solver/src/deptestomatic.cc (original)
+++ trunk/libzypp-testsuite/solver/src/deptestomatic.cc Tue Jul 31 16:31:42 2007
@@ -785,7 +785,8 @@
if (type == "url") {
try {
cout << "Load from Url '" << filename << "'" << endl;
-
+ MIL << "Load from Url '" << filename << "'" << endl;
+
RepoInfo nrepo;
nrepo
.setAlias ( alias )
@@ -809,7 +810,8 @@
else {
try {
cout << "Load from File '" << pathname << "'" << endl;
-
+ MIL << "Load from File '" << pathname << "'" << endl;
+
RepoInfo nrepo;
nrepo
.setAlias ( alias )
@@ -819,8 +821,9 @@
.addBaseUrl ( pathname.asUrl() );
zypp::repo::RepositoryImpl_Ptr impl( new HelixSourceImpl( nrepo ) );
-
+
repo = Repository( impl );
+ repo.resolvables();
}
catch ( Exception & excpt_r ) {
ZYPP_CAUGHT (excpt_r);
Modified: trunk/libzypp-testsuite/src/helix/Buffer.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/Buffer.cc?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/Buffer.cc (original)
+++ trunk/libzypp-testsuite/src/helix/Buffer.cc Tue Jul 31 16:31:42 2007
@@ -44,7 +44,7 @@
using namespace std;
-
+using namespace zypp;
//---------------------------------------------------------------------------
// compress/uncompress stuff
@@ -472,7 +472,7 @@
*/
Buffer *
-bufferMapFile (const string & filename)
+bufferMapFile (const Pathname & filename)
{
struct stat s;
int fd;
Modified: trunk/libzypp-testsuite/src/helix/Buffer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/Buffer.h?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/Buffer.h (original)
+++ trunk/libzypp-testsuite/src/helix/Buffer.h Tue Jul 31 16:31:42 2007
@@ -28,7 +28,7 @@
#define BUFFER_H
#include
-#include <string>
+#include
typedef unsigned char byte;
@@ -46,12 +46,12 @@
bool is_mmapped;
} Buffer;
-Buffer *bufferMapFile (const std::string & filename);
+Buffer *bufferMapFile (const zypp::Pathname & filename);
void bufferUnmapFile (Buffer *buffer);
xmlDoc *parseXmlFromBuffer (const char *input_buffer, size_t input_length);
-xmlDoc *parseXmlFromFile (const std::string & filename);
+xmlDoc *parseXmlFromFile (const zypp::Pathname & filename);
#endif // BUFFER_H
Modified: trunk/libzypp-testsuite/src/helix/HelixExtract.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/HelixExtract.cc?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/HelixExtract.cc (original)
+++ trunk/libzypp-testsuite/src/helix/HelixExtract.cc Tue Jul 31 16:31:42 2007
@@ -37,6 +37,8 @@
int
extractHelixBuffer (const char *buf, size_t len, HelixSourceImpl *impl)
{
+ ZYPP_THROW(Exception("I disabled this crap. dmacvicar"));
+
MIL << "extractHelixBuffer()" << endl;
if (buf == NULL || len == 0)
@@ -51,9 +53,10 @@
int
-extractHelixFile (const std::string & filename, HelixSourceImpl *impl)
+extractHelixFile (const Pathname & filename, HelixSourceImpl *impl)
{
- MIL << "extractHelixFile(" << filename << ")" << endl;
+
+ MIL << "'" << filename << "'" << endl;
Buffer *buf;
Modified: trunk/libzypp-testsuite/src/helix/HelixExtract.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/HelixExtract.h?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/HelixExtract.h (original)
+++ trunk/libzypp-testsuite/src/helix/HelixExtract.h Tue Jul 31 16:31:42 2007
@@ -38,7 +38,7 @@
class HelixSourceImpl;
int extractHelixBuffer (const char *data, size_t len, HelixSourceImpl *impl);
-int extractHelixFile (const std::string & filename, HelixSourceImpl *impl);
+int extractHelixFile (const Pathname & filename, HelixSourceImpl *impl);
}
Modified: trunk/libzypp-testsuite/src/helix/HelixParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/HelixParser.cc?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/HelixParser.cc (original)
+++ trunk/libzypp-testsuite/src/helix/HelixParser.cc Tue Jul 31 16:31:42 2007
@@ -347,7 +347,7 @@
void
HelixParser::parseChunk(const char *xmlbuf, size_t size, HelixSourceImpl *impl)
{
-// _DBG("HelixParser") << "HelixParser::parseChunk(" << xmlbuf << "...," << (long)size << ")" << endl;
+ MIL << " << buffer size: " << (long)size << "" << endl;
xmlSubstituteEntitiesDefault(true);
@@ -360,6 +360,20 @@
xmlParseChunk(_xml_context, xmlbuf, size, 0);
}
+void HelixParser::parseFile (const Pathname &p, HelixSourceImpl *impl)
+{
+ MIL << endl;
+
+ xmlSubstituteEntitiesDefault(true);
+
+ if (!_xml_context) {
+ _xml_context = xmlCreatePushParserCtxt(&sax_handler, this, NULL, 0, NULL);
+ }
+
+ _impl = impl;
+
+ xmlParseFile(p.c_str());
+}
void
HelixParser::done()
Modified: trunk/libzypp-testsuite/src/helix/HelixParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/HelixParser.h?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/HelixParser.h (original)
+++ trunk/libzypp-testsuite/src/helix/HelixParser.h Tue Jul 31 16:31:42 2007
@@ -144,6 +144,7 @@
void endElement(const std::string & token);
void parseChunk (const char *xmlbuf, size_t size, HelixSourceImpl *impl);
+ void parseFile (const Pathname &p, HelixSourceImpl *impl);
void done (void);
private:
Modified: trunk/libzypp-testsuite/src/helix/HelixSourceImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/src/helix/HelixSourceImpl.cc?rev=6335&r1=6334&r2=6335&view=diff
==============================================================================
--- trunk/libzypp-testsuite/src/helix/HelixSourceImpl.cc (original)
+++ trunk/libzypp-testsuite/src/helix/HelixSourceImpl.cc Tue Jul 31 16:31:42 2007
@@ -54,8 +54,16 @@
{
_source = Repository(this);
- MIL << "HelixSourceImpl::createResolvables(" << _pathname << ", for source " << _source.info().alias() << ")" << endl;
- extractHelixFile (_pathname.asString(), this);
+ MIL << " (" << _pathname << ", for source " << _source.info().alias() << ")" << endl;
+
+ if ( ! PathInfo(_pathname).isExist() )
+ ZYPP_THROW(Exception(_pathname.asString() + " does not exist"));
+
+ if ( extractHelixFile(_pathname, this) != 0 )
+ ZYPP_THROW(Exception("Error in extractHelixFile"));
+
+ MIL << "store sze: " << _store.size() << endl;
+ //MIL << " N: " << resolvables().size() << endl;
}
@@ -302,6 +310,7 @@
void
HelixSourceImpl::parserCallback (const HelixParser & parsed)
{
+ MIL << endl;
try {
if (parsed.kind == ResTraits<Package>::kind) {
Package::Ptr p = createPackage (parsed);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org