Enable --plus-content option (FATE#316287)
authorMichael Andres <ma@suse.de>
Fri, 11 Jul 2014 06:51:19 +0000 (08:51 +0200)
committerMichael Andres <ma@suse.de>
Fri, 11 Jul 2014 10:56:46 +0000 (12:56 +0200)
src/RequestFeedback.cc
src/repos.cc

index c27f86d..e412426 100644 (file)
@@ -68,8 +68,13 @@ string SolverRequester::Feedback::asUserString(
         return str::form(_("Object '%s' not found in specified repositories."), _reqpkg.orig_str.c_str());
     }
   case NOT_FOUND_CAP:
+  {
     // translators: meaning a package %s or provider of capability %s
-    return str::form(_("No provider of '%s' found."), _reqpkg.orig_str.c_str());
+    std::string ret( str::form(_("No provider of '%s' found."), _reqpkg.orig_str.c_str()) );
+    if ( _reqpkg.orig_str.find("debuginfo") != std::string::npos )
+      ret += " ['--plus-content debug'?]";
+    return ret;
+  }
 
   case NOT_INSTALLED:
     if (_reqpkg.orig_str.find_first_of("?*") != string::npos) // wildcards used
index a859d82..065fd3f 100644 (file)
@@ -262,7 +262,7 @@ static bool refresh_raw_metadata(Zypper & zypper,
 
 // ---------------------------------------------------------------------------
 
-static bool build_cache(Zypper & zypper, const RepoInfo &repo, bool force_build)
+static bool build_cache(Zypper & zypper, const RepoInfo & repo, bool force_build)
 {
   if (force_build)
     zypper.out().info(_("Forcing building of repository cache"));
@@ -660,6 +660,25 @@ void do_init_repos(Zypper & zypper, const Container & container)
     RepoInfo repo(*it);
     MIL << "checking if to refresh " << repo.alias() << endl;
 
+    // disabled repos may get temp. enabled to check for --plus-content
+    bool contentcheck = false;
+    if ( ! ( gData.additional_content_repos.empty() 
+          || repo.url().schemeIsVolatile()
+         || repo.enabled() ) )
+    {
+      // Preliminarily enable if last content matches or no content info available.
+      // Final check is done after refresh.
+      if ( repo.hasContentAny( gData.additional_content_repos ) || ! repo.hasContent() )
+      {
+       contentcheck = true;
+       repo.setEnabled( true );
+       zypper.out().info( boost::format(_("Scanning content of disabled repository '%s'."))
+                         % repo.asUserString(),
+                         " [--plus-content]" );
+       MIL << "[--plus-content] check " << repo.alias() << endl;
+      }
+    }
+
     bool do_refresh =
       repo.enabled() &&
       repo.autorefresh() &&
@@ -682,6 +701,7 @@ void do_init_repos(Zypper & zypper, const Container & container)
               % repo.alias() << endl;
 
           it->setEnabled(false);
+         contentcheck = false;
         }
       }
       // non-root user
@@ -719,6 +739,7 @@ void do_init_repos(Zypper & zypper, const Container & container)
               % repo.alias() << endl;
 
           it->setEnabled(false);
+         contentcheck = false;
         }
       }
       // non-root user
@@ -741,9 +762,29 @@ void do_init_repos(Zypper & zypper, const Container & container)
               % repo.asUserString()));
           WAR << "Disabling repository '" << repo.alias() << "'" << endl;
           it->setEnabled(false);
+         contentcheck = false;
         }
       }
     }
+
+    if ( contentcheck )
+    {
+      if ( repo.hasContentAny( gData.additional_content_repos ) )
+      {
+       zypper.out().info( boost::format(_("Temporarily enabling repository '%s'."))
+                          % repo.asUserString(),
+                          " [--plus-content]" );
+       it->setEnabled(true);
+       MIL << "[--plus-content] check says use " << repo.alias() << endl;
+      }
+      else
+      {
+       zypper.out().info( boost::format(_("Repository '%s' stays disabled."))
+                          % repo.asUserString(),
+                          " [--plus-content]" );
+       MIL << "[--plus-content] check says disable " << repo.alias() << endl;
+      }
+    }
   }
 }