adapted to libzypp after removing the old API (libzypp r5820, branch
authorJan Kupec <jkupec@suse.cz>
Thu, 21 Jun 2007 15:10:10 +0000 (15:10 +0000)
committerJan Kupec <jkupec@suse.cz>
Thu, 21 Jun 2007 15:10:10 +0000 (15:10 +0000)
REFACTORING-10_3)

src/zypp-checkpatches.cc
src/zypper-info.cc
src/zypper-media-callbacks.h
src/zypper-misc.cc
src/zypper-search.h
src/zypper-source-callbacks.h
src/zypper-tabulator.cc
src/zypper-updates.cc
src/zypper.cc

index b9778b0..5009781 100644 (file)
@@ -9,6 +9,7 @@
 
 /* (c) Novell Inc. */
 
+#include <fcntl.h>
 
 #include <iostream>
 #include <fstream>
@@ -17,6 +18,7 @@
 #include <zypp/base/Gettext.h>
 #include <zypp/target/store/PersistentStorage.h>
 #include <zypp/RepoManager.h>
+#include <zypp/PathInfo.h>
 
 #include "checkpatches-keyring-callbacks.h"
 #include "zypper.h"
index c346b3e..43a9184 100644 (file)
@@ -81,7 +81,7 @@ Copy and modify /usr/share/vim/current/gvimrc to ~/.gvimrc if needed.
  */
 void printPkgInfo(const PoolItem & pool_item, const PoolItem & ins_pool_item) {
 
-  cout << _("Catalog: ") << pool_item.resolvable()->source().alias() << endl;
+  cout << _("Catalog: ") << pool_item.resolvable()->repository().info().alias() << endl;
   cout << _("Name: ") << pool_item.resolvable()->name() << endl;
   cout << _("Version: ") << pool_item.resolvable()->edition().asString() << endl;
   cout << _("Arch: ") << pool_item.resolvable()->arch().asString() << endl;
index e108aaa..686bdf6 100644 (file)
@@ -21,7 +21,6 @@
 #include <zypp/KeyRing.h>
 #include <zypp/Digest.h>
 #include <zypp/Url.h>
-#include <zypp/Source.h>
 
 #include "AliveCursor.h"
 
@@ -33,7 +32,7 @@ namespace ZmartRecipients
 {
 
   struct MediaChangeReportReceiver : public zypp::callback::ReceiveReport<MediaChangeReport>
-  {
+  {/*
     virtual MediaChangeReport::Action requestMedia( zypp::Source_Ref source, unsigned mediumNr, MediaChangeReport::Error error, const std::string & description )
     { 
       cout << "Please insert media [" << description << "] # " << mediumNr << ". Retry [y/n]: " << endl;
@@ -43,6 +42,7 @@ namespace ZmartRecipients
         return MediaChangeReport::ABORT; 
     
     }
+    */
   };
 
     // progress for downloading a file
index f75cdf7..53b0fb6 100644 (file)
@@ -435,7 +435,7 @@ void load_repo_resolvables()
   
       cout_vv << format(_("(%d resolvables found)")) % store.size() << endl;
     }
-    catch ( const repo::RepoNotCachedException &e )
+    catch (const Exception & e)
     {
       ZYPP_CAUGHT(e);
       cerr << format(_("Problem loading data from '%s'")) % repo.alias();
@@ -553,7 +553,7 @@ void show_patches()
     Patch::constPtr patch = asKind<Patch>(res);
 
     TableRow tr;
-    tr << patch->source ().alias ();
+    tr << patch->repository().info().alias ();
     tr << res->name () << res->edition ().asString();
     tr << patch->category();
     tr << string_status (it->status ());
@@ -589,7 +589,7 @@ void list_patch_updates ()
 
       if (true) {
        TableRow tr (cols);
-       tr << patch->source ().alias ();
+       tr << patch->repository().info().alias ();
        tr << res->name () << res->edition ().asString();
        tr << patch->category();
        tr << string_status (it->status ());
@@ -726,7 +726,7 @@ void list_updates( const ResObject::Kind &kind )
 //      candstat.setToBeInstalled (ResStatus::USER);
       ResObject::constPtr res = ci->resolvable();
       TableRow tr (cols);
-      tr << "v" << res->source ().alias ();
+      tr << "v" << res->repository().info().alias();
       if (gSettings.is_rug_compatible)
        tr << "";               // Bundle
       tr << res->name ()
index 2eccf5c..f26a5a0 100644 (file)
@@ -262,7 +262,7 @@ struct FillTable
     }
 
     // add other fields to the result table
-    row << pool_item.resolvable()->source().alias()
+    row << pool_item.resolvable()->repository().info().alias()
         // TODO what about rug's Bundle?
         << (gSettings.is_rug_compatible ? "" : pool_item.resolvable()->kind().asString()) 
         << pool_item.resolvable()->name()
index 2578a01..1a5d58a 100644 (file)
@@ -20,7 +20,6 @@
 #include <zypp/KeyRing.h>
 #include <zypp/Digest.h>
 #include <zypp/Url.h>
-#include <zypp/Source.h>
 
 #include "zypper-callbacks.h"
 
@@ -28,8 +27,7 @@
 namespace ZmartRecipients
 {
 ///////////////////////////////////////////////////////////////////    
-#ifndef LIBZYPP_1xx
-    // progress for probing a source
+/*    // progress for probing a source
     struct ProbeSourceReceive : public zypp::callback::ReceiveReport<zypp::source::ProbeSourceReport>
     {
       virtual void start(const zypp::Url &url)
@@ -37,7 +35,7 @@ namespace ZmartRecipients
         cout << "Determining " << url << " source type..." << endl;
       }
       
-      virtual void failedProbe( const zypp::Url &/*url*/, const std::string & type )
+      virtual void failedProbe( const zypp::Url &/*url*//*, const std::string & type )
       {
         cout << ".. not " << type << endl;
       }
@@ -47,7 +45,7 @@ namespace ZmartRecipients
         cout << url << " is type " << type << endl;
       }
       
-      virtual void finish(const zypp::Url &/*url*/, Error error, const std::string & reason )
+      virtual void finish(const zypp::Url &/*url*//*, Error error, const std::string & reason )
       {
         if ( error == INVALID )
         {
@@ -56,10 +54,10 @@ namespace ZmartRecipients
         }
       }
 
-      virtual bool progress(const zypp::Url &/*url*/, int /*value*/)
+      virtual bool progress(const zypp::Url &/*url*//*, int /*value*//*)
       { return true; }
 
-      virtual Action problem( const zypp::Url &/*url*/, Error error, const std::string & description )
+      virtual Action problem( const zypp::Url &/*url*//*, Error error, const std::string & description )
       {
        display_done ();
        display_error (error, description);
@@ -67,8 +65,7 @@ namespace ZmartRecipients
         return ABORT;
       }
     };
-#endif
-    
+    */
 // progress for downloading a resolvable
 struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<zypp::source::DownloadResolvableReport>
 {
@@ -203,7 +200,7 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
   }
 };
 
-#ifndef LIBZYPP_1xx
+/*
 struct SourceReportReceiver  : public zypp::callback::ReceiveReport<zypp::source::SourceReport>
 {     
   virtual void start( zypp::Source_Ref source, const std::string & task )
@@ -225,14 +222,14 @@ struct SourceReportReceiver  : public zypp::callback::ReceiveReport<zypp::source
     return true;
   }
   
-  virtual Action problem( zypp::Source_Ref /*source*/, Error error, const std::string & description )
+  virtual Action problem( zypp::Source_Ref /*source*//*, Error error, const std::string & description )
   {
     display_done ();
     display_error (error, description);
     return (Action) read_action_ari ();
   }
 
-  virtual void finish( zypp::Source_Ref /*source*/, const std::string & task, Error error, const std::string & reason )
+  virtual void finish( zypp::Source_Ref /*source*//*, const std::string & task, Error error, const std::string & reason )
   {
     display_step(100);
     // many of these, avoid newline
@@ -246,8 +243,7 @@ struct SourceReportReceiver  : public zypp::callback::ReceiveReport<zypp::source
   std::string _task;
   zypp::Source_Ref _source;
 };
-#endif
-
+*/
     ///////////////////////////////////////////////////////////////////
 }; // namespace ZmartRecipients
 ///////////////////////////////////////////////////////////////////
@@ -255,27 +251,21 @@ struct SourceReportReceiver  : public zypp::callback::ReceiveReport<zypp::source
 class SourceCallbacks {
 
   private:
-#ifndef LIBZYPP_1xx
-    ZmartRecipients::ProbeSourceReceive _sourceProbeReport;
-    ZmartRecipients::SourceReportReceiver _SourceReport;
-#endif
+//    ZmartRecipients::ProbeSourceReceive _sourceProbeReport;
+//    ZmartRecipients::SourceReportReceiver _SourceReport;
     ZmartRecipients::DownloadResolvableReportReceiver _downloadReport;
   public:
     SourceCallbacks()
     {
-#ifndef LIBZYPP_1xx
-      _sourceProbeReport.connect();
-      _SourceReport.connect();
-#endif
+//      _sourceProbeReport.connect();
+//      _SourceReport.connect();
       _downloadReport.connect();
     }
 
     ~SourceCallbacks()
     {
-#ifndef LIBZYPP_1xx
-      _sourceProbeReport.disconnect();
-      _SourceReport.disconnect();
-#endif
+//      _sourceProbeReport.disconnect();
+//      _SourceReport.disconnect();
       _downloadReport.disconnect();
     }
 
index cd55c5d..9dbf424 100644 (file)
@@ -5,7 +5,7 @@ using namespace std;
 TableStyle Table::defaultStyle = Ascii;
 
 static
-char * lines[][3] = {
+const char * lines[][3] = {
   { "|", "-", "+"},            ///< Ascii
   // utf 8. TODO wchars?
   { "\xE2\x94\x82", "\xE2\x94\x80", "\xE2\x94\xBC"}, ///< light
@@ -38,7 +38,7 @@ void TableRow::dumbDumpTo (ostream &stream) const {
 
 void TableRow::dumpTo (ostream &stream, const vector<unsigned>& widths,
                       TableStyle st) const {
-  char * vline = lines[st][0];
+  const char * vline = lines[st][0];
 
   bool seen_first = false;
   container::const_iterator
@@ -90,8 +90,8 @@ void Table::updateColWidths (const TableRow& tr) {
 }
 
 void Table::dumpRule (ostream &stream) const {
-  char * hline = lines[_style][1];
-  char * cross = lines[_style][2];
+  const char * hline = lines[_style][1];
+  const char * cross = lines[_style][2];
 
   bool seen_first = false;
   
index f7c521d..2764a7f 100644 (file)
@@ -102,8 +102,8 @@ void render_result( const Edition &version, std::ostream &out, const zypp::ResPo
       out << " <update category=\"" << patch ->category() << "\" name=\"" << patch->name() << "\" edition=\"" << patch->edition() << "\"" << ">" << std::endl;
       out << " <summary>" << xml_escape(patch->summary()) << "</summary>" << endl;
       out << " <description>" << xml_escape(patch->description()) << "</description>" << endl;
-      if ( patch->source() != Source_Ref::noSource )
-        out << "<source url=\"" << patch->source().url() << "\" alias=\"" << patch->source().alias() << "\"/>" << std::endl;
+      if ( patch->repository() != Repository::noRepository )
+        out << "<source url=\"" << *(patch->repository().info().baseUrlsBegin()) << "\" alias=\"" << patch->repository().info().alias() << "\"/>" << std::endl;
       out << "</update>" << endl;
       
       count++;
index b093f82..72a36b4 100644 (file)
@@ -435,7 +435,7 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       "This command has no options.\n"
       );
   }
-  else if (command == ZypperCommand::NONE) {//command_str == "patches" || command_str == "pch") {
+  else if (command == ZypperCommand::SHOW_PATCHES) {
     static struct option patches_options[] = {
       {"help", no_argument, 0, 'h'},
       {0, 0, 0, 0}
@@ -844,7 +844,7 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
 
   // --------------------------( patches )------------------------------------
 
-  else if (command == ZypperCommand::NONE) {//command_str == "patches" || command_str == "pch") {
+  else if (command == ZypperCommand::SHOW_PATCHES) {
     if (ghelp) {
       cerr << specific_help;
       return !ghelp;