do not autorefresh services if --no-refresh is given
authorJán Kupec <jkupec@suse.cz>
Tue, 30 Nov 2010 10:39:51 +0000 (11:39 +0100)
committerJán Kupec <jkupec@suse.cz>
Tue, 30 Nov 2010 10:48:29 +0000 (11:48 +0100)
src/repos.cc

index 6ecd223..b49cc51 100644 (file)
@@ -532,21 +532,24 @@ void do_init_repos(Zypper & zypper, const Container & container)
   // can ignore repos targetted for other systems
   init_target(zypper);
 
-  MIL << "Refreshing autorefresh services." << endl;
-
-  const list<ServiceInfo> & services = zypper.repoManager().knownServices();
-  bool called_refresh = false;
-  for_(s, services.begin(), services.end())
+  if (!zypper.globalOpts().no_refresh)
   {
-    if (s->enabled() && s->autorefresh())
+    MIL << "Refreshing autorefresh services." << endl;
+
+    const list<ServiceInfo> & services = zypper.repoManager().knownServices();
+    bool called_refresh = false;
+    for_(s, services.begin(), services.end())
     {
-      refresh_service(zypper, *s);
-      called_refresh = true;
+      if (s->enabled() && s->autorefresh())
+      {
+        refresh_service(zypper, *s);
+        called_refresh = true;
+      }
     }
+    // reinitialize the repo manager to re-read the list of repos
+    if (called_refresh)
+      zypper.initRepoManager();
   }
-  // reinitialize the repo manager to re-read the list of repos
-  if (called_refresh)
-    zypper.initRepoManager();
 
   MIL << "Going to initialize repositories." << endl;
   RepoManager & manager = zypper.repoManager();