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(
#include <zypp/PathInfo.h>
#include "checkpatches-keyring-callbacks.h"
-#include "zypper.h"
+//#include "zypper.h"
#include "zypper-updates.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
using namespace boost;
ZYpp::Ptr God;
-RuntimeData gData;
-Settings gSettings;
+std::list<zypp::RepoInfo> repos;
std::list<Error> errors;
ostream no_stream(NULL);
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 )
{
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.") ) );
}
-
#include <iostream>
#include <fstream>
#include <sstream>
#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);
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;
}
#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 )
std::string description;
};
+extern std::list<zypp::RepoInfo> repos;
extern std::list<Error> errors;
std::string read_old_token();
-#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)
{
#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.
*/
// 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;
#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"