From 7ce539c0a976de06ef29e227e867b48f9ef094f4 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Sat, 21 Jun 2008 17:13:24 +0000 Subject: [PATCH] - unused --- src/zypper-updates.cc | 142 -------------------------------------------------- src/zypper-updates.h | 61 ---------------------- 2 files changed, 203 deletions(-) delete mode 100644 src/zypper-updates.cc delete mode 100644 src/zypper-updates.h diff --git a/src/zypper-updates.cc b/src/zypper-updates.cc deleted file mode 100644 index 93fafe3..0000000 --- a/src/zypper-updates.cc +++ /dev/null @@ -1,142 +0,0 @@ -#include -#include -#include -#include - -#include "zypp/Patch.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/base/Logger.h" -#include "zypp/Digest.h" -#include "zypp/parser/xml_escape_parser.hpp" - -#include "zypper-updates.h" - -using namespace std; -using namespace zypp; - -extern std::list repos; -extern std::list 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); - return Edition(line); -} - -void save_version( const Edition &edition ) -{ - write_line_to_file( XML_FILE_VERSION, edition.asString() ); -} - - -string read_old_token() -{ - return read_line_from_file(TOKEN_FILE); -} - -void save_token( const std::string &token ) -{ - write_line_to_file( TOKEN_FILE, token ); -} - -static std::string xml_escape( const std::string &text ) -{ - iobind::parser::xml_escape_parser parser; - return parser.escape(text); -} - -void render_error( const Edition &version, std::ostream &out ) -{ - out << "" << std::endl; - out << "" << std::endl; - out << " " << std::endl; - for ( std::list::const_iterator it = errors.begin(); it != errors.end(); ++it ) - { - out << " " << xml_escape(it->description) << "" << endl; - } - out << " " << std::endl; - out << "" << std::endl; -} - -void render_result( const Edition &version, std::ostream &out, const zypp::ResPool &pool) -{ - int count = 0; - int security_count = 0; - - out << "" << std::endl; - out << "" << std::endl; - - //out << " " << std::endl; - out << " " << std::endl; - for ( std::list::const_iterator it = errors.begin(); it != errors.end(); ++it ) - { - out << " " << xml_escape(it->description) << "" << endl; - } - out << " " << std::endl; - - out << " " << std::endl; - for ( std::list::const_iterator it = repos.begin(); it != repos.end(); ++it ) - { - out << " baseUrlsBegin()) << "\" alias=\"" << it->alias() << "\"/>" << std::endl; - } - out << " " << std::endl; - out << " " << std::endl; - for ( ResPool::byKind_iterator it = pool.byKindBegin(); it != pool.byKindEnd(); ++it ) - { - Resolvable::constPtr res = it->resolvable(); - Patch::constPtr patch = asKind(res); - MIL << patch->name() << " " << patch->edition() << " " << "[" << patch->category() << "]" << ( it->isBroken() ? " [broken]" : " [satisfied]" )<< std::endl; - if ( it->isBroken() ) - { - out << " category() << "\" name=\"" << patch->name() << "\" edition=\"" << patch->edition() << "\"" << ">" << std::endl; - out << " " << xml_escape(patch->summary()) << "" << endl; - out << " " << xml_escape(patch->description()) << "" << endl; - if ( patch->repository() != Repository::noRepository ) - out << "repository().info().baseUrlsBegin()) << "\" alias=\"" << patch->repository().info().alias() << "\"/>" << std::endl; - out << "" << endl; - - count++; - if (patch->category() == "security") - security_count++; - } - } - out << " " << std::endl; - out << " " << std::endl; - out << "" << std::endl; -} diff --git a/src/zypper-updates.h b/src/zypper-updates.h deleted file mode 100644 index e559d6b..0000000 --- a/src/zypper-updates.h +++ /dev/null @@ -1,61 +0,0 @@ -/*-----------------------------------------------------------*- c++ -*-\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZMART_UPDATES_H -#define ZMART_UPDATES_H - -#include -#include "zypp/Url.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/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 ) - : description(desc) - {} - std::string description; -}; - -extern std::list repos; -extern std::list errors; - -std::string read_old_token(); -void save_token( const std::string &token ); -zypp::Edition read_old_version(); -void save_version( const zypp::Edition &edition ); -void render_error( const zypp::Edition &version, std::ostream &out ); -void render_result( const zypp::Edition &version, std::ostream &out, const zypp::ResPool &pool); - -#endif - -- 2.7.4