Hello community,
here is the log from the commit of package libzypp-zmd-backend
checked in at Wed Jun 14 13:23:21 CEST 2006.
--------
--- libzypp-zmd-backend/libzypp-zmd-backend.changes 2006-06-09 14:37:38.000000000 +0200
+++ libzypp-zmd-backend/libzypp-zmd-backend.changes 2006-06-13 16:09:16.000000000 +0200
@@ -1,0 +2,22 @@
+Tue Jun 13 13:01:50 CEST 2006 - kkaempf@suse.de
+
+- log all exceptions to stderr as a single line (#180382)
+- no context means nothing to transact (#183854)
+- check _media_set being NULL (#184154)
+- ensure proper URL passed to service-delete (#183211)
+- do a media change request for cd or dvd only (#183315)
+- rev 3610
+
+-------------------------------------------------------------------
+Mon Jun 12 16:39:08 CEST 2006 - kkaempf@suse.de
+
+- only restore sources if needed (#176301)
+- rev 3596
+
+-------------------------------------------------------------------
+Mon Jun 12 12:21:53 CEST 2006 - kkaempf@suse.de
+
+- fix message format to stdout/stderr (#180382)
+- rev 3579
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libzypp-zmd-backend.spec ++++++
--- /var/tmp/diff_new_pack.yfH8Dd/_old 2006-06-14 13:19:25.000000000 +0200
+++ /var/tmp/diff_new_pack.yfH8Dd/_new 2006-06-14 13:19:25.000000000 +0200
@@ -22,7 +22,7 @@
Obsoletes: zmd-librc-backend
Summary: ZMD backend for Package, Patch, Pattern, and Product Management
Version: 7.1.1.0
-Release: 56
+Release: 57
Source: zmd-backend-%{version}.tar.bz2
Prefix: /usr
@@ -68,6 +68,19 @@
/etc/logrotate.d/zmd-backend
%changelog -n libzypp-zmd-backend
+* Tue Jun 13 2006 - kkaempf@suse.de
+- log all exceptions to stderr as a single line (#180382)
+- no context means nothing to transact (#183854)
+- check _media_set being NULL (#184154)
+- ensure proper URL passed to service-delete (#183211)
+- do a media change request for cd or dvd only (#183315)
+- rev 3610
+* Mon Jun 12 2006 - kkaempf@suse.de
+- only restore sources if needed (#176301)
+- rev 3596
+* Mon Jun 12 2006 - kkaempf@suse.de
+- fix message format to stdout/stderr (#180382)
+- rev 3579
* Fri Jun 09 2006 - kkaempf@suse.de
- strip line breaks from exception strings (#181039)
- rev 3560
++++++ zmd-backend-7.1.1.0.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/KeyRingCallbacks.h new/zmd-backend-7.1.1.0/src/KeyRingCallbacks.h
--- old/zmd-backend-7.1.1.0/src/KeyRingCallbacks.h 2006-05-30 12:36:16.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/KeyRingCallbacks.h 2006-06-13 11:37:18.000000000 +0200
@@ -17,11 +17,16 @@
#include <iostream>
#include
+#include
#include
#include
#include
#include
+
+#define SECURITYPATH "/etc/sysconfig/security"
+#define SECURITYTAG "CHECK_SIGNATURES"
+
///////////////////////////////////////////////////////////////////
namespace zypp {
///////////////////////////////////////////////////////////////////
@@ -45,6 +50,7 @@
if (c == '1')
result = true;
}
+ DBG << "answer " << result << std::endl;
return result;
}
@@ -54,26 +60,42 @@
///////////////////////////////////////////////////////////////////
struct KeyRingReceive : public zypp::callback::ReceiveReportzypp::KeyRingReport
{
+ bool _enabled;
+ KeyRingReceive()
+ : _enabled( true )
+ {
+ }
+
+ void disable( bool value )
+ {
+ _enabled = !value;
+ MIL << "KeyRingReceive is now " << (_enabled ? "en" : "dis") << "abled." << std::endl;
+ }
+
virtual bool askUserToAcceptUnsignedFile( const std::string &file )
{
+ if (!_enabled) return true;
DBG << "21|" << file << std::endl;
std::cout << "21|" << file << std::endl;
return readCallbackAnswer();
}
virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &keyid, const std::string &keyname, const std::string &fingerprint )
{
+ if (!_enabled) return true;
DBG << "22|" << file << "|" << keyid << "|" << keyname << "|" << fingerprint << std::endl;
std::cout << "22|" << file << "|" << keyid << "|" << keyname << "|" << fingerprint << std::endl;
return readCallbackAnswer();
}
virtual bool askUserToTrustKey( const std::string &keyid, const std::string &keyname, const std::string &fingerprint )
{
+ if (!_enabled) return true;
DBG << "23|" << keyid << "|" << keyname << "|" << fingerprint << std::endl;
std::cout << "23|" << keyid << "|" << keyname << "|" << fingerprint << std::endl;
return readCallbackAnswer();
}
virtual bool askUserToAcceptVerificationFailed( const std::string &file, const std::string &keyid, const std::string &keyname, const std::string &fingerprint )
{
+ if (!_enabled) return true;
DBG << "24|" << file << "|" << keyid << "|" << keyname << "|" << fingerprint << std::endl;
std::cout << "24|" << file << "|" << keyid << "|" << keyname << "|" << fingerprint << std::endl;
return readCallbackAnswer();
@@ -83,20 +105,35 @@
struct DigestReceive : public zypp::callback::ReceiveReportzypp::DigestReport
{
+ bool _enabled;
+ DigestReceive()
+ : _enabled( true )
+ {
+ }
+
+ void disable( bool value )
+ {
+ _enabled = !value;
+ MIL << "DigestReceive is now " << (_enabled ? "en" : "dis") << "abled." << std::endl;
+ }
+
virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file )
{
+ if (!_enabled) return true;
DBG << "25|" << file << std::endl;
std::cout << "25|" << file << std::endl;
return readCallbackAnswer();
}
virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name )
{
+ if (!_enabled) return true;
DBG << "26|" << file << "|" << name << std::endl;
std::cout << "26|" << file << "|" << name << std::endl;
return readCallbackAnswer();
}
virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found )
{
+ if (!_enabled) return true;
DBG << "27|" << file << "|" << requested << "|" << found << std::endl;
std::cout << "27|" << file << "|" << requested << "|" << found << std::endl;
return readCallbackAnswer();
@@ -115,6 +152,11 @@
public:
KeyRingCallbacks()
{
+ std::mapstd::string,std::string data = zypp::base::sysconfig::read( SECURITYPATH );
+ std::mapstd::string,std::string::const_iterator it = data.find( SECURITYTAG );
+ if (it != data.end())
+ _keyRingReport.disable( it->second != "yes" );
+
_keyRingReport.connect();
}
@@ -133,6 +175,11 @@
public:
DigestCallbacks()
{
+ std::mapstd::string,std::string data = zypp::base::sysconfig::read( SECURITYPATH );
+ std::mapstd::string,std::string::const_iterator it = data.find( SECURITYTAG );
+ if (it != data.end())
+ _digestReport.disable( it->second != "yes" );
+
_digestReport.connect();
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/MediaChangeCallback.h new/zmd-backend-7.1.1.0/src/MediaChangeCallback.h
--- old/zmd-backend-7.1.1.0/src/MediaChangeCallback.h 2006-05-31 10:27:32.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/MediaChangeCallback.h 2006-06-13 15:07:25.000000000 +0200
@@ -15,6 +15,8 @@
#include <iostream>
+#include "dbsource/utils.h"
+
#include
#include
#include
@@ -48,6 +50,17 @@
DBG << "requestMedia(" << source << ", " << mediumNr << ", " << error << ", " << description << ")" << endl;
+ string scheme( source.url().getScheme() );
+
+ // if its not CD or DVD, report as normal error and abort
+
+ if (scheme != "cd"
+ && scheme != "dvd")
+ {
+ cerr << "1|Error accessing package: " << error << " (" << joinlines( description ) << ")" << endl;
+ mediumNr = 0; // force abort
+ }
+
if (mediumNr > 0) {
// request media via stdout
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/DbAccess.cc new/zmd-backend-7.1.1.0/src/dbsource/DbAccess.cc
--- old/zmd-backend-7.1.1.0/src/dbsource/DbAccess.cc 2006-06-06 13:06:45.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/dbsource/DbAccess.cc 2006-06-12 12:09:54.000000000 +0200
@@ -455,13 +455,13 @@
|| _db == NULL)
{
ERR << "Can not open SQL database: " << sqlite3_errmsg (_db) << endl;
- cerr << "Can't open " << _dbfile << endl;
+ cerr << "1|Can't open " << _dbfile << endl;
return false;
}
if (for_writing) {
if (!prepareWrite()) {
- cerr << "Can't prepare sql access handles" << endl;
+ cerr << "1|Can't prepare sql access handles" << endl;
return false;
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/DbSourceImpl.cc new/zmd-backend-7.1.1.0/src/dbsource/DbSourceImpl.cc
--- old/zmd-backend-7.1.1.0/src/dbsource/DbSourceImpl.cc 2006-05-12 12:13:25.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/dbsource/DbSourceImpl.cc 2006-06-13 13:50:48.000000000 +0200
@@ -55,9 +55,14 @@
try {
media::MediaManager media_mgr;
MIL << "Adding no media verifier" << endl;
- media::MediaAccessId _media = _media_set->getMediaAccessId(1);
- media_mgr.delVerifier( _media);
- media_mgr.addVerifier( _media, media::MediaVerifierRef( new media::NoVerifier()));
+ if (_media_set == NULL) {
+ WAR << "_media_set is NULL" << endl;
+ }
+ else {
+ media::MediaAccessId _media = _media_set->getMediaAccessId(1);
+ media_mgr.delVerifier( _media);
+ media_mgr.addVerifier( _media, media::MediaVerifierRef( new media::NoVerifier()));
+ }
}
catch (const Exception & excpt_r)
{
@@ -77,13 +82,13 @@
void
DbSourceImpl::attachIdMap (IdMap *idmap)
{
- _idmap = idmap;
+ _idmap = idmap;
}
void
DbSourceImpl::attachZyppSource(zypp::Source_Ref source)
{
- _zyppsource = source;
+ _zyppsource = source;
}
//-----------------------------------------------------------------------------
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/DbSources.cc new/zmd-backend-7.1.1.0/src/dbsource/DbSources.cc
--- old/zmd-backend-7.1.1.0/src/dbsource/DbSources.cc 2006-06-07 16:12:22.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/dbsource/DbSources.cc 2006-06-13 11:53:51.000000000 +0200
@@ -31,6 +31,7 @@
#include "zypp/media/MediaManager.h"
+#include "utils.h"
#include "DbSources.h"
#include "DbSourceImpl.h"
#include
@@ -93,6 +94,8 @@
// actually create sources from catalogs table
// if zypp_restore == true, match catalogs entries with actual zypp sources
// and return zypp source on match
+// this is needed by the 'transact' helper
+//
// else create dummy file:/ source since a real source is either not needed
// or files are provided by zmd
//
@@ -121,6 +124,7 @@
sqlite3_stmt *handle = NULL;
int rc = sqlite3_prepare (_db, query, -1, &handle, NULL);
if (rc != SQLITE_OK) {
+ cerr << "1|Can not read 'channels': " << sqlite3_errmsg (_db) << endl;
ERR << "Can not read 'channels': " << sqlite3_errmsg (_db) << endl;
return _sources;
}
@@ -128,13 +132,17 @@
media::MediaManager mmgr;
_smgr = SourceManager::sourceManager();
- try {
- _smgr->restore("/");
- }
- catch (Exception & excpt_r) {
- ZYPP_CAUGHT (excpt_r);
- ERR << "Couldn't restore sources" << endl;
- return _sources;
+ // restore zypp cache only if needed (e.g. by transact helper)
+
+ if (zypp_restore) {
+ try {
+ _smgr->restore("/");
+ }
+ catch (Exception & excpt_r) {
+ cerr << "2|Can't restore sources: " << joinlines( excpt_r.asUserString() ) << endl;
+ ZYPP_CAUGHT (excpt_r);
+ ERR << "Couldn't restore all sources" << endl;
+ }
}
@@ -146,7 +154,6 @@
// local Url. See #176964
media::MediaId mediaid = mmgr.open( Url( "file:/" ) );
-
SourceFactory factory;
// read catalogs table
@@ -248,6 +255,7 @@
_sources.push_back( src );
}
catch (Exception & excpt_r) {
+ cerr << "2|Can't restore sources: " << joinlines( excpt_r.asUserString() ) << endl;
ZYPP_CAUGHT(excpt_r);
ERR << "Couldn't create zmd source" << endl;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/Makefile.am new/zmd-backend-7.1.1.0/src/dbsource/Makefile.am
--- old/zmd-backend-7.1.1.0/src/dbsource/Makefile.am 2006-05-12 12:13:25.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/dbsource/Makefile.am 2006-06-13 11:50:19.000000000 +0200
@@ -9,7 +9,8 @@
pkginclude_HEADERS = \
DbSources.h \
- DbAccess.h
+ DbAccess.h \
+ utils.h
noinst_HEADERS = \
DbSourceImpl.h \
@@ -35,7 +36,8 @@
DbPatternImpl.cc \
DbProductImpl.cc \
DbSources.cc \
- DbAccess.cc
+ DbAccess.cc \
+ utils.cc
lib@PACKAGE@_la_LDFLAGS = @BACKEND_VERSION_INFO@
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/Makefile.in new/zmd-backend-7.1.1.0/src/dbsource/Makefile.in
--- old/zmd-backend-7.1.1.0/src/dbsource/Makefile.in 2006-05-30 12:12:37.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/dbsource/Makefile.in 2006-06-13 11:53:54.000000000 +0200
@@ -65,7 +65,7 @@
am_lib@PACKAGE@_la_OBJECTS = DbSourceImpl.lo DbPackageImpl.lo \
DbAtomImpl.lo DbScriptImpl.lo DbMessageImpl.lo \
DbLanguageImpl.lo DbPatchImpl.lo DbPatternImpl.lo \
- DbProductImpl.lo DbSources.lo DbAccess.lo
+ DbProductImpl.lo DbSources.lo DbAccess.lo utils.lo
lib@PACKAGE@_la_OBJECTS = $(am_lib@PACKAGE@_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -235,7 +235,8 @@
pkginclude_HEADERS = \
DbSources.h \
- DbAccess.h
+ DbAccess.h \
+ utils.h
noinst_HEADERS = \
DbSourceImpl.h \
@@ -260,7 +261,8 @@
DbPatternImpl.cc \
DbProductImpl.cc \
DbSources.cc \
- DbAccess.cc
+ DbAccess.cc \
+ utils.cc
lib@PACKAGE@_la_LDFLAGS = @BACKEND_VERSION_INFO@
all: all-am
@@ -343,6 +345,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DbScriptImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DbSourceImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DbSources.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/utils.cc new/zmd-backend-7.1.1.0/src/dbsource/utils.cc
--- old/zmd-backend-7.1.1.0/src/dbsource/utils.cc 1970-01-01 01:00:00.000000000 +0100
+++ new/zmd-backend-7.1.1.0/src/dbsource/utils.cc 2006-06-13 11:51:46.000000000 +0200
@@ -0,0 +1,17 @@
+//
+// utils.cc
+//
+// utility functions for zmd backend helpers
+//
+
+#include <string>
+#include <vector>
+#include
+#include "utils.h"
+
+std::string joinlines( const std::string & s )
+{
+ std::vectorstd::string lines;
+ zypp::str::split( s, std::back_inserter( lines ), "\n" );
+ return zypp::str::join( lines, "" );
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/dbsource/utils.h new/zmd-backend-7.1.1.0/src/dbsource/utils.h
--- old/zmd-backend-7.1.1.0/src/dbsource/utils.h 1970-01-01 01:00:00.000000000 +0100
+++ new/zmd-backend-7.1.1.0/src/dbsource/utils.h 2006-06-13 11:53:19.000000000 +0200
@@ -0,0 +1,27 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* utils.h utility functions for zmd backend helpers
+ *
+ * Copyright (C) 2006 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZMD_BACKEND_UTILS_H
+#define ZMD_BACKEND_UTILS_H
+
+#include <string>
+std::string joinlines( const std::string & s );
+
+#endif // ZMD_BACKEND_UTILS_H
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/parse-metadata.cc new/zmd-backend-7.1.1.0/src/parse-metadata.cc
--- old/zmd-backend-7.1.1.0/src/parse-metadata.cc 2006-06-09 14:29:54.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/parse-metadata.cc 2006-06-13 11:54:56.000000000 +0200
@@ -49,6 +49,7 @@
#include
+#include "dbsource/utils.h"
#include "dbsource/DbAccess.h"
#include "KeyRingCallbacks.h"
@@ -63,10 +64,9 @@
manager->restore("/");
}
catch (Exception & excpt_r) {
- cerr << "3|Can't restore sources: " << backend::striplinebreaks( excpt_r.asUserString() ) << endl;
+ cerr << "2|Can't restore sources: " << joinlines( excpt_r.asUserString() ) << endl;
ZYPP_CAUGHT (excpt_r);
- ERR << "Couldn't restore sources" << endl;
- return false;
+ ERR << "Couldn't restore all sources" << endl;
}
return true;
}
@@ -112,7 +112,7 @@
main (int argc, char **argv)
{
if (argc < 5) {
- cerr << "3|usage: " << argv[0] << " <database> <owner> <uri> <path> <catalog id>" << endl;
+ cerr << "1|usage: " << argv[0] << " <database> <owner> <uri> <path> <catalog id>" << endl;
return 1;
}
@@ -138,7 +138,7 @@
owner = ZMD_OWNED;
}
else {
- cerr << "3|Invalid option " << argv[2] << ", expecting '" << ZYPP << "' or '" << ZMD << "'" << endl;
+ cerr << "1|Invalid option " << argv[2] << ", expecting '" << ZYPP << "' or '" << ZMD << "'" << endl;
ERR << "Invalid option " << argv[2] << ", expecting '" << ZYPP << "' or '" << ZMD << "'" << endl;
return 1;
}
@@ -158,7 +158,7 @@
if (!db.openDb( true )) // open for writing
{
- cerr << "3|Cannot open database " << argv[1] << endl;
+ cerr << "1|Cannot open database " << argv[1] << endl;
ERR << "Cannot open database" << endl;
return 1;
}
@@ -194,7 +194,7 @@
}
catch ( const Exception & excpt_r ) {
ZYPP_CAUGHT( excpt_r );
- cerr << "3|" << backend::striplinebreaks( excpt_r.asUserString() ) << endl;
+ cerr << "1|" << joinlines( excpt_r.asUserString() ) << endl;
return 1;
}
@@ -204,7 +204,7 @@
&& !urialias.empty())
{
ERR << "Bad paremeters, yum-type url with alias" << endl;
- cerr << "3|Bad paremeters, yum-type url with alias" << endl;
+ cerr << "1|Bad paremeters, yum-type url with alias" << endl;
return 1;
}
@@ -272,7 +272,7 @@
if (it == manager->Source_end()) {
if (!urialias.empty()) { // alias given but not found in zypp -> error
- cerr << "3|Unknown alias '" << urialias << "' passed." << endl;
+ cerr << "1|Unknown alias '" << urialias << "' passed." << endl;
ERR << "Unknown alias '" << urialias << "' passed." << endl;
goto finish;
}
@@ -293,7 +293,7 @@
}
}
catch( const Exception & excpt_r ) {
- cerr << "3|Can't add repository at " << uri << ": " << backend::striplinebreaks( excpt_r.asUserString() ) << endl;
+ cerr << "1|Can't add repository at " << uri << ": " << joinlines( excpt_r.asUserString() ) << endl;
ZYPP_CAUGHT( excpt_r );
ERR << "Can't add repository at " << uri << endl;
result = 1;
@@ -320,7 +320,7 @@
manager->store( "/", true /*metadata_cache*/ );
}
catch (Exception & excpt_r) {
- cerr << "3|Can't store source to zypp" << endl;
+ cerr << "1|Can't store source to zypp" << endl;
ZYPP_CAUGHT (excpt_r);
ERR << "Couldn't store source to zypp" << endl;
result = 1;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/query-files.cc new/zmd-backend-7.1.1.0/src/query-files.cc
--- old/zmd-backend-7.1.1.0/src/query-files.cc 2006-06-09 14:28:56.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/query-files.cc 2006-06-13 11:55:02.000000000 +0200
@@ -28,6 +28,7 @@
#include
+#include "dbsource/utils.h"
#include "dbsource/DbAccess.h"
#include "dbsource/DbSources.h"
#include "KeyRingCallbacks.h"
@@ -363,7 +364,7 @@
manager->restore("/");
}
catch (Exception & excpt_r) {
- cerr << "3|Can't restore sources: " << backend::striplinebreaks( excpt_r.asUserString() ) << endl;
+ cerr << "1|Can't restore sources: " << joinlines( excpt_r.asUserString() ) << endl;
ZYPP_CAUGHT (excpt_r);
ERR << "Couldn't restore sources" << endl;
return;
@@ -391,7 +392,7 @@
main (int argc, char **argv)
{
if (argc < 3 || argc > 4) {
- std::cerr << "3|usage: " << argv[0] << " <database> <uri> [catalog id]" << endl;
+ std::cerr << "1|usage: " << argv[0] << " <database> <uri> [catalog id]" << endl;
return 1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/query-system.cc new/zmd-backend-7.1.1.0/src/query-system.cc
--- old/zmd-backend-7.1.1.0/src/query-system.cc 2006-05-18 12:26:08.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/query-system.cc 2006-06-12 11:58:01.000000000 +0200
@@ -46,8 +46,9 @@
Target_Ptr target = backend::initTarget( God, false );
DbAccess db( argv[1] );
- if (!db.openDb( true ))
+ if (!db.openDb( true )) {
return 1;
+ }
db.writeStore( God->target()->resolvables(), ResStatus::installed, "@system", ZYPP_OWNED );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/resolve-dependencies.cc new/zmd-backend-7.1.1.0/src/resolve-dependencies.cc
--- old/zmd-backend-7.1.1.0/src/resolve-dependencies.cc 2006-06-08 16:13:54.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/resolve-dependencies.cc 2006-06-13 13:43:26.000000000 +0200
@@ -127,10 +127,9 @@
solver::detail::ResolverContext_Ptr context = God->resolver()->context();
if (context == NULL) {
- ERR << "No context ?!" << endl;
- return 1;
+ MIL << "Nothing to transact" << endl;
}
- if (success) {
+ else if (success) {
success = write_transactions( God->pool(), db.db(), context );
}
else {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/service-delete.cc new/zmd-backend-7.1.1.0/src/service-delete.cc
--- old/zmd-backend-7.1.1.0/src/service-delete.cc 2006-06-09 14:29:07.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/service-delete.cc 2006-06-13 14:25:06.000000000 +0200
@@ -14,6 +14,7 @@
#include
#include
+#include "dbsource/utils.h"
#include "KeyRingCallbacks.h"
using namespace std;
@@ -35,10 +36,9 @@
manager->restore( "/" );
}
catch (Exception & excpt_r) {
- cerr << "3|Can't restore sources: " << backend::striplinebreaks( excpt_r.asUserString() ) << endl;
+ cerr << "2|Can't restore sources: " << joinlines( excpt_r.asUserString() ) << endl;
ZYPP_CAUGHT( excpt_r );
- ERR << "Couldn't restore sources" << endl;
- return 1;
+ ERR << "Couldn't restore all sources" << endl;
}
Url uri;
@@ -47,7 +47,7 @@
// Url() constructor might throw
try {
- uri = Url ( name );
+ uri = Url ( (name[0] == '/') ? (string("file:") + name) : name );
uriparams = uri.getQueryStringMap(); // extract parameters
url::ParamMap::const_iterator it = uriparams.find( "alias" );
if (it != uriparams.end()) {
@@ -77,12 +77,14 @@
manager->store ("/", true /*metadata_cache*/);
}
catch (Exception & excpt_r) {
+ cerr << "2|Can't remove source '" << name << "': " << joinlines( excpt_r.asUserString() ) << endl;
ZYPP_CAUGHT (excpt_r);
ERR << "Couldn't update source cache" << endl;
return 1;
}
}
else {
+ cerr << "3|Source '" << name << "' already removed." << endl;
WAR << "Source '" << name << "' not found" << endl;
return 1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/transact.cc new/zmd-backend-7.1.1.0/src/transact.cc
--- old/zmd-backend-7.1.1.0/src/transact.cc 2006-06-09 14:30:15.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/transact.cc 2006-06-13 11:55:19.000000000 +0200
@@ -19,6 +19,7 @@
using namespace zypp;
#include
+#include "dbsource/utils.h"
#include "dbsource/DbAccess.h"
#include "dbsource/DbSources.h"
@@ -82,7 +83,7 @@
main (int argc, char **argv)
{
if (argc < 2) {
- cerr << "usage: " << argv[0] << " <database> [--test] [--nosignature] [--nopretest]" << endl;
+ cerr << "1|Usage: " << argv[0] << " <database> [--test] [--nosignature] [--nopretest]" << endl;
return 1;
}
@@ -143,7 +144,7 @@
int removals = 0;
int count = read_transactions (God->pool(), db.db(), dbs, removals, items);
if (count < 0) {
- cerr << "Reading transactions failed." << endl;
+ cerr << "1|Reading transactions failed." << endl;
return 1;
}
@@ -182,6 +183,9 @@
{
result = 1;
if (zres._errors.size() > 0) {
+
+ // write transaction progress to stdout
+
cout << "3|Incomplete transactions:" << endl;
for (PoolItemList::const_iterator it = zres._errors.begin(); it != zres._errors.end(); ++it) {
cout << "3|" << it->resolvable() << endl;
@@ -200,20 +204,26 @@
if (med_callback.mediaNr() != 0 // exception due to MediaChange callback ?
&& !med_callback.description().empty())
{
- cerr << "Need media " << med_callback.mediaNr() << ": " << med_callback.description() << endl;
+ // "4|" means 'message' to ZMD
+ cerr << "4|Need media " << med_callback.mediaNr() << ": " << med_callback.description() << endl;
}
else {
- cout << "3|" << backend::striplinebreaks( expt_r.asUserString() ) << endl;
- cerr << expt_r.asString() << endl;
+ // "3|" is progress to stdout
+ cout << "3|" << joinlines( expt_r.asUserString() ) << endl;
+ // report as message ("4|" is message) to stderr
+ cerr << "4|" << expt_r.asString() << endl;
}
}
catch ( const Exception & expt_r ) {
ZYPP_CAUGHT( expt_r );
result = 1;
- cout << "3|" << backend::striplinebreaks( expt_r.asUserString() ) << endl;
- cerr << expt_r.asString() << endl;
+ // transact progress to stdout
+ cout << "3|" << joinlines( expt_r.asUserString() ) << endl;
+ // report as error
+ cerr << "1|" << expt_r.asString() << endl;
}
+ // 'finish' transaction progress
cout << "4" << endl;
// now drop those transactions which are already committed
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/transactions.cc new/zmd-backend-7.1.1.0/src/transactions.cc
--- old/zmd-backend-7.1.1.0/src/transactions.cc 2006-05-12 12:13:26.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/transactions.cc 2006-06-12 12:13:00.000000000 +0200
@@ -119,7 +119,7 @@
obj = sources.getById( id ); // get the ResObject by Id
if (obj == NULL) {
ERR << "Can't find res object id " << id << endl;
- cerr << "3|Resolvable id " << id << " does not exist." << endl;
+ cerr << "2|Resolvable id " << id << " does not exist." << endl;
break;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/src/zmd-backend.cc new/zmd-backend-7.1.1.0/src/zmd-backend.cc
--- old/zmd-backend-7.1.1.0/src/zmd-backend.cc 2006-06-09 14:29:32.000000000 +0200
+++ new/zmd-backend-7.1.1.0/src/zmd-backend.cc 2006-06-13 12:08:34.000000000 +0200
@@ -2,6 +2,7 @@
// zmd-backend.cc
// ZMD backend helpers
+#include "dbsource/utils.h"
#include "zmd-backend.h"
#include
@@ -23,8 +24,8 @@
}
catch (Exception & excpt_r) {
ZYPP_CAUGHT (excpt_r);
- cout << "3|A transaction is already in progress." << endl;
- cerr << "A transaction is already in progress." << endl;
+ cerr << "1|A transaction is already in progress." << endl;
+ cout << "A transaction is already in progress." << endl;
exit(1);
}
return Z;
@@ -41,28 +42,13 @@
}
catch (Exception & excpt_r) {
ZYPP_CAUGHT (excpt_r);
- cout << "3|" << backend::striplinebreaks( excpt_r.asUserString() ) << endl;
- cerr << excpt_r.asString() << endl;
+ cerr << "3|" << joinlines( excpt_r.asUserString() ) << endl;
+ cout << excpt_r.asString() << endl;
exit(1);
}
return T;
}
-
-std::string
-striplinebreaks( const std::string & s )
-{
- std::string result = s;
- do {
- string::size_type nlpos = result.find( "\n" );
- if (nlpos == string::npos) break;
- result = result.erase( nlpos, 1 );
- }
- while( 1 );
- return result;
-}
-
-
};
// EOF
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/testsuite/tests/Makefile.am new/zmd-backend-7.1.1.0/testsuite/tests/Makefile.am
--- old/zmd-backend-7.1.1.0/testsuite/tests/Makefile.am 2006-06-09 14:25:30.000000000 +0200
+++ new/zmd-backend-7.1.1.0/testsuite/tests/Makefile.am 2006-06-13 12:58:30.000000000 +0200
@@ -20,4 +20,5 @@
sources_SOURCES = sources.cc
-linebreaks_SOURCES = linebreaks.cc ../../src/zmd-backend.cc
+linebreaks_SOURCES = linebreaks.cc
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/testsuite/tests/Makefile.in new/zmd-backend-7.1.1.0/testsuite/tests/Makefile.in
--- old/zmd-backend-7.1.1.0/testsuite/tests/Makefile.in 2006-06-09 14:25:34.000000000 +0200
+++ new/zmd-backend-7.1.1.0/testsuite/tests/Makefile.in 2006-06-13 15:10:44.000000000 +0200
@@ -55,7 +55,7 @@
am__DEPENDENCIES_1 =
catalogs_DEPENDENCIES = $(top_srcdir)/src/dbsource/lib@PACKAGE@.la \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_linebreaks_OBJECTS = linebreaks.$(OBJEXT) zmd-backend.$(OBJEXT)
+am_linebreaks_OBJECTS = linebreaks.$(OBJEXT)
linebreaks_OBJECTS = $(am_linebreaks_OBJECTS)
linebreaks_LDADD = $(LDADD)
linebreaks_DEPENDENCIES = $(top_srcdir)/src/dbsource/lib@PACKAGE@.la \
@@ -231,7 +231,7 @@
catalogs_SOURCES = catalogs.cc
sources_SOURCES = sources.cc
-linebreaks_SOURCES = linebreaks.cc ../../src/zmd-backend.cc
+linebreaks_SOURCES = linebreaks.cc
all: all-am
.SUFFIXES:
@@ -291,7 +291,6 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/catalogs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linebreaks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sources.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmd-backend.Po@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -314,20 +313,6 @@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
-zmd-backend.o: ../../src/zmd-backend.cc
-@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT zmd-backend.o -MD -MP -MF "$(DEPDIR)/zmd-backend.Tpo" -c -o zmd-backend.o `test -f '../../src/zmd-backend.cc' || echo '$(srcdir)/'`../../src/zmd-backend.cc; \
-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/zmd-backend.Tpo" "$(DEPDIR)/zmd-backend.Po"; else rm -f "$(DEPDIR)/zmd-backend.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../../src/zmd-backend.cc' object='zmd-backend.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o zmd-backend.o `test -f '../../src/zmd-backend.cc' || echo '$(srcdir)/'`../../src/zmd-backend.cc
-
-zmd-backend.obj: ../../src/zmd-backend.cc
-@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT zmd-backend.obj -MD -MP -MF "$(DEPDIR)/zmd-backend.Tpo" -c -o zmd-backend.obj `if test -f '../../src/zmd-backend.cc'; then $(CYGPATH_W) '../../src/zmd-backend.cc'; else $(CYGPATH_W) '$(srcdir)/../../src/zmd-backend.cc'; fi`; \
-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/zmd-backend.Tpo" "$(DEPDIR)/zmd-backend.Po"; else rm -f "$(DEPDIR)/zmd-backend.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../../src/zmd-backend.cc' object='zmd-backend.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o zmd-backend.obj `if test -f '../../src/zmd-backend.cc'; then $(CYGPATH_W) '../../src/zmd-backend.cc'; else $(CYGPATH_W) '$(srcdir)/../../src/zmd-backend.cc'; fi`
-
mostlyclean-libtool:
-rm -f *.lo
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1.0/testsuite/tests/linebreaks.cc new/zmd-backend-7.1.1.0/testsuite/tests/linebreaks.cc
--- old/zmd-backend-7.1.1.0/testsuite/tests/linebreaks.cc 2006-06-09 13:58:31.000000000 +0200
+++ new/zmd-backend-7.1.1.0/testsuite/tests/linebreaks.cc 2006-06-13 16:07:42.000000000 +0200
@@ -1,28 +1,25 @@
//
-// linebreaks.cc
+// joinlines.cc
//
-// test striplinebreaks
+// test split/join
//
#include <iostream>
#include <string>
-#include "src/zmd-backend.h"
-
-
-using std::endl;
-using namespace backend;
+#include <vector>
+#include "../../src/dbsource/utils.h"
int
main(int argc, char *argv[])
{
- if (striplinebreaks("") != "") return 1;
- if (striplinebreaks("\n") != "") return 2;
- if (striplinebreaks("foo\n") != "foo") return 3;
- if (striplinebreaks("\nfoo") != "foo") return 4;
- if (striplinebreaks("\nfoo\n") != "foo") return 5;
- if (striplinebreaks("foo\nbar") != "foobar") return 6;
- if (striplinebreaks("foo\n\nbar") != "foobar") return 7;
- if (striplinebreaks("foo\n\n\nbar") != "foobar") return 8;
+ if (joinlines("") != "") return 1;
+ if (joinlines("\n") != "") return 2;
+ if (joinlines("foo\n") != "foo") return 3;
+ if (joinlines("\nfoo") != "foo") return 4;
+ if (joinlines("\nfoo\n") != "foo") return 5;
+ if (joinlines("foo\nbar") != "foobar") return 6;
+ if (joinlines("foo\n\nbar") != "foobar") return 7;
+ if (joinlines("foo\n\n\nbar") != "foobar") return 8;
return 0;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit-unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit-help@opensuse.org