Mailinglist Archive: zypp-commit (268 mails)

< Previous Next >
[zypp-commit] r7739 - in /trunk/zypper/src: CMakeLists.txt zypp-checkpatches.cc zypper-updates.cc zypper-updates.h zypper-utils.cc zypper-utils.h zypper.cc zypper.h
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Sun, 04 Nov 2007 10:27:29 -0000
  • Message-id: <20071104102729.7CE4A25BBE@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Sun Nov 4 11:27:29 2007
New Revision: 7739

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7739&view=rev
Log:
- zypper and zypp-checkpatches decoupled

Modified:
trunk/zypper/src/CMakeLists.txt
trunk/zypper/src/zypp-checkpatches.cc
trunk/zypper/src/zypper-updates.cc
trunk/zypper/src/zypper-updates.h
trunk/zypper/src/zypper-utils.cc
trunk/zypper/src/zypper-utils.h
trunk/zypper/src/zypper.cc
trunk/zypper/src/zypper.h

Modified: trunk/zypper/src/CMakeLists.txt
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/CMakeLists.txt?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/CMakeLists.txt (original)
+++ trunk/zypper/src/CMakeLists.txt Sun Nov 4 11:27:29 2007
@@ -44,7 +44,7 @@
RUNTIME DESTINATION ${INSTALL_PREFIX}/bin
)

-ADD_EXECUTABLE( zypp-checkpatches zypp-checkpatches.cc zypper-updates.cc
zypper-utils.cc )
+ADD_EXECUTABLE( zypp-checkpatches zypp-checkpatches.cc zypper-updates.cc )
TARGET_LINK_LIBRARIES( zypp-checkpatches ${ZYPP_LIBRARY} )

INSTALL(

Modified: trunk/zypper/src/zypp-checkpatches.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypp-checkpatches.cc?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypp-checkpatches.cc (original)
+++ trunk/zypper/src/zypp-checkpatches.cc Sun Nov 4 11:27:29 2007
@@ -20,7 +20,7 @@
#include <zypp/PathInfo.h>

#include "checkpatches-keyring-callbacks.h"
-#include "zypper.h"
+//#include "zypper.h"
#include "zypper-updates.h"

#undef ZYPP_BASE_LOGGER_LOGGROUP
@@ -35,8 +35,7 @@
using namespace boost;

ZYpp::Ptr God;
-RuntimeData gData;
-Settings gSettings;
+std::list<zypp::RepoInfo> repos;
std::list<Error> errors;

ostream no_stream(NULL);
@@ -176,7 +175,7 @@

MIL << "repository: " << it->alias() << std::endl; //" from " <<
src.timestamp() << std::endl;

- gData.repos.push_back(*it);
+ repos.push_back(*it);
}
catch (const Exception &excpt_r )
{
@@ -224,13 +223,13 @@
MIL << "System has changed, recalculation of updates needed" << endl;
}

- for ( std::list<RepoInfo>::const_iterator it = gData.repos.begin(); it !=
gData.repos.end(); ++it )
+ for ( std::list<RepoInfo>::const_iterator it = repos.begin(); it !=
repos.end(); ++it )
{
Repository repository = manager.createFromCache(*it);
God->addResolvables(repository.resolvables());
}

- if ( gData.repos.size() == 0 )
+ if ( repos.size() == 0 )
{
errors.push_back( str::form( _( "There are no update repositories defined.
Please add one or more update repositories in order to be notified of
updates.") ) );
}

Modified: trunk/zypper/src/zypper-updates.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-updates.cc?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypper-updates.cc (original)
+++ trunk/zypper/src/zypper-updates.cc Sun Nov 4 11:27:29 2007
@@ -1,4 +1,3 @@
-
#include <iostream>
#include <fstream>
#include <sstream>
@@ -15,18 +14,45 @@
#include <zypp/Digest.h>
#include <zypp/target/store/xml_escape_parser.hpp>

-#include "zypper.h"
#include "zypper-updates.h"
-#include "zypper-utils.h"

using namespace std;
using namespace zypp;

-extern ZYpp::Ptr God;
-extern RuntimeData gData;
-extern Settings gSettings;
+extern std::list<zypp::RepoInfo> repos;
extern std::list<Error> errors;

+string read_line_from_file( const Pathname &file )
+{
+ string buffer;
+ string token;
+ std::ifstream is(file.asString().c_str());
+ if ( is.good() )
+ {
+ while(is && !is.eof())
+ {
+ getline(is, buffer);
+ token += buffer;
+ }
+ is.close();
+ }
+ return token;
+ }
+
+// ----------------------------------------------------------------------------
+
+void write_line_to_file( const Pathname &file, const std::string &line )
+{
+ std::ofstream os(file.asString().c_str());
+ if ( os.good() )
+ {
+ os << line << endl;;
+ }
+ os.close();
+}
+
+// ----------------------------------------------------------------------------
+
Edition read_old_version()
{
string line = read_line_from_file(XML_FILE_VERSION);
@@ -85,7 +111,7 @@
out << " </errors>" << std::endl;

out << " <update-sources>" << std::endl;
- for ( std::list<RepoInfo>::const_iterator it = gData.repos.begin(); it !=
gData.repos.end(); ++it )
+ for ( std::list<RepoInfo>::const_iterator it = repos.begin(); it !=
repos.end(); ++it )
{
out << " <source url=\"" << *(it->baseUrlsBegin()) << "\" alias=\"" <<
it->alias() << "\"/>" << std::endl;
}

Modified: trunk/zypper/src/zypper-updates.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-updates.h?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypper-updates.h (original)
+++ trunk/zypper/src/zypper-updates.h Sun Nov 4 11:27:29 2007
@@ -15,10 +15,32 @@
#include "zypp/ResObject.h"
#include "zypp/Edition.h"

+#include <zypp/base/LogControl.h>
+#include <zypp/base/Logger.h>
+#include <zypp/base/String.h>
+#include <zypp/Locale.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/ResStore.h>
+#include <zypp/RepoInfo.h>
+
+#define ZYPP_CHECKPATCHES_LOG "/var/log/zypper.log"
#define TOKEN_FILE "/var/lib/zypp/cache/updates_token"
#define XML_FILE_VERSION "/var/lib/zypp/cache/updates_xml_version"
#define RESULT_FILE "/var/lib/zypp/cache/updates_result.xml"

+// undefine _ and _PL macros from libzypp
+#ifdef _
+#undef _
+#endif
+#ifdef _PL
+#undef _PL
+#endif
+
+// define new macros
+#define _(MSG) ::gettext(MSG)
+#define _PL(MSG1,MSG2,N) ::ngettext(MSG1,MSG2,N)
+
struct Error
{
Error( const std::string &desc )
@@ -27,6 +49,7 @@
std::string description;
};

+extern std::list<zypp::RepoInfo> repos;
extern std::list<Error> errors;

std::string read_old_token();

Modified: trunk/zypper/src/zypper-utils.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-utils.cc?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypper-utils.cc (original)
+++ trunk/zypper/src/zypper-utils.cc Sun Nov 4 11:27:29 2007
@@ -1,46 +1,12 @@
-#include <fstream>
-
#include <zypp/media/MediaManager.h>

#include "zypper.h"

-using namespace zypp::detail;
-
using namespace std;
using namespace zypp;
+using namespace zypp::detail;

-string read_line_from_file( const Pathname &file )
-{
- string buffer;
- string token;
- std::ifstream is(file.asString().c_str());
- if ( is.good() )
- {
- while(is && !is.eof())
- {
- getline(is, buffer);
- token += buffer;
- }
- is.close();
- }
- return token;
- }
-
-// ----------------------------------------------------------------------------
-
-void write_line_to_file( const Pathname &file, const std::string &line )
-{
- std::ofstream os(file.asString().c_str());
- if ( os.good() )
- {
- os << line << endl;;
- }
- os.close();
-}
-
-// ----------------------------------------------------------------------------
-
-/// tell to report a bug, and how
+/// tell the user to report a bug, and how
// (multiline, with endls)
ostream& report_a_bug (ostream& stm)
{

Modified: trunk/zypper/src/zypper-utils.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-utils.h?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypper-utils.h (original)
+++ trunk/zypper/src/zypper-utils.h Sun Nov 4 11:27:29 2007
@@ -4,13 +4,9 @@
#include <ostream>
#include <string>

-#include <zypp/Pathname.h>
#include <zypp/Url.h>
#include <zypp/Resolvable.h>

-std::string read_line_from_file( const zypp::Pathname &file );
-void write_line_to_file( const zypp::Pathname &file, const std::string &line );
-
/**
* Write a suggestion to report a bug to the specified stream.
*/

Modified: trunk/zypper/src/zypper.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypper.cc (original)
+++ trunk/zypper/src/zypper.cc Sun Nov 4 11:27:29 2007
@@ -1680,7 +1680,7 @@
// logging
const char *logfile = getenv("ZYPP_LOGFILE");
if (logfile == NULL)
- logfile = ZYPP_CHECKPATCHES_LOG;
+ logfile = ZYPPER_LOG;
zypp::base::LogControl::instance().logfile( logfile );

MIL << "Hi, me zypper " VERSION " built " << __DATE__ << " " << __TIME__ <<
endl;

Modified: trunk/zypper/src/zypper.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.h?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/zypper/src/zypper.h (original)
+++ trunk/zypper/src/zypper.h Sun Nov 4 11:27:29 2007
@@ -18,7 +18,7 @@

#include "zypper-command.h"

-#define ZYPP_CHECKPATCHES_LOG "/var/log/zypper.log"
+#define ZYPPER_LOG "/var/log/zypper.log"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "zypper"


--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages