Imported Upstream version 17.13.0
[platform/upstream/libzypp.git] / zypp / RepoManager.cc
index 50ddf46..059c8a4 100644 (file)
@@ -309,7 +309,7 @@ namespace zypp
       bool nonroot( geteuid() != 0 );
       if ( nonroot && ! PathInfo(dir).userMayRX() )
       {
-       JobReport::warning( str::FormatNAC(_("Cannot read repo directory '%1%': Permission denied")) % dir );
+       JobReport::warning( str::Format(_("Cannot read repo directory '%1%': Permission denied")) % dir );
       }
       else
       {
@@ -327,7 +327,7 @@ namespace zypp
          {
            if ( nonroot && ! PathInfo(*it).userMayR() )
            {
-             JobReport::warning( str::FormatNAC(_("Cannot read repo file '%1%': Permission denied")) % *it );
+             JobReport::warning( str::Format(_("Cannot read repo file '%1%': Permission denied")) % *it );
            }
            else
            {
@@ -456,13 +456,7 @@ namespace zypp
 
   std::list<RepoInfo> readRepoFile( const Url & repo_file )
   {
-    // no interface to download a specific file, using workaround:
-    //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
-    Url url(repo_file);
-    Pathname path(url.getPathName());
-    url.setPathName ("/");
-    MediaSetAccess access(url);
-    Pathname local = access.provideFile(path);
+    ManagedFile local = MediaSetAccess::provideFileFromUrl(repo_file);
 
     DBG << "reading repo file " << repo_file << ", local path: " << local << endl;
 
@@ -796,7 +790,7 @@ namespace zypp
       }
     }
 
-    repo::PluginServices(_options.pluginsPath/"services", ServiceCollector(_services));
+   repo::PluginServices(_options.pluginsPath/"services", ServiceCollector(_services));
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -868,7 +862,7 @@ namespace zypp
          // translators: Cleanup a repository previously owned by a meanwhile unknown (deleted) service.
          //   %1% = service name
          //   %2% = repository name
-         JobReport::warning( str::FormatNAC(_("Unknown service '%1%': Removing orphaned service repository '%2%'"))
+         JobReport::warning( str::Format(_("Unknown service '%1%': Removing orphaned service repository '%2%'"))
                              % repoInfo.service()
                              % repoInfo.alias() );
          try {
@@ -1131,7 +1125,7 @@ namespace zypp
            {
              if ( info.alias() == (*it).alias() )
              {
-               RepoInfo modifiedrepo = info;
+               RepoInfo modifiedrepo = *it;
                modifiedrepo.setType( repokind );
                modifyRepository( info.alias(), modifiedrepo );
                break;
@@ -1354,6 +1348,7 @@ namespace zypp
         cmd.push_back( "-o" );
         cmd.push_back( solvfile.asString() );
        cmd.push_back( "-X" );  // autogenerate pattern from pattern-package
+        // bsc#1104415: no more application support // cmd.push_back( "-A" );  // autogenerate application pseudo packages
 
         if ( repokind == RepoType::RPMPLAINDIR )
         {
@@ -2099,7 +2094,13 @@ namespace zypp
     // and in zypper.
     std::pair<DefaultIntegral<bool,false>, repo::ServicePluginInformalException> uglyHack;
     try {
-      ServiceRepos( service, bind( &RepoCollector::collect, &collector, _1 ) );
+      // FIXME bsc#1080693: Shortcoming of (plugin)services (and repos as well) is that they
+      // are not aware of the RepoManagers rootDir. The service url, as created in known_services,
+      // contains the full path to the script. The script however has to be executed chrooted.
+      // Repos would need to know the RepoMangers rootDir to use the correct vars.d to replace
+      // repos variables. Until RepoInfoBase is aware if the rootDir, we need to explicitly pass it
+      // to ServiceRepos.
+      ServiceRepos( _options.rootDir, service, bind( &RepoCollector::collect, &collector, _1 ) );
     }
     catch ( const repo::ServicePluginInformalException & e )
     {
@@ -2240,7 +2241,7 @@ namespace zypp
 
        // Make sure the service repo is created with the appropriate enablement
        if ( ! indeterminate(toBeEnabled) )
-         it->setEnabled( toBeEnabled );
+         it->setEnabled( ( bool ) toBeEnabled );
 
         DBG << "Service adds repo " << it->alias() << " " << (it->enabled()?"enabled":"disabled") << endl;
         addRepository( *it );