Imported Upstream version 17.28.6 upstream/17.28.6
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Dec 2021 00:31:40 +0000 (09:31 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Dec 2021 00:31:40 +0000 (09:31 +0900)
349 files changed:
.obs/workflows.yml
VERSION.cmake
devel/devel.ma/Basic.cc
devel/devel.ma/MT.cc
devel/devel.ma/PluginTest.cc
devel/devel.ma/Signal.cc
devel/devel.ma/Test.cc
devel/devel.ma/Xml.cc
package/libzypp.changes
po/de.po
po/it.po
tests/lib/WebServer.cc
tests/media/CredentialManager_test.cc
tests/media/MetaLinkParser_test.cc
tests/media/file_exists_test.cc
tests/media/media1_test.cc
tests/media/throw_if_not_exists_test.cc
tests/parser/HistoryLogReader_test.cc
tests/parser/inifile/inidict_test.cc
tests/parser/yum/RepomdFileReader_test.cc
tests/repo/PluginServices_test.cc
tests/repo/RepoSigcheck_test.cc
tests/repo/RepoVariables_test.cc
tests/zypp/CpeId_test.cc
tests/zypp/Digest_test.cc
tests/zypp/DrunkenBishop_test.cc
tests/zypp/Fetcher_test.cc
tests/zypp/FileChecker_test.cc
tests/zypp/KeyRingTestReceiver.h
tests/zypp/KeyRing_test.cc
tests/zypp/Locale_test.cc
tests/zypp/Locks_test.cc
tests/zypp/PoolQueryCC_test.cc
tests/zypp/PoolQuery_test.cc
tests/zypp/ProgressData_test.cc
tests/zypp/ResStatus_test.cc
tests/zypp/Resolvable_test.cc
tests/zypp/RpmPkgSigCheck_test.cc
tests/zypp/Signature_test.cc
tests/zypp/StringV_test.cc
tests/zypp/Url_test.cc
tests/zypp/base/String_test.cc
tests/zypp/base/Sysconfig_test.cc
tools/DumpSelectable.cc
tools/argparse.h
tools/zypp-NameReqPrv.cc
tools/zypp-install.cc
tools/zypp-list.cc
tools/zypp-pubkey.cc
zypp-core/AutoDispose.h
zypp-core/Date.cc
zypp-core/Digest.cc
zypp-core/Digest.h
zypp-core/ExternalProgram.cc
zypp-core/ExternalProgram.h
zypp-core/Pathname.cc
zypp-core/Pathname.h
zypp-core/TriBool.h
zypp-core/Url.cc
zypp-core/Url.h
zypp-core/base/Exception.h
zypp-core/base/ExternalDataSource.cc
zypp-core/base/Flags.h
zypp-core/base/IOStream.cc
zypp-core/base/IOStream.h
zypp-core/base/IOTools.cc
zypp-core/base/IOTools.h
zypp-core/base/LogControl.cc
zypp-core/base/Logger.h
zypp-core/base/PtrTypes.h
zypp-core/base/String.cc
zypp-core/base/String.h
zypp-core/base/StringV.cc
zypp-core/base/StringV.h
zypp-core/base/Xml.h
zypp-core/fs/PathInfo.cc
zypp-core/fs/PathInfo.h
zypp-core/fs/TmpPath.cc
zypp-core/fs/TmpPath.h
zypp-core/parser/xml/XmlEscape.cc
zypp-core/parser/xml/XmlEscape.h
zypp-core/url/UrlBase.cc
zypp-core/url/UrlBase.h
zypp-core/url/UrlUtils.cc
zypp-core/zyppng/base/statemachine.h
zypp-core/zyppng/core/string.h
zypp-core/zyppng/io/forkspawnengine.cc
zypp-core/zyppng/io/private/abstractspawnengine_p.h
zypp/Arch.cc
zypp/Callback.h
zypp/Capabilities.h
zypp/Capability.cc
zypp/Changelog.cc
zypp/ContentType.h
zypp/CountryCode.cc
zypp/CpeId.cc
zypp/CpeId.h
zypp/Dep.cc
zypp/Digest.cc
zypp/DiskUsageCounter.cc
zypp/DiskUsageCounter.h
zypp/DownloadMode.h
zypp/Edition.h
zypp/Fetcher.cc
zypp/FileChecker.cc
zypp/HistoryLog.cc
zypp/HistoryLogData.cc
zypp/IdStringType.h
zypp/KVMap.h
zypp/KeyContext.h
zypp/KeyManager.cc
zypp/KeyManager.h
zypp/KeyRing.cc
zypp/KeyRing.h
zypp/LanguageCode.cc
zypp/Locale.cc
zypp/Locks.cc
zypp/Locks.h
zypp/MediaSetAccess.cc
zypp/MediaSetAccess.h
zypp/Package.cc
zypp/Patch.cc
zypp/Patch.h
zypp/PathInfo.cc
zypp/Pattern.cc
zypp/Pattern.h
zypp/PluginExecutor.cc
zypp/PluginFrame.cc
zypp/PluginScript.cc
zypp/PluginScript.h
zypp/PoolItem.cc
zypp/PoolItemBest.cc
zypp/PoolQuery.cc
zypp/ProblemSolution.cc
zypp/ProblemTypes.h
zypp/Product.cc
zypp/Product.h
zypp/ProgressData.cc
zypp/ProgressData.h
zypp/PublicKey.cc
zypp/Range.cc
zypp/RepoInfo.cc
zypp/RepoInfo.h
zypp/RepoManager.cc
zypp/RepoStatus.cc
zypp/Repository.cc
zypp/Repository.h
zypp/ResFilters.h
zypp/ResKind.cc
zypp/ResPool.h
zypp/ResPoolProxy.cc
zypp/ResStatus.cc
zypp/ResStatus.h
zypp/Resolvable.h
zypp/ResolverFocus.cc
zypp/ResolverProblem.cc
zypp/ServiceInfo.cc
zypp/ServiceInfo.h
zypp/Signature.cc
zypp/Signature.h
zypp/Target.cc
zypp/Target.h
zypp/UserData.h
zypp/VendorAttr.cc
zypp/VendorAttr.h
zypp/VendorSupportOptions.cc
zypp/ZConfig.cc
zypp/ZYppCallbacks.h
zypp/ZYppCommitPolicy.cc
zypp/ZYppCommitResult.cc
zypp/ZYppCommitResult.h
zypp/ZYppFactory.cc
zypp/base/Backtrace.cc
zypp/base/Debug.h
zypp/base/DrunkenBishop.cc
zypp/base/DrunkenBishop.h
zypp/base/Env.h
zypp/base/GzStream.cc
zypp/base/InputStream.cc
zypp/base/Json.h
zypp/base/LocaleGuard.h
zypp/base/Measure.cc
zypp/base/Measure.h
zypp/base/NamedValue.h
zypp/base/SetRelationMixin.h
zypp/base/SetTracker.h
zypp/base/Signal.h
zypp/base/StrMatcher.cc
zypp/base/StrMatcher.h
zypp/base/Sysconfig.cc
zypp/base/Sysconfig.h
zypp/base/UserRequestException.cc
zypp/base/WatchFile.h
zypp/media/CredentialFileReader.cc
zypp/media/CredentialManager.cc
zypp/media/CurlConfig.cc
zypp/media/CurlConfig.h
zypp/media/CurlHelper.cc
zypp/media/CurlHelper.h
zypp/media/MediaBlockList.cc
zypp/media/MediaCD.cc
zypp/media/MediaCD.h
zypp/media/MediaCIFS.cc
zypp/media/MediaCIFS.h
zypp/media/MediaCurl.cc
zypp/media/MediaCurl.h
zypp/media/MediaDIR.cc
zypp/media/MediaDIR.h
zypp/media/MediaDISK.cc
zypp/media/MediaDISK.h
zypp/media/MediaException.cc
zypp/media/MediaException.h
zypp/media/MediaHandler.cc
zypp/media/MediaHandler.h
zypp/media/MediaHandlerFactory.cc
zypp/media/MediaISO.cc
zypp/media/MediaISO.h
zypp/media/MediaManager.cc
zypp/media/MediaMultiCurl.cc
zypp/media/MediaNFS.cc
zypp/media/MediaNFS.h
zypp/media/MediaNetworkCommonHandler.h
zypp/media/MediaPlugin.h
zypp/media/MediaPriority.cc
zypp/media/MediaPriority.h
zypp/media/MediaSource.h
zypp/media/MetaLinkParser.cc
zypp/media/Mount.cc
zypp/media/Mount.h
zypp/media/TransferSettings.cc
zypp/media/UrlResolverPlugin.cc
zypp/media/UrlResolverPlugin.h
zypp/media/ZsyncParser.cc
zypp/media/proxyinfo/ProxyInfoLibproxy.cc
zypp/media/proxyinfo/ProxyInfoSysconfig.cc
zypp/misc/CheckAccessDeleted.cc
zypp/misc/YamlTestcaseHelpers.h
zypp/parser/HistoryLogReader.cc
zypp/parser/IniDict.h
zypp/parser/IniParser.cc
zypp/parser/ParseException.cc
zypp/parser/ParserProgress.h
zypp/parser/ProductFileReader.cc
zypp/parser/ProductFileReader.h
zypp/parser/RepoFileReader.cc
zypp/parser/RepoindexFileReader.cc
zypp/parser/ServiceFileReader.cc
zypp/parser/ServiceFileReader.h
zypp/parser/susetags/ContentFileReader.cc
zypp/parser/susetags/ContentFileReader.h
zypp/parser/susetags/RepoIndex.h
zypp/parser/xml/Reader.cc
zypp/parser/yum/RepomdFileReader.cc
zypp/parser/yum/RepomdFileReader.h
zypp/pool/PoolImpl.h
zypp/pool/PoolTraits.h
zypp/repo/Downloader.cc
zypp/repo/Downloader.h
zypp/repo/MediaInfoDownloader.cc
zypp/repo/MediaInfoDownloader.h
zypp/repo/PackageProvider.cc
zypp/repo/PackageProvider.h
zypp/repo/PluginServices.cc
zypp/repo/PluginServices.h
zypp/repo/RepoMirrorList.cc
zypp/repo/RepoMirrorList.h
zypp/repo/RepoProvideFile.cc
zypp/repo/RepoType.cc
zypp/repo/RepoVariables.cc
zypp/repo/SUSEMediaVerifier.cc
zypp/repo/ServiceRepos.cc
zypp/repo/ServiceRepos.h
zypp/repo/susetags/Downloader.cc
zypp/repo/susetags/Downloader.h
zypp/repo/yum/Downloader.cc
zypp/repo/yum/Downloader.h
zypp/sat/FileConflicts.cc
zypp/sat/FileConflicts.h
zypp/sat/LookupAttr.cc
zypp/sat/LookupAttr.h
zypp/sat/Map.cc
zypp/sat/Pool.cc
zypp/sat/Pool.h
zypp/sat/Queue.cc
zypp/sat/Queue.h
zypp/sat/SolvIterMixin.h
zypp/sat/Solvable.cc
zypp/sat/Solvable.h
zypp/sat/SolvableSet.h
zypp/sat/SolvableSpec.cc
zypp/sat/Transaction.cc
zypp/sat/Transaction.h
zypp/sat/detail/PoolImpl.cc
zypp/sat/detail/PoolImpl.h
zypp/solver/detail/ItemCapKind.h
zypp/solver/detail/ProblemSolutionCombi.h
zypp/solver/detail/ProblemSolutionIgnore.cc
zypp/solver/detail/ProblemSolutionIgnore.h
zypp/solver/detail/Resolver.cc
zypp/solver/detail/SATResolver.cc
zypp/solver/detail/SATResolver.h
zypp/solver/detail/SolutionAction.cc
zypp/solver/detail/SolutionAction.h
zypp/solver/detail/SolverQueueItem.cc
zypp/solver/detail/SolverQueueItemDelete.cc
zypp/solver/detail/SolverQueueItemDelete.h
zypp/solver/detail/SolverQueueItemInstall.cc
zypp/solver/detail/SolverQueueItemInstall.h
zypp/solver/detail/SolverQueueItemInstallOneOf.cc
zypp/solver/detail/SolverQueueItemInstallOneOf.h
zypp/solver/detail/SolverQueueItemLock.cc
zypp/solver/detail/SolverQueueItemLock.h
zypp/solver/detail/SolverQueueItemUpdate.cc
zypp/solver/detail/SolverQueueItemUpdate.h
zypp/solver/detail/SystemCheck.cc
zypp/solver/detail/SystemCheck.h
zypp/solver/detail/Testcase.cc
zypp/solver/detail/Testcase.h
zypp/solver/detail/Testcase_helix.cc
zypp/solver/detail/Types.h
zypp/target/CommitPackageCache.cc
zypp/target/CommitPackageCacheReadAhead.cc
zypp/target/HardLocksFile.h
zypp/target/RpmPostTransCollector.cc
zypp/target/RpmPostTransCollector.h
zypp/target/SolvIdentFile.cc
zypp/target/TargetCallbackReceiver.cc
zypp/target/TargetCallbackReceiver.h
zypp/target/TargetImpl.cc
zypp/target/TargetImpl.commitFindFileConflicts.cc
zypp/target/TargetImpl.h
zypp/target/modalias/Modalias.cc
zypp/target/modalias/Modalias.h
zypp/target/rpm/BinHeader.cc
zypp/target/rpm/RpmDb.cc
zypp/target/rpm/RpmFlags.h
zypp/target/rpm/RpmHeader.cc
zypp/target/rpm/librpmDb.cc
zypp/ui/Selectable.cc
zypp/ui/SelectableImpl.cc
zypp/ui/SelectableImpl.h
zypp/ui/SelectableTraits.h
zypp/ui/UserWantedPackages.cc
zypp/ui/UserWantedPackages.h
zypp/zypp_detail/ZYppImpl.cc
zypp/zyppng/media/medianetwork.cc
zypp/zyppng/media/network/networkrequestdispatcher.cc
zypp/zyppng/media/network/private/downloaderstates/rangedownloader_p.cc
zypp/zyppng/media/network/request.cc

index e11358c..deb4c68 100644 (file)
@@ -1,5 +1,20 @@
-workflow:
+ci_workflow:
   steps:
     - branch_package:
         source_project: zypp:ci:libzypp
         source_package: libzypp
+        target_project: home:zypp-team
+  filters:
+    event: pull_request
+
+master_workflow:
+  steps:
+    - branch_package:
+        source_project: zypp:ci:libzypp
+        source_package: libzypp
+        target_project: home:zypp-team
+  filters:
+    event: push
+    branches:
+      only:
+        - master
\ No newline at end of file
index f884e92..7935739 100644 (file)
@@ -61,8 +61,8 @@
 SET(LIBZYPP_MAJOR "17")
 SET(LIBZYPP_COMPATMINOR "22")
 SET(LIBZYPP_MINOR "28")
-SET(LIBZYPP_PATCH "5")
+SET(LIBZYPP_PATCH "6")
 #
-# LAST RELEASED: 17.28.5 (22)
+# LAST RELEASED: 17.28.6 (22)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index dd867de..f1c8a7e 100644 (file)
@@ -43,35 +43,35 @@ using namespace zypp::ui;
         };
 #endif
         virtual void start( const Url & file, Pathname localfile )
-       {
-         USR << "DP +++ " << file  << endl;
-         lp = 0;
-       }
+        {
+          USR << "DP +++ " << file  << endl;
+          lp = 0;
+        }
 
         virtual bool progress(int value, const Url &file, double dbps_avg = -1, double dbps_current = -1)
         {
-         if ( abs(value-lp) >= 20 || value == 100 && lp != 100  )
-         {
-           USR << "DP " << file << " " << value << "%" << endl;
-           lp = value;
-         }
-         return true;
+          if ( abs(value-lp) >= 20 || value == 100 && lp != 100  )
+          {
+            USR << "DP " << file << " " << value << "%" << endl;
+            lp = value;
+          }
+          return true;
 
-       }
+        }
 
         virtual Action problem( const Url &file , Error error , const std::string &description )
-       {
-         USR << "DP !!! " << file << " (" << error << ")" << endl;
-         return ABORT;
+        {
+          USR << "DP !!! " << file << " (" << error << ")" << endl;
+          return ABORT;
 
-       }
+        }
 
         virtual void finish( const Url &file , Error error , const std::string &reason )
-       {
-         USR << "DP --- " << file << " (" << error << ")" << endl;
-       }
+        {
+          USR << "DP --- " << file << " (" << error << ")" << endl;
+        }
 
-       int lp;
+        int lp;
     };
 
     ////////////////////////////////////////////////////////////////////
@@ -98,7 +98,7 @@ using namespace zypp::ui;
 #endif
       virtual void start( Resolvable::constPtr resolvable_ptr, const Url &url )
       {
-       USR << "+++ " << resolvable_ptr << endl;
+        USR << "+++ " << resolvable_ptr << endl;
       }
 
 
@@ -109,23 +109,23 @@ using namespace zypp::ui;
       // - problems are just informal
       virtual void startDeltaDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ )
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       virtual bool progressDeltaDownload( int /*value*/ )
       {
-       USR << __PRETTY_FUNCTION__ << endl;
-       return true;
+        USR << __PRETTY_FUNCTION__ << endl;
+        return true;
       }
 
       virtual void problemDeltaDownload( const std::string &/*description*/ )
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       virtual void finishDeltaDownload()
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       // Apply delta rpm:
@@ -134,44 +134,44 @@ using namespace zypp::ui;
       // - problems are just informal
       virtual void startDeltaApply( const Pathname & /*filename*/ )
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       virtual void progressDeltaApply( int /*value*/ )
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       virtual void problemDeltaApply( const std::string &/*description*/ )
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       virtual void finishDeltaApply()
       {
-       USR << __PRETTY_FUNCTION__ << endl;
+        USR << __PRETTY_FUNCTION__ << endl;
       }
 
       // return false if the download should be aborted right now
       virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
       {
-       if ( 1 || abs(value-lp) >= 20 || value == 100 && lp != 100  )
-       {
-         USR << resolvable_ptr << " " << value << "%" << endl;
-         lp = value;
-       }
-       return true;
+        if ( 1 || abs(value-lp) >= 20 || value == 100 && lp != 100  )
+        {
+          USR << resolvable_ptr << " " << value << "%" << endl;
+          lp = value;
+        }
+        return true;
       }
 
       virtual Action problem( Resolvable::constPtr resolvable_ptr , Error error , const std::string &/*description*/ )
       {
-       USR << "!!! " << resolvable_ptr << " (" << error << ")" << endl;
-       return ABORT;
+        USR << "!!! " << resolvable_ptr << " (" << error << ")" << endl;
+        return ABORT;
       }
 
       virtual void finish(Resolvable::constPtr resolvable_ptr , Error error , const std::string &/*reason*/ )
       {
-       USR << "--- " << resolvable_ptr << " (" << error << ")" << endl;
+        USR << "--- " << resolvable_ptr << " (" << error << ")" << endl;
       }
 
       int lp;
index e0decbb..3ad071c 100644 (file)
@@ -42,19 +42,19 @@ namespace zypp
       const size_t taskCount = (tasks.size() / threadCount) + 1;
       for ( size_t start = 0; start < tasks.size(); start += taskCount )
       {
-       group.create_thread( [&tasks, start, taskCount]()
-       {
-         const size_t end = std::min( tasks.size(), start + taskCount );
-         for ( size_t i = start; i < end; ++i )
-           tasks[i]();
-       });
+        group.create_thread( [&tasks, start, taskCount]()
+        {
+          const size_t end = std::min( tasks.size(), start + taskCount );
+          for ( size_t i = start; i < end; ++i )
+            tasks[i]();
+        });
       }
       group.join_all();
     }
     else
     {
       for_( f, tasks.begin(), tasks.end() )
-       (*f)();
+        (*f)();
     }
   }
 }
index 2581d40..15e8027 100644 (file)
@@ -120,20 +120,20 @@ try {
     Pathname script( ZConfig::instance().pluginsPath()/"system/spacewalkx" );
     if ( PathInfo( script ).isX() )
       try {
-       PluginScript spacewalk( script );
-       spacewalk.open();
+        PluginScript spacewalk( script );
+        spacewalk.open();
 
-       PluginFrame notify( "PACKAGESETCHANGED" );
-       spacewalk.send( notify );
+        PluginFrame notify( "PACKAGESETCHANGED" );
+        spacewalk.send( notify );
 
-       PluginFrame ret( spacewalk.receive() );
-       MIL << ret << endl;
-       if ( ret.command() == "ERROR" )
-         ret.writeTo( WAR ) << endl;
+        PluginFrame ret( spacewalk.receive() );
+        MIL << ret << endl;
+        if ( ret.command() == "ERROR" )
+          ret.writeTo( WAR ) << endl;
       }
       catch ( const Exception & excpt )
       {
-       WAR << excpt.asUserHistory() << endl;
+        WAR << excpt.asUserHistory() << endl;
       }
   }
 
@@ -146,20 +146,20 @@ try {
     for ( unsigned i = 1; true; ++i )
     {
       try {
-       MIL << "Receiving " << i << endl;
-       PluginFrame ret( receive() );
+        MIL << "Receiving " << i << endl;
+        PluginFrame ret( receive() );
       }
       catch ( const PluginScriptTimeout & excpt )
       {
-       ERR << excpt << endl;
-       scr.send( f );
+        ERR << excpt << endl;
+        scr.send( f );
       }
       catch ( const PluginScriptDiedUnexpectedly & excpt )
       {
-       ERR << excpt << endl;
-       ERR << scr << endl;
-       scr.close();
-       break;
+        ERR << excpt << endl;
+        ERR << scr << endl;
+        scr.close();
+        break;
       }
     }
   }
@@ -171,20 +171,20 @@ try {
     for ( unsigned i = 1; true; ++i )
     {
       try {
-       MIL << "Sending " << i << endl;
-       send( f );
+        MIL << "Sending " << i << endl;
+        send( f );
       }
       catch ( const PluginScriptTimeout & excpt )
       {
-       ERR << excpt << endl;
-       ::kill( scr.getPid(), SIGKILL);
+        ERR << excpt << endl;
+        ::kill( scr.getPid(), SIGKILL);
       }
       catch ( const PluginScriptDiedUnexpectedly & excpt )
       {
-       ERR << excpt << endl;
-       ERR << scr << endl;
-       scr.close();
-       break;
+        ERR << excpt << endl;
+        ERR << scr << endl;
+        scr.close();
+        break;
       }
     }
   }
index cbf418a..065fa32 100644 (file)
@@ -22,9 +22,9 @@ namespace boost
     std::ostream & operator<<( std::ostream & str, const connection & obj )
     {
       return str << "Connection: "
-         << ( obj.connected() ? '*' : '_' )
-         << ( obj.blocked()   ? 'B' : '_' )
-         ;
+          << ( obj.connected() ? '*' : '_' )
+          << ( obj.blocked()   ? 'B' : '_' )
+          ;
     }
   }
 }
index 8abb6c9..42fbf41 100644 (file)
@@ -38,7 +38,7 @@ bool solve()
   }
   MIL << "resolve " << rres << endl;
   vdumpPoolStats( USR << "Transacting:"<< endl,
-                 make_filter_begin<resfilter::ByTransact>(ResPool::instance()),
+                  make_filter_begin<resfilter::ByTransact>(ResPool::instance()),
                   make_filter_end<resfilter::ByTransact>(ResPool::instance()) ) << endl;
 
   return true;
index a1030ad..66e16f7 100644 (file)
@@ -44,7 +44,7 @@ bool dumpNode( xml::Reader & reader_r )
       MIL << *reader_r << endl;
       for ( int i = 0; i < reader_r->attributeCount(); ++i )
       {
-       MIL << " attr no " << i << " '" << reader_r->getAttributeNo( i ) << "'" << endl;
+        MIL << " attr no " << i << " '" << reader_r->getAttributeNo( i ) << "'" << endl;
       }
       break;
 
@@ -74,7 +74,7 @@ bool consume( xml::Reader & reader_r )
       MIL << *reader_r << endl;
       for ( int i = 0; i < reader_r->attributeCount(); ++i )
       {
-       MIL << " attr no " << i << " '" << reader_r->getAttributeNo( i ) << "'" << endl;
+        MIL << " attr no " << i << " '" << reader_r->getAttributeNo( i ) << "'" << endl;
       }
       break;
 
@@ -121,17 +121,17 @@ int main( int argc, char * argv[] )
       input = *argv;
 
       try {
-       Measure m( input.basename() );
+        Measure m( input.basename() );
 //     zypp::base::LogControl::TmpLineWriter shutUp;
-       xml::Reader reader( input );
-       if ( verbose )
-         reader.foreachNodeOrAttribute( consumer );
-       else
-         reader.foreachNode( consumer );
+        xml::Reader reader( input );
+        if ( verbose )
+          reader.foreachNodeOrAttribute( consumer );
+        else
+          reader.foreachNode( consumer );
       }
       catch ( const Exception & exp )
       {
-       INT << exp << endl << exp.historyAsString();
+        INT << exp << endl << exp.historyAsString();
       }
     }
   }
index 9f2e2d0..9d87895 100644 (file)
@@ -1,4 +1,23 @@
 -------------------------------------------------------------------
+Mon Oct 18 12:02:57 CEST 2021 - ma@suse.de
+
+- Zypper should keep cached files if transaction is aborted
+  (bsc#1190356)
+  Singletrans mode currently does not keep files around if the
+  transaction is aborted. This patch fixes the problem.
+- Require a minimum number of mirrors for multicurl (bsc#1191609)
+- Use procfs to detect nr of open fd's if rlimit is too high
+  (bsc#1191324)
+  Especially in a VM iterating over all possible fd's to close open
+  ones right before a exec() slows down zypper unnecessarily. This
+  patch uses /proc/self/fd to iterate over open fd's in case rlimit
+  is above 1024.
+- po: Fix some lost '%' signs in positional args (bsc#1191370)
+- RepoManager: Don't probe for plaindir repo if URL schema is
+  plugin: (bsc#1191286)
+- version 17.28.6 (22)
+
+-------------------------------------------------------------------
 Mon Oct  4 12:46:46 CEST 2021 - ma@suse.de
 
 - Downloader does not respect checkExistsOnly flag (bsc#1190712)
index 71deaf2..16f5143 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -4651,7 +4651,7 @@ msgstr "%1% aus ausgeschlossenem Repository installieren"
 #: zypp/solver/detail/SATResolver.cc:1449
 #, boost-format
 msgid "install %1% although it has been retracted"
-msgstr "%1 installieren, obwohl es widerrufen wurde"
+msgstr "%1% installieren, obwohl es widerrufen wurde"
 
 #. translator: %1% is a package name
 #: zypp/solver/detail/SATResolver.cc:1452
index 6778319..28a1ade 100644 (file)
--- a/po/it.po
+++ b/po/it.po
@@ -4654,7 +4654,7 @@ msgid ""
 "install %1% from vendor %2%\n"
 "  replacing %3% from vendor %4%"
 msgstr ""
-"installa %1 dal fornitore %2\n"
+"installa %1% dal fornitore %2%\n"
 "  sostituzione di %3% del fornitore %4%"
 
 #: zypp/solver/detail/SATResolver.cc:1507
index ef41cbc..bf18070 100644 (file)
@@ -65,7 +65,7 @@ namespace  {
     AutoDispose<int> sockfd { socket( AF_INET, SOCK_STREAM, 0 ) };
     if ( sockfd < 0 ) {
         std::cerr << "ERROR opening socket" << endl;
-       return ret;
+        return ret;
     }
     sockfd.setDispose( ::close );
 
@@ -208,7 +208,7 @@ public:
         bool canContinue = ( zypp::filesystem::symlink( Pathname(TESTS_SRC_DIR)/"data"/"nginxconf"/"nginx.conf",  confFile ) == 0 );
         if ( canContinue ) canContinue = writeConfFile( confPath / "srvroot.conf", str::Format("root    %1%;") % _docroot );
         if ( canContinue ) canContinue = writeConfFile( confPath / "fcgisock.conf", str::Format("fastcgi_pass unix:%1%;") % socketPath().c_str() );
-       if ( canContinue ) canContinue = writeConfFile( confPath / "user.conf", getuid() != 0 ? "" : "user root;" );
+        if ( canContinue ) canContinue = writeConfFile( confPath / "user.conf", getuid() != 0 ? "" : "user root;" );
         if ( canContinue ) {
           if ( _ssl )
             canContinue = writeConfFile( confPath / "port.conf", str::Format("listen    %1% ssl;") % _port );
@@ -256,21 +256,21 @@ public:
           std::cerr << line << endl;
         };
 
-       // Wait max 10 sec for the socket becoming available
-       bool isup { checkLocalPort( port() ) };
-       if ( !isup )
-       {
-         unsigned i = 0;
-         do {
-           std::this_thread::sleep_for( std::chrono::milliseconds(1000) );
-           isup = checkLocalPort( port() );
-         } while ( !isup && ++i < 10 );
-
-         if ( !isup && prog.running() ) {
-           prog.kill( SIGTERM );
+        // Wait max 10 sec for the socket becoming available
+        bool isup { checkLocalPort( port() ) };
+        if ( !isup )
+        {
+          unsigned i = 0;
+          do {
+            std::this_thread::sleep_for( std::chrono::milliseconds(1000) );
+            isup = checkLocalPort( port() );
+          } while ( !isup && ++i < 10 );
+
+          if ( !isup && prog.running() ) {
+            prog.kill( SIGTERM );
             prog.close();
-         }
-       }
+          }
+        }
 
         if ( !prog.running() ) {
           _stop = true;
@@ -281,7 +281,7 @@ public:
 
         FCGX_Request request;
         FCGX_InitRequest(&request, sockFD,0);
-       AutoDispose<FCGX_Request*> guard( &request, boost::bind( &FCGX_Free, _1, 0 ) );
+        AutoDispose<FCGX_Request*> guard( &request, boost::bind( &FCGX_Free, _1, 0 ) );
 
         struct pollfd fds[] { {
             _wakeupPipe[0],
index d808915..db12233 100644 (file)
@@ -14,8 +14,8 @@ using namespace zypp;
 using namespace zypp::media;
 
 inline void testGetCreds( CredentialManager & cm_r, const std::string & url_r,
-                     const std::string & user_r = "",
-                     const std::string & pass_r = "" )
+                      const std::string & user_r = "",
+                      const std::string & pass_r = "" )
 {
   Url url( url_r );
   AuthData_Ptr cred = cm_r.getCred( url );
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(save_creds)
   cm1.saveInGlobal(cr2);
   CredentialFileReader( opts.globalCredFilePath, bind( &CredCollector::collect, &collector, _1 ) );
   BOOST_CHECK_EQUAL(collector.creds.size(), 2 );
-  
+
   collector.creds.clear();
   // save the same creds again
   cm1.saveInGlobal(cr2);
index ad1a29e..3e481e5 100644 (file)
@@ -12,8 +12,8 @@ BOOST_AUTO_TEST_CASE(parse_metalink)
   Pathname meta3file = TESTS_SRC_DIR "/media/data/openSUSE-11.3-NET-i586.iso.metalink";
   Pathname meta4file = TESTS_SRC_DIR "/media/data/openSUSE-11.3-NET-i586.iso.meta4";
 
-       MetaLinkParser mlp3;
-       MetaLinkParser mlp4;
+        MetaLinkParser mlp3;
+        MetaLinkParser mlp4;
 
   mlp3.parse(meta3file);
   MediaBlockList bl3 = mlp3.getBlockList();
index b1a240c..2a1f3b8 100644 (file)
@@ -22,9 +22,9 @@ BOOST_AUTO_TEST_CASE(curl_params_reset)
 {
   MediaManager     mm;
   media::MediaId   id;
-  
+
   Url url("http://ftp.kernel.org/pub/");
-  
+
   id = mm.open( url, "");
   mm.attach(id);
 
@@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE(curl_params_reset)
   BOOST_REQUIRE( PathInfo(dest).size() != 0 );
   mm.doesFileExist(id, src);
   BOOST_REQUIRE( PathInfo(dest).size() != 0 );
-  mm.release(id);   
+  mm.release(id);
 }
 
 BOOST_AUTO_TEST_CASE(http_test)
@@ -47,9 +47,9 @@ BOOST_AUTO_TEST_CASE(http_test)
   //MediaVerifierRef verifier( new MyMediaVerifier() );
   MediaManager     mm;
   media::MediaId   id;
-  
+
   Url url("http://ftp.kernel.org/pub/");
-  
+
 //   iso_url = "iso:/";
 //   iso_url.setQueryParam("iso", "SUSE-10.1-Beta5/SUSE-Linux-10.1-beta5-i386-CD1.iso");
 //   iso_url.setQueryParam("url", src_url.asString());
@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(http_test)
   mm.attach(id);
   BOOST_REQUIRE( mm.doesFileExist(id, Pathname("/README")) );
   BOOST_REQUIRE( ! mm.doesFileExist(id, Pathname("/fakefile")) );
-  mm.release(id); 
+  mm.release(id);
 }
 
 BOOST_AUTO_TEST_CASE(ftp_test)
@@ -67,9 +67,9 @@ BOOST_AUTO_TEST_CASE(ftp_test)
   //MediaVerifierRef verifier( new MyMediaVerifier() );
   MediaManager     mm;
   media::MediaId   id;
-  
+
   Url url("ftp://ftp.kernel.org/pub/");
-  
+
 //   iso_url = "iso:/";
 //   iso_url.setQueryParam("iso", "SUSE-10.1-Beta5/SUSE-Linux-10.1-beta5-i386-CD1.iso");
 //   iso_url.setQueryParam("url", src_url.asString());
@@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(ftp_test)
   mm.attach(id);
   BOOST_REQUIRE( mm.doesFileExist(id, Pathname("/README")) );
   BOOST_REQUIRE( ! mm.doesFileExist(id, Pathname("/fakefile")) );
-  mm.release(id); 
+  mm.release(id);
 }
 
 BOOST_AUTO_TEST_CASE(isotest)
@@ -89,13 +89,13 @@ BOOST_AUTO_TEST_CASE(isotest)
      BOOST_WARN( "ISO test requires root permissions! (mount)");
      return;
    }
-  
+
   MediaManager     mm;
   media::MediaId   id;
-  
+
   //Url url("nfs://dist.suse.de/dist/install/openSUSE-10.2-GM/");
   Url url("dir:/mounts/dist/install/openSUSE-10.2-GM/");
-  
+
   Url iso_url("iso:/");
   iso_url.setQueryParam("iso", "openSUSE-10.2-RC5-PromoDVD-i386.iso");
   iso_url.setQueryParam("url", url.asString());
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(isotest)
   mm.attach(id);
   BOOST_REQUIRE( mm.doesFileExist(id, Pathname("/README")) );
   BOOST_REQUIRE( ! mm.doesFileExist(id, Pathname("/fakefile")) );
-  mm.release(id); 
+  mm.release(id);
 }
 
 BOOST_AUTO_TEST_CASE(nfs_tst)
@@ -114,17 +114,17 @@ BOOST_AUTO_TEST_CASE(nfs_tst)
      BOOST_WARN( "NFS test requires root permissions! (mount)");
      return;
    }
-  
+
   MediaManager     mm;
   media::MediaId   id;
   Url url("nfs://dist.suse.de/dist/install");
-  
+
   id = mm.open( url, "");
   mm.attach(id);
   BOOST_REQUIRE( mm.doesFileExist(id, Pathname("/SLP/openSUSE-10.2-RM/i386/DVD1/README")) );
   BOOST_REQUIRE( ! mm.doesFileExist(id, Pathname("/fakefile")) );
   mm.release(id);
-  
+
 }
 
 // vim: set ts=2 sts=2 sw=2 ai et:
index 8c0a240..c1cf86c 100644 (file)
@@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(verifier_test)
   mm.provideFile(id, Pathname("/suse/setup/descr/EXTRA_PROV"));
   mm.release(id);
   mm.attach(id);
-  mm.provideFile(id, Pathname("/suse/setup/descr/EXTRA_PROV"));  
+  mm.provideFile(id, Pathname("/suse/setup/descr/EXTRA_PROV"));
 }
 
 // vim: set ts=2 sts=2 sw=2 ai et:
index 623ca63..66bf001 100644 (file)
@@ -24,14 +24,14 @@ BOOST_AUTO_TEST_CASE(http_test)
   //MediaVerifierRef verifier( new MyMediaVerifier() );
   MediaManager     mm;
   media::MediaId   id;
-  
+
   Url url("http://www.google.com");
-  
+
   id = mm.open( url, "");
   //mm.addVerifier( id, verifier);
   mm.attach(id);
   BOOST_CHECK_THROW( mm.provideFile(id, Pathname("/file-not-exists")), Exception );
-  mm.release(id); 
+  mm.release(id);
 }
 
 // vim: set ts=2 sts=2 sw=2 ai et:
index 126507d..231313e 100644 (file)
@@ -8,7 +8,7 @@ BOOST_AUTO_TEST_CASE(basic)
 {
   std::vector<HistoryLogData::Ptr> history;
   parser::HistoryLogReader parser( TESTS_SRC_DIR "/parser/HistoryLogReader_test.dat",
-                                  parser::HistoryLogReader::Options(),
+                                   parser::HistoryLogReader::Options(),
     [&history]( HistoryLogData::Ptr ptr )->bool {
       history.push_back( ptr );
       return true;
index d7c731f..861b7ef 100644 (file)
@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(ini_read)
   for ( IniDict::section_const_iterator it = dict.sectionsBegin(); it != dict.sectionsEnd(); ++it )
   {
     MIL << (*it) << endl;
-    
+
     for ( IniDict::entry_const_iterator it2 = dict.entriesBegin(*it); it2 != dict.entriesEnd(*it); ++it2 )
     {
       MIL << "  - " << (*it2).first << " | " << (*it2).second << endl;
index 4d62e9a..5b0eddf 100644 (file)
@@ -29,7 +29,7 @@ public:
     items.push_back( make_pair( t, std::move(loc) ) );
     return true;
   }
-  
+
   std::vector<std::pair<std::string, OnMediaLocation> > items;
 };
 
@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(repomd_read)
   std::list<Pathname> entries;
   if ( filesystem::readdir( entries, DATADIR, false ) != 0 )
     ZYPP_THROW(Exception("failed to read directory"));
-    
+
   for ( std::list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
   {
     Pathname file = *it;
@@ -49,20 +49,20 @@ BOOST_AUTO_TEST_CASE(repomd_read)
       Collector collect;
       RepomdFileReader r( file, std::ref(collect) );
       if ( file.basename() == "repomd-1.xml" ) {
-       BOOST_CHECK_EQUAL( r.keywords().size(), 7 );
-       auto keyhints = r.keyhints();
-       BOOST_CHECK_EQUAL( keyhints.size(), 5 );
-       std::map<std::string,std::string> check = {
-         { "gpg-pubkey-39db7c82-5847eb1f.asc", "FEAB502539D846DB2C0961CA70AF9E8139DB7C82" },
-         { "gpg-pubkey-307e3d54-5aaa90a5.asc", "4E98E67519D98DC7362A" },
-         { "gpg-pubkey-65176565-59787af5.asc", "637B32FF" },
-         { "gpg-pubkey-3dbdc284-is OK",        "3dbdc284" },
-         { "gpg-pubkey-feab502539d846db2c0961ca70af9e8139db7c82-is OK as well", "feab502539d846db2c0961ca70af9e8139db7c82" },
-         { "gpg-pubkey-536X4dd4-X is not a hexdigit", "must not occur" },
-       };
-       for ( const auto & hint : keyhints ) {
-         BOOST_CHECK_EQUAL( check[hint.first], hint.second );
-       }
+        BOOST_CHECK_EQUAL( r.keywords().size(), 7 );
+        auto keyhints = r.keyhints();
+        BOOST_CHECK_EQUAL( keyhints.size(), 5 );
+        std::map<std::string,std::string> check = {
+          { "gpg-pubkey-39db7c82-5847eb1f.asc", "FEAB502539D846DB2C0961CA70AF9E8139DB7C82" },
+          { "gpg-pubkey-307e3d54-5aaa90a5.asc", "4E98E67519D98DC7362A" },
+          { "gpg-pubkey-65176565-59787af5.asc", "637B32FF" },
+          { "gpg-pubkey-3dbdc284-is OK",        "3dbdc284" },
+          { "gpg-pubkey-feab502539d846db2c0961ca70af9e8139db7c82-is OK as well", "feab502539d846db2c0961ca70af9e8139db7c82" },
+          { "gpg-pubkey-536X4dd4-X is not a hexdigit", "must not occur" },
+        };
+        for ( const auto & hint : keyhints ) {
+          BOOST_CHECK_EQUAL( check[hint.first], hint.second );
+        }
       }
 
       std::ifstream ifs( file.extend(".solution").asString().c_str() );
@@ -71,10 +71,10 @@ BOOST_AUTO_TEST_CASE(repomd_read)
       while ( ifs && !ifs.eof() )
       {
         std::string dtype;
-       getline(ifs, dtype);
-       if ( dtype.empty() )
-         break;
-       BOOST_REQUIRE( count < collect.items.size() );
+        getline(ifs, dtype);
+        if ( dtype.empty() )
+          break;
+        BOOST_REQUIRE( count < collect.items.size() );
         BOOST_CHECK_EQUAL( collect.items[count].first, dtype );
 
         std::string checksum_type;
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(repomd_read)
         getline(ifs, checksum);
         BOOST_CHECK_EQUAL( collect.items[count].second.checksum(), CheckSum(checksum_type, checksum) );
 
-       std::string loc;
+        std::string loc;
         getline(ifs, loc);
         BOOST_CHECK_EQUAL( collect.items[count].second.filename(), Pathname(loc) );
 
index 80ffd56..8fdd0c4 100644 (file)
@@ -26,7 +26,7 @@ class ServiceCollector
 {
 public:
   typedef std::set<ServiceInfo> ServiceSet;
-    
+
   ServiceCollector( ServiceSet & services_r )
     : _services( services_r )
   {}
@@ -45,7 +45,7 @@ private:
 BOOST_AUTO_TEST_CASE(plugin_services)
 {
   ServiceCollector::ServiceSet services;
-    
+
   PluginServices local("/space/tmp/services", ServiceCollector(services));
 }
 
index 51eb985..0226f64 100644 (file)
@@ -117,109 +117,109 @@ BOOST_AUTO_TEST_CASE(init)
       zcfg.setRepoGpgCheck( g_RepoGpgCheck );
       for ( TriBool g_PkgGpgCheck : tribools )
       {
-       zcfg.setPkgGpgCheck( g_PkgGpgCheck );
-
-       // .repo values
-       for ( TriBool r_GpgCheck : tribools )
-       {
-         repo.setGpgCheck( r_GpgCheck );
-         for ( TriBool r_RepoGpgCheck : tribools )
-         {
-           repo.setRepoGpgCheck( r_RepoGpgCheck );
-           for ( TriBool r_PkgGpgCheck : tribools )
-           {
-             repo.setPkgGpgCheck( r_PkgGpgCheck );
-
-             // check the repo methods returning what to do:
-             bool      cfgGpgCheck     = indeterminate(r_GpgCheck)                                  ? g_GpgCheck     : bool(r_GpgCheck);
-             TriBool   cfgRepoGpgCheck = indeterminate(r_GpgCheck) && indeterminate(r_RepoGpgCheck) ? g_RepoGpgCheck : r_RepoGpgCheck;
-             TriBool   cfgPkgGpgCheck  = indeterminate(r_GpgCheck) && indeterminate(r_PkgGpgCheck)  ? g_PkgGpgCheck  : r_PkgGpgCheck;
+        zcfg.setPkgGpgCheck( g_PkgGpgCheck );
+
+        // .repo values
+        for ( TriBool r_GpgCheck : tribools )
+        {
+          repo.setGpgCheck( r_GpgCheck );
+          for ( TriBool r_RepoGpgCheck : tribools )
+          {
+            repo.setRepoGpgCheck( r_RepoGpgCheck );
+            for ( TriBool r_PkgGpgCheck : tribools )
+            {
+              repo.setPkgGpgCheck( r_PkgGpgCheck );
+
+              // check the repo methods returning what to do:
+              bool     cfgGpgCheck     = indeterminate(r_GpgCheck)                                  ? g_GpgCheck     : bool(r_GpgCheck);
+              TriBool  cfgRepoGpgCheck = indeterminate(r_GpgCheck) && indeterminate(r_RepoGpgCheck) ? g_RepoGpgCheck : r_RepoGpgCheck;
+              TriBool  cfgPkgGpgCheck  = indeterminate(r_GpgCheck) && indeterminate(r_PkgGpgCheck)  ? g_PkgGpgCheck  : r_PkgGpgCheck;
 #if ( TC_VERBOSE )
-             COUT << chr(cfgGpgCheck) << "\t" << chr(cfgRepoGpgCheck) << "\t" << chr(cfgPkgGpgCheck)
-                  << "\t(" << chr(r_GpgCheck)     << "," << chr(g_GpgCheck)     << ")"
-                  << "\t(" << chr(r_RepoGpgCheck) << "," << chr(g_RepoGpgCheck) << ")"
-                  << "\t(" << chr(r_PkgGpgCheck)  << "," << chr(g_PkgGpgCheck)  << ")"
-                  << flush;
+              COUT << chr(cfgGpgCheck) << "\t" << chr(cfgRepoGpgCheck) << "\t" << chr(cfgPkgGpgCheck)
+                   << "\t(" << chr(r_GpgCheck)     << "," << chr(g_GpgCheck)     << ")"
+                   << "\t(" << chr(r_RepoGpgCheck) << "," << chr(g_RepoGpgCheck) << ")"
+                   << "\t(" << chr(r_PkgGpgCheck)  << "," << chr(g_PkgGpgCheck)  << ")"
+                   << flush;
 #endif
 
-             // default gpgCeck follows config
-             BOOST_CHECK_EQUAL( repo.gpgCheck(), cfgGpgCheck );
+              // default gpgCeck follows config
+              BOOST_CHECK_EQUAL( repo.gpgCheck(), cfgGpgCheck );
 
 
-             // repoGpgCheck follows gpgCeck
-             // explicitly defined it alters mandatory check
-             bool willCheckRepo  = repo.repoGpgCheck();
-             bool mandatoryCheck = repo.repoGpgCheckIsMandatory();
+              // repoGpgCheck follows gpgCeck
+              // explicitly defined it alters mandatory check
+              bool willCheckRepo  = repo.repoGpgCheck();
+              bool mandatoryCheck = repo.repoGpgCheckIsMandatory();
 #if ( TC_VERBOSE )
-             COUT << "\t" << ( willCheckRepo ? ( mandatoryCheck ? "!" : "+" ) : "-" ) << flush;
+              COUT << "\t" << ( willCheckRepo ? ( mandatoryCheck ? "!" : "+" ) : "-" ) << flush;
 #endif
-             if ( mandatoryCheck )     // be a subset of willCheckRepo!
-               BOOST_CHECK_EQUAL( willCheckRepo, mandatoryCheck );
-
-             if ( cfgGpgCheck )
-             {
-               BOOST_CHECK_EQUAL( willCheckRepo,  true );
-               BOOST_CHECK_EQUAL( mandatoryCheck, !bool(!cfgRepoGpgCheck) );   // TriBool: !false = true or indeterminate
-             }
-             else
-             {
-               BOOST_CHECK_EQUAL( willCheckRepo,  bool(cfgRepoGpgCheck) );
-               BOOST_CHECK_EQUAL( mandatoryCheck, bool(cfgRepoGpgCheck) );
-             }
-
-
-             // pkgGpgCheck may depend on the repoGpgCheck result
-             for ( TriBool r_validSignature : tribools )       // indeterminate <==> unsigned repo
-             {
-               repo.setValidRepoSignature( r_validSignature );
-
-               if ( r_validSignature && !willCheckRepo )
-                 // RepoInfo must invalidate any valid (old) signature as soon as the repo check
-                 // is turned off. This prevents showing 'valid sig' for not yet refreshed repos.
-                 // Instead show 'won't be checked' immediately.
-                 BOOST_CHECK( bool(!repo.validRepoSignature()) );
-               else
-                 BOOST_CHECK( sameTriboolState( repo.validRepoSignature(), r_validSignature ) );
-
-               bool willCheckPkg   = repo.pkgGpgCheck();
-               bool mandatoryCheck = repo.pkgGpgCheckIsMandatory();
+              if ( mandatoryCheck )    // be a subset of willCheckRepo!
+                BOOST_CHECK_EQUAL( willCheckRepo, mandatoryCheck );
+
+              if ( cfgGpgCheck )
+              {
+                BOOST_CHECK_EQUAL( willCheckRepo,  true );
+                BOOST_CHECK_EQUAL( mandatoryCheck, !bool(!cfgRepoGpgCheck) );  // TriBool: !false = true or indeterminate
+              }
+              else
+              {
+                BOOST_CHECK_EQUAL( willCheckRepo,  bool(cfgRepoGpgCheck) );
+                BOOST_CHECK_EQUAL( mandatoryCheck, bool(cfgRepoGpgCheck) );
+              }
+
+
+              // pkgGpgCheck may depend on the repoGpgCheck result
+              for ( TriBool r_validSignature : tribools )      // indeterminate <==> unsigned repo
+              {
+                repo.setValidRepoSignature( r_validSignature );
+
+                if ( r_validSignature && !willCheckRepo )
+                  // RepoInfo must invalidate any valid (old) signature as soon as the repo check
+                  // is turned off. This prevents showing 'valid sig' for not yet refreshed repos.
+                  // Instead show 'won't be checked' immediately.
+                  BOOST_CHECK( bool(!repo.validRepoSignature()) );
+                else
+                  BOOST_CHECK( sameTriboolState( repo.validRepoSignature(), r_validSignature ) );
+
+                bool willCheckPkg   = repo.pkgGpgCheck();
+                bool mandatoryCheck = repo.pkgGpgCheckIsMandatory();
 #if ( TC_VERBOSE )
-               COUT << "\t" << chr(r_validSignature) << ( willCheckPkg ? ( mandatoryCheck ? "!" : "+" ) : "-" ) << flush;
+                COUT << "\t" << chr(r_validSignature) << ( willCheckPkg ? ( mandatoryCheck ? "!" : "+" ) : "-" ) << flush;
 #endif
-               if ( mandatoryCheck )   // be a subset of willCheckPkg!
-                 BOOST_CHECK_EQUAL( willCheckPkg, mandatoryCheck );
-
-               if ( cfgPkgGpgCheck )
-               {
-                 BOOST_CHECK_EQUAL( willCheckPkg,   true );
-                 BOOST_CHECK_EQUAL( mandatoryCheck, true );
-               }
-               else if ( cfgGpgCheck )
-               {
-                 if ( r_validSignature )
-                 {
-                   BOOST_CHECK_EQUAL( willCheckPkg,   false );
-                   BOOST_CHECK_EQUAL( mandatoryCheck, false );
-                 }
-                 else // TriBool: !true = false or indeterminate/unsigned
-                 {
-                   BOOST_CHECK_EQUAL( willCheckPkg,   true );
-                   BOOST_CHECK_EQUAL( mandatoryCheck, !bool(!cfgPkgGpgCheck) ); // TriBool: !false = true or indeterminate/unsigned
-                 }
-               }
-               else
-               {
-                 BOOST_CHECK_EQUAL( willCheckPkg,   false );
-                 BOOST_CHECK_EQUAL( mandatoryCheck, false );
-               }
-             }
+                if ( mandatoryCheck )  // be a subset of willCheckPkg!
+                  BOOST_CHECK_EQUAL( willCheckPkg, mandatoryCheck );
+
+                if ( cfgPkgGpgCheck )
+                {
+                  BOOST_CHECK_EQUAL( willCheckPkg,   true );
+                  BOOST_CHECK_EQUAL( mandatoryCheck, true );
+                }
+                else if ( cfgGpgCheck )
+                {
+                  if ( r_validSignature )
+                  {
+                    BOOST_CHECK_EQUAL( willCheckPkg,   false );
+                    BOOST_CHECK_EQUAL( mandatoryCheck, false );
+                  }
+                  else // TriBool: !true = false or indeterminate/unsigned
+                  {
+                    BOOST_CHECK_EQUAL( willCheckPkg,   true );
+                    BOOST_CHECK_EQUAL( mandatoryCheck, !bool(!cfgPkgGpgCheck) ); // TriBool: !false = true or indeterminate/unsigned
+                  }
+                }
+                else
+                {
+                  BOOST_CHECK_EQUAL( willCheckPkg,   false );
+                  BOOST_CHECK_EQUAL( mandatoryCheck, false );
+                }
+              }
 #if ( TC_VERBOSE )
-             COUT << endl;
+              COUT << endl;
 #endif
 
-           }
-         }
-       }
+            }
+          }
+        }
       }
     }
   }
@@ -284,9 +284,9 @@ struct KeyRingGuard
 };
 
 void testLoadRepo( bool succeed_r,                             // whether loadRepos should succeed or fail with RepoException
-                  const std::string & repo_r,                  // name of the test repo to load
-                  KeyRing::DefaultAccept accept_r,             // Callback response bits to set (mimics user input)
-                  KeyRingReceiver::CallbackList cblist_r )     // Callback sequence list expected
+                   const std::string & repo_r,                 // name of the test repo to load
+                   KeyRing::DefaultAccept accept_r,            // Callback response bits to set (mimics user input)
+                   KeyRingReceiver::CallbackList cblist_r )    // Callback sequence list expected
 {
   KeyRingGuard _guard( accept_r );
   krCallback._cblist = std::move(cblist_r);
@@ -313,23 +313,23 @@ BOOST_AUTO_TEST_CASE(unsigned_repo)
 
   std::string repo( "unsigned_repo" );
   testLoadRepo( true, repo, KeyRing::ACCEPT_NOTHING,
-               { } );
+                { } );
 
   zcfg->setRepoGpgCheck( indeterminate );      // the default
 
   testLoadRepo( false, repo, KeyRing::ACCEPT_NOTHING,
-               { "reportbegin", "askUserToAcceptUnsignedFile", "reportend" } );
+                { "reportbegin", "askUserToAcceptUnsignedFile", "reportend" } );
   testLoadRepo( true, repo, KeyRing::ACCEPT_UNSIGNED_FILE,
-               { "reportbegin", "askUserToAcceptUnsignedFile", "reportend" } );
+                { "reportbegin", "askUserToAcceptUnsignedFile", "reportend" } );
 }
 
 BOOST_AUTO_TEST_CASE(unknownkey_repo)
 {
   std::string repo( "unknownkey_repo" );
   testLoadRepo( false, repo, KeyRing::ACCEPT_NOTHING,
-               { "reportbegin", "askUserToAcceptUnknownKey", "reportend" } );
+                { "reportbegin", "askUserToAcceptUnknownKey", "reportend" } );
   testLoadRepo( true, repo, KeyRing::ACCEPT_UNKNOWNKEY,
-               { "reportbegin", "askUserToAcceptUnknownKey", "reportend" } );
+                { "reportbegin", "askUserToAcceptUnknownKey", "reportend" } );
 }
 
 
@@ -341,26 +341,26 @@ BOOST_AUTO_TEST_CASE(wrongsig_repo)
   // 1st testcase with a key, so on the fly check askUserToAcceptKey
   // being called unless the key is imported in the trusted ring
   testLoadRepo( false, repo, KeyRing::ACCEPT_NOTHING,
-               { "reportbegin", "askUserToAcceptKey", "reportend" } );
+                { "reportbegin", "askUserToAcceptKey", "reportend" } );
   testLoadRepo( false, repo, KeyRing::TRUST_KEY_TEMPORARILY,
-               { "reportbegin", "askUserToAcceptKey", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
+                { "reportbegin", "askUserToAcceptKey", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
   testLoadRepo( false, repo, KeyRing::ACCEPT_NOTHING,
-               { "reportbegin", "askUserToAcceptKey", "reportend" } );
+                { "reportbegin", "askUserToAcceptKey", "reportend" } );
   testLoadRepo( false, repo, KeyRing::TRUST_AND_IMPORT_KEY,
-               { "reportbegin", "askUserToAcceptKey", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
+                { "reportbegin", "askUserToAcceptKey", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
 
   // Now the key is in the trusted ring (no more askUserToAcceptKey)
   testLoadRepo( false, repo, KeyRing::ACCEPT_NOTHING,
-               { "reportbegin", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
+                { "reportbegin", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
   testLoadRepo( true, repo, KeyRing::KeyRing::ACCEPT_VERIFICATION_FAILED,
-               { "reportbegin", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
+                { "reportbegin", "infoVerify", "askUserToAcceptVerificationFailed", "reportend" } );
 }
 
 BOOST_AUTO_TEST_CASE(signed_repo)
 {
   std::string repo( "signed_repo" );
   testLoadRepo( true, repo, KeyRing::KeyRing::ACCEPT_NOTHING,  // relies on wrongsig_repo having accepted the key! (already in trusted ring)
-               { "reportbegin", "infoVerify", "reportend" } );
+                { "reportbegin", "infoVerify", "reportend" } );
 }
 
 
index 62014fa..57905a7 100644 (file)
@@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(RepVarExpand)
 }
 
 void varInAuthExpect( const Url & url_r, const std::string & expHost_r, const std::string & expPort_r, const std::string & expPath_r,
-                     const std::string & user_r = std::string(), const std::string & pass_r = std::string() )
+                      const std::string & user_r = std::string(), const std::string & pass_r = std::string() )
 {
   BOOST_CHECK_EQUAL( url_r.getHost(),     expHost_r );
   BOOST_CHECK_EQUAL( url_r.getPort(),     expPort_r );
@@ -223,16 +223,16 @@ BOOST_AUTO_TEST_CASE(replace_text)
   BOOST_CHECK_NO_THROW( Url("ftp://site.org/${arch:+somearch}/?arch=${arch:+somearch}") );
 
   BOOST_CHECK_EQUAL(replacer2(Url("ftp://user:secret@site.org/$arch/")).asCompleteString(),
-                   "ftp://user:secret@site.org/i686/");
+                    "ftp://user:secret@site.org/i686/");
 
   BOOST_CHECK_EQUAL(replacer2(Url("http://user:my$arch@site.org/$basearch/")).asCompleteString(),
-                   "http://user:my$arch@site.org/i386/");
+                    "http://user:my$arch@site.org/i386/");
 
   BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/?arch=$arch")).asCompleteString(),
-                   "http://site.org/update/?arch=i686");
+                    "http://site.org/update/?arch=i686");
 
   BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/$releasever/?arch=$arch")).asCompleteString(),
-                   "http://site.org/update/13.2/?arch=i686");
+                    "http://site.org/update/13.2/?arch=i686");
 
   // - bsc#1067605: Allow VAR in Url authority
   // fake some host name via $arch
index bc6000e..2b5f446 100644 (file)
@@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(cpeid_value_string_wildcarded)
     BOOST_CHECK( c != wildcardfree );
 #if WFN_STRICT_SPEC
     BOOST_CHECK( c != wildcarded );    // !!! According to the CPE Name Matching Specification Version 2.3
-                                       // unquoted wildcard characters yield an undefined result (not ==).
+                                        // unquoted wildcard characters yield an undefined result (not ==).
 #else
     BOOST_CHECK( c == wildcarded );
 #endif
@@ -253,13 +253,13 @@ BOOST_AUTO_TEST_CASE(cpeid_value_valid)
       BOOST_CHECK_EQUAL( f.asString(), u.asString() );
       if ( ch == '.' )
       {
-       BOOST_CHECK_EQUAL( f.asFs(), chstr );
-       BOOST_CHECK_EQUAL( f.asUri(), chstr );
+        BOOST_CHECK_EQUAL( f.asFs(), chstr );
+        BOOST_CHECK_EQUAL( f.asUri(), chstr );
       }
       else
       {
-       BOOST_CHECK_EQUAL( f.asFs(), qchstr );
-       BOOST_CHECK_EQUAL( f.asUri(), pchstr );
+        BOOST_CHECK_EQUAL( f.asFs(), qchstr );
+        BOOST_CHECK_EQUAL( f.asUri(), pchstr );
       }
 
       BOOST_CHECK( Value( qchstr ).isString() );
@@ -399,20 +399,20 @@ BOOST_AUTO_TEST_CASE(cpeid_strconv)
 {
   // colon embedded in product value
   testStrconv ( "cpe:2.3:a:opensuse:lib\\:zypp:14.16.0:beta:*:*:*:*:*:-",
-               "cpe:/a:opensuse:lib%3azypp:14.16.0:beta:~~~~~-",
-               "wfn:[part=\"a\",vendor=\"opensuse\",product=\"lib\\:zypp\",version=\"14\\.16\\.0\",update=\"beta\",other=NA]" );
+                "cpe:/a:opensuse:lib%3azypp:14.16.0:beta:~~~~~-",
+                "wfn:[part=\"a\",vendor=\"opensuse\",product=\"lib\\:zypp\",version=\"14\\.16\\.0\",update=\"beta\",other=NA]" );
 
   testStrconv ( "cpe:2.3:a:hp:insight_diagnostics:7.4.0.1570:-:*:*:online:win2003:x64:*",
-               "cpe:/a:hp:insight_diagnostics:7.4.0.1570:-:~~online~win2003~x64~",
-               "wfn:[part=\"a\",vendor=\"hp\",product=\"insight_diagnostics\",version=\"7\\.4\\.0\\.1570\",update=NA,sw_edition=\"online\",target_sw=\"win2003\",target_hw=\"x64\"]" );
+                "cpe:/a:hp:insight_diagnostics:7.4.0.1570:-:~~online~win2003~x64~",
+                "wfn:[part=\"a\",vendor=\"hp\",product=\"insight_diagnostics\",version=\"7\\.4\\.0\\.1570\",update=NA,sw_edition=\"online\",target_sw=\"win2003\",target_hw=\"x64\"]" );
 
   testStrconv ( "cpe:2.3:a:hp:openview_network_manager:7.51:*:*:*:*:linux:*:*",
-               "cpe:/a:hp:openview_network_manager:7.51::~~~linux~~",
-               "wfn:[part=\"a\",vendor=\"hp\",product=\"openview_network_manager\",version=\"7\\.51\",target_sw=\"linux\"]" );
+                "cpe:/a:hp:openview_network_manager:7.51::~~~linux~~",
+                "wfn:[part=\"a\",vendor=\"hp\",product=\"openview_network_manager\",version=\"7\\.51\",target_sw=\"linux\"]" );
 
   testStrconv ( "cpe:2.3:a:foo\\\\bar:big\\$money_manager_2010:*:*:*:*:special:ipod_touch:80gb:*",
-               "cpe:/a:foo%5cbar:big%24money_manager_2010:::~~special~ipod_touch~80gb~",
-               "wfn:[part=\"a\",vendor=\"foo\\\\bar\",product=\"big\\$money_manager_2010\",sw_edition=\"special\",target_sw=\"ipod_touch\",target_hw=\"80gb\"]" );
+                "cpe:/a:foo%5cbar:big%24money_manager_2010:::~~special~ipod_touch~80gb~",
+                "wfn:[part=\"a\",vendor=\"foo\\\\bar\",product=\"big\\$money_manager_2010\",sw_edition=\"special\",target_sw=\"ipod_touch\",target_hw=\"80gb\"]" );
 
   BOOST_CHECK_THROW( (CpeId( "cpe:/x:" )), std::invalid_argument );    // illegal part 'x'
   BOOST_CHECK_THROW( CpeId( "cpe:/a:foo%5cbar:big%24money_2010%07:::~~special~ipod_touch~80gb~" ), std::invalid_argument );    // illegal %07
index 5e29f01..528574f 100644 (file)
@@ -28,8 +28,8 @@ BOOST_AUTO_TEST_CASE(digest)
   std::stringstream str2(data);
   std::stringstream str3(data);
 
-  BOOST_CHECK_EQUAL( Digest::digest( "sha1", str1 ), "142df4277c326f3549520478c188cab6e3b5d042" ); 
-  BOOST_CHECK_EQUAL( Digest::digest( "md5", str2 ), "f139a810b84d82d1f29fc53c5e59beae" ); 
+  BOOST_CHECK_EQUAL( Digest::digest( "sha1", str1 ), "142df4277c326f3549520478c188cab6e3b5d042" );
+  BOOST_CHECK_EQUAL( Digest::digest( "md5", str2 ), "f139a810b84d82d1f29fc53c5e59beae" );
   // FIXME i think it should throw
-  BOOST_CHECK_EQUAL( Digest::digest( "lalala", str3) , "" ); 
+  BOOST_CHECK_EQUAL( Digest::digest( "lalala", str3) , "" );
 }
index 1730770..85dc92e 100644 (file)
@@ -12,15 +12,15 @@ BOOST_AUTO_TEST_CASE(drunkenbishop)
   {
     DrunkenBishop b;
     BOOST_CHECK_EQUAL( b.asString(),
-                      "++\n"
-                      "++" );
+                       "++\n"
+                       "++" );
   }
   {
     DrunkenBishop b( "94", 0, 0 );
     BOOST_CHECK_EQUAL( b.asString(),
-                      "+-+\n"
-                      "|E|\n"
-                      "+-+" );
+                       "+-+\n"
+                       "|E|\n"
+                       "+-+" );
   }
   {
     BOOST_CHECK_THROW( DrunkenBishop( "9g" ), std::invalid_argument );
@@ -28,63 +28,63 @@ BOOST_AUTO_TEST_CASE(drunkenbishop)
   {
     DrunkenBishop b( "" );
     BOOST_CHECK_EQUAL( b.asString(),
-                      "+-----------------+\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|        E        |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "+-----------------+" );
+                       "+-----------------+\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|        E        |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "+-----------------+" );
   }
   {
     DrunkenBishop b( "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "Title" );
     BOOST_CHECK_EQUAL( b.asString(),
-                      "+-----[Title]-----+\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|       ^         |\n"
-                      "|        E        |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "+---[CCCCCCCC]----+" );
+                       "+-----[Title]-----+\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|       ^         |\n"
+                       "|        E        |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "+---[CCCCCCCC]----+" );
   }
   {
     DrunkenBishop b( "9c6fb17fa201ad829d808739379a2a51", "very very long Title"   );
     BOOST_CHECK_EQUAL( b.asString(),
-                      "+[very very long ]+\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|                 |\n"
-                      "|  E+   . o       |\n"
-                      "| .= =   S o      |\n"
-                      "|.  * = . + o     |\n"
-                      "| .o . + . =      |\n"
-                      "|..     . . o. .  |\n"
-                      "|o         ...o   |\n"
-                      "+---[379A2A51]----+" );
+                       "+[very very long ]+\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|                 |\n"
+                       "|  E+   . o       |\n"
+                       "| .= =   S o      |\n"
+                       "|.  * = . + o     |\n"
+                       "| .o . + . =      |\n"
+                       "|..     . . o. .  |\n"
+                       "|o         ...o   |\n"
+                       "+---[379A2A51]----+" );
   }
   {
     DrunkenBishop b( "4E98E67519D98DC7362A5990E3A5C360307E3D54" );
     BOOST_CHECK_EQUAL( b.asString(),
-                      "+-------------------+\n"
-                      "|       ^.  .^E     |\n"
-                      "|      . .^^: .     |\n"
-                      "|       ...:^? :    |\n"
-                      "|        .  ?.: i   |\n"
-                      "|        ^   i : .  |\n"
-                      "|       : S l .     |\n"
-                      "|      ^ : . .      |\n"
-                      "|       . .         |\n"
-                      "|                   |\n"
-                      "|                   |\n"
-                      "|                   |\n"
-                      "+----[307E3D54]-----+" );
+                       "+-------------------+\n"
+                       "|       ^.  .^E     |\n"
+                       "|      . .^^: .     |\n"
+                       "|       ...:^? :    |\n"
+                       "|        .  ?.: i   |\n"
+                       "|        ^   i : .  |\n"
+                       "|       : S l .     |\n"
+                       "|      ^ : . .      |\n"
+                       "|       . .         |\n"
+                       "|                   |\n"
+                       "|                   |\n"
+                       "|                   |\n"
+                       "+----[307E3D54]-----+" );
   }
 }
index 523bc60..5f03d0b 100644 (file)
@@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE(enqueuedir_http)
 
       fetcher.reset();
   }
-  
+
   web.stop();
 }
 
index 404c400..3867bcb 100644 (file)
@@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(keyring_test)
   Pathname file2( Pathname(DATADIR) + "hello2.txt" );
   Pathname pubkey( Pathname(DATADIR) + "hello.txt.key" );
   Pathname signature( Pathname(DATADIR) + "hello.txt.asc" );
-  
+
   /**
    * 1st scenario, the signature does
    * match
@@ -38,13 +38,13 @@ BOOST_AUTO_TEST_CASE(keyring_test)
   {
     KeyRingTestReceiver keyring_callbacks;
     KeyRingTestSignalReceiver receiver;
-    
+
     keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
     SignatureFileChecker sigchecker( signature );
     sigchecker.addPublicKey(pubkey);
-    sigchecker(file); 
+    sigchecker(file);
   }
-  
+
   /**
    * second scenario, the signature does not
    * match, an exception has to be thrown
@@ -52,15 +52,15 @@ BOOST_AUTO_TEST_CASE(keyring_test)
   {
     KeyRingTestReceiver keyring_callbacks;
     KeyRingTestSignalReceiver receiver;
-    
+
     keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
     SignatureFileChecker sigchecker( signature );
     sigchecker.addPublicKey(pubkey);
-    
+
     BOOST_CHECK_THROW( sigchecker(file2), zypp::Exception );
 
   }
-  
+
 }
 
 BOOST_AUTO_TEST_CASE(checksum_test)
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(checksum_test)
   Pathname file2( Pathname(DATADIR) + "hello2.txt" );
   Pathname pubkey( Pathname(DATADIR) + "hello.txt.key" );
   Pathname signature( Pathname(DATADIR) + "hello.txt.asc" );
-  
+
   /**
    * 1st scenario, checksum matches
    */
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(checksum_test)
     ChecksumFileChecker checker( CheckSum("sha1", "f2105202a0f017ab818b670d04982a89f55f090b") );
     checker(file);
   }
-  
+
   /**
    * 1st scenario, checksum does not matches
    */
index 8c65f20..17e7572 100644 (file)
@@ -31,43 +31,43 @@ struct KeyRingTestReceiver : public zypp::callback::ReceiveReport<zypp::KeyRingR
     _asked_user_to_accept_ver_failed = false;
     _asked_user_to_accept_unsigned_file = false;
   }
-  
+
   ~KeyRingTestReceiver()
   {
     disconnect();
   }
-  
+
   void answerAcceptVerFailed( bool answer )
   { _answer_ver_failed = answer; }
-  
+
   bool askedAcceptVerFailed() const
   { return _asked_user_to_accept_ver_failed; }
-  
+
   void answerAcceptUnknownKey( bool answer )
   { _answer_accept_unknown_key = answer; }
-  
+
   bool askedAcceptUnknownKey() const
   { return _asked_user_to_accept_unknown_key; }
-  
+
   void answerAcceptKey( KeyRingReport::KeyTrust answer )
   { _answer_accept_key = answer; }
-  
+
   bool askedAcceptKey() const
   { return _asked_user_to_accept_key; }
 
   void answerAcceptUnsignedFile( bool answer )
   { _answer_accept_unsigned_file = answer; }
-  
+
   bool askedAcceptUnsignedFile() const
   { return _asked_user_to_accept_unsigned_file; }
-    
+
   virtual bool askUserToAcceptUnsignedFile( const std::string &file, const zypp::KeyContext &keycontext )
   {
     MIL << std::endl;
     _asked_user_to_accept_unsigned_file = true;
     return _answer_accept_unsigned_file;
   }
-  
+
   virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id, const zypp::KeyContext &keycontext )
   {
     MIL << std::endl;
@@ -88,13 +88,13 @@ struct KeyRingTestReceiver : public zypp::callback::ReceiveReport<zypp::KeyRingR
     _asked_user_to_accept_ver_failed = true;
     return _answer_ver_failed;
   }
-  
+
   // how to answer
   bool _answer_accept_unknown_key;
   KeyRingReport::KeyTrust _answer_accept_key;
   bool _answer_ver_failed;
   bool _answer_accept_unsigned_file;
-  
+
   // we use this variables to check that the
   // callbacks were called
   bool _asked_user_to_accept_unknown_key;
@@ -134,9 +134,9 @@ struct KeyRingTestSignalReceiver : zypp::callback::ReceiveReport<zypp::KeyRingSi
   virtual void trustedKeyRemoved( const zypp::PublicKey &key  )
   {
   }
-  
+
   bool _trusted_key_added_called;
-  
+
 };
 
 #endif
index 2628c07..81ee7cc 100644 (file)
@@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(keyring_test)
 {
   PublicKey key( Pathname(DATADIR) + "public.asc" );
 
- /** 
+ /**
   * scenario #1
   * import a not trusted key
   * ask for accept, answer yes 'temporarily'
@@ -40,27 +40,27 @@ BOOST_AUTO_TEST_CASE(keyring_test)
 
     BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 );
     BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 );
-  
+
     keyring.importKey( key, false );
-    
+
     BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 1 );
     BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 );
-    
+
     BOOST_CHECK_MESSAGE( keyring.isKeyKnown( key.id() ), "Imported untrusted key should be known");
     BOOST_CHECK_MESSAGE( ! keyring.isKeyTrusted( key.id() ), "Imported untrusted key should be untrusted");
-    
+
     keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
     bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", DATADIR + "repomd.xml.asc");
-  
+
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known");
     BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptKey(), "Verify Signature Workflow with only 1 untrusted key should ask user wether to trust and/or import");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptVerFailed(), "The signature validates");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnsignedFile(), "It is a signed file, so dont ask the opposite");
-    
+
     BOOST_CHECK_MESSAGE( to_continue, "We did not import, but we trusted and signature validates.");
   }
 
-  /** 
+  /**
   * scenario #1.1
   * import a not trusted key
   * ask to accept, answer yes 'temporarily'
@@ -72,17 +72,17 @@ BOOST_AUTO_TEST_CASE(keyring_test)
     // base sandbox for playing
     TmpDir tmp_dir;
     KeyRing keyring( tmp_dir.path() );
-    
+
     BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 );
     BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 );
-  
+
     keyring.importKey( key, false );
-    
+
     keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
 
     // now we will recheck with a corrupted file
     bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml.corrupted", "Blah Blah", DATADIR + "repomd.xml.asc");
-    
+
     // check wether the user got the right questions
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known");
     BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptKey(), "Verify Signature Workflow with only 1 untrusted key should ask user wether to trust and/or import");
@@ -91,8 +91,8 @@ BOOST_AUTO_TEST_CASE(keyring_test)
 
     BOOST_CHECK_MESSAGE( ! to_continue, "We did not continue with a corrupted file");
   }
-  
-   /** 
+
+   /**
   * scenario #1.2
   * import a not trusted key
   * ask for trust, answer yes
@@ -105,22 +105,22 @@ BOOST_AUTO_TEST_CASE(keyring_test)
     // base sandbox for playing
     TmpDir tmp_dir;
     KeyRing keyring( tmp_dir.path() );
-    
+
     keyring.importKey( key, false );
-    
+
     keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
     // now we will recheck with a unsigned file
     bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", Pathname() );
-    
+
     // check wether the user got the right questions
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptKey(), "No signature, no key to trust");
     BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptUnsignedFile(), "Ask the user wether to accept an unsigned file");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptVerFailed(), "There is no signature to verify");
-    
+
     BOOST_CHECK_MESSAGE( ! to_continue, "We did not continue with a unsigned file");
   }
-  
+
  /** scenario #2
   * empty keyring
   * should ask for unknown key
@@ -153,27 +153,27 @@ BOOST_AUTO_TEST_CASE(keyring_test)
     // base sandbox for playing
     TmpDir tmp_dir;
     KeyRing keyring( tmp_dir.path() );
-    
+
     BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 );
     BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 );
-  
+
     keyring.importKey( key, true );
 
     BOOST_CHECK_EQUAL( receiver._trusted_key_added_called, true );
-    
+
     BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 );
     BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 1 );
-    
+
     BOOST_CHECK_MESSAGE( keyring.isKeyKnown( key.id() ), "Imported trusted key should be known");
     BOOST_CHECK_MESSAGE( keyring.isKeyTrusted( key.id() ), "Imported trusted key should be trusted");
-    
+
     bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", DATADIR + "repomd.xml.asc");
-  
+
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptKey(), "Verify Signature Workflow with only 1 untrusted key should ask user wether to trust and/or import");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptVerFailed(), "The signature validates");
     BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnsignedFile(), "It is a signed file, so dont ask the opposite");
-    
+
     BOOST_CHECK_MESSAGE( to_continue, "We did not import, but we trusted and signature validates.");
   }
   //keyring.importKey( key, true );
@@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(keyring_test)
   //BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), 1 );
 
   /* check signature id can be extracted */
-  
+
 }
 
 BOOST_AUTO_TEST_CASE(signature_test)
@@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(signature_test)
     // base sandbox for playing
     TmpDir tmp_dir;
     KeyRing keyring( tmp_dir.path() );
-    
+
     BOOST_CHECK_EQUAL( keyring.readSignatureKeyId( DATADIR + "repomd.xml.asc" ), "BD61D89BD98821BE" );
     BOOST_CHECK_THROW( keyring.readSignatureKeyId(Pathname()), Exception );
     TmpFile tmp;
index 1dfe0ea..576892a 100644 (file)
@@ -121,8 +121,8 @@ BOOST_AUTO_TEST_CASE(locale)
   {
     for ( const Locale & l : { Locale(), Locale( "" ), Locale( "@UTF-8" ), Locale( ".UTF-8" )
                              , Locale( LanguageCode(), CountryCode(nullptr) )
-                            , Locale( LanguageCode(nullptr), CountryCode() )
-                            , Locale( LanguageCode(), CountryCode() ) } )
+                             , Locale( LanguageCode(nullptr), CountryCode() )
+                             , Locale( LanguageCode(), CountryCode() ) } )
     {
       BOOST_CHECK_EQUAL( l.id(),               IdString::Empty.id() );
       BOOST_CHECK_EQUAL( l.language().id(),    IdString::Empty.id() );
index 2d4ac17..69af3fc 100644 (file)
@@ -70,11 +70,11 @@ BOOST_AUTO_TEST_CASE(locks_save_load)
   {
     BOOST_CHECK(isLocked(*it));
   }
-#if 1 
+#if 1
   filesystem::TmpFile testfile;
   //Pathname testfile(TESTS_SRC_DIR);
     //  testfile += "/zypp/data/Locks/testlocks";
-  Locks::instance().removeLock(q); 
+  Locks::instance().removeLock(q);
   Locks::instance().save(testfile);
   Locks::instance().readAndApply(testfile);
   //now unlocked
index 68731f7..5fa475c 100644 (file)
@@ -87,7 +87,7 @@ unsigned qtest( const std::string & pattern_r, Match::Mode mode_r, bool verbose_
       nlist( cout << "    o", o );
       nlist( cout << "    r", r );
       if ( ! verbose_r )
-       return qtestSIZEMISS;
+        return qtestSIZEMISS;
     }
   }
   catch ( const zypp::MatchInvalidRegexException & excpt )
index f2ed84d..cd8aabf 100644 (file)
@@ -890,9 +890,9 @@ namespace
     do {
       PoolQuery q;
       if ( q.recover( s ) )
-       *out_r++ = std::move(q);
+        *out_r++ = std::move(q);
       else
-       break;
+        break;
     } while ( true );
   }
 
index acdf1aa..251cd41 100644 (file)
@@ -20,40 +20,40 @@ BOOST_AUTO_TEST_CASE(progressdata_test)
   {
     ProgressData progress(100);
     CombinedProgressData sub1rcv(progress, 80);
-    
+
     ProgressData sub1progress(100);
     sub1progress.sendTo(sub1rcv);
-    
+
     // task 1 goes to 50%
     sub1progress.set(50);
     // which is 50% of 80% in task 1
     BOOST_CHECK_EQUAL( progress.val(), 40 );
   }
-  
+
   {
     ProgressData progress(40000);
     CombinedProgressData sub2rcv(progress, 10000);
-    
+
     ProgressData sub2progress(500);
     sub2progress.sendTo(sub2rcv);
     sub2progress.set(250);
-    
+
     // which is 50% of 80% in task 1
     BOOST_CHECK_EQUAL( progress.val(), 5000 );
   }
-  
+
   {
     ProgressData progress(20000,60000);
     CombinedProgressData sub2rcv(progress, 10000);
-    
+
     ProgressData sub2progress(500);
     sub2progress.sendTo(sub2rcv);
     sub2progress.set(250);
-    
+
     // which is 50% of 80% in task 1
     BOOST_CHECK_EQUAL( progress.val(), 25000 );
   }
-  
+
 }
-   
+
 
index 12ed695..9489bbf 100644 (file)
@@ -150,7 +150,7 @@ void testTable( Transition transition, Evaluate evaluate )
 //
 
 #define DOCHECK( FROMSTATE, TOSTATE, C_DONE, C_STATE, C_CAUSER ) \
-       if ( ResStatus::FROMSTATE == fromState && TOSTATE == toState ) { C_DONE; CHECK_STATE( C_STATE ); C_CAUSER; }
+        if ( ResStatus::FROMSTATE == fromState && TOSTATE == toState ) { C_DONE; CHECK_STATE( C_STATE ); C_CAUSER; }
 
 void evaluateSetTransact( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy,
                           bool                     toState,   ResStatus::TransactByValue toBy,
@@ -169,8 +169,8 @@ void evaluateSetTransact( ResStatus::TransactValue fromState, ResStatus::Transac
 }
 
 void evaluateSetSoftTransact( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy,
-                             bool                     toState,   ResStatus::TransactByValue toBy,
-                             bool                     done,      ResStatus                  result )
+                              bool                     toState,   ResStatus::TransactByValue toBy,
+                              bool                     done,      ResStatus                  result )
 {
   ResStatus from;
   initStatus( fromState, fromBy, from );
index 8b0e6a1..157b7b3 100644 (file)
@@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(resolvable_test)
             //BOOST_CHECK( ! asKind<Pattern>(pitem->resolvable())->contents().empty() );
             MIL << asKind<Pattern>(pitem->resolvable()) << endl;
             pattern_count++;
-        }        
+        }
     }
     BOOST_CHECK(pattern_count > 0);
 }
index d504ae8..bfa8459 100644 (file)
@@ -40,7 +40,7 @@ namespace
     {}
 
     CheckResult( RpmDb::CheckPackageResult && result_r,
-                std::vector<std::pair<RpmDb::CheckPackageResult,std::string>> && detail_r )
+                 std::vector<std::pair<RpmDb::CheckPackageResult,std::string>> && detail_r )
     : result { std::move(result_r) }
     { static_cast<std::vector<std::pair<RpmDb::CheckPackageResult,std::string>>&>(detail) = std::move(detail_r); }
 
@@ -63,7 +63,7 @@ namespace
     for ( const auto & l : lhs.detail )
     {
       if ( std::find( rhs.detail.begin(), rhs.detail.end(), l ) == rhs.detail.end() )
-       return false;
+        return false;
     }
     return true;
   }
index d54f6d2..e95095a 100644 (file)
@@ -16,7 +16,7 @@ using namespace zypp;
 
 
 void signature_test()
-{  
+{
 }
 
 test_suite*
index 7b80e08..511fbb0 100644 (file)
@@ -28,9 +28,9 @@ namespace tools
 
   // CB data tracker
   void outs( std::ostream & str,
-            std::optional<std::string_view> w = std::optional<std::string_view>(),
-            std::optional<unsigned> i = std::optional<unsigned>(),
-            std::optional<bool> f = std::optional<bool>() )
+             std::optional<std::string_view> w = std::optional<std::string_view>(),
+             std::optional<unsigned> i = std::optional<unsigned>(),
+             std::optional<bool> f = std::optional<bool>() )
   { outsopt(str,w); outsopt(str,i); outsopt(str,f) << endl; }
 
 } // namespace tools
@@ -60,30 +60,30 @@ BOOST_AUTO_TEST_CASE(WordConsumerSignature)
 
   // Trace:
   BOOST_CHECK_EQUAL( str.str(),
-                    "{}{0}{0}\n"       // F1
-                    "{0b2}{1}{1}\n"
-                    "{}{0}{@}\n"       // F2
-                    "{0b2}{1}{@}\n"
-                    "{}{@}{@}\n"       // F3
-                    "{0b2}{@}{@}\n"
-                    "{@}{@}{@}\n"      // F4
-                    "{@}{@}{@}\n"
-                    "{}{0}{0}\n"       // T1
-                    "{0}{1}{0}\n"
-                    "{2}{2}{0}\n"
-                    "{}{3}{1}\n"
-                    "{}{0}{@}\n"       // T2
-                    "{0}{1}{@}\n"
-                    "{2}{2}{@}\n"
-                    "{}{3}{@}\n"
-                    "{}{@}{@}\n"       // T3
-                    "{0}{@}{@}\n"
-                    "{2}{@}{@}\n"
-                    "{}{@}{@}\n"
-                    "{@}{@}{@}\n"      // T4
-                    "{@}{@}{@}\n"
-                    "{@}{@}{@}\n"
-                    "{@}{@}{@}\n"
+                     "{}{0}{0}\n"      // F1
+                     "{0b2}{1}{1}\n"
+                     "{}{0}{@}\n"      // F2
+                     "{0b2}{1}{@}\n"
+                     "{}{@}{@}\n"      // F3
+                     "{0b2}{@}{@}\n"
+                     "{@}{@}{@}\n"     // F4
+                     "{@}{@}{@}\n"
+                     "{}{0}{0}\n"      // T1
+                     "{0}{1}{0}\n"
+                     "{2}{2}{0}\n"
+                     "{}{3}{1}\n"
+                     "{}{0}{@}\n"      // T2
+                     "{0}{1}{@}\n"
+                     "{2}{2}{@}\n"
+                     "{}{3}{@}\n"
+                     "{}{@}{@}\n"      // T3
+                     "{0}{@}{@}\n"
+                     "{2}{@}{@}\n"
+                     "{}{@}{@}\n"
+                     "{@}{@}{@}\n"     // T4
+                     "{@}{@}{@}\n"
+                     "{@}{@}{@}\n"
+                     "{@}{@}{@}\n"
   );
 }
 
@@ -93,7 +93,7 @@ namespace tools
 
   /* Call splitter_r and check whether CB results match word_r. May CB abort at stopAt_r. */
   void checkSplit( std::function<unsigned(WordConsumer&&)> splitter_r, const std::initializer_list<const char*> & words_r,
-                  unsigned stopAt_r = -1U )
+                   unsigned stopAt_r = -1U )
   {
     //cout << "??? " << words_r.size() << endl;
     auto next = words_r.begin();
index 7f44363..914d06e 100644 (file)
@@ -22,8 +22,8 @@ using boost::unit_test::test_case;
 using namespace zypp;
 
 void testUrlAuthority( const Url & url_r,
-                      const std::string & host_r, const std::string & port_r = std::string(),
-                      const std::string & user_r = std::string(), const std::string & pass_r = std::string() )
+                       const std::string & host_r, const std::string & port_r = std::string(),
+                       const std::string & user_r = std::string(), const std::string & pass_r = std::string() )
 {
   BOOST_CHECK_EQUAL( url_r.getUsername(),      user_r );
   BOOST_CHECK_EQUAL( url_r.getPassword(),      pass_r );
index 27a7718..0a6fb16 100644 (file)
@@ -34,18 +34,18 @@ BOOST_AUTO_TEST_CASE(glob2rx)
     {
       s[0] = x[1] = *ch;
       if ( *ch == '?' )
-       BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), "." );
+        BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), "." );
       else if ( *ch == '*' )
-       BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), ".*" );
+        BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), ".*" );
       else if ( *ch == '[' )
-       BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), "\\[" );     // no closing ] so it is literal
-       else if ( *ch == '\\' )
-         BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), "\\" );    // actually an input error as "\" is not a valid GLOB
-         else
-         {
-           s[0] = x[1] = *ch;
-           BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), x );
-         }
+        BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), "\\[" );    // no closing ] so it is literal
+        else if ( *ch == '\\' )
+          BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), "\\" );   // actually an input error as "\" is not a valid GLOB
+          else
+          {
+            s[0] = x[1] = *ch;
+            BOOST_CHECK_EQUAL( str::rxEscapeGlob( s ), x );
+          }
     }
     std::string a( str::rxEscapeStr( RXspecial ) );    // all rx/glob special chars are literally (\-escaped)
     BOOST_CHECK_EQUAL( str::rxEscapeGlob( a ), a );    // nothing more to escape.
@@ -387,13 +387,13 @@ BOOST_AUTO_TEST_CASE(hexencode_hexdecode)
 
       if ( *d1 <= 'F' &&  *d2 <= 'F' )
       {
-       BOOST_CHECK_EQUAL( u, l );              // no matter if upper or lower case hexdigit
-       BOOST_CHECK_EQUAL( u.size(), 1 );       // size 1 == decoded
+        BOOST_CHECK_EQUAL( u, l );             // no matter if upper or lower case hexdigit
+        BOOST_CHECK_EQUAL( u.size(), 1 );      // size 1 == decoded
       }
       else
       {
-       BOOST_CHECK_EQUAL( u, eu );             // no hexdigits remain unchanged
-       BOOST_CHECK_EQUAL( l, el );
+        BOOST_CHECK_EQUAL( u, eu );            // no hexdigits remain unchanged
+        BOOST_CHECK_EQUAL( l, el );
      }
     }
 }
index c33d97f..705c8d5 100644 (file)
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(SysconfigWrite)
   filesystem::copy( file, tmpf.path() );
 
   BOOST_REQUIRE_THROW( zypp::base::sysconfig::writeStringVal( "/tmp/wrzlprmpf", "PROXY_ENABLED", "yes", "# fifi\n fofo\n" ),
-                      zypp::Exception );
+                       zypp::Exception );
   BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "PROXY_ENABLED", "yes", "# fifi\n fofo\n" ) );
   BOOST_CHECK( !zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW1","12" ) );
   BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW2","13", "# fifi\n# fofo" ) );
@@ -49,27 +49,27 @@ BOOST_AUTO_TEST_CASE(SysconfigWrite)
   std::ostringstream s;
   ExternalProgram( "diff -u " + file.asString() + " " + tmpf.path().asString() + " | tail -n +3" ) >> s;
   BOOST_CHECK_EQUAL( s.str(),
-                    "@@ -8,7 +8,7 @@\n"
-                    " # This setting allows to turn the proxy on and off while\n"
-                    " # preserving the particular proxy setup.\n"
-                    " #\n"
-                    "-PROXY_ENABLED=\"no\"\n"
-                    "+PROXY_ENABLED=\"yes\"\n"
-                    " \n"
-                    " ## Type:\tstring\n"
-                    " ## Default:\t\"\"\n"
-                    "@@ -49,3 +49,11 @@\n"
-                    " # Example: NO_PROXY=\"www.me.de, do.main, localhost\"\n"
-                    " #\n"
-                    " NO_PROXY=\"localhost, 127.0.0.1\"\n"
-                    "+\n"
-                    "+# fifi\n"
-                    "+# fofo\n"
-                    "+NEW2=\"13\"\n"
-                    "+\n"
-                    "+# fifi\n"
-                    "+# ffofo\n"
-                    "+NEW3=\"13\\\"str\\\"\"\n"
+                     "@@ -8,7 +8,7 @@\n"
+                     " # This setting allows to turn the proxy on and off while\n"
+                     " # preserving the particular proxy setup.\n"
+                     " #\n"
+                     "-PROXY_ENABLED=\"no\"\n"
+                     "+PROXY_ENABLED=\"yes\"\n"
+                     " \n"
+                     " ## Type:\tstring\n"
+                     " ## Default:\t\"\"\n"
+                     "@@ -49,3 +49,11 @@\n"
+                     " # Example: NO_PROXY=\"www.me.de, do.main, localhost\"\n"
+                     " #\n"
+                     " NO_PROXY=\"localhost, 127.0.0.1\"\n"
+                     "+\n"
+                     "+# fifi\n"
+                     "+# fofo\n"
+                     "+NEW2=\"13\"\n"
+                     "+\n"
+                     "+# fifi\n"
+                     "+# ffofo\n"
+                     "+NEW3=\"13\\\"str\\\"\"\n"
   );
 }
 
index c6c25ef..e35359a 100644 (file)
@@ -68,10 +68,10 @@ int main( int argc, char * argv[] )
     {
       --argc,++argv;
       if ( ! argc )
-       return errexit("--root requires an argument.");
+        return errexit("--root requires an argument.");
 
       if ( ! PathInfo( *argv ).isDir() )
-       return errexit("--root requires a directory.");
+        return errexit("--root requires a directory.");
 
       sysRoot = *argv;
     }
@@ -159,9 +159,9 @@ int main( int argc, char * argv[] )
     if ( verbose )
     {
       for_( it, sel->installedBegin(), sel->installedEnd() )
-       dumpPi( message, *it );
+        dumpPi( message, *it );
       for_( it, sel->availableBegin(), sel->availableEnd() )
-       dumpPi( message, *it );
+        dumpPi( message, *it );
     }
   }
 
index 8b22073..c3c4160 100644 (file)
@@ -63,7 +63,7 @@ namespace argparse
     , _hasarg { hasarg_r }
     {
       if ( hasarg_r == Arg::optional )
-       throw OptionException( "Not yet implemented: Option::Arg::optional" );
+        throw OptionException( "Not yet implemented: Option::Arg::optional" );
     }
 
     const std::string & descr() const
@@ -99,26 +99,26 @@ namespace argparse
 
       Injector & operator()( const std::string & names_r, std::string descr_r, Option::Arg hasarg_r = Option::Arg::none )
       {
-       smatch result;
-       if ( regex_match( names_r, result, regex("([[:alnum:]][-_[:alnum:]]+)(,([[:alnum:]]))?") ) )
-       {
-         auto opt = std::make_shared<const Option>( std::move(descr_r), hasarg_r );
-         add( result[1], opt );
-         if ( ! result[3].empty() )
-           add( result[3], opt );
-       }
-       else
-         throw OptionException( "Illegal option names: ", names_r );
-
-       return *this;
+        smatch result;
+        if ( regex_match( names_r, result, regex("([[:alnum:]][-_[:alnum:]]+)(,([[:alnum:]]))?") ) )
+        {
+          auto opt = std::make_shared<const Option>( std::move(descr_r), hasarg_r );
+          add( result[1], opt );
+          if ( ! result[3].empty() )
+            add( result[3], opt );
+        }
+        else
+          throw OptionException( "Illegal option names: ", names_r );
+
+        return *this;
       }
 
     private:
       void add( std::string name_r, std::shared_ptr<const Option> opt_r )
       {
-       if ( _optmap.count( name_r ) )
-         throw OptionException( "Duplicate option name: ", name_r );
-       _optmap[name_r] = opt_r;
+        if ( _optmap.count( name_r ) )
+          throw OptionException( "Duplicate option name: ", name_r );
+        _optmap[name_r] = opt_r;
       }
 
     private:
@@ -137,28 +137,28 @@ namespace argparse
       str_r << "OPTIONS:";
       if ( ! _optmap.empty() )
       {
-       std::unordered_map<std::shared_ptr<const Option>, std::string> unify;
-       for ( const auto & p : _optmap )
-       {
-         std::string & t { unify[p.second] };
-         if ( t.empty() )
-           t = (p.first.length()>1?"--":"-")+p.first;
-         else if ( p.first.length() > 1 )
-           t = "--"+p.first+", "+t;
-         else
-           t = t+", -"+p.first;
-       }
-
-       boost::format fmt( "\n    %1% %|30t|%2%" );
-       for ( const auto & p : unify )
-       {
-         fmt % p.second % p.first->descr();
-         str_r << fmt.str();
-       }
+        std::unordered_map<std::shared_ptr<const Option>, std::string> unify;
+        for ( const auto & p : _optmap )
+        {
+          std::string & t { unify[p.second] };
+          if ( t.empty() )
+            t = (p.first.length()>1?"--":"-")+p.first;
+          else if ( p.first.length() > 1 )
+            t = "--"+p.first+", "+t;
+          else
+            t = t+", -"+p.first;
+        }
+
+        boost::format fmt( "\n    %1% %|30t|%2%" );
+        for ( const auto & p : unify )
+        {
+          fmt % p.second % p.first->descr();
+          str_r << fmt.str();
+        }
       }
       else
       {
-       str_r << "    This command accepts no options.";
+        str_r << "    This command accepts no options.";
       }
       return str_r;
     }
@@ -187,7 +187,7 @@ namespace argparse
     const std::string & arg() const
     {
       if ( ! _arg )
-       throw std::domain_error( "No arg value" );
+        throw std::domain_error( "No arg value" );
 
       return *_arg;
     }
@@ -213,7 +213,7 @@ namespace argparse
     {
       auto iter = _optmap.find( optname_r );
       if ( iter == _optmap.end() )
-       return 0;
+        return 0;
 
       auto resiter = _options.find( iter->second );
       return( resiter == _options.end() ? 0 : 1 );
@@ -233,32 +233,32 @@ namespace argparse
       bool collectpositional = false;
       for ( --argc,++argv; argc; --argc,++argv )
       {
-       if ( (*argv)[0] == '-' && !collectpositional )
-       {
-         if ( (*argv)[1] == '-' )
-         {
-           if ( (*argv)[2] == '\0' )
-           {
-             // -- rest are positional...
-             collectpositional = true;
-           }
-           else
-           {
-             // --longopt
-             parseoptl( (*argv)+2, argc, argv );
-           }
-         }
-         else
-         {
-           // -s(hortopt)
-           parseopts( (*argv)+1, argc, argv );
-         }
-       }
-       else
-       {
-         // positional
-         _positionals.push_back( *argv );
-       }
+        if ( (*argv)[0] == '-' && !collectpositional )
+        {
+          if ( (*argv)[1] == '-' )
+          {
+            if ( (*argv)[2] == '\0' )
+            {
+              // -- rest are positional...
+              collectpositional = true;
+            }
+            else
+            {
+              // --longopt
+              parseoptl( (*argv)+2, argc, argv );
+            }
+          }
+          else
+          {
+            // -s(hortopt)
+            parseopts( (*argv)+1, argc, argv );
+          }
+        }
+        else
+        {
+          // positional
+          _positionals.push_back( *argv );
+        }
       }
     }
 
@@ -269,7 +269,7 @@ namespace argparse
     void parseoptl( const std::string & name_r, int & argc, char **& argv )
     {
       if ( name_r.length() < 2 )
-       throw OptionException( "Illegal long opt: --", name_r );
+        throw OptionException( "Illegal long opt: --", name_r );
 
       parseopt( name_r, argc, argv );
     }
@@ -277,7 +277,7 @@ namespace argparse
     void parseopts( const std::string & name_r, int & argc, char **& argv )
     {
      if ( name_r.length() != 1 )
-       throw OptionException( "Illegal short opt: -", name_r );
+        throw OptionException( "Illegal short opt: -", name_r );
 
      parseopt( name_r, argc, argv );
     }
@@ -288,21 +288,21 @@ namespace argparse
 
       auto iter = _options.find( opt );
       if ( iter != _options.end() )
-       throw OptionException( "Multiple occurrences of option: ", dashed( name_r ) );
+        throw OptionException( "Multiple occurrences of option: ", dashed( name_r ) );
 
       if ( opt->hasarg() != Option::Arg::none )
       {
-       if ( opt->hasarg() == Option::Arg::optional )
-         throw OptionException( "Not yet implemented: Option::Arg::optional" ); // i.e. '--opt=arg'
+        if ( opt->hasarg() == Option::Arg::optional )
+          throw OptionException( "Not yet implemented: Option::Arg::optional" ); // i.e. '--opt=arg'
 
-       if ( argc < 2 )
-         throw OptionException( "Missing argument for option: ", dashed( name_r ) );
+        if ( argc < 2 )
+          throw OptionException( "Missing argument for option: ", dashed( name_r ) );
 
-       --argc,++argv;
-       moveToResult( opt, OptionValue( opt, *argv ) );
+        --argc,++argv;
+        moveToResult( opt, OptionValue( opt, *argv ) );
       }
       else
-       moveToResult( opt, OptionValue( opt ) );
+        moveToResult( opt, OptionValue( opt ) );
     }
 
     void moveToResult( std::shared_ptr<const Option> opt_r, OptionValue && value_r )
@@ -312,7 +312,7 @@ namespace argparse
     {
       auto iter = _optmap.find( name_r );
       if ( iter == _optmap.end() )
-       throw OptionException( "Unknown option: ", dashed( name_r ) );
+        throw OptionException( "Unknown option: ", dashed( name_r ) );
       return iter->second;
     }
 
@@ -320,7 +320,7 @@ namespace argparse
     {
       auto iter = _options.find( requireOptByName( name_r ) );
       if ( iter == _options.end() )
-       throw OptionException( "Option not present: ", dashed( name_r ) );
+        throw OptionException( "Option not present: ", dashed( name_r ) );
       return iter->second;
     }
 
index 5501603..c0b5e3f 100644 (file)
@@ -69,13 +69,13 @@ struct PQSort
       bool l = lhs.isSystem();
       bool r = rhs.isSystem();
       if ( l != r )
-       return r;
+        return r;
     }
     {
       IdString l { lhs.ident() };
       IdString r { rhs.ident() };
       if ( l != r )
-       return l < r;
+        return l < r;
     }
     return avo( PoolItem(lhs), PoolItem(rhs) );
     return lhs.id() > rhs.id();
@@ -104,10 +104,10 @@ struct Table
     for_( match, it_r.matchesBegin(), it_r.matchesEnd() ) {
       std::string ent { match->inSolvAttr().asString().substr( 9, 3 )+": " +match->asString() };
       if ( match->inSolvAttr() == sat::SolvAttr::requires
-       && match->inSolvable().prerequires().contains( Capability(match->id()) ) ) {
-       static const char * pre = "   " COL_C "[PRE]" COL_OFF;
-       ent[3] = '+';
-       ent += pre;
+        && match->inSolvable().prerequires().contains( Capability(match->id()) ) ) {
+        static const char * pre = "   " COL_C "[PRE]" COL_OFF;
+        ent[3] = '+';
+        ent += pre;
       }
       details.insert( std::move(ent) );
     }
@@ -139,10 +139,10 @@ struct Table
       const char * tagCol = slv.isSystem() ? COL_M : ui::Selectable::get(slv)->identicalInstalled(PoolItem(slv)) ? COL_C : "";
 
       str << str::form( "%s"    fmtSID S fmtNAME S "%s"    fmtREPO S fmtTIME S fmtVEND COL_OFF "\n",
-                       tagCol, argSID,  argNAME,  tagCol, argREPO,  argTIME,  argVEND );
+                        tagCol, argSID,  argNAME,  tagCol, argREPO,  argTIME,  argVEND );
 
       for ( const auto & d : el.second )
-       str << dind << d << endl;
+        str << dind << d << endl;
     }
     return str;
   }
@@ -223,21 +223,21 @@ void dTree( const std::string & cmd_r, const std::string & spec_r )
     {
       for ( const auto & cap : el.provides() )
       {
-       // get attrs matching cap
-       for ( const auto & attr : attrs )
-       {
-         PoolQuery q;
-         q.addDependency( attr, cap );
-         if ( q.empty() )
-           continue;
-         for_( it, q.begin(), q.end() ) {
-           for_( match, it.matchesBegin(), it.matchesEnd() ) {
-             result[attr][*it].insert( match->inSolvAttr().asString().substr( 9, 3 )+": " +match->asString()
-             + " (" + cap.asString() + ")"
-             );
-           }
-         }
-       }
+        // get attrs matching cap
+        for ( const auto & attr : attrs )
+        {
+          PoolQuery q;
+          q.addDependency( attr, cap );
+          if ( q.empty() )
+            continue;
+          for_( it, q.begin(), q.end() ) {
+            for_( match, it.matchesBegin(), it.matchesEnd() ) {
+              result[attr][*it].insert( match->inSolvAttr().asString().substr( 9, 3 )+": " +match->asString()
+              + " (" + cap.asString() + ")"
+              );
+            }
+          }
+        }
       }
     }
     message << endl << t;
@@ -254,7 +254,7 @@ void dTree( const std::string & cmd_r, const std::string & spec_r )
     {
       auto & details { t.row( el.first ) };
       for ( const auto & cap : el.second )
-       details.insert( cap );
+        details.insert( cap );
     }
     message << endl << t << endl;
   }
@@ -387,49 +387,49 @@ int main( int argc, char * argv[] )
     {
       for ( const char * arg = (*argv)+1; *arg != '\0'; ++arg )        // -pr for -p -r
       {
-       switch ( *arg )
-       {
-         case 'a': names =             true,   requires = provides =   true;   break;
-         case 'A': names =             true,   requires = provides =   false;  break;
-         case 'D':
-           if ( argc > 1 )
-           {
-             --argc,++argv;
-             dDump( *argv );
-           }
-           else
-             return errexit("-D <pkgspec> requires an argument.");
-           break;
-         case 'T':
-           if ( argc > 1 )
-           {
-             std::string cmd { *argv };
-             --argc,++argv;
-             dTree( cmd, *argv );
-           }
-           else
-             return errexit("-T <pkgspec> requires an argument.");
-           break;
-         case 'i': ignorecase =        true;   break;
-         case 'I': ignorecase =        false;  break;
-         case 'x': matechexact =       true;   break;
-         case 'n': names =             true;   break;
-         case 'N': names =             false;  break;
-         case 'r': requires =          true;   break;
-         case 'R': requires =          false;  break;
-         case 'p': provides =          true;   break;
-         case 'P': provides =          false;  break;
-         case 'c': conflicts =         true;   break;
-         case 'C': conflicts =         false;  break;
-         case 'o': obsoletes =         true;   break;
-         case 'O': obsoletes =         false;  break;
-         case 'm': recommends =        true;   break;
-         case 'M': recommends =        false;  break;
-         case 's': supplements =       true;   break;
-         case 'S': supplements =       false;  break;
-         case 'e': enhacements =       true;   break;
-         case 'E': enhacements =       false;  break;
-       }
+        switch ( *arg )
+        {
+          case 'a': names =            true,   requires = provides =   true;   break;
+          case 'A': names =            true,   requires = provides =   false;  break;
+          case 'D':
+            if ( argc > 1 )
+            {
+              --argc,++argv;
+              dDump( *argv );
+            }
+            else
+              return errexit("-D <pkgspec> requires an argument.");
+            break;
+          case 'T':
+            if ( argc > 1 )
+            {
+              std::string cmd { *argv };
+              --argc,++argv;
+              dTree( cmd, *argv );
+            }
+            else
+              return errexit("-T <pkgspec> requires an argument.");
+            break;
+          case 'i': ignorecase =       true;   break;
+          case 'I': ignorecase =       false;  break;
+          case 'x': matechexact =      true;   break;
+          case 'n': names =            true;   break;
+          case 'N': names =            false;  break;
+          case 'r': requires =         true;   break;
+          case 'R': requires =         false;  break;
+          case 'p': provides =         true;   break;
+          case 'P': provides =         false;  break;
+          case 'c': conflicts =                true;   break;
+          case 'C': conflicts =                false;  break;
+          case 'o': obsoletes =                true;   break;
+          case 'O': obsoletes =                false;  break;
+          case 'm': recommends =       true;   break;
+          case 'M': recommends =       false;  break;
+          case 's': supplements =      true;   break;
+          case 'S': supplements =      false;  break;
+          case 'e': enhacements =      true;   break;
+          case 'E': enhacements =      false;  break;
+        }
       }
       continue;
     }
@@ -456,56 +456,56 @@ int main( int argc, char * argv[] )
       sat::Solvable::SplitIdent ident( qstr );
       if ( ident.kind() != ResKind::package )
       {
-       q.addKind( ident.kind() );
-       q.addString( ident.name().asString() );
+        q.addKind( ident.kind() );
+        q.addString( ident.name().asString() );
       }
       else
-       q.addString( qstr );
+        q.addString( qstr );
 
       if ( matechexact )
-       q.setMatchGlob();
+        q.setMatchGlob();
       else
-       q.setMatchRegex();
+        q.setMatchRegex();
       q.setCaseSensitive( ! ignorecase );
 
       if ( names )
-       q.addAttribute( sat::SolvAttr::name );
+        q.addAttribute( sat::SolvAttr::name );
       if ( provides )
       {
-       q.addDependency( sat::SolvAttr::provides );
-       q.addDependency( sat::SolvAttr::provides, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::provides );
+        q.addDependency( sat::SolvAttr::provides, Capability(qstr) );
       }
       if ( requires )
       {
-       q.addDependency( sat::SolvAttr::requires );
-       q.addDependency( sat::SolvAttr::requires, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::requires );
+        q.addDependency( sat::SolvAttr::requires, Capability(qstr) );
       }
       if ( conflicts )
       {
-       q.addDependency( sat::SolvAttr::conflicts );
-       q.addDependency( sat::SolvAttr::conflicts, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::conflicts );
+        q.addDependency( sat::SolvAttr::conflicts, Capability(qstr) );
       }
       if ( obsoletes )
       {
-       q.addDependency( sat::SolvAttr::obsoletes );
-       q.addDependency( sat::SolvAttr::obsoletes, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::obsoletes );
+        q.addDependency( sat::SolvAttr::obsoletes, Capability(qstr) );
       }
       if ( recommends )
       {
-       q.addDependency( sat::SolvAttr::recommends );
-       q.addDependency( sat::SolvAttr::recommends, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::recommends );
+        q.addDependency( sat::SolvAttr::recommends, Capability(qstr) );
       }
       if ( supplements )
       {
-       q.addDependency( sat::SolvAttr::supplements );
-       q.addDependency( sat::SolvAttr::supplements, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::supplements );
+        q.addDependency( sat::SolvAttr::supplements, Capability(qstr) );
       }
       if ( enhacements )
       {
-       q.addDependency( sat::SolvAttr::enhances );
-       q.addDependency( sat::SolvAttr::enhances, Capability(qstr) );
-       q.addDependency( sat::SolvAttr::suggests );
-       q.addDependency( sat::SolvAttr::suggests, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::enhances );
+        q.addDependency( sat::SolvAttr::enhances, Capability(qstr) );
+        q.addDependency( sat::SolvAttr::suggests );
+        q.addDependency( sat::SolvAttr::suggests, Capability(qstr) );
       }
     }
 
@@ -517,7 +517,7 @@ int main( int argc, char * argv[] )
     for_( it, q.begin(), q.end() )
     {
       if ( it->isKind( ResKind::srcpackage ) && !withSrcPackages )
-       continue;
+        continue;
       t.row( it );
     }
     message << t << "}" << endl;
index e9ed108..481a36a 100644 (file)
@@ -59,59 +59,59 @@ try {
     for ( RepoInfo & nrepo : repoManager.knownRepositories() )
     {
       if ( ! nrepo.enabled() )
-       continue;
+        continue;
 
       // Often volatile media are sipped in automated environments
       // to avoid media chagne requests:
       if ( nrepo.url().schemeIsVolatile() )
-       continue;
+        continue;
 
       bool refreshNeeded = false;
       if ( nrepo.autorefresh() )       // test whether to autorefresh repo metadata
       {
-       for ( const Url & url : nrepo.baseUrls() )
-       {
-         try
-         {
-           if ( repoManager.checkIfToRefreshMetadata( nrepo, url ) == RepoManager::REFRESH_NEEDED )
-           {
-             cout << "Need to autorefresh repo " << nrepo.alias() << endl;
-             refreshNeeded = true;
-           }
-           break;      // exit after first successful checkIfToRefreshMetadata
-         }
-         catch ( const Exception & exp )
-         {}    // Url failed, try next one...
-       }
-       // If all urls failed we can leave it to the code below to
-       // fail if access is actually needed and still failing.
-       // (missing metadata, package download, ...)
+        for ( const Url & url : nrepo.baseUrls() )
+        {
+          try
+          {
+            if ( repoManager.checkIfToRefreshMetadata( nrepo, url ) == RepoManager::REFRESH_NEEDED )
+            {
+              cout << "Need to autorefresh repo " << nrepo.alias() << endl;
+              refreshNeeded = true;
+            }
+            break;     // exit after first successful checkIfToRefreshMetadata
+          }
+          catch ( const Exception & exp )
+          {}   // Url failed, try next one...
+        }
+        // If all urls failed we can leave it to the code below to
+        // fail if access is actually needed and still failing.
+        // (missing metadata, package download, ...)
       }
 
       // initial metadata download or cache refresh
       if ( ! repoManager.isCached( nrepo ) || refreshNeeded )
       {
-       cout << "Refreshing repo " << nrepo << endl;
-       if ( repoManager.isCached( nrepo ) )
-       {
-         repoManager.cleanCache( nrepo );
-       }
-       repoManager.refreshMetadata( nrepo );
-       repoManager.buildCache( nrepo );
+        cout << "Refreshing repo " << nrepo << endl;
+        if ( repoManager.isCached( nrepo ) )
+        {
+          repoManager.cleanCache( nrepo );
+        }
+        repoManager.refreshMetadata( nrepo );
+        repoManager.buildCache( nrepo );
       }
 
       // load cache
       try
       {
-       cout << "Loading resolvables from " << nrepo.alias() << endl;
-       repoManager.loadFromCache( nrepo );// load available packages to pool
+        cout << "Loading resolvables from " << nrepo.alias() << endl;
+        repoManager.loadFromCache( nrepo );// load available packages to pool
       }
       catch ( const Exception & exp )
       {
-       // cachefile has old fomat (or is corrupted): try yo rebuild it
-       repoManager.cleanCache( nrepo );
-       repoManager.buildCache( nrepo );
-       repoManager.loadFromCache( nrepo );
+        // cachefile has old fomat (or is corrupted): try yo rebuild it
+        repoManager.cleanCache( nrepo );
+        repoManager.buildCache( nrepo );
+        repoManager.loadFromCache( nrepo );
       }
     }
   }
@@ -161,33 +161,33 @@ try {
       unsigned probNo = 0;
       for ( const auto & probPtr : problems )
       {
-       cout << "Problem " << ++probNo << ": " << probPtr->description() << endl;
+        cout << "Problem " << ++probNo << ": " << probPtr->description() << endl;
 
-       const ProblemSolutionList & solutions = probPtr->solutions();
-       unsigned solNo = 0;
-       for ( const auto & solPtr : solutions )
-       {
-         cout << "  Solution " << ++solNo << ": " << solPtr->description() << endl;
-       }
+        const ProblemSolutionList & solutions = probPtr->solutions();
+        unsigned solNo = 0;
+        for ( const auto & solPtr : solutions )
+        {
+          cout << "  Solution " << ++solNo << ": " << solPtr->description() << endl;
+        }
 
-       // if you (interactively) resolve problems pick 1 solution per problem
-       // and store it int the totry list. After having applied the selected
-       // start a new attempt.
-       //
-       // It's not necessary to process all problems. You can pick a solution
-       // for the first problem and retry immediately. Often one solution actually
-       // resolves more than one reported problem.
-       //
-       // totry.push_back( solPtr );
+        // if you (interactively) resolve problems pick 1 solution per problem
+        // and store it int the totry list. After having applied the selected
+        // start a new attempt.
+        //
+        // It's not necessary to process all problems. You can pick a solution
+        // for the first problem and retry immediately. Often one solution actually
+        // resolves more than one reported problem.
+        //
+        // totry.push_back( solPtr );
       }
 
 
       if ( ! totry.empty() )
       {
-       cout << "Apply selected solutions..." << endl;
-       zypp->resolver()->applySolutions( totry );
-       cout << "Solving dependencies..." << endl;
-       continue;
+        cout << "Apply selected solutions..." << endl;
+        zypp->resolver()->applySolutions( totry );
+        cout << "Solving dependencies..." << endl;
+        continue;
       }
       // otherwise give up
       throw "Solving dependencies failed: Giving up!";
@@ -203,7 +203,7 @@ try {
     for ( const PoolItem & pi : zypp->pool() )
     {
       if ( pi.status().transacts() )
-       cout << "  " << pi << endl;
+        cout << "  " << pi << endl;
     }
   }
   else
@@ -212,7 +212,7 @@ try {
     for ( const ui::Selectable_Ptr & sel : zypp->pool().proxy() )
     {
       if ( sel->toModify() )
-       cout << "  " << sel << endl;
+        cout << "  " << sel << endl;
     }
   }
 
@@ -242,10 +242,10 @@ try {
       ZYppCommitResult result = zypp->commit( policy );        // go....
       if ( ! ( result.allDone() || ( dryRunEtc && result.noError() ) ) )
       {
-       throw "Incomplete commit!";
-       // ZYppCommitResult offers access to the TransactionStepList
-       // where you can see which packages have been processed and
-       // which not.
+        throw "Incomplete commit!";
+        // ZYppCommitResult offers access to the TransactionStepList
+        // where you can see which packages have been processed and
+        // which not.
       }
       cout << "Commit succeeded" << endl;
     }
index 2a596bb..405fab3 100644 (file)
@@ -161,7 +161,7 @@ int main( int argc, char * argv[] )
     for_( it, pool.begin(), pool.end() )
     {
       if ( (*it).status().isLocked() )
-       OUT << *it << endl;
+        OUT << *it << endl;
     }
   }
 
index 15647b1..913359c 100644 (file)
@@ -57,9 +57,9 @@ int main( int argc, char * argv[] )
   opt::options_description options( "Options" );
   options.add_options()
       ( "key-file",    opt::value<std::vector<std::string> >(),
-                       "ASCII ascii armored public key file")
+                        "ASCII ascii armored public key file")
       ( "root",                opt::value<std::string>()->default_value( "/" ),
-                       "Use the rmp database from system rooted at ARG")
+                        "Use the rmp database from system rooted at ARG")
       ( "help,?",      "Produce this help message")
       ;
 
@@ -96,11 +96,11 @@ int main( int argc, char * argv[] )
     for_each_( it, rpmpubkeys )
     {
       if ( last == it->gpgPubkeyVersion() )
-       cout << *it << endl;
+        cout << *it << endl;
       else
       {
-       dumpPubkeyOn( cout, *it );
-       last = it->gpgPubkeyVersion();
+        dumpPubkeyOn( cout, *it );
+        last = it->gpgPubkeyVersion();
       }
     }
     return 0;
@@ -121,17 +121,17 @@ int main( int argc, char * argv[] )
     {
       if ( rpmpub->gpgPubkeyVersion() == pubkeyV )
       {
-       int cmp = rpmpub->gpgPubkeyRelease().compare( pubkeyR );
-       if ( cmp < 0 )
-         cout << "<<< ";
-       else if ( cmp > 0 )
-         cout << ">>> ";
-       else
-       {
-         ++count;
-         cout << "*** ";
-       }
-       cout << "gpg-pubkey-" << rpmpub->gpgPubkeyVersion() << "-" << rpmpub->gpgPubkeyRelease() << " " << rpmpub->daysToLive() << endl;
+        int cmp = rpmpub->gpgPubkeyRelease().compare( pubkeyR );
+        if ( cmp < 0 )
+          cout << "<<< ";
+        else if ( cmp > 0 )
+          cout << ">>> ";
+        else
+        {
+          ++count;
+          cout << "*** ";
+        }
+        cout << "gpg-pubkey-" << rpmpub->gpgPubkeyVersion() << "-" << rpmpub->gpgPubkeyRelease() << " " << rpmpub->daysToLive() << endl;
       }
     }
     if ( ! count )
index d30ff77..01547d1 100644 (file)
@@ -18,6 +18,7 @@
 #include <zypp-core/base/NonCopyable.h>
 #include <zypp-core/base/PtrTypes.h>
 #include <zypp-core/base/Function.h>
+#include <zypp-core/Pathname.h>
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -97,10 +98,11 @@ namespace zypp
       typedef typename boost::call_traits<Tp>::const_reference  const_reference;
       typedef Tp                                                value_type;
       typedef typename boost::call_traits<Tp>::value_type       result_type;
+      using dispose_param_type = std::conditional_t< std::is_pointer_v<Tp> || std::is_integral_v<Tp>, Tp const, reference >;
 
     public:
       /** Dispose function signatue. */
-      typedef function<void ( param_type )> Dispose;
+      using Dispose = function<void ( dispose_param_type )>;
 
     public:
       /** Default Ctor using default constructed value and no dispose function. */
index df69429..2e4b41e 100644 (file)
@@ -33,48 +33,48 @@ namespace zypp
     {
       LocaleGuard()
       {
-       const char * tmp = ::setlocale( LC_TIME, NULL );
-       _mylocale = tmp ? tmp : "";
-
-       if ( _mylocale.find( "UTF-8" ) == std::string::npos
-         && _mylocale.find( "utf-8" ) == std::string::npos
-         && _mylocale != "POSIX"
-         && _mylocale != "C"
-         && _mylocale != "" )
-       {
-         // language[_territory][.codeset][@modifier]
-         // add/exchange codeset with UTF-8
-         std::string needLocale = ".UTF-8";
-         std::string::size_type loc = _mylocale.find_first_of( ".@" );
-         if ( loc != std::string::npos )
-         {
-           // prepend language[_territory]
-           needLocale = _mylocale.substr( 0, loc ) + needLocale;
-           loc = _mylocale.find_last_of( "@" );
-           if ( loc != std::string::npos )
-           {
-             // append [@modifier]
-             needLocale += _mylocale.substr( loc );
-           }
-         }
-         else
-         {
-           // append ".UTF-8"
-           needLocale = _mylocale + needLocale;
-         }
-         ::setlocale( LC_TIME, needLocale.c_str() );
-       }
-       else
-       {
-         // no need to change the locale
-         _mylocale.clear();
-       }
+        const char * tmp = ::setlocale( LC_TIME, NULL );
+        _mylocale = tmp ? tmp : "";
+
+        if ( _mylocale.find( "UTF-8" ) == std::string::npos
+          && _mylocale.find( "utf-8" ) == std::string::npos
+          && _mylocale != "POSIX"
+          && _mylocale != "C"
+          && _mylocale != "" )
+        {
+          // language[_territory][.codeset][@modifier]
+          // add/exchange codeset with UTF-8
+          std::string needLocale = ".UTF-8";
+          std::string::size_type loc = _mylocale.find_first_of( ".@" );
+          if ( loc != std::string::npos )
+          {
+            // prepend language[_territory]
+            needLocale = _mylocale.substr( 0, loc ) + needLocale;
+            loc = _mylocale.find_last_of( "@" );
+            if ( loc != std::string::npos )
+            {
+              // append [@modifier]
+              needLocale += _mylocale.substr( loc );
+            }
+          }
+          else
+          {
+            // append ".UTF-8"
+            needLocale = _mylocale + needLocale;
+          }
+          ::setlocale( LC_TIME, needLocale.c_str() );
+        }
+        else
+        {
+          // no need to change the locale
+          _mylocale.clear();
+        }
       }
 
       ~LocaleGuard()
       {
-       if ( ! _mylocale.empty() )
-         ::setlocale( LC_TIME, _mylocale.c_str() );
+        if ( ! _mylocale.empty() )
+          ::setlocale( LC_TIME, _mylocale.c_str() );
       }
     private:
       std::string _mylocale;
@@ -91,13 +91,13 @@ namespace zypp
     inline const char * _dateFormat( Date::DateFormat dateFormat_r )
     {
       static const char * fmt[] = {
-       "",             ///< ""
-       "%Y-%m-%d",     ///< 2014-02-07
-       "%Y-%m",        ///< 2014-02
-       "%Y",           ///< 2014
-       "%G-W%V",       ///< 2014-W06
-       "%G-W%V-%u",    ///< 2014-W06-5 (1 is Monday)
-       "%Y-%j",        ///< 2014-038
+        "",            ///< ""
+        "%Y-%m-%d",    ///< 2014-02-07
+        "%Y-%m",       ///< 2014-02
+        "%Y",          ///< 2014
+        "%G-W%V",      ///< 2014-W06
+        "%G-W%V-%u",   ///< 2014-W06-5 (1 is Monday)
+        "%Y-%j",       ///< 2014-038
       };
       return fmt[dateFormat_r.asIntegral()];
     }
@@ -105,10 +105,10 @@ namespace zypp
     inline const char * _timeFormat( Date::TimeFormat timeFormat_r )
     {
       static const char * fmt[] = {
-       "",             ///< ""
-       "%H:%M:%S",     ///< 07:06:41
-       "%H:%M",        ///< 07:06
-       "%H",           ///< 07
+        "",            ///< ""
+        "%H:%M:%S",    ///< 07:06:41
+        "%H:%M",       ///< 07:06
+        "%H",          ///< 07
       };
       return fmt[timeFormat_r.asIntegral()];
     }
@@ -116,9 +116,9 @@ namespace zypp
     inline const char * _timeZoneFormat( Date::TimeZoneFormat timeZoneFormat_r )
     {
       static const char * fmt[] = {
-       "",             ///< ""
-       " %Z",          ///< UTC, CET, ...
-       "%z",           ///< +0000
+        "",            ///< ""
+        " %Z",         ///< UTC, CET, ...
+        "%z",          ///< +0000
       };
       return fmt[timeZoneFormat_r.asIntegral()];
     }
@@ -126,21 +126,21 @@ namespace zypp
     inline std::string doForm( const std::string & format_r, Date::TimeBase base_r, const Date::ValueType & date_r )
     {
       if ( ! date_r )
-       return "0";
+        return "0";
 
       LocaleGuard guard;
       static char buf[512];
       if ( ! strftime( buf, 512, format_r.c_str(), (base_r == Date::TB_UTC ? gmtime : localtime)( &date_r ) ) )
-       *buf = '\0';
+        *buf = '\0';
       else
       {
-       // strip a trailing '00' in a timeZoneFormat
-       unsigned l = ::strlen( buf );
-       if ( l >= 5
-         && ( buf[l-1] == '0' )
-         && ( buf[l-2] == '0' )
-         && ( buf[l-5] == '+' || buf[l-5] == '-') )
-         buf[l-2] = '\0';
+        // strip a trailing '00' in a timeZoneFormat
+        unsigned l = ::strlen( buf );
+        if ( l >= 5
+          && ( buf[l-1] == '0' )
+          && ( buf[l-2] == '0' )
+          && ( buf[l-5] == '+' || buf[l-5] == '-') )
+          buf[l-2] = '\0';
       }
       return buf;
     }
@@ -193,10 +193,10 @@ namespace zypp
     if ( timeFormat_r != TimeFormat::none )
     {
       if ( dateFormat_r != DateFormat::none )
-       str << ' ';
+        str << ' ';
       str << _timeFormat( timeFormat_r );
       if ( timeZoneFormat_r != TimeZoneFormat::none )
-       str << _timeZoneFormat( timeZoneFormat_r );
+        str << _timeZoneFormat( timeZoneFormat_r );
     }
     return doForm( str, base_r, _date );
   }
@@ -209,22 +209,22 @@ namespace zypp
     if ( timeFormat_r != TimeFormat::none )
     {
       if ( dateFormat_r != DateFormat::none )
-       str << 'T';
+        str << 'T';
       str << _timeFormat( timeFormat_r );
       switch ( timeZoneFormat_r.asEnum() )
       {
-       case TimeZoneFormat::none:
-         break;
-       case TimeZoneFormat::name:
-         if ( base_r == TB_UTC )
-         {
-           str << 'Z';
-           break;
-         }
-         // else: FALLTHROUGH and print offset!
-       case TimeZoneFormat::offset:
-         str << _timeZoneFormat( TimeZoneFormat::offset );
-         break;
+        case TimeZoneFormat::none:
+          break;
+        case TimeZoneFormat::name:
+          if ( base_r == TB_UTC )
+          {
+            str << 'Z';
+            break;
+          }
+          // else: FALLTHROUGH and print offset!
+        case TimeZoneFormat::offset:
+          str << _timeZoneFormat( TimeZoneFormat::offset );
+          break;
       }
     }
     return doForm( str, base_r, _date );
index decd0c2..0e84e53 100644 (file)
@@ -145,7 +145,7 @@ namespace zypp {
       if(name.empty()) return false;
 
       if(_dp->mdctx)
-       _dp->cleanup();
+        _dp->cleanup();
 
       _dp->name = name;
 
@@ -195,24 +195,24 @@ namespace zypp {
     namespace {
       template <typename BArr>
       BArr hexStrToBArr ( std::string_view &&str ) {
-       BArr bytes;
-       for ( std::string::size_type i = 0; i < str.length(); i+=2 )
-       {
-         #define c2h(c) (((c)>='0' && (c)<='9') ? ((c)-'0')              \
-         : ((c)>='a' && (c)<='f') ? ((c)-('a'-10))       \
-         : ((c)>='A' && (c)<='F') ? ((c)-('A'-10))       \
-         : -1)
-         int v = c2h(str[i]);
-         if (v < 0)
-           return {};
-         bytes.push_back(v);
-         v = c2h(str[i+1]);
-         if (v < 0)
-           return {};
-         bytes.back() = (bytes.back() << 4) | v;
-         #undef c2h
-       }
-       return bytes;
+        BArr bytes;
+        for ( std::string::size_type i = 0; i < str.length(); i+=2 )
+        {
+          #define c2h(c) (((c)>='0' && (c)<='9') ? ((c)-'0')              \
+          : ((c)>='a' && (c)<='f') ? ((c)-('a'-10))       \
+          : ((c)>='A' && (c)<='F') ? ((c)-('A'-10))       \
+          : -1)
+          int v = c2h(str[i]);
+          if (v < 0)
+            return {};
+          bytes.push_back(v);
+          v = c2h(str[i+1]);
+          if (v < 0)
+            return {};
+          bytes.back() = (bytes.back() << 4) | v;
+          #undef c2h
+        }
+        return bytes;
       }
     } // namespace
 
@@ -241,7 +241,7 @@ namespace zypp {
       }
       r.reserve(_dp->md_len);
       for(unsigned i = 0; i < _dp->md_len; ++i)
-       r.push_back(_dp->md_value[i]);
+        r.push_back(_dp->md_value[i]);
       return r;
     }
 
@@ -249,21 +249,21 @@ namespace zypp {
     {
       if(!bytes)
       {
-       return false;
+        return false;
       }
 
       if(!_dp->maybeInit())
-       return false;
+        return false;
 
       if(_dp->finalized)
       {
-       _dp->cleanup();
-       if(!_dp->maybeInit())
-           return false;
+        _dp->cleanup();
+        if(!_dp->maybeInit())
+            return false;
 
       }
       if(!EVP_DigestUpdate(_dp->mdctx.get(), reinterpret_cast<const unsigned char*>(bytes), len))
-       return false;
+        return false;
 
       return true;
     }
@@ -290,7 +290,7 @@ namespace zypp {
     std::string Digest::digest(const std::string& name, std::istream& is, size_t bufsize)
     {
       if(name.empty() || !is)
-       return std::string();
+        return std::string();
 
       Digest digest;
       if(!digest.create(name))
index 530f99c..8d92db5 100644 (file)
@@ -35,121 +35,121 @@ namespace zypp {
     class Digest
     {
       private:
-       class P;
-       P* _dp;
+        class P;
+        P* _dp;
 
-       // disabled
-       Digest(const Digest& d);
-       // disabled
-       const Digest& operator=(const Digest& d);
+        // disabled
+        Digest(const Digest& d);
+        // disabled
+        const Digest& operator=(const Digest& d);
 
       public:
-       /** \name Well known digest algorithm names. */
-       //@{
-       /** md5 */
-       static const std::string & md5();
-       /** sha1 */
-       static const std::string & sha1();
-       /** sha224 */
-       static const std::string & sha224();
-       /** sha256 */
-       static const std::string & sha256();
-       /** sha384 */
-       static const std::string & sha384();
-       /** sha512 */
-       static const std::string & sha512();
-       //@}
+        /** \name Well known digest algorithm names. */
+        //@{
+        /** md5 */
+        static const std::string & md5();
+        /** sha1 */
+        static const std::string & sha1();
+        /** sha224 */
+        static const std::string & sha224();
+        /** sha256 */
+        static const std::string & sha256();
+        /** sha384 */
+        static const std::string & sha384();
+        /** sha512 */
+        static const std::string & sha512();
+        //@}
 
       public:
-       Digest();
-       ~Digest();
-
-       /** \brief initialize creation of a new message digest
-        *
-        * Since openssl is used as backend you may use anything that openssl
-        * supports (see man 1 dgst). Common examples are md5 or sha1. sha1
-        * should be preferred when creating digests to verify the authenticity
-        * of something.
-        *
-        * successive calls to this funcion will destroy the internal state and
-        * reinit from scratch
-        *
-        * @param name name of the message digest algorithm.
-        * @return whether an error occured
-        * */
-       bool create(const std::string& name);
-
-       /** \brief get the name of the current digest algorithm */
-       const std::string& name();
-
-       /** \brief feed data into digest computation algorithm
-        * @param bytes
-        * @param len
-        * @return whether an error occured
-        * */
-       bool update(const char* bytes, size_t len);
+        Digest();
+        ~Digest();
+
+        /** \brief initialize creation of a new message digest
+         *
+         * Since openssl is used as backend you may use anything that openssl
+         * supports (see man 1 dgst). Common examples are md5 or sha1. sha1
+         * should be preferred when creating digests to verify the authenticity
+         * of something.
+         *
+         * successive calls to this funcion will destroy the internal state and
+         * reinit from scratch
+         *
+         * @param name name of the message digest algorithm.
+         * @return whether an error occured
+         * */
+        bool create(const std::string& name);
+
+        /** \brief get the name of the current digest algorithm */
+        const std::string& name();
 
         /** \brief feed data into digest computation algorithm
-        * @param is
-        * @param bufsize
-        * @return whether an error occured
-        * */
+         * @param bytes
+         * @param len
+         * @return whether an error occured
+         * */
+        bool update(const char* bytes, size_t len);
+
+        /** \brief feed data into digest computation algorithm
+         * @param is
+         * @param bufsize
+         * @return whether an error occured
+         * */
         bool update(std::istream& is, size_t bufsize = 4096);
 
-       /** \brief get hex string representation of the digest
-        *
-        * this function will finalize the digest computation. calls to update
-        * after this function will start from scratch
-        *
-        * @return hex string representation of the digest
-        * */
-       std::string digest();
+        /** \brief get hex string representation of the digest
+         *
+         * this function will finalize the digest computation. calls to update
+         * after this function will start from scratch
+         *
+         * @return hex string representation of the digest
+         * */
+        std::string digest();
 
         /** \brief get hex string representation of the digest vector given as parameter
-        *
-        * @return hex string representation of the digest
-        * */
+         *
+         * @return hex string representation of the digest
+         * */
         static std::string digestVectorToString ( const UByteArray &vec );
 
 #ifdef __cpp_lib_string_view
         /** \brief convert the hex string representation of the digest vector given as parameter into the actual byte array representation
-        *
-        * @return hex string representation of the digest
-        * */
+         *
+         * @return hex string representation of the digest
+         * */
         static ByteArray hexStringToByteArray ( std::string_view str );
         static UByteArray hexStringToUByteArray ( std::string_view str );
 #endif
 
-       /** \brief get vector of unsigned char representation of the digest
-        *
-        * this function will finalize the digest computation. calls to update
-        * after this function will start from scratch
-        *
-        * @return vector representation of the digest
-        * */
-       UByteArray digestVector();
-
-       /** \brief reset internal digest state
-        *
-        * this function is equivalent to calling create() with an unchanged name,
-        * but it may be implemented in a more efficient way.
-        */
-       bool reset();
-
-       /** \brief compute digest of a stream. convenience function
-        *
-        * calls create, update and digest in one function. The data for the
-        * computation is read from the stream
-        *
-        * @param name name of the digest algorithm, \see create
-        * @param is an input stream to get the data from
-        * @param bufsize size of the buffer used for update(). Be careful, this is on the stack.
-        * @return the digest or empty on error
-        * */
-       static std::string digest(const std::string& name, std::istream& is, size_t bufsize = 4096);
-
-       /** \overload Reading input data from \c string. */
-       static std::string digest( const std::string & name, const std::string & input, size_t bufsize = 4096 );
+        /** \brief get vector of unsigned char representation of the digest
+         *
+         * this function will finalize the digest computation. calls to update
+         * after this function will start from scratch
+         *
+         * @return vector representation of the digest
+         * */
+        UByteArray digestVector();
+
+        /** \brief reset internal digest state
+         *
+         * this function is equivalent to calling create() with an unchanged name,
+         * but it may be implemented in a more efficient way.
+         */
+        bool reset();
+
+        /** \brief compute digest of a stream. convenience function
+         *
+         * calls create, update and digest in one function. The data for the
+         * computation is read from the stream
+         *
+         * @param name name of the digest algorithm, \see create
+         * @param is an input stream to get the data from
+         * @param bufsize size of the buffer used for update(). Be careful, this is on the stack.
+         * @return the digest or empty on error
+         * */
+        static std::string digest(const std::string& name, std::istream& is, size_t bufsize = 4096);
+
+        /** \overload Reading input data from \c string. */
+        static std::string digest( const std::string & name, const std::string & input, size_t bufsize = 4096 );
     };
 
 } // namespace zypp
index f1529ca..ec4882f 100644 (file)
@@ -64,7 +64,7 @@ namespace zypp {
     ExternalProgram::ExternalProgram( const Arguments & argv,
                                       Stderr_Disposition stderr_disp,
                                       bool use_pty,
-                                     int stderr_fd,
+                                      int stderr_fd,
                                       bool default_locale,
                                       const Pathname & root )
     {
@@ -72,8 +72,8 @@ namespace zypp {
       unsigned c = 0;
       for_( i, argv.begin(), argv.end() )
       {
-       argvp[c] = i->c_str();
-       ++c;
+        argvp[c] = i->c_str();
+        ++c;
       }
       argvp[c] = 0;
 
@@ -84,16 +84,16 @@ namespace zypp {
                                       const Environment & environment,
                                       Stderr_Disposition stderr_disp,
                                       bool use_pty,
-                                     int stderr_fd,
+                                      int stderr_fd,
                                       bool default_locale,
-                                     const Pathname & root )
+                                      const Pathname & root )
     {
       const char * argvp[argv.size() + 1];
       unsigned c = 0;
       for_( i, argv.begin(), argv.end() )
       {
-       argvp[c] = i->c_str();
-       ++c;
+        argvp[c] = i->c_str();
+        ++c;
       }
       argvp[c] = 0;
 
@@ -111,24 +111,24 @@ namespace zypp {
     }
 
     ExternalProgram::ExternalProgram( const char *const * argv,
-                                     const Environment & environment,
-                                     Stderr_Disposition stderr_disp,
-                                     bool use_pty,
-                                     int stderr_fd,
-                                     bool default_locale,
-                                     const Pathname & root )
+                                      const Environment & environment,
+                                      Stderr_Disposition stderr_disp,
+                                      bool use_pty,
+                                      int stderr_fd,
+                                      bool default_locale,
+                                      const Pathname & root )
     {
       start_program( argv, environment, stderr_disp, stderr_fd, default_locale, root.c_str(), false, false, use_pty );
     }
 
 
     ExternalProgram::ExternalProgram( const char *binpath,
-                                     const char *const *argv_1,
-                                     bool use_pty )
+                                      const char *const *argv_1,
+                                      bool use_pty )
     {
       int i = 0;
       while (argv_1[i++])
-       ;
+        ;
       const char *argv[i + 1];
       argv[0] = binpath;
       memcpy( &argv[1], argv_1, (i - 1) * sizeof (char *) );
@@ -136,13 +136,13 @@ namespace zypp {
     }
 
     ExternalProgram::ExternalProgram( const char *binpath,
-                                     const char *const *argv_1,
-                                     const Environment & environment,
-                                     bool use_pty )
+                                      const char *const *argv_1,
+                                      const Environment & environment,
+                                      bool use_pty )
     {
       int i = 0;
       while (argv_1[i++])
-       ;
+        ;
       const char *argv[i + 1];
       argv[0] = binpath;
       memcpy( &argv[1], argv_1, (i - 1) * sizeof (char *) );
@@ -155,11 +155,11 @@ namespace zypp {
 
 
     void ExternalProgram::start_program( const char *const *argv,
-                                        const Environment & environment,
-                                        Stderr_Disposition stderr_disp,
-                                        int stderr_fd,
-                                        bool default_locale,
-                                        const char * root , bool switch_pgid, bool die_with_parent , bool usePty )
+                                         const Environment & environment,
+                                         Stderr_Disposition stderr_disp,
+                                         int stderr_fd,
+                                         bool default_locale,
+                                         const char * root , bool switch_pgid, bool die_with_parent , bool usePty )
     {
       if ( _backend )
         return;
@@ -180,46 +180,46 @@ namespace zypp {
 
       if ( root )
       {
-       if ( root[0] == '\0' )
-       {
-         root = nullptr;       // ignore empty root
-       }
-       else if ( root[0] == '/' && root[1] == '\0' )
-       {
-         // If root is '/' do not chroot, but chdir to '/'
-         // unless arglist defines another dir.
-         chdirTo = "/";
-         root = nullptr;
-       }
+        if ( root[0] == '\0' )
+        {
+          root = nullptr;      // ignore empty root
+        }
+        else if ( root[0] == '/' && root[1] == '\0' )
+        {
+          // If root is '/' do not chroot, but chdir to '/'
+          // unless arglist defines another dir.
+          chdirTo = "/";
+          root = nullptr;
+        }
       }
 
       for ( bool strip = false; argv[0] != nullptr; ++argv )
       {
-       strip = false;
-       switch ( argv[0][0] )
-       {
-         case '<':
-           strip = true;
-           redirectStdin = argv[0]+1;
-           if ( *redirectStdin == '\0' )
-             redirectStdin = "/dev/null";
-           break;
-
-         case '>':
-           strip = true;
-           redirectStdout = argv[0]+1;
-           if ( *redirectStdout == '\0' )
-             redirectStdout = "/dev/null";
-           break;
-
-         case '#':
-           strip = true;
-           if ( argv[0][1] == '/' )    // #/[path]
-             chdirTo = argv[0]+1;
-           break;
-       }
-       if ( ! strip )
-         break;
+        strip = false;
+        switch ( argv[0][0] )
+        {
+          case '<':
+            strip = true;
+            redirectStdin = argv[0]+1;
+            if ( *redirectStdin == '\0' )
+              redirectStdin = "/dev/null";
+            break;
+
+          case '>':
+            strip = true;
+            redirectStdout = argv[0]+1;
+            if ( *redirectStdout == '\0' )
+              redirectStdout = "/dev/null";
+            break;
+
+          case '#':
+            strip = true;
+            if ( argv[0][1] == '/' )   // #/[path]
+              chdirTo = argv[0]+1;
+            break;
+        }
+        if ( ! strip )
+          break;
       }
 
       // those are the FDs that the new process will receive
@@ -238,15 +238,15 @@ namespace zypp {
 
         int master_tty,        slave_tty;              // fds for pair of ttys
 
-       // Create pair of ttys
+        // Create pair of ttys
         DBG << "Using ttys for communication with " << argv[0] << endl;
-       if (openpty (&master_tty, &slave_tty, 0, 0, 0) != 0)
-       {
+        if (openpty (&master_tty, &slave_tty, 0, 0, 0) != 0)
+        {
           _backend->setExecError( str::form( _("Can't open pty (%s)."), strerror(errno) ) );
           _backend->setExitStatus( 126 );
           ERR << _backend->execError() << endl;
           return;
-       }
+        }
 
         stdinFd  = slave_tty;
         stdoutFd = slave_tty;
@@ -324,11 +324,11 @@ namespace zypp {
         outputfile = fdopen( childStdinParentFd, "w" );
         childStdinParentFd.resetDispose();
 
-       if (!inputfile || !outputfile)
-       {
-           ERR << "Cannot create streams to external program " << argv[0] << endl;
+        if (!inputfile || !outputfile)
+        {
+            ERR << "Cannot create streams to external program " << argv[0] << endl;
             ExternalProgram::close();
-       }
+        }
       } else {
         // Fork failed, exit code and status was set by backend
         return;
@@ -345,60 +345,60 @@ namespace zypp {
 
       if ( _backend->isRunning() )
       {
-       if ( inputFile() )
-       {
-         // Discard any output instead of closing the pipe,
-         // but watch out for the command exiting while some
-         // subprocess keeps the filedescriptor open.
-         setBlocking( false );
-         FILE * inputfile = inputFile();
-         int    inputfileFd = ::fileno( inputfile );
-         long   delay = 0;
-         do
-         {
-           /* Watch inputFile to see when it has input. */
-           fd_set rfds;
-           FD_ZERO( &rfds );
-           FD_SET( inputfileFd, &rfds );
-
-           /* Wait up to 1 seconds. */
-           struct timeval tv;
-           tv.tv_sec  = (delay < 0 ? 1 : 0);
-           tv.tv_usec = (delay < 0 ? 0 : delay*100000);
-           if ( delay >= 0 && ++delay > 9 )
-             delay = -1;
-           int retval = select( inputfileFd+1, &rfds, NULL, NULL, &tv );
-
-           if ( retval == -1 )
-           {
+        if ( inputFile() )
+        {
+          // Discard any output instead of closing the pipe,
+          // but watch out for the command exiting while some
+          // subprocess keeps the filedescriptor open.
+          setBlocking( false );
+          FILE * inputfile = inputFile();
+          int    inputfileFd = ::fileno( inputfile );
+          long   delay = 0;
+          do
+          {
+            /* Watch inputFile to see when it has input. */
+            fd_set rfds;
+            FD_ZERO( &rfds );
+            FD_SET( inputfileFd, &rfds );
+
+            /* Wait up to 1 seconds. */
+            struct timeval tv;
+            tv.tv_sec  = (delay < 0 ? 1 : 0);
+            tv.tv_usec = (delay < 0 ? 0 : delay*100000);
+            if ( delay >= 0 && ++delay > 9 )
+              delay = -1;
+            int retval = select( inputfileFd+1, &rfds, NULL, NULL, &tv );
+
+            if ( retval == -1 )
+            {
               if ( errno != EINTR ) {
                 ERR << "select error: " << strerror(errno) << endl;
-               break;
+                break;
               }
-           }
-           else if ( retval )
-           {
-             // Data is available now.
-             static size_t linebuffer_size = 0;      // static because getline allocs
-             static char * linebuffer = 0;           // and reallocs if buffer is too small
-             getline( &linebuffer, &linebuffer_size, inputfile );
-             // ::feof check is important as select returns
-             // positive if the file was closed.
-             if ( ::feof( inputfile ) )
-               break;
-             clearerr( inputfile );
-           }
-           else
-           {
-             // No data within time.
-             if ( ! _backend->isRunning() )
-               break;
-           }
-         } while ( true );
-       }
-
-       // wait for the process to end)
-       _backend->isRunning( true );
+            }
+            else if ( retval )
+            {
+              // Data is available now.
+              static size_t linebuffer_size = 0;      // static because getline allocs
+              static char * linebuffer = 0;           // and reallocs if buffer is too small
+              getline( &linebuffer, &linebuffer_size, inputfile );
+              // ::feof check is important as select returns
+              // positive if the file was closed.
+              if ( ::feof( inputfile ) )
+                break;
+              clearerr( inputfile );
+            }
+            else
+            {
+              // No data within time.
+              if ( ! _backend->isRunning() )
+                break;
+            }
+          } while ( true );
+        }
+
+        // wait for the process to end)
+        _backend->isRunning( true );
       }
 
       ExternalDataSource::close();
@@ -410,8 +410,8 @@ namespace zypp {
     {
       if ( _backend && _backend->isRunning() )
       {
-       ::kill( _backend->pid(), SIGKILL);
-       close();
+        ::kill( _backend->pid(), SIGKILL);
+        close();
       }
       return true;
     }
@@ -481,62 +481,62 @@ namespace zypp {
     {
       EarlyPipe::EarlyPipe()
       {
-       _fds[R] = _fds[W] = -1;
+        _fds[R] = _fds[W] = -1;
 #ifdef HAVE_PIPE2
-       ::pipe2( _fds, O_NONBLOCK );
+        ::pipe2( _fds, O_NONBLOCK );
 #else
         ::pipe( _fds );
         ::fcntl(_fds[R], F_SETFD, O_NONBLOCK );
         ::fcntl(_fds[W], F_SETFD, O_NONBLOCK );
 #endif
-       _stderr = ::fdopen( _fds[R], "r" );
+        _stderr = ::fdopen( _fds[R], "r" );
       }
 
       EarlyPipe::~EarlyPipe()
       {
-       closeW();
-       if ( _stderr )
-         ::fclose( _stderr );
+        closeW();
+        if ( _stderr )
+          ::fclose( _stderr );
       }
     } // namespace externalprogram
 
     bool ExternalProgramWithStderr::stderrGetUpTo( std::string & retval_r, const char delim_r, bool returnDelim_r )
     {
       if ( ! _stderr )
-       return false;
+        return false;
       if ( delim_r && ! _buffer.empty() )
       {
-       // check for delim already in buffer
-       std::string::size_type pos( _buffer.find( delim_r ) );
-       if ( pos != std::string::npos )
-       {
-         retval_r = _buffer.substr( 0, returnDelim_r ? pos+1 : pos );
-         _buffer.erase( 0, pos+1 );
-         return true;
-       }
+        // check for delim already in buffer
+        std::string::size_type pos( _buffer.find( delim_r ) );
+        if ( pos != std::string::npos )
+        {
+          retval_r = _buffer.substr( 0, returnDelim_r ? pos+1 : pos );
+          _buffer.erase( 0, pos+1 );
+          return true;
+        }
       }
       ::clearerr( _stderr );
       do {
-       int ch = fgetc( _stderr );
-       if ( ch != EOF )
-       {
-         if ( ch != delim_r || ! delim_r )
-           _buffer.push_back( ch );
-         else
-         {
-           if ( returnDelim_r )
-             _buffer.push_back( delim_r );
-           break;
-         }
-       }
-       else if ( ::feof( _stderr ) )
-       {
-         if ( _buffer.empty() )
-           return false;
-         break;
-       }
-       else if ( errno != EINTR )
-         return false;
+        int ch = fgetc( _stderr );
+        if ( ch != EOF )
+        {
+          if ( ch != delim_r || ! delim_r )
+            _buffer.push_back( ch );
+          else
+          {
+            if ( returnDelim_r )
+              _buffer.push_back( delim_r );
+            break;
+          }
+        }
+        else if ( ::feof( _stderr ) )
+        {
+          if ( _buffer.empty() )
+            return false;
+          break;
+        }
+        else if ( errno != EINTR )
+          return false;
       } while ( true );
       // HERE: we left after readig at least one char (\n)
       retval_r.swap( _buffer );
index 5d987d9..d10ce42 100644 (file)
@@ -72,10 +72,10 @@ namespace zypp {
        * of stderr
        */
       enum Stderr_Disposition {
-       Normal_Stderr,
-       Discard_Stderr,
-       Stderr_To_Stdout,
-       Stderr_To_FileDesc
+        Normal_Stderr,
+        Discard_Stderr,
+        Stderr_To_Stdout,
+        Stderr_To_FileDesc
       };
 
       /**
@@ -92,9 +92,9 @@ namespace zypp {
        * @param root directory to chroot into; or just 'cd' if '/'l;  nothing if empty
        */
       ExternalProgram (std::string commandline,
-                    Stderr_Disposition stderr_disp = Normal_Stderr,
-                    bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
-                    const Pathname& root = "");
+                     Stderr_Disposition stderr_disp = Normal_Stderr,
+                     bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+                     const Pathname& root = "");
 
       /**
        * Start an external program by giving the arguments as an arry of char *pointers.
@@ -121,31 +121,31 @@ namespace zypp {
       ExternalProgram();
 
       ExternalProgram (const Arguments &argv,
-                    Stderr_Disposition stderr_disp = Normal_Stderr,
-                    bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
-                    const Pathname& root = "");
+                     Stderr_Disposition stderr_disp = Normal_Stderr,
+                     bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+                     const Pathname& root = "");
 
       ExternalProgram (const Arguments &argv, const Environment & environment,
-                    Stderr_Disposition stderr_disp = Normal_Stderr,
-                    bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
-                    const Pathname& root = "");
+                     Stderr_Disposition stderr_disp = Normal_Stderr,
+                     bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+                     const Pathname& root = "");
 
       ExternalProgram (const char *const *argv,
-                    Stderr_Disposition stderr_disp = Normal_Stderr,
-                    bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
-                    const Pathname& root = "");
+                     Stderr_Disposition stderr_disp = Normal_Stderr,
+                     bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+                     const Pathname& root = "");
 
       ExternalProgram (const char *const *argv, const Environment & environment,
-                    Stderr_Disposition stderr_disp = Normal_Stderr,
-                    bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
-                    const Pathname& root = "");
+                     Stderr_Disposition stderr_disp = Normal_Stderr,
+                     bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+                     const Pathname& root = "");
 
       ExternalProgram (const char *binpath, const char *const *argv_1,
-                    bool use_pty = false);
+                     bool use_pty = false);
 
 
       ExternalProgram (const char *binpath, const char *const *argv_1, const Environment & environment,
-                    bool use_pty = false);
+                     bool use_pty = false);
 
 
       ~ExternalProgram();
@@ -220,9 +220,9 @@ namespace zypp {
     protected:
 
       void start_program (const char *const *argv, const Environment & environment,
-                       Stderr_Disposition stderr_disp = Normal_Stderr,
-                       int stderr_fd = -1, bool default_locale = false,
-                       const char* root = NULL, bool switch_pgid = false, bool die_with_parent = false, bool usePty = false );
+                        Stderr_Disposition stderr_disp = Normal_Stderr,
+                        int stderr_fd = -1, bool default_locale = false,
+                        const char* root = NULL, bool switch_pgid = false, bool die_with_parent = false, bool usePty = false );
 
     };
 
@@ -242,8 +242,8 @@ namespace zypp {
       void closeW()            { if ( _fds[W] != -1 ) { ::close( _fds[W] ); _fds[W] = -1; } }
       FILE * fStdErr()         { return _stderr; }
       protected:
-       FILE * _stderr;
-       int _fds[2];
+        FILE * _stderr;
+        int _fds[2];
     };
   } // namespace externalprogram
 
index 1d085a2..e6aa833 100644 (file)
@@ -38,18 +38,18 @@ namespace zypp
 
       // Collect up to "/.."
       enum Pending {
-       P_none  = 0,    // ""
-       P_slash = 1,    // "/"
-       P_dot1  = 2,    // "/."
-       P_dot2  = 3     // "/.."
+        P_none = 0,    // ""
+        P_slash        = 1,    // "/"
+        P_dot1 = 2,    // "/."
+        P_dot2 = 3     // "/.."
       } pending = P_none;
 
       // Assert relative path starting with "./"
       // We rely on this below!
       if ( name_r[0] != '/' )
       {
-       _name += '.';
-       pending = P_slash;
+        _name += '.';
+        pending = P_slash;
       }
 
       // Lambda handling the "/.." case:
@@ -59,63 +59,63 @@ namespace zypp
       // [*/..]  + "/.."  ==> [*/../..]
       // [*/foo] + "/.."  ==> [*]
       auto goParent_f =  [&](){
-       if ( _name.empty() )
-         /*NOOP*/;
-       else if ( _name.size() == 1 ) // content is '.'
-         _name += "/..";
-       else
-       {
-         std::string::size_type pos = _name.rfind( "/" );
-         if ( pos == _name.size() - 3 && _name[pos+1] == '.' && _name[pos+2] == '.' )
-           _name += "/..";
-         else
-           _name.erase( pos );
-       }
+        if ( _name.empty() )
+          /*NOOP*/;
+        else if ( _name.size() == 1 ) // content is '.'
+          _name += "/..";
+        else
+        {
+          std::string::size_type pos = _name.rfind( "/" );
+          if ( pos == _name.size() - 3 && _name[pos+1] == '.' && _name[pos+2] == '.' )
+            _name += "/..";
+          else
+            _name.erase( pos );
+        }
       };
 
       for ( char ch : name_r )
       {
-       switch ( ch )
-       {
-         case '/':
-           switch ( pending )
-           {
-             case P_none:      pending = P_slash; break;
-             case P_slash:     break;
-             case P_dot1:      pending = P_slash; break;
-             case P_dot2:      goParent_f(); pending = P_slash; break;
-           }
-           break;
-
-         case '.':
-           switch ( pending )
-           {
-             case P_none:      _name += '.'; break;
-             case P_slash:     pending = P_dot1; break;
-             case P_dot1:      pending = P_dot2; break;
-             case P_dot2:      _name += "/..."; pending = P_none; break;
-           }
-           break;
-
-         default:
-           switch ( pending )
-           {
-             case P_none:      break;
-             case P_slash:     _name += '/';    pending = P_none; break;
-             case P_dot1:      _name += "/.";   pending = P_none; break;
-             case P_dot2:      _name += "/.."; pending = P_none; break;
-           }
-           _name += ch;
-           break;
-       }
+        switch ( ch )
+        {
+          case '/':
+            switch ( pending )
+            {
+              case P_none:     pending = P_slash; break;
+              case P_slash:    break;
+              case P_dot1:     pending = P_slash; break;
+              case P_dot2:     goParent_f(); pending = P_slash; break;
+            }
+            break;
+
+          case '.':
+            switch ( pending )
+            {
+              case P_none:     _name += '.'; break;
+              case P_slash:    pending = P_dot1; break;
+              case P_dot1:     pending = P_dot2; break;
+              case P_dot2:     _name += "/..."; pending = P_none; break;
+            }
+            break;
+
+          default:
+            switch ( pending )
+            {
+              case P_none:     break;
+              case P_slash:    _name += '/';    pending = P_none; break;
+              case P_dot1:     _name += "/.";   pending = P_none; break;
+              case P_dot2:     _name += "/.."; pending = P_none; break;
+            }
+            _name += ch;
+            break;
+        }
       }
 
       switch ( pending )
       {
-       case P_none:    break;
-       case P_slash:   if ( _name.empty() ) _name = "/"; break;
-       case P_dot1:    if ( _name.empty() ) _name = "/"; break;
-       case P_dot2:    goParent_f(); if ( _name.empty() ) _name = "/"; break;
+        case P_none:   break;
+        case P_slash:  if ( _name.empty() ) _name = "/"; break;
+        case P_dot1:   if ( _name.empty() ) _name = "/"; break;
+        case P_dot2:   goParent_f(); if ( _name.empty() ) _name = "/"; break;
       }
       return;
     }
@@ -212,17 +212,17 @@ namespace zypp
       std::string::size_type pos = base.rfind( '.' );
       switch ( pos )
       {
-       case 0:
-         if ( base.size() == 1 )                       // .
-           return string();
-         break;
-       case 1:
-         if ( base.size() == 2 && base[0] == '.' )     // ..
-           return string();
-         break;
-       case std::string::npos:
-         return string();
-         break;
+        case 0:
+          if ( base.size() == 1 )                      // .
+            return string();
+          break;
+        case 1:
+          if ( base.size() == 2 && base[0] == '.' )    // ..
+            return string();
+          break;
+        case std::string::npos:
+          return string();
+          break;
       }
       return base.substr( pos );
     }
@@ -244,12 +244,12 @@ namespace zypp
     Pathname Pathname::stripprefix( const Pathname & root_r, const Pathname & path_r )
     {
       if ( root_r.emptyOrRoot() )
-       return path_r;
+        return path_r;
       if ( root_r == path_r )
-       return "/";
+        return "/";
       std::string rest( str::stripPrefix( path_r.asString(), root_r.asString() ) );
       if ( rest[0] == '/' )    // needs to be a dir prefix!
-       return rest;
+        return rest;
       return path_r;
     }
 
@@ -267,7 +267,7 @@ namespace zypp
 
       string ret_ti( name_r._name );
       if( add_tv._name[0] != '/' )
-       ret_ti += '/';
+        ret_ti += '/';
       return ret_ti + add_tv._name;
     }
 
index d387807..08924cb 100644 (file)
@@ -64,8 +64,8 @@ namespace zypp
       /** Swap */
       friend void swap( Pathname & lhs, Pathname & rhs )
       {
-       using std::swap;
-       swap( lhs._name, rhs._name );
+        using std::swap;
+        swap( lhs._name, rhs._name );
       }
 
       /** Move Ctor */
index f2c5cfe..55e9995 100644 (file)
@@ -42,8 +42,8 @@ namespace zypp
   using   boost::logic::indeterminate;
 
   inline std::string asString( const TriBool & val_r, const std::string & istr_r = std::string(),
-                                                     const std::string & tstr_r = std::string(),
-                                                     const std::string & fstr_r = std::string() )
+                                                      const std::string & tstr_r = std::string(),
+                                                      const std::string & fstr_r = std::string() )
   {
     std::string ret;
     if (indeterminate(val_r))
index 359ace7..166789e 100644 (file)
@@ -477,6 +477,11 @@ namespace zypp
     static const char * val[] = { "http", "https", "ftp", "sftp", "tftp" };
     return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
   }
+
+  bool Url::schemeIsPlugin( const std::string & scheme_r )
+  {
+    return scheme_r == "plugin";
+  }
   ///////////////////////////////////////////////////////////////////
 
   // -----------------------------------------------------------------
index 2f75c13..d1eeabf 100644 (file)
@@ -275,6 +275,11 @@ namespace zypp
     /** \overload nonstatic version */
     bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); }
 
+    /** plugin */
+    static bool schemeIsPlugin( const std::string & scheme_r );
+    /** \overload nonstatic version */
+    bool schemeIsPlugin() const { return schemeIsPlugin( getScheme() ); }
+
     /**
      * \brief Verifies the Url.
      *
index 0cce99f..09e48a0 100644 (file)
@@ -227,14 +227,14 @@ namespace zypp
     void addToHistory( const TContainer & msgc_r )
     {
       for ( const std::string & el : msgc_r )
-       addHistory( el );
+        addHistory( el );
     }
     /** \ref addHistory from string container types (oldest first) moving */
     template<class TContainer>
     void moveToHistory( TContainer && msgc_r )
     {
       for ( std::string & el : msgc_r )
-       addHistory( std::move(el) );
+        addHistory( std::move(el) );
     }
 
     /** Iterator pointing to the most recent message. */
index 3a12e22..81ef36f 100644 (file)
@@ -43,7 +43,7 @@ namespace zypp {
     ExternalDataSource::~ExternalDataSource()
     {
       if (linebuffer)
-       free( linebuffer );
+        free( linebuffer );
       close ();
     }
 
@@ -52,12 +52,12 @@ namespace zypp {
     ExternalDataSource::send( const char *buffer, size_t length )
     {
       if ( outputfile ) {
-       bool success = fwrite( buffer, length, 1, outputfile ) != 0;
-       fflush( outputfile );
-       return success;
+        bool success = fwrite( buffer, length, 1, outputfile ) != 0;
+        fflush( outputfile );
+        return success;
       }
       else
-       return false;
+        return false;
     }
 
 
@@ -74,15 +74,15 @@ namespace zypp {
     {
       if ( inputfile && !feof( inputfile ) )
       {
-       std::ostringstream datas;
-        while ( true )
-        {
-          int readc = fgetc( inputfile );
-          if ( readc == EOF ) break;
-          datas << (char)readc;
-          if ( (char)readc == c ) break;
-        }
-        return datas.str();
+        std::ostringstream datas;
+         while ( true )
+         {
+           int readc = fgetc( inputfile );
+           if ( readc == EOF ) break;
+           datas << (char)readc;
+           if ( (char)readc == c ) break;
+         }
+         return datas.str();
       }
       return std::string();
     }
@@ -101,9 +101,9 @@ namespace zypp {
     ExternalDataSource::receive( char *buffer, size_t length )
     {
       if ( inputfile )
-       return fread( buffer, 1, length, inputfile );
+        return fread( buffer, 1, length, inputfile );
       else
-       return 0;
+        return 0;
     }
 
     void ExternalDataSource::setBlocking( bool mode )
@@ -116,11 +116,11 @@ namespace zypp {
     {
       if ( inputfile )
       {
-       ssize_t nread = getline( &linebuffer, &linebuffer_size, inputfile );
-       if ( nread == -1 )
-           return "";
-       else
-           return std::string( linebuffer, nread );
+        ssize_t nread = getline( &linebuffer, &linebuffer_size, inputfile );
+        if ( nread == -1 )
+            return "";
+        else
+            return std::string( linebuffer, nread );
       }
       else
         return "";
@@ -135,9 +135,9 @@ namespace zypp {
     ExternalDataSource::close()
     {
       if ( inputfile && inputfile != outputfile )
-       fclose( inputfile );
+        fclose( inputfile );
       if ( outputfile )
-       fclose( outputfile );
+        fclose( outputfile );
       inputfile = 0;
       outputfile = 0;
       return 0;
index 701acd3..9689d65 100644 (file)
@@ -112,10 +112,10 @@ namespace zypp
         constexpr bool testFlag( Enum flag_r ) const   { return testFlag( integral(flag_r) ); }
 
       private:
-       constexpr bool testFlag( Integral flag ) const  { return flag ? ( _val & flag ) == flag : !_val; }
+        constexpr bool testFlag( Integral flag ) const { return flag ? ( _val & flag ) == flag : !_val; }
 
-       constexpr static Integral integral( Flags obj ) { return obj._val; }
-       constexpr static Integral integral( Enum obj )  { return static_cast<Integral>(obj); }
+        constexpr static Integral integral( Flags obj )        { return obj._val; }
+        constexpr static Integral integral( Enum obj ) { return static_cast<Integral>(obj); }
 
         Integral _val;
     };
@@ -135,7 +135,7 @@ namespace zypp
      */
     template<typename Enum>
     std::string stringify( const Flags<Enum> & flag_r, const std::initializer_list<std::pair<Flags<Enum>,std::string> > & flaglist_r = {},
-                          std::string intro_r = "[", std::string sep_r = "|", std::string extro_r = "]" )
+                           std::string intro_r = "[", std::string sep_r = "|", std::string extro_r = "]" )
     {
       std::string ret( std::move(intro_r) );
       std::string sep;
@@ -143,20 +143,20 @@ namespace zypp
       Flags<Enum> mask;
       for ( const auto & pair : flaglist_r )
       {
-       if ( flag_r.testFlag( pair.first ) )
-       {
-         mask |= pair.first;
-         ret += sep;
-         ret += pair.second;
-         if ( sep.empty() && !sep_r.empty() )
-         { sep = std::move(sep_r); }
-       }
+        if ( flag_r.testFlag( pair.first ) )
+        {
+          mask |= pair.first;
+          ret += sep;
+          ret += pair.second;
+          if ( sep.empty() && !sep_r.empty() )
+          { sep = std::move(sep_r); }
+        }
       }
       mask = flag_r & ~mask;
       if ( mask )
       {
-       ret += sep;
-       ret += str::hexstring( mask, 0 );
+        ret += sep;
+        ret += str::hexstring( mask, 0 );
       }
       ret += std::move(extro_r);
       return ret;
index eb2bba0..2b0759a 100644 (file)
@@ -73,13 +73,13 @@ namespace zypp
     {
       if ( ! _valid )
       {
-       return false;
+        return false;
       }
 
       if ( ! _str ) // usg: saw EOF in previous read
       {
-       _line.clear();
-       return(_valid = false);
+        _line.clear();
+        return(_valid = false);
       }
 
       _lineStart = _str.tellg();
@@ -87,8 +87,8 @@ namespace zypp
       ++_lineNo;
       if ( _str.fail() || _str.bad() )
       {
-       _line.clear();
-       return(_valid = false);
+        _line.clear();
+        return(_valid = false);
       }
       return(_valid = true);
     }
@@ -102,17 +102,17 @@ namespace zypp
       int lineno = 0;
       while ( str_r )
       {
-       std::string line( getline( str_r ) );
-       if ( ! (str_r.fail() || str_r.bad()) )
-       {
-         // line contains valid data to be consumed.
-         ++lineno;
-         if ( consume_r && ! consume_r( lineno, line ) )
-         {
-           lineno = -lineno;
-           break;
-         }
-       }
+        std::string line( getline( str_r ) );
+        if ( ! (str_r.fail() || str_r.bad()) )
+        {
+          // line contains valid data to be consumed.
+          ++lineno;
+          if ( consume_r && ! consume_r( lineno, line ) )
+          {
+            lineno = -lineno;
+            break;
+          }
+        }
       }
       return lineno;
     }
@@ -124,30 +124,30 @@ namespace zypp
     int simpleParseFile( std::istream & str_r, ParseFlags flags_r, function<bool(int, std::string)> consume_r )
     {
       return forEachLine( str_r,
-                         [&]( int num_r, std::string line_r )->bool
-                         {
-                           if ( ! consume_r )
-                             return true;
-
-                           if ( flags_r )
-                           {
-                             if ( flags_r & PF_TRIM )
-                               line_r = str::trim( line_r, str::Trim( unsigned(flags_r & PF_TRIM) ) );
-
-                             if ( flags_r & ~PF_TRIM )
-                             {
-                               const char* firstNW = line_r.c_str();
-                               while ( *firstNW == ' ' || *firstNW == '\t' )
-                                 ++firstNW;
-                               switch ( *firstNW )
-                               {
-                                 case '\0':    if ( flags_r & PF_SKIP_EMPTY )          return true; break;
-                                 case '#':     if ( flags_r & PF_SKIP_SHARP_COMMENT )  return true; break;
-                               }
-                             }
-                           }
-                           return consume_r( num_r, line_r );
-                         } );
+                          [&]( int num_r, std::string line_r )->bool
+                          {
+                            if ( ! consume_r )
+                              return true;
+
+                            if ( flags_r )
+                            {
+                              if ( flags_r & PF_TRIM )
+                                line_r = str::trim( line_r, str::Trim( unsigned(flags_r & PF_TRIM) ) );
+
+                              if ( flags_r & ~PF_TRIM )
+                              {
+                                const char* firstNW = line_r.c_str();
+                                while ( *firstNW == ' ' || *firstNW == '\t' )
+                                  ++firstNW;
+                                switch ( *firstNW )
+                                {
+                                  case '\0':   if ( flags_r & PF_SKIP_EMPTY )          return true; break;
+                                  case '#':    if ( flags_r & PF_SKIP_SHARP_COMMENT )  return true; break;
+                                }
+                              }
+                            }
+                            return consume_r( num_r, line_r );
+                          } );
     }
 
     /////////////////////////////////////////////////////////////////
index d34ce32..15a832c 100644 (file)
@@ -111,56 +111,56 @@ namespace zypp
     class EachLine : private base::NonCopyable
     {
       public:
-       /** Ctor taking a stream and reading the 1st line from it. */
-       EachLine( std::istream & str_r, unsigned lineNo_r = 0 );
-
-       /** Whether \c this contains a valid line to consume. */
-       bool valid() const
-       { return _valid; }
-
-       /** Evaluate class in a boolean context. */
-       explicit operator bool() const
-       { return _valid; }
-
-       /** Return the current line number. */
-       unsigned lineNo() const
-       { return _lineNo; }
-
-       std::streamoff lineStart() const
-       { return _lineStart; };
-
-       /** Set current line number. */
-       void setLineNo( unsigned lineNo_r )
-       { _lineNo = lineNo_r; }
-
-       /** Access the current line. */
-       const std::string & operator*() const
-       { return _line; }
-       /** \overload non const access */
-       std::string & operator*()
-       { return _line; }
-
-       /** Access the current line. */
-       const std::string * operator->() const
-       { return &_line; }
-
-       /** Advance to next line. */
-       bool next();
-
-       /** Advance \a num_r lines. */
-       bool next( unsigned num_r )
-       {
-         while ( num_r-- && next() )
-           ; /* EMPTY */
-         return valid();
-       }
+        /** Ctor taking a stream and reading the 1st line from it. */
+        EachLine( std::istream & str_r, unsigned lineNo_r = 0 );
+
+        /** Whether \c this contains a valid line to consume. */
+        bool valid() const
+        { return _valid; }
+
+        /** Evaluate class in a boolean context. */
+        explicit operator bool() const
+        { return _valid; }
+
+        /** Return the current line number. */
+        unsigned lineNo() const
+        { return _lineNo; }
+
+        std::streamoff lineStart() const
+        { return _lineStart; };
+
+        /** Set current line number. */
+        void setLineNo( unsigned lineNo_r )
+        { _lineNo = lineNo_r; }
+
+        /** Access the current line. */
+        const std::string & operator*() const
+        { return _line; }
+        /** \overload non const access */
+        std::string & operator*()
+        { return _line; }
+
+        /** Access the current line. */
+        const std::string * operator->() const
+        { return &_line; }
+
+        /** Advance to next line. */
+        bool next();
+
+        /** Advance \a num_r lines. */
+        bool next( unsigned num_r )
+        {
+          while ( num_r-- && next() )
+            ; /* EMPTY */
+          return valid();
+        }
 
       private:
-       std::istream & _str;
-       std::string    _line;
-       std::streamoff _lineStart;
-       unsigned       _lineNo;
-       bool           _valid;
+        std::istream & _str;
+        std::string    _line;
+        std::streamoff _lineStart;
+        unsigned       _lineNo;
+        bool           _valid;
     };
     ///////////////////////////////////////////////////////////////////
 
index 908052a..291b116 100644 (file)
@@ -73,8 +73,8 @@ namespace zypp::io {
     while ( read != size ) {
       const auto r = zyppng::eintrSafeCall( ::read, fd, tmpBuf+read, size - read );
       if ( r == 0 )
-                               return ReadAllResult::Eof;
-                       if ( r < 0 )
+                                return ReadAllResult::Eof;
+                        if ( r < 0 )
         return ReadAllResult::Error;
 
       read += r;
index 54d563d..b094a12 100644 (file)
@@ -40,11 +40,11 @@ namespace zypp::io {
   /*!
     Blocks until the number of bytes passed via \a size was received
    */
-       enum class ReadAllResult {
-               Error,
-               Eof,
-               Ok
-       };
+        enum class ReadAllResult {
+                Error,
+                Eof,
+                Ok
+        };
   ReadAllResult readAll ( int fd, void *buf, size_t size );
 
   class TimeoutException : public Exception
index c1ce824..998f5e3 100644 (file)
@@ -363,14 +363,14 @@ namespace zypp
       }
       else
       {
-       if ( mode_r )
-       {
+        if ( mode_r )
+        {
           // not filesystem::assert_file as filesystem:: functions log,
-         // and this FileWriter is not yet in place.
-         int fd = ::open( file_r.c_str(), O_CREAT|O_EXCL, mode_r );
-         if ( fd != -1 )
-           ::close( fd );
-       }
+          // and this FileWriter is not yet in place.
+          int fd = ::open( file_r.c_str(), O_CREAT|O_EXCL, mode_r );
+          if ( fd != -1 )
+            ::close( fd );
+        }
         // set unbuffered write
         std::ofstream * fstr = 0;
         _outs.reset( (fstr = new std::ofstream( file_r.asString().c_str(), std::ios_base::app )) );
@@ -441,8 +441,8 @@ namespace zypp
         /** */
         virtual int writeout( const char* s, std::streamsize n )
         {
-         //logger::putStream( _group, _level, _file, _func, _line, _buffer );
-         //return n;
+          //logger::putStream( _group, _level, _file, _func, _line, _buffer );
+          //return n;
           if ( s && n )
             {
               const char * c = s;
@@ -537,35 +537,35 @@ namespace zypp
       struct LogControlImpl
       {
       public:
-       bool isExcessive() const
-       { return _excessive; }
+        bool isExcessive() const
+        { return _excessive; }
 
         void excessive( bool onOff_r )
         { _excessive = onOff_r; }
 
 
         /** Hint for Formater whether to hide the thread name. */
-       bool hideThreadName() const
-       {
-         if ( indeterminate(_hideThreadName) )
-           _hideThreadName = ( zyppng::ThreadData::current().name() == ZYPP_MAIN_THREAD_NAME );
-         return bool(_hideThreadName);
-       }
-       /** \overload Setter */
+        bool hideThreadName() const
+        {
+          if ( indeterminate(_hideThreadName) )
+            _hideThreadName = ( zyppng::ThreadData::current().name() == ZYPP_MAIN_THREAD_NAME );
+          return bool(_hideThreadName);
+        }
+        /** \overload Setter */
         void hideThreadName( bool onOff_r )
         { _hideThreadName = onOff_r; }
         /** \overload Static getter */
-       static bool instanceHideThreadName()
-       {
-         auto impl = LogControlImpl::instance();
-         return impl ? impl->hideThreadName() : false;
-       }
-       /** \overload Static setter */
+        static bool instanceHideThreadName()
+        {
+          auto impl = LogControlImpl::instance();
+          return impl ? impl->hideThreadName() : false;
+        }
+        /** \overload Static setter */
         static void instanceHideThreadName( bool onOff_r )
         {
-         auto impl = LogControlImpl::instance();
-         if ( impl ) impl->hideThreadName( onOff_r );
-       }
+          auto impl = LogControlImpl::instance();
+          if ( impl ) impl->hideThreadName( onOff_r );
+        }
 
 
         /** NULL _lineWriter indicates no loggin. */
@@ -598,7 +598,7 @@ namespace zypp
         LogClient    _logClient;
         std::ostream _no_stream;
         bool         _excessive;
-       mutable TriBool _hideThreadName = indeterminate;        ///< Hint for Formater whether to hide the thread name.
+        mutable TriBool _hideThreadName = indeterminate;       ///< Hint for Formater whether to hide the thread name.
 
         shared_ptr<LogControl::LineFormater> _lineFormater;
 
@@ -620,11 +620,11 @@ namespace zypp
               _streamtable[group_r][level_r].reset( new Loglinestream( group_r, level_r ) );
             }
           std::ostream & ret( _streamtable[group_r][level_r]->getStream( file_r, func_r, line_r ) );
-         if ( !ret )
-         {
-           ret.clear();
-           ret << "---<RESET LOGSTREAM FROM FAILED STATE]" << endl;
-         }
+          if ( !ret )
+          {
+            ret.clear();
+            ret << "---<RESET LOGSTREAM FROM FAILED STATE]" << endl;
+          }
           return ret;
         }
 
@@ -777,22 +777,22 @@ namespace zypp
       std::string now( Date::now().form( "%Y-%m-%d %H:%M:%S" ) );
       std::string ret;
       if ( LogControlImpl::instanceHideThreadName() )
-       ret = str::form( "%s <%d> %s(%d) [%s] %s(%s):%d %s",
-                        now.c_str(), level_r,
-                        ( gethostname( hostname, 1024 ) ? nohostname : hostname ),
-                        getpid(),
-                        group_r.c_str(),
-                        file_r, func_r, line_r,
-                        message_r.c_str() );
+        ret = str::form( "%s <%d> %s(%d) [%s] %s(%s):%d %s",
+                         now.c_str(), level_r,
+                         ( gethostname( hostname, 1024 ) ? nohostname : hostname ),
+                         getpid(),
+                         group_r.c_str(),
+                         file_r, func_r, line_r,
+                         message_r.c_str() );
       else
-       ret = str::form( "%s <%d> %s(%d) [%s] %s(%s):%d {T:%s} %s",
-                        now.c_str(), level_r,
-                        ( gethostname( hostname, 1024 ) ? nohostname : hostname ),
-                        getpid(),
-                        group_r.c_str(),
-                        file_r, func_r, line_r,
-                        zyppng::ThreadData::current().name().c_str(),
-                        message_r.c_str() );
+        ret = str::form( "%s <%d> %s(%d) [%s] %s(%s):%d {T:%s} %s",
+                         now.c_str(), level_r,
+                         ( gethostname( hostname, 1024 ) ? nohostname : hostname ),
+                         getpid(),
+                         group_r.c_str(),
+                         file_r, func_r, line_r,
+                         zyppng::ThreadData::current().name().c_str(),
+                         message_r.c_str() );
       return ret;
     }
 
index 52c1168..686fe77 100644 (file)
@@ -47,9 +47,9 @@ namespace zypp
       template<class Tp>
       Osd & operator<<( Tp && val )
       {
-       _strout << std::forward<Tp>(val);
-       _strlog << std::forward<Tp>(val);
-       return *this;
+        _strout << std::forward<Tp>(val);
+        _strlog << std::forward<Tp>(val);
+        return *this;
       }
 
       Osd & operator<<( std::ostream& (*iomanip)( std::ostream& ) );
index d0a6cf4..ddee931 100644 (file)
@@ -304,7 +304,7 @@ namespace zypp
         {}
 
         RW_pointer & operator=( std::nullptr_t )
-       { reset(); return *this; }
+        { reset(); return *this; }
 
         void reset()
         { PtrType().swap( _dptr ); }
@@ -341,10 +341,10 @@ namespace zypp
 
       public:
         bool unique() const
-       { return DTraits().unique( _dptr ); }
+        { return DTraits().unique( _dptr ); }
 
-       long use_count() const
-       { return DTraits().use_count( _dptr ); }
+        long use_count() const
+        { return DTraits().use_count( _dptr ); }
 
         constPtrType getPtr() const
         { return _dptr; }
@@ -460,11 +460,11 @@ namespace zypp
         typedef typename DTraits::PtrType               PtrType;
         typedef typename DTraits::constPtrType          constPtrType;
 
-       RWCOW_pointer()
-       {}
+        RWCOW_pointer()
+        {}
 
-       RWCOW_pointer( std::nullptr_t )
-       {}
+        RWCOW_pointer( std::nullptr_t )
+        {}
 
         explicit
         RWCOW_pointer( typename PtrType::element_type * dptr )
@@ -477,7 +477,7 @@ namespace zypp
         {}
 
         RWCOW_pointer & operator=( std::nullptr_t )
-       { reset(); return *this; }
+        { reset(); return *this; }
 
         void reset()
         { PtrType().swap( _dptr ); }
@@ -492,7 +492,7 @@ namespace zypp
         { _dptr.swap( rhs ); }
 
         explicit operator bool() const
-       { return _dptr.get() != nullptr; }
+        { return _dptr.get() != nullptr; }
 
         const D & operator*() const
         { return *_dptr; };
@@ -514,10 +514,10 @@ namespace zypp
 
       public:
         bool unique() const
-       { return DTraits().unique( _dptr ); }
+        { return DTraits().unique( _dptr ); }
 
-       long use_count() const
-       { return DTraits().use_count( _dptr ); }
+        long use_count() const
+        { return DTraits().use_count( _dptr ); }
 
         constPtrType getPtr() const
         { return _dptr; }
index 393fd34..4c7d228 100644 (file)
@@ -232,24 +232,24 @@ namespace zypp
 
       if ( trim_r & L_TRIM )
       {
-       std::string::size_type p = ret.find_first_not_of( " \t\n" );
-       if ( p == std::string::npos )
-       {
-         ret.clear();
-         return ret;
-       }
-       ret.erase( 0, p );
+        std::string::size_type p = ret.find_first_not_of( " \t\n" );
+        if ( p == std::string::npos )
+        {
+          ret.clear();
+          return ret;
+        }
+        ret.erase( 0, p );
       }
 
       if ( trim_r & R_TRIM )
       {
-       std::string::size_type p = ret.find_last_not_of( " \t\n" );
-       if ( p == std::string::npos )
-       {
-         ret.clear();
-         return ret;
-       }
-       ret = ret.erase( p+1 );
+        std::string::size_type p = ret.find_last_not_of( " \t\n" );
+        if ( p == std::string::npos )
+        {
+          ret.clear();
+          return ret;
+        }
+        ret = ret.erase( p+1 );
       }
 
       return ret;
@@ -331,15 +331,15 @@ namespace zypp
     {
       if ( ! from_r.empty() )
       {
-       std::string::size_type pos = 0;
-       while ( (pos = str_r.find( from_r, pos )) != std::string::npos )
-       {
-         str_r.replace( pos, from_r.size(), to_r );
-         pos += to_r.size();
-
-         if ( pos >= str_r.length() )
-           break;
-       }
+        std::string::size_type pos = 0;
+        while ( (pos = str_r.find( from_r, pos )) != std::string::npos )
+        {
+          str_r.replace( pos, from_r.size(), to_r );
+          pos += to_r.size();
+
+          if ( pos >= str_r.length() )
+            break;
+        }
       }
       return str_r;
     }
@@ -354,16 +354,16 @@ namespace zypp
     {
       if ( ! from_r.empty() )
       {
-       std::string::size_type pos = 0;
-       while ( (pos = str_r.find( from_r, pos )) != std::string::npos )
-       {
-         std::string to( to_r() );
-         str_r.replace( pos, from_r.size(), to );
-         pos += to.size();
-
-         if ( pos >= str_r.length() )
-           break;
-       }
+        std::string::size_type pos = 0;
+        while ( (pos = str_r.find( from_r, pos )) != std::string::npos )
+        {
+          std::string to( to_r() );
+          str_r.replace( pos, from_r.size(), to );
+          pos += to.size();
+
+          if ( pos >= str_r.length() )
+            break;
+        }
       }
       return str_r;
     }
@@ -394,18 +394,18 @@ namespace zypp
     std::string bEscape( std::string str_r, const C_Str & special_r )
     {
       if ( str_r.empty() )
-       return str_r;
+        return str_r;
 
       if ( str_r.find_first_of( special_r ) == std::string::npos
-       && ( ::strchr( special_r.c_str(), '\\' ) ||  !::strchr( str_r.c_str(), '\\' ) ) )
-       return str_r;
+        && ( ::strchr( special_r.c_str(), '\\' ) ||  !::strchr( str_r.c_str(), '\\' ) ) )
+        return str_r;
 
       Str buf;
       for_( s, str_r.c_str(), s+str_r.size() )
       {
-       if ( *s == '\\' || ::strchr( special_r.c_str(), *s ) )
-         buf << '\\';
-       buf << *s;
+        if ( *s == '\\' || ::strchr( special_r.c_str(), *s ) )
+          buf << '\\';
+        buf << *s;
       }
       return buf;
     }
@@ -420,56 +420,56 @@ namespace zypp
     std::string rxEscapeGlob( std::string str_r )
     {
       if ( str_r.empty() )
-       return str_r;
+        return str_r;
 
       if ( str_r.find_first_of( RXSPECIALCHARS ) == std::string::npos )
-       return str_r;
+        return str_r;
 
       Str buf;
       for_( s, str_r.c_str(), s+str_r.size() )
       {
-       if ( *s == '\\' )       // + next char literally
-       {
-         buf << '\\';
-         if ( *(s+1) ) { ++s; buf << *s; }
-       }
-       else if ( *s == '?' )   // translate
-       {
-         buf << '.';
-       }
-       else if ( *s == '*' )   // translate
-       {
-         buf << ".*";
-       }
-       else if ( *s == '[' )   // character class if closing ] is found, else literally
-       {
-         const char * e = s+1;
-         if ( *e == '^' || *e == '!' ) // negated cclass
-           ++e;
-         if ( *e == ']' )              // ] in cclass
-           ++e;
-         while ( *e && *e != ']' )     // ...to ] or \0
-           ++e;
-         if ( *e ) // on closing ']'
-         {
-           ++s;  buf << '[' << (*s == '!' ? '^' : *s );
-           while ( ++s != e )
-             buf << *s;
-           buf << ']';
-         }
-         else
-         {
-           buf << "\\[";
-         }
-       }
-       else if ( ::strchr( RXSPECIALCHARS, *s ) )      // escape
-       {
-         buf << '\\' << *s;
-       }
-       else
-       {
-         buf << *s;
-       }
+        if ( *s == '\\' )      // + next char literally
+        {
+          buf << '\\';
+          if ( *(s+1) ) { ++s; buf << *s; }
+        }
+        else if ( *s == '?' )  // translate
+        {
+          buf << '.';
+        }
+        else if ( *s == '*' )  // translate
+        {
+          buf << ".*";
+        }
+        else if ( *s == '[' )  // character class if closing ] is found, else literally
+        {
+          const char * e = s+1;
+          if ( *e == '^' || *e == '!' )        // negated cclass
+            ++e;
+          if ( *e == ']' )             // ] in cclass
+            ++e;
+          while ( *e && *e != ']' )    // ...to ] or \0
+            ++e;
+          if ( *e ) // on closing ']'
+          {
+            ++s;  buf << '[' << (*s == '!' ? '^' : *s );
+            while ( ++s != e )
+              buf << *s;
+            buf << ']';
+          }
+          else
+          {
+            buf << "\\[";
+          }
+        }
+        else if ( ::strchr( RXSPECIALCHARS, *s ) )     // escape
+        {
+          buf << '\\' << *s;
+        }
+        else
+        {
+          buf << *s;
+        }
       }
       return buf;
     }
@@ -489,27 +489,27 @@ namespace zypp
     {
       std::ostringstream datas;
       do {
-       char ch;
-       if ( str.get( ch ) )
-       {
-         if ( ch != delim_r )
-         {
-           datas.put( ch );
-         }
-         else
-         {
-           if ( returnDelim_r )
-             datas.put( ch );
-           break;      // --> delimiter found
-         }
-       }
-       else
-       {
-         // clear fail bit if we read data before reaching EOF
-         if ( str.eof() && datas.tellp() )
-           str.clear( std::ios::eofbit );
-         break;        // --> no consumable data.
-       }
+        char ch;
+        if ( str.get( ch ) )
+        {
+          if ( ch != delim_r )
+          {
+            datas.put( ch );
+          }
+          else
+          {
+            if ( returnDelim_r )
+              datas.put( ch );
+            break;     // --> delimiter found
+          }
+        }
+        else
+        {
+          // clear fail bit if we read data before reaching EOF
+          if ( str.eof() && datas.tellp() )
+            str.clear( std::ios::eofbit );
+          break;       // --> no consumable data.
+        }
       } while ( true );
       return datas.str();
     }
index 11807b9..89b3064 100644 (file)
@@ -480,9 +480,9 @@ namespace zypp
     {
       if ( gap_r &&  inp_r.size() > gap_r )
       {
-       inp_r.reserve( inp_r.size() + (inp_r.size()-1)/gap_r );
-       for ( std::string::size_type pos = gap_r; pos < inp_r.size(); pos += gap_r+1 )
-         inp_r.insert( pos, 1, gapchar );
+        inp_r.reserve( inp_r.size() + (inp_r.size()-1)/gap_r );
+        for ( std::string::size_type pos = gap_r; pos < inp_r.size(); pos += gap_r+1 )
+          inp_r.insert( pos, 1, gapchar );
       }
       return inp_r;
     }
@@ -617,86 +617,86 @@ namespace zypp
         }
 
         // after the leading sepchars
-       enum class Quote { None, Slash, Single, Double, DoubleSlash };
-       std::vector<char> buf;
-       Quote quoting = Quote::None;
+        enum class Quote { None, Slash, Single, Double, DoubleSlash };
+        std::vector<char> buf;
+        Quote quoting = Quote::None;
         for ( beg = cur; *beg; beg = cur, ++result_r, ++ret )
-       {
-         // read next value until unquoted sepchar
-         buf.clear();
-         quoting = Quote::None;
-         do {
-           switch ( quoting )
-           {
-             case Quote::None:
-               switch ( *cur )
-               {
-                 case '\\':    quoting = Quote::Slash;         break;
-                 case '\'':    quoting = Quote::Single;        break;
-                 case '"':     quoting = Quote::Double;        break;
-                 default:      buf.push_back( *cur );          break;
-               }
-               break;
-
-             case Quote::Slash:
-               buf.push_back( *cur );
-               quoting = Quote::None;
-               break;
-
-             case Quote::Single:
-               switch ( *cur )
-               {
-                 case '\'':    quoting = Quote::None;          break;
-                 default:      buf.push_back( *cur );          break;
-               }
-               break;
-
-             case Quote::Double:
-               switch ( *cur )
-               {
-                 case '\"':    quoting = Quote::None;          break;
-                 case '\\':    quoting = Quote::DoubleSlash;   break;
-                 default:      buf.push_back( *cur );          break;
-               }
-               break;
-
-             case Quote::DoubleSlash:
-               switch ( *cur )
-               {
-                 case '\"':    /*fallthrough*/
-                 case '\\':    buf.push_back( *cur );          break;
-                 default:
-                   buf.push_back( '\\' );
-                   buf.push_back( *cur );
-                   break;
-               }
-               quoting = Quote::Double;
-               break;
-           }
-           ++cur;
-         } while ( *cur && ( quoting != Quote::None || !::strchr( sepchars_r, *cur ) ) );
-         *result_r = std::string( buf.begin(), buf.end() );
-
-
-         // skip sepchars
-         if ( *cur && ::strchr( sepchars_r, *cur ) )
-           ++cur;
-         while ( *cur && ::strchr( sepchars_r, *cur ) )
-         {
-           ++cur;
-           if (withEmpty)
-           {
-             *result_r = "";
-             ++ret;
-           }
-         }
-         // the last was a separator => one more field
-         if ( !*cur && withEmpty && ::strchr( sepchars_r, *(cur-1) ) )
-         {
-           *result_r = "";
-           ++ret;
-         }
-       }
+        {
+          // read next value until unquoted sepchar
+          buf.clear();
+          quoting = Quote::None;
+          do {
+            switch ( quoting )
+            {
+              case Quote::None:
+                switch ( *cur )
+                {
+                  case '\\':   quoting = Quote::Slash;         break;
+                  case '\'':   quoting = Quote::Single;        break;
+                  case '"':    quoting = Quote::Double;        break;
+                  default:     buf.push_back( *cur );          break;
+                }
+                break;
+
+              case Quote::Slash:
+                buf.push_back( *cur );
+                quoting = Quote::None;
+                break;
+
+              case Quote::Single:
+                switch ( *cur )
+                {
+                  case '\'':   quoting = Quote::None;          break;
+                  default:     buf.push_back( *cur );          break;
+                }
+                break;
+
+              case Quote::Double:
+                switch ( *cur )
+                {
+                  case '\"':   quoting = Quote::None;          break;
+                  case '\\':   quoting = Quote::DoubleSlash;   break;
+                  default:     buf.push_back( *cur );          break;
+                }
+                break;
+
+              case Quote::DoubleSlash:
+                switch ( *cur )
+                {
+                  case '\"':   /*fallthrough*/
+                  case '\\':   buf.push_back( *cur );          break;
+                  default:
+                    buf.push_back( '\\' );
+                    buf.push_back( *cur );
+                    break;
+                }
+                quoting = Quote::Double;
+                break;
+            }
+            ++cur;
+          } while ( *cur && ( quoting != Quote::None || !::strchr( sepchars_r, *cur ) ) );
+          *result_r = std::string( buf.begin(), buf.end() );
+
+
+          // skip sepchars
+          if ( *cur && ::strchr( sepchars_r, *cur ) )
+            ++cur;
+          while ( *cur && ::strchr( sepchars_r, *cur ) )
+          {
+            ++cur;
+            if (withEmpty)
+            {
+              *result_r = "";
+              ++ret;
+            }
+          }
+          // the last was a separator => one more field
+          if ( !*cur && withEmpty && ::strchr( sepchars_r, *(cur-1) ) )
+          {
+            *result_r = "";
+            ++ret;
+          }
+        }
         return ret;
       }
 
@@ -731,11 +731,11 @@ namespace zypp
           {
             // skip non sepchars
             while( *cur && !::strchr( sepchars_r, *cur ) )
-           {
-             if ( *cur == '\\' && *(cur+1) )
-               ++cur;
+            {
+              if ( *cur == '\\' && *(cur+1) )
+                ++cur;
               ++cur;
-           }
+            }
             // build string
             *result_r = std::string( beg, cur-beg );
             ++ret;
@@ -844,35 +844,35 @@ namespace zypp
        */
       inline std::ostream & printIndented( std::ostream & str, const std::string & text_r, const std::string & indent_r = "  ", unsigned maxWitdh_r = 0 )
       {
-       if ( maxWitdh_r )
-       {
-         if ( indent_r.size() >= maxWitdh_r )
-           maxWitdh_r = 0;     // nonsense: indent larger than line witdh
-         else
-           maxWitdh_r -= indent_r.size();
-       }
-       unsigned width = 0;
-       for ( const char * e = text_r.c_str(), * s = e; *e; s = ++e )
-       {
-         for ( ; *e && *e != '\n'; ++e ) ;/*searching*/
-         width = e-s;
-         if ( maxWitdh_r && width > maxWitdh_r )
-         {
-           // must break line
-           width = maxWitdh_r;
-           for ( e = s+width; e > s && *e != ' '; --e ) ;/*searching*/
-           if ( e > s )
-             width = e-s;      // on a ' ', replaced by '\n'
-           else
-             e = s+width-1;    // cut line;
-         }
-         str << indent_r;
-         str.write( s, width );
-         str << "\n";
-         if ( !*e )    // on '\0'
-           break;
-       }
-       return str;
+        if ( maxWitdh_r )
+        {
+          if ( indent_r.size() >= maxWitdh_r )
+            maxWitdh_r = 0;    // nonsense: indent larger than line witdh
+          else
+            maxWitdh_r -= indent_r.size();
+        }
+        unsigned width = 0;
+        for ( const char * e = text_r.c_str(), * s = e; *e; s = ++e )
+        {
+          for ( ; *e && *e != '\n'; ++e ) ;/*searching*/
+          width = e-s;
+          if ( maxWitdh_r && width > maxWitdh_r )
+          {
+            // must break line
+            width = maxWitdh_r;
+            for ( e = s+width; e > s && *e != ' '; --e ) ;/*searching*/
+            if ( e > s )
+              width = e-s;     // on a ' ', replaced by '\n'
+            else
+              e = s+width-1;   // cut line;
+          }
+          str << indent_r;
+          str.write( s, width );
+          str << "\n";
+          if ( !*e )   // on '\0'
+            break;
+        }
+        return str;
       }
       /** \overload Indent by number of chars [' '] optionally wrap. */
       inline std::ostream & printIndented( std::ostream & str, const std::string & text_r, unsigned indent_r, char indentch_r = ' ', unsigned maxWitdh_r = 0 )
@@ -886,25 +886,25 @@ namespace zypp
        */
       inline std::ostream & autoPrefix( std::ostream & str, const std::string & text_r, function<std::string(const char*, const char*)> fnc_r )
       {
-       for ( const char * e = text_r.c_str(); *e; ++e )
-       {
-         const char * s = e;
-         for ( ; *e && *e != '\n'; ++e ) /*searching*/;
-         str << fnc_r( s, e );
-         str.write( s, e-s );
-         str << "\n";
-         if ( !*e )    // on '\0'
-           break;
-       }
-       return str;
+        for ( const char * e = text_r.c_str(); *e; ++e )
+        {
+          const char * s = e;
+          for ( ; *e && *e != '\n'; ++e ) /*searching*/;
+          str << fnc_r( s, e );
+          str.write( s, e-s );
+          str << "\n";
+          if ( !*e )   // on '\0'
+            break;
+        }
+        return str;
       }
       /** \overload Prefix lines by string generated by function [std::string()] */
       inline std::ostream & autoPrefix0( std::ostream & str, const std::string & text_r, function<std::string()> fnc_r )
       {
-       auto wrap = [&fnc_r]( const char*, const char* )-> std::string {
-         return fnc_r();
-       };
-       return autoPrefix( str, text_r, wrap );
+        auto wrap = [&fnc_r]( const char*, const char* )-> std::string {
+          return fnc_r();
+        };
+        return autoPrefix( str, text_r, wrap );
       }
     //@}
     ///////////////////////////////////////////////////////////////////
index 14ea425..93f934e 100644 (file)
@@ -25,71 +25,71 @@ namespace zypp
        */
       unsigned _splitSimple( std::string_view line_r, WordConsumer && fnc_r )
       {
-       // callback stats
-       unsigned fncCall = 0;
-
-       // NOTE: line_r is not null-terminated!
-       const char *const eol = line_r.data() + line_r.size();  // the '\0'
-       const char * searchfrom = line_r.data();        // start of the next search (moves with each cycle!)
-
-       // Empty sep: split at /[BLANK,TAB]+/ and report no-empty words
-       auto isSep = []( char ch )->bool { return ch == ' '|| ch == '\t'; };
-
-       auto skipSep = [eol,&isSep]( const char *& ptr )->bool {
-         while ( ptr < eol && isSep( *ptr ) )
-           ++ptr;
-         return ptr < eol;     // whether we ended up at a new wordstart
-       };
-
-       auto skipWord = [eol,&isSep]( const char *& ptr )->void {
-         while ( ptr < eol && ! isSep( *ptr ) )
-           ++ptr;
-       };
-
-       // For the 'last' CB argument: we must remember a word
-       // until we know whether another one is following
-       std::string_view word;
-
-       while ( skipSep( searchfrom ) ) {
-         const char * wordstart = searchfrom;
-         // Report a previous word found
-         if ( ! word.empty() ) {
-           if ( fnc_r ) {
-             if ( ! fnc_r( word, fncCall, false/*more to come*/ ) ) {
-               // Stop searching for further matches. Final report will
-               // be the remaining line (right trimmed)
-               const char * wordend = eol;
-               while ( isSep( *(wordend-1) ) ) // noSep at wordstart stops loop
-                 --wordend;
-               word = std::string_view( wordstart, wordend-wordstart );
-               ++fncCall;
-               break;
-             }
-           }
-           ++fncCall;
-         }
-         // remember new word
-         ++searchfrom;
-         skipWord( searchfrom );
-         word = std::string_view( wordstart, searchfrom-wordstart );
-       }
-
-       // finally report the last word
-       if ( ! word.empty() ) {
-         if ( fnc_r ) {
-           fnc_r( word, fncCall, true/*last*/ );
-         }
-         ++fncCall;
-       }
-
-       return fncCall;
+        // callback stats
+        unsigned fncCall = 0;
+
+        // NOTE: line_r is not null-terminated!
+        const char *const eol = line_r.data() + line_r.size(); // the '\0'
+        const char * searchfrom = line_r.data();       // start of the next search (moves with each cycle!)
+
+        // Empty sep: split at /[BLANK,TAB]+/ and report no-empty words
+        auto isSep = []( char ch )->bool { return ch == ' '|| ch == '\t'; };
+
+        auto skipSep = [eol,&isSep]( const char *& ptr )->bool {
+          while ( ptr < eol && isSep( *ptr ) )
+            ++ptr;
+          return ptr < eol;    // whether we ended up at a new wordstart
+        };
+
+        auto skipWord = [eol,&isSep]( const char *& ptr )->void {
+          while ( ptr < eol && ! isSep( *ptr ) )
+            ++ptr;
+        };
+
+        // For the 'last' CB argument: we must remember a word
+        // until we know whether another one is following
+        std::string_view word;
+
+        while ( skipSep( searchfrom ) ) {
+          const char * wordstart = searchfrom;
+          // Report a previous word found
+          if ( ! word.empty() ) {
+            if ( fnc_r ) {
+              if ( ! fnc_r( word, fncCall, false/*more to come*/ ) ) {
+                // Stop searching for further matches. Final report will
+                // be the remaining line (right trimmed)
+                const char * wordend = eol;
+                while ( isSep( *(wordend-1) ) ) // noSep at wordstart stops loop
+                  --wordend;
+                word = std::string_view( wordstart, wordend-wordstart );
+                ++fncCall;
+                break;
+              }
+            }
+            ++fncCall;
+          }
+          // remember new word
+          ++searchfrom;
+          skipWord( searchfrom );
+          word = std::string_view( wordstart, searchfrom-wordstart );
+        }
+
+        // finally report the last word
+        if ( ! word.empty() ) {
+          if ( fnc_r ) {
+            fnc_r( word, fncCall, true/*last*/ );
+          }
+          ++fncCall;
+        }
+
+        return fncCall;
       }
     } // namespace detail
 
     unsigned detail::_split( std::string_view line_r, std::string_view sep_r, Trim trim_r, WordConsumer && fnc_r )
     {
       if ( sep_r.empty() )
-       return _splitSimple( line_r, std::move( fnc_r ) );
+        return _splitSimple( line_r, std::move( fnc_r ) );
 
       // callback stats
       bool fncStop = false;
@@ -100,29 +100,29 @@ namespace zypp
       size_type searchfrom = 0; // start of the next search for a separator
 
       do {     // report lhs word of separator matches...
-       searchfrom = line_r.find( sep_r, searchfrom );
-       if ( fncStop || searchfrom == line_r.npos ) {
-         break;
-       }
-
-       // Report lhs word of the match and advance...
-       if ( fnc_r ) {
-         if ( ! fnc_r( trim( line_r.substr(wordstart,searchfrom-wordstart), trim_r ), fncCall, false/*more to come*/ ) )
-           fncStop= true;      // stop searching for further matches
-       }
-       ++fncCall;
-
-       // Next wordstart is behind the separator match.
-       searchfrom += sep_r.size();
-       wordstart = searchfrom;
+        searchfrom = line_r.find( sep_r, searchfrom );
+        if ( fncStop || searchfrom == line_r.npos ) {
+          break;
+        }
+
+        // Report lhs word of the match and advance...
+        if ( fnc_r ) {
+          if ( ! fnc_r( trim( line_r.substr(wordstart,searchfrom-wordstart), trim_r ), fncCall, false/*more to come*/ ) )
+            fncStop= true;     // stop searching for further matches
+        }
+        ++fncCall;
+
+        // Next wordstart is behind the separator match.
+        searchfrom += sep_r.size();
+        wordstart = searchfrom;
       } while( wordstart < line_r.size() );
 
       // finally report rhs word of the last separator match (or no match)
       if ( fnc_r ) {
-       if ( wordstart < line_r.size() )
-         fnc_r( trim( line_r.substr(wordstart,line_r.size()-wordstart), trim_r ), fncCall, true/*last*/ );
-       else    // a final match at $ so a final empty word reported (no trim needed)
-         fnc_r( std::string_view( line_r.data()+line_r.size(), 0 ), fncCall, true/*last*/ );
+        if ( wordstart < line_r.size() )
+          fnc_r( trim( line_r.substr(wordstart,line_r.size()-wordstart), trim_r ), fncCall, true/*last*/ );
+        else   // a final match at $ so a final empty word reported (no trim needed)
+          fnc_r( std::string_view( line_r.data()+line_r.size(), 0 ), fncCall, true/*last*/ );
       }
       ++fncCall;
       return fncCall;
@@ -142,42 +142,42 @@ namespace zypp
 
       // Whether to match the ^ at beginning of the line or after an \n:
       auto matchAtBOL = [&]() {
-       return searchfrom == line_r.data() || *(searchfrom-1) == '\n' ? regex::none : regex::not_bol;
+        return searchfrom == line_r.data() || *(searchfrom-1) == '\n' ? regex::none : regex::not_bol;
       };
       do {     // report lhs word of separator matches...
-       smatch match;
-       if ( fncStop || ! rx_r.matches( searchfrom, match, matchAtBOL() ) ) {
-         break;
-       }
-       if ( trailingNL && searchfrom+match.begin(0) == eol )
-         break;        // don't report matches behind a trailing NL
-
-       if ( match.end(0) == 0 && searchfrom == wordstart && searchfrom != line_r.data() ) {
-         // An empty(!) separator found at wordstart is ignored unless we're at the very beginning.
-         // If searchfrom == wordstart we just skipped over a not-empty separator. If wordstart is
-         // not part of a 2nd not-empty separator, we want the next separator to it's right.
-         // Example: Rx:"b*" Str:"0b2" - at pos 2 Rx matches empty; the previous cycle found 'b' and reported the '0'.
-         ++searchfrom;
-       } else {
-         // Report lhs word of the match and advance...
-         if ( fnc_r ) {
-           if ( ! fnc_r( std::string_view( wordstart, searchfrom+match.begin(0) - wordstart ), fncCall, false/*more to come*/ ) )
-             fncStop= true;    // stop searching for further matches
-         }
-         ++fncCall;
-         // Next wordstart is behind the separator match.
-         // Next searchfrom also, but advances at least by 1.
-         wordstart = searchfrom+match.end(0);
-         searchfrom += match.end(0) ? match.end(0) : 1;
-       }
+        smatch match;
+        if ( fncStop || ! rx_r.matches( searchfrom, match, matchAtBOL() ) ) {
+          break;
+        }
+        if ( trailingNL && searchfrom+match.begin(0) == eol )
+          break;       // don't report matches behind a trailing NL
+
+        if ( match.end(0) == 0 && searchfrom == wordstart && searchfrom != line_r.data() ) {
+          // An empty(!) separator found at wordstart is ignored unless we're at the very beginning.
+          // If searchfrom == wordstart we just skipped over a not-empty separator. If wordstart is
+          // not part of a 2nd not-empty separator, we want the next separator to it's right.
+          // Example: Rx:"b*" Str:"0b2" - at pos 2 Rx matches empty; the previous cycle found 'b' and reported the '0'.
+          ++searchfrom;
+        } else {
+          // Report lhs word of the match and advance...
+          if ( fnc_r ) {
+            if ( ! fnc_r( std::string_view( wordstart, searchfrom+match.begin(0) - wordstart ), fncCall, false/*more to come*/ ) )
+              fncStop= true;   // stop searching for further matches
+          }
+          ++fncCall;
+          // Next wordstart is behind the separator match.
+          // Next searchfrom also, but advances at least by 1.
+          wordstart = searchfrom+match.end(0);
+          searchfrom += match.end(0) ? match.end(0) : 1;
+        }
       } while ( searchfrom <= eol );   // incl. '== eol' as there might be an (empty) match at $
 
       // finally report rhs word of the last separator match (or no match)
       if ( fnc_r ) {
-       if ( wordstart < eol )
-         fnc_r( std::string_view( wordstart, eol-wordstart ), fncCall, true/*last*/ );
-       else    // a final match at $ so a final empty word reported
-         fnc_r( std::string_view( eol, 0 ), fncCall, true/*last*/ );
+        if ( wordstart < eol )
+          fnc_r( std::string_view( wordstart, eol-wordstart ), fncCall, true/*last*/ );
+        else   // a final match at $ so a final empty word reported
+          fnc_r( std::string_view( eol, 0 ), fncCall, true/*last*/ );
       }
       ++fncCall;
       return fncCall;
index a32276c..9189b64 100644 (file)
@@ -43,12 +43,12 @@ namespace zypp
     inline std::string_view ltrim( std::string_view str_r, std::string_view chars_r = blank )
     {
       if ( str_r.empty() )
-       return str_r;
+        return str_r;
       auto pos = str_r.find_first_not_of( chars_r );
       if ( pos == str_r.npos )
-       str_r.remove_prefix( str_r.size() );
+        str_r.remove_prefix( str_r.size() );
       else if ( pos )
-       str_r.remove_prefix( pos );
+        str_r.remove_prefix( pos );
       return str_r;
     }
 
@@ -56,12 +56,12 @@ namespace zypp
     inline std::string_view rtrim( std::string_view str_r, std::string_view chars_r = blank )
     {
       if ( str_r.empty() )
-       return str_r;
+        return str_r;
       auto pos = str_r.find_last_not_of( chars_r );
       if ( pos == str_r.npos )
-       str_r.remove_suffix( str_r.size() );
+        str_r.remove_suffix( str_r.size() );
       else if ( (pos = str_r.size()-1-pos) )
-       str_r.remove_suffix( pos );
+        str_r.remove_suffix( pos );
       return str_r;
     }
 
@@ -69,7 +69,7 @@ namespace zypp
     inline std::string_view trim( std::string_view str_r, std::string_view chars_r = blank )
     {
       if ( str_r.empty() )
-       return str_r;
+        return str_r;
       str_r = ltrim( std::move(str_r), chars_r );
       str_r = rtrim( std::move(str_r), chars_r );
       return str_r;
@@ -79,11 +79,11 @@ namespace zypp
     inline std::string_view trim( std::string_view str_r, std::string_view chars_r, TrimFlag trim_r )
     {
       if ( str_r.empty() || trim_r == Trim::notrim )
-       return str_r;
+        return str_r;
       if ( trim_r.testFlag( Trim::left ) )
-       str_r = ltrim( std::move(str_r), chars_r );
+        str_r = ltrim( std::move(str_r), chars_r );
       if ( trim_r.testFlag( Trim::right ) )
-       str_r = rtrim( std::move(str_r), chars_r );
+        str_r = rtrim( std::move(str_r), chars_r );
       return str_r;
     }
     /** \overload Trimming blanks at \a trim_r sides of \a str_r. */
index 97b72b0..894e332 100644 (file)
@@ -112,29 +112,29 @@ namespace zypp
       /** Dtor wrting end tag */
       ~Node()
       {
-       if ( isComment() )
-         _out << "-->";
-       else
-       {
-         if ( _hasContent )
-           _out << "</" << _name << ">";
-         else
-           _out << "/>";
-       }
+        if ( isComment() )
+          _out << "-->";
+        else
+        {
+          if ( _hasContent )
+            _out << "</" << _name << ">";
+          else
+            _out << "/>";
+        }
       }
 
       /** Exception type thrown if attributes are added to a closed start node. */
       struct HasContentException{};
 
        /** Add additional attributes (requires OptionalContentType)
-       * \throw HasContentException If start node is already closed
-       */
+        * \throw HasContentException If start node is already closed
+        */
       Node & addAttr( const std::initializer_list<Attr> & attrs_r = {} )
       {
-       if ( _hasContent )
-         throw HasContentException();
-       printAttr( attrs_r );
-       return *this;
+        if ( _hasContent )
+          throw HasContentException();
+        printAttr( attrs_r );
+        return *this;
       }
 
       /** \overload for one */
@@ -145,38 +145,38 @@ namespace zypp
       /** Return the output stream */
       std::ostream & operator*()
       {
-       if ( ! _hasContent )
-       {
-         _hasContent = true;
-         if ( isComment() )
-           _out << "|";
-         else
-           _out << ">";
-       }
-       return _out;
+        if ( ! _hasContent )
+        {
+          _hasContent = true;
+          if ( isComment() )
+            _out << "|";
+          else
+            _out << ">";
+        }
+        return _out;
       }
 
     private:
       void printStart( const std::initializer_list<Attr> & attrs_r )
       {
-       if ( _name.empty() || _name[0] == '!' )
-       {
-         _out << "<!--" << _name;
-         _name.clear();        // a comment
-       }
-       else
-         _out << "<" << _name;
-
-       printAttr( attrs_r );
-
-       if ( !isComment() && _hasContent )
-         _out << ">";
+        if ( _name.empty() || _name[0] == '!' )
+        {
+          _out << "<!--" << _name;
+          _name.clear();       // a comment
+        }
+        else
+          _out << "<" << _name;
+
+        printAttr( attrs_r );
+
+        if ( !isComment() && _hasContent )
+          _out << ">";
       }
 
       void printAttr( const std::initializer_list<Attr> & attrs_r )
       {
-       for ( const auto & pair : attrs_r )
-         _out << " " << pair.first << "=\"" << xml::escape( pair.second ) << "\"";
+        for ( const auto & pair : attrs_r )
+          _out << " " << pair.first << "=\"" << xml::escape( pair.second ) << "\"";
       }
 
       bool isComment() const
index 7766d46..fa74165 100644 (file)
@@ -286,14 +286,14 @@ namespace zypp
       /**  Helper function to log return values. */
       inline int doLogResult( const int res, const char * rclass = 0 /*errno*/ )
       {
-       if ( res )
-       {
-         if ( rclass )
-           WAR << " FAILED: " << rclass << " " << res << endl;
-         else
-           WAR << " FAILED: " << str::strerror( res ) << endl;
-       }
-       return res;
+        if ( res )
+        {
+          if ( rclass )
+            WAR << " FAILED: " << rclass << " " << res << endl;
+          else
+            WAR << " FAILED: " << str::strerror( res ) << endl;
+        }
+        return res;
       }
     } // namespace
 
@@ -424,11 +424,11 @@ namespace zypp
 
       p.lstat();       // get dir symlinks
       if ( !p.isDir() ) {
-       MIL << "unlink symlink ";
-       if ( ::unlink( path.asString().c_str() ) == -1 ) {
-         return logResult( errno );
-       }
-       return logResult( 0 );
+        MIL << "unlink symlink ";
+        if ( ::unlink( path.asString().c_str() ) == -1 ) {
+          return logResult( errno );
+        }
+        return logResult( 0 );
       }
 
       return logResult( recursive_rmdir_1( path ) );
@@ -538,37 +538,66 @@ namespace zypp
     }
 
     ///////////////////////////////////////////////////////////////////////
-    // dirForEach
+    // dirForEachImpl
     ///////////////////////////////////////////////////////////////////////
+    template <class... T>
+    constexpr bool always_false = false;
 
-    int dirForEach( const Pathname & dir_r, function<bool(const Pathname &, const char *const)> fnc_r )
+    template <typename F>
+    int dirForEachImpl ( const Pathname & dir_r, F &&fnc_r )
     {
-      if ( ! fnc_r )
-       return 0;
-
       AutoDispose<DIR *> dir( ::opendir( dir_r.c_str() ),
-                             []( DIR * dir_r ) { if ( dir_r ) ::closedir( dir_r ); } );
+                              []( DIR * dir_r ) { if ( dir_r ) ::closedir( dir_r ); } );
 
       MIL << "readdir " << dir_r << ' ';
       if ( ! dir )
-       return logResult( errno );
+              return logResult( errno );
       MIL << endl; // close line before callbacks are invoked.
 
       int ret = 0;
       for ( struct dirent * entry = ::readdir( dir ); entry; entry = ::readdir( dir ) )
       {
         if ( entry->d_name[0] == '.' && ( entry->d_name[1] == '\0' || ( entry->d_name[1] == '.' && entry->d_name[2] == '\0' ) ) )
-         continue; // omitt . and ..
+                continue; // omitt . and ..
+
+        // some static checks to make sure the correct func is selected
+        static_assert( !std::is_invocable_v< function<bool(const Pathname &, const char *const)>, const Pathname &, const DirEntry &> , "Invoke detection broken" );
+        static_assert( !std::is_invocable_v< function<bool(const Pathname &, const DirEntry& )>, const Pathname &, const char *> , "Invoke detection broken" );
 
-       if ( ! fnc_r( dir_r, entry->d_name ) )
-       {
-         ret = -1;
-         break;
-       }
+        if constexpr ( std::is_invocable_v<F, const Pathname &, const char *const> ) {
+          if ( ! std::forward<F>(fnc_r)( dir_r, entry->d_name ) ) {
+            ret = -1;
+            break;
+          }
+        } else if constexpr ( std::is_invocable_v<F, const Pathname &, const DirEntry&> ) {
+          if ( ! std::forward<F>(fnc_r)( dir_r, DirEntry( entry ) ) ) {
+            ret = -1;
+            break;
+          }
+        } else {
+          static_assert( always_false<F>, "Callback not supported" );
+        }
       }
       return ret;
     }
 
+    int dirForEach( const Pathname & dir_r, function<bool(const Pathname &, const char *const)> fnc_r )
+    {
+      if ( ! fnc_r )
+              return 0;
+
+      return dirForEachImpl( dir_r, fnc_r );
+    }
+
+
+    int dirForEachExt( const Pathname & dir_r, const function<bool(const Pathname &, const DirEntry &)> &fnc_r )
+    {
+      if ( ! fnc_r )
+              return 0;
+
+      return dirForEachImpl( dir_r, fnc_r );
+    }
+
     ///////////////////////////////////////////////////////////////////
     // readdir
     ///////////////////////////////////////////////////////////////////
@@ -577,12 +606,12 @@ namespace zypp
     {
       retlist_r.clear();
       return dirForEach( path_r,
-                        [&]( const Pathname & dir_r, const char *const name_r )->bool
-                        {
-                          if ( dots_r || name_r[0] != '.' )
-                            retlist_r.push_back( name_r );
-                          return true;
-                        } );
+                         [&]( const Pathname & dir_r, const char *const name_r )->bool
+                         {
+                           if ( dots_r || name_r[0] != '.' )
+                             retlist_r.push_back( name_r );
+                           return true;
+                         } );
     }
 
 
@@ -590,12 +619,43 @@ namespace zypp
     {
       retlist_r.clear();
       return dirForEach( path_r,
-                        [&]( const Pathname & dir_r, const char *const name_r )->bool
-                        {
-                          if ( dots_r || name_r[0] != '.' )
-                            retlist_r.push_back( dir_r/name_r );
-                          return true;
-                        } );
+                         [&]( const Pathname & dir_r, const char *const name_r )->bool
+                         {
+                           if ( dots_r || name_r[0] != '.' )
+                             retlist_r.push_back( dir_r/name_r );
+                           return true;
+                         } );
+    }
+
+    DirEntry::DirEntry( struct dirent* entry )
+      : name( str::asString( entry->d_name ) )
+    {
+      switch( entry->d_type ) {
+        case DT_BLK:
+          this->type = FileType::FT_BLOCKDEV;
+          break;
+        case DT_CHR:
+          this->type =  FileType::FT_CHARDEV;
+          break;
+        case DT_DIR:
+          this->type =  FileType::FT_DIR;
+          break;
+        case DT_FIFO:
+          this->type =  FileType::FT_FIFO;
+          break;
+        case DT_LNK:
+          this->type =  FileType::FT_LINK;
+          break;
+        case DT_REG:
+          this->type =  FileType::FT_FILE;
+          break;
+        case DT_SOCK:
+          this->type =  FileType::FT_SOCKET;
+          break;
+        case DT_UNKNOWN:
+          this->type =  FileType::FT_NOT_AVAIL;
+          break;
+      }
     }
 
     bool DirEntry::operator==( const DirEntry &rhs ) const
@@ -610,12 +670,12 @@ namespace zypp
     {
       retlist_r.clear();
       return dirForEach( path_r,
-                        [&]( const Pathname & dir_r, const char *const name_r )->bool
-                        {
-                          if ( dots_r || name_r[0] != '.' )
-                            retlist_r.push_back( DirEntry( name_r, PathInfo( dir_r/name_r, statmode_r ).fileType() ) );
-                          return true;
-                        } );
+                         [&]( const Pathname & dir_r, const char *const name_r )->bool
+                         {
+                           if ( dots_r || name_r[0] != '.' )
+                             retlist_r.push_back( DirEntry( name_r, PathInfo( dir_r/name_r, statmode_r ).fileType() ) );
+                           return true;
+                         } );
     }
 
     std::ostream & operator<<( std::ostream & str, const DirContent & obj )
@@ -628,8 +688,8 @@ namespace zypp
     int is_empty_dir( const Pathname & path_r )
     {
       return dirForEach( path_r,
-                        [&]( const Pathname & dir_r, const char *const name_r )->bool
-                        { return false; } );
+                         [&]( const Pathname & dir_r, const char *const name_r )->bool
+                         { return false; } );
     }
 
     ///////////////////////////////////////////////////////////////////
@@ -827,17 +887,17 @@ namespace zypp
       PathInfo pi( oldpath, PathInfo::LSTAT );
       if ( pi.isLink() )
       {
-       // dont hardlink symlinks!
-       MIL << " => copy" << endl;
-       return copy( oldpath, newpath );
+        // dont hardlink symlinks!
+        MIL << " => copy" << endl;
+        return copy( oldpath, newpath );
       }
 
       pi.lstat( newpath );
       if ( pi.isExist() )
       {
-       int res = unlink( newpath );
-       if ( res != 0 )
-         return logResult( res );
+        int res = unlink( newpath );
+        if ( res != 0 )
+          return logResult( res );
       }
 
       // Here: no symlink, no newpath
@@ -845,9 +905,9 @@ namespace zypp
       {
         switch ( errno )
         {
-         case EPERM: // /proc/sys/fs/protected_hardlink in proc(5)
+          case EPERM: // /proc/sys/fs/protected_hardlink in proc(5)
           case EXDEV: // oldpath  and  newpath are not on the same mounted file system
-           MIL << " => copy" << endl;
+            MIL << " => copy" << endl;
             return copy( oldpath, newpath );
             break;
         }
@@ -1149,14 +1209,14 @@ namespace zypp
       PathInfo pi( path );
       if ( pi.isExist() )
       {
-       if ( ! pi.isFile() )
-         return logResult( EEXIST );
+        if ( ! pi.isFile() )
+          return logResult( EEXIST );
 
-       mode = applyUmaskTo( mode );
-       if ( pi.st_mode() != mode )
-         return chmod( path, mode );
+        mode = applyUmaskTo( mode );
+        if ( pi.st_mode() != mode )
+          return chmod( path, mode );
 
-       return logResult( 0 );
+        return logResult( 0 );
       }
 
       int fd = ::creat( path.c_str(), mode );
index 57fb3ac..1793762 100644 (file)
@@ -31,6 +31,8 @@ extern "C"
 #include <zypp-core/ByteCount.h>
 #include <zypp-core/CheckSum.h>
 
+struct dirent;
+
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
@@ -504,6 +506,8 @@ namespace zypp
       , type( type_r )
       {}
 
+      DirEntry( struct dirent* entry );
+
       bool operator==( const DirEntry &rhs ) const;
     };
 
@@ -529,6 +533,11 @@ namespace zypp
                  bool dots = true, PathInfo::Mode statmode = PathInfo::STAT );
 
     /**
+     * Simiar to \sa dirForEach, except that the callback takes a \sa DirEntry as second argument
+     */
+    int dirForEachExt( const Pathname & dir_r, const function<bool(const Pathname &, const DirEntry &)> &fnc_r );
+
+    /**
      * Check if the specified directory is empty.
      * \param path The path of the directory to check.
      * \return 0 if directory is empty, -1 if not, errno > 0 on failure.
index 0eb7715..5834e51 100644 (file)
@@ -86,7 +86,7 @@ namespace zypp {
         { return( _flags & Autodelete ); }
 
         void autoCleanup( bool yesno_r )
-       { _flags = yesno_r ? CtorDefault : NoOp; }
+        { _flags = yesno_r ? CtorDefault : NoOp; }
 
       private:
         Pathname _path;
index 3effb50..13b40de 100644 (file)
@@ -76,14 +76,14 @@ namespace zypp {
         { return path(); }
 
         /**
-        * Whether path is valid and deleted when the last reference drops.
-        */
+         * Whether path is valid and deleted when the last reference drops.
+         */
         bool autoCleanup() const;
 
         /**
-        * Turn \ref autoCleanup on/off if path is valid.
-        */
-       void autoCleanup( bool yesno_r );
+         * Turn \ref autoCleanup on/off if path is valid.
+         */
+        void autoCleanup( bool yesno_r );
 
       public:
         /**
index f3a0435..da22f9c 100644 (file)
@@ -39,27 +39,27 @@ namespace iobind
     {
       std::string unescape(const std::string &istr) const
       {
-       size_t i;
-       std::string str = istr;
-       i = str.find_first_of("&");
-       while (i != std::string::npos)
-       {
-         if (str[i] == '&')
-         {
-           if (!str.compare(i + 1, 3, "lt;"))
-             str.replace(i, 4, 1, '<');
-           else if (!str.compare(i + 1, 3, "gt;"))
-             str.replace(i, 4, 1, '>');
-           else if (!str.compare(i + 1, 4, "amp;"))
-             str.replace(i, 5, 1, '&');
-           else if (!str.compare(i + 1, 5, "apos;"))
-             str.replace(i, 6, 1, '\'');
-           else if (!str.compare(i + 1, 5, "quot;"))
-             str.replace(i, 6, 1, '"');
-         }
-         i = str.find_first_of("&", i + 1);
-       }
-       return str;
+        size_t i;
+        std::string str = istr;
+        i = str.find_first_of("&");
+        while (i != std::string::npos)
+        {
+          if (str[i] == '&')
+          {
+            if (!str.compare(i + 1, 3, "lt;"))
+              str.replace(i, 4, 1, '<');
+            else if (!str.compare(i + 1, 3, "gt;"))
+              str.replace(i, 4, 1, '>');
+            else if (!str.compare(i + 1, 4, "amp;"))
+              str.replace(i, 5, 1, '&');
+            else if (!str.compare(i + 1, 5, "apos;"))
+              str.replace(i, 6, 1, '\'');
+            else if (!str.compare(i + 1, 5, "quot;"))
+              str.replace(i, 6, 1, '"');
+          }
+          i = str.find_first_of("&", i + 1);
+        }
+        return str;
       }
     };
   } // namespace parser
@@ -78,33 +78,33 @@ namespace zypp
     {
       std::ostream & EscapedString::dumpOn( std::ostream & str ) const
       {
-       typedef unsigned char uchar;
-       for ( char ch : _in )
-       {
-         switch ( ch )
-         {
-           case '<':   str << "&lt;";          break;
-           case '>':   str << "&gt;";          break;
-           case '&':   str << "&amp;";         break;
-           case '"':   str << "&quot;";        break;
-           case '\'':  str << "&apos;";        break;
+        typedef unsigned char uchar;
+        for ( char ch : _in )
+        {
+          switch ( ch )
+          {
+            case '<':  str << "&lt;";          break;
+            case '>':  str << "&gt;";          break;
+            case '&':  str << "&amp;";         break;
+            case '"':  str << "&quot;";        break;
+            case '\'': str << "&apos;";        break;
 
-           // control chars we allow:
-           case '\n':
-           case '\r':
-           case '\t':
-             str << ch;
-             break;
+            // control chars we allow:
+            case '\n':
+            case '\r':
+            case '\t':
+              str << ch;
+              break;
 
-           default:
-             if ( uchar(ch) < 32u )
-               str << '?'; // filter problematic control chars (XML1.0)
-             else
-               str << ch;
-             break;
-         }
-       }
-       return str;
+            default:
+              if ( uchar(ch) < 32u )
+                str << '?'; // filter problematic control chars (XML1.0)
+              else
+                str << ch;
+              break;
+          }
+        }
+        return str;
       }
 
     } // detail
index 67ce821..4972bac 100644 (file)
@@ -27,14 +27,14 @@ namespace zypp
     {
       struct EscapedString
       {
-       EscapedString( const std::string & in_r ) : _in( in_r ) {}
-       std::ostream & dumpOn( std::ostream & str ) const;
-       std::string asString() const
-       { std::ostringstream str; dumpOn( str ); return str.str(); }
-       operator std::string() const
-       { return asString(); }
+        EscapedString( const std::string & in_r ) : _in( in_r ) {}
+        std::ostream & dumpOn( std::ostream & str ) const;
+        std::string asString() const
+        { std::ostringstream str; dumpOn( str ); return str.str(); }
+        operator std::string() const
+        { return asString(); }
       private:
-       const std::string & _in;
+        const std::string & _in;
       };
 
       /** \relates EscapedString Stream output */
index 29c9152..82f0096 100644 (file)
@@ -149,23 +149,23 @@ namespace zypp
     private:
       void _assign( std::string && rhs )
       {
-       _fullQuerytsr = std::move(rhs);
-
-       static constexpr std::string_view tag { "proxypass=" };
-       if ( _fullQuerytsr.find( tag ) != std::string::npos )
-       {
-         std::string safe;
-         strv::split( _fullQuerytsr, "&", [&safe]( std::string_view val ) {
-           if ( val.substr( 0, tag.size()  ) != tag ) {
-             if ( ! safe.empty() )
-               safe += "&";
-             safe += val;
-           }
-         });
-         _safeQuerytsr = std::move(safe);
-       }
-       else
-         _safeQuerytsr = std::nullopt;
+        _fullQuerytsr = std::move(rhs);
+
+        static constexpr std::string_view tag { "proxypass=" };
+        if ( _fullQuerytsr.find( tag ) != std::string::npos )
+        {
+          std::string safe;
+          strv::split( _fullQuerytsr, "&", [&safe]( std::string_view val ) {
+            if ( val.substr( 0, tag.size()  ) != tag ) {
+              if ( ! safe.empty() )
+                safe += "&";
+              safe += val;
+            }
+          });
+          _safeQuerytsr = std::move(safe);
+        }
+        else
+          _safeQuerytsr = std::nullopt;
       }
     private:
       std::string                _fullQuerytsr;        ///<
@@ -207,7 +207,7 @@ namespace zypp
     namespace // anonymous
     {
 
-                       // -------------------------------------------------------------
+                        // -------------------------------------------------------------
       inline void
       checkUrlData(const std::string &data,
                    const std::string &name,
@@ -298,9 +298,9 @@ namespace zypp
                   const std::string &fragment)
     {
       if ( scheme.empty() && *pathdata.c_str() == '/' )
-       setScheme("file");
+        setScheme("file");
       else
-       setScheme(scheme);
+        setScheme(scheme);
 
       setAuthority(authority);
       setPathData(pathdata);
@@ -619,7 +619,7 @@ namespace zypp
 
       if( opts.has(ViewOptions::WITH_QUERY_STR))
       {
-       const std::string & querystr { getQueryString( opts ) };        // full or safe depending on opts
+        const std::string & querystr { getQueryString( opts ) };       // full or safe depending on opts
         if( !querystr.empty() )
         {
           url += "?" + querystr;
index e31ee19..dfa4d3f 100644 (file)
@@ -158,7 +158,7 @@ namespace zypp
        * It causes, that if the fragment string is requested using
        * the WITH_FRAGMENT option, the URL allways contains the "#"
        * fragment string separator, even if the fragment string is
-       * empty. 
+       * empty.
        * This option depends on a enabled WITH_FRAGMENT view
        * option and is disabled by default.
        */
@@ -423,7 +423,7 @@ namespace zypp
        * \endcode
        *
        * \param opts  A combination of view options.
-       * \return A string representation of the Url object. 
+       * \return A string representation of the Url object.
        */
       virtual std::string
       asString(const zypp::url::ViewOptions &opts) const;
@@ -1019,7 +1019,7 @@ namespace zypp
        * It is not required if there is an authority ("//" behind
        * the "scheme:"), that is in the path-abempty rule, but it
        * is used e.g. in ftp url's defined by RFC1738.
-       * 
+       *
        * We apply this operation in both cases (for all paths),
        * but if \p authority is true, the encoding of the second
        * slash depends on the schema configuration (for ftp only).
index 80cf434..bd079a6 100644 (file)
@@ -164,7 +164,7 @@ namespace zypp
     void
     split(ParamVec          &pvec,
           const std::string &pstr,
-               const std::string &psep)
+                const std::string &psep)
     {
       size_t beg, pos, len;
       if( psep.empty())
index 28361bd..3b301f8 100644 (file)
@@ -519,7 +519,7 @@ namespace zyppng {
           _emittedFinalSig = true;
           _sigFinished.emit();
         }
-          
+
       }
 
       template <typename State, typename Transition>
index a8f0e4d..0db39e9 100644 (file)
@@ -9,23 +9,35 @@
 #ifndef ZYPP_NG_CORE_STRING_H_INCLUDED
 #define ZYPP_NG_CORE_STRING_H_INCLUDED
 
+#include <optional>
 #include <zypp-core/base/String.h>
 #include <boost/utility/string_view.hpp>
 
 namespace zyppng {
-using namespace zypp::str;
 
 namespace str {
 
+  using zypp::str::Trim;
+
+  template <typename T>
+  std::optional<T> safe_strtonum ( const std::string_view &val)
+  {
+    errno = 0;
+    const int entryVal = zypp::str::strtonum<T>( val.data() );
+    if ( errno == ERANGE )
+      return {};
+    return entryVal;
+  }
+
   template< typename StrType, typename T = std::remove_reference_t<StrType> >
   T trim( StrType&& s, const Trim trim_r )
   {
     T ret( std::forward<StrType>(s) );
 
-    if ( ret.empty() || trim_r == NO_TRIM )
+    if ( ret.empty() || trim_r == Trim::NO_TRIM )
       return ret;
 
-    if ( trim_r & L_TRIM )
+    if ( trim_r & Trim::L_TRIM )
     {
       typename T::size_type p = ret.find_first_not_of( " \t\r\n" );
       if ( p == T::npos )
@@ -36,7 +48,7 @@ namespace str {
       ret.remove_prefix( p );
     }
 
-    if ( trim_r & R_TRIM )
+    if ( trim_r & Trim::R_TRIM )
     {
       typename T::size_type p = ret.find_last_not_of( " \t\r\n" );
       if ( p == T::npos )
@@ -51,7 +63,7 @@ namespace str {
   }
 
   template<class TOutputIterator>
-  void split( const boost::string_view & line_r, TOutputIterator result_r, const boost::string_view & sepchars_r = " \t", const Trim trim_r = NO_TRIM )
+  void split( const boost::string_view & line_r, TOutputIterator result_r, const boost::string_view & sepchars_r = " \t", const Trim trim_r = Trim::NO_TRIM )
   {
     //skip initial sepchars
     std::string_view::size_type tokenEnd = 0, tokenBegin = line_r.find_first_not_of( sepchars_r );
@@ -76,7 +88,8 @@ namespace str {
   }
 }
 
-
+  // use strerror from zypp::str in zyppng
+  using zypp::str::strerror;
 
 }
 
index d1f2e0f..3bcb1a5 100644 (file)
@@ -4,6 +4,8 @@
 #include <zypp/base/LogControl.h>
 #include <zypp/base/Gettext.h>
 #include <zypp/base/IOTools.h>
+#include <zypp-core/fs/PathInfo.h>
+#include <zypp-core/zyppng/core/String>
 #include <zypp-core/zyppng/base/EventDispatcher>
 #include <zypp-core/zyppng/base/private/linuxhelpers_p.h>
 #include <zypp-core/base/CleanerThread_p.h>
@@ -88,12 +90,37 @@ void zyppng::AbstractDirectSpawnEngine::mapExtraFds ( int controlFd )
     dup2( fd, nextFd );
   }
 
-  // close all filedescriptors above the last we want to keep
-  for ( int i = ::getdtablesize() - 1; i > lastFdToKeep; --i ) {
+  const auto &canCloseFd = [&]( int fd ){
     // controlFD has O_CLOEXEC set so it will be cleaned up :)
-    if ( controlFd != -1 && controlFd == i )
-      continue;
-    ::close( i );
+    if ( controlFd != -1 && controlFd == fd )
+      return false;
+    // make sure we don't close fd's still need
+    if ( fd <= lastFdToKeep )
+      return false;
+    return true;
+  };
+
+  const auto maxFds = ( ::getdtablesize() - 1 );
+  //If the rlimits are too high we need to use a different approach
+  // in detecting how many fds we need to close, or otherwise we are too slow (bsc#1191324)
+  if ( maxFds >= 1024 && zypp::PathInfo( "/proc/self/fd" ).isExist() ) {
+    zypp::filesystem::dirForEachExt( "/proc/self/fd", [&]( const zypp::Pathname &p, const zypp::filesystem::DirEntry &entry ){
+      if ( entry.type != zypp::filesystem::FT_LINK)
+        return true;
+
+      const auto &fdVal = zyppng::str::safe_strtonum<int>( entry.name );
+      if ( !fdVal || !canCloseFd(*fdVal) )
+        return true;
+
+      ::close( *fdVal );
+      return true;
+    });
+  } else {
+    // close all filedescriptors above the last we want to keep
+    for ( int i = maxFds; i > lastFdToKeep; --i ) {
+      if ( !canCloseFd(i) ) continue;
+      ::close( i );
+    }
   }
 }
 
@@ -237,7 +264,7 @@ bool zyppng::ForkSpawnEngine::start( const char * const *argv, int stdin_fd, int
     {
         if( ::chroot(_chroot.c_str()) == -1)
         {
-            _execError = zypp::str::form( _("Can't chroot to '%s' (%s)."), _chroot.c_str(), strerror(errno) );
+            _execError = zypp::str::form( _("Can't chroot to '%s' (%s)."), _chroot.c_str(), strerror(errno).c_str() );
             std::cerr << _execError << std::endl; // After fork log on stderr too
             writeErrAndExit( 128, ChildErrType::CHROOT_FAILED ); // No sense in returning! I am forked away!!
         }
@@ -247,8 +274,8 @@ bool zyppng::ForkSpawnEngine::start( const char * const *argv, int stdin_fd, int
 
     if ( chdirTo && chdir( chdirTo ) == -1 )
     {
-      _execError = _chroot.empty() ? zypp::str::form( _("Can't chdir to '%s' (%s)."), chdirTo, strerror(errno) )
-                                   : zypp::str::form( _("Can't chdir to '%s' inside chroot '%s' (%s)."), chdirTo, _chroot.c_str(), strerror(errno) );
+      _execError = _chroot.empty() ? zypp::str::form( _("Can't chdir to '%s' (%s)."), chdirTo, strerror(errno).c_str() )
+                                   : zypp::str::form( _("Can't chdir to '%s' inside chroot '%s' (%s)."), chdirTo, _chroot.c_str(), strerror(errno).c_str() );
 
       std::cerr << _execError << std::endl;// After fork log on stderr too
       writeErrAndExit( 128, ChildErrType::CHDIR_FAILED ); // No sense in returning! I am forked away!!
@@ -277,14 +304,14 @@ bool zyppng::ForkSpawnEngine::start( const char * const *argv, int stdin_fd, int
 
     execvp( argv[0], const_cast<char *const *>( argv ) );
     // don't want to get here
-    _execError = zypp::str::form( _("Can't exec '%s' (%s)."), _args[0].c_str(), strerror(errno) );
+    _execError = zypp::str::form( _("Can't exec '%s' (%s)."), _args[0].c_str(), strerror(errno).c_str() );
     std::cerr << _execError << std::endl;// After fork log on stderr too
     writeErrAndExit( 129, ChildErrType::EXEC_FAILED ); // No sense in returning! I am forked away!!
     //////////////////////////////////////////////////////////////////////
   }
   else if ( _pid == -1 )        // Fork failed, close everything.
   {
-    _execError = zypp::str::form( _("Can't fork (%s)."), strerror(errno) );
+    _execError = zypp::str::form( _("Can't fork (%s)."), strerror(errno).c_str() );
     _exitStatus = 127;
     ERR << _execError << std::endl;
     return false;
@@ -445,7 +472,7 @@ bool zyppng::GlibSpawnEngine::start( const char * const *argv, int stdin_fd, int
   if ( !error ) {
     _pid = childPid;
   } else {
-    _execError = zypp::str::form( _("Can't fork (%s)."), strerror(errno) );
+    _execError = zypp::str::form( _("Can't fork (%s)."), strerror(errno).c_str() );
     _exitStatus = 127;
     ERR << _execError << std::endl;
     return false;
@@ -466,7 +493,7 @@ void zyppng::GlibSpawnEngine::glibSpawnCallback(void *data)
 
   if ( doChroot ) {
     if ( ::chroot( d->that->_chroot.c_str() ) == -1 ) {
-      execError = zypp::str::form( "Can't chroot to '%s' (%s).", d->that->_chroot.c_str(), strerror(errno) );
+      execError = zypp::str::form( "Can't chroot to '%s' (%s).", d->that->_chroot.c_str(), strerror(errno).c_str() );
       std::cerr << execError << std::endl;// After fork log on stderr too
       _exit (128); // No sense in returning! I am forked away!!
     }
@@ -480,8 +507,8 @@ void zyppng::GlibSpawnEngine::glibSpawnCallback(void *data)
 
     if ( !chdir.empty() && ::chdir( chdir.data() ) == -1 )
     {
-      execError = doChroot ? zypp::str::form( "Can't chdir to '%s' inside chroot '%s' (%s).", chdir.data(), d->that->_chroot.c_str(), strerror(errno) )
-                           : zypp::str::form( "Can't chdir to '%s' (%s).", chdir.data(), strerror(errno) );
+      execError = doChroot ? zypp::str::form( "Can't chdir to '%s' inside chroot '%s' (%s).", chdir.data(), d->that->_chroot.c_str(), strerror(errno).c_str() )
+                           : zypp::str::form( "Can't chdir to '%s' (%s).", chdir.data(), strerror(errno).c_str() );
       std::cerr << execError << std::endl; // After fork log on stderr too
       _exit (128);                          // No sense in returning! I am forked away!!
     }
index 4628747..850091a 100644 (file)
@@ -14,7 +14,7 @@ namespace zyppng {
    * This implements the basic skeleton of ExternalProgram and Process.
    * Taking care of forking the process and setting up stdout and stderr so both
    * implementations can use the same code
-   * 
+   *
    */
   class AbstractSpawnEngine
   {
@@ -48,12 +48,12 @@ namespace zyppng {
 
     /**
      * @returns the pid of the forked process, without checking if the process is
-     *          still running.  
+     *          still running.
      */
     pid_t pid   ( );
 
-    /** 
-     * Kickstart the process, if this returns true it is guaranteed that exec() was successful 
+    /**
+     * Kickstart the process, if this returns true it is guaranteed that exec() was successful
      */
     virtual bool start ( const char *const *argv, int stdin_fd, int stdout_fd, int stderr_fd )  = 0;
 
index fedec03..6ceb752 100644 (file)
@@ -89,7 +89,7 @@ namespace zypp
     int compare( const CompatEntry & rhs ) const
     {
       if ( _idBit.value() != rhs. _idBit.value() )
-       return( _idBit.value() < rhs. _idBit.value() ? -1 : 1 );
+        return( _idBit.value() < rhs. _idBit.value() ? -1 : 1 );
       return _archStr.compare( rhs._archStr ); // Id 1: non builtin
     }
 
@@ -300,7 +300,7 @@ namespace zypp
         // Define the CompatibleWith relation:
         //
         // NOTE: Order of definition is significant! (Arch::compare)
-       //       - define compatible (less) architectures first!
+        //       - define compatible (less) architectures first!
         //
         defCompatibleWith( a_i386(),           a_noarch() );
         defCompatibleWith( a_i486(),           a_noarch(),a_i386() );
@@ -333,10 +333,10 @@ namespace zypp
         defCompatibleWith( a_sparc(),          a_noarch() );
         defCompatibleWith( a_sparcv8(),                a_noarch(),a_sparc() );
         defCompatibleWith( a_sparcv9(),                a_noarch(),a_sparc(),a_sparcv8() );
-       defCompatibleWith( a_sparcv9v(),        a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9() );
-       //
+        defCompatibleWith( a_sparcv9v(),       a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9() );
+        //
         defCompatibleWith( a_sparc64(),                a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9() );
-       defCompatibleWith( a_sparc64v(),        a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9(),a_sparcv9v(),a_sparc64() );
+        defCompatibleWith( a_sparc64v(),       a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9(),a_sparcv9v(),a_sparc64() );
         //
         defCompatibleWith( a_armv3l(),         a_noarch() );
         defCompatibleWith( a_armv4l(),         a_noarch(),a_armv3l() );
@@ -351,10 +351,10 @@ namespace zypp
         defCompatibleWith( a_armv6hl(),                a_noarch() );
         defCompatibleWith( a_armv7hl(),                a_noarch(),a_armv6hl() );
         defCompatibleWith( a_armv7hnl(),       a_noarch(),a_armv7hl(),a_armv6hl() );
-       /*legacy: rpm uses v7hnl */
-       defCompatibleWith( a_armv7nhl(),        a_noarch(),a_armv7hnl(),a_armv7hl(),a_armv6hl() );
+        /*legacy: rpm uses v7hnl */
+        defCompatibleWith( a_armv7nhl(),       a_noarch(),a_armv7hnl(),a_armv7hl(),a_armv6hl() );
 
-       /*?*/defCompatibleWith( a_armv7thl(),   a_noarch(),a_armv7hl() );
+        /*?*/defCompatibleWith( a_armv7thl(),  a_noarch(),a_armv7hl() );
         /*?*/defCompatibleWith( a_armv7tnhl(), a_noarch(),a_armv7hl(),a_armv7nhl(),a_armv7thl() );
 
         defCompatibleWith( a_aarch64(),                a_noarch() );
@@ -368,10 +368,10 @@ namespace zypp
 
         defCompatibleWith( a_m68k(),           a_noarch() );
 
-       defCompatibleWith( a_mips(),            a_noarch() );
-       defCompatibleWith( a_mipsel(),          a_noarch() );
-       defCompatibleWith( a_mips64(),          a_noarch() );
-       defCompatibleWith( a_mips64el(),        a_noarch() );
+        defCompatibleWith( a_mips(),           a_noarch() );
+        defCompatibleWith( a_mipsel(),         a_noarch() );
+        defCompatibleWith( a_mips64(),         a_noarch() );
+        defCompatibleWith( a_mips64el(),       a_noarch() );
         //
         ///////////////////////////////////////////////////////////////////
         // dumpOn( USR ) << endl;
index 634d22e..8b13cf6 100644 (file)
@@ -167,8 +167,8 @@ namespace zypp
     template<class TReport>
       struct ReceiveReport : public TReport
       {
-       typedef TReport                   ReportType;
-       typedef ReceiveReport<TReport>    Receiver;
+        typedef TReport                   ReportType;
+        typedef ReceiveReport<TReport>    Receiver;
         typedef DistributeReport<TReport> Distributor;
 
         virtual ~ReceiveReport()
@@ -197,9 +197,9 @@ namespace zypp
       struct DistributeReport
       {
        public:
-       typedef TReport                   ReportType;
-       typedef ReceiveReport<TReport>    Receiver;
-       typedef DistributeReport<TReport> Distributor;
+        typedef TReport                   ReportType;
+        typedef ReceiveReport<TReport>    Receiver;
+        typedef DistributeReport<TReport> Distributor;
 
          static DistributeReport & instance()
          {
@@ -235,7 +235,7 @@ namespace zypp
     template<class TReport>
       struct SendReport : private zypp::base::NonCopyable
       {
-       typedef TReport                   ReportType;
+        typedef TReport                   ReportType;
         typedef ReceiveReport<TReport>    Receiver;
         typedef DistributeReport<TReport> Distributor;
 
@@ -283,7 +283,7 @@ namespace zypp
     template<class TReport>
       struct TempConnect
       {
-       typedef TReport                   ReportType;
+        typedef TReport                   ReportType;
         typedef ReceiveReport<TReport>    Receiver;
         typedef DistributeReport<TReport> Distributor;
 
index f45c62a..3338942 100644 (file)
@@ -176,7 +176,7 @@ namespace zypp
   {
     for ( const Capability & rhs : *this )
       if ( lhs == rhs )
-       return true;
+        return true;
     return false;
   }
 
@@ -184,7 +184,7 @@ namespace zypp
   {
     for ( const Capability & rhs : *this )
       if ( lhs.matches( rhs ) == CapMatch::yes )
-       return true;
+        return true;
     return false;
   }
   /////////////////////////////////////////////////////////////////
index 7e34c0c..fdc309b 100644 (file)
@@ -396,8 +396,8 @@ namespace zypp
       // require name part matching a pool items name (not just provides!)
       if ( pool.byIdentBegin( detail.name() ) != pool.byIdentEnd( detail.name() ) )
       {
-       rewrote_r = true;
-       return guesscap;
+        rewrote_r = true;
+        return guesscap;
       }
 
       // try the one but last '-'
@@ -413,10 +413,10 @@ namespace zypp
 
           // require name part matching a pool items name (not just provides!)
           if ( pool.byIdentBegin( detail.name() ) != pool.byIdentEnd( detail.name() ) )
-         {
-           rewrote_r = true;
-           return guesscap;
-         }
+          {
+            rewrote_r = true;
+            return guesscap;
+          }
         }
       }
     }
index e5ead94..5f35e03 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
 
   /** \relates ChangelogEntry */
   std::ostream & operator<<( std::ostream & out, const ChangelogEntry & obj )
-  { 
+  {
     out << obj.date() << " " << obj.author() << endl << obj.text() << endl;
     return out;
   }
index eaf99c6..53ede3b 100644 (file)
@@ -41,8 +41,8 @@ namespace zypp
       std::string::size_type pos = type_r.find( "/" );
       if ( pos != std::string::npos )
       {
-       testAndSet( _subtype, type_r.substr( pos+1 ) );
-       type_r.erase( pos );
+        testAndSet( _subtype, type_r.substr( pos+1 ) );
+        type_r.erase( pos );
       }
       testAndSet( _type, std::move(type_r) );
     }
@@ -100,7 +100,7 @@ namespace zypp
     void testAndSet( std::string & var_r, std::string val_r )
     {
       if ( val_r.find_first_of( "/ \t\r\n" ) != std::string::npos )
-       throw std::invalid_argument( "ContentType: illegal char in '" + val_r + "'" );
+        throw std::invalid_argument( "ContentType: illegal char in '" + val_r + "'" );
       var_r = std::move(val_r);
     }
   private:
index 407f0ba..336eef6 100644 (file)
@@ -33,26 +33,26 @@ namespace zypp
       /** The singleton */
       static CodeMaps & instance()
       {
-       static CodeMaps _instance;
-       return _instance;
+        static CodeMaps _instance;
+        return _instance;
       }
 
       /** Lookup (translated) name for \a index_r.*/
       std::string name( IdString index_r )
       {
-       Link link( getIndex( index_r ) );
-
-       std::string ret;
-       if ( link->second )
-       { ret = _(link->second); }
-       else
-       {
-         ret = _("Unknown country: ");
-         ret += "'";
-         ret += index_r.c_str();
-         ret += "'";
-       }
-       return ret;
+        Link link( getIndex( index_r ) );
+
+        std::string ret;
+        if ( link->second )
+        { ret = _(link->second); }
+        else
+        {
+          ret = _("Unknown country: ");
+          ret += "'";
+          ret += index_r.c_str();
+          ret += "'";
+        }
+        return ret;
       }
 
     private:
@@ -69,39 +69,39 @@ namespace zypp
       /** Return \ref Link for \a index_r, creating it if necessary. */
       Link getIndex( IdString index_r )
       {
-       auto it = _indexMap.find( index_r );
-       return( it != _indexMap.end()
-             ? it->second
-             : newIndex( index_r, index_r.asString() ) );
+        auto it = _indexMap.find( index_r );
+        return( it != _indexMap.end()
+              ? it->second
+              : newIndex( index_r, index_r.asString() ) );
       }
 
       /** Return the CodeMap Index for \a code_r. */
       Link newIndex( IdString index_r, const std::string & code_r )
       {
-       Link link = _codeMap.find( code_r );
-       if ( link != _codeMap.end() )
-         return (_indexMap[index_r] = link);
-
-       // not found: Remember a new code
-       CodeMap::value_type nval( code_r, nullptr );
-
-       if ( code_r.size() != 2 )
-         WAR << "Malformed CountryCode '" << code_r << "' (expect 2-letter)" << endl;
-
-       std::string ucode( str::toUpper( code_r ) );
-       if ( ucode != code_r )
-       {
-         WAR << "Malformed CountryCode '" << code_r << "' (not upper case)" << endl;
-         // but maybe we're lucky with the lower case code
-         // and find a language name.
-         link = _codeMap.find( ucode );
-         if ( link != _codeMap.end() )
-         {
-           nval.second = link->second;
-         }
-       }
-       MIL << "Remember CountryCode '" << code_r << "': '" << (nval.second?nval.second:"Unknown country") << "'" << endl;
-       return (_indexMap[index_r] = _codeMap.insert( nval ).first);
+        Link link = _codeMap.find( code_r );
+        if ( link != _codeMap.end() )
+          return (_indexMap[index_r] = link);
+
+        // not found: Remember a new code
+        CodeMap::value_type nval( code_r, nullptr );
+
+        if ( code_r.size() != 2 )
+          WAR << "Malformed CountryCode '" << code_r << "' (expect 2-letter)" << endl;
+
+        std::string ucode( str::toUpper( code_r ) );
+        if ( ucode != code_r )
+        {
+          WAR << "Malformed CountryCode '" << code_r << "' (not upper case)" << endl;
+          // but maybe we're lucky with the lower case code
+          // and find a language name.
+          link = _codeMap.find( ucode );
+          if ( link != _codeMap.end() )
+          {
+            nval.second = link->second;
+          }
+        }
+        MIL << "Remember CountryCode '" << code_r << "': '" << (nval.second?nval.second:"Unknown country") << "'" << endl;
+        return (_indexMap[index_r] = _codeMap.insert( nval ).first);
       }
 
     private:
@@ -150,8 +150,8 @@ namespace zypp
 
       struct Init
       {
-         const char *iso3166;
-         const char *name;
+          const char *iso3166;
+          const char *name;
       };
 
       const Init init[] = {
@@ -402,11 +402,11 @@ namespace zypp
           {"ZM", N_( "Zambia" ) },                             // :ZMB:894:
           {"ZW", N_( "Zimbabwe" ) },                           // :ZWE:716:
 
-         { NULL, NULL }
+          { NULL, NULL }
       };
 
       for (const Init * i = init; i->iso3166 != NULL; ++i)
-         _codeMap[i->iso3166] = i->name;
+          _codeMap[i->iso3166] = i->name;
     }
 
     /////////////////////////////////////////////////////////////////
index 9a45918..260ee59 100644 (file)
@@ -44,11 +44,11 @@ namespace zypp
     inline int heDecodeCh( char ch )
     {
       if ( '0' <= ch && ch <= '9' )
-       return( ch - '0' );
+        return( ch - '0' );
       if ( 'A' <= ch && ch <= 'F' )
-       return( ch - 'A' + 10 );
+        return( ch - 'A' + 10 );
       if ( 'a' <= ch && ch <= 'f' )
-       return( ch - 'a' + 10 );
+        return( ch - 'a' + 10 );
       return -1;
     }
 
@@ -102,7 +102,7 @@ namespace zypp
       ret << "cpe:2.3";
       for ( auto ai : WFN_ATTRIBUTES )
       {
-       ret << ':' << _wfn[ai].asFs();
+        ret << ':' << _wfn[ai].asFs();
       }
       return ret;
     }
@@ -115,37 +115,37 @@ namespace zypp
       unsigned colon = 0;      // to remember trailing colons
       for ( auto ai : WFN_ATTRIBUTES )
       {
-       val = _wfn[ai].asUri();
-
-       if ( ai == Attribute::edition )
-       {
-         if ( ! ( _wfn[Attribute::sw_edition].isANY()
-               && _wfn[Attribute::target_sw].isANY()
-               && _wfn[Attribute::target_hw].isANY()
-               && _wfn[Attribute::other].isANY() ) )
-         {
-           // packing is needed
-           val = str::Str()
-                 << '~' << val//Attribute::edition
-                 << '~' << _wfn[Attribute::sw_edition].asUri()
-                 << '~' << _wfn[Attribute::target_sw].asUri()
-                 << '~' << _wfn[Attribute::target_hw].asUri()
-                 << '~' << _wfn[Attribute::other].asUri();
-         }
-       }
-
-       if ( ! val.empty() )
-       {
-         if ( colon )
-           ret << std::string( colon, ':' );
-         ret << val;
-         colon = 1;
-       }
-       else
-         ++colon;
-
-       if ( ai == Attribute::language )
-         break;        // remaining attrs packaed in edition
+        val = _wfn[ai].asUri();
+
+        if ( ai == Attribute::edition )
+        {
+          if ( ! ( _wfn[Attribute::sw_edition].isANY()
+                && _wfn[Attribute::target_sw].isANY()
+                && _wfn[Attribute::target_hw].isANY()
+                && _wfn[Attribute::other].isANY() ) )
+          {
+            // packing is needed
+            val = str::Str()
+                  << '~' << val//Attribute::edition
+                  << '~' << _wfn[Attribute::sw_edition].asUri()
+                  << '~' << _wfn[Attribute::target_sw].asUri()
+                  << '~' << _wfn[Attribute::target_hw].asUri()
+                  << '~' << _wfn[Attribute::other].asUri();
+          }
+        }
+
+        if ( ! val.empty() )
+        {
+          if ( colon )
+            ret << std::string( colon, ':' );
+          ret << val;
+          colon = 1;
+        }
+        else
+          ++colon;
+
+        if ( ai == Attribute::language )
+          break;       // remaining attrs packaed in edition
       }
       return ret;
     }
@@ -156,16 +156,16 @@ namespace zypp
       ret << "wfn:[";
       for ( auto ai : WFN_ATTRIBUTES )
       {
-       const Value & val( _wfn[ai] );
-       if ( ! val.isANY() )
-       {
-         if ( ai ) ret << ',';
-         ret << Attribute::asString( ai ) << '=';
-         if ( val.isString() )
-           ret << '"' << val << '"';
-         else
-           ret << "NA";        // as ANY is omitted, it must be NA
-       }
+        const Value & val( _wfn[ai] );
+        if ( ! val.isANY() )
+        {
+          if ( ai ) ret << ',';
+          ret << Attribute::asString( ai ) << '=';
+          if ( val.isString() )
+            ret << '"' << val << '"';
+          else
+            ret << "NA";       // as ANY is omitted, it must be NA
+        }
       }
       return ret << "]";
     }
@@ -176,35 +176,35 @@ namespace zypp
       SetCompare ret = SetCompare::equal;
       for ( auto ai : WFN_ATTRIBUTES )
       {
-       switch ( _wfn[ai].compare( trg._wfn[ai] ).asEnum() )
-       {
-         case SetCompare::uncomparable:
-           ret = SetCompare::uncomparable;
-           break;
-
-         case SetCompare::equal:
-           break;
-
-         case SetCompare::properSubset:
-           if ( ret == SetCompare::equal )
-             ret = SetCompare::properSubset;
-           else if ( ret != SetCompare::properSubset )
-             ret = SetCompare::uncomparable;
-           break;
-
-         case SetCompare::properSuperset:
-           if ( ret == SetCompare::equal )
-             ret = SetCompare::properSuperset;
-           else if ( ret != SetCompare::properSuperset )
-             ret = SetCompare::uncomparable;
-           break;
-
-         case SetCompare::disjoint:
-           ret = SetCompare::disjoint;
-           break;
-       }
-       if ( ret == SetCompare::uncomparable || ret == SetCompare::disjoint )
-         break;
+        switch ( _wfn[ai].compare( trg._wfn[ai] ).asEnum() )
+        {
+          case SetCompare::uncomparable:
+            ret = SetCompare::uncomparable;
+            break;
+
+          case SetCompare::equal:
+            break;
+
+          case SetCompare::properSubset:
+            if ( ret == SetCompare::equal )
+              ret = SetCompare::properSubset;
+            else if ( ret != SetCompare::properSubset )
+              ret = SetCompare::uncomparable;
+            break;
+
+          case SetCompare::properSuperset:
+            if ( ret == SetCompare::equal )
+              ret = SetCompare::properSuperset;
+            else if ( ret != SetCompare::properSuperset )
+              ret = SetCompare::uncomparable;
+            break;
+
+          case SetCompare::disjoint:
+            ret = SetCompare::disjoint;
+            break;
+        }
+        if ( ret == SetCompare::uncomparable || ret == SetCompare::disjoint )
+          break;
       }
       return ret;
     }
@@ -217,51 +217,51 @@ namespace zypp
     {
       if ( val_r.isString() )
       {
-       switch ( attr_r.asEnum() )
-       {
-         case Attribute::part:
-           {
-             const std::string & wfn( val_r.asWfn() );
-             switch ( wfn[0] )
-             {
-               case 'h':
-               case 'o':
-               case 'a':
-                 if ( wfn[1] == '\0' )
-                   break;
-                 // else: fallthrough
-               default:
-                 throw std::invalid_argument( str::Str() << "CpeId:Wfn:part: '" << wfn << "' illegal value; expected: 'h' | 'o' | 'a'"   );
-                 break;
-             }
-           }
-           break;
-
-         case Attribute::language:
-           {
-             const std::string & wfn( val_r.asWfn() );
-             std::string::size_type len = 0;
-             // (2*3ALPHA) ["-" (2ALPHA / 3DIGIT)]
-             if ( chIsAlpha( wfn[0] ) && chIsAlpha( wfn[1] ) )
-             {
-               len = chIsAlpha( wfn[2] ) ? 3 : 2;
-               if ( wfn[len] == '-' )
-               {
-                 if ( chIsAlpha( wfn[len+1] ) && chIsAlpha( wfn[len+2] ) )
-                   len += 3;
-                 else if ( chIsNum( wfn[len+1] ) && chIsNum( wfn[len+2] ) && chIsNum( wfn[len+3] ) )
-                   len += 4;
-               }
-             }
-             if ( wfn.size() != len )
-               throw std::invalid_argument( str::Str() << "CpeId:Wfn:language: '" << wfn << "' illegal value; expected RFC5646 conform: language ['-' region]" );
-           }
-           break;
-
-         default:
-           // no contraints
-           break;
-       }
+        switch ( attr_r.asEnum() )
+        {
+          case Attribute::part:
+            {
+              const std::string & wfn( val_r.asWfn() );
+              switch ( wfn[0] )
+              {
+                case 'h':
+                case 'o':
+                case 'a':
+                  if ( wfn[1] == '\0' )
+                    break;
+                  // else: fallthrough
+                default:
+                  throw std::invalid_argument( str::Str() << "CpeId:Wfn:part: '" << wfn << "' illegal value; expected: 'h' | 'o' | 'a'"   );
+                  break;
+              }
+            }
+            break;
+
+          case Attribute::language:
+            {
+              const std::string & wfn( val_r.asWfn() );
+              std::string::size_type len = 0;
+              // (2*3ALPHA) ["-" (2ALPHA / 3DIGIT)]
+              if ( chIsAlpha( wfn[0] ) && chIsAlpha( wfn[1] ) )
+              {
+                len = chIsAlpha( wfn[2] ) ? 3 : 2;
+                if ( wfn[len] == '-' )
+                {
+                  if ( chIsAlpha( wfn[len+1] ) && chIsAlpha( wfn[len+2] ) )
+                    len += 3;
+                  else if ( chIsNum( wfn[len+1] ) && chIsNum( wfn[len+2] ) && chIsNum( wfn[len+3] ) )
+                    len += 4;
+                }
+              }
+              if ( wfn.size() != len )
+                throw std::invalid_argument( str::Str() << "CpeId:Wfn:language: '" << wfn << "' illegal value; expected RFC5646 conform: language ['-' region]" );
+            }
+            break;
+
+          default:
+            // no contraints
+            break;
+        }
       }
       wfn_r[attr_r.asIntegral()] = val_r;
     }
@@ -296,17 +296,17 @@ namespace zypp
     {
       if ( cpe_r[4] == '/' )
       {
-       ret = unbindUri( cpe_r );
+        ret = unbindUri( cpe_r );
       }
       else if ( cpe_r[4] == '2'
-            && cpe_r[5] == '.'
-            && cpe_r[6] == '3'
-            && cpe_r[7] == ':' )
+             && cpe_r[5] == '.'
+             && cpe_r[6] == '3'
+             && cpe_r[7] == ':' )
       {
-       ret = unbindFs( cpe_r );
+        ret = unbindFs( cpe_r );
       }
       else
-       throw std::invalid_argument( "CpeId: bad magic; expected: 'cpe:2.3:' | 'cpe:/'" );
+        throw std::invalid_argument( "CpeId: bad magic; expected: 'cpe:2.3:' | 'cpe:/'" );
     }
     else if ( cpe_r[0] != '\0' )
       throw std::invalid_argument( "CpeId: bad magic; expected: 'cpe:2.3:' | 'cpe:/'" );
@@ -328,19 +328,19 @@ namespace zypp
     {
       if ( ai == Attribute::edition && field[ai][0] == '~' )
       {
-       // unpacking is needed
-       static constexpr unsigned numPacks = 6u;        // dummy_before_~ + edition + 4 extended attributes
-       std::vector<std::string> pack;
-       pack.reserve( numPacks );
-       if ( str::splitFields( field[ai], std::back_inserter(pack), "~" ) > numPacks )
-         throw std::invalid_argument( str::Str() << "CpeId:Uri:edition: too many packs (" << pack.size() << "); expected " << numPacks );
-       pack.resize( numPacks );        // fillup with ANY(""), should be noOP
-
-       pack[1].swap( field[Attribute::edition] );
-       pack[2].swap( field[Attribute::sw_edition] );
-       pack[3].swap( field[Attribute::target_sw] );
-       pack[4].swap( field[Attribute::target_hw] );
-       pack[5].swap( field[Attribute::other] );
+        // unpacking is needed
+        static constexpr unsigned numPacks = 6u;       // dummy_before_~ + edition + 4 extended attributes
+        std::vector<std::string> pack;
+        pack.reserve( numPacks );
+        if ( str::splitFields( field[ai], std::back_inserter(pack), "~" ) > numPacks )
+          throw std::invalid_argument( str::Str() << "CpeId:Uri:edition: too many packs (" << pack.size() << "); expected " << numPacks );
+        pack.resize( numPacks );       // fillup with ANY(""), should be noOP
+
+        pack[1].swap( field[Attribute::edition] );
+        pack[2].swap( field[Attribute::sw_edition] );
+        pack[3].swap( field[Attribute::target_sw] );
+        pack[4].swap( field[Attribute::target_hw] );
+        pack[5].swap( field[Attribute::other] );
       }
       assignAttr( ret, ai, Value( field[ai], Value::uriFormat ) );
     }
@@ -452,56 +452,56 @@ namespace zypp
     if ( value_r.empty() )     // NA
     {
       if ( ! CpeId::Value::NA._value ) // initialized by this ctor!
-       _value.reset( new std::string );
+        _value.reset( new std::string );
       else
-       _value = CpeId::Value::NA._value;
+        _value = CpeId::Value::NA._value;
     }
     else if ( value_r != "*" ) // ANY is default constructed
     {
       bool starting = true;    // false after the 1st non-?
       for_( chp, value_r.begin(), value_r.end() )
       {
-       switch ( *chp )
-       {
-         case '\\':    // quoted
-           ++chp;
-           if ( ! chIsValidRange( *chp )  )
-           {
-             if ( *chp )
-               throw std::invalid_argument( str::Str() << "CpeId:Wfn: illegal quoted character '\\" << reinterpret_cast<void*>(*chp) << "'" );
-             else
-               throw std::invalid_argument( "CpeId:Wfn: Backslash escapes nothing" );
-           }
-           else if ( chIsWfnUnescaped( *chp ) )
-             throw std::invalid_argument( str::Str() << "CpeId:Wfn: unnecessarily quoted character '\\" << *chp << "'" );
-           else if ( starting && *chp == '-' && chp+1 == value_r.end() )
-             throw std::invalid_argument( str::Str() << "CpeId:Wfn: '\\-' is illegal value" );
-           break;
-
-         case '?':     // sequence at beginning or end of string
-           while ( *(chp+1) == '?' )
-             ++chp;
-           if ( ! ( starting || chp+1 == value_r.end() ) )
-             throw std::invalid_argument( "CpeId:Wfn: embedded ?" );
-           break;
-
-         case '*':     // single at beginning or end of string
-           if ( ! ( starting || chp+1 == value_r.end() ) )
-             throw std::invalid_argument( "CpeId:Wfn: embedded *" );
-           break;
-
-         default:      // everything else unquoted
-           if ( ! chIsWfnUnescaped( *chp ) )
-           {
-             if ( chIsValidRange( *chp ) )
-               throw std::invalid_argument( str::Str() << "CpeId:Wfn: missing quote before '" << *chp << "'" );
-             else
-               throw std::invalid_argument( str::Str() << "CpeId:Wfn: illegal character '" << reinterpret_cast<void*>(*chp) << "'" );
-           }
-           break;
-       }
-       if ( starting )
-         starting = false;
+        switch ( *chp )
+        {
+          case '\\':   // quoted
+            ++chp;
+            if ( ! chIsValidRange( *chp )  )
+            {
+              if ( *chp )
+                throw std::invalid_argument( str::Str() << "CpeId:Wfn: illegal quoted character '\\" << reinterpret_cast<void*>(*chp) << "'" );
+              else
+                throw std::invalid_argument( "CpeId:Wfn: Backslash escapes nothing" );
+            }
+            else if ( chIsWfnUnescaped( *chp ) )
+              throw std::invalid_argument( str::Str() << "CpeId:Wfn: unnecessarily quoted character '\\" << *chp << "'" );
+            else if ( starting && *chp == '-' && chp+1 == value_r.end() )
+              throw std::invalid_argument( str::Str() << "CpeId:Wfn: '\\-' is illegal value" );
+            break;
+
+          case '?':    // sequence at beginning or end of string
+            while ( *(chp+1) == '?' )
+              ++chp;
+            if ( ! ( starting || chp+1 == value_r.end() ) )
+              throw std::invalid_argument( "CpeId:Wfn: embedded ?" );
+            break;
+
+          case '*':    // single at beginning or end of string
+            if ( ! ( starting || chp+1 == value_r.end() ) )
+              throw std::invalid_argument( "CpeId:Wfn: embedded *" );
+            break;
+
+          default:     // everything else unquoted
+            if ( ! chIsWfnUnescaped( *chp ) )
+            {
+              if ( chIsValidRange( *chp ) )
+                throw std::invalid_argument( str::Str() << "CpeId:Wfn: missing quote before '" << *chp << "'" );
+              else
+                throw std::invalid_argument( str::Str() << "CpeId:Wfn: illegal character '" << reinterpret_cast<void*>(*chp) << "'" );
+            }
+            break;
+        }
+        if ( starting )
+          starting = false;
       }
       _value.reset( new std::string( value_r ) );
     }
@@ -513,61 +513,61 @@ namespace zypp
     {
       if ( encoded_r == "-" )  // NA
       {
-       _value = CpeId::Value::NA._value;
+        _value = CpeId::Value::NA._value;
       }
       else
       {
-       str::Str result;
-       bool starting = true;   // false after the 1st non-?
-       for_( chp, encoded_r.begin(), encoded_r.end() )
-       {
-         switch ( *chp )
-         {
-           case '\\':  // may stay quoted
-             ++chp;
-             if ( chIsWfnUnescaped( *chp ) )
-               result << *chp;
-             else if ( chIsValidRange( *chp ) )
-               result << '\\' << *chp;
-             else if ( *chp )
-               throw std::invalid_argument( str::Str() << "CpeId:Fs: illegal quoted character '\\" << *chp << "'" );
-             else
-               throw std::invalid_argument( "CpeId:Fs: Backslash escapes nothing" );
-             break;
-
-           case '?':   // sequence at beginning or end of string
-             result << '?';
-             while ( *(chp+1) == '?' )
-             {
-               ++chp;
-               result << '?';
-             }
-             if ( ! ( starting || chp+1 == encoded_r.end() ) )
-               throw std::invalid_argument( "CpeId:Fs: embedded ?" );
-             break;
-
-           case '*':   // single at beginning or end of string
-             if ( starting || chp+1 == encoded_r.end() )
-               result << '*';
-             else
-               throw std::invalid_argument( "CpeId:Fs: embedded *" );
-             break;
-
-           default:
-             if ( chIsWfnUnescaped( *chp ) )
-               result << *chp;
-             else if ( chIsValidRange( *chp ) )
-               result << '\\' << *chp;
-             else
-               throw std::invalid_argument( str::Str() << "CpeId:Fs: illegal character '" << reinterpret_cast<void*>(*chp) << "'" );
-             break;
-         }
-         if ( starting )
-           starting = false;
-       }
-       if ( starting )
-         throw std::invalid_argument( "CpeId:Fs: '' value is illegal" );
-       _value.reset( new std::string( result ) );
+        str::Str result;
+        bool starting = true;  // false after the 1st non-?
+        for_( chp, encoded_r.begin(), encoded_r.end() )
+        {
+          switch ( *chp )
+          {
+            case '\\': // may stay quoted
+              ++chp;
+              if ( chIsWfnUnescaped( *chp ) )
+                result << *chp;
+              else if ( chIsValidRange( *chp ) )
+                result << '\\' << *chp;
+              else if ( *chp )
+                throw std::invalid_argument( str::Str() << "CpeId:Fs: illegal quoted character '\\" << *chp << "'" );
+              else
+                throw std::invalid_argument( "CpeId:Fs: Backslash escapes nothing" );
+              break;
+
+            case '?':  // sequence at beginning or end of string
+              result << '?';
+              while ( *(chp+1) == '?' )
+              {
+                ++chp;
+                result << '?';
+              }
+              if ( ! ( starting || chp+1 == encoded_r.end() ) )
+                throw std::invalid_argument( "CpeId:Fs: embedded ?" );
+              break;
+
+            case '*':  // single at beginning or end of string
+              if ( starting || chp+1 == encoded_r.end() )
+                result << '*';
+              else
+                throw std::invalid_argument( "CpeId:Fs: embedded *" );
+              break;
+
+            default:
+              if ( chIsWfnUnescaped( *chp ) )
+                result << *chp;
+              else if ( chIsValidRange( *chp ) )
+                result << '\\' << *chp;
+              else
+                throw std::invalid_argument( str::Str() << "CpeId:Fs: illegal character '" << reinterpret_cast<void*>(*chp) << "'" );
+              break;
+          }
+          if ( starting )
+            starting = false;
+        }
+        if ( starting )
+          throw std::invalid_argument( "CpeId:Fs: '' value is illegal" );
+        _value.reset( new std::string( result ) );
       }
     }
   }
@@ -578,73 +578,73 @@ namespace zypp
     {
       if ( encoded_r == "-" )  // NA
       {
-       _value = CpeId::Value::NA._value;
+        _value = CpeId::Value::NA._value;
       }
       else
       {
-       str::Str result;
-       bool starting = true;   // false after the 1st non-? (%01)
-       for_( chp, encoded_r.begin(), encoded_r.end() )
-       {
-         char ch = *chp;
-
-         if ( ch == '%' )      // legal '%xx' sequence first
-         {
-           int d1 = heDecodeCh( *(chp+1) );
-           if ( d1 != -1 )
-           {
-             int d2 = heDecodeCh( *(chp+2) );
-             if ( d2 != -1 )
-             {
-               chp += 2;       // skip sequence
-               if ( d1 == 0 )
-               {
-                 if ( d2 == 1 )        // %01 - ? valid sequence at begin or end
-                 {
-                   result << '?';
-                   while ( *(chp+1) == '%' && *(chp+2) == '0' && *(chp+3) == '1' )
-                   {
-                     chp += 3;
-                     result << '?';
-                   }
-                   if ( starting || chp+1 == encoded_r.end() )
-                   {
-                     starting = false;
-                     continue; // -> continue;
-                   }
-                   else
-                     throw std::invalid_argument( "CpeId:Uri: embedded %01" );
-                 }
-                 else if ( d2 == 2 )   // %02 - * valid at begin or end
-                 {
-                   if ( starting || chp+1 == encoded_r.end() )
-                   {
-                     result << '*';
-                     starting = false;
-                     continue; // -> continue;
-                   }
-                   else
-                     throw std::invalid_argument( "CpeId:Uri: embedded %02" );
-                 }
-               }
-               ch = (d1<<4)|d2;
-               if ( ! chIsValidRange( ch ) )
-                 throw std::invalid_argument( str::Str() << "CpeId:Uri: illegal % encoded character '" << reinterpret_cast<void*>(ch) << "'" );
-             }
-           }
-         }
-         else if ( ! chIsValidRange( ch ) )
-           throw std::invalid_argument( str::Str() << "CpeId:Uri: illegal character '" << reinterpret_cast<void*>(ch) << "'" );
-
-         if ( chIsWfnUnescaped( ch ) )
-           result << ch;
-         else
-           result << '\\' << ch;
-
-         if ( starting )
-           starting = false;
-       }
-       _value.reset( new std::string( result ) );
+        str::Str result;
+        bool starting = true;  // false after the 1st non-? (%01)
+        for_( chp, encoded_r.begin(), encoded_r.end() )
+        {
+          char ch = *chp;
+
+          if ( ch == '%' )     // legal '%xx' sequence first
+          {
+            int d1 = heDecodeCh( *(chp+1) );
+            if ( d1 != -1 )
+            {
+              int d2 = heDecodeCh( *(chp+2) );
+              if ( d2 != -1 )
+              {
+                chp += 2;      // skip sequence
+                if ( d1 == 0 )
+                {
+                  if ( d2 == 1 )       // %01 - ? valid sequence at begin or end
+                  {
+                    result << '?';
+                    while ( *(chp+1) == '%' && *(chp+2) == '0' && *(chp+3) == '1' )
+                    {
+                      chp += 3;
+                      result << '?';
+                    }
+                    if ( starting || chp+1 == encoded_r.end() )
+                    {
+                      starting = false;
+                      continue;        // -> continue;
+                    }
+                    else
+                      throw std::invalid_argument( "CpeId:Uri: embedded %01" );
+                  }
+                  else if ( d2 == 2 )  // %02 - * valid at begin or end
+                  {
+                    if ( starting || chp+1 == encoded_r.end() )
+                    {
+                      result << '*';
+                      starting = false;
+                      continue;        // -> continue;
+                    }
+                    else
+                      throw std::invalid_argument( "CpeId:Uri: embedded %02" );
+                  }
+                }
+                ch = (d1<<4)|d2;
+                if ( ! chIsValidRange( ch ) )
+                  throw std::invalid_argument( str::Str() << "CpeId:Uri: illegal % encoded character '" << reinterpret_cast<void*>(ch) << "'" );
+              }
+            }
+          }
+          else if ( ! chIsValidRange( ch ) )
+            throw std::invalid_argument( str::Str() << "CpeId:Uri: illegal character '" << reinterpret_cast<void*>(ch) << "'" );
+
+          if ( chIsWfnUnescaped( ch ) )
+            result << ch;
+          else
+            result << '\\' << ch;
+
+          if ( starting )
+            starting = false;
+        }
+        _value.reset( new std::string( result ) );
       }
     }
   }
@@ -680,28 +680,28 @@ namespace zypp
       str::Str result;
       for_( chp, _value->begin(), _value->end() )
       {
-       if ( *chp != '\\' )
-         result << *chp;
-       else
-       {
-         ++chp;
-         switch ( *chp )
-         {
-           case '-':
-           case '.':
-           case '_':
-             result << *chp;   // without escaping
-             break;
-
-           case '\0':
-             throw std::invalid_argument( "CpeId:Wfn: Backslash escapes nothing" );
-             break;
-
-           default:
-             result << '\\' << *chp;
-             break;
-         }
-       }
+        if ( *chp != '\\' )
+          result << *chp;
+        else
+        {
+          ++chp;
+          switch ( *chp )
+          {
+            case '-':
+            case '.':
+            case '_':
+              result << *chp;  // without escaping
+              break;
+
+            case '\0':
+              throw std::invalid_argument( "CpeId:Wfn: Backslash escapes nothing" );
+              break;
+
+            default:
+              result << '\\' << *chp;
+              break;
+          }
+        }
       }
       ret = result;
     }
@@ -715,57 +715,57 @@ namespace zypp
     {
       if ( isNA() )
       {
-       static const std::string dash( "-" );
-       ret = dash;
+        static const std::string dash( "-" );
+        ret = dash;
       }
       else
       {
-       str::Str result;
-       for_( chp, _value->begin(), _value->end() )
-       {
-         if ( chIsWfnUnescaped( *chp ) )
-         {
-           result << *chp;
-         }
-         else
-         {
-           static const char *const hdig = "0123456789abcdef";
-           switch ( *chp )
-           {
-             case '\\':
-               ++chp;
-               switch ( *chp )
-               {
-                 case '-':
-                 case '.':
-                   result << *chp;     // without encodeing
-                   break;
-
-                 case '\0':
-                   throw std::invalid_argument( "CpeId:Wfn: Backslash escapes nothing" );
-                   break;
-
-                 default:
-                   result << '%' << hdig[(unsigned char)(*chp)/16] << hdig[(unsigned char)(*chp)%16];
-                   break;
-               }
-               break;
-
-             case '?':
-               result << "%01";
-               break;
-
-             case '*':
-               result << "%02";
-               break;
-
-             default:
-               throw std::invalid_argument( str::Str() << "CpeId:Wfn: illegal char '" << *chp << "' in WFN" );
-               break;
-           }
-         }
-       }
-       ret = result;
+        str::Str result;
+        for_( chp, _value->begin(), _value->end() )
+        {
+          if ( chIsWfnUnescaped( *chp ) )
+          {
+            result << *chp;
+          }
+          else
+          {
+            static const char *const hdig = "0123456789abcdef";
+            switch ( *chp )
+            {
+              case '\\':
+                ++chp;
+                switch ( *chp )
+                {
+                  case '-':
+                  case '.':
+                    result << *chp;    // without encodeing
+                    break;
+
+                  case '\0':
+                    throw std::invalid_argument( "CpeId:Wfn: Backslash escapes nothing" );
+                    break;
+
+                  default:
+                    result << '%' << hdig[(unsigned char)(*chp)/16] << hdig[(unsigned char)(*chp)%16];
+                    break;
+                }
+                break;
+
+              case '?':
+                result << "%01";
+                break;
+
+              case '*':
+                result << "%02";
+                break;
+
+              default:
+                throw std::invalid_argument( str::Str() << "CpeId:Wfn: illegal char '" << *chp << "' in WFN" );
+                break;
+            }
+          }
+        }
+        ret = result;
       }
     }
     return ret;
@@ -786,10 +786,10 @@ namespace zypp
       unsigned backslashes = 0;
       for_( it, rbegin_r, rend_r )
       {
-       if ( *it == '\\' )
-         ++backslashes;
-       else
-         break;
+        if ( *it == '\\' )
+          ++backslashes;
+        else
+          break;
       }
       return !(backslashes & 1U);
     }
@@ -800,12 +800,12 @@ namespace zypp
       unsigned chars = 0;
       for_( it, begin_r, end_r )
       {
-       ++chars;
-       if ( str_r[it] == '\\' )
-       {
-         if ( ++it == end_r )
-           break;
-       }
+        ++chars;
+        if ( str_r[it] == '\\' )
+        {
+          if ( ++it == end_r )
+            break;
+        }
       }
       return chars;
     }
@@ -847,63 +847,63 @@ namespace zypp
       std::string::size_type prefx = 0;
       switch ( *src.begin() )  // wellformed implies not empty
       {
-       case '*':
-         if ( src.size() == 1 )
-           return true;        // "*" matches always: superset
-         // else
-         prefx = std::string::npos;
-         src.erase( 0, 1 );
-         break;
-       case '?':
-         ++prefx;
-         for_( it, ++src.begin(), src.end() )
-         { if ( *it == '?' ) ++prefx; else break; }
-         if ( src.size() == prefx )
-           return( trg.size() <= prefx );      // "??..?": superset if at most #prefx chars
-         // else
-         src.erase( 0, prefx );
-         break;
-       default:
-         break;
+        case '*':
+          if ( src.size() == 1 )
+            return true;       // "*" matches always: superset
+          // else
+          prefx = std::string::npos;
+          src.erase( 0, 1 );
+          break;
+        case '?':
+          ++prefx;
+          for_( it, ++src.begin(), src.end() )
+          { if ( *it == '?' ) ++prefx; else break; }
+          if ( src.size() == prefx )
+            return( trg.size() <= prefx );     // "??..?": superset if at most #prefx chars
+          // else
+          src.erase( 0, prefx );
+          break;
+        default:
+          break;
       }
       // unescaped wildcard suffix
       std::string::size_type suffx = 0;
       if ( ! src.empty() )
       {
-       switch ( *src.rbegin() )
-       {
-         case '*':
-           if ( evenNumberOfBackslashes( ++src.rbegin(), src.rend() ) )
-           {
-             suffx = std::string::npos;
-             src.erase( src.size()-1 );
-           }
-           break;
-         case '?':
-           ++suffx;
-           for_( it, ++src.rbegin(), src.rend() )
-           { if ( *it == '?' ) ++suffx; else break; }
-           if ( ! evenNumberOfBackslashes( src.rbegin()+suffx, src.rend() ) )
-             --suffx;  // last '?' was escaped.
-           src.erase( src.size()-suffx );
-           break;
-         default:
-           break;
-       }
+        switch ( *src.rbegin() )
+        {
+          case '*':
+            if ( evenNumberOfBackslashes( ++src.rbegin(), src.rend() ) )
+            {
+              suffx = std::string::npos;
+              src.erase( src.size()-1 );
+            }
+            break;
+          case '?':
+            ++suffx;
+            for_( it, ++src.rbegin(), src.rend() )
+            { if ( *it == '?' ) ++suffx; else break; }
+            if ( ! evenNumberOfBackslashes( src.rbegin()+suffx, src.rend() ) )
+              --suffx; // last '?' was escaped.
+            src.erase( src.size()-suffx );
+            break;
+          default:
+            break;
+        }
       }
       // now match; find src in trg an check surrounding wildcards
       src = str::toLower( src );
       trg = str::toLower( trg );
       for ( std::string::size_type match = trg.find( src, 0 );
-           match != std::string::npos;
+            match != std::string::npos;
             match = trg.find( src, match+1 ) )
       {
-       if ( prefx != std::string::npos && trueCharsIn( trg, 0, match ) > prefx )
-         break;        // not "*", and already more chars than "?"s before match: disjoint
-       std::string::size_type frontSize = match + src.size();
-       if ( suffx != std::string::npos && trueCharsIn( trg, frontSize, trg.size() ) > suffx )
-         continue;     // not "*", and still more chars than "?"s after match: check next match
-       return true;    // match: superset
+        if ( prefx != std::string::npos && trueCharsIn( trg, 0, match ) > prefx )
+          break;       // not "*", and already more chars than "?"s before match: disjoint
+        std::string::size_type frontSize = match + src.size();
+        if ( suffx != std::string::npos && trueCharsIn( trg, frontSize, trg.size() ) > suffx )
+          continue;    // not "*", and still more chars than "?"s after match: check next match
+        return true;   // match: superset
       }
       return false;    // disjoint
     }
@@ -914,7 +914,7 @@ namespace zypp
   {
     const std::string & value( *_value );
     return ( isWildchar( *value.begin() )
-       || ( isWildchar( *value.rbegin() ) && evenNumberOfBackslashes( ++value.rbegin(), value.rend() ) ) );
+        || ( isWildchar( *value.rbegin() ) && evenNumberOfBackslashes( ++value.rbegin(), value.rend() ) ) );
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -965,13 +965,13 @@ namespace zypp
     {
       if ( srcType == Type::wildcardfree )     // trgType == Type::wildcardfree
       {
-       // simple string compare
-       ret = matchWildcardfreeString( *_value, *trg._value ) ? SetCompare::equal : SetCompare::disjoint;
+        // simple string compare
+        ret = matchWildcardfreeString( *_value, *trg._value ) ? SetCompare::equal : SetCompare::disjoint;
       }
       else if ( srcType == Type::wildcarded )  // trgType == Type::wildcardfree
       {
-       // Needs wildcard compare
-       ret = matchWildcardedString( *_value, *trg._value ) ? SetCompare::properSuperset : SetCompare::disjoint;
+        // Needs wildcard compare
+        ret = matchWildcardedString( *_value, *trg._value ) ? SetCompare::properSuperset : SetCompare::disjoint;
      }
     }
     return ret;
@@ -1020,29 +1020,29 @@ namespace zypp
       // NeedsCloserLook:
       if ( isWildcarded() )
       {
-       if ( trg.isWildcarded() )
-       {
-         // simple string compare just to detect 'equal'
-         ret = matchWildcardfreeString( *_value, *trg._value ) ? SetCompare::equal : SetCompare::uncomparable;
-       }
-       else
-       {
-         // Needs wildcard compare (src,trg)
-         if ( matchWildcardedString( *_value, *trg._value ) ) ret = SetCompare::properSuperset; // else: SetCompare::disjoint;
-       }
+        if ( trg.isWildcarded() )
+        {
+          // simple string compare just to detect 'equal'
+          ret = matchWildcardfreeString( *_value, *trg._value ) ? SetCompare::equal : SetCompare::uncomparable;
+        }
+        else
+        {
+          // Needs wildcard compare (src,trg)
+          if ( matchWildcardedString( *_value, *trg._value ) ) ret = SetCompare::properSuperset; // else: SetCompare::disjoint;
+        }
       }
       else
       {
-       if ( trg.isWildcarded() )
-       {
-         // Needs wildcard compare (trg,src)
-         if ( matchWildcardedString( *trg._value, *_value ) ) ret = SetCompare::properSubset; // else: SetCompare::disjoint;
-       }
-       else
-       {
-         // simple string compare
-         if ( matchWildcardfreeString( *_value, *trg._value ) ) ret = SetCompare::equal; // else: SetCompare::disjoint;
-       }
+        if ( trg.isWildcarded() )
+        {
+          // Needs wildcard compare (trg,src)
+          if ( matchWildcardedString( *trg._value, *_value ) ) ret = SetCompare::properSubset; // else: SetCompare::disjoint;
+        }
+        else
+        {
+          // simple string compare
+          if ( matchWildcardfreeString( *_value, *trg._value ) ) ret = SetCompare::equal; // else: SetCompare::disjoint;
+        }
       }
     }
     return ret;
index b5c540a..b707bc8 100644 (file)
@@ -38,17 +38,17 @@ namespace zypp
     /** WFN attributes (use like 'enum class \ref Attribute') */
     struct EAttributeDef {
       enum Enum {
-       part,           //< attribute (2.2)
-       vendor,         //< attribute (2.2)
-       product,        //< attribute (2.2)
-       version,        //< attribute (2.2)
-       update,         //< attribute (2.2)
-       edition,        //< attribute (2.2)
-       language,       //< attribute (2.2)
-       sw_edition,     //< extended attribute (2.3)
-       target_sw,      //< extended attribute (2.3)
-       target_hw,      //< extended attribute (2.3)
-       other           //< extended attribute (2.3)
+        part,          //< attribute (2.2)
+        vendor,                //< attribute (2.2)
+        product,       //< attribute (2.2)
+        version,       //< attribute (2.2)
+        update,                //< attribute (2.2)
+        edition,       //< attribute (2.2)
+        language,      //< attribute (2.2)
+        sw_edition,    //< extended attribute (2.3)
+        target_sw,     //< extended attribute (2.3)
+        target_hw,     //< extended attribute (2.3)
+        other          //< extended attribute (2.3)
       };
       static constexpr unsigned numAttributes = other+1;       ///< number of attributes
       static const std::string & asString( Enum val_r );       ///< string representantion
@@ -206,10 +206,10 @@ namespace zypp
     /** Classification of \ref Value types mostly for \ref match (use like 'enum class \ref Type') */
     struct ETypeDef {
       enum Enum {
-       ANY,
-       NA,
-       wildcardfree,
-       wildcarded,
+        ANY,
+        NA,
+        wildcardfree,
+        wildcarded,
       };
     };
     typedef base::EnumClass<ETypeDef> Type;    ///< 'enum class Type'
index 3a24f8a..3cf7164 100644 (file)
@@ -27,21 +27,21 @@ namespace zypp
     inline Dep::for_use_in_switch parse( const std::string & strval_r )
     {
       const std::map<std::string,Dep::for_use_in_switch> _table = {
-       { "provides",           Dep::PROVIDES_e         },
-       { "prerequires",        Dep::PREREQUIRES_e      },
-       { "requires",           Dep::REQUIRES_e         },
-       { "conflicts",          Dep::CONFLICTS_e        },
-       { "obsoletes",          Dep::OBSOLETES_e        },
-       { "recommends",         Dep::RECOMMENDS_e       },
-       { "suggests",           Dep::SUGGESTS_e         },
-       { "enhances",           Dep::ENHANCES_e         },
-       { "supplements",        Dep::SUPPLEMENTS_e      }
+        { "provides",          Dep::PROVIDES_e         },
+        { "prerequires",       Dep::PREREQUIRES_e      },
+        { "requires",          Dep::REQUIRES_e         },
+        { "conflicts",         Dep::CONFLICTS_e        },
+        { "obsoletes",         Dep::OBSOLETES_e        },
+        { "recommends",                Dep::RECOMMENDS_e       },
+        { "suggests",          Dep::SUGGESTS_e         },
+        { "enhances",          Dep::ENHANCES_e         },
+        { "supplements",       Dep::SUPPLEMENTS_e      }
       };
 
       auto it = _table.find( str::toLower( strval_r ) );
       if ( it == _table.end() )
       {
-       ZYPP_THROW( Exception("Dep parse: illegal string value '"+strval_r+"'") );
+        ZYPP_THROW( Exception("Dep parse: illegal string value '"+strval_r+"'") );
       }
       return it->second;
     }
index fba43f0..01d3c49 100644 (file)
@@ -45,14 +45,14 @@ namespace zypp {
 
       if(argc > 1 && std::string(argv[argpos]) == "--openssl")
       {
-       openssl = true;
-       ++argpos;
+        openssl = true;
+        ++argpos;
       }
 
       if(argc - argpos < 2)
       {
-       cerr << "Usage: " << argv[0] << " <DIGESTNAME> <FILE>" << endl;
-       return 1;
+        cerr << "Usage: " << argv[0] << " <DIGESTNAME> <FILE>" << endl;
+        return 1;
       }
 
       const char* digestname = argv[argpos++];
@@ -63,9 +63,9 @@ namespace zypp {
       std::string digest = Digest::digest(digestname, file);
 
       if(openssl)
-       cout << digestname << "(" << fn << ")= " << digest << endl;
+        cout << digestname << "(" << fn << ")= " << digest << endl;
       else
-       cout << digest << "  " << fn << endl;
+        cout << digest << "  " << fn << endl;
 
       return 0;
     }
index 5d5158c..822957d 100644 (file)
@@ -55,8 +55,8 @@ namespace zypp
         for_( it, result.begin(), result.end() )
         {
           duchanges[idx].path = it->dir.c_str();
-         if ( it->growonly )
-           duchanges[idx].flags |= DUCHANGES_ONLYADD;
+          if ( it->growonly )
+            duchanges[idx].flags |= DUCHANGES_ONLYADD;
           ++idx;
         }
       }
@@ -71,9 +71,9 @@ namespace zypp
         unsigned idx = 0;
         for_( it, result.begin(), result.end() )
         {
-         // Limit estimated waste (half block per file) as it does not apply to
-         // btrfs, which reports up to 64K blocksize (bsc#974275,bsc#965322)
-         static const ByteCount blockAdjust( 2, ByteCount::K ); // (files * blocksize) / 2 / 1K; result value in K!
+          // Limit estimated waste (half block per file) as it does not apply to
+          // btrfs, which reports up to 64K blocksize (bsc#974275,bsc#965322)
+          static const ByteCount blockAdjust( 2, ByteCount::K ); // (files * blocksize) / 2 / 1K; result value in K!
 
           it->pkg_size = it->used_size          // current usage
                        + duchanges[idx].kbytes  // package data size
@@ -136,195 +136,195 @@ namespace zypp
       std::ifstream procmounts( "/proc/mounts" );
 
       if ( !procmounts ) {
-       WAR << "Unable to read /proc/mounts" << std::endl;
+        WAR << "Unable to read /proc/mounts" << std::endl;
       } else {
 
-       std::string prfx;
-       if ( rootdir != "/" )
-         prfx = rootdir; // rootdir not /
-
-       while ( procmounts ) {
-         std::string l = str::getline( procmounts );
-         if ( !(procmounts.fail() || procmounts.bad()) ) {
-           // data to consume
-
-           // rootfs           /               rootfs          rw 0 0
-           // /dev/root        /               reiserfs        rw 0 0
-           // proc             /proc           proc            rw 0 0
-           // devpts           /dev/pts        devpts          rw 0 0
-           // /dev/hda5        /boot           ext2            rw 0 0
-           // shmfs            /dev/shm        shm             rw 0 0
-           // usbdevfs         /proc/bus/usb   usbdevfs        rw 0 0
-
-           std::vector<std::string> words;
-           str::split( l, std::back_inserter(words) );
-
-           if ( words.size() < 3 ) {
-             WAR << "Suspicious entry in /proc/mounts: " << l << std::endl;
-             continue;
-           }
-
-           //
-           // Filter devices without '/' (proc,shmfs,..)
-           //
-           if ( words[0].find( '/' ) == std::string::npos ) {
-             DBG << "Discard mount point : " << l << std::endl;
-             continue;
-           }
-
-           // remove /proc entry
-           if (words[0] == "/proc")
-           {
-             DBG << "Discard /proc filesystem: " << l << std::endl;
-             continue;
-           }
-
-           //
-           // Filter mountpoints not at or below _rootdir
-           //
-           std::string mp = words[1];
-           if ( prfx.size() ) {
-             if ( mp.compare( 0, prfx.size(), prfx ) != 0 ) {
-               // mountpoint not below rootdir
-               DBG << "Unwanted mount point : " << l << std::endl;
-               continue;
-             }
-             // strip prfx
-             mp.erase( 0, prfx.size() );
-             if ( mp.empty() ) {
-               mp = "/";
-             } else if ( mp[0] != '/' ) {
-               // mountpoint not below rootdir
-               DBG << "Unwanted mount point : " << l << std::endl;
-               continue;
-             }
-           }
-
-           //
-           // Filter cdrom
-           //
-           if ( words[2] == "iso9660" ) {
-             DBG << "Discard cdrom : " << l << std::endl;
-             continue;
-           }
-
-           if ( words[2] == "vfat" || words[2] == "fat" || words[2] == "ntfs" || words[2] == "ntfs-3g")
-           {
-             MIL << words[1] << " contains ignored fs (" << words[2] << ')' << std::endl;
-             continue;
-           }
-
-           //
-           // Filter some common unwanted mountpoints
-           //
-           const char * mpunwanted[] = {
-             "/mnt", "/media", "/mounts", "/floppy", "/cdrom",
-             "/suse", "/tmp", "/var/tmp", "/var/adm/mount", "/var/adm/YaST",
-             /*last*/0/*entry*/
-           };
-
-           const char ** nomp = mpunwanted;
-           for ( ; *nomp; ++nomp ) {
-             std::string pre( *nomp );
-             if ( mp.compare( 0, pre.size(), pre ) == 0 // mp has prefix pre
-                  && ( mp.size() == pre.size() || mp[pre.size()] == '/' ) ) {
-               break;
-             }
-           }
-           if ( *nomp ) {
-             DBG << "Filter mount point : " << l << std::endl;
-             continue;
-           }
-
-           //
-           // Check whether mounted readonly
-           //
-           MountPoint::HintFlags hints;
-
-           std::vector<std::string> flags;
-           str::split( words[3], std::back_inserter(flags), "," );
-
-           for ( unsigned i = 0; i < flags.size(); ++i ) {
-             if ( flags[i] == "ro" ) {
-               hints |= MountPoint::Hint_readonly;
-               break;
-             }
-           }
+        std::string prfx;
+        if ( rootdir != "/" )
+          prfx = rootdir; // rootdir not /
+
+        while ( procmounts ) {
+          std::string l = str::getline( procmounts );
+          if ( !(procmounts.fail() || procmounts.bad()) ) {
+            // data to consume
+
+            // rootfs          /               rootfs          rw 0 0
+            // /dev/root       /               reiserfs        rw 0 0
+            // proc            /proc           proc            rw 0 0
+            // devpts          /dev/pts        devpts          rw 0 0
+            // /dev/hda5       /boot           ext2            rw 0 0
+            // shmfs           /dev/shm        shm             rw 0 0
+            // usbdevfs        /proc/bus/usb   usbdevfs        rw 0 0
+
+            std::vector<std::string> words;
+            str::split( l, std::back_inserter(words) );
+
+            if ( words.size() < 3 ) {
+              WAR << "Suspicious entry in /proc/mounts: " << l << std::endl;
+              continue;
+            }
+
+            //
+            // Filter devices without '/' (proc,shmfs,..)
+            //
+            if ( words[0].find( '/' ) == std::string::npos ) {
+              DBG << "Discard mount point : " << l << std::endl;
+              continue;
+            }
+
+            // remove /proc entry
+            if (words[0] == "/proc")
+            {
+              DBG << "Discard /proc filesystem: " << l << std::endl;
+              continue;
+            }
+
+            //
+            // Filter mountpoints not at or below _rootdir
+            //
+            std::string mp = words[1];
+            if ( prfx.size() ) {
+              if ( mp.compare( 0, prfx.size(), prfx ) != 0 ) {
+                // mountpoint not below rootdir
+                DBG << "Unwanted mount point : " << l << std::endl;
+                continue;
+              }
+              // strip prfx
+              mp.erase( 0, prfx.size() );
+              if ( mp.empty() ) {
+                mp = "/";
+              } else if ( mp[0] != '/' ) {
+                // mountpoint not below rootdir
+                DBG << "Unwanted mount point : " << l << std::endl;
+                continue;
+              }
+            }
+
+            //
+            // Filter cdrom
+            //
+            if ( words[2] == "iso9660" ) {
+              DBG << "Discard cdrom : " << l << std::endl;
+              continue;
+            }
+
+            if ( words[2] == "vfat" || words[2] == "fat" || words[2] == "ntfs" || words[2] == "ntfs-3g")
+            {
+              MIL << words[1] << " contains ignored fs (" << words[2] << ')' << std::endl;
+              continue;
+            }
+
+            //
+            // Filter some common unwanted mountpoints
+            //
+            const char * mpunwanted[] = {
+              "/mnt", "/media", "/mounts", "/floppy", "/cdrom",
+              "/suse", "/tmp", "/var/tmp", "/var/adm/mount", "/var/adm/YaST",
+              /*last*/0/*entry*/
+            };
+
+            const char ** nomp = mpunwanted;
+            for ( ; *nomp; ++nomp ) {
+              std::string pre( *nomp );
+              if ( mp.compare( 0, pre.size(), pre ) == 0 // mp has prefix pre
+                   && ( mp.size() == pre.size() || mp[pre.size()] == '/' ) ) {
+                break;
+              }
+            }
+            if ( *nomp ) {
+              DBG << "Filter mount point : " << l << std::endl;
+              continue;
+            }
+
+            //
+            // Check whether mounted readonly
+            //
+            MountPoint::HintFlags hints;
+
+            std::vector<std::string> flags;
+            str::split( words[3], std::back_inserter(flags), "," );
+
+            for ( unsigned i = 0; i < flags.size(); ++i ) {
+              if ( flags[i] == "ro" ) {
+                hints |= MountPoint::Hint_readonly;
+                break;
+              }
+            }
             if ( hints.testFlag( MountPoint::Hint_readonly ) ) {
-             DBG << "Filter ro mount point : " << l << std::endl;
-             continue;
-           }
-
-           //
-           // check for snapshotting btrfs
-           //
-           bool btrfshack = false;
-           if ( words[2] == "btrfs" )
-           {
-             btrfshack = true;
-             if ( geteuid() != 0 )
-             {
-               DBG << "Assume snapshots on " << words[1] << ": non-root user can't check" << std::endl;
-               hints |= MountPoint::Hint_growonly;
-             }
-             else
-             {
-               // For now just check whether there is
-               // at least one snapshot on the volume:
-               ExternalProgram prog({"btrfs","subvolume","list","-s",words[1]});
-               std::string line( prog.receiveLine() );
-               if ( ! line.empty() )
-               {
-                 DBG << "Found a snapshot on " << words[1] << ": " << line; // has trailing std::endl
-                 hints |= MountPoint::Hint_growonly;
-               }
-               prog.kill();
-             }
-           }
-
-           //
-           // statvfs (full path!) and get the data
-           //
-           struct statvfs sb;
-           if ( statvfs( words[1].c_str(), &sb ) != 0 ) {
-             WAR << "Unable to statvfs(" << words[1] << "); errno " << errno << std::endl;
-             ret.insert( DiskUsageCounter::MountPoint( mp, words[2], 0LL, 0LL, 0LL, 0LL, hints ) );
-           }
-           else
-           {
-             //
-             // Filter zero sized devices (bnc#769819)
-             //
-             if ( sb.f_blocks == 0 || sb.f_bsize == 0 )
-             {
-               DBG << "Filter zero-sized mount point : " << l << std::endl;
-               continue;
-             }
-             if ( btrfshack )
-             {
-               // HACK:
-               // Collect just the top/1st mountpoint of each btrfs volume
-               // (by device). This filters away nested subvolumes
-               // which otherwise break per package disk usage computation.
-               // FIX: Computation must learn to handle multiple mount points
-               // contributing to the same file system.
-               MountPoint & bmp( btrfsfilter[words[0]] );
-               if ( bmp.fstype.empty() )       // 1st occurance
-               {
-                 bmp = DiskUsageCounter::MountPoint( mp, words[2], sb.f_bsize,
-                                                     ((long long)sb.f_blocks)*sb.f_bsize/1024,
-                                                     ((long long)(sb.f_blocks - sb.f_bfree))*sb.f_bsize/1024, 0LL, hints );
-               }
-               else if ( bmp.dir > mp )
-                 bmp.dir = mp;
-               continue;
-             }
-             ret.insert( DiskUsageCounter::MountPoint( mp, words[2], sb.f_bsize,
-               ((long long)sb.f_blocks)*sb.f_bsize/1024,
-               ((long long)(sb.f_blocks - sb.f_bfree))*sb.f_bsize/1024, 0LL, hints ) );
-           }
-         }
-       }
+              DBG << "Filter ro mount point : " << l << std::endl;
+              continue;
+            }
+
+            //
+            // check for snapshotting btrfs
+            //
+            bool btrfshack = false;
+            if ( words[2] == "btrfs" )
+            {
+              btrfshack = true;
+              if ( geteuid() != 0 )
+              {
+                DBG << "Assume snapshots on " << words[1] << ": non-root user can't check" << std::endl;
+                hints |= MountPoint::Hint_growonly;
+              }
+              else
+              {
+                // For now just check whether there is
+                // at least one snapshot on the volume:
+                ExternalProgram prog({"btrfs","subvolume","list","-s",words[1]});
+                std::string line( prog.receiveLine() );
+                if ( ! line.empty() )
+                {
+                  DBG << "Found a snapshot on " << words[1] << ": " << line; // has trailing std::endl
+                  hints |= MountPoint::Hint_growonly;
+                }
+                prog.kill();
+              }
+            }
+
+            //
+            // statvfs (full path!) and get the data
+            //
+            struct statvfs sb;
+            if ( statvfs( words[1].c_str(), &sb ) != 0 ) {
+              WAR << "Unable to statvfs(" << words[1] << "); errno " << errno << std::endl;
+              ret.insert( DiskUsageCounter::MountPoint( mp, words[2], 0LL, 0LL, 0LL, 0LL, hints ) );
+            }
+            else
+            {
+              //
+              // Filter zero sized devices (bnc#769819)
+              //
+              if ( sb.f_blocks == 0 || sb.f_bsize == 0 )
+              {
+                DBG << "Filter zero-sized mount point : " << l << std::endl;
+                continue;
+              }
+              if ( btrfshack )
+              {
+                // HACK:
+                // Collect just the top/1st mountpoint of each btrfs volume
+                // (by device). This filters away nested subvolumes
+                // which otherwise break per package disk usage computation.
+                // FIX: Computation must learn to handle multiple mount points
+                // contributing to the same file system.
+                MountPoint & bmp( btrfsfilter[words[0]] );
+                if ( bmp.fstype.empty() )      // 1st occurance
+                {
+                  bmp = DiskUsageCounter::MountPoint( mp, words[2], sb.f_bsize,
+                                                      ((long long)sb.f_blocks)*sb.f_bsize/1024,
+                                                      ((long long)(sb.f_blocks - sb.f_bfree))*sb.f_bsize/1024, 0LL, hints );
+                }
+                else if ( bmp.dir > mp )
+                  bmp.dir = mp;
+                continue;
+              }
+              ret.insert( DiskUsageCounter::MountPoint( mp, words[2], sb.f_bsize,
+                ((long long)sb.f_blocks)*sb.f_bsize/1024,
+                ((long long)(sb.f_blocks - sb.f_bfree))*sb.f_bsize/1024, 0LL, hints ) );
+            }
+          }
+        }
     }
 
     // collect filtered btrfs volumes
index 3a2ad05..2778b2e 100644 (file)
@@ -56,21 +56,21 @@ namespace zypp
       /** HinFlags for ctor */
       enum Hint
       {
-       NoHint          = 0,
-       Hint_readonly   = (1<<0),       ///< readonly partitions
-       Hint_growonly   = (1<<1),       ///< growonly partitions (e.g. snapshotting btrfs)
+        NoHint         = 0,
+        Hint_readonly  = (1<<0),       ///< readonly partitions
+        Hint_growonly  = (1<<1),       ///< growonly partitions (e.g. snapshotting btrfs)
       };
       ZYPP_DECLARE_FLAGS(HintFlags,Hint);
 
       /** Ctor initialize directory, fstype and sizes */
       MountPoint( const std::string & d = "/",
-                 const std::string & f = std::string(),
-                 long long bs = 0LL, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
-                 HintFlags hints = NoHint )
-       : dir(d), fstype(f)
-       , block_size(bs), total_size(total), used_size(used), pkg_size(pkg)
-       , readonly(hints.testFlag(Hint_readonly))
-       , growonly(hints.testFlag(Hint_growonly))
+                  const std::string & f = std::string(),
+                  long long bs = 0LL, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
+                  HintFlags hints = NoHint )
+        : dir(d), fstype(f)
+        , block_size(bs), total_size(total), used_size(used), pkg_size(pkg)
+        , readonly(hints.testFlag(Hint_readonly))
+        , growonly(hints.testFlag(Hint_growonly))
       {}
        /** \overload <tt>const char *</tt> to allow e.g. initiailzer lists
        * \code
@@ -78,42 +78,42 @@ namespace zypp
        * \endcode
        */
       MountPoint( const char * d,
-                 const std::string & f = std::string(),
-                 long long bs = 0LL, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
-                 HintFlags hints = NoHint )
-       : MountPoint( std::string(d?d:""), f, bs, total, used, pkg, hints )
+                  const std::string & f = std::string(),
+                  long long bs = 0LL, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
+                  HintFlags hints = NoHint )
+        : MountPoint( std::string(d?d:""), f, bs, total, used, pkg, hints )
       {}
 
 
       /** Ctor initialize directory and sizes */
       MountPoint( const std::string & d,
-                 long long bs, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
-                 HintFlags hints = NoHint )
-       : MountPoint( d, std::string(), bs, total, used, pkg, hints )
+                  long long bs, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
+                  HintFlags hints = NoHint )
+        : MountPoint( d, std::string(), bs, total, used, pkg, hints )
       {}
       /** \overload <tt>const char *</tt> */
       MountPoint( const char * d,
-                 long long bs, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
-                 HintFlags hints = NoHint )
-       : MountPoint( std::string(d?d:""), bs, total, used, pkg, hints )
+                  long long bs, long long total = 0LL, long long used = 0LL, long long pkg = 0LL,
+                  HintFlags hints = NoHint )
+        : MountPoint( std::string(d?d:""), bs, total, used, pkg, hints )
       {}
 
 
       /** Ctor just name and hints, all sizes 0 */
       MountPoint( const std::string & d, HintFlags hints )
-       : MountPoint( d, std::string(), 0LL, 0LL, 0LL, 0LL, hints )
+        : MountPoint( d, std::string(), 0LL, 0LL, 0LL, 0LL, hints )
       {}
       /** \overload <tt>const char *</tt> */
       MountPoint( const char * d, HintFlags hints )
-       : MountPoint( std::string(d?d:""), hints )
+        : MountPoint( std::string(d?d:""), hints )
       {}
       /** \overload to prevent propagation Hint -> long long */
       MountPoint( const std::string & d, Hint hint )
-       : MountPoint( d, HintFlags(hint) )
+        : MountPoint( d, HintFlags(hint) )
       {}
       /** \overload to prevent propagation Hint -> long long */
       MountPoint( const char * d, Hint hint )
-       : MountPoint( std::string(d?d:""), HintFlags(hint) )
+        : MountPoint( std::string(d?d:""), HintFlags(hint) )
       {}
 
       /** Sort by directory name */
@@ -200,7 +200,7 @@ namespace zypp
     {
       Bitmap bitmap( Bitmap::poolSize );
       for_( it, begin_r, end_r )
-       bitmap.set( sat::asSolvable()( *it ).id() );
+        bitmap.set( sat::asSolvable()( *it ).id() );
       return disk_usage( bitmap );
     }
 
index 15a9bc9..936d654 100644 (file)
@@ -23,15 +23,15 @@ namespace zypp
   {
     DownloadDefault, //!< libzypp will decide what to do.
     DownloadOnly,      //!< Just download all packages to the local cache.
-                       //!< Do not install. Implies a dry-run.
+                        //!< Do not install. Implies a dry-run.
     DownloadInAdvance, //!< First download all packages to the local cache.
-                       //!< Then start to install.
+                        //!< Then start to install.
     DownloadInHeaps,   //!< Similar to DownloadInAdvance, but try to split
-                       //!< the transaction into heaps, where at the end of
-                       //!< each heap a consistent system state is reached.
+                        //!< the transaction into heaps, where at the end of
+                        //!< each heap a consistent system state is reached.
     DownloadAsNeeded   //!< Alternating download and install. Packages are
-                       //!< cached just to avid CD/DVD hopping. This is the
-                       //!< traditional behaviour.
+                        //!< cached just to avid CD/DVD hopping. This is the
+                        //!< traditional behaviour.
   };
 
   /** \relates DownloadMode Parse from string.
index d455427..ae3fe41 100644 (file)
@@ -181,10 +181,10 @@ namespace zypp
   /** \relates Edition XML output. */
   inline std::ostream & dumpAsXmlOn( std::ostream & str, const Edition & obj )
   { return str << "<edition"
-              << " epoch=\"" << obj.epoch() << "\""
-              << " version=\"" << obj.version() << "\""
-              << " release=\"" << obj.release() << "\""
-              << "/>";
+               << " epoch=\"" << obj.epoch() << "\""
+               << " version=\"" << obj.version() << "\""
+               << " release=\"" << obj.release() << "\""
+               << "/>";
   }
 
   /////////////////////////////////////////////////////////////////
index 451e8db..111a52d 100644 (file)
@@ -365,9 +365,9 @@ namespace zypp
       cacheLocation = cacheDir / resource_r.filename();
       if ( PathInfo(cacheLocation).isExist() && is_checksum( cacheLocation, resource_r.checksum() ) )
       {
-       MIL << "file " << resource_r.filename() << " found in cache " << cacheDir << endl;
-       swap( ret, cacheLocation );
-       return ret;
+        MIL << "file " << resource_r.filename() << " found in cache " << cacheDir << endl;
+        swap( ret, cacheLocation );
+        return ret;
       }
     }
 
@@ -410,24 +410,24 @@ namespace zypp
   {
       auto fnc_addIfInContent( [&]( const std::string & index_r ) -> bool
       {
-       if ( find( content.begin(), content.end(), filesystem::DirEntry(index_r,filesystem::FT_FILE) ) == content.end() )
-         return false;
-       // add the index of this directory
-       OnMediaLocation indexloc( resource );
-       indexloc.changeFilename( resource.filename() + index_r );
-       addIndex( indexloc );
-       // we need to read it now
-       downloadAndReadIndexList( media, dest_dir );
-       return true;
+        if ( find( content.begin(), content.end(), filesystem::DirEntry(index_r,filesystem::FT_FILE) ) == content.end() )
+          return false;
+        // add the index of this directory
+        OnMediaLocation indexloc( resource );
+        indexloc.changeFilename( resource.filename() + index_r );
+        addIndex( indexloc );
+        // we need to read it now
+        downloadAndReadIndexList( media, dest_dir );
+        return true;
       } );
 
       if ( _options & AutoAddChecksumsIndexes )
       {
-       fnc_addIfInContent( "CHECKSUMS" ) || fnc_addIfInContent( "SHA1SUMS" );
+        fnc_addIfInContent( "CHECKSUMS" ) || fnc_addIfInContent( "SHA1SUMS" );
       }
       if ( _options & AutoAddContentFileIndexes )
       {
-       fnc_addIfInContent( "content" );
+        fnc_addIfInContent( "content" );
       }
   }
 
@@ -463,13 +463,13 @@ namespace zypp
       MIL << "Adding directory " << resource.filename() << endl;
       filesystem::DirContent content;
       try {
-       getDirectoryContent(media, resource, content);
+        getDirectoryContent(media, resource, content);
       }
       catch ( media::MediaFileNotFoundException & exception )
       {
-       ZYPP_CAUGHT( exception );
-       WAR << "Skiping subtree hidden at " << resource.filename() << endl;
-       return;
+        ZYPP_CAUGHT( exception );
+        WAR << "Skiping subtree hidden at " << resource.filename() << endl;
+        return;
       }
 
       // this method test for the option flags so indexes are added
@@ -530,9 +530,9 @@ namespace zypp
       Pathname tmpFile = locateInCache( resource, destDir_r );
       if ( tmpFile.empty() )
       {
-       MIL << "Not found in cache, retrieving..." << endl;
-       tmpFile = media_r.provideFile( resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT );
-       releaseFileGuard.reset( new MediaSetAccess::ReleaseFileGuard( media_r, resource ) ); // release it when we leave the block
+        MIL << "Not found in cache, retrieving..." << endl;
+        tmpFile = media_r.provideFile( resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT );
+        releaseFileGuard.reset( new MediaSetAccess::ReleaseFileGuard( media_r, resource ) ); // release it when we leave the block
       }
 
       // The final destination: locateInCache also checks destFullPath!
@@ -540,35 +540,35 @@ namespace zypp
       // care it gets deleted, in case the validation fails.
       ManagedFile destFullPath( destDir_r / resource.filename() );
       if ( tmpFile == destFullPath )
-       destFullPath.setDispose( filesystem::unlink );
+        destFullPath.setDispose( filesystem::unlink );
 
       // validate the file (throws if not valid)
       validate( tmpFile, jobp_r->checkers );
 
       // move it to the final destination
       if ( tmpFile == destFullPath )
-       destFullPath.resetDispose();    // keep it!
+        destFullPath.resetDispose();   // keep it!
       else
       {
-       if ( assert_dir( destFullPath->dirname() ) != 0 )
-         ZYPP_THROW( Exception( "Can't create " + destFullPath->dirname().asString() ) );
+        if ( assert_dir( destFullPath->dirname() ) != 0 )
+          ZYPP_THROW( Exception( "Can't create " + destFullPath->dirname().asString() ) );
 
-       if ( filesystem::hardlinkCopy( tmpFile, destFullPath ) != 0 )
-         ZYPP_THROW( Exception( "Can't hardlink/copy " + tmpFile.asString() + " to " + destDir_r.asString() ) );
+        if ( filesystem::hardlinkCopy( tmpFile, destFullPath ) != 0 )
+          ZYPP_THROW( Exception( "Can't hardlink/copy " + tmpFile.asString() + " to " + destDir_r.asString() ) );
       }
     }
     catch ( Exception & excpt )
     {
       if ( resource.optional() )
       {
-       ZYPP_CAUGHT( excpt );
-       WAR << "optional resource " << resource << " could not be transferred." << endl;
-       return;
+        ZYPP_CAUGHT( excpt );
+        WAR << "optional resource " << resource << " could not be transferred." << endl;
+        return;
       }
       else
       {
-       excpt.remember( "Can't provide " + resource.filename().asString() );
-       ZYPP_RETHROW( excpt );
+        excpt.remember( "Can't provide " + resource.filename().asString() );
+        ZYPP_RETHROW( excpt );
       }
     }
   }
@@ -617,24 +617,24 @@ namespace zypp
       std::ifstream in( index.c_str() );
       if ( ! in.fail() )
       {
-         std::string buffer;
+          std::string buffer;
           while ( getline( in, buffer ) )
           {
 
-             if ( buffer[0] == '#' )
-               continue;       // simple comment
+              if ( buffer[0] == '#' )
+                continue;      // simple comment
 
-             CheckSum checksum( str::stripFirstWord( buffer, /*ltrim before strip*/true ) );
-             if ( checksum.empty() )
-               continue;       // empty line | unknown cheksum format
+              CheckSum checksum( str::stripFirstWord( buffer, /*ltrim before strip*/true ) );
+              if ( checksum.empty() )
+                continue;      // empty line | unknown cheksum format
 
-             if ( buffer.empty() )
-             {
-               WAR << "Missing filename in CHECKSUMS file: " << index.asString() << " (" << checksum << ")" << endl;
-               continue;
-             }
+              if ( buffer.empty() )
+              {
+                WAR << "Missing filename in CHECKSUMS file: " << index.asString() << " (" << checksum << ")" << endl;
+                continue;
+              }
 
-             _checksums[(basedir/buffer).asString()] = checksum;
+              _checksums[(basedir/buffer).asString()] = checksum;
           }
       }
       else
index 91bf77b..d0a2996 100644 (file)
@@ -52,26 +52,26 @@ namespace zypp
       CheckSum real_checksum( _checksum.type(), filesystem::checksum( file, _checksum.type() ));
       if ( (real_checksum != _checksum) )
       {
-       // Remember askUserToAcceptWrongDigest decision for at most 12hrs in memory;
-       // Actually we just want to prevent asking the same question again when the
-       // previously downloaded file is retrieved from the disk cache.
-       static std::map<std::string,std::string> exceptions;
-       static Date exceptionsAge;
-       Date now( Date::now() );
-       if ( !exceptions.empty() && now-exceptionsAge > 12*Date::hour )
-         exceptions.clear();
-
-       WAR << "File " <<  file << " has wrong checksum " << real_checksum << " (expected " << _checksum << ")" << endl;
-       if ( !exceptions.empty() && exceptions[real_checksum.checksum()] == _checksum.checksum() )
-       {
-         WAR << "User accepted " <<  file << " with WRONG CHECKSUM. (remembered)" << std::endl;
+        // Remember askUserToAcceptWrongDigest decision for at most 12hrs in memory;
+        // Actually we just want to prevent asking the same question again when the
+        // previously downloaded file is retrieved from the disk cache.
+        static std::map<std::string,std::string> exceptions;
+        static Date exceptionsAge;
+        Date now( Date::now() );
+        if ( !exceptions.empty() && now-exceptionsAge > 12*Date::hour )
+          exceptions.clear();
+
+        WAR << "File " <<  file << " has wrong checksum " << real_checksum << " (expected " << _checksum << ")" << endl;
+        if ( !exceptions.empty() && exceptions[real_checksum.checksum()] == _checksum.checksum() )
+        {
+          WAR << "User accepted " <<  file << " with WRONG CHECKSUM. (remembered)" << std::endl;
           return;
-       }
+        }
         else if ( report->askUserToAcceptWrongDigest( file, _checksum.checksum(), real_checksum.checksum() ) )
         {
           WAR << "User accepted " <<  file << " with WRONG CHECKSUM." << std::endl;
-         exceptions[real_checksum.checksum()] = _checksum.checksum();
-         exceptionsAge = now;
+          exceptions[real_checksum.checksum()] = _checksum.checksum();
+          exceptionsAge = now;
           return;
         }
         else
index 985fa2d..17adea2 100644 (file)
@@ -45,9 +45,9 @@ namespace zypp
       char * tmp = ::cuserid(buf);
       if (tmp)
       {
-       result = string(tmp);
-       if (!::gethostname(buf, 255))
-         result += "@" + string(buf);
+        result = string(tmp);
+        if (!::gethostname(buf, 255))
+          result += "@" + string(buf);
       }
       return result;
     }
@@ -57,13 +57,13 @@ namespace zypp
       static std::string _val;
       if ( _val.empty() )
       {
-       pid_t mypid = getpid();
-       zypp::Pathname p( "/proc/"+zypp::str::numstring(mypid)+"/exe" );
-       zypp::Pathname myname( zypp::filesystem::readlink( p ) );
+        pid_t mypid = getpid();
+        zypp::Pathname p( "/proc/"+zypp::str::numstring(mypid)+"/exe" );
+        zypp::Pathname myname( zypp::filesystem::readlink( p ) );
 
-       _val += zypp::str::numstring(mypid);
-       _val += ":";
-       _val += myname.basename();
+        _val += zypp::str::numstring(mypid);
+        _val += ":";
+        _val += myname.basename();
       }
       return _val;
     }
@@ -73,28 +73,28 @@ namespace zypp
       static std::string _val;
       if ( _val.empty() )
       {
-       pid_t mypid = getpid();
-       {
-         std::ifstream cmdlineStr( Pathname("/proc/"+zypp::str::numstring(mypid)+"/cmdline").c_str() );
-         char ch;
-         const char * sep = "'";
-         while ( cmdlineStr && cmdlineStr.get( ch ) )
-         {
-           if ( sep )
-           {
-             _val += sep;
-             sep = nullptr;
-           }
-           switch ( ch )
-           {
-             case '\0':        _val += '\''; sep = " '"; break;
-             case '\n':        _val += ' '; break;
-             case '\\':        _val += '\\'; _val += '\\'; break;
-             case '|':         _val += '\\'; _val += '|'; break;
-             default:          _val += ch; break;
-           }
-         }
-       }
+        pid_t mypid = getpid();
+        {
+          std::ifstream cmdlineStr( Pathname("/proc/"+zypp::str::numstring(mypid)+"/cmdline").c_str() );
+          char ch;
+          const char * sep = "'";
+          while ( cmdlineStr && cmdlineStr.get( ch ) )
+          {
+            if ( sep )
+            {
+              _val += sep;
+              sep = nullptr;
+            }
+            switch ( ch )
+            {
+              case '\0':       _val += '\''; sep = " '"; break;
+              case '\n':       _val += ' '; break;
+              case '\\':       _val += '\\'; _val += '\\'; break;
+              case '|':                _val += '\\'; _val += '|'; break;
+              default:         _val += ch; break;
+            }
+          }
+        }
       }
       return _val;
     }
@@ -118,7 +118,7 @@ namespace zypp
       if( !_log && _fnameLastFail != _fname )
       {
         ERR << "Could not open logfile '" << _fname << "'" << endl;
-       _fnameLastFail = _fname;
+        _fnameLastFail = _fname;
       }
     }
 
index baf73b5..6b8d71e 100644 (file)
@@ -127,9 +127,9 @@ namespace zypp
       _action = HistoryActionID( trimmed );
       if ( _action != action_r )
       {
-       ZYPP_THROW( ParseException( str::form( "Bad action id. Got %s, expected %s.",
-                                              _action.asString().c_str(),
-                                              action_r.asString().c_str() ) ) );
+        ZYPP_THROW( ParseException( str::form( "Bad action id. Got %s, expected %s.",
+                                               _action.asString().c_str(),
+                                               action_r.asString().c_str() ) ) );
       }
       _field.swap( fields_r );
       // now adjust action field:
@@ -139,20 +139,20 @@ namespace zypp
     void _checkFields( const FieldVector & fields_r, size_type expect_r )
     {
       if ( expect_r < 2 )      // at least 2 fields (date and action) are required
-       expect_r = 2;
+        expect_r = 2;
       if ( fields_r.size() < expect_r )
       {
-       ZYPP_THROW( ParseException( str::form( "Bad number of fields. Got %zd, expected at least %zd.",
-                                              fields_r.size(),
-                                              expect_r ) ) );
+        ZYPP_THROW( ParseException( str::form( "Bad number of fields. Got %zd, expected at least %zd.",
+                                               fields_r.size(),
+                                               expect_r ) ) );
       }
       try
       {
-       _date = Date( fields_r[DATE_INDEX], HISTORY_LOG_DATE_FORMAT );
+        _date = Date( fields_r[DATE_INDEX], HISTORY_LOG_DATE_FORMAT );
       }
       catch ( const std::exception & excpt )
       {
-       ZYPP_THROW( ParseException( excpt.what() ) );   // invalid date format
+        ZYPP_THROW( ParseException( excpt.what() ) );  // invalid date format
       }
       // _action handled later
     }
@@ -188,18 +188,18 @@ namespace zypp
       switch ( HistoryActionID( str::trim( fields_r[ACTION_INDEX] ) ).toEnum() )
       {
 #define OUTS(E,T) case HistoryActionID::E: return Ptr( new T( fields_r ) ); break;
-       OUTS( INSTALL_e,                HistoryLogDataInstall );
-       OUTS( REMOVE_e,                 HistoryLogDataRemove );
-       OUTS( REPO_ADD_e,               HistoryLogDataRepoAdd );
-       OUTS( REPO_REMOVE_e,            HistoryLogDataRepoRemove );
-       OUTS( REPO_CHANGE_ALIAS_e,      HistoryLogDataRepoAliasChange );
-       OUTS( REPO_CHANGE_URL_e,        HistoryLogDataRepoUrlChange );
-       OUTS( STAMP_COMMAND_e,          HistoryLogDataStampCommand );
+        OUTS( INSTALL_e,               HistoryLogDataInstall );
+        OUTS( REMOVE_e,                        HistoryLogDataRemove );
+        OUTS( REPO_ADD_e,              HistoryLogDataRepoAdd );
+        OUTS( REPO_REMOVE_e,           HistoryLogDataRepoRemove );
+        OUTS( REPO_CHANGE_ALIAS_e,     HistoryLogDataRepoAliasChange );
+        OUTS( REPO_CHANGE_URL_e,       HistoryLogDataRepoUrlChange );
+        OUTS( STAMP_COMMAND_e,         HistoryLogDataStampCommand );
         OUTS( PATCH_STATE_CHANGE_e,     HistoryLogPatchStateChange );
 #undef OUTS
-       // intentionally no default:
-       case HistoryActionID::NONE_e:
-         break;
+        // intentionally no default:
+        case HistoryActionID::NONE_e:
+          break;
       }
     }
     // unknown action or invalid fields? Ctor will accept or throw.
index 634ad98..1e7cff9 100644 (file)
@@ -131,7 +131,7 @@ namespace zypp
 
       static int compare( const IdString & lhs,    const Derived & rhs )     { return compare( lhs, rhs.idStr() ); }
       static int compare( const IdString & lhs,    const IdString & rhs )    { return lhs == rhs ? 0 : Derived::_doCompare( (lhs ? lhs.c_str() : (const char *)0 ),
-                                                                                                                           (rhs ? rhs.c_str() : (const char *)0 ) ); }
+                                                                                                                            (rhs ? rhs.c_str() : (const char *)0 ) ); }
       static int compare( const IdString & lhs,    const std::string & rhs ) { return compare( lhs, rhs.c_str() ); }
       static int compare( const IdString & lhs,    const char * rhs )        { return Derived::_doCompare( (lhs ? lhs.c_str() : (const char *)0 ), rhs ); }
 
@@ -155,8 +155,8 @@ namespace zypp
     private:
       static int _doCompare( const char * lhs,  const char * rhs )
       {
-       if ( ! lhs ) return rhs ? -1 : 0;
-       return rhs ? ::strcmp( lhs, rhs ) : 1;
+        if ( ! lhs ) return rhs ? -1 : 0;
+        return rhs ? ::strcmp( lhs, rhs ) : 1;
       }
   };
   ///////////////////////////////////////////////////////////////////
index 51ec46a..c739035 100644 (file)
@@ -60,14 +60,14 @@ namespace zypp {
         , _fjoin  ( _fsplit )
       {}
       KVMapPolicy( const std::string & kvsplit_r, const std::string & fsplit_r,
-            const std::string & kvjoin_r )
+             const std::string & kvjoin_r )
         : _kvsplit( kvsplit_r )
         , _fsplit ( fsplit_r )
         , _kvjoin ( kvjoin_r )
         , _fjoin  ( _fsplit )
       {}
       KVMapPolicy( const std::string & kvsplit_r, const std::string & fsplit_r,
-            const std::string & kvjoin_r, const std::string & fjoin_r )
+             const std::string & kvjoin_r, const std::string & fjoin_r )
         : _kvsplit( kvsplit_r )
         , _fsplit ( fsplit_r )
         , _kvjoin ( kvjoin_r )
@@ -82,76 +82,76 @@ namespace zypp {
      * @short Base class for KVMaps, (key,value) pairs
      **/
     struct KVMapBase : public std::map<std::string,std::string> {
-    
+
       /**
        * (key,value) map type
        **/
       typedef std::map<std::string,std::string> map_type;
-    
+
       KVMapBase()
       {}
       KVMapBase( const map_type & kvmap_r )
         : std::map<std::string,std::string>( kvmap_r )
       {}
-    
+
       /**
        * Test whether key is set.
        **/
       bool has( const std::string & key_r ) const {
         return( find( key_r ) != end() );
       }
-    
+
       /**
        * @short KVMapPolicy for KVMaps using a single char as separator (e.g. mount options).
        **/
       template<char kv, char f>
       struct CharSep : public KVMapPolicy { CharSep() : KVMapPolicy( std::string(1,kv), std::string(1,f) ) {} };
-    
+
       ///////////////////////////////////////////////////////////////////
-    
+
       /**
        * Split str_r into (key,value) map, using the separators defined
        * by opts_r.
        **/
       static map_type split( const std::string & str_r,
-                        const KVMapPolicy & opts_r ) {
+                         const KVMapPolicy & opts_r ) {
         map_type ret;
         std::vector<std::string> fields;
         str::split( str_r, std::back_inserter(fields), opts_r._fsplit );
-    
+
         for ( unsigned i = 0; i < fields.size(); ++i ) {
           std::string::size_type pos = fields[i].find( opts_r._kvsplit );
           if ( pos == std::string::npos ) {
-       ret[fields[i]] = "";
+        ret[fields[i]] = "";
           } else {
-       ret[fields[i].substr( 0, pos )] = fields[i].substr( pos+1 );
+        ret[fields[i].substr( 0, pos )] = fields[i].substr( pos+1 );
           }
         }
-    
+
         return ret;
       }
-    
+
       /**
        * Join (key,value) map into string, using the separators defined
        * by opts_r.
        **/
       static std::string join( const map_type & kvmap_r,
-                          const KVMapPolicy & opts_r ) {
+                           const KVMapPolicy & opts_r ) {
         std::string ret;
-    
+
         for ( map_type::const_iterator it = kvmap_r.begin(); it != kvmap_r.end(); ++it ) {
           if ( ! ret.empty() ) {
-       ret += opts_r._fjoin;
+        ret += opts_r._fjoin;
           }
           ret += it->first;
           if ( !it->second.empty() ) {
-       ret += opts_r._kvjoin + it->second;
+        ret += opts_r._kvjoin + it->second;
           }
         }
-    
+
         return ret;
       }
-    
+
     };
 
 
@@ -174,7 +174,7 @@ namespace zypp {
    **/
   template<typename KVMapOpts>
   struct KVMap : public kvmap::KVMapBase {
-  
+
     KVMap()
     {}
     KVMap( const char * str_r )
@@ -186,13 +186,13 @@ namespace zypp {
     KVMap( const map_type & map_r )
       : kvmap::KVMapBase( map_r )
     {}
-  
+
     ~KVMap() {}
-  
+
     std::string asString() const {
       return join( *this, KVMapOpts() );
     }
-  
+
   };
 
   ///////////////////////////////////////////////////////////////////
index ca9da51..2768a7d 100644 (file)
@@ -13,11 +13,11 @@ namespace zypp {
 
     /** Is the context unknown? */
     bool empty() const { return _repoInfo.alias().empty(); }
-    
+
   public:
     const RepoInfo repoInfo() const { return _repoInfo; }
     void setRepoInfo(const RepoInfo & repoinfo) { _repoInfo = repoinfo; }
-  
+
   private:
     RepoInfo _repoInfo;
   };
index 272e514..af1ca18 100644 (file)
@@ -41,11 +41,11 @@ namespace zypp
       const char *version = gpgme_check_version(NULL);
       if ( version )
       {
-       MIL << "Initialized libgpgme version: " << version << endl;
+        MIL << "Initialized libgpgme version: " << version << endl;
       }
       else
       {
-       MIL << "Initialized libgpgme with unknown version" << endl;
+        MIL << "Initialized libgpgme with unknown version" << endl;
       }
     }
 
@@ -86,7 +86,7 @@ namespace zypp
       str << "  "  << obj.not_imported         << " keys not imported." << endl;
       for ( gpgme_import_status_t p = obj.imports; p; p = p->next )
       {
-       str << "  - "  << p->fpr << ": " << p->result << endl;
+        str << "  - "  << p->fpr << ": " << p->result << endl;
       }
       // In V.1.11: str << "  "  << obj.skipped_v3_keys        << " skipped v3 keys." << endl;
       return str << "}";
index 4a5999e..7082647 100644 (file)
@@ -32,29 +32,29 @@ namespace zypp
 class KeyManagerCtx
 {
     public:
-       /** Creates a new KeyManagerCtx for PGP using a volatile temp. homedir/keyring.
-        *
-        * Mainly used with methods, which need a context but do not need a keyring
-        * (like \ref readKeyFromFile or \ref readSignatureFingerprints).
-        *
-        * \note The underlying keyring is intentionally NOT the users keyring.
-        * Think of it as a volatile keyring whose content may get cleared anytime.
-        *
-        * \throws KeyRingException if context can not be created or set up
-        */
-       static KeyManagerCtx createForOpenPGP();
-
-       /** Creates a new KeyManagerCtx for PGP using a custom homedir/keyring.
-        *
-        * \note If you explicitly pass an empty \c Pathname, no homedir/keyring
-        * will be set and GPGME will use it's defaults.
-        *
-        * \throws KeyRingException if context can not be created or set up
-        */
-       static KeyManagerCtx createForOpenPGP( const Pathname & keyring_r );
-
-       /** Return the homedir/keyring. */
-       Pathname homedir() const;
+        /** Creates a new KeyManagerCtx for PGP using a volatile temp. homedir/keyring.
+         *
+         * Mainly used with methods, which need a context but do not need a keyring
+         * (like \ref readKeyFromFile or \ref readSignatureFingerprints).
+         *
+         * \note The underlying keyring is intentionally NOT the users keyring.
+         * Think of it as a volatile keyring whose content may get cleared anytime.
+         *
+         * \throws KeyRingException if context can not be created or set up
+         */
+        static KeyManagerCtx createForOpenPGP();
+
+        /** Creates a new KeyManagerCtx for PGP using a custom homedir/keyring.
+         *
+         * \note If you explicitly pass an empty \c Pathname, no homedir/keyring
+         * will be set and GPGME will use it's defaults.
+         *
+         * \throws KeyRingException if context can not be created or set up
+         */
+        static KeyManagerCtx createForOpenPGP( const Pathname & keyring_r );
+
+        /** Return the homedir/keyring. */
+        Pathname homedir() const;
 
         /**  Returns a list of all public keys found in the current keyring */
         std::list<PublicKeyData> listKeys();
index c03b86d..5d28f09 100644 (file)
@@ -100,8 +100,8 @@ namespace zypp
   }
 
   void KeyRingReport::reportAutoImportKey( const std::list<PublicKeyData> & keyDataList_r,
-                                          const PublicKeyData & keySigning_r,
-                                          const KeyContext &keyContext_r )
+                                           const PublicKeyData & keySigning_r,
+                                           const KeyContext &keyContext_r )
   {
     UserData data { REPORT_AUTO_IMPORT_KEY };
     data.set( "KeyDataList", keyDataList_r );
@@ -134,27 +134,27 @@ namespace zypp
       /// the context tags the cached data as dirty. Should be used to import/delete keys
       /// in a cache keyring.
       struct Manip {
-       NON_COPYABLE_BUT_MOVE( Manip );
-       Manip( CachedPublicKeyData & cache_r, Pathname keyring_r )
-       : _cache { cache_r }
-       , _keyring { std::move(keyring_r) }
-       {}
-
-       KeyManagerCtx & keyManagerCtx() {
-         if ( not _context ) {
-           _context = KeyManagerCtx::createForOpenPGP( _keyring );
-         }
-         // frankly: don't remember why an explicit setDirty was introduced and
-         // why WatchFile was not enough. Maybe some corner case when the keyrings
-         // are created?
-         _cache.setDirty( _keyring );
-         return _context.value();
-       }
+        NON_COPYABLE_BUT_MOVE( Manip );
+        Manip( CachedPublicKeyData & cache_r, Pathname keyring_r )
+        : _cache { cache_r }
+        , _keyring { std::move(keyring_r) }
+        {}
+
+        KeyManagerCtx & keyManagerCtx() {
+          if ( not _context ) {
+            _context = KeyManagerCtx::createForOpenPGP( _keyring );
+          }
+          // frankly: don't remember why an explicit setDirty was introduced and
+          // why WatchFile was not enough. Maybe some corner case when the keyrings
+          // are created?
+          _cache.setDirty( _keyring );
+          return _context.value();
+        }
 
       private:
-       CachedPublicKeyData & _cache;
-       Pathname _keyring;
-       std::optional<KeyManagerCtx> _context;
+        CachedPublicKeyData & _cache;
+        Pathname _keyring;
+        std::optional<KeyManagerCtx> _context;
       };
       ///////////////////////////////////////////////////////////////////
 
@@ -164,53 +164,53 @@ namespace zypp
     private:
       struct Cache
       {
-       Cache() {}
-
-       void setDirty()
-       {
-         _keyringK.reset();
-         _keyringP.reset();
-       }
-
-       void assertCache( const Pathname & keyring_r )
-       {
-         // .kbx since gpg2-2.1
-         if ( !_keyringK )
-           _keyringK.reset( new WatchFile( keyring_r/"pubring.kbx", WatchFile::NO_INIT ) );
-         if ( !_keyringP )
-           _keyringP.reset( new WatchFile( keyring_r/"pubring.gpg", WatchFile::NO_INIT ) );
-       }
-
-       bool hasChanged() const
-       {
-         bool k = _keyringK->hasChanged();     // be sure both files are checked
-         bool p = _keyringP->hasChanged();
-         return k || p;
-       }
-
-       std::list<PublicKeyData> _data;
+        Cache() {}
+
+        void setDirty()
+        {
+          _keyringK.reset();
+          _keyringP.reset();
+        }
+
+        void assertCache( const Pathname & keyring_r )
+        {
+          // .kbx since gpg2-2.1
+          if ( !_keyringK )
+            _keyringK.reset( new WatchFile( keyring_r/"pubring.kbx", WatchFile::NO_INIT ) );
+          if ( !_keyringP )
+            _keyringP.reset( new WatchFile( keyring_r/"pubring.gpg", WatchFile::NO_INIT ) );
+        }
+
+        bool hasChanged() const
+        {
+          bool k = _keyringK->hasChanged();    // be sure both files are checked
+          bool p = _keyringP->hasChanged();
+          return k || p;
+        }
+
+        std::list<PublicKeyData> _data;
 
       private:
 
-       scoped_ptr<WatchFile> _keyringK;
-       scoped_ptr<WatchFile> _keyringP;
+        scoped_ptr<WatchFile> _keyringK;
+        scoped_ptr<WatchFile> _keyringP;
       };
 
       typedef std::map<Pathname,Cache> CacheMap;
 
       const std::list<PublicKeyData> & getData( const Pathname & keyring_r ) const
       {
-       Cache & cache( _cacheMap[keyring_r] );
-       // init new cache entry
-       cache.assertCache( keyring_r );
-       return getData( keyring_r, cache );
+        Cache & cache( _cacheMap[keyring_r] );
+        // init new cache entry
+        cache.assertCache( keyring_r );
+        return getData( keyring_r, cache );
       }
 
       const std::list<PublicKeyData> & getData( const Pathname & keyring_r, Cache & cache_r ) const
       {
         if ( cache_r.hasChanged() ) {
-         cache_r._data = KeyManagerCtx::createForOpenPGP( keyring_r ).listKeys();
-         MIL << "Found keys: " << cache_r._data  << endl;
+          cache_r._data = KeyManagerCtx::createForOpenPGP( keyring_r ).listKeys();
+          MIL << "Found keys: " << cache_r._data  << endl;
         }
         return cache_r._data;
       }
@@ -344,16 +344,16 @@ namespace zypp
     {
       void operator()( const PublicKey & key_r )
       {
-       try {
-         _rpmdbEmitSignal->trustedKeyAdded( key_r );
-         _emitSignal->trustedKeyAdded( key_r );
-       }
-       catch ( const Exception & excp )
-       {
-         ERR << "Could not import key into rpmdb: " << excp << endl;
-         // TODO: JobReport as hotfix for bsc#1057188; should bubble up and go through some callback
-         JobReport::error( excp.asUserHistory() );
-       }
+        try {
+          _rpmdbEmitSignal->trustedKeyAdded( key_r );
+          _emitSignal->trustedKeyAdded( key_r );
+        }
+        catch ( const Exception & excp )
+        {
+          ERR << "Could not import key into rpmdb: " << excp << endl;
+          // TODO: JobReport as hotfix for bsc#1057188; should bubble up and go through some callback
+          JobReport::error( excp.asUserHistory() );
+        }
       }
 
     private:
@@ -373,14 +373,14 @@ namespace zypp
       ImportKeyCBHelper emitSignal;
       if ( key.hiddenKeys().empty() )
       {
-       emitSignal( key );
+        emitSignal( key );
       }
       else
       {
-       // multiple keys: Export individual keys ascii armored to import in rpmdb
-       emitSignal( exportKey( key, trustedKeyRing() ) );
-       for ( const PublicKeyData & hkey : key.hiddenKeys() )
-         emitSignal( exportKey( hkey, trustedKeyRing() ) );
+        // multiple keys: Export individual keys ascii armored to import in rpmdb
+        emitSignal( exportKey( key, trustedKeyRing() ) );
+        for ( const PublicKeyData & hkey : key.hiddenKeys() )
+          emitSignal( exportKey( hkey, trustedKeyRing() ) );
       }
     }
   }
@@ -431,8 +431,8 @@ namespace zypp
     {
       if ( key.providesKey( id ) )
       {
-       ret = key;
-       break;
+        ret = key;
+        break;
       }
     }
     DBG << (ret ? "Found" : "No") << " key [" << id << "] in keyring " << keyring << endl;
@@ -464,17 +464,17 @@ namespace zypp
     const str::regex rx { "^gpg-pubkey-([[:xdigit:]]{8,})(-[[:xdigit:]]{8,})?\\.(asc|key)$" };
     for ( const auto & cache : cachedirs ) {
       dirForEach( cache,
-                 [&rx,&keyCandidates]( const Pathname & dir_r, const char *const file_r )->bool {
-                   str::smatch what;
-                   if ( str::regex_match( file_r, what, rx ) ) {
-                     Pathname & remember { keyCandidates[what[1]] };
-                     if ( remember.empty() ) {
-                       remember = dir_r / file_r;
-                     }
-                   }
-                   return true;
-                 }
-               );
+                  [&rx,&keyCandidates]( const Pathname & dir_r, const char *const file_r )->bool {
+                    str::smatch what;
+                    if ( str::regex_match( file_r, what, rx ) ) {
+                      Pathname & remember { keyCandidates[what[1]] };
+                      if ( remember.empty() ) {
+                        remember = dir_r / file_r;
+                      }
+                    }
+                    return true;
+                  }
+                );
     }
 
     for ( const auto & p : keyCandidates ) {
@@ -483,12 +483,12 @@ namespace zypp
       const std::string & id { p.first };
       const Pathname & path { p.second };
       if ( isKeyTrusted(id) )
-       continue;
+        continue;
       if ( manip.keyManagerCtx().importKey( path ) ) {
-       DBG << "preload key file " << path << endl;
+        DBG << "preload key file " << path << endl;
       }
       else {
-       WAR << "Skipping: Can't preload key file " << path << endl;
+        WAR << "Skipping: Can't preload key file " << path << endl;
       }
     }
   }
@@ -554,21 +554,21 @@ namespace zypp
     std::list<PublicKeyData> buddies;  // Could be imported IFF the file is validated by a trusted key
     for ( const auto & sid : context_r.buddyKeys() ) {
       if ( not PublicKeyData::isSafeKeyId( sid ) ) {
-       WAR << "buddy " << sid << ": key id is too short to safely identify a gpg key. Skipping it." << endl;
-       continue;
+        WAR << "buddy " << sid << ": key id is too short to safely identify a gpg key. Skipping it." << endl;
+        continue;
       }
       if ( trustedPublicKeyExists( sid ) ) {
-       MIL << "buddy " << sid << ": already in trusted key ring. Not needed." << endl;
-       continue;
+        MIL << "buddy " << sid << ": already in trusted key ring. Not needed." << endl;
+        continue;
       }
       auto pk = publicKeyExists( sid );
       if ( not pk ) {
-       WAR << "buddy " << sid << ": not available in the public key ring. Skipping it." << endl;
-       continue;
+        WAR << "buddy " << sid << ": not available in the public key ring. Skipping it." << endl;
+        continue;
       }
       if ( pk.providesKey(id) ) {
-       MIL << "buddy " << sid << ": is the signing key. Handled separately." << endl;
-       continue;
+        MIL << "buddy " << sid << ": is the signing key. Handled separately." << endl;
+        continue;
       }
       MIL << "buddy " << sid << ": candidate for auto import. Remeber it." << endl;
       buddies.push_back( pk );
@@ -589,19 +589,19 @@ namespace zypp
         {
           // bnc #393160: Comment #30: Compare at least the fingerprint
           // in case an attacker created a key the the same id.
-         //
-         // FIXME: bsc#1008325: For keys using subkeys, we'd actually need
-         // to compare the subkey sets, to tell whether a key was updated.
-         // because created() remains unchanged if the primary key is not touched.
-         // For now we wait until a new subkey signs the data and treat it as a
-         //  new key (else part below).
+          //
+          // FIXME: bsc#1008325: For keys using subkeys, we'd actually need
+          // to compare the subkey sets, to tell whether a key was updated.
+          // because created() remains unchanged if the primary key is not touched.
+          // For now we wait until a new subkey signs the data and treat it as a
+          //  new key (else part below).
           if ( trustedKeyData.fingerprint() == generalKeyData.fingerprint()
-            && trustedKeyData.created() < generalKeyData.created() )
+             && trustedKeyData.created() < generalKeyData.created() )
           {
             MIL << "Key was updated. Saving new version into trusted keyring: " << generalKeyData << endl;
             importKey( exportKey( generalKeyData, generalKeyRing() ), true );
-           trustedKeyData = publicKeyExists( id, trustedKeyRing() ); // re-read: invalidated by import?
-         }
+            trustedKeyData = publicKeyExists( id, trustedKeyRing() ); // re-read: invalidated by import?
+          }
         }
 
         foundKey = trustedKeyData;
@@ -656,21 +656,21 @@ namespace zypp
       report->infoVerify( filedesc, foundKey, keyContext );
       if ( verifyFile( file, signature, whichKeyring ) )
       {
-       context_r.fileValidated( true );
-       if ( context_r.signatureIdTrusted() && not buddies.empty() ) {
-         // Check for buddy keys to be imported...
-         MIL << "Validated with trusted key: importing buddy list..." << endl;
-         report->reportAutoImportKey( buddies, foundKey, keyContext );
-         for ( const auto & kd : buddies ) {
-           importKey( exportKey( kd, generalKeyRing() ), true );
-         }
-       }
+        context_r.fileValidated( true );
+        if ( context_r.signatureIdTrusted() && not buddies.empty() ) {
+          // Check for buddy keys to be imported...
+          MIL << "Validated with trusted key: importing buddy list..." << endl;
+          report->reportAutoImportKey( buddies, foundKey, keyContext );
+          for ( const auto & kd : buddies ) {
+            importKey( exportKey( kd, generalKeyRing() ), true );
+          }
+        }
         return context_r.fileValidated();      // signature is actually successfully validated!
       }
       else
       {
-       bool res = report->askUserToAcceptVerificationFailed( filedesc, exportKey( foundKey, whichKeyring ), keyContext );
-       MIL << "askUserToAcceptVerificationFailed: " << res << endl;
+        bool res = report->askUserToAcceptVerificationFailed( filedesc, exportKey( foundKey, whichKeyring ), keyContext );
+        MIL << "askUserToAcceptVerificationFailed: " << res << endl;
         return res;
       }
     } else {
@@ -751,8 +751,8 @@ namespace zypp
     if ( ! PathInfo( keyfile ).isExist() )
       // TranslatorExplanation first %s is key name, second is keyring name
       ZYPP_THROW(KeyRingException( str::Format(_("Tried to import not existent key %s into keyring %s"))
-                                  % keyfile.asString()
-                                  % keyring.asString() ));
+                                   % keyfile.asString()
+                                   % keyring.asString() ));
 
     CachedPublicKeyData::Manip manip { keyRingManip( keyring ) }; // Provides the context if we want to manip a cached keyring.
     if ( ! manip.keyManagerCtx().importKey( keyfile ) )
index 955c8e5..9ae8e2a 100644 (file)
@@ -143,8 +143,8 @@ namespace zypp
       * "KeyContext"           The KeyContext
       */
      void reportAutoImportKey( const std::list<PublicKeyData> & keyDataList_r,
-                              const PublicKeyData & keySigning_r,
-                              const KeyContext &keyContext_r );
+                               const PublicKeyData & keySigning_r,
+                               const KeyContext &keyContext_r );
      /** \relates reportAutoImportKey generic reports UserData::type */
      constexpr static const char *REPORT_AUTO_IMPORT_KEY = "KeyRingReport/reportAutoImportKey";
   };
index c1b669b..88ed52b 100644 (file)
@@ -32,26 +32,26 @@ namespace zypp
       /** The singleton */
       static CodeMaps & instance()
       {
-       static CodeMaps _instance;
-       return _instance;
+        static CodeMaps _instance;
+        return _instance;
       }
 
       /** Lookup (translated) name for \a index_r.*/
       std::string name( IdString index_r )
       {
-       Link link( getIndex( index_r ) );
+        Link link( getIndex( index_r ) );
 
-       std::string ret;
-       if ( link->second )
-       { ret = _(link->second); }
-       else
-       {
-         ret = _("Unknown language: ");
-         ret += "'";
-         ret += index_r.c_str();
-         ret += "'";
-       }
-       return ret;
+        std::string ret;
+        if ( link->second )
+        { ret = _(link->second); }
+        else
+        {
+          ret = _("Unknown language: ");
+          ret += "'";
+          ret += index_r.c_str();
+          ret += "'";
+        }
+        return ret;
       }
 
     private:
@@ -68,39 +68,39 @@ namespace zypp
       /** Return \ref Link for \a index_r, creating it if necessary. */
       Link getIndex( IdString index_r )
       {
-       auto it = _indexMap.find( index_r );
-       return( it != _indexMap.end()
-             ? it->second
-             : newIndex( index_r, index_r.asString() ) );
+        auto it = _indexMap.find( index_r );
+        return( it != _indexMap.end()
+              ? it->second
+              : newIndex( index_r, index_r.asString() ) );
       }
 
       /** Return the CodeMap Index for \a code_r. */
       Link newIndex( IdString index_r, const std::string & code_r )
       {
-       Link link = _codeMap.find( code_r );
-       if ( link != _codeMap.end() )
-         return (_indexMap[index_r] = link);
+        Link link = _codeMap.find( code_r );
+        if ( link != _codeMap.end() )
+          return (_indexMap[index_r] = link);
 
-       // not found: Remember a new code
-       CodeMap::value_type nval( code_r, nullptr );
+        // not found: Remember a new code
+        CodeMap::value_type nval( code_r, nullptr );
 
-       if ( code_r.size() > 3 || code_r.size() < 2 )
-         WAR << "Malformed LanguageCode '" << code_r << "' (expect 2 or 3-letter)" << endl;
+        if ( code_r.size() > 3 || code_r.size() < 2 )
+          WAR << "Malformed LanguageCode '" << code_r << "' (expect 2 or 3-letter)" << endl;
 
-       std::string lcode( str::toLower( code_r ) );
-       if ( lcode != code_r )
-       {
-         WAR << "Malformed LanguageCode '" << code_r << "' (not lower case)" << endl;
-         // but maybe we're lucky with the lower case code
-         // and find a language name.
-         link = _codeMap.find( lcode );
-         if ( link != _codeMap.end() )
-         {
-           nval.second = link->second;
-         }
-       }
-       MIL << "Remember LanguageCode '" << code_r << "': '" << (nval.second?nval.second:"Unknown language") << "'" << endl;
-       return (_indexMap[index_r] = _codeMap.insert( nval ).first);
+        std::string lcode( str::toLower( code_r ) );
+        if ( lcode != code_r )
+        {
+          WAR << "Malformed LanguageCode '" << code_r << "' (not lower case)" << endl;
+          // but maybe we're lucky with the lower case code
+          // and find a language name.
+          link = _codeMap.find( lcode );
+          if ( link != _codeMap.end() )
+          {
+            nval.second = link->second;
+          }
+        }
+        MIL << "Remember LanguageCode '" << code_r << "': '" << (nval.second?nval.second:"Unknown language") << "'" << endl;
+        return (_indexMap[index_r] = _codeMap.insert( nval ).first);
       }
 
     private:
@@ -149,1014 +149,1014 @@ namespace zypp
 
       struct LangInit
       {
-         const char *iso639_2;
-         const char *iso639_1;
-         const char *name;
+          const char *iso639_2;
+          const char *iso639_1;
+          const char *name;
       };
 
       // some languages have more than one iso639_2 code
       // so there are items with duplicate names
       const LangInit langInit[] = {
-         // language code: aar aa
-         { "aar", "aa", N_( "Afar" ) },
-         // language code: abk ab
-         { "abk", "ab", N_( "Abkhazian" ) },
-         // language code: ace
-         { "ace", NULL, N_( "Achinese" ) },
-         // language code: ach
-         { "ach", NULL, N_( "Acoli" ) },
-         // language code: ada
-         { "ada", NULL, N_( "Adangme" ) },
-         // language code: ady
-         { "ady", NULL, N_( "Adyghe" ) },
-         // language code: afa
-         { "afa", NULL, N_( "Afro-Asiatic (Other)" ) },
-         // language code: afh
-         { "afh", NULL, N_( "Afrihili" ) },
-         // language code: afr af
-         { "afr", "af", N_( "Afrikaans" ) },
-         // language code: ain
-         { "ain", NULL, N_( "Ainu" ) },
-         // language code: aka ak
-         { "aka", "ak", N_( "Akan" ) },
-         // language code: akk
-         { "akk", NULL, N_( "Akkadian" ) },
-         // language code: alb sqi sq
-         { "alb", "sq", N_( "Albanian" ) },
-         // language code: alb sqi sq
-         { "sqi", NULL, N_( "Albanian" ) },
-         // language code: ale
-         { "ale", NULL, N_( "Aleut" ) },
-         // language code: alg
-         { "alg", NULL, N_( "Algonquian Languages" ) },
-         // language code: alt
-         { "alt", NULL, N_( "Southern Altai" ) },
-         // language code: amh am
-         { "amh", "am", N_( "Amharic" ) },
-         // language code: ang
-         { "ang", NULL, N_( "English, Old (ca.450-1100)" ) },
-         // language code: apa
-         { "apa", NULL, N_( "Apache Languages" ) },
-         // language code: ara ar
-         { "ara", "ar", N_( "Arabic" ) },
-         // language code: arc
-         { "arc", NULL, N_( "Aramaic" ) },
-         // language code: arg an
-         { "arg", "an", N_( "Aragonese" ) },
-         // language code: arm hye hy
-         { "arm", "hy", N_( "Armenian" ) },
-         // language code: arm hye hy
-         { "hye", NULL, N_( "Armenian" ) },
-         // language code: arn
-         { "arn", NULL, N_( "Araucanian" ) },
-         // language code: arp
-         { "arp", NULL, N_( "Arapaho" ) },
-         // language code: art
-         { "art", NULL, N_( "Artificial (Other)" ) },
-         // language code: arw
-         { "arw", NULL, N_( "Arawak" ) },
-         // language code: asm as
-         { "asm", "as", N_( "Assamese" ) },
-         // language code: ast
-         { "ast", NULL, N_( "Asturian" ) },
-         // language code: ath
-         { "ath", NULL, N_( "Athapascan Languages" ) },
-         // language code: aus
-         { "aus", NULL, N_( "Australian Languages" ) },
-         // language code: ava av
-         { "ava", "av", N_( "Avaric" ) },
-         // language code: ave ae
-         { "ave", "ae", N_( "Avestan" ) },
-         // language code: awa
-         { "awa", NULL, N_( "Awadhi" ) },
-         // language code: aym ay
-         { "aym", "ay", N_( "Aymara" ) },
-         // language code: aze az
-         { "aze", "az", N_( "Azerbaijani" ) },
-         // language code: bad
-         { "bad", NULL, N_( "Banda" ) },
-         // language code: bai
-         { "bai", NULL, N_( "Bamileke Languages" ) },
-         // language code: bak ba
-         { "bak", "ba", N_( "Bashkir" ) },
-         // language code: bal
-         { "bal", NULL, N_( "Baluchi" ) },
-         // language code: bam bm
-         { "bam", "bm", N_( "Bambara" ) },
-         // language code: ban
-         { "ban", NULL, N_( "Balinese" ) },
-         // language code: baq eus eu
-         { "baq", "eu", N_( "Basque" ) },
-         // language code: baq eus eu
-         { "eus", NULL, N_( "Basque" ) },
-         // language code: bas
-         { "bas", NULL, N_( "Basa" ) },
-         // language code: bat
-         { "bat", NULL, N_( "Baltic (Other)" ) },
-         // language code: bej
-         { "bej", NULL, N_( "Beja" ) },
-         // language code: bel be
-         { "bel", "be", N_( "Belarusian" ) },
-         // language code: bem
-         { "bem", NULL, N_( "Bemba" ) },
-         // language code: ben bn
-         { "ben", "bn", N_( "Bengali" ) },
-         // language code: ber
-         { "ber", NULL, N_( "Berber (Other)" ) },
-         // language code: bho
-         { "bho", NULL, N_( "Bhojpuri" ) },
-         // language code: bih bh
-         { "bih", "bh", N_( "Bihari" ) },
-         // language code: bik
-         { "bik", NULL, N_( "Bikol" ) },
-         // language code: bin
-         { "bin", NULL, N_( "Bini" ) },
-         // language code: bis bi
-         { "bis", "bi", N_( "Bislama" ) },
-         // language code: bla
-         { "bla", NULL, N_( "Siksika" ) },
-         // language code: bnt
-         { "bnt", NULL, N_( "Bantu (Other)" ) },
-         // language code: bos bs
-         { "bos", "bs", N_( "Bosnian" ) },
-         // language code: bra
-         { "bra", NULL, N_( "Braj" ) },
-         // language code: bre br
-         { "bre", "br", N_( "Breton" ) },
-         // language code: btk
-         { "btk", NULL, N_( "Batak (Indonesia)" ) },
-         // language code: bua
-         { "bua", NULL, N_( "Buriat" ) },
-         // language code: bug
-         { "bug", NULL, N_( "Buginese" ) },
-         // language code: bul bg
-         { "bul", "bg", N_( "Bulgarian" ) },
-         // language code: bur mya my
-         { "bur", "my", N_( "Burmese" ) },
-         // language code: bur mya my
-         { "mya", NULL, N_( "Burmese" ) },
-         // language code: byn
-         { "byn", NULL, N_( "Blin" ) },
-         // language code: cad
-         { "cad", NULL, N_( "Caddo" ) },
-         // language code: cai
-         { "cai", NULL, N_( "Central American Indian (Other)" ) },
-         // language code: car
-         { "car", NULL, N_( "Carib" ) },
-         // language code: cat ca
-         { "cat", "ca", N_( "Catalan" ) },
-         // language code: cau
-         { "cau", NULL, N_( "Caucasian (Other)" ) },
-         // language code: ceb
-         { "ceb", NULL, N_( "Cebuano" ) },
-         // language code: cel
-         { "cel", NULL, N_( "Celtic (Other)" ) },
-         // language code: cha ch
-         { "cha", "ch", N_( "Chamorro" ) },
-         // language code: chb
-         { "chb", NULL, N_( "Chibcha" ) },
-         // language code: che ce
-         { "che", "ce", N_( "Chechen" ) },
-         // language code: chg
-         { "chg", NULL, N_( "Chagatai" ) },
-         // language code: chi zho zh
-         { "chi", "zh", N_( "Chinese" ) },
-         // language code: chi zho zh
-         { "zho", NULL, N_( "Chinese" ) },
-         // language code: chk
-         { "chk", NULL, N_( "Chuukese" ) },
-         // language code: chm
-         { "chm", NULL, N_( "Mari" ) },
-         // language code: chn
-         { "chn", NULL, N_( "Chinook Jargon" ) },
-         // language code: cho
-         { "cho", NULL, N_( "Choctaw" ) },
-         // language code: chp
-         { "chp", NULL, N_( "Chipewyan" ) },
-         // language code: chr
-         { "chr", NULL, N_( "Cherokee" ) },
-         // language code: chu cu
-         { "chu", "cu", N_( "Church Slavic" ) },
-         // language code: chv cv
-         { "chv", "cv", N_( "Chuvash" ) },
-         // language code: chy
-         { "chy", NULL, N_( "Cheyenne" ) },
-         // language code: cmc
-         { "cmc", NULL, N_( "Chamic Languages" ) },
-         // language code: cop
-         { "cop", NULL, N_( "Coptic" ) },
-         // language code: cor kw
-         { "cor", "kw", N_( "Cornish" ) },
-         // language code: cos co
-         { "cos", "co", N_( "Corsican" ) },
-         // language code: cpe
-         { "cpe", NULL, N_( "Creoles and Pidgins, English-Based (Other)" ) },
-         // language code: cpf
-         { "cpf", NULL, N_( "Creoles and Pidgins, French-Based (Other)" ) },
-         // language code: cpp
-         { "cpp", NULL, N_( "Creoles and Pidgins, Portuguese-Based (Other)" ) },
-         // language code: cre cr
-         { "cre", "cr", N_( "Cree" ) },
-         // language code: crh
-         { "crh", NULL, N_( "Crimean Tatar" ) },
-         // language code: crp
-         { "crp", NULL, N_( "Creoles and Pidgins (Other)" ) },
-         // language code: csb
-         { "csb", NULL, N_( "Kashubian" ) },
-         // language code: cus
-         { "cus", NULL, N_( "Cushitic (Other)" ) },
-         // language code: cze ces cs
-         { "cze", "cs", N_( "Czech" ) },
-         // language code: cze ces cs
-         { "ces", NULL, N_( "Czech" ) },
-         // language code: dak
-         { "dak", NULL, N_( "Dakota" ) },
-         // language code: dan da
-         { "dan", "da", N_( "Danish" ) },
-         // language code: dar
-         { "dar", NULL, N_( "Dargwa" ) },
-         // language code: day
-         { "day", NULL, N_( "Dayak" ) },
-         // language code: del
-         { "del", NULL, N_( "Delaware" ) },
-         // language code: den
-         { "den", NULL, N_( "Slave (Athapascan)" ) },
-         // language code: dgr
-         { "dgr", NULL, N_( "Dogrib" ) },
-         // language code: din
-         { "din", NULL, N_( "Dinka" ) },
-         // language code: div dv
-         { "div", "dv", N_( "Divehi" ) },
-         // language code: doi
-         { "doi", NULL, N_( "Dogri" ) },
-         // language code: dra
-         { "dra", NULL, N_( "Dravidian (Other)" ) },
-         // language code: dsb
-         { "dsb", NULL, N_( "Lower Sorbian" ) },
-         // language code: dua
-         { "dua", NULL, N_( "Duala" ) },
-         // language code: dum
-         { "dum", NULL, N_( "Dutch, Middle (ca.1050-1350)" ) },
-         // language code: dut nld nl
-         { "dut", "nl", N_( "Dutch" ) },
-         // language code: dut nld nl
-         { "nld", NULL, N_( "Dutch" ) },
-         // language code: dyu
-         { "dyu", NULL, N_( "Dyula" ) },
-         // language code: dzo dz
-         { "dzo", "dz", N_( "Dzongkha" ) },
-         // language code: efi
-         { "efi", NULL, N_( "Efik" ) },
-         // language code: egy
-         { "egy", NULL, N_( "Egyptian (Ancient)" ) },
-         // language code: eka
-         { "eka", NULL, N_( "Ekajuk" ) },
-         // language code: elx
-         { "elx", NULL, N_( "Elamite" ) },
-         // language code: eng en
-         { "eng", "en", N_( "English" ) },
-         // language code: enm
-         { "enm", NULL, N_( "English, Middle (1100-1500)" ) },
-         // language code: epo eo
-         { "epo", "eo", N_( "Esperanto" ) },
-         // language code: est et
-         { "est", "et", N_( "Estonian" ) },
-         // language code: ewe ee
-         { "ewe", "ee", N_( "Ewe" ) },
-         // language code: ewo
-         { "ewo", NULL, N_( "Ewondo" ) },
-         // language code: fan
-         { "fan", NULL, N_( "Fang" ) },
-         // language code: fao fo
-         { "fao", "fo", N_( "Faroese" ) },
-         // language code: fat
-         { "fat", NULL, N_( "Fanti" ) },
-         // language code: fij fj
-         { "fij", "fj", N_( "Fijian" ) },
-         // language code: fil
-         { "fil", NULL, N_( "Filipino" ) },
-         // language code: fin fi
-         { "fin", "fi", N_( "Finnish" ) },
-         // language code: fiu
-         { "fiu", NULL, N_( "Finno-Ugrian (Other)" ) },
-         // language code: fon
-         { "fon", NULL, N_( "Fon" ) },
-         // language code: fre fra fr
-         { "fre", "fr", N_( "French" ) },
-         // language code: fre fra fr
-         { "fra", NULL, N_( "French" ) },
-         // language code: frm
-         { "frm", NULL, N_( "French, Middle (ca.1400-1600)" ) },
-         // language code: fro
-         { "fro", NULL, N_( "French, Old (842-ca.1400)" ) },
-         // language code: fry fy
-         { "fry", "fy", N_( "Frisian" ) },
-         // language code: ful ff
-         { "ful", "ff", N_( "Fulah" ) },
-         // language code: fur
-         { "fur", NULL, N_( "Friulian" ) },
-         // language code: gaa
-         { "gaa", NULL, N_( "Ga" ) },
-         // language code: gay
-         { "gay", NULL, N_( "Gayo" ) },
-         // language code: gba
-         { "gba", NULL, N_( "Gbaya" ) },
-         // language code: gem
-         { "gem", NULL, N_( "Germanic (Other)" ) },
-         // language code: geo kat ka
-         { "geo", "ka", N_( "Georgian" ) },
-         // language code: geo kat ka
-         { "kat", NULL, N_( "Georgian" ) },
-         // language code: ger deu de
-         { "ger", "de", N_( "German" ) },
-         // language code: ger deu de
-         { "deu", NULL, N_( "German" ) },
-         // language code: gez
-         { "gez", NULL, N_( "Geez" ) },
-         // language code: gil
-         { "gil", NULL, N_( "Gilbertese" ) },
-         // language code: gla gd
-         { "gla", "gd", N_( "Gaelic" ) },
-         // language code: gle ga
-         { "gle", "ga", N_( "Irish" ) },
-         // language code: glg gl
-         { "glg", "gl", N_( "Galician" ) },
-         // language code: glv gv
-         { "glv", "gv", N_( "Manx" ) },
-         // language code: gmh
-         { "gmh", NULL, N_( "German, Middle High (ca.1050-1500)" ) },
-         // language code: goh
-         { "goh", NULL, N_( "German, Old High (ca.750-1050)" ) },
-         // language code: gon
-         { "gon", NULL, N_( "Gondi" ) },
-         // language code: gor
-         { "gor", NULL, N_( "Gorontalo" ) },
-         // language code: got
-         { "got", NULL, N_( "Gothic" ) },
-         // language code: grb
-         { "grb", NULL, N_( "Grebo" ) },
-         // language code: grc
-         { "grc", NULL, N_( "Greek, Ancient (to 1453)" ) },
-         // language code: gre ell el
-         { "gre", "el", N_( "Greek, Modern (1453-)" ) },
-         // language code: gre ell el
-         { "ell", NULL, N_( "Greek, Modern (1453-)" ) },
-         // language code: grn gn
-         { "grn", "gn", N_( "Guarani" ) },
-         // language code: guj gu
-         { "guj", "gu", N_( "Gujarati" ) },
-         // language code: gwi
-         { "gwi", NULL, N_( "Gwich'in" ) },
-         // language code: hai
-         { "hai", NULL, N_( "Haida" ) },
-         // language code: hat ht
-         { "hat", "ht", N_( "Haitian" ) },
-         // language code: hau ha
-         { "hau", "ha", N_( "Hausa" ) },
-         // language code: haw
-         { "haw", NULL, N_( "Hawaiian" ) },
-         // language code: heb he
-         { "heb", "he", N_( "Hebrew" ) },
-         // language code: her hz
-         { "her", "hz", N_( "Herero" ) },
-         // language code: hil
-         { "hil", NULL, N_( "Hiligaynon" ) },
-         // language code: him
-         { "him", NULL, N_( "Himachali" ) },
-         // language code: hin hi
-         { "hin", "hi", N_( "Hindi" ) },
-         // language code: hit
-         { "hit", NULL, N_( "Hittite" ) },
-         // language code: hmn
-         { "hmn", NULL, N_( "Hmong" ) },
-         // language code: hmo ho
-         { "hmo", "ho", N_( "Hiri Motu" ) },
-         // language code: hsb
-         { "hsb", NULL, N_( "Upper Sorbian" ) },
-         // language code: hun hu
-         { "hun", "hu", N_( "Hungarian" ) },
-         // language code: hup
-         { "hup", NULL, N_( "Hupa" ) },
-         // language code: iba
-         { "iba", NULL, N_( "Iban" ) },
-         // language code: ibo ig
-         { "ibo", "ig", N_( "Igbo" ) },
-         // language code: ice isl is
-         { "ice", "is", N_( "Icelandic" ) },
-         // language code: ice isl is
-         { "isl", NULL, N_( "Icelandic" ) },
-         // language code: ido io
-         { "ido", "io", N_( "Ido" ) },
-         // language code: iii ii
-         { "iii", "ii", N_( "Sichuan Yi" ) },
-         // language code: ijo
-         { "ijo", NULL, N_( "Ijo" ) },
-         // language code: iku iu
-         { "iku", "iu", N_( "Inuktitut" ) },
-         // language code: ile ie
-         { "ile", "ie", N_( "Interlingue" ) },
-         // language code: ilo
-         { "ilo", NULL, N_( "Iloko" ) },
-         // language code: ina ia
-         { "ina", "ia", N_( "Interlingua (International Auxiliary Language Association)" ) },
-         // language code: inc
-         { "inc", NULL, N_( "Indic (Other)" ) },
-         // language code: ind id
-         { "ind", "id", N_( "Indonesian" ) },
-         // language code: ine
-         { "ine", NULL, N_( "Indo-European (Other)" ) },
-         // language code: inh
-         { "inh", NULL, N_( "Ingush" ) },
-         // language code: ipk ik
-         { "ipk", "ik", N_( "Inupiaq" ) },
-         // language code: ira
-         { "ira", NULL, N_( "Iranian (Other)" ) },
-         // language code: iro
-         { "iro", NULL, N_( "Iroquoian Languages" ) },
-         // language code: ita it
-         { "ita", "it", N_( "Italian" ) },
-         // language code: jav jv
-         { "jav", "jv", N_( "Javanese" ) },
-         // language code: jbo
-         { "jbo", NULL, N_( "Lojban" ) },
-         // language code: jpn ja
-         { "jpn", "ja", N_( "Japanese" ) },
-         // language code: jpr
-         { "jpr", NULL, N_( "Judeo-Persian" ) },
-         // language code: jrb
-         { "jrb", NULL, N_( "Judeo-Arabic" ) },
-         // language code: kaa
-         { "kaa", NULL, N_( "Kara-Kalpak" ) },
-         // language code: kab
-         { "kab", NULL, N_( "Kabyle" ) },
-         // language code: kac
-         { "kac", NULL, N_( "Kachin" ) },
-         // language code: kal kl
-         { "kal", "kl", N_( "Kalaallisut" ) },
-         // language code: kam
-         { "kam", NULL, N_( "Kamba" ) },
-         // language code: kan kn
-         { "kan", "kn", N_( "Kannada" ) },
-         // language code: kar
-         { "kar", NULL, N_( "Karen" ) },
-         // language code: kas ks
-         { "kas", "ks", N_( "Kashmiri" ) },
-         // language code: kau kr
-         { "kau", "kr", N_( "Kanuri" ) },
-         // language code: kaw
-         { "kaw", NULL, N_( "Kawi" ) },
-         // language code: kaz kk
-         { "kaz", "kk", N_( "Kazakh" ) },
-         // language code: kbd
-         { "kbd", NULL, N_( "Kabardian" ) },
-         // language code: kha
-         { "kha", NULL, N_( "Khasi" ) },
-         // language code: khi
-         { "khi", NULL, N_( "Khoisan (Other)" ) },
-         // language code: khm km
-         { "khm", "km", N_( "Khmer" ) },
-         // language code: kho
-         { "kho", NULL, N_( "Khotanese" ) },
-         // language code: kik ki
-         { "kik", "ki", N_( "Kikuyu" ) },
-         // language code: kin rw
-         { "kin", "rw", N_( "Kinyarwanda" ) },
-         // language code: kir ky
-         { "kir", "ky", N_( "Kirghiz" ) },
-         // language code: kmb
-         { "kmb", NULL, N_( "Kimbundu" ) },
-         // language code: kok
-         { "kok", NULL, N_( "Konkani" ) },
-         // language code: kom kv
-         { "kom", "kv", N_( "Komi" ) },
-         // language code: kon kg
-         { "kon", "kg", N_( "Kongo" ) },
-         // language code: kor ko
-         { "kor", "ko", N_( "Korean" ) },
-         // language code: kos
-         { "kos", NULL, N_( "Kosraean" ) },
-         // language code: kpe
-         { "kpe", NULL, N_( "Kpelle" ) },
-         // language code: krc
-         { "krc", NULL, N_( "Karachay-Balkar" ) },
-         // language code: kro
-         { "kro", NULL, N_( "Kru" ) },
-         // language code: kru
-         { "kru", NULL, N_( "Kurukh" ) },
-         // language code: kua kj
-         { "kua", "kj", N_( "Kuanyama" ) },
-         // language code: kum
-         { "kum", NULL, N_( "Kumyk" ) },
-         // language code: kur ku
-         { "kur", "ku", N_( "Kurdish" ) },
-         // language code: kut
-         { "kut", NULL, N_( "Kutenai" ) },
-         // language code: lad
-         { "lad", NULL, N_( "Ladino" ) },
-         // language code: lah
-         { "lah", NULL, N_( "Lahnda" ) },
-         // language code: lam
-         { "lam", NULL, N_( "Lamba" ) },
-         // language code: lao lo
-         { "lao", "lo", N_( "Lao" ) },
-         // language code: lat la
-         { "lat", "la", N_( "Latin" ) },
-         // language code: lav lv
-         { "lav", "lv", N_( "Latvian" ) },
-         // language code: lez
-         { "lez", NULL, N_( "Lezghian" ) },
-         // language code: lim li
-         { "lim", "li", N_( "Limburgan" ) },
-         // language code: lin ln
-         { "lin", "ln", N_( "Lingala" ) },
-         // language code: lit lt
-         { "lit", "lt", N_( "Lithuanian" ) },
-         // language code: lol
-         { "lol", NULL, N_( "Mongo" ) },
-         // language code: loz
-         { "loz", NULL, N_( "Lozi" ) },
-         // language code: ltz lb
-         { "ltz", "lb", N_( "Luxembourgish" ) },
-         // language code: lua
-         { "lua", NULL, N_( "Luba-Lulua" ) },
-         // language code: lub lu
-         { "lub", "lu", N_( "Luba-Katanga" ) },
-         // language code: lug lg
-         { "lug", "lg", N_( "Ganda" ) },
-         // language code: lui
-         { "lui", NULL, N_( "Luiseno" ) },
-         // language code: lun
-         { "lun", NULL, N_( "Lunda" ) },
-         // language code: luo
-         { "luo", NULL, N_( "Luo (Kenya and Tanzania)" ) },
-         // language code: lus
-         { "lus", NULL, N_( "Lushai" ) },
-         // language code: mac mkd mk
-         { "mac", "mk", N_( "Macedonian" ) },
-         // language code: mac mkd mk
-         { "mkd", NULL, N_( "Macedonian" ) },
-         // language code: mad
-         { "mad", NULL, N_( "Madurese" ) },
-         // language code: mag
-         { "mag", NULL, N_( "Magahi" ) },
-         // language code: mah mh
-         { "mah", "mh", N_( "Marshallese" ) },
-         // language code: mai
-         { "mai", NULL, N_( "Maithili" ) },
-         // language code: mak
-         { "mak", NULL, N_( "Makasar" ) },
-         // language code: mal ml
-         { "mal", "ml", N_( "Malayalam" ) },
-         // language code: man
-         { "man", NULL, N_( "Mandingo" ) },
-         // language code: mao mri mi
-         { "mao", "mi", N_( "Maori" ) },
-         // language code: mao mri mi
-         { "mri", NULL, N_( "Maori" ) },
-         // language code: map
-         { "map", NULL, N_( "Austronesian (Other)" ) },
-         // language code: mar mr
-         { "mar", "mr", N_( "Marathi" ) },
-         // language code: mas
-         { "mas", NULL, N_( "Masai" ) },
-         // language code: may msa ms
-         { "may", "ms", N_( "Malay" ) },
-         // language code: may msa ms
-         { "msa", NULL, N_( "Malay" ) },
-         // language code: mdf
-         { "mdf", NULL, N_( "Moksha" ) },
-         // language code: mdr
-         { "mdr", NULL, N_( "Mandar" ) },
-         // language code: men
-         { "men", NULL, N_( "Mende" ) },
-         // language code: mga
-         { "mga", NULL, N_( "Irish, Middle (900-1200)" ) },
-         // language code: mic
-         { "mic", NULL, N_( "Mi'kmaq" ) },
-         // language code: min
-         { "min", NULL, N_( "Minangkabau" ) },
-         // language code: mis
-         { "mis", NULL, N_( "Miscellaneous Languages" ) },
-         // language code: mkh
-         { "mkh", NULL, N_( "Mon-Khmer (Other)" ) },
-         // language code: mlg mg
-         { "mlg", "mg", N_( "Malagasy" ) },
-         // language code: mlt mt
-         { "mlt", "mt", N_( "Maltese" ) },
-         // language code: mnc
-         { "mnc", NULL, N_( "Manchu" ) },
-         // language code: mni
-         { "mni", NULL, N_( "Manipuri" ) },
-         // language code: mno
-         { "mno", NULL, N_( "Manobo Languages" ) },
-         // language code: moh
-         { "moh", NULL, N_( "Mohawk" ) },
-         // language code: mol mo
-         { "mol", "mo", N_( "Moldavian" ) },
-         // language code: mon mn
-         { "mon", "mn", N_( "Mongolian" ) },
-         // language code: mos
-         { "mos", NULL, N_( "Mossi" ) },
-         // language code: mul
-         { "mul", NULL, N_( "Multiple Languages" ) },
-         // language code: mun
-         { "mun", NULL, N_( "Munda languages" ) },
-         // language code: mus
-         { "mus", NULL, N_( "Creek" ) },
-         // language code: mwl
-         { "mwl", NULL, N_( "Mirandese" ) },
-         // language code: mwr
-         { "mwr", NULL, N_( "Marwari" ) },
-         // language code: myn
-         { "myn", NULL, N_( "Mayan Languages" ) },
-         // language code: myv
-         { "myv", NULL, N_( "Erzya" ) },
-         // language code: nah
-         { "nah", NULL, N_( "Nahuatl" ) },
-         // language code: nai
-         { "nai", NULL, N_( "North American Indian" ) },
-         // language code: nap
-         { "nap", NULL, N_( "Neapolitan" ) },
-         // language code: nau na
-         { "nau", "na", N_( "Nauru" ) },
-         // language code: nav nv
-         { "nav", "nv", N_( "Navajo" ) },
-         // language code: nbl nr
-         { "nbl", "nr", N_( "Ndebele, South" ) },
-         // language code: nde nd
-         { "nde", "nd", N_( "Ndebele, North" ) },
-         // language code: ndo ng
-         { "ndo", "ng", N_( "Ndonga" ) },
-         // language code: nds
-         { "nds", NULL, N_( "Low German" ) },
-         // language code: nep ne
-         { "nep", "ne", N_( "Nepali" ) },
-         // language code: new
-         { "new", NULL, N_( "Nepal Bhasa" ) },
-         // language code: nia
-         { "nia", NULL, N_( "Nias" ) },
-         // language code: nic
-         { "nic", NULL, N_( "Niger-Kordofanian (Other)" ) },
-         // language code: niu
-         { "niu", NULL, N_( "Niuean" ) },
-         // language code: nno nn
-         { "nno", "nn", N_( "Norwegian Nynorsk" ) },
-         // language code: nob nb
-         { "nob", "nb", N_( "Norwegian Bokmal" ) },
-         // language code: nog
-         { "nog", NULL, N_( "Nogai" ) },
-         // language code: non
-         { "non", NULL, N_( "Norse, Old" ) },
-         // language code: nor no
-         { "nor", "no", N_( "Norwegian" ) },
-         // language code: nso
-         { "nso", NULL, N_( "Northern Sotho" ) },
-         // language code: nub
-         { "nub", NULL, N_( "Nubian Languages" ) },
-         // language code: nwc
-         { "nwc", NULL, N_( "Classical Newari" ) },
-         // language code: nya ny
-         { "nya", "ny", N_( "Chichewa" ) },
-         // language code: nym
-         { "nym", NULL, N_( "Nyamwezi" ) },
-         // language code: nyn
-         { "nyn", NULL, N_( "Nyankole" ) },
-         // language code: nyo
-         { "nyo", NULL, N_( "Nyoro" ) },
-         // language code: nzi
-         { "nzi", NULL, N_( "Nzima" ) },
-         // language code: oci oc
-         { "oci", "oc", N_( "Occitan (post 1500)" ) },
-         // language code: oji oj
-         { "oji", "oj", N_( "Ojibwa" ) },
-         // language code: ori or
-         { "ori", "or", N_( "Oriya" ) },
-         // language code: orm om
-         { "orm", "om", N_( "Oromo" ) },
-         // language code: osa
-         { "osa", NULL, N_( "Osage" ) },
-         // language code: oss os
-         { "oss", "os", N_( "Ossetian" ) },
-         // language code: ota
-         { "ota", NULL, N_( "Turkish, Ottoman (1500-1928)" ) },
-         // language code: oto
-         { "oto", NULL, N_( "Otomian Languages" ) },
-         // language code: paa
-         { "paa", NULL, N_( "Papuan (Other)" ) },
-         // language code: pag
-         { "pag", NULL, N_( "Pangasinan" ) },
-         // language code: pal
-         { "pal", NULL, N_( "Pahlavi" ) },
-         // language code: pam
-         { "pam", NULL, N_( "Pampanga" ) },
-         // language code: pan pa
-         { "pan", "pa", N_( "Panjabi" ) },
-         // language code: pap
-         { "pap", NULL, N_( "Papiamento" ) },
-         // language code: pau
-         { "pau", NULL, N_( "Palauan" ) },
-         // language code: peo
-         { "peo", NULL, N_( "Persian, Old (ca.600-400 B.C.)" ) },
-         // language code: per fas fa
-         { "per", "fa", N_( "Persian" ) },
-         // language code: per fas fa
-         { "fas", NULL, N_( "Persian" ) },
-         // language code: phi
-         { "phi", NULL, N_( "Philippine (Other)" ) },
-         // language code: phn
-         { "phn", NULL, N_( "Phoenician" ) },
-         // language code: pli pi
-         { "pli", "pi", N_( "Pali" ) },
-         // language code: pol pl
-         { "pol", "pl", N_( "Polish" ) },
-         // language code: pon
-         { "pon", NULL, N_( "Pohnpeian" ) },
-         // language code: por pt
-         { "por", "pt", N_( "Portuguese" ) },
-         // language code: pra
-         { "pra", NULL, N_( "Prakrit Languages" ) },
-         // language code: pro
-         { "pro", NULL, N_( "Provencal, Old (to 1500)" ) },
-         // language code: pus ps
-         { "pus", "ps", N_( "Pushto" ) },
-         // language code: que qu
-         { "que", "qu", N_( "Quechua" ) },
-         // language code: raj
-         { "raj", NULL, N_( "Rajasthani" ) },
-         // language code: rap
-         { "rap", NULL, N_( "Rapanui" ) },
-         // language code: rar
-         { "rar", NULL, N_( "Rarotongan" ) },
-         // language code: roa
-         { "roa", NULL, N_( "Romance (Other)" ) },
-         // language code: roh rm
-         { "roh", "rm", N_( "Raeto-Romance" ) },
-         // language code: rom
-         { "rom", NULL, N_( "Romany" ) },
-         // language code: rum ron ro
-         { "rum", "ro", N_( "Romanian" ) },
-         // language code: rum ron ro
-         { "ron", NULL, N_( "Romanian" ) },
-         // language code: run rn
-         { "run", "rn", N_( "Rundi" ) },
-         // language code: rus ru
-         { "rus", "ru", N_( "Russian" ) },
-         // language code: sad
-         { "sad", NULL, N_( "Sandawe" ) },
-         // language code: sag sg
-         { "sag", "sg", N_( "Sango" ) },
-         // language code: sah
-         { "sah", NULL, N_( "Yakut" ) },
-         // language code: sai
-         { "sai", NULL, N_( "South American Indian (Other)" ) },
-         // language code: sal
-         { "sal", NULL, N_( "Salishan Languages" ) },
-         // language code: sam
-         { "sam", NULL, N_( "Samaritan Aramaic" ) },
-         // language code: san sa
-         { "san", "sa", N_( "Sanskrit" ) },
-         // language code: sas
-         { "sas", NULL, N_( "Sasak" ) },
-         // language code: sat
-         { "sat", NULL, N_( "Santali" ) },
-         // language code: scc srp sr
-         { "scc", "sr", N_( "Serbian" ) },
-         // language code: scc srp sr
-         { "srp", NULL, N_( "Serbian" ) },
-         // language code: scn
-         { "scn", NULL, N_( "Sicilian" ) },
-         // language code: sco
-         { "sco", NULL, N_( "Scots" ) },
-         // language code: scr hrv hr
-         { "scr", "hr", N_( "Croatian" ) },
-         // language code: scr hrv hr
-         { "hrv", NULL, N_( "Croatian" ) },
-         // language code: sel
-         { "sel", NULL, N_( "Selkup" ) },
-         // language code: sem
-         { "sem", NULL, N_( "Semitic (Other)" ) },
-         // language code: sga
-         { "sga", NULL, N_( "Irish, Old (to 900)" ) },
-         // language code: sgn
-         { "sgn", NULL, N_( "Sign Languages" ) },
-         // language code: shn
-         { "shn", NULL, N_( "Shan" ) },
-         // language code: sid
-         { "sid", NULL, N_( "Sidamo" ) },
-         // language code: sin si
-         { "sin", "si", N_( "Sinhala" ) },
-         // language code: sio
-         { "sio", NULL, N_( "Siouan Languages" ) },
-         // language code: sit
-         { "sit", NULL, N_( "Sino-Tibetan (Other)" ) },
-         // language code: sla
-         { "sla", NULL, N_( "Slavic (Other)" ) },
-         // language code: slo slk sk
-         { "slo", "sk", N_( "Slovak" ) },
-         // language code: slo slk sk
-         { "slk", NULL, N_( "Slovak" ) },
-         // language code: slv sl
-         { "slv", "sl", N_( "Slovenian" ) },
-         // language code: sma
-         { "sma", NULL, N_( "Southern Sami" ) },
-         // language code: sme se
-         { "sme", "se", N_( "Northern Sami" ) },
-         // language code: smi
-         { "smi", NULL, N_( "Sami Languages (Other)" ) },
-         // language code: smj
-         { "smj", NULL, N_( "Lule Sami" ) },
-         // language code: smn
-         { "smn", NULL, N_( "Inari Sami" ) },
-         // language code: smo sm
-         { "smo", "sm", N_( "Samoan" ) },
-         // language code: sms
-         { "sms", NULL, N_( "Skolt Sami" ) },
-         // language code: sna sn
-         { "sna", "sn", N_( "Shona" ) },
-         // language code: snd sd
-         { "snd", "sd", N_( "Sindhi" ) },
-         // language code: snk
-         { "snk", NULL, N_( "Soninke" ) },
-         // language code: sog
-         { "sog", NULL, N_( "Sogdian" ) },
-         // language code: som so
-         { "som", "so", N_( "Somali" ) },
-         // language code: son
-         { "son", NULL, N_( "Songhai" ) },
-         // language code: sot st
-         { "sot", "st", N_( "Sotho, Southern" ) },
-         // language code: spa es
-         { "spa", "es", N_( "Spanish" ) },
-         // language code: srd sc
-         { "srd", "sc", N_( "Sardinian" ) },
-         // language code: srr
-         { "srr", NULL, N_( "Serer" ) },
-         // language code: ssa
-         { "ssa", NULL, N_( "Nilo-Saharan (Other)" ) },
-         // language code: ssw ss
-         { "ssw", "ss", N_( "Swati" ) },
-         // language code: suk
-         { "suk", NULL, N_( "Sukuma" ) },
-         // language code: sun su
-         { "sun", "su", N_( "Sundanese" ) },
-         // language code: sus
-         { "sus", NULL, N_( "Susu" ) },
-         // language code: sux
-         { "sux", NULL, N_( "Sumerian" ) },
-         // language code: swa sw
-         { "swa", "sw", N_( "Swahili" ) },
-         // language code: swe sv
-         { "swe", "sv", N_( "Swedish" ) },
-         // language code: syr
-         { "syr", NULL, N_( "Syriac" ) },
-         // language code: tah ty
-         { "tah", "ty", N_( "Tahitian" ) },
-         // language code: tai
-         { "tai", NULL, N_( "Tai (Other)" ) },
-         // language code: tam ta
-         { "tam", "ta", N_( "Tamil" ) },
-         // language code: tat tt
-         { "tat", "tt", N_( "Tatar" ) },
-         // language code: tel te
-         { "tel", "te", N_( "Telugu" ) },
-         // language code: tem
-         { "tem", NULL, N_( "Timne" ) },
-         // language code: ter
-         { "ter", NULL, N_( "Tereno" ) },
-         // language code: tet
-         { "tet", NULL, N_( "Tetum" ) },
-         // language code: tgk tg
-         { "tgk", "tg", N_( "Tajik" ) },
-         // language code: tgl tl
-         { "tgl", "tl", N_( "Tagalog" ) },
-         // language code: tha th
-         { "tha", "th", N_( "Thai" ) },
-         // language code: tib bod bo
-         { "tib", "bo", N_( "Tibetan" ) },
-         // language code: tib bod bo
-         { "bod", NULL, N_( "Tibetan" ) },
-         // language code: tig
-         { "tig", NULL, N_( "Tigre" ) },
-         // language code: tir ti
-         { "tir", "ti", N_( "Tigrinya" ) },
-         // language code: tiv
-         { "tiv", NULL, N_( "Tiv" ) },
-         // language code: tkl
-         { "tkl", NULL, N_( "Tokelau" ) },
-         // language code: tlh
-         { "tlh", NULL, N_( "Klingon" ) },
-         // language code: tli
-         { "tli", NULL, N_( "Tlingit" ) },
-         // language code: tmh
-         { "tmh", NULL, N_( "Tamashek" ) },
-         // language code: tog
-         { "tog", NULL, N_( "Tonga (Nyasa)" ) },
-         // language code: ton to
-         { "ton", "to", N_( "Tonga (Tonga Islands)" ) },
-         // language code: tpi
-         { "tpi", NULL, N_( "Tok Pisin" ) },
-         // language code: tsi
-         { "tsi", NULL, N_( "Tsimshian" ) },
-         // language code: tsn tn
-         { "tsn", "tn", N_( "Tswana" ) },
-         // language code: tso ts
-         { "tso", "ts", N_( "Tsonga" ) },
-         // language code: tuk tk
-         { "tuk", "tk", N_( "Turkmen" ) },
-         // language code: tum
-         { "tum", NULL, N_( "Tumbuka" ) },
-         // language code: tup
-         { "tup", NULL, N_( "Tupi Languages" ) },
-         // language code: tur tr
-         { "tur", "tr", N_( "Turkish" ) },
-         // language code: tut
-         { "tut", NULL, N_( "Altaic (Other)" ) },
-         // language code: tvl
-         { "tvl", NULL, N_( "Tuvalu" ) },
-         // language code: twi tw
-         { "twi", "tw", N_( "Twi" ) },
-         // language code: tyv
-         { "tyv", NULL, N_( "Tuvinian" ) },
-         // language code: udm
-         { "udm", NULL, N_( "Udmurt" ) },
-         // language code: uga
-         { "uga", NULL, N_( "Ugaritic" ) },
-         // language code: uig ug
-         { "uig", "ug", N_( "Uighur" ) },
-         // language code: ukr uk
-         { "ukr", "uk", N_( "Ukrainian" ) },
-         // language code: umb
-         { "umb", NULL, N_( "Umbundu" ) },
-         // language code: und
-         { "und", NULL, N_( "Undetermined" ) },
-         // language code: urd ur
-         { "urd", "ur", N_( "Urdu" ) },
-         // language code: uzb uz
-         { "uzb", "uz", N_( "Uzbek" ) },
-         // language code: vai
-         { "vai", NULL, N_( "Vai" ) },
-         // language code: ven ve
-         { "ven", "ve", N_( "Venda" ) },
-         // language code: vie vi
-         { "vie", "vi", N_( "Vietnamese" ) },
-         // language code: vol vo
-         { "vol", "vo", N_( "Volapuk" ) },
-         // language code: vot
-         { "vot", NULL, N_( "Votic" ) },
-         // language code: wak
-         { "wak", NULL, N_( "Wakashan Languages" ) },
-         // language code: wal
-         { "wal", NULL, N_( "Walamo" ) },
-         // language code: war
-         { "war", NULL, N_( "Waray" ) },
-         // language code: was
-         { "was", NULL, N_( "Washo" ) },
-         // language code: wel cym cy
-         { "wel", "cy", N_( "Welsh" ) },
-         // language code: wel cym cy
-         { "cym", NULL, N_( "Welsh" ) },
-         // language code: wen
-         { "wen", NULL, N_( "Sorbian Languages" ) },
-         // language code: wln wa
-         { "wln", "wa", N_( "Walloon" ) },
-         // language code: wol wo
-         { "wol", "wo", N_( "Wolof" ) },
-         // language code: xal
-         { "xal", NULL, N_( "Kalmyk" ) },
-         // language code: xho xh
-         { "xho", "xh", N_( "Xhosa" ) },
-         // language code: yao
-         { "yao", NULL, N_( "Yao" ) },
-         // language code: yap
-         { "yap", NULL, N_( "Yapese" ) },
-         // language code: yid yi
-         { "yid", "yi", N_( "Yiddish" ) },
-         // language code: yor yo
-         { "yor", "yo", N_( "Yoruba" ) },
-         // language code: ypk
-         { "ypk", NULL, N_( "Yupik Languages" ) },
-         // language code: zap
-         { "zap", NULL, N_( "Zapotec" ) },
-         // language code: zen
-         { "zen", NULL, N_( "Zenaga" ) },
-         // language code: zha za
-         { "zha", "za", N_( "Zhuang" ) },
-         // language code: znd
-         { "znd", NULL, N_( "Zande" ) },
-         // language code: zul zu
-         { "zul", "zu", N_( "Zulu" ) },
-         // language code: zun
-         { "zun", NULL, N_( "Zuni" ) },
+          // language code: aar aa
+          { "aar", "aa", N_( "Afar" ) },
+          // language code: abk ab
+          { "abk", "ab", N_( "Abkhazian" ) },
+          // language code: ace
+          { "ace", NULL, N_( "Achinese" ) },
+          // language code: ach
+          { "ach", NULL, N_( "Acoli" ) },
+          // language code: ada
+          { "ada", NULL, N_( "Adangme" ) },
+          // language code: ady
+          { "ady", NULL, N_( "Adyghe" ) },
+          // language code: afa
+          { "afa", NULL, N_( "Afro-Asiatic (Other)" ) },
+          // language code: afh
+          { "afh", NULL, N_( "Afrihili" ) },
+          // language code: afr af
+          { "afr", "af", N_( "Afrikaans" ) },
+          // language code: ain
+          { "ain", NULL, N_( "Ainu" ) },
+          // language code: aka ak
+          { "aka", "ak", N_( "Akan" ) },
+          // language code: akk
+          { "akk", NULL, N_( "Akkadian" ) },
+          // language code: alb sqi sq
+          { "alb", "sq", N_( "Albanian" ) },
+          // language code: alb sqi sq
+          { "sqi", NULL, N_( "Albanian" ) },
+          // language code: ale
+          { "ale", NULL, N_( "Aleut" ) },
+          // language code: alg
+          { "alg", NULL, N_( "Algonquian Languages" ) },
+          // language code: alt
+          { "alt", NULL, N_( "Southern Altai" ) },
+          // language code: amh am
+          { "amh", "am", N_( "Amharic" ) },
+          // language code: ang
+          { "ang", NULL, N_( "English, Old (ca.450-1100)" ) },
+          // language code: apa
+          { "apa", NULL, N_( "Apache Languages" ) },
+          // language code: ara ar
+          { "ara", "ar", N_( "Arabic" ) },
+          // language code: arc
+          { "arc", NULL, N_( "Aramaic" ) },
+          // language code: arg an
+          { "arg", "an", N_( "Aragonese" ) },
+          // language code: arm hye hy
+          { "arm", "hy", N_( "Armenian" ) },
+          // language code: arm hye hy
+          { "hye", NULL, N_( "Armenian" ) },
+          // language code: arn
+          { "arn", NULL, N_( "Araucanian" ) },
+          // language code: arp
+          { "arp", NULL, N_( "Arapaho" ) },
+          // language code: art
+          { "art", NULL, N_( "Artificial (Other)" ) },
+          // language code: arw
+          { "arw", NULL, N_( "Arawak" ) },
+          // language code: asm as
+          { "asm", "as", N_( "Assamese" ) },
+          // language code: ast
+          { "ast", NULL, N_( "Asturian" ) },
+          // language code: ath
+          { "ath", NULL, N_( "Athapascan Languages" ) },
+          // language code: aus
+          { "aus", NULL, N_( "Australian Languages" ) },
+          // language code: ava av
+          { "ava", "av", N_( "Avaric" ) },
+          // language code: ave ae
+          { "ave", "ae", N_( "Avestan" ) },
+          // language code: awa
+          { "awa", NULL, N_( "Awadhi" ) },
+          // language code: aym ay
+          { "aym", "ay", N_( "Aymara" ) },
+          // language code: aze az
+          { "aze", "az", N_( "Azerbaijani" ) },
+          // language code: bad
+          { "bad", NULL, N_( "Banda" ) },
+          // language code: bai
+          { "bai", NULL, N_( "Bamileke Languages" ) },
+          // language code: bak ba
+          { "bak", "ba", N_( "Bashkir" ) },
+          // language code: bal
+          { "bal", NULL, N_( "Baluchi" ) },
+          // language code: bam bm
+          { "bam", "bm", N_( "Bambara" ) },
+          // language code: ban
+          { "ban", NULL, N_( "Balinese" ) },
+          // language code: baq eus eu
+          { "baq", "eu", N_( "Basque" ) },
+          // language code: baq eus eu
+          { "eus", NULL, N_( "Basque" ) },
+          // language code: bas
+          { "bas", NULL, N_( "Basa" ) },
+          // language code: bat
+          { "bat", NULL, N_( "Baltic (Other)" ) },
+          // language code: bej
+          { "bej", NULL, N_( "Beja" ) },
+          // language code: bel be
+          { "bel", "be", N_( "Belarusian" ) },
+          // language code: bem
+          { "bem", NULL, N_( "Bemba" ) },
+          // language code: ben bn
+          { "ben", "bn", N_( "Bengali" ) },
+          // language code: ber
+          { "ber", NULL, N_( "Berber (Other)" ) },
+          // language code: bho
+          { "bho", NULL, N_( "Bhojpuri" ) },
+          // language code: bih bh
+          { "bih", "bh", N_( "Bihari" ) },
+          // language code: bik
+          { "bik", NULL, N_( "Bikol" ) },
+          // language code: bin
+          { "bin", NULL, N_( "Bini" ) },
+          // language code: bis bi
+          { "bis", "bi", N_( "Bislama" ) },
+          // language code: bla
+          { "bla", NULL, N_( "Siksika" ) },
+          // language code: bnt
+          { "bnt", NULL, N_( "Bantu (Other)" ) },
+          // language code: bos bs
+          { "bos", "bs", N_( "Bosnian" ) },
+          // language code: bra
+          { "bra", NULL, N_( "Braj" ) },
+          // language code: bre br
+          { "bre", "br", N_( "Breton" ) },
+          // language code: btk
+          { "btk", NULL, N_( "Batak (Indonesia)" ) },
+          // language code: bua
+          { "bua", NULL, N_( "Buriat" ) },
+          // language code: bug
+          { "bug", NULL, N_( "Buginese" ) },
+          // language code: bul bg
+          { "bul", "bg", N_( "Bulgarian" ) },
+          // language code: bur mya my
+          { "bur", "my", N_( "Burmese" ) },
+          // language code: bur mya my
+          { "mya", NULL, N_( "Burmese" ) },
+          // language code: byn
+          { "byn", NULL, N_( "Blin" ) },
+          // language code: cad
+          { "cad", NULL, N_( "Caddo" ) },
+          // language code: cai
+          { "cai", NULL, N_( "Central American Indian (Other)" ) },
+          // language code: car
+          { "car", NULL, N_( "Carib" ) },
+          // language code: cat ca
+          { "cat", "ca", N_( "Catalan" ) },
+          // language code: cau
+          { "cau", NULL, N_( "Caucasian (Other)" ) },
+          // language code: ceb
+          { "ceb", NULL, N_( "Cebuano" ) },
+          // language code: cel
+          { "cel", NULL, N_( "Celtic (Other)" ) },
+          // language code: cha ch
+          { "cha", "ch", N_( "Chamorro" ) },
+          // language code: chb
+          { "chb", NULL, N_( "Chibcha" ) },
+          // language code: che ce
+          { "che", "ce", N_( "Chechen" ) },
+          // language code: chg
+          { "chg", NULL, N_( "Chagatai" ) },
+          // language code: chi zho zh
+          { "chi", "zh", N_( "Chinese" ) },
+          // language code: chi zho zh
+          { "zho", NULL, N_( "Chinese" ) },
+          // language code: chk
+          { "chk", NULL, N_( "Chuukese" ) },
+          // language code: chm
+          { "chm", NULL, N_( "Mari" ) },
+          // language code: chn
+          { "chn", NULL, N_( "Chinook Jargon" ) },
+          // language code: cho
+          { "cho", NULL, N_( "Choctaw" ) },
+          // language code: chp
+          { "chp", NULL, N_( "Chipewyan" ) },
+          // language code: chr
+          { "chr", NULL, N_( "Cherokee" ) },
+          // language code: chu cu
+          { "chu", "cu", N_( "Church Slavic" ) },
+          // language code: chv cv
+          { "chv", "cv", N_( "Chuvash" ) },
+          // language code: chy
+          { "chy", NULL, N_( "Cheyenne" ) },
+          // language code: cmc
+          { "cmc", NULL, N_( "Chamic Languages" ) },
+          // language code: cop
+          { "cop", NULL, N_( "Coptic" ) },
+          // language code: cor kw
+          { "cor", "kw", N_( "Cornish" ) },
+          // language code: cos co
+          { "cos", "co", N_( "Corsican" ) },
+          // language code: cpe
+          { "cpe", NULL, N_( "Creoles and Pidgins, English-Based (Other)" ) },
+          // language code: cpf
+          { "cpf", NULL, N_( "Creoles and Pidgins, French-Based (Other)" ) },
+          // language code: cpp
+          { "cpp", NULL, N_( "Creoles and Pidgins, Portuguese-Based (Other)" ) },
+          // language code: cre cr
+          { "cre", "cr", N_( "Cree" ) },
+          // language code: crh
+          { "crh", NULL, N_( "Crimean Tatar" ) },
+          // language code: crp
+          { "crp", NULL, N_( "Creoles and Pidgins (Other)" ) },
+          // language code: csb
+          { "csb", NULL, N_( "Kashubian" ) },
+          // language code: cus
+          { "cus", NULL, N_( "Cushitic (Other)" ) },
+          // language code: cze ces cs
+          { "cze", "cs", N_( "Czech" ) },
+          // language code: cze ces cs
+          { "ces", NULL, N_( "Czech" ) },
+          // language code: dak
+          { "dak", NULL, N_( "Dakota" ) },
+          // language code: dan da
+          { "dan", "da", N_( "Danish" ) },
+          // language code: dar
+          { "dar", NULL, N_( "Dargwa" ) },
+          // language code: day
+          { "day", NULL, N_( "Dayak" ) },
+          // language code: del
+          { "del", NULL, N_( "Delaware" ) },
+          // language code: den
+          { "den", NULL, N_( "Slave (Athapascan)" ) },
+          // language code: dgr
+          { "dgr", NULL, N_( "Dogrib" ) },
+          // language code: din
+          { "din", NULL, N_( "Dinka" ) },
+          // language code: div dv
+          { "div", "dv", N_( "Divehi" ) },
+          // language code: doi
+          { "doi", NULL, N_( "Dogri" ) },
+          // language code: dra
+          { "dra", NULL, N_( "Dravidian (Other)" ) },
+          // language code: dsb
+          { "dsb", NULL, N_( "Lower Sorbian" ) },
+          // language code: dua
+          { "dua", NULL, N_( "Duala" ) },
+          // language code: dum
+          { "dum", NULL, N_( "Dutch, Middle (ca.1050-1350)" ) },
+          // language code: dut nld nl
+          { "dut", "nl", N_( "Dutch" ) },
+          // language code: dut nld nl
+          { "nld", NULL, N_( "Dutch" ) },
+          // language code: dyu
+          { "dyu", NULL, N_( "Dyula" ) },
+          // language code: dzo dz
+          { "dzo", "dz", N_( "Dzongkha" ) },
+          // language code: efi
+          { "efi", NULL, N_( "Efik" ) },
+          // language code: egy
+          { "egy", NULL, N_( "Egyptian (Ancient)" ) },
+          // language code: eka
+          { "eka", NULL, N_( "Ekajuk" ) },
+          // language code: elx
+          { "elx", NULL, N_( "Elamite" ) },
+          // language code: eng en
+          { "eng", "en", N_( "English" ) },
+          // language code: enm
+          { "enm", NULL, N_( "English, Middle (1100-1500)" ) },
+          // language code: epo eo
+          { "epo", "eo", N_( "Esperanto" ) },
+          // language code: est et
+          { "est", "et", N_( "Estonian" ) },
+          // language code: ewe ee
+          { "ewe", "ee", N_( "Ewe" ) },
+          // language code: ewo
+          { "ewo", NULL, N_( "Ewondo" ) },
+          // language code: fan
+          { "fan", NULL, N_( "Fang" ) },
+          // language code: fao fo
+          { "fao", "fo", N_( "Faroese" ) },
+          // language code: fat
+          { "fat", NULL, N_( "Fanti" ) },
+          // language code: fij fj
+          { "fij", "fj", N_( "Fijian" ) },
+          // language code: fil
+          { "fil", NULL, N_( "Filipino" ) },
+          // language code: fin fi
+          { "fin", "fi", N_( "Finnish" ) },
+          // language code: fiu
+          { "fiu", NULL, N_( "Finno-Ugrian (Other)" ) },
+          // language code: fon
+          { "fon", NULL, N_( "Fon" ) },
+          // language code: fre fra fr
+          { "fre", "fr", N_( "French" ) },
+          // language code: fre fra fr
+          { "fra", NULL, N_( "French" ) },
+          // language code: frm
+          { "frm", NULL, N_( "French, Middle (ca.1400-1600)" ) },
+          // language code: fro
+          { "fro", NULL, N_( "French, Old (842-ca.1400)" ) },
+          // language code: fry fy
+          { "fry", "fy", N_( "Frisian" ) },
+          // language code: ful ff
+          { "ful", "ff", N_( "Fulah" ) },
+          // language code: fur
+          { "fur", NULL, N_( "Friulian" ) },
+          // language code: gaa
+          { "gaa", NULL, N_( "Ga" ) },
+          // language code: gay
+          { "gay", NULL, N_( "Gayo" ) },
+          // language code: gba
+          { "gba", NULL, N_( "Gbaya" ) },
+          // language code: gem
+          { "gem", NULL, N_( "Germanic (Other)" ) },
+          // language code: geo kat ka
+          { "geo", "ka", N_( "Georgian" ) },
+          // language code: geo kat ka
+          { "kat", NULL, N_( "Georgian" ) },
+          // language code: ger deu de
+          { "ger", "de", N_( "German" ) },
+          // language code: ger deu de
+          { "deu", NULL, N_( "German" ) },
+          // language code: gez
+          { "gez", NULL, N_( "Geez" ) },
+          // language code: gil
+          { "gil", NULL, N_( "Gilbertese" ) },
+          // language code: gla gd
+          { "gla", "gd", N_( "Gaelic" ) },
+          // language code: gle ga
+          { "gle", "ga", N_( "Irish" ) },
+          // language code: glg gl
+          { "glg", "gl", N_( "Galician" ) },
+          // language code: glv gv
+          { "glv", "gv", N_( "Manx" ) },
+          // language code: gmh
+          { "gmh", NULL, N_( "German, Middle High (ca.1050-1500)" ) },
+          // language code: goh
+          { "goh", NULL, N_( "German, Old High (ca.750-1050)" ) },
+          // language code: gon
+          { "gon", NULL, N_( "Gondi" ) },
+          // language code: gor
+          { "gor", NULL, N_( "Gorontalo" ) },
+          // language code: got
+          { "got", NULL, N_( "Gothic" ) },
+          // language code: grb
+          { "grb", NULL, N_( "Grebo" ) },
+          // language code: grc
+          { "grc", NULL, N_( "Greek, Ancient (to 1453)" ) },
+          // language code: gre ell el
+          { "gre", "el", N_( "Greek, Modern (1453-)" ) },
+          // language code: gre ell el
+          { "ell", NULL, N_( "Greek, Modern (1453-)" ) },
+          // language code: grn gn
+          { "grn", "gn", N_( "Guarani" ) },
+          // language code: guj gu
+          { "guj", "gu", N_( "Gujarati" ) },
+          // language code: gwi
+          { "gwi", NULL, N_( "Gwich'in" ) },
+          // language code: hai
+          { "hai", NULL, N_( "Haida" ) },
+          // language code: hat ht
+          { "hat", "ht", N_( "Haitian" ) },
+          // language code: hau ha
+          { "hau", "ha", N_( "Hausa" ) },
+          // language code: haw
+          { "haw", NULL, N_( "Hawaiian" ) },
+          // language code: heb he
+          { "heb", "he", N_( "Hebrew" ) },
+          // language code: her hz
+          { "her", "hz", N_( "Herero" ) },
+          // language code: hil
+          { "hil", NULL, N_( "Hiligaynon" ) },
+          // language code: him
+          { "him", NULL, N_( "Himachali" ) },
+          // language code: hin hi
+          { "hin", "hi", N_( "Hindi" ) },
+          // language code: hit
+          { "hit", NULL, N_( "Hittite" ) },
+          // language code: hmn
+          { "hmn", NULL, N_( "Hmong" ) },
+          // language code: hmo ho
+          { "hmo", "ho", N_( "Hiri Motu" ) },
+          // language code: hsb
+          { "hsb", NULL, N_( "Upper Sorbian" ) },
+          // language code: hun hu
+          { "hun", "hu", N_( "Hungarian" ) },
+          // language code: hup
+          { "hup", NULL, N_( "Hupa" ) },
+          // language code: iba
+          { "iba", NULL, N_( "Iban" ) },
+          // language code: ibo ig
+          { "ibo", "ig", N_( "Igbo" ) },
+          // language code: ice isl is
+          { "ice", "is", N_( "Icelandic" ) },
+          // language code: ice isl is
+          { "isl", NULL, N_( "Icelandic" ) },
+          // language code: ido io
+          { "ido", "io", N_( "Ido" ) },
+          // language code: iii ii
+          { "iii", "ii", N_( "Sichuan Yi" ) },
+          // language code: ijo
+          { "ijo", NULL, N_( "Ijo" ) },
+          // language code: iku iu
+          { "iku", "iu", N_( "Inuktitut" ) },
+          // language code: ile ie
+          { "ile", "ie", N_( "Interlingue" ) },
+          // language code: ilo
+          { "ilo", NULL, N_( "Iloko" ) },
+          // language code: ina ia
+          { "ina", "ia", N_( "Interlingua (International Auxiliary Language Association)" ) },
+          // language code: inc
+          { "inc", NULL, N_( "Indic (Other)" ) },
+          // language code: ind id
+          { "ind", "id", N_( "Indonesian" ) },
+          // language code: ine
+          { "ine", NULL, N_( "Indo-European (Other)" ) },
+          // language code: inh
+          { "inh", NULL, N_( "Ingush" ) },
+          // language code: ipk ik
+          { "ipk", "ik", N_( "Inupiaq" ) },
+          // language code: ira
+          { "ira", NULL, N_( "Iranian (Other)" ) },
+          // language code: iro
+          { "iro", NULL, N_( "Iroquoian Languages" ) },
+          // language code: ita it
+          { "ita", "it", N_( "Italian" ) },
+          // language code: jav jv
+          { "jav", "jv", N_( "Javanese" ) },
+          // language code: jbo
+          { "jbo", NULL, N_( "Lojban" ) },
+          // language code: jpn ja
+          { "jpn", "ja", N_( "Japanese" ) },
+          // language code: jpr
+          { "jpr", NULL, N_( "Judeo-Persian" ) },
+          // language code: jrb
+          { "jrb", NULL, N_( "Judeo-Arabic" ) },
+          // language code: kaa
+          { "kaa", NULL, N_( "Kara-Kalpak" ) },
+          // language code: kab
+          { "kab", NULL, N_( "Kabyle" ) },
+          // language code: kac
+          { "kac", NULL, N_( "Kachin" ) },
+          // language code: kal kl
+          { "kal", "kl", N_( "Kalaallisut" ) },
+          // language code: kam
+          { "kam", NULL, N_( "Kamba" ) },
+          // language code: kan kn
+          { "kan", "kn", N_( "Kannada" ) },
+          // language code: kar
+          { "kar", NULL, N_( "Karen" ) },
+          // language code: kas ks
+          { "kas", "ks", N_( "Kashmiri" ) },
+          // language code: kau kr
+          { "kau", "kr", N_( "Kanuri" ) },
+          // language code: kaw
+          { "kaw", NULL, N_( "Kawi" ) },
+          // language code: kaz kk
+          { "kaz", "kk", N_( "Kazakh" ) },
+          // language code: kbd
+          { "kbd", NULL, N_( "Kabardian" ) },
+          // language code: kha
+          { "kha", NULL, N_( "Khasi" ) },
+          // language code: khi
+          { "khi", NULL, N_( "Khoisan (Other)" ) },
+          // language code: khm km
+          { "khm", "km", N_( "Khmer" ) },
+          // language code: kho
+          { "kho", NULL, N_( "Khotanese" ) },
+          // language code: kik ki
+          { "kik", "ki", N_( "Kikuyu" ) },
+          // language code: kin rw
+          { "kin", "rw", N_( "Kinyarwanda" ) },
+          // language code: kir ky
+          { "kir", "ky", N_( "Kirghiz" ) },
+          // language code: kmb
+          { "kmb", NULL, N_( "Kimbundu" ) },
+          // language code: kok
+          { "kok", NULL, N_( "Konkani" ) },
+          // language code: kom kv
+          { "kom", "kv", N_( "Komi" ) },
+          // language code: kon kg
+          { "kon", "kg", N_( "Kongo" ) },
+          // language code: kor ko
+          { "kor", "ko", N_( "Korean" ) },
+          // language code: kos
+          { "kos", NULL, N_( "Kosraean" ) },
+          // language code: kpe
+          { "kpe", NULL, N_( "Kpelle" ) },
+          // language code: krc
+          { "krc", NULL, N_( "Karachay-Balkar" ) },
+          // language code: kro
+          { "kro", NULL, N_( "Kru" ) },
+          // language code: kru
+          { "kru", NULL, N_( "Kurukh" ) },
+          // language code: kua kj
+          { "kua", "kj", N_( "Kuanyama" ) },
+          // language code: kum
+          { "kum", NULL, N_( "Kumyk" ) },
+          // language code: kur ku
+          { "kur", "ku", N_( "Kurdish" ) },
+          // language code: kut
+          { "kut", NULL, N_( "Kutenai" ) },
+          // language code: lad
+          { "lad", NULL, N_( "Ladino" ) },
+          // language code: lah
+          { "lah", NULL, N_( "Lahnda" ) },
+          // language code: lam
+          { "lam", NULL, N_( "Lamba" ) },
+          // language code: lao lo
+          { "lao", "lo", N_( "Lao" ) },
+          // language code: lat la
+          { "lat", "la", N_( "Latin" ) },
+          // language code: lav lv
+          { "lav", "lv", N_( "Latvian" ) },
+          // language code: lez
+          { "lez", NULL, N_( "Lezghian" ) },
+          // language code: lim li
+          { "lim", "li", N_( "Limburgan" ) },
+          // language code: lin ln
+          { "lin", "ln", N_( "Lingala" ) },
+          // language code: lit lt
+          { "lit", "lt", N_( "Lithuanian" ) },
+          // language code: lol
+          { "lol", NULL, N_( "Mongo" ) },
+          // language code: loz
+          { "loz", NULL, N_( "Lozi" ) },
+          // language code: ltz lb
+          { "ltz", "lb", N_( "Luxembourgish" ) },
+          // language code: lua
+          { "lua", NULL, N_( "Luba-Lulua" ) },
+          // language code: lub lu
+          { "lub", "lu", N_( "Luba-Katanga" ) },
+          // language code: lug lg
+          { "lug", "lg", N_( "Ganda" ) },
+          // language code: lui
+          { "lui", NULL, N_( "Luiseno" ) },
+          // language code: lun
+          { "lun", NULL, N_( "Lunda" ) },
+          // language code: luo
+          { "luo", NULL, N_( "Luo (Kenya and Tanzania)" ) },
+          // language code: lus
+          { "lus", NULL, N_( "Lushai" ) },
+          // language code: mac mkd mk
+          { "mac", "mk", N_( "Macedonian" ) },
+          // language code: mac mkd mk
+          { "mkd", NULL, N_( "Macedonian" ) },
+          // language code: mad
+          { "mad", NULL, N_( "Madurese" ) },
+          // language code: mag
+          { "mag", NULL, N_( "Magahi" ) },
+          // language code: mah mh
+          { "mah", "mh", N_( "Marshallese" ) },
+          // language code: mai
+          { "mai", NULL, N_( "Maithili" ) },
+          // language code: mak
+          { "mak", NULL, N_( "Makasar" ) },
+          // language code: mal ml
+          { "mal", "ml", N_( "Malayalam" ) },
+          // language code: man
+          { "man", NULL, N_( "Mandingo" ) },
+          // language code: mao mri mi
+          { "mao", "mi", N_( "Maori" ) },
+          // language code: mao mri mi
+          { "mri", NULL, N_( "Maori" ) },
+          // language code: map
+          { "map", NULL, N_( "Austronesian (Other)" ) },
+          // language code: mar mr
+          { "mar", "mr", N_( "Marathi" ) },
+          // language code: mas
+          { "mas", NULL, N_( "Masai" ) },
+          // language code: may msa ms
+          { "may", "ms", N_( "Malay" ) },
+          // language code: may msa ms
+          { "msa", NULL, N_( "Malay" ) },
+          // language code: mdf
+          { "mdf", NULL, N_( "Moksha" ) },
+          // language code: mdr
+          { "mdr", NULL, N_( "Mandar" ) },
+          // language code: men
+          { "men", NULL, N_( "Mende" ) },
+          // language code: mga
+          { "mga", NULL, N_( "Irish, Middle (900-1200)" ) },
+          // language code: mic
+          { "mic", NULL, N_( "Mi'kmaq" ) },
+          // language code: min
+          { "min", NULL, N_( "Minangkabau" ) },
+          // language code: mis
+          { "mis", NULL, N_( "Miscellaneous Languages" ) },
+          // language code: mkh
+          { "mkh", NULL, N_( "Mon-Khmer (Other)" ) },
+          // language code: mlg mg
+          { "mlg", "mg", N_( "Malagasy" ) },
+          // language code: mlt mt
+          { "mlt", "mt", N_( "Maltese" ) },
+          // language code: mnc
+          { "mnc", NULL, N_( "Manchu" ) },
+          // language code: mni
+          { "mni", NULL, N_( "Manipuri" ) },
+          // language code: mno
+          { "mno", NULL, N_( "Manobo Languages" ) },
+          // language code: moh
+          { "moh", NULL, N_( "Mohawk" ) },
+          // language code: mol mo
+          { "mol", "mo", N_( "Moldavian" ) },
+          // language code: mon mn
+          { "mon", "mn", N_( "Mongolian" ) },
+          // language code: mos
+          { "mos", NULL, N_( "Mossi" ) },
+          // language code: mul
+          { "mul", NULL, N_( "Multiple Languages" ) },
+          // language code: mun
+          { "mun", NULL, N_( "Munda languages" ) },
+          // language code: mus
+          { "mus", NULL, N_( "Creek" ) },
+          // language code: mwl
+          { "mwl", NULL, N_( "Mirandese" ) },
+          // language code: mwr
+          { "mwr", NULL, N_( "Marwari" ) },
+          // language code: myn
+          { "myn", NULL, N_( "Mayan Languages" ) },
+          // language code: myv
+          { "myv", NULL, N_( "Erzya" ) },
+          // language code: nah
+          { "nah", NULL, N_( "Nahuatl" ) },
+          // language code: nai
+          { "nai", NULL, N_( "North American Indian" ) },
+          // language code: nap
+          { "nap", NULL, N_( "Neapolitan" ) },
+          // language code: nau na
+          { "nau", "na", N_( "Nauru" ) },
+          // language code: nav nv
+          { "nav", "nv", N_( "Navajo" ) },
+          // language code: nbl nr
+          { "nbl", "nr", N_( "Ndebele, South" ) },
+          // language code: nde nd
+          { "nde", "nd", N_( "Ndebele, North" ) },
+          // language code: ndo ng
+          { "ndo", "ng", N_( "Ndonga" ) },
+          // language code: nds
+          { "nds", NULL, N_( "Low German" ) },
+          // language code: nep ne
+          { "nep", "ne", N_( "Nepali" ) },
+          // language code: new
+          { "new", NULL, N_( "Nepal Bhasa" ) },
+          // language code: nia
+          { "nia", NULL, N_( "Nias" ) },
+          // language code: nic
+          { "nic", NULL, N_( "Niger-Kordofanian (Other)" ) },
+          // language code: niu
+          { "niu", NULL, N_( "Niuean" ) },
+          // language code: nno nn
+          { "nno", "nn", N_( "Norwegian Nynorsk" ) },
+          // language code: nob nb
+          { "nob", "nb", N_( "Norwegian Bokmal" ) },
+          // language code: nog
+          { "nog", NULL, N_( "Nogai" ) },
+          // language code: non
+          { "non", NULL, N_( "Norse, Old" ) },
+          // language code: nor no
+          { "nor", "no", N_( "Norwegian" ) },
+          // language code: nso
+          { "nso", NULL, N_( "Northern Sotho" ) },
+          // language code: nub
+          { "nub", NULL, N_( "Nubian Languages" ) },
+          // language code: nwc
+          { "nwc", NULL, N_( "Classical Newari" ) },
+          // language code: nya ny
+          { "nya", "ny", N_( "Chichewa" ) },
+          // language code: nym
+          { "nym", NULL, N_( "Nyamwezi" ) },
+          // language code: nyn
+          { "nyn", NULL, N_( "Nyankole" ) },
+          // language code: nyo
+          { "nyo", NULL, N_( "Nyoro" ) },
+          // language code: nzi
+          { "nzi", NULL, N_( "Nzima" ) },
+          // language code: oci oc
+          { "oci", "oc", N_( "Occitan (post 1500)" ) },
+          // language code: oji oj
+          { "oji", "oj", N_( "Ojibwa" ) },
+          // language code: ori or
+          { "ori", "or", N_( "Oriya" ) },
+          // language code: orm om
+          { "orm", "om", N_( "Oromo" ) },
+          // language code: osa
+          { "osa", NULL, N_( "Osage" ) },
+          // language code: oss os
+          { "oss", "os", N_( "Ossetian" ) },
+          // language code: ota
+          { "ota", NULL, N_( "Turkish, Ottoman (1500-1928)" ) },
+          // language code: oto
+          { "oto", NULL, N_( "Otomian Languages" ) },
+          // language code: paa
+          { "paa", NULL, N_( "Papuan (Other)" ) },
+          // language code: pag
+          { "pag", NULL, N_( "Pangasinan" ) },
+          // language code: pal
+          { "pal", NULL, N_( "Pahlavi" ) },
+          // language code: pam
+          { "pam", NULL, N_( "Pampanga" ) },
+          // language code: pan pa
+          { "pan", "pa", N_( "Panjabi" ) },
+          // language code: pap
+          { "pap", NULL, N_( "Papiamento" ) },
+          // language code: pau
+          { "pau", NULL, N_( "Palauan" ) },
+          // language code: peo
+          { "peo", NULL, N_( "Persian, Old (ca.600-400 B.C.)" ) },
+          // language code: per fas fa
+          { "per", "fa", N_( "Persian" ) },
+          // language code: per fas fa
+          { "fas", NULL, N_( "Persian" ) },
+          // language code: phi
+          { "phi", NULL, N_( "Philippine (Other)" ) },
+          // language code: phn
+          { "phn", NULL, N_( "Phoenician" ) },
+          // language code: pli pi
+          { "pli", "pi", N_( "Pali" ) },
+          // language code: pol pl
+          { "pol", "pl", N_( "Polish" ) },
+          // language code: pon
+          { "pon", NULL, N_( "Pohnpeian" ) },
+          // language code: por pt
+          { "por", "pt", N_( "Portuguese" ) },
+          // language code: pra
+          { "pra", NULL, N_( "Prakrit Languages" ) },
+          // language code: pro
+          { "pro", NULL, N_( "Provencal, Old (to 1500)" ) },
+          // language code: pus ps
+          { "pus", "ps", N_( "Pushto" ) },
+          // language code: que qu
+          { "que", "qu", N_( "Quechua" ) },
+          // language code: raj
+          { "raj", NULL, N_( "Rajasthani" ) },
+          // language code: rap
+          { "rap", NULL, N_( "Rapanui" ) },
+          // language code: rar
+          { "rar", NULL, N_( "Rarotongan" ) },
+          // language code: roa
+          { "roa", NULL, N_( "Romance (Other)" ) },
+          // language code: roh rm
+          { "roh", "rm", N_( "Raeto-Romance" ) },
+          // language code: rom
+          { "rom", NULL, N_( "Romany" ) },
+          // language code: rum ron ro
+          { "rum", "ro", N_( "Romanian" ) },
+          // language code: rum ron ro
+          { "ron", NULL, N_( "Romanian" ) },
+          // language code: run rn
+          { "run", "rn", N_( "Rundi" ) },
+          // language code: rus ru
+          { "rus", "ru", N_( "Russian" ) },
+          // language code: sad
+          { "sad", NULL, N_( "Sandawe" ) },
+          // language code: sag sg
+          { "sag", "sg", N_( "Sango" ) },
+          // language code: sah
+          { "sah", NULL, N_( "Yakut" ) },
+          // language code: sai
+          { "sai", NULL, N_( "South American Indian (Other)" ) },
+          // language code: sal
+          { "sal", NULL, N_( "Salishan Languages" ) },
+          // language code: sam
+          { "sam", NULL, N_( "Samaritan Aramaic" ) },
+          // language code: san sa
+          { "san", "sa", N_( "Sanskrit" ) },
+          // language code: sas
+          { "sas", NULL, N_( "Sasak" ) },
+          // language code: sat
+          { "sat", NULL, N_( "Santali" ) },
+          // language code: scc srp sr
+          { "scc", "sr", N_( "Serbian" ) },
+          // language code: scc srp sr
+          { "srp", NULL, N_( "Serbian" ) },
+          // language code: scn
+          { "scn", NULL, N_( "Sicilian" ) },
+          // language code: sco
+          { "sco", NULL, N_( "Scots" ) },
+          // language code: scr hrv hr
+          { "scr", "hr", N_( "Croatian" ) },
+          // language code: scr hrv hr
+          { "hrv", NULL, N_( "Croatian" ) },
+          // language code: sel
+          { "sel", NULL, N_( "Selkup" ) },
+          // language code: sem
+          { "sem", NULL, N_( "Semitic (Other)" ) },
+          // language code: sga
+          { "sga", NULL, N_( "Irish, Old (to 900)" ) },
+          // language code: sgn
+          { "sgn", NULL, N_( "Sign Languages" ) },
+          // language code: shn
+          { "shn", NULL, N_( "Shan" ) },
+          // language code: sid
+          { "sid", NULL, N_( "Sidamo" ) },
+          // language code: sin si
+          { "sin", "si", N_( "Sinhala" ) },
+          // language code: sio
+          { "sio", NULL, N_( "Siouan Languages" ) },
+          // language code: sit
+          { "sit", NULL, N_( "Sino-Tibetan (Other)" ) },
+          // language code: sla
+          { "sla", NULL, N_( "Slavic (Other)" ) },
+          // language code: slo slk sk
+          { "slo", "sk", N_( "Slovak" ) },
+          // language code: slo slk sk
+          { "slk", NULL, N_( "Slovak" ) },
+          // language code: slv sl
+          { "slv", "sl", N_( "Slovenian" ) },
+          // language code: sma
+          { "sma", NULL, N_( "Southern Sami" ) },
+          // language code: sme se
+          { "sme", "se", N_( "Northern Sami" ) },
+          // language code: smi
+          { "smi", NULL, N_( "Sami Languages (Other)" ) },
+          // language code: smj
+          { "smj", NULL, N_( "Lule Sami" ) },
+          // language code: smn
+          { "smn", NULL, N_( "Inari Sami" ) },
+          // language code: smo sm
+          { "smo", "sm", N_( "Samoan" ) },
+          // language code: sms
+          { "sms", NULL, N_( "Skolt Sami" ) },
+          // language code: sna sn
+          { "sna", "sn", N_( "Shona" ) },
+          // language code: snd sd
+          { "snd", "sd", N_( "Sindhi" ) },
+          // language code: snk
+          { "snk", NULL, N_( "Soninke" ) },
+          // language code: sog
+          { "sog", NULL, N_( "Sogdian" ) },
+          // language code: som so
+          { "som", "so", N_( "Somali" ) },
+          // language code: son
+          { "son", NULL, N_( "Songhai" ) },
+          // language code: sot st
+          { "sot", "st", N_( "Sotho, Southern" ) },
+          // language code: spa es
+          { "spa", "es", N_( "Spanish" ) },
+          // language code: srd sc
+          { "srd", "sc", N_( "Sardinian" ) },
+          // language code: srr
+          { "srr", NULL, N_( "Serer" ) },
+          // language code: ssa
+          { "ssa", NULL, N_( "Nilo-Saharan (Other)" ) },
+          // language code: ssw ss
+          { "ssw", "ss", N_( "Swati" ) },
+          // language code: suk
+          { "suk", NULL, N_( "Sukuma" ) },
+          // language code: sun su
+          { "sun", "su", N_( "Sundanese" ) },
+          // language code: sus
+          { "sus", NULL, N_( "Susu" ) },
+          // language code: sux
+          { "sux", NULL, N_( "Sumerian" ) },
+          // language code: swa sw
+          { "swa", "sw", N_( "Swahili" ) },
+          // language code: swe sv
+          { "swe", "sv", N_( "Swedish" ) },
+          // language code: syr
+          { "syr", NULL, N_( "Syriac" ) },
+          // language code: tah ty
+          { "tah", "ty", N_( "Tahitian" ) },
+          // language code: tai
+          { "tai", NULL, N_( "Tai (Other)" ) },
+          // language code: tam ta
+          { "tam", "ta", N_( "Tamil" ) },
+          // language code: tat tt
+          { "tat", "tt", N_( "Tatar" ) },
+          // language code: tel te
+          { "tel", "te", N_( "Telugu" ) },
+          // language code: tem
+          { "tem", NULL, N_( "Timne" ) },
+          // language code: ter
+          { "ter", NULL, N_( "Tereno" ) },
+          // language code: tet
+          { "tet", NULL, N_( "Tetum" ) },
+          // language code: tgk tg
+          { "tgk", "tg", N_( "Tajik" ) },
+          // language code: tgl tl
+          { "tgl", "tl", N_( "Tagalog" ) },
+          // language code: tha th
+          { "tha", "th", N_( "Thai" ) },
+          // language code: tib bod bo
+          { "tib", "bo", N_( "Tibetan" ) },
+          // language code: tib bod bo
+          { "bod", NULL, N_( "Tibetan" ) },
+          // language code: tig
+          { "tig", NULL, N_( "Tigre" ) },
+          // language code: tir ti
+          { "tir", "ti", N_( "Tigrinya" ) },
+          // language code: tiv
+          { "tiv", NULL, N_( "Tiv" ) },
+          // language code: tkl
+          { "tkl", NULL, N_( "Tokelau" ) },
+          // language code: tlh
+          { "tlh", NULL, N_( "Klingon" ) },
+          // language code: tli
+          { "tli", NULL, N_( "Tlingit" ) },
+          // language code: tmh
+          { "tmh", NULL, N_( "Tamashek" ) },
+          // language code: tog
+          { "tog", NULL, N_( "Tonga (Nyasa)" ) },
+          // language code: ton to
+          { "ton", "to", N_( "Tonga (Tonga Islands)" ) },
+          // language code: tpi
+          { "tpi", NULL, N_( "Tok Pisin" ) },
+          // language code: tsi
+          { "tsi", NULL, N_( "Tsimshian" ) },
+          // language code: tsn tn
+          { "tsn", "tn", N_( "Tswana" ) },
+          // language code: tso ts
+          { "tso", "ts", N_( "Tsonga" ) },
+          // language code: tuk tk
+          { "tuk", "tk", N_( "Turkmen" ) },
+          // language code: tum
+          { "tum", NULL, N_( "Tumbuka" ) },
+          // language code: tup
+          { "tup", NULL, N_( "Tupi Languages" ) },
+          // language code: tur tr
+          { "tur", "tr", N_( "Turkish" ) },
+          // language code: tut
+          { "tut", NULL, N_( "Altaic (Other)" ) },
+          // language code: tvl
+          { "tvl", NULL, N_( "Tuvalu" ) },
+          // language code: twi tw
+          { "twi", "tw", N_( "Twi" ) },
+          // language code: tyv
+          { "tyv", NULL, N_( "Tuvinian" ) },
+          // language code: udm
+          { "udm", NULL, N_( "Udmurt" ) },
+          // language code: uga
+          { "uga", NULL, N_( "Ugaritic" ) },
+          // language code: uig ug
+          { "uig", "ug", N_( "Uighur" ) },
+          // language code: ukr uk
+          { "ukr", "uk", N_( "Ukrainian" ) },
+          // language code: umb
+          { "umb", NULL, N_( "Umbundu" ) },
+          // language code: und
+          { "und", NULL, N_( "Undetermined" ) },
+          // language code: urd ur
+          { "urd", "ur", N_( "Urdu" ) },
+          // language code: uzb uz
+          { "uzb", "uz", N_( "Uzbek" ) },
+          // language code: vai
+          { "vai", NULL, N_( "Vai" ) },
+          // language code: ven ve
+          { "ven", "ve", N_( "Venda" ) },
+          // language code: vie vi
+          { "vie", "vi", N_( "Vietnamese" ) },
+          // language code: vol vo
+          { "vol", "vo", N_( "Volapuk" ) },
+          // language code: vot
+          { "vot", NULL, N_( "Votic" ) },
+          // language code: wak
+          { "wak", NULL, N_( "Wakashan Languages" ) },
+          // language code: wal
+          { "wal", NULL, N_( "Walamo" ) },
+          // language code: war
+          { "war", NULL, N_( "Waray" ) },
+          // language code: was
+          { "was", NULL, N_( "Washo" ) },
+          // language code: wel cym cy
+          { "wel", "cy", N_( "Welsh" ) },
+          // language code: wel cym cy
+          { "cym", NULL, N_( "Welsh" ) },
+          // language code: wen
+          { "wen", NULL, N_( "Sorbian Languages" ) },
+          // language code: wln wa
+          { "wln", "wa", N_( "Walloon" ) },
+          // language code: wol wo
+          { "wol", "wo", N_( "Wolof" ) },
+          // language code: xal
+          { "xal", NULL, N_( "Kalmyk" ) },
+          // language code: xho xh
+          { "xho", "xh", N_( "Xhosa" ) },
+          // language code: yao
+          { "yao", NULL, N_( "Yao" ) },
+          // language code: yap
+          { "yap", NULL, N_( "Yapese" ) },
+          // language code: yid yi
+          { "yid", "yi", N_( "Yiddish" ) },
+          // language code: yor yo
+          { "yor", "yo", N_( "Yoruba" ) },
+          // language code: ypk
+          { "ypk", NULL, N_( "Yupik Languages" ) },
+          // language code: zap
+          { "zap", NULL, N_( "Zapotec" ) },
+          // language code: zen
+          { "zen", NULL, N_( "Zenaga" ) },
+          // language code: zha za
+          { "zha", "za", N_( "Zhuang" ) },
+          // language code: znd
+          { "znd", NULL, N_( "Zande" ) },
+          // language code: zul zu
+          { "zul", "zu", N_( "Zulu" ) },
+          // language code: zun
+          { "zun", NULL, N_( "Zuni" ) },
 
-         { NULL, NULL, NULL }
+          { NULL, NULL, NULL }
       };
 
       for (const LangInit * i = langInit; i->iso639_2 != NULL; ++i)
       {
-         const char * name( i->name );
-         _codeMap[i->iso639_2] = name;
-         if (i->iso639_1 != NULL)
-             _codeMap[i->iso639_1] = name;
+          const char * name( i->name );
+          _codeMap[i->iso639_2] = name;
+          if (i->iso639_1 != NULL)
+              _codeMap[i->iso639_1] = name;
       }
     }
   } // namespace
index 8949483..ab2698f 100644 (file)
@@ -28,7 +28,7 @@ namespace zypp
     {
        boost::string_ref::size_type sep = trashStart( code_r );
        if ( sep != boost::string_ref::npos )
-        code_r = IdString( code_r.c_str(), sep );
+         code_r = IdString( code_r.c_str(), sep );
        return code_r;
     }
 
@@ -46,18 +46,18 @@ namespace zypp
       IdString ret;
       if ( language_r )
       {
-       if ( country_r )
-         ret = IdString( std::string(language_r) + "_" + country_r.c_str() );
-       else
-         ret = IdString(language_r);
+        if ( country_r )
+          ret = IdString( std::string(language_r) + "_" + country_r.c_str() );
+        else
+          ret = IdString(language_r);
       }
       else
       {
-       if ( country_r )
-         ret = IdString( "_" + std::string(country_r) );
-       else if ( ! ( IdString(language_r) || IdString(country_r) ) )
-         ret = IdString::Null;
-       // else IdString::Empty
+        if ( country_r )
+          ret = IdString( "_" + std::string(country_r) );
+        else if ( ! ( IdString(language_r) || IdString(country_r) ) )
+          ret = IdString::Null;
+        // else IdString::Empty
       }
       return ret;
     }
@@ -81,9 +81,9 @@ namespace zypp
       std::string ret( lc._l.name() );
       if ( lc._c )
       {
-       ret += " (";
-       ret += lc._c.name();
-       ret += ")";
+        ret += " (";
+        ret += lc._c.name();
+        ret += ")";
       }
       return ret;
     }
@@ -93,14 +93,14 @@ namespace zypp
       static const IdString special( "pt_BR" );
       Locale ret;
       if ( index_r == special )        // "pt_BR"->"en" - by now the only fallback exception
-       ret = Locale::enCode;
+        ret = Locale::enCode;
       else
       {
-       const LC & lc( getIndex( index_r ) );
-       if ( lc._c )
-         ret = lc._l;
-       else if ( lc._l && lc._l != LanguageCode::enCode )
-         ret = Locale::enCode;
+        const LC & lc( getIndex( index_r ) );
+        if ( lc._c )
+          ret = lc._l;
+        else if ( lc._l && lc._l != LanguageCode::enCode )
+          ret = Locale::enCode;
       }
       return ret;
     }
@@ -110,7 +110,7 @@ namespace zypp
     {
       boost::string_ref::size_type sep = trashStart( code_r );
       if ( sep != boost::string_ref::npos )
-       code_r = code_r.substr( 0, sep );
+        code_r = code_r.substr( 0, sep );
       return IdString( code_r );
     }
 
@@ -142,22 +142,22 @@ namespace zypp
       auto it = _codeMap.find( index_r );
       if ( it == _codeMap.end() )
       {
-       CodeMap::value_type newval( index_r, LC() );
-
-       boost::string_ref str( index_r.c_str() );
-       boost::string_ref::size_type sep = str.find( '_' );
-       if ( sep == boost::string_ref::npos )
-         newval.second._l = LanguageCode( index_r );
-       else
-       {
-         // bsc#1064999: dup! Creating a new IdString may invalidate the IdString.c_str() stored in str.
-         std::string dup( str );
-         str = dup;
-         newval.second._l = LanguageCode( IdString(str.substr( 0, sep )) );
-         newval.second._c = CountryCode( IdString(str.substr( sep+1 )) );
-       }
-
-       it = _codeMap.insert( std::move(newval) ).first;
+        CodeMap::value_type newval( index_r, LC() );
+
+        boost::string_ref str( index_r.c_str() );
+        boost::string_ref::size_type sep = str.find( '_' );
+        if ( sep == boost::string_ref::npos )
+          newval.second._l = LanguageCode( index_r );
+        else
+        {
+          // bsc#1064999: dup! Creating a new IdString may invalidate the IdString.c_str() stored in str.
+          std::string dup( str );
+          str = dup;
+          newval.second._l = LanguageCode( IdString(str.substr( 0, sep )) );
+          newval.second._c = CountryCode( IdString(str.substr( sep+1 )) );
+        }
+
+        it = _codeMap.insert( std::move(newval) ).first;
       }
       return it->second;
     }
@@ -215,7 +215,7 @@ namespace zypp
     if ( ! avLocales_r.empty() )
     {
       if ( ! requested_r )
-       requested_r = ZConfig::instance().textLocale();
+        requested_r = ZConfig::instance().textLocale();
       for ( ; requested_r; requested_r = requested_r.fallback() )
       {
         if ( avLocales_r.count( requested_r ) )
index 638bd75..5e5ef6d 100644 (file)
@@ -65,7 +65,7 @@ public:
   bool     locksDirty;
 
   bool mergeList(callback::SendReport<SavingLocksReport>& report);
-  
+
   Impl()
   : locksDirty( false )
   , _APIdirty( false )
@@ -125,7 +125,7 @@ struct ApplyLock
 };
 
 /**
- * iterator that takes lock, lock all solvables from query 
+ * iterator that takes lock, lock all solvables from query
  * and send query to output iterator
  */
 template <class OutputIterator>
@@ -140,7 +140,7 @@ struct LockingOutputIterator
     ApplyLock a;a(query);
     *out++ = query;
   }
-  
+
   private:
   OutputIterator& out;
 };
@@ -166,13 +166,13 @@ void Locks::read( const Pathname& file )
   PathInfo pinfo(file);
   if ( pinfo.isExist() )
     readPoolQueriesFromFile( file, std::insert_iterator<LockSet>(_pimpl->MANIPlocks(), _pimpl->MANIPlocks().end()) );
-  else 
+  else
     MIL << "file does not exist(or cannot be stat), no lock added." << endl;
 }
 
 
 void Locks::apply() const
-{ 
+{
   DBG << "apply locks" << endl;
   for_each(_pimpl->locks().begin(), _pimpl->locks().end(), ApplyLock());
 }
@@ -227,7 +227,7 @@ void Locks::removeLock( const PoolQuery& query )
     PoolItem item(*it);
     item.status().setLock(false,ResStatus::USER);
   }
-  
+
   if ( _pimpl->toAdd.erase( query ) )
   {
     DBG << "query removed from added" << endl;
@@ -333,7 +333,7 @@ void Locks::removeEmpty()
     MIL << "cleaning aborted" << endl;
     report->finish(CleanEmptyLocksReport::ABORTED);
   }
-  else 
+  else
   {
     report->finish(CleanEmptyLocksReport::NO_ERROR);
 
index 6d88864..0f58d4b 100644 (file)
@@ -5,14 +5,14 @@
 #include <zypp/Pathname.h>
 #include <zypp/PoolQuery.h>
 #include <zypp/ZConfig.h>
+
 namespace zypp
 {
   /** \name Locks */
   //@{
   /**
    * Singleton class which manipulate with locks file and apply locks on pool.
-   * for user information about locksfile and its format see 
+   * for user information about locksfile and its format see
    * <a>http://en.opensuse.org/Libzypp/Locksfile</a>
    */
   class Locks
@@ -55,19 +55,19 @@ namespace zypp
     /**
      * add lock by name and kind and
      * add this lock as toAdd
-     */ 
+     */
     void addLock( const ResKind& kind_r, const IdString& name_r );
 
     /**
      * add lock by name and kind and
      * add this lock as toAdd
-     */ 
+     */
     void addLock( const ResKind& kind_r, const C_Str& name_r );
 
     /**
      * unlocks by result of query and add to toRemove.
      *
-     * If unlock non-saved lock (so he is in toAdd list) then both is deleted 
+     * If unlock non-saved lock (so he is in toAdd list) then both is deleted
      * and nathing happen during save
      */
     void removeLock( const PoolQuery& query );
@@ -75,7 +75,7 @@ namespace zypp
     /**
      * remove lock by identifier (e.g. Selectable->ident()
      *
-     * If unlock non-saved lock (so he is in toAdd list) then both is deleted 
+     * If unlock non-saved lock (so he is in toAdd list) then both is deleted
      * and nathing happen during save
      */
     void removeLock( const IdString& ident_r );
@@ -83,7 +83,7 @@ namespace zypp
     /**
      * remove lock by name and kind
      *
-     * If unlock non-saved lock (so he is in toAdd list) then both is deleted 
+     * If unlock non-saved lock (so he is in toAdd list) then both is deleted
      * and nathing happen during save
      */
     void removeLock( const ResKind& kind_r, const IdString& name_r );
@@ -120,7 +120,7 @@ namespace zypp
      * \see SavingLocksReport
      */
     void merge();
-    
+
     /**
      * Gets true if some lock doesn't lock any object in pool
      * This can happen e.g. if package is removed or
@@ -144,10 +144,10 @@ namespace zypp
     //@}
   private:
     Locks();
-    
+
     RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
 
   };
 }
-    
+
 #endif
index a9077c4..9356185 100644 (file)
@@ -53,7 +53,7 @@ IMPL_PTR_TYPE(MediaSetAccess);
     {
       media::MediaManager manager;
       for ( const auto & mm : _medias )
-       manager.close( mm.second );
+        manager.close( mm.second );
     }
     catch(...) {} // don't let exception escape a dtor.
   }
@@ -327,9 +327,9 @@ IMPL_PTR_TYPE(MediaSetAccess);
           }
 
           // Propagate the original error if _no_ callback receiver is connected, or
-         // non_interactive mode (for optional files) is used (except for wrong media).
+          // non_interactive mode (for optional files) is used (except for wrong media).
           if ( ! callback::SendReport<media::MediaChangeReport>::connected()
-            || (( options & PROVIDE_NON_INTERACTIVE ) && reason != media::MediaChangeReport::WRONG ) )
+             || (( options & PROVIDE_NON_INTERACTIVE ) && reason != media::MediaChangeReport::WRONG ) )
           {
               MIL << "Can't provide file. Non-Interactive mode." << endl;
               ZYPP_RETHROW(excp);
@@ -362,22 +362,22 @@ IMPL_PTR_TYPE(MediaSetAccess);
           else if ( user == media::MediaChangeReport::IGNORE )
           {
             DBG << "Skipping" << endl;
-           SkipRequestException nexcp("User-requested skipping of a file");
-           nexcp.remember(excp);
-           ZYPP_THROW(nexcp);
-         }
+            SkipRequestException nexcp("User-requested skipping of a file");
+            nexcp.remember(excp);
+            ZYPP_THROW(nexcp);
+          }
           else if ( user == media::MediaChangeReport::EJECT )
           {
             DBG << "Eject: try to release" << endl;
-           try
-           {
-             media_mgr.releaseAll();
-             media_mgr.release (media, devindex < devices.size() ? devices[devindex] : "");
-           }
-           catch ( const Exception & e)
-           {
-             ZYPP_CAUGHT(e);
-           }
+            try
+            {
+              media_mgr.releaseAll();
+              media_mgr.release (media, devindex < devices.size() ? devices[devindex] : "");
+            }
+            catch ( const Exception & e)
+            {
+              ZYPP_CAUGHT(e);
+            }
           }
           else if ( user == media::MediaChangeReport::RETRY  ||
             user == media::MediaChangeReport::CHANGE_URL )
index 7f570ec..41a4bd2 100644 (file)
@@ -261,17 +261,17 @@ namespace zypp
       ///////////////////////////////////////////////////////////////////
       struct ReleaseFileGuard
       {
-       NON_COPYABLE( ReleaseFileGuard );
-       NON_MOVABLE( ReleaseFileGuard );
-       ReleaseFileGuard( MediaSetAccess & media_r, const OnMediaLocation & loc_r )
-       : _media( media_r )
-       , _loc( loc_r )
-       {}
-       ~ReleaseFileGuard()
-       { _media.releaseFile( _loc ); }
+        NON_COPYABLE( ReleaseFileGuard );
+        NON_MOVABLE( ReleaseFileGuard );
+        ReleaseFileGuard( MediaSetAccess & media_r, const OnMediaLocation & loc_r )
+        : _media( media_r )
+        , _loc( loc_r )
+        {}
+        ~ReleaseFileGuard()
+        { _media.releaseFile( _loc ); }
       private:
-       MediaSetAccess & _media;
-       const OnMediaLocation & _loc;
+        MediaSetAccess & _media;
+        const OnMediaLocation & _loc;
       };
 
       /**
index dac0c8e..2b3534d 100644 (file)
@@ -44,17 +44,17 @@ namespace zyppintern
     {
       Url url( repo_r.url() );
       if ( ! schemeIsLocalDir( url ) )
-       return Pathname();      // same name but no checksum to verify
+        return Pathname();     // same name but no checksum to verify
 
       // for local repos compare with the checksum in repo
       if ( CheckSum( CheckSum::md5Type(), std::ifstream( (url.getPathName() / repo_r.path() / loc_r.filename()).c_str() ) )
-       != CheckSum( CheckSum::md5Type(), std::ifstream( pi.c_str() ) ) )
-       return Pathname();      // same name but wrong checksum
+        != CheckSum( CheckSum::md5Type(), std::ifstream( pi.c_str() ) ) )
+        return Pathname();     // same name but wrong checksum
     }
     else
     {
       if ( loc_r.checksum() != CheckSum( loc_r.checksum().type(), std::ifstream( pi.c_str() ) ) )
-       return Pathname();      // same name but wrong checksum
+        return Pathname();     // same name but wrong checksum
     }
 
     return pi.path();          // the right one
@@ -98,27 +98,27 @@ namespace zypp
     for ( const auto & solv : sat::WhatProvides( (Capability(ident().id())) ) )
     {
       if ( solv.edition() == edition()
-       && solv.ident() == ident()
-       && identical( solv ) )
+        && solv.ident() == ident()
+        && identical( solv ) )
       {
-       for ( PackageKeyword kw : Keywords( sat::SolvAttr::keywords, solv ) )
-       {
-         switch ( ret )
-         {
-           case VendorSupportUnknown:
-             if ( kw == support_unsupported )  { ret = VendorSupportUnsupported; break; }
-           case VendorSupportUnsupported:
-             if ( kw == support_acc )  { ret = VendorSupportACC; break; }
-           case VendorSupportACC:
-             if ( kw == support_l1 )   { ret = VendorSupportLevel1; break; }
-           case VendorSupportLevel1:
-             if ( kw == support_l2 )   { ret = VendorSupportLevel2; break; }
-           case VendorSupportLevel2:
-             if ( kw == support_l3 )   { return VendorSupportLevel3; break; }
-           case VendorSupportLevel3:
-             /* make gcc happy */ break;
-         }
-       }
+        for ( PackageKeyword kw : Keywords( sat::SolvAttr::keywords, solv ) )
+        {
+          switch ( ret )
+          {
+            case VendorSupportUnknown:
+              if ( kw == support_unsupported ) { ret = VendorSupportUnsupported; break; }
+            case VendorSupportUnsupported:
+              if ( kw == support_acc ) { ret = VendorSupportACC; break; }
+            case VendorSupportACC:
+              if ( kw == support_l1 )  { ret = VendorSupportLevel1; break; }
+            case VendorSupportLevel1:
+              if ( kw == support_l2 )  { ret = VendorSupportLevel2; break; }
+            case VendorSupportLevel2:
+              if ( kw == support_l3 )  { return VendorSupportLevel3; break; }
+            case VendorSupportLevel3:
+              /* make gcc happy */ break;
+          }
+        }
       }
     }
     return ret;
@@ -131,12 +131,12 @@ namespace zypp
       case VendorSupportUnknown:
       case VendorSupportUnsupported:
       case VendorSupportACC:
-       return true;
+        return true;
 
       case VendorSupportLevel1:
       case VendorSupportLevel2:
       case VendorSupportLevel3:
-       break;  // intentionally no default:
+        break; // intentionally no default:
     }
     return false;
   }
index 7906eea..be00617 100644 (file)
@@ -67,52 +67,52 @@ namespace zypp
       //       CAT_YAST
       case 'y':
       case 'Y':
-       if ( str::compareCI( category_r, "yast" ) == 0 )
-         return CAT_YAST;
-       break;
+        if ( str::compareCI( category_r, "yast" ) == 0 )
+          return CAT_YAST;
+        break;
 
       //       CAT_SECURITY
       case 's':
       case 'S':
-       if ( str::compareCI( category_r, "security" ) == 0 )
-         return CAT_SECURITY;
-       break;
+        if ( str::compareCI( category_r, "security" ) == 0 )
+          return CAT_SECURITY;
+        break;
 
       //       CAT_RECOMMENDED
       case 'r':
       case 'R':
-       if ( str::compareCI( category_r, "recommended" ) == 0 )
-         return CAT_RECOMMENDED;
-       break;
+        if ( str::compareCI( category_r, "recommended" ) == 0 )
+          return CAT_RECOMMENDED;
+        break;
       case 'b':
       case 'B':
-       if ( str::compareCI( category_r, "bugfix" ) == 0 )      // rhn
-         return CAT_RECOMMENDED;
-       break;
+        if ( str::compareCI( category_r, "bugfix" ) == 0 )     // rhn
+          return CAT_RECOMMENDED;
+        break;
 
       //       CAT_OPTIONAL
       case 'o':
       case 'O':
-       if ( str::compareCI( category_r, "optional" ) == 0 )
-         return CAT_OPTIONAL;
-       break;
+        if ( str::compareCI( category_r, "optional" ) == 0 )
+          return CAT_OPTIONAL;
+        break;
       case 'f':
       case 'F':
-       if ( str::compareCI( category_r, "feature" ) == 0 )
-         return CAT_OPTIONAL;
-       break;
+        if ( str::compareCI( category_r, "feature" ) == 0 )
+          return CAT_OPTIONAL;
+        break;
       case 'e':
       case 'E':
-       if ( str::compareCI( category_r, "enhancement" ) == 0 ) // rhn
-         return CAT_OPTIONAL;
-       break;
+        if ( str::compareCI( category_r, "enhancement" ) == 0 )        // rhn
+          return CAT_OPTIONAL;
+        break;
 
       //       CAT_DOCUMENT
       case 'd':
       case 'D':
-       if ( str::compareCI( category_r, "document" ) == 0 )
-         return CAT_DOCUMENT;
-       break;
+        if ( str::compareCI( category_r, "document" ) == 0 )
+          return CAT_DOCUMENT;
+        break;
     }
     // default:
     INT << "Unrecognized Patch::Category string '" << category_r << "'" << endl;
@@ -154,37 +154,37 @@ namespace zypp
     {
       case 'l':
       case 'L':
-       if ( str::compareCI( severity_r, "low" ) == 0 )
-         return SEV_LOW;
-       break;
+        if ( str::compareCI( severity_r, "low" ) == 0 )
+          return SEV_LOW;
+        break;
 
       case 'm':
       case 'M':
-       if ( str::compareCI( severity_r, "moderate" ) == 0 )
-         return SEV_MODERATE;
-       break;
+        if ( str::compareCI( severity_r, "moderate" ) == 0 )
+          return SEV_MODERATE;
+        break;
 
       case 'i':
       case 'I':
-       if ( str::compareCI( severity_r, "important" ) == 0 )
-         return SEV_IMPORTANT;
-       break;
+        if ( str::compareCI( severity_r, "important" ) == 0 )
+          return SEV_IMPORTANT;
+        break;
 
       case 'c':
       case 'C':
-       if ( str::compareCI( severity_r, "critical" ) == 0 )
-         return SEV_CRITICAL;
-       break;
+        if ( str::compareCI( severity_r, "critical" ) == 0 )
+          return SEV_CRITICAL;
+        break;
 
       case 'u':
       case 'U':
-       if ( str::compareCI( severity_r, "unspecified" ) == 0 )
-         return SEV_NONE;
-       break;
+        if ( str::compareCI( severity_r, "unspecified" ) == 0 )
+          return SEV_NONE;
+        break;
 
       case '\0':
-       return SEV_NONE;
-       break;
+        return SEV_NONE;
+        break;
     }
     // default:
     INT << "Unrecognized Patch::Severity string '" << severity_r << "'" << endl;
index 33de43c..9247c73 100644 (file)
@@ -74,12 +74,12 @@ namespace zypp
        * \ref asSring( const Patch::SeverityFlag & ).
        */
       enum SeverityFlag {
-       SEV_OTHER       = 1,    //!< unknown value specified
-       SEV_NONE        = 1<<1, //!< no value specified
-       SEV_LOW         = 1<<2, //!< Low
-       SEV_MODERATE    = 1<<3, //!< Moderate
-       SEV_IMPORTANT   = 1<<4, //!< Important
-       SEV_CRITICAL    = 1<<5  //!< Critical
+        SEV_OTHER      = 1,    //!< unknown value specified
+        SEV_NONE       = 1<<1, //!< no value specified
+        SEV_LOW                = 1<<2, //!< Low
+        SEV_MODERATE   = 1<<3, //!< Moderate
+        SEV_IMPORTANT  = 1<<4, //!< Important
+        SEV_CRITICAL   = 1<<5  //!< Critical
       };
       ZYPP_DECLARE_FLAGS(SeverityFlags, SeverityFlag);
 
@@ -114,9 +114,9 @@ namespace zypp
       template <class TContainer, typename = typename TContainer::value_type>
       bool isCategory( const TContainer & categories_r ) const
       {
-       for ( const std::string & el : categories_r )
-       { if ( isCategory( el ) ) return true; }
-       return false;
+        for ( const std::string & el : categories_r )
+        { if ( isCategory( el ) ) return true; }
+        return false;
       }
 
       /** Patch category as enum of wellknown categories.
@@ -150,9 +150,9 @@ namespace zypp
       template <class TContainer, typename = typename TContainer::value_type>
       bool isSeverity( const TContainer & severities_r ) const
       {
-       for ( const std::string & el : severities_r )
-       { if ( isSeverity( el ) ) return true; }
-       return false;
+        for ( const std::string & el : severities_r )
+        { if ( isSeverity( el ) ) return true; }
+        return false;
       }
 
       /** Severity string mapped to an enum.
index 32b5169..4631160 100644 (file)
@@ -32,16 +32,16 @@ namespace zypp
     int dirForEach( const Pathname & dir_r, const StrMatcher & matcher_r, function<bool( const Pathname &, const char *const)> fnc_r )
     {
       if ( ! fnc_r )
-       return 0;
+        return 0;
 
       bool nodots = ( &matcher_r == &matchNoDots() );
       return dirForEach( dir_r,
-                        [&]( const Pathname & dir_r, const char *const name_r )->bool
-                        {
-                          if ( ( nodots && name_r[0] == '.' ) || ! matcher_r( name_r ) )
-                            return true;
-                          return fnc_r( dir_r, name_r );
-                        } );
+                         [&]( const Pathname & dir_r, const char *const name_r )->bool
+                         {
+                           if ( ( nodots && name_r[0] == '.' ) || ! matcher_r( name_r ) )
+                             return true;
+                           return fnc_r( dir_r, name_r );
+                         } );
     }
 
     /////////////////////////////////////////////////////////////////
index 91b24df..1ccf729 100644 (file)
@@ -28,8 +28,8 @@ namespace zypp
     {
       static const Capability autopattern( "autopattern()" );
       for ( const auto & cap : provides_r )
-       if ( cap.matches( autopattern ) == CapMatch::yes )
-         return cap;
+        if ( cap.matches( autopattern ) == CapMatch::yes )
+          return cap;
       return Capability();
     }
 
@@ -186,7 +186,7 @@ namespace zypp
     // is visible IFF ident is available in the pool.
     IdString ident( lookupStrAttribute( sat::SolvAttr::isvisible ) );
     return( ident.empty() ? lookupBoolAttribute( sat::SolvAttr::isvisible )
-                         : ! ResPool::instance().byIdent( ident ).empty() );
+                          : ! ResPool::instance().byIdent( ident ).empty() );
   }
 
   std::string Pattern::category( const Locale & lang_r ) const
@@ -211,8 +211,8 @@ namespace zypp
     {
       Capability pkgCap( arch(), autocap.detail().ed().asString(), Rel::EQ, edition() );
       for ( const auto & solv: sat::WhatProvides( pkgCap ) )
-       if ( solv.repository() == repository() )
-         return solv;
+        if ( solv.repository() == repository() )
+          return solv;
     }
     return sat::Solvable();
   }
@@ -231,7 +231,7 @@ namespace zypp
       Capabilities c( solv_r[dep_r] );
       if ( ! c.empty() )
       {
-       caps_r.insert( c.begin(),c.end() );
+        caps_r.insert( c.begin(),c.end() );
       }
     }
   } //namespace
@@ -272,7 +272,7 @@ namespace zypp
       addCaps( caps, depKeeper, Dep::REQUIRES );
       addCaps( caps, depKeeper, Dep::RECOMMENDS );
       if ( includeSuggests_r )
-       addCaps( caps, depKeeper, Dep::SUGGESTS );
+        addCaps( caps, depKeeper, Dep::SUGGESTS );
     }
     // get items providing the above
     sat::WhatProvides prv( caps );
@@ -307,9 +307,9 @@ namespace zypp
       sat::WhatProvides prv( caps );
       for ( ui::Selectable::Ptr sel : prv.selectable() )
       {
-       const PoolItem & pi( sel->theObj() );
-       if ( pi.isKind<Package>() )
-         set_r.insert( pi );
+        const PoolItem & pi( sel->theObj() );
+        if ( pi.isKind<Package>() )
+          set_r.insert( pi );
       }
     }
 
@@ -348,30 +348,30 @@ namespace zypp
 
       while ( ! reqTodo.empty() )
       {
-       // pop one patterns-package from todo
-       depKeeper = ( *reqTodo.begin() );
-       reqTodo.erase( reqTodo.begin() );
-       allDone.insert( depKeeper );
-
-       // collects stats
-       ContentsSet result;
-       dependsSet( depKeeper, result );
-
-       // evaluate result....
-       for ( sat::Solvable solv : result.req ) // remember unprocessed required patterns-packages...
-       {
-         if ( collect_r.req.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
-           reqTodo.insert( solv );
-       }
-       for ( sat::Solvable solv : result.rec ) // remember unprocessed recommended patterns-packages...
-       {
-         if ( collect_r.rec.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
-           recTodo.insert( solv );
-       }
-       for ( sat::Solvable solv : result.sug ) // NOTE: We don't expand suggested patterns!
-       {
-         collect_r.sug.insert( solv );
-       }
+        // pop one patterns-package from todo
+        depKeeper = ( *reqTodo.begin() );
+        reqTodo.erase( reqTodo.begin() );
+        allDone.insert( depKeeper );
+
+        // collects stats
+        ContentsSet result;
+        dependsSet( depKeeper, result );
+
+        // evaluate result....
+        for ( sat::Solvable solv : result.req )        // remember unprocessed required patterns-packages...
+        {
+          if ( collect_r.req.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
+            reqTodo.insert( solv );
+        }
+        for ( sat::Solvable solv : result.rec )        // remember unprocessed recommended patterns-packages...
+        {
+          if ( collect_r.rec.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
+            recTodo.insert( solv );
+        }
+        for ( sat::Solvable solv : result.sug )        // NOTE: We don't expand suggested patterns!
+        {
+          collect_r.sug.insert( solv );
+        }
       }
     }
     // step 2: All requirements are expanded, now check remaining recommends....
@@ -381,7 +381,7 @@ namespace zypp
       depKeeper = ( *recTodo.begin() );
       recTodo.erase( recTodo.begin() );
       if ( ! allDone.insert( depKeeper ).second )
-       continue;       // allready expanded (in requires)
+        continue;      // allready expanded (in requires)
 
       // collects stats
       ContentsSet result;
@@ -390,19 +390,19 @@ namespace zypp
       // evaluate result....
       for ( sat::Solvable solv : result.req )  // remember unprocessed required patterns-packages...
       {
-       // NOTE: Requirements of recommended patterns count as 'recommended'
-       if ( collect_r.rec.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
-         recTodo.insert( solv );
+        // NOTE: Requirements of recommended patterns count as 'recommended'
+        if ( collect_r.rec.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
+          recTodo.insert( solv );
       }
       for ( sat::Solvable solv : result.rec )  // remember unprocessed recommended patterns-packages...
       {
-       if ( collect_r.rec.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
-         recTodo.insert( solv );
+        if ( collect_r.rec.insert( solv ) && recursively_r && isPatternsPackage( solv ) )
+          recTodo.insert( solv );
       }
-       for ( sat::Solvable solv : result.sug ) // NOTE: We don't expand suggested patterns!
-       {
-         collect_r.sug.insert( solv );
-       }
+        for ( sat::Solvable solv : result.sug )        // NOTE: We don't expand suggested patterns!
+        {
+          collect_r.sug.insert( solv );
+        }
     }
   }
 
index 0d41e7a..127c05b 100644 (file)
@@ -100,9 +100,9 @@ namespace zypp
     public:
       struct ContentsSet
       {
-       Contents req;   ///< required content set
-       Contents rec;   ///< recommended content set
-       Contents sug;   ///< suggested content set
+        Contents req;  ///< required content set
+        Contents rec;  ///< recommended content set
+        Contents sug;  ///< suggested content set
       };
       /** Dependency based content set (does not evaluate includes/extends relation).
        * If \a recursively_r, required and recommended
index 7569654..cda9639 100644 (file)
@@ -37,7 +37,7 @@ namespace zypp
     ~Impl()
     {
       if ( ! empty() )
-       send( PluginFrame( "PLUGINEND" ) );
+        send( PluginFrame( "PLUGINEND" ) );
       // ~PluginScript will disconnect all remaining plugins!
     }
 
@@ -53,29 +53,29 @@ namespace zypp
       DBG << "+++++++++++++++ load " << pi << endl;
       if ( pi.isDir() )
       {
-       std::list<Pathname> entries;
-       if ( filesystem::readdir( entries, pi.path(), false ) != 0 )
-       {
-         WAR << "Plugin dir is not readable: " << pi << endl;
-         return;
-       }
-       for_( it, entries.begin(), entries.end() )
-       {
-         PathInfo pii( *it );
-         if ( pii.isFile() && pii.userMayRX() )
-           doLoad( pii );
-       }
+        std::list<Pathname> entries;
+        if ( filesystem::readdir( entries, pi.path(), false ) != 0 )
+        {
+          WAR << "Plugin dir is not readable: " << pi << endl;
+          return;
+        }
+        for_( it, entries.begin(), entries.end() )
+        {
+          PathInfo pii( *it );
+          if ( pii.isFile() && pii.userMayRX() )
+            doLoad( pii );
+        }
       }
       else if ( pi.isFile() )
       {
-       if ( pi.userMayRX() )
-         doLoad( pi );
-       else
-         WAR << "Plugin file is not executable: " << pi << endl;
+        if ( pi.userMayRX() )
+          doLoad( pi );
+        else
+          WAR << "Plugin file is not executable: " << pi << endl;
       }
       else
       {
-       WAR << "Plugin path is neither dir nor file: " << pi << endl;
+        WAR << "Plugin path is neither dir nor file: " << pi << endl;
       }
       DBG << "--------------- load " << pi << endl;
     }
@@ -85,11 +85,11 @@ namespace zypp
       DBG << "+++++++++++++++ send " << frame_r << endl;
       for ( auto it = _scripts.begin(); it != _scripts.end(); )
       {
-       doSend( *it, frame_r );
-       if ( it->isOpen() )
-         ++it;
-       else
-         it = _scripts.erase( it );
+        doSend( *it, frame_r );
+        if ( it->isOpen() )
+          ++it;
+        else
+          it = _scripts.erase( it );
       }
       DBG << "--------------- send " << frame_r << endl;
     }
@@ -103,20 +103,20 @@ namespace zypp
     {
       MIL << "Load plugin: " << pi_r << endl;
       try {
-       PluginScript plugin( pi_r.path() );
-       plugin.open();
+        PluginScript plugin( pi_r.path() );
+        plugin.open();
 
-       PluginFrame frame( "PLUGINBEGIN" );
-       if ( ZConfig::instance().hasUserData() )
-         frame.setHeader( "userdata", ZConfig::instance().userData() );
+        PluginFrame frame( "PLUGINBEGIN" );
+        if ( ZConfig::instance().hasUserData() )
+          frame.setHeader( "userdata", ZConfig::instance().userData() );
 
-       doSend( plugin, frame );        // closes on error
-       if ( plugin.isOpen() )
-         _scripts.push_back( plugin );
+        doSend( plugin, frame );       // closes on error
+        if ( plugin.isOpen() )
+          _scripts.push_back( plugin );
       }
       catch( const zypp::Exception & e )
       {
-       WAR << "Failed to load plugin " << pi_r << endl;
+        WAR << "Failed to load plugin " << pi_r << endl;
       }
     }
 
@@ -125,21 +125,21 @@ namespace zypp
       PluginFrame ret;
 
       try {
-       script_r.send( frame_r );
-       ret = script_r.receive();
+        script_r.send( frame_r );
+        ret = script_r.receive();
       }
       catch( const zypp::Exception & e )
       {
-       ZYPP_CAUGHT(e);
-       WAR << e.asUserHistory() << endl;
+        ZYPP_CAUGHT(e);
+        WAR << e.asUserHistory() << endl;
       }
 
       // Allow using "/bin/cat" as reflector-script for testing
       if ( ! ( ret.isAckCommand() || ret.isEnomethodCommand() || ( script_r.script() == "/bin/cat" && frame_r.command() != "ERROR" ) ) )
       {
-       WAR << "Bad plugin response from " << script_r << ": " << ret << endl;
-       WAR << "(Expected " << PluginFrame::ackCommand() << " or " << PluginFrame::enomethodCommand() << ")" << endl;
-       script_r.close();
+        WAR << "Bad plugin response from " << script_r << ": " << ret << endl;
+        WAR << "(Expected " << PluginFrame::ackCommand() << " or " << PluginFrame::enomethodCommand() << ")" << endl;
+        script_r.close();
       }
 
       return ret;
index 2186357..c443e15 100644 (file)
@@ -39,14 +39,14 @@ namespace zypp
       { setCommand( command_r ); }
 
       Impl( const std::string & command_r, const std::string & body_r )
-       : _body( body_r )
+        : _body( body_r )
       { setCommand( command_r ); }
 
       Impl( const std::string & command_r, HeaderInitializerList contents_r )
       { setCommand( command_r ); addHeader( contents_r ); }
 
       Impl( const std::string & command_r, const std::string & body_r, HeaderInitializerList contents_r )
-       : _body( body_r )
+        : _body( body_r )
       { setCommand( command_r ); addHeader( contents_r ); }
 
       Impl( std::istream & stream_r );
@@ -60,9 +60,9 @@ namespace zypp
 
       void setCommand( const std::string & command_r )
       {
-       if ( command_r.find( '\n' ) != std::string::npos )
-         ZYPP_THROW( PluginFrameException( "Multiline command", command_r ) );
-       _command = command_r;
+        if ( command_r.find( '\n' ) != std::string::npos )
+          ZYPP_THROW( PluginFrameException( "Multiline command", command_r ) );
+        _command = command_r;
       }
 
       const std::string & body() const
@@ -86,61 +86,61 @@ namespace zypp
 
       const std::string & getHeader( const std::string & key_r ) const
       {
-       constKeyRange r( _header.equal_range( key_r ) );
-       if ( r.first == r.second )
-         ZYPP_THROW( PluginFrameException( "No value for key", key_r ) );
-       const std::string & ret( r.first->second );
-       if ( ++r.first != r.second )
-         ZYPP_THROW( PluginFrameException( "Multiple values for key", key_r ) );
-       return ret;
+        constKeyRange r( _header.equal_range( key_r ) );
+        if ( r.first == r.second )
+          ZYPP_THROW( PluginFrameException( "No value for key", key_r ) );
+        const std::string & ret( r.first->second );
+        if ( ++r.first != r.second )
+          ZYPP_THROW( PluginFrameException( "Multiple values for key", key_r ) );
+        return ret;
       }
 
       const std::string & getHeader( const std::string & key_r, const std::string & default_r ) const
       {
-       constKeyRange r( _header.equal_range( key_r ) );
-       if ( r.first == r.second )
-         return default_r;
-       const std::string & ret( r.first->second );
-       if ( ++r.first != r.second )
-         ZYPP_THROW( PluginFrameException( "Multiple values for key", key_r ) );
-       return ret;
+        constKeyRange r( _header.equal_range( key_r ) );
+        if ( r.first == r.second )
+          return default_r;
+        const std::string & ret( r.first->second );
+        if ( ++r.first != r.second )
+          ZYPP_THROW( PluginFrameException( "Multiple values for key", key_r ) );
+        return ret;
       }
 
       const std::string & getHeaderNT( const std::string & key_r, const std::string & default_r ) const
       {
-       HeaderListIterator iter( _header.find( key_r ) );
-       return iter != _header.end() ? iter->second : default_r;
+        HeaderListIterator iter( _header.find( key_r ) );
+        return iter != _header.end() ? iter->second : default_r;
       }
 
       HeaderList::value_type mkHeaderPair( const std::string & key_r, const std::string & value_r )
       {
-       if ( key_r.find_first_of( ":\n" ) != std::string::npos )
-         ZYPP_THROW( PluginFrameException( "Illegal char in header key", key_r ) );
-       if ( value_r.find_first_of( "\n" ) != std::string::npos )
-         ZYPP_THROW( PluginFrameException( "Illegal char in header value", value_r ) );
-       return HeaderList::value_type( key_r, value_r );
+        if ( key_r.find_first_of( ":\n" ) != std::string::npos )
+          ZYPP_THROW( PluginFrameException( "Illegal char in header key", key_r ) );
+        if ( value_r.find_first_of( "\n" ) != std::string::npos )
+          ZYPP_THROW( PluginFrameException( "Illegal char in header value", value_r ) );
+        return HeaderList::value_type( key_r, value_r );
       }
 
       void setHeader( const std::string & key_r, const std::string & value_r )
       {
-       clearHeader( key_r );
-       addHeader( key_r, value_r );
+        clearHeader( key_r );
+        addHeader( key_r, value_r );
       }
 
       void addHeader( const std::string & key_r, const std::string & value_r )
       {
-       _header.insert( mkHeaderPair( key_r, value_r ) );
+        _header.insert( mkHeaderPair( key_r, value_r ) );
       }
 
       void addHeader( HeaderInitializerList contents_r )
       {
-       for ( const auto & el : contents_r )
-         addHeader( el.first, el.second );
+        for ( const auto & el : contents_r )
+          addHeader( el.first, el.second );
       }
 
       void clearHeader( const std::string & key_r )
       {
-       _header.erase( key_r );
+        _header.erase( key_r );
       }
 
     public:
@@ -155,8 +155,8 @@ namespace zypp
       /** Offer default Impl. */
       static shared_ptr<Impl> nullimpl()
       {
-       static shared_ptr<Impl> _nullimpl( new Impl );
-       return _nullimpl;
+        static shared_ptr<Impl> _nullimpl( new Impl );
+        return _nullimpl;
       }
     private:
       friend Impl * rwcowClone<Impl>( const Impl * rhs );
@@ -194,14 +194,14 @@ namespace zypp
     do {
       std::string data = str::getline( stream_r );
       if ( ! stream_r.good() )
-       ZYPP_THROW( PluginFrameException( "Missing NL after header" ) );
+        ZYPP_THROW( PluginFrameException( "Missing NL after header" ) );
 
       if ( data.empty() )
-       break;  // --> empty line sep. header and body
+        break; // --> empty line sep. header and body
 
       std::string::size_type sep( data.find( ':') );
       if ( sep ==  std::string::npos )
-       ZYPP_THROW( PluginFrameException( "Missing colon in header" ) );
+        ZYPP_THROW( PluginFrameException( "Missing colon in header" ) );
 
       _header.insert( HeaderList::value_type( data.substr(0,sep), data.substr(sep+1) ) );
     } while ( true );
index 7215096..68150f9 100644 (file)
@@ -46,18 +46,18 @@ namespace zypp
       PluginDebugBuffer( const std::string & buffer_r ) : _buffer( buffer_r ) {}
       ~PluginDebugBuffer()
       {
-       if ( PLUGIN_DEBUG )
-       {
-         if ( _buffer.empty() )
-         {
-           L_DBG("PLUGIN") << "< (empty)" << endl;
-         }
-         else
-         {
-           std::istringstream datas( _buffer );
-           iostr::copyIndent( datas, L_DBG("PLUGIN"), "< "  ) << endl;
-         }
-       }
+        if ( PLUGIN_DEBUG )
+        {
+          if ( _buffer.empty() )
+          {
+            L_DBG("PLUGIN") << "< (empty)" << endl;
+          }
+          else
+          {
+            std::istringstream datas( _buffer );
+            iostr::copyIndent( datas, L_DBG("PLUGIN"), "< "  ) << endl;
+          }
+        }
       }
       const std::string & _buffer;
     };
@@ -70,9 +70,9 @@ namespace zypp
       PluginDumpStderr( ExternalProgramWithStderr & prog_r ) : _prog( prog_r ) {}
       ~PluginDumpStderr()
       {
-       std::string line;
-       while ( _prog.stderrGetline( line ) )
-         L_WAR("PLUGIN") << "! " << line << endl;
+        std::string line;
+        while ( _prog.stderrGetline( line ) )
+          L_WAR("PLUGIN") << "! " << line << endl;
       }
       ExternalProgramWithStderr & _prog;
     };
@@ -80,24 +80,24 @@ namespace zypp
     inline void setBlocking( FILE * file_r, bool yesno_r = true )
     {
       if ( ! file_r )
-       ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
+        ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
 
       int fd = ::fileno( file_r );
       if ( fd == -1 )
-       ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
+        ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
 
       int flags = ::fcntl( fd, F_GETFL );
       if ( flags == -1 )
-       ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
+        ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
 
       if ( ! yesno_r )
-       flags |= O_NONBLOCK;
+        flags |= O_NONBLOCK;
       else if ( flags & O_NONBLOCK )
-       flags ^= O_NONBLOCK;
+        flags ^= O_NONBLOCK;
 
       flags = ::fcntl( fd, F_SETFL, flags );
       if ( flags == -1 )
-       ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
+        ZYPP_THROW( PluginScriptException( "setNonBlocking" ) );
     }
 
     inline void setNonBlocking( FILE * file_r, bool yesno_r = true )
@@ -182,9 +182,9 @@ namespace zypp
   }
 
   long PluginScript::Impl::_defaultSendTimeout =    ( PLUGIN_SEND_TIMEOUT > 0    ? PLUGIN_SEND_TIMEOUT
-                                                                                : ( PLUGIN_TIMEOUT > 0 ? PLUGIN_TIMEOUT : 30 ) );
+                                                                                 : ( PLUGIN_TIMEOUT > 0 ? PLUGIN_TIMEOUT : 30 ) );
   long PluginScript::Impl::_defaultReceiveTimeout = ( PLUGIN_RECEIVE_TIMEOUT > 0 ? PLUGIN_RECEIVE_TIMEOUT
-                                                                                : ( PLUGIN_TIMEOUT > 0 ? PLUGIN_TIMEOUT : 30 ) );
+                                                                                 : ( PLUGIN_TIMEOUT > 0 ? PLUGIN_TIMEOUT : 30 ) );
 
   ///////////////////////////////////////////////////////////////////
 
@@ -198,7 +198,7 @@ namespace zypp
     {
       PathInfo pi( script_r );
       if ( ! ( pi.isFile() && pi.isX() ) )
-       ZYPP_THROW( PluginScriptException( "Script is not executable", str::Str() << pi ) );
+        ZYPP_THROW( PluginScriptException( "Script is not executable", str::Str() << pi ) );
     }
 
     // go and launch script
@@ -229,24 +229,24 @@ namespace zypp
       DBG << "Close:" << *this << endl;
       bool doKill = true;
       try {
-       // do not kill script if _DISCONNECT is ACKed.
-       send( PluginFrame( "_DISCONNECT" ) );
-       PluginFrame ret( receive() );
-       if ( ret.isAckCommand() )
-       {
-         doKill = false;
-         str::strtonum( ret.getHeaderNT( "exit" ), _lastReturn.get() );
-         _lastExecError = ret.body();
-       }
+        // do not kill script if _DISCONNECT is ACKed.
+        send( PluginFrame( "_DISCONNECT" ) );
+        PluginFrame ret( receive() );
+        if ( ret.isAckCommand() )
+        {
+          doKill = false;
+          str::strtonum( ret.getHeaderNT( "exit" ), _lastReturn.get() );
+          _lastExecError = ret.body();
+        }
       }
       catch (...)
       { /* NOP */ }
 
       if ( doKill )
       {
-       _cmd->kill();
-       _lastReturn = _cmd->close();
-       _lastExecError = _cmd->execError();
+        _cmd->kill();
+        _lastReturn = _cmd->close();
+        _lastExecError = _cmd->execError();
       }
       DBG << *this << " -> [" << _lastReturn << "] " << _lastExecError << endl;
       _cmd.reset();
@@ -293,57 +293,57 @@ namespace zypp
       const char * buffer = data.c_str();
       ssize_t buffsize = data.size();
       do {
-       fd_set wfds;
-       FD_ZERO( &wfds );
-       FD_SET( fd, &wfds );
-
-       struct timeval tv;
-       tv.tv_sec = _sendTimeout;
-       tv.tv_usec = 0;
-
-       int retval = select( fd+1, NULL, &wfds, NULL, &tv );
-       if ( retval > 0 )       // FD_ISSET( fd, &wfds ) will be true.
-       {
-         //DBG << "Ready to write..." << endl;
-         ssize_t ret = ::write( fd, buffer, buffsize );
-         if ( ret == buffsize )
-         {
-           //DBG << "::write(" << buffsize << ") -> " << ret << endl;
-           ::fflush( filep );
-           break;              // -> done
-         }
-         else if ( ret > 0 )
-         {
-           //WAR << "::write(" << buffsize << ") -> " << ret << " INCOMPLETE..." << endl;
-           ::fflush( filep );
-           buffsize -= ret;
-           buffer += ret;      // -> continue
-         }
-         else // ( retval == -1 )
-         {
-           if ( errno != EINTR )
-           {
-             ERR << "write(): " << Errno() << endl;
-             if ( errno == EPIPE )
-               ZYPP_THROW( PluginScriptDiedUnexpectedly( "Send: script died unexpectedly", str::Str() << Errno() ) );
-             else
-               ZYPP_THROW( PluginScriptException( "Send: send error", str::Str() << Errno() ) );
-           }
-         }
-       }
-       else if ( retval == 0 )
-       {
-         WAR << "Not ready to write within timeout." << endl;
-         ZYPP_THROW( PluginScriptSendTimeout( "Not ready to write within timeout." ) );
-       }
-       else // ( retval == -1 )
-       {
-         if ( errno != EINTR )
-         {
-           ERR << "select(): " << Errno() << endl;
-           ZYPP_THROW( PluginScriptException( "Error waiting on file descriptor", str::Str() << Errno() ) );
-         }
-       }
+        fd_set wfds;
+        FD_ZERO( &wfds );
+        FD_SET( fd, &wfds );
+
+        struct timeval tv;
+        tv.tv_sec = _sendTimeout;
+        tv.tv_usec = 0;
+
+        int retval = select( fd+1, NULL, &wfds, NULL, &tv );
+        if ( retval > 0 )      // FD_ISSET( fd, &wfds ) will be true.
+        {
+          //DBG << "Ready to write..." << endl;
+          ssize_t ret = ::write( fd, buffer, buffsize );
+          if ( ret == buffsize )
+          {
+            //DBG << "::write(" << buffsize << ") -> " << ret << endl;
+            ::fflush( filep );
+            break;             // -> done
+          }
+          else if ( ret > 0 )
+          {
+            //WAR << "::write(" << buffsize << ") -> " << ret << " INCOMPLETE..." << endl;
+            ::fflush( filep );
+            buffsize -= ret;
+            buffer += ret;     // -> continue
+          }
+          else // ( retval == -1 )
+          {
+            if ( errno != EINTR )
+            {
+              ERR << "write(): " << Errno() << endl;
+              if ( errno == EPIPE )
+                ZYPP_THROW( PluginScriptDiedUnexpectedly( "Send: script died unexpectedly", str::Str() << Errno() ) );
+              else
+                ZYPP_THROW( PluginScriptException( "Send: send error", str::Str() << Errno() ) );
+            }
+          }
+        }
+        else if ( retval == 0 )
+        {
+          WAR << "Not ready to write within timeout." << endl;
+          ZYPP_THROW( PluginScriptSendTimeout( "Not ready to write within timeout." ) );
+        }
+        else // ( retval == -1 )
+        {
+          if ( errno != EINTR )
+          {
+            ERR << "select(): " << Errno() << endl;
+            ZYPP_THROW( PluginScriptException( "Error waiting on file descriptor", str::Str() << Errno() ) );
+          }
+        }
       } while( true );
     }
   }
@@ -368,56 +368,56 @@ namespace zypp
       PluginDebugBuffer _debug( data ); // dump receive buffer if PLUGIN_DEBUG
       PluginDumpStderr _dump( *_cmd ); // dump scripts stderr before leaving
       do {
-       int ch = fgetc( filep );
-       if ( ch != EOF )
-       {
-         data.push_back( ch );
-         if ( ch == '\0' )
-           break;
-       }
-       else if ( ::feof( filep ) )
-       {
-         WAR << "Unexpected EOF" << endl;
-         ZYPP_THROW( PluginScriptDiedUnexpectedly( "Receive: script died unexpectedly", str::Str() << Errno() ) );
-       }
-       else if ( errno != EINTR )
-       {
-         if ( errno == EWOULDBLOCK )
-         {
-           // wait a while for fd to become ready for reading...
-           fd_set rfds;
-           FD_ZERO( &rfds );
-           FD_SET( fd, &rfds );
-
-           struct timeval tv;
-           tv.tv_sec = _receiveTimeout;
-           tv.tv_usec = 0;
-
-           int retval = select( fd+1, &rfds, NULL, NULL, &tv );
-           if ( retval > 0 )   // FD_ISSET( fd, &rfds ) will be true.
-           {
-             ::clearerr( filep );
-           }
-           else if ( retval == 0 )
-           {
-             WAR << "Not ready to read within timeout." << endl;
-             ZYPP_THROW( PluginScriptReceiveTimeout( "Not ready to read within timeout." ) );
-           }
-           else // ( retval == -1 )
-           {
-             if ( errno != EINTR )
-             {
-               ERR << "select(): " << Errno() << endl;
-               ZYPP_THROW( PluginScriptException( "Error waiting on file descriptor", str::Str() << Errno() ) );
-             }
-           }
-         }
-         else
-         {
-           ERR << "read(): " << Errno() << endl;
-           ZYPP_THROW( PluginScriptException( "Receive: receive error", str::Str() << Errno() ) );
-         }
-       }
+        int ch = fgetc( filep );
+        if ( ch != EOF )
+        {
+          data.push_back( ch );
+          if ( ch == '\0' )
+            break;
+        }
+        else if ( ::feof( filep ) )
+        {
+          WAR << "Unexpected EOF" << endl;
+          ZYPP_THROW( PluginScriptDiedUnexpectedly( "Receive: script died unexpectedly", str::Str() << Errno() ) );
+        }
+        else if ( errno != EINTR )
+        {
+          if ( errno == EWOULDBLOCK )
+          {
+            // wait a while for fd to become ready for reading...
+            fd_set rfds;
+            FD_ZERO( &rfds );
+            FD_SET( fd, &rfds );
+
+            struct timeval tv;
+            tv.tv_sec = _receiveTimeout;
+            tv.tv_usec = 0;
+
+            int retval = select( fd+1, &rfds, NULL, NULL, &tv );
+            if ( retval > 0 )  // FD_ISSET( fd, &rfds ) will be true.
+            {
+              ::clearerr( filep );
+            }
+            else if ( retval == 0 )
+            {
+              WAR << "Not ready to read within timeout." << endl;
+              ZYPP_THROW( PluginScriptReceiveTimeout( "Not ready to read within timeout." ) );
+            }
+            else // ( retval == -1 )
+            {
+              if ( errno != EINTR )
+              {
+                ERR << "select(): " << Errno() << endl;
+                ZYPP_THROW( PluginScriptException( "Error waiting on file descriptor", str::Str() << Errno() ) );
+              }
+            }
+          }
+          else
+          {
+            ERR << "read(): " << Errno() << endl;
+            ZYPP_THROW( PluginScriptException( "Receive: receive error", str::Str() << Errno() ) );
+          }
+        }
       } while ( true );
     }
     // DBG << " <-read " << data.size() << endl;
index cca3fc1..10ea567 100644 (file)
@@ -77,21 +77,21 @@ namespace zypp
        * \c ZYPP_PLUGIN_RECEIVE_TIMEOUT or \c ZYPP_PLUGIN_TIMEOUT (both: send and receive).
        */
       //@{
-       /** Global default timeout (sec.) when sending data. */
-       static long defaultSendTimeout();
+        /** Global default timeout (sec.) when sending data. */
+        static long defaultSendTimeout();
 
-       /** Global default timeout (sec.) when receiving data. */
-       static long defaultReceiveTimeout();
+        /** Global default timeout (sec.) when receiving data. */
+        static long defaultReceiveTimeout();
 
-       /** Set global default timeout (sec.) when sending data. */
-       static void defaultSendTimeout( long newval_r );
+        /** Set global default timeout (sec.) when sending data. */
+        static void defaultSendTimeout( long newval_r );
 
-       /** Set global default timeout (sec.) when receiving data. */
-       static void defaultReceiveTimeout( long newval_r );
+        /** Set global default timeout (sec.) when receiving data. */
+        static void defaultReceiveTimeout( long newval_r );
 
-       /** Set global default timeout (sec.) (both: send and receive).*/
-       static void defaultTimeout( long newval_r )
-       { defaultSendTimeout( newval_r ); defaultReceiveTimeout( newval_r ); }
+        /** Set global default timeout (sec.) (both: send and receive).*/
+        static void defaultTimeout( long newval_r )
+        { defaultSendTimeout( newval_r ); defaultReceiveTimeout( newval_r ); }
       //@}
 
     public:
@@ -128,21 +128,21 @@ namespace zypp
      public:
       /** \name Get/set local timeout settings. */
       //@{
-       /** Local default timeout (sec.) when sending data. */
-       long sendTimeout() const;
+        /** Local default timeout (sec.) when sending data. */
+        long sendTimeout() const;
 
-       /** Local default timeout (sec.) when receiving data. */
-       long receiveTimeout() const;
+        /** Local default timeout (sec.) when receiving data. */
+        long receiveTimeout() const;
 
-       /** Set local default timeout (sec.) when sending data. */
-       void sendTimeout( long newval_r );
+        /** Set local default timeout (sec.) when sending data. */
+        void sendTimeout( long newval_r );
 
-       /** Set local default timeout (sec.) when receiving data. */
-       void receiveTimeout( long newval_r );
+        /** Set local default timeout (sec.) when receiving data. */
+        void receiveTimeout( long newval_r );
 
-       /** Set local default timeout (sec.) (both: send and receive).*/
-       void timeout( long newval_r )
-       { sendTimeout( newval_r ); receiveTimeout( newval_r ); }
+        /** Set local default timeout (sec.) (both: send and receive).*/
+        void timeout( long newval_r )
+        { sendTimeout( newval_r ); receiveTimeout( newval_r ); }
       //@}
 
    public:
index 0f4f348..1e2db4d 100644 (file)
@@ -72,32 +72,32 @@ namespace zypp
     public:
       bool isUndetermined() const
       {
-         return status().isUndetermined();
+          return status().isUndetermined();
       }
 
       bool isRelevant() const
       {
-         return !status().isNonRelevant();
+          return !status().isNonRelevant();
       }
 
       bool isSatisfied() const
       {
-         return status().isSatisfied();
+          return status().isSatisfied();
       }
 
       bool isBroken() const
       {
-         return status().isBroken();
+          return status().isBroken();
       }
 
       bool isNeeded() const
       {
-       return status().isToBeInstalled() || ( isBroken() && ! status().isLocked() );
+        return status().isToBeInstalled() || ( isBroken() && ! status().isLocked() );
       }
 
       bool isUnwanted() const
       {
-       return isBroken() && status().isLocked();
+        return isBroken() && status().isLocked();
       }
 
     private:
@@ -147,9 +147,9 @@ namespace zypp
   {
     str << obj.status();
     if (obj.resolvable())
-       str << *obj.resolvable();
+        str << *obj.resolvable();
     else
-       str << "(NULL)";
+        str << "(NULL)";
     return str;
   }
 
@@ -160,8 +160,8 @@ namespace zypp
     {
       if ( myBuddy._pimpl->_buddy )
       {
-       ERR <<  *this << " would be buddy2 in " << myBuddy << endl;
-       return;
+        ERR <<  *this << " would be buddy2 in " << myBuddy << endl;
+        return;
       }
       myBuddy._pimpl->_buddy = -resolvable()->satSolvable().id();
       _buddy = myBuddy.satSolvable().id();
index 722309c..68836f1 100644 (file)
@@ -69,13 +69,13 @@ namespace zypp
     {
       if ( ! pi_r.status().isLocked() )
       {
-       if ( ccand.status().isLocked() || ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
-         ccand = pi_r;
+        if ( ccand.status().isLocked() || ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
+          ccand = pi_r;
       }
       else if ( ccand.status().isLocked() )
       {
-       if ( ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
-         ccand = pi_r;
+        if ( ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
+          ccand = pi_r;
       }
     }
     else if ( ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
index 1af89ba..3a338fb 100644 (file)
@@ -78,8 +78,8 @@ namespace zypp
 
       bool operator()( sat::LookupAttr::iterator iter_r )
       {
-       if ( !_arch.empty() && iter_r.inSolvable().arch() != _arch )
-         return false;
+        if ( !_arch.empty() && iter_r.inSolvable().arch() != _arch )
+          return false;
 
         CapDetail cap( iter_r.id() );
         if ( ! cap.isSimple() )
@@ -117,9 +117,9 @@ namespace zypp
 
       bool operator()( sat::LookupAttr::iterator iter_r )
       {
-       if ( !_arch.empty() && iter_r.inSolvable().arch() != _arch )
-         return false;
-       return overlaps( Edition::MatchRange( Rel::EQ, iter_r.inSolvable().edition() ), _range );
+        if ( !_arch.empty() && iter_r.inSolvable().arch() != _arch )
+          return false;
+        return overlaps( Edition::MatchRange( Rel::EQ, iter_r.inSolvable().edition() ), _range );
       }
 
       std::string serialize() const
@@ -268,33 +268,33 @@ namespace zypp
         {
           if ( words[0] == "EditionRange" )
           {
-           switch( words.size() )
-           {
-             case 3:
-               ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]) );
-               break;
-             case 4:
-               ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) );
-               break;
-             default:
-               ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) );
-               break;
-           }
+            switch( words.size() )
+            {
+              case 3:
+                ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]) );
+                break;
+              case 4:
+                ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) );
+                break;
+              default:
+                ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) );
+                break;
+            }
           }
           else if ( words[0] == "SolvableRange" )
           {
-           switch( words.size() )
-           {
-             case 3:
-               ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]) );
-               break;
-             case 4:
-               ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) );
-               break;
-             default:
-               ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) );
-               break;
-           }
+            switch( words.size() )
+            {
+              case 3:
+                ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]) );
+                break;
+              case 4:
+                ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) );
+                break;
+              default:
+                ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) );
+                break;
+            }
           }
           else if ( words[0] == "CapabilityMatch" )
           {
@@ -318,50 +318,50 @@ namespace zypp
       /** Serialize \ref strMatcher \ref Match::Mode */
       static std::string serializeMode( Match::Mode mode_r )
       {
-       // Legacy code used "[C|X]" to differ just between OTHER (need to (C)ompile) and
-       // using the default search mode. As we now allow to specify a SEARCHMODE we
-       // need to serialize it:
-       switch ( mode_r )
-       {
+        // Legacy code used "[C|X]" to differ just between OTHER (need to (C)ompile) and
+        // using the default search mode. As we now allow to specify a SEARCHMODE we
+        // need to serialize it:
+        switch ( mode_r )
+        {
 #define OUTS(M,S) case Match::M: return #S; break
-         // (C)ompile
-         OUTS( OTHER,          C );
-         // well known modes:
-         OUTS( STRING,         T );
-         OUTS( STRINGSTART,    S );
-         OUTS( STRINGEND,      E );
-         OUTS( SUBSTRING,      B );
-         OUTS( GLOB,           G );
-         OUTS( REGEX,          R );
+          // (C)ompile
+          OUTS( OTHER,         C );
+          // well known modes:
+          OUTS( STRING,                T );
+          OUTS( STRINGSTART,   S );
+          OUTS( STRINGEND,     E );
+          OUTS( SUBSTRING,     B );
+          OUTS( GLOB,          G );
+          OUTS( REGEX,         R );
 #undef OUTS
-         // everything else use default
-         case Match::NOTHING:
-           break;
-       }
-       return "X";
+          // everything else use default
+          case Match::NOTHING:
+            break;
+        }
+        return "X";
       }
 
       /** Deserialize \ref strMatcher \ref Match::Mode */
       static Match::Mode deserializeMode( const std::string & str_r )
       {
-       switch ( str_r[0] )
-       {
+        switch ( str_r[0] )
+        {
 #define OUTS(M,C) case *#C: return Match::M; break
-         // (C)ompile
-         OUTS( OTHER,          C );
-         // well known modes:
-         OUTS( STRING,         T );
-         OUTS( STRINGSTART,    S );
-         OUTS( STRINGEND,      E );
-         OUTS( SUBSTRING,      B );
-         OUTS( GLOB,           G );
-         OUTS( REGEX,          R );
+          // (C)ompile
+          OUTS( OTHER,         C );
+          // well known modes:
+          OUTS( STRING,                T );
+          OUTS( STRINGSTART,   S );
+          OUTS( STRINGEND,     E );
+          OUTS( SUBSTRING,     B );
+          OUTS( GLOB,          G );
+          OUTS( REGEX,         R );
 #undef OUTS
-         // everything else use default
-         default:
-           break;
-       }
-       return Match::NOTHING;
+          // everything else use default
+          default:
+            break;
+        }
+        return Match::NOTHING;
       }
     };
 
@@ -481,26 +481,26 @@ namespace zypp
     bool operator==( const PoolQuery::Impl & rhs ) const
     {
       if ( _flags == rhs._flags
-       // bnc#792901: while libzypp uses exact match mode for a single
-       // package name lock, zypper always uses glob. :(
-       // We unify those two forms to enable zypper to remove zypp locks
-       // without need to actually evaluate the query (which would require
-       // repos to be loaded).
-       || ( ( ( _flags.isModeString() && rhs._flags.isModeGlob() )
-           || ( _flags.isModeGlob() && rhs._flags.isModeString() ) )
-         && _strings.empty()
-         && _attrs.size() == 1
-         && _attrs.begin()->first == sat::SolvAttr::name ) )
+        // bnc#792901: while libzypp uses exact match mode for a single
+        // package name lock, zypper always uses glob. :(
+        // We unify those two forms to enable zypper to remove zypp locks
+        // without need to actually evaluate the query (which would require
+        // repos to be loaded).
+        || ( ( ( _flags.isModeString() && rhs._flags.isModeGlob() )
+            || ( _flags.isModeGlob() && rhs._flags.isModeString() ) )
+          && _strings.empty()
+          && _attrs.size() == 1
+          && _attrs.begin()->first == sat::SolvAttr::name ) )
       {
-       return ( _strings == rhs._strings
-             && _attrs == rhs._attrs
-             && _uncompiledPredicated == rhs._uncompiledPredicated
-             && _match_word == rhs._match_word
-             && _status_flags == rhs._status_flags
-             && _edition == rhs._edition
-             && _op == rhs._op
-             && _repos == rhs._repos
-             && _kinds == rhs._kinds );
+        return ( _strings == rhs._strings
+              && _attrs == rhs._attrs
+              && _uncompiledPredicated == rhs._uncompiledPredicated
+              && _match_word == rhs._match_word
+              && _status_flags == rhs._status_flags
+              && _edition == rhs._edition
+              && _op == rhs._op
+              && _repos == rhs._repos
+              && _kinds == rhs._kinds );
       }
       return false;
     }
@@ -597,17 +597,17 @@ namespace zypp
       for_( ai, _attrs.begin(), _attrs.end() )
       {
         if ( ai->second.empty() )
-         continue;
-       for_( it, ai->second.begin(), ai->second.end() )
-       {
-         if ( !it->empty() )
-         {
-           attrvals_empty = false;
-           break;
-         }
-       }
+          continue;
+        for_( it, ai->second.begin(), ai->second.end() )
+        {
+          if ( !it->empty() )
+          {
+            attrvals_empty = false;
+            break;
+          }
+        }
         if ( ! attrvals_empty )
-         break;
+          break;
       }
 
       // chceck whether the per-attribute strings are all the same
@@ -686,9 +686,9 @@ namespace zypp
           if ( ! mstr.empty() )
             joined.insert( mstr );
 
-         // copy and exchange the StrMatcher
-         AttrMatchData nattr( *it );
-         nattr.strMatcher = joinedStrMatcher( joined, _flags );
+          // copy and exchange the StrMatcher
+          AttrMatchData nattr( *it );
+          nattr.strMatcher = joinedStrMatcher( joined, _flags );
           _attrMatchList.push_back( std::move(nattr) );
         }
         else
@@ -723,10 +723,10 @@ namespace zypp
     std::string rxEscape( std::string str_r, const Match & flags_r )
     {
       if ( str_r.empty() || flags_r.isModeRegex() )
-       return str_r;
+        return str_r;
 
       if ( flags_r.isModeGlob() )
-       return str::rxEscapeGlob( std::move(str_r) );
+        return str::rxEscapeGlob( std::move(str_r) );
 
       return str::rxEscapeStr( std::move(str_r) );
     }
@@ -759,7 +759,7 @@ namespace zypp
     {
       ret << sep << rxEscape( s, flags_r );
       if ( sep == '(' )
-       sep = '|';
+        sep = '|';
     }
     ret << ')';
 
@@ -1231,8 +1231,8 @@ namespace zypp
       }
       else if ( attribute==PoolQueryAttr::requireAllAttr )
       {
-       // LEAGACY: attribute was defined but never implemented.
-       // Actually it should not occur outside our testcases.
+        // LEAGACY: attribute was defined but never implemented.
+        // Actually it should not occur outside our testcases.
       }
       else if ( attribute==PoolQueryAttr::caseSensitiveAttr )
       {
@@ -1302,17 +1302,17 @@ namespace zypp
         std::string s = attrName;
         str::replaceAll( s,"_",":" );
         SolvAttr a(s);
-       if ( a == SolvAttr::name || isDependencyAttribute( a ) )
-       {
-         Capability c( attrValue );
-         CapDetail d( c );
-         if ( d.isVersioned() )
-           addDependency( a, d.name().asString(), d.op(), d.ed() );
-         else
-           addDependency( a, attrValue );
-       }
-       else
-         addAttribute( a, attrValue );
+        if ( a == SolvAttr::name || isDependencyAttribute( a ) )
+        {
+          Capability c( attrValue );
+          CapDetail d( c );
+          if ( d.isVersioned() )
+            addDependency( a, d.name().asString(), d.op(), d.ed() );
+          else
+            addDependency( a, attrValue );
+        }
+        else
+          addAttribute( a, attrValue );
       }
 
     } while ( true );
@@ -1338,46 +1338,46 @@ namespace zypp
       const AttrMatchData & attrmatch {  *_pimpl->_uncompiledPredicated.begin() };
       if ( attrmatch.attr == SolvAttr::name && attrmatch.strMatcher.flags().mode() == Match::OTHER )
       {
-       // ...for SolvAttr::name and following the global search flags.
-       // A candidate for a rewrite?
-
-       std::vector<std::string> words;
-       str::splitEscaped( attrmatch.predicateStr, std::back_inserter(words) );
-       if ( words.size() < 4 || words[3].empty() )
-       {
-         // We have _NO_ arch rule in the complex predicate, so we can simplify it.
-         //
-         // NOTE: AFAIK it's not possible to create (or have created) a complex lock
-         // with arch rule with zypper means. Nevertheless, in case such a rule made it
-         // into a locks file, it's better to have a strange looking 'zypper locks' list
-         // than to lock the wrong packages.
-         // (and remember that you can't use "addAttribute( SolvAttr::arch, ... )" because
-         // attributes are `OR`ed)
-
-         // kind
-         if ( attrmatch.kindPredicate )
-         {
-           _pimpl->_kinds.clear();     // an explicit kind overwrites any global one
-           addKind( attrmatch.kindPredicate );
-         }
-
-         // name
-         addAttribute( SolvAttr::name, attrmatch.strMatcher.searchstring() );
-
-         // edition
-         std::vector<std::string> words;
-         str::splitEscaped( attrmatch.predicateStr, std::back_inserter(words) );
-         if ( ! words.empty() )
-         {
-           if ( words[0] == "EditionRange" || words[0] == "SolvableRange" )
-           {
-             setEdition( Edition(words[2]), Rel(words[1]) );
-           }
-         }
-
-         // finally remove the complex lock
-         _pimpl->_uncompiledPredicated.clear();
-       }
+        // ...for SolvAttr::name and following the global search flags.
+        // A candidate for a rewrite?
+
+        std::vector<std::string> words;
+        str::splitEscaped( attrmatch.predicateStr, std::back_inserter(words) );
+        if ( words.size() < 4 || words[3].empty() )
+        {
+          // We have _NO_ arch rule in the complex predicate, so we can simplify it.
+          //
+          // NOTE: AFAIK it's not possible to create (or have created) a complex lock
+          // with arch rule with zypper means. Nevertheless, in case such a rule made it
+          // into a locks file, it's better to have a strange looking 'zypper locks' list
+          // than to lock the wrong packages.
+          // (and remember that you can't use "addAttribute( SolvAttr::arch, ... )" because
+          // attributes are `OR`ed)
+
+          // kind
+          if ( attrmatch.kindPredicate )
+          {
+            _pimpl->_kinds.clear();    // an explicit kind overwrites any global one
+            addKind( attrmatch.kindPredicate );
+          }
+
+          // name
+          addAttribute( SolvAttr::name, attrmatch.strMatcher.searchstring() );
+
+          // edition
+          std::vector<std::string> words;
+          str::splitEscaped( attrmatch.predicateStr, std::back_inserter(words) );
+          if ( ! words.empty() )
+          {
+            if ( words[0] == "EditionRange" || words[0] == "SolvableRange" )
+            {
+              setEdition( Edition(words[2]), Rel(words[1]) );
+            }
+          }
+
+          // finally remove the complex lock
+          _pimpl->_uncompiledPredicated.clear();
+        }
       }
     }
 
@@ -1525,34 +1525,34 @@ namespace zypp
     class PoolQueryMatcher
     {
       public:
-       typedef sat::LookupAttr::iterator base_iterator;
+        typedef sat::LookupAttr::iterator base_iterator;
 
       public:
-       const base_iterator & end() const
-       {
-         static base_iterator _end;
-         return _end;
-       }
-
-       bool advance( base_iterator & base_r ) const
-       {
-         if ( base_r == end() )
-           base_r = startNewQyery(); // first candidate
-         else
+        const base_iterator & end() const
+        {
+          static base_iterator _end;
+          return _end;
+        }
+
+        bool advance( base_iterator & base_r ) const
+        {
+          if ( base_r == end() )
+            base_r = startNewQyery(); // first candidate
+          else
           {
             base_r.nextSkipSolvable(); // assert we don't visit this Solvable again
-           ++base_r; // advance to next candidate
+            ++base_r; // advance to next candidate
           }
 
-         while ( base_r != end() )
-         {
-           if ( isAMatch( base_r ) )
-             return true;
-           // No match: try next
+          while ( base_r != end() )
+          {
+            if ( isAMatch( base_r ) )
+              return true;
+            // No match: try next
             ++base_r;
-         }
-         return false;
-       }
+          }
+          return false;
+        }
 
         /** Provide all matching attributes within this solvable.
          *
@@ -1605,135 +1605,135 @@ namespace zypp
         }
 
       public:
-       /** Ctor stores the \ref PoolQuery settings.
+        /** Ctor stores the \ref PoolQuery settings.
          * \throw MatchException Any of the exceptions thrown by \ref PoolQuery::Impl::compile.
          */
-       PoolQueryMatcher( const shared_ptr<const PoolQuery::Impl> & query_r )
-       {
-         query_r->compile();
-
-         // Repo restriction:
-         sat::Pool satpool( sat::Pool::instance() );
-
-         for_( it, query_r->_repos.begin(), query_r->_repos.end() )
-         {
-           Repository r( satpool.reposFind( *it ) );
-           if ( r )
-             _repos.insert( r );
-           else
-             _neverMatchRepo = true;
-         }
-         // _neverMatchRepo: we just need to catch the case that no repo
-         // matched, so we'd interpret the empty list as 'take from all'
-         if ( _neverMatchRepo && ! _repos.empty() )
-           _neverMatchRepo = false;
-
-         // Kind restriction:
-         _kinds = query_r->_kinds;
-         // Edition restriction:
-         _op      = query_r->_op;
-         _edition = query_r->_edition;
-         // Status restriction:
-         _status_flags = query_r->_status_flags;
+        PoolQueryMatcher( const shared_ptr<const PoolQuery::Impl> & query_r )
+        {
+          query_r->compile();
+
+          // Repo restriction:
+          sat::Pool satpool( sat::Pool::instance() );
+
+          for_( it, query_r->_repos.begin(), query_r->_repos.end() )
+          {
+            Repository r( satpool.reposFind( *it ) );
+            if ( r )
+              _repos.insert( r );
+            else
+              _neverMatchRepo = true;
+          }
+          // _neverMatchRepo: we just need to catch the case that no repo
+          // matched, so we'd interpret the empty list as 'take from all'
+          if ( _neverMatchRepo && ! _repos.empty() )
+            _neverMatchRepo = false;
+
+          // Kind restriction:
+          _kinds = query_r->_kinds;
+          // Edition restriction:
+          _op      = query_r->_op;
+          _edition = query_r->_edition;
+          // Status restriction:
+          _status_flags = query_r->_status_flags;
           // StrMatcher
           _attrMatchList = query_r->_attrMatchList;
-       }
+        }
 
-       ~PoolQueryMatcher()
-       {}
+        ~PoolQueryMatcher()
+        {}
 
       private:
-       /** Initialize a new base query. */
-       base_iterator startNewQyery() const
-       {
-         sat::LookupAttr q;
-
-         if ( _neverMatchRepo )
-           return q.end();
-
-         // Repo restriction:
-         if ( _repos.size() == 1 )
-           q.setRepo( *_repos.begin() );
-         // else: handled in isAMatch.
-
-         // Attribute restriction:
-         if ( _attrMatchList.size() == 1 ) // all (SolvAttr::allAttr) or 1 attr
-         {
+        /** Initialize a new base query. */
+        base_iterator startNewQyery() const
+        {
+          sat::LookupAttr q;
+
+          if ( _neverMatchRepo )
+            return q.end();
+
+          // Repo restriction:
+          if ( _repos.size() == 1 )
+            q.setRepo( *_repos.begin() );
+          // else: handled in isAMatch.
+
+          // Attribute restriction:
+          if ( _attrMatchList.size() == 1 ) // all (SolvAttr::allAttr) or 1 attr
+          {
             const AttrMatchData & matchData( _attrMatchList.front() );
-           q.setAttr( matchData.attr );
+            q.setAttr( matchData.attr );
             if ( matchData.strMatcher ) // empty searchstring matches always
               q.setStrMatcher( matchData.strMatcher );
-         }
+          }
           else // more than 1 attr (but not all)
           {
             // no restriction, it's all handled in isAMatch.
             q.setAttr( sat::SolvAttr::allAttr );
           }
 
-         return q.begin();
-       }
-
-
-       /** Check whether we are on a match.
-        *
-        * The check covers the whole Solvable, not just the current
-        * attribute \c base_r points to. If there's no match, also
-        * prepare \c base_r to advance appropriately. If there is
-        * a match, simply return \c true. \ref advance always moves
-        * to the next Solvable if there was a match.
-        *
-        * \note: Caller asserts we're not at \ref end.
-       */
-       bool isAMatch( base_iterator & base_r ) const
-       {
-         /////////////////////////////////////////////////////////////////////
-         Repository inRepo( base_r.inRepo() );
-         // Status restriction:
-         if ( _status_flags
-            && ( (_status_flags == PoolQuery::INSTALLED_ONLY) != inRepo.isSystemRepo() ) )
-         {
-           base_r.nextSkipRepo();
-           return false;
-         }
-         // Repo restriction:
-         if ( _repos.size() > 1 && _repos.find( inRepo ) == _repos.end() )
-         {
-           base_r.nextSkipRepo();
-           return false;
-         }
-         /////////////////////////////////////////////////////////////////////
-         sat::Solvable inSolvable( base_r.inSolvable() );
-         // Edition restriction:
-         if ( _op != Rel::ANY && !compareByRel( _op, inSolvable.edition(), _edition, Edition::Match() ) )
-         {
-           base_r.nextSkipSolvable();
-           return false;
-         }
-
-         // Kind restriction:
-         // Delay the decision to nextSkipSolvable and return false, as there may be
-         // some explicit kind:name predicate which overrules the global kinds.
-         bool globalKindOk =( _kinds.empty() || inSolvable.isKind( _kinds.begin(), _kinds.end() ) );
-
-         /////////////////////////////////////////////////////////////////////
-         // string and predicate matching:
+          return q.begin();
+        }
+
+
+        /** Check whether we are on a match.
+         *
+         * The check covers the whole Solvable, not just the current
+         * attribute \c base_r points to. If there's no match, also
+         * prepare \c base_r to advance appropriately. If there is
+         * a match, simply return \c true. \ref advance always moves
+         * to the next Solvable if there was a match.
+         *
+         * \note: Caller asserts we're not at \ref end.
+        */
+        bool isAMatch( base_iterator & base_r ) const
+        {
+          /////////////////////////////////////////////////////////////////////
+          Repository inRepo( base_r.inRepo() );
+          // Status restriction:
+          if ( _status_flags
+             && ( (_status_flags == PoolQuery::INSTALLED_ONLY) != inRepo.isSystemRepo() ) )
+          {
+            base_r.nextSkipRepo();
+            return false;
+          }
+          // Repo restriction:
+          if ( _repos.size() > 1 && _repos.find( inRepo ) == _repos.end() )
+          {
+            base_r.nextSkipRepo();
+            return false;
+          }
+          /////////////////////////////////////////////////////////////////////
+          sat::Solvable inSolvable( base_r.inSolvable() );
+          // Edition restriction:
+          if ( _op != Rel::ANY && !compareByRel( _op, inSolvable.edition(), _edition, Edition::Match() ) )
+          {
+            base_r.nextSkipSolvable();
+            return false;
+          }
+
+          // Kind restriction:
+          // Delay the decision to nextSkipSolvable and return false, as there may be
+          // some explicit kind:name predicate which overrules the global kinds.
+          bool globalKindOk =( _kinds.empty() || inSolvable.isKind( _kinds.begin(), _kinds.end() ) );
+
+          /////////////////////////////////////////////////////////////////////
+          // string and predicate matching:
 
           if ( _attrMatchList.size() == 1 )
           {
             // String matching was done by the base iterator.
             // Now check any predicate:
-           const AttrMatchData & matchData( _attrMatchList.front() );
-
-           if ( matchData.kindPredicate )
-           {
-             if ( matchData.kindPredicate != inSolvable.kind() )
-             {
-               base_r.nextSkipSolvable();      // this matchData will never match in this solvable
-               return false;
-             }
-           }
-           else if ( !globalKindOk )
-             return false;                     // only matching kindPredicate could overwrite this
+            const AttrMatchData & matchData( _attrMatchList.front() );
+
+            if ( matchData.kindPredicate )
+            {
+              if ( matchData.kindPredicate != inSolvable.kind() )
+              {
+                base_r.nextSkipSolvable();     // this matchData will never match in this solvable
+                return false;
+              }
+            }
+            else if ( !globalKindOk )
+              return false;                    // only matching kindPredicate could overwrite this
 
             if ( !matchData.predicate || matchData.predicate( base_r ) )
               return true;
@@ -1746,13 +1746,13 @@ namespace zypp
           {
             const AttrMatchData & matchData( *mi );
 
-           if ( matchData.kindPredicate )
-           {
-             if ( matchData.kindPredicate != inSolvable.kind() )
-               continue;                       // this matchData does not apply
-           }
-           else if ( !globalKindOk )
-             continue;                         // only matching kindPredicate could overwrite this
+            if ( matchData.kindPredicate )
+            {
+              if ( matchData.kindPredicate != inSolvable.kind() )
+                continue;                      // this matchData does not apply
+            }
+            else if ( !globalKindOk )
+              continue;                                // only matching kindPredicate could overwrite this
 
             sat::LookupAttr q( matchData.attr, inSolvable );
             if ( matchData.strMatcher ) // an empty searchstring matches always
@@ -1776,12 +1776,12 @@ namespace zypp
           }
           base_r.nextSkipSolvable();
           return false;
-       }
+        }
 
       private:
         /** Repositories include in the search. */
         std::set<Repository> _repos;
-       DefaultIntegral<bool,false> _neverMatchRepo;
+        DefaultIntegral<bool,false> _neverMatchRepo;
         /** Resolvable kinds to include. */
         std::set<ResKind> _kinds;
         /** Edition filter. */
index 406b26c..8043048 100644 (file)
@@ -105,13 +105,13 @@ namespace zypp
     {
       if ( _pimpl->_description.empty() )      // first entry
       {
-       _pimpl->_description = std::move(description);
-       return;
+        _pimpl->_description = std::move(description);
+        return;
       }
       else                                     // second entry: form headline in _description
       {
-       _pimpl->_description.swap( _pimpl->_details );
-       _pimpl->_description = _("Following actions will be done:");
+        _pimpl->_description.swap( _pimpl->_details );
+        _pimpl->_description = _("Following actions will be done:");
       }
     }
     if ( front )
index 57aeeab..115affa 100644 (file)
@@ -35,7 +35,7 @@
 #include <zypp/solver/detail/Types.h>  // SolutionAction type
 
 /////////////////////////////////////////////////////////////////////////
-namespace zypp 
+namespace zypp
 {
   DEFINE_PTR_TYPE(Resolver);
 
index b8f5371..b64f181 100644 (file)
@@ -77,17 +77,17 @@ namespace zypp
     {
       if ( it->repository() == repository() && it->arch() == arch() )
       {
-       bool fitsBuildtime = ( it->buildtime() == buildtime() );
-       if ( found )
-       {
-         bool lowerEdition = ( it->edition() <= found.edition() );
-         if ( (  foundBuildTime && ( !fitsBuildtime || lowerEdition ) )
-           || ( !foundBuildTime && ( !fitsBuildtime && lowerEdition ) ) )
-           continue;
-       }
-       found = *it;
-       if ( fitsBuildtime )
-         foundBuildTime = true;
+        bool fitsBuildtime = ( it->buildtime() == buildtime() );
+        if ( found )
+        {
+          bool lowerEdition = ( it->edition() <= found.edition() );
+          if ( (  foundBuildTime && ( !fitsBuildtime || lowerEdition ) )
+            || ( !foundBuildTime && ( !fitsBuildtime && lowerEdition ) ) )
+            continue;
+        }
+        found = *it;
+        if ( fitsBuildtime )
+          foundBuildTime = true;
       }
     }
 
@@ -99,13 +99,13 @@ namespace zypp
       std::string refFile( referenceFilename() );      // the basename only!
       if ( ! refFile.empty() )
       {
-       StrMatcher matcher( "/etc/products.d/"+refFile, Match::STRING | Match::FILES );
-       q.setStrMatcher( matcher );
-       if ( ! q.empty() )
-         found = q.begin().inSolvable();
+        StrMatcher matcher( "/etc/products.d/"+refFile, Match::STRING | Match::FILES );
+        q.setStrMatcher( matcher );
+        if ( ! q.empty() )
+          found = q.begin().inSolvable();
       }
       else
-       INT << "Product referenceFilename unexpectedly empty!" << endl;
+        INT << "Product referenceFilename unexpectedly empty!" << endl;
     }
 
     if ( ! found )
@@ -221,7 +221,7 @@ namespace zypp
     {
       ret.reserve( 2 );
       for_( it, q.begin(), q.end() )
-       ret.push_back( it.asString() );
+        ret.push_back( it.asString() );
     }
     return ret;
   }
@@ -232,7 +232,7 @@ namespace zypp
     for_( it, q.begin(), q.end() )
     {
       if ( it.asString() == cident_r )
-       return true;
+        return true;
     }
     return false;
   }
@@ -248,7 +248,7 @@ namespace zypp
 
   std::string Product::registerFlavor() const
   { return lookupStrAttribute( sat::SolvAttr::productRegisterFlavor ); }
-  
+
   /////////////////////////////////////////////////////////////////
 
   Product::UrlList Product::urls( const std::string & key_r ) const
index 36995fb..1940855 100644 (file)
@@ -127,8 +127,8 @@ namespace zypp
     bool hasUpdateContentIdentifier( TIterator begin, TIterator end ) const
     {
       for_( it, begin, end )
-       if ( hasUpdateContentIdentifier( *it ) )
-         return true;
+        if ( hasUpdateContentIdentifier( *it ) )
+          return true;
       return false;
     }
 
index 4a2ba7e..db72c82 100644 (file)
@@ -40,27 +40,27 @@ namespace zypp
       value_type newVal = _d->_val * 100 / ( _d->_max - _d->_min );
 
       if ( newVal - _d->_last_val > 10
-          || now - _d->_last_send > 1
-          || ( _d->_last_val == 0 && newVal > 0 )
-          || ( newVal == 100 && _d->_last_val != 100 )
-          || ( newVal != 100 && _d->_last_val == 100 )
-          || _d->_state != RUN /*INIT||END*/ )
+           || now - _d->_last_send > 1
+           || ( _d->_last_val == 0 && newVal > 0 )
+           || ( newVal == 100 && _d->_last_val != 100 )
+           || ( newVal != 100 && _d->_last_val == 100 )
+           || _d->_state != RUN /*INIT||END*/ )
       {
-       _d->_last_val  = newVal;
-       _d->_last_send = now;
+        _d->_last_val  = newVal;
+        _d->_last_send = now;
       }
       else
-       return true;    // skip report, continue per default
+        return true;   // skip report, continue per default
     }
     else
     {
       if ( now - _d->_last_send > 1 || _d->_state != RUN /*INIT||END*/ )
       {
-       _d->_last_val  = _d->_val;
-       _d->_last_send = now;
+        _d->_last_val  = _d->_val;
+        _d->_last_send = now;
       }
       else
-       return true;    // skip report, continue per default
+        return true;   // skip report, continue per default
     }
 
     // now send report
@@ -74,13 +74,13 @@ namespace zypp
     {
       if ( ! _d->_receiver( *this ) )
       {
-       if ( _d->_state != END )
-       {
-         WAR << "User request to ABORT pending action. "
-         << str::form( "{#%u|%s}(%lld%s)", numericId(), name().c_str(),
-                       _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl;
-       }
-       return false;   // aborted by user
+        if ( _d->_state != END )
+        {
+          WAR << "User request to ABORT pending action. "
+          << str::form( "{#%u|%s}(%lld%s)", numericId(), name().c_str(),
+                        _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl;
+        }
+        return false;  // aborted by user
       }
     }
     else if ( _d->_state == END )
@@ -101,12 +101,12 @@ namespace zypp
     if ( obj.hasRange() )
     {
       return str << str::form( "{%u|%s}[%lld,%lld](%lld)%lld%%)",
-                              obj.numericId(), obj.name().c_str(),
-                              obj.min(), obj.max(), obj.val(), obj.reportValue() );
+                               obj.numericId(), obj.name().c_str(),
+                               obj.min(), obj.max(), obj.val(), obj.reportValue() );
     }
     return str << str::form( "{%u|%s}[-,-](%lld)",
-                            obj.numericId(), obj.name().c_str(),
-                            obj.val() );
+                             obj.numericId(), obj.name().c_str(),
+                             obj.val() );
   }
 
   /******************************************************************
index c07f816..c8ef07b 100644 (file)
@@ -143,27 +143,27 @@ namespace zypp
 
       class Data
       {
-       public:
-         Data( value_type min_r, value_type max_r, value_type val_r )
-         : _state( INIT ), _min( min_r ), _max( max_r ), _val( val_r )
-         , _last_val( 0 ), _last_send( 0 )
-         {}
-
-       public:
-         State       _state;
-         std::string _name;
-         value_type  _min;
-         value_type  _max;
-         value_type  _val;
-
-         ReceiverFnc _receiver;
-         value_type  _last_val;
-         Date        _last_send;
-
-       private:
-         /** clone for RWCOW_pointer */
-         friend Data * rwcowClone<Data>( const Data * rhs );
-         Data * clone() const { return new Data( *this ); }
+        public:
+          Data( value_type min_r, value_type max_r, value_type val_r )
+          : _state( INIT ), _min( min_r ), _max( max_r ), _val( val_r )
+          , _last_val( 0 ), _last_send( 0 )
+          {}
+
+        public:
+          State       _state;
+          std::string _name;
+          value_type  _min;
+          value_type  _max;
+          value_type  _val;
+
+          ReceiverFnc _receiver;
+          value_type  _last_val;
+          Date        _last_send;
+
+        private:
+          /** clone for RWCOW_pointer */
+          friend Data * rwcowClone<Data>( const Data * rhs );
+          Data * clone() const { return new Data( *this ); }
       };
 
     public:
@@ -189,11 +189,11 @@ namespace zypp
 
       ~ProgressData()
       {
-       if ( _d->_state == RUN )
-       {
-         _d->_state = END;
-         report();
-       }
+        if ( _d->_state == RUN )
+        {
+          _d->_state = END;
+          report();
+        }
       }
 
     public:
@@ -245,16 +245,16 @@ namespace zypp
       /** Set new counter \c value. */
       bool set( value_type val_r )
       {
-       _d->_val = val_r;
-       return report();
+        _d->_val = val_r;
+        return report();
       }
 
       /** Set range and counter from an other \ref ProgressData. */
       bool set( const ProgressData & rhs )
       {
-       min( rhs.min() );
-       max( rhs.max() );
-       return set( rhs.val() );
+        min( rhs.min() );
+        max( rhs.max() );
+        return set( rhs.val() );
       }
 
       /** Increment counter \c value (default by 1). */
index e815088..ce55f1d 100644 (file)
@@ -46,10 +46,10 @@ namespace zypp
     {
       if ( expires_r )
       {
-       Date exp( expires_r - Date::now() );
-       int ret = exp / Date::day;
-       if ( exp < 0 ) ret -= 1;
-       return ret;
+        Date exp( expires_r - Date::now() );
+        int ret = exp / Date::day;
+        if ( exp < 0 ) ret -= 1;
+        return ret;
       }
       return INT_MAX;
     }
@@ -59,18 +59,18 @@ namespace zypp
       str::Str str;
       if ( ! expires_r )
       {
-       // translators: an annotation to a gpg keys expiry date
-       str << _("does not expire");
+        // translators: an annotation to a gpg keys expiry date
+        str << _("does not expire");
       }
       else if ( isExpired( expires_r ) )
       {
-       // translators: an annotation to a gpg keys expiry date: "expired: 1999-04-12"
-       str << ( str::Format(_("expired: %1%") ) % expires_r.printDate() );
+        // translators: an annotation to a gpg keys expiry date: "expired: 1999-04-12"
+        str << ( str::Format(_("expired: %1%") ) % expires_r.printDate() );
       }
       else
       {
-       // translators: an annotation to a gpg keys expiry date: "expires: 2111-04-12"
-       str << ( str::Format(_("expires: %1%") ) % expires_r.printDate() );
+        // translators: an annotation to a gpg keys expiry date: "expires: 2111-04-12"
+        str << ( str::Format(_("expires: %1%") ) % expires_r.printDate() );
       }
       return str;
     }
@@ -79,25 +79,25 @@ namespace zypp
     {
       if ( !expires_r )
       { // translators: an annotation to a gpg keys expiry date
-       return _("(does not expire)");
+        return _("(does not expire)");
       }
       std::string ret( expires_r.asString() );
       int ttl( hasDaysToLive( expires_r ) );
       if ( ttl <= 90 )
       {
-       ret += " ";
-       if ( ttl < 0 )
-       { // translators: an annotation to a gpg keys expiry date
-         ret += _("(EXPIRED)");
-       }
-       else if ( ttl == 0 )
-       { // translators: an annotation to a gpg keys expiry date
-         ret += _("(expires within 24h)");
-       }
-       else
-       { // translators: an annotation to a gpg keys expiry date
-         ret += str::form( PL_("(expires in %d day)", "(expires in %d days)", ttl ), ttl );
-       }
+        ret += " ";
+        if ( ttl < 0 )
+        { // translators: an annotation to a gpg keys expiry date
+          ret += _("(EXPIRED)");
+        }
+        else if ( ttl == 0 )
+        { // translators: an annotation to a gpg keys expiry date
+          ret += _("(expires within 24h)");
+        }
+        else
+        { // translators: an annotation to a gpg keys expiry date
+          ret += str::form( PL_("(expires in %d day)", "(expires in %d days)", ttl ), ttl );
+        }
       }
       return ret;
     }
@@ -106,16 +106,16 @@ namespace zypp
     {
       std::string ret;
       if ( const char * n = ::gpgme_pubkey_algo_name( key_r->pubkey_algo ) )
-       ret = str::Str() << n << ' ' << key_r->length;
+        ret = str::Str() << n << ' ' << key_r->length;
       else
-       ret = "?";
+        ret = "?";
       return ret;
     }
 
     inline bool shorterIsSuffixCI( const std::string & lhs, const std::string & rhs )
     {
       if ( lhs.size() >= rhs.size() )
-       return str::endsWithCI( lhs, rhs );
+        return str::endsWithCI( lhs, rhs );
       return str::endsWithCI( rhs, lhs );
     }
   } //namespace
@@ -231,7 +231,7 @@ namespace zypp
     bool ret = false;
     for ( const PublicSubkeyData & sub : _subkeys ) {
       if ( shorterIsSuffixCI( sub.id(), id_r ) ) {
-       ret = true;
+        ret = true;
         break;
       }
     }
@@ -255,13 +255,13 @@ namespace zypp
       //libzypp expects the date of the latest signature on the first uid
       if ( rawData->uids && rawData->uids->signatures ) {
         data->_created = zypp::Date(rawData->uids->signatures->timestamp);
-       // bsc#1179222: The keyring does not order the signatures when multiple
-       // versions of the same key are imported. We take the last signature here,
-       // the one GPGME_EXPORT_MODE_MINIMAL will later use in export.
-       for ( auto t = rawData->uids->signatures->next; t; t = t->next ) {
-         if ( t->timestamp > data->_created )
-           data->_created = t->timestamp;
-       }
+        // bsc#1179222: The keyring does not order the signatures when multiple
+        // versions of the same key are imported. We take the last signature here,
+        // the one GPGME_EXPORT_MODE_MINIMAL will later use in export.
+        for ( auto t = rawData->uids->signatures->next; t; t = t->next ) {
+          if ( t->timestamp > data->_created )
+            data->_created = t->timestamp;
+        }
       }
       else
         data->_created = zypp::Date(sKey->timestamp);
@@ -419,7 +419,7 @@ namespace zypp
         ZYPP_THROW(Exception("Can't read public key from " + keyFile_r.asString() + ", file not found"));
 
       if ( filesystem::hardlinkCopy( keyFile_r, path() ) != 0 )
-       ZYPP_THROW(Exception("Can't copy public key data from " + keyFile_r.asString() + " to " +  path().asString() ));
+        ZYPP_THROW(Exception("Can't copy public key data from " + keyFile_r.asString() + " to " +  path().asString() ));
 
       readFromFile();
     }
@@ -435,8 +435,8 @@ namespace zypp
     {
       if ( ! keyData_r )
       {
-       WAR << "Invalid PublicKeyData supplied: scanning from file" << endl;
-       readFromFile();
+        WAR << "Invalid PublicKeyData supplied: scanning from file" << endl;
+        readFromFile();
       }
     }
 
@@ -550,7 +550,7 @@ namespace zypp
       return true;
     for ( const auto & keydata : hiddenKeys() ) {
       if ( keydata.providesKey( id_r ) )
-       return true;
+        return true;
     }
     return false;
   }
index fc090f7..e556b0c 100644 (file)
@@ -36,42 +36,42 @@ namespace zypp
 
       if ( lhs == Rel::NE )
       {
-         if ( cmp < 0 )
-         {
-             // lhs < rhs
-             return( rhs == Rel::GE 
-                     || rhs == Rel::EQ );
-         } else if ( cmp > 0)
-         {
-             // lhs > rhs
-             return( rhs == Rel::LT
-                     || rhs == Rel::EQ );            
-         } else 
-         {
-             //lhs == rhs
-             return ( rhs == Rel::GT
-                      || rhs == Rel::LT );
-         }
+          if ( cmp < 0 )
+          {
+              // lhs < rhs
+              return( rhs == Rel::GE
+                      || rhs == Rel::EQ );
+          } else if ( cmp > 0)
+          {
+              // lhs > rhs
+              return( rhs == Rel::LT
+                      || rhs == Rel::EQ );
+          } else
+          {
+              //lhs == rhs
+              return ( rhs == Rel::GT
+                       || rhs == Rel::LT );
+          }
       }
-      
+
       if ( rhs == Rel::NE )
       {
-         if ( cmp < 0 )
-         {
-             // lhs < rhs
-             return(  lhs == Rel::LE
-                      || lhs == Rel::EQ );
-         } else if ( cmp > 0)
-         {
-             // lhs > rhs
-             return(  lhs == Rel::GT
-                      || lhs == Rel::EQ );           
-         } else
-         {
-             //lhs == rhs
-             return ( lhs == Rel::GT
-                      || lhs == Rel::LT );
-         }
+          if ( cmp < 0 )
+          {
+              // lhs < rhs
+              return(  lhs == Rel::LE
+                       || lhs == Rel::EQ );
+          } else if ( cmp > 0)
+          {
+              // lhs > rhs
+              return(  lhs == Rel::GT
+                       || lhs == Rel::EQ );
+          } else
+          {
+              //lhs == rhs
+              return ( lhs == Rel::GT
+                       || lhs == Rel::LT );
+          }
       }
 
       if ( cmp < 0 )
index 534cee1..5083e1a 100644 (file)
@@ -54,12 +54,12 @@ namespace zypp
       repo::RepoType ret = repo::RepoType::NONE;
       if ( PathInfo(path_r).isDir() )
       {
-       if ( PathInfo(path_r/"/repodata/repomd.xml").isFile() )
-       { ret = repo::RepoType::RPMMD; }
-       else if ( PathInfo(path_r/"/content").isFile() )
-       { ret = repo::RepoType::YAST2; }
-       else if ( PathInfo(path_r/"/cookie").isFile() )
-       { ret = repo::RepoType::RPMPLAINDIR; }
+        if ( PathInfo(path_r/"/repodata/repomd.xml").isFile() )
+        { ret = repo::RepoType::RPMMD; }
+        else if ( PathInfo(path_r/"/content").isFile() )
+        { ret = repo::RepoType::YAST2; }
+        else if ( PathInfo(path_r/"/cookie").isFile() )
+        { ret = repo::RepoType::RPMPLAINDIR; }
       }
       DBG << "Probed cached type " << ret << " at " << path_r << endl;
       return ret;
@@ -103,7 +103,7 @@ namespace zypp
     repo::RepoType type() const
     {
       if ( _type == repo::RepoType::NONE )
-       setProbedType( probeCache( metadataPath() / path ) );
+        setProbedType( probeCache( metadataPath() / path ) );
       return _type;
     }
 
@@ -114,22 +114,22 @@ namespace zypp
       Pathname ret;
       if ( !metadataPath().empty() )
       {
-       std::string licenseStem( "license" );
-       if ( !name_r.empty() )
-       {
-         licenseStem += "-";
-         licenseStem += name_r;
-       }
-
-       filesystem::Glob g;
-       // TODO: REPOMD: this assumes we know the name of the tarball. In fact
-       // we'd need to get the file from repomd.xml (<data type="license[-name_r]">)
-       g.add( metadataPath() / path / ("repodata/*"+licenseStem+".tar.gz") );
-       if ( g.empty() )
-         g.add( metadataPath() / path / (licenseStem+".tar.gz") );
-
-       if ( !g.empty() )
-         ret = *g.begin();
+        std::string licenseStem( "license" );
+        if ( !name_r.empty() )
+        {
+          licenseStem += "-";
+          licenseStem += name_r;
+        }
+
+        filesystem::Glob g;
+        // TODO: REPOMD: this assumes we know the name of the tarball. In fact
+        // we'd need to get the file from repomd.xml (<data type="license[-name_r]">)
+        g.add( metadataPath() / path / ("repodata/*"+licenseStem+".tar.gz") );
+        if ( g.empty() )
+          g.add( metadataPath() / path / (licenseStem+".tar.gz") );
+
+        if ( !g.empty() )
+          ret = *g.begin();
       }
       return ret;
     }
@@ -141,8 +141,8 @@ namespace zypp
       {
         emptybaseurls = true;
         DBG << "MetadataPath: " << metadataPath() << endl;
-       repo::RepoMirrorList rmurls( mlurl, metadataPath(), _mirrorListForceMetalink );
-       _baseUrls.raw().insert( _baseUrls.raw().end(), rmurls.getUrls().begin(), rmurls.getUrls().end() );
+        repo::RepoMirrorList rmurls( mlurl, metadataPath(), _mirrorListForceMetalink );
+        _baseUrls.raw().insert( _baseUrls.raw().end(), rmurls.getUrls().begin(), rmurls.getUrls().end() );
       }
       return _baseUrls;
     }
@@ -171,43 +171,43 @@ namespace zypp
     {
       if ( !_keywords.first && ! metadataPath().empty() )
       {
-       // HACK directly check master index file until RepoManager offers
-       // some content probing and zypper uses it.
-       /////////////////////////////////////////////////////////////////
-       MIL << "Empty keywords...." << metadataPath() << endl;
-       Pathname master;
-       if ( PathInfo( (master=metadataPath()/"/repodata/repomd.xml") ).isFile() )
-       {
-         //MIL << "GO repomd.." << endl;
-         xml::Reader reader( master );
-         while ( reader.seekToNode( 2, "content" ) )
-         {
-           _keywords.second.insert( reader.nodeText().asString() );
-           reader.seekToEndNode( 2, "content" );
-         }
-         _keywords.first = true;       // valid content in _keywords even if empty
-       }
-       else if ( PathInfo( (master=metadataPath()/"/content") ).isFile() )
-       {
-         //MIL << "GO content.." << endl;
-         iostr::forEachLine( InputStream( master ),
+        // HACK directly check master index file until RepoManager offers
+        // some content probing and zypper uses it.
+        /////////////////////////////////////////////////////////////////
+        MIL << "Empty keywords...." << metadataPath() << endl;
+        Pathname master;
+        if ( PathInfo( (master=metadataPath()/"/repodata/repomd.xml") ).isFile() )
+        {
+          //MIL << "GO repomd.." << endl;
+          xml::Reader reader( master );
+          while ( reader.seekToNode( 2, "content" ) )
+          {
+            _keywords.second.insert( reader.nodeText().asString() );
+            reader.seekToEndNode( 2, "content" );
+          }
+          _keywords.first = true;      // valid content in _keywords even if empty
+        }
+        else if ( PathInfo( (master=metadataPath()/"/content") ).isFile() )
+        {
+          //MIL << "GO content.." << endl;
+          iostr::forEachLine( InputStream( master ),
                             [this]( int num_r, std::string line_r )->bool
                             {
                               if ( str::startsWith( line_r, "REPOKEYWORDS" ) )
-                             {
-                               std::vector<std::string> words;
-                               if ( str::split( line_r, std::back_inserter(words) ) > 1
-                                 && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
-                               {
-                                 this->_keywords.second.insert( ++words.begin(), words.end() );
-                               }
-                               return true; // mult. occurrances are ok.
-                             }
-                             return( ! str::startsWith( line_r, "META " ) );   // no need to parse into META section.
-                           } );
-         _keywords.first = true;       // valid content in _keywords even if empty
-       }
-       /////////////////////////////////////////////////////////////////
+                              {
+                                std::vector<std::string> words;
+                                if ( str::split( line_r, std::back_inserter(words) ) > 1
+                                  && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
+                                {
+                                  this->_keywords.second.insert( ++words.begin(), words.end() );
+                                }
+                                return true; // mult. occurrances are ok.
+                              }
+                              return( ! str::startsWith( line_r, "META " ) );  // no need to parse into META section.
+                            } );
+          _keywords.first = true;      // valid content in _keywords even if empty
+        }
+        /////////////////////////////////////////////////////////////////
       }
       return _keywords.first;
     }
@@ -222,13 +222,13 @@ namespace zypp
     TriBool internalValidRepoSignature() const
     {
       if ( ! indeterminate(_validRepoSignature) )
-       return _validRepoSignature;
+        return _validRepoSignature;
       // check metadata:
       if ( ! metadataPath().empty() )
       {
-       // A missing ".repo_gpgcheck" might be plaindir(no Downloader) or not yet refreshed signed repo!
-       TriBool linkval = triBoolFromPath( metadataPath() / ".repo_gpgcheck" );
-       return linkval;
+        // A missing ".repo_gpgcheck" might be plaindir(no Downloader) or not yet refreshed signed repo!
+        TriBool linkval = triBoolFromPath( metadataPath() / ".repo_gpgcheck" );
+        return linkval;
       }
       return indeterminate;
     }
@@ -237,16 +237,16 @@ namespace zypp
     {
       if ( PathInfo(metadataPath()).isDir() )
       {
-       Pathname gpgcheckFile( metadataPath() / ".repo_gpgcheck" );
-       if ( PathInfo(gpgcheckFile).isExist() )
-       {
-         TriBool linkval( indeterminate );
-         if ( triBoolFromPath( gpgcheckFile, linkval ) && linkval == value_r )
-           return;     // existing symlink fits value_r
-         else
-           filesystem::unlink( gpgcheckFile ); // will write a new one
-       }
-       filesystem::symlink( asString(value_r), gpgcheckFile );
+        Pathname gpgcheckFile( metadataPath() / ".repo_gpgcheck" );
+        if ( PathInfo(gpgcheckFile).isExist() )
+        {
+          TriBool linkval( indeterminate );
+          if ( triBoolFromPath( gpgcheckFile, linkval ) && linkval == value_r )
+            return;    // existing symlink fits value_r
+          else
+            filesystem::unlink( gpgcheckFile );        // will write a new one
+        }
+        filesystem::symlink( asString(value_r), gpgcheckFile );
       }
       _validRepoSignature = value_r;
     }
@@ -277,13 +277,13 @@ namespace zypp
 
       bool known = true;
       if ( linkval == truePath )
-       ret_r = true;
+        ret_r = true;
       else if ( linkval == falsePath )
-       ret_r = false;
+        ret_r = false;
       else if ( linkval == indeterminatePath )
-       ret_r = indeterminate;
+        ret_r = indeterminate;
       else
-       known = false;
+        known = false;
       return known;
     }
 
@@ -336,14 +336,14 @@ namespace zypp
     Pathname metadataPath() const
     {
       if ( usesAutoMethadataPaths() )
-       return _metadataPath.dirname() / "%RAW%";
+        return _metadataPath.dirname() / "%RAW%";
       return _metadataPath;
     }
 
     Pathname packagesPath() const
     {
       if ( _packagesPath.empty() && usesAutoMethadataPaths() )
-       return _metadataPath.dirname() / "%PKG%";
+        return _metadataPath.dirname() / "%PKG%";
       return _packagesPath;
     }
 
@@ -478,28 +478,28 @@ namespace zypp
     switch ( mode_r )
     {
       case GpgCheck::On:
-       changed = changeGpgCheckTo( ogpg, true,          indeterminate, indeterminate );
-       break;
+        changed = changeGpgCheckTo( ogpg, true,          indeterminate, indeterminate );
+        break;
       case GpgCheck::Strict:
-       changed = changeGpgCheckTo( ogpg, true,          true,          true          );
-       break;
+        changed = changeGpgCheckTo( ogpg, true,          true,          true          );
+        break;
       case GpgCheck::AllowUnsigned:
-       changed = changeGpgCheckTo( ogpg, true,          false,         false         );
-       break;
+        changed = changeGpgCheckTo( ogpg, true,          false,         false         );
+        break;
       case GpgCheck::AllowUnsignedRepo:
-       changed = changeGpgCheckTo( ogpg, true,          false,         indeterminate );
-       break;
+        changed = changeGpgCheckTo( ogpg, true,          false,         indeterminate );
+        break;
       case GpgCheck::AllowUnsignedPackage:
-       changed = changeGpgCheckTo( ogpg, true,          indeterminate, false         );
-       break;
+        changed = changeGpgCheckTo( ogpg, true,          indeterminate, false         );
+        break;
       case GpgCheck::Default:
-       changed = changeGpgCheckTo( ogpg, indeterminate, indeterminate, indeterminate );
-       break;
+        changed = changeGpgCheckTo( ogpg, indeterminate, indeterminate, indeterminate );
+        break;
       case GpgCheck::Off:
-       changed = changeGpgCheckTo( ogpg, false,         indeterminate, indeterminate );
-       break;
+        changed = changeGpgCheckTo( ogpg, false,         indeterminate, indeterminate );
+        break;
       case GpgCheck::indeterminate:    // no change
-       break;
+        break;
     }
 
     if ( changed )
@@ -570,33 +570,33 @@ namespace zypp
     // all keys specified in gpgkey= entries
     if ( !tempKeyRing.isKeyTrusted(keyID_r) ) {
       if ( ! gpgKeyUrlsEmpty() ) {
-       // translator: %1% is a gpg key ID like 3DBDC284
-       //             %2% is a repositories name
-       JobReport::info( str::Format(_("Looking for gpg key ID %1% in repository %2%.") ) % keyIDStr % asUserString() );
-       for ( const Url &url : gpgKeyUrls() ) {
-         try {
-           JobReport::info( "  gpgkey=" + url.asString() );
-           ManagedFile f = MediaSetAccess::provideOptionalFileFromUrl( url );
-           if ( f->empty() )
-             continue;
-
-           PublicKey key(f);
-           if ( !key.isValid() )
-             continue;
-
-           // import all keys into our temporary keyring
-           tempKeyRing.multiKeyImport(f, true);
-
-         } catch ( const std::exception & e ) {
-           //ignore and continue to next url
-           ZYPP_CAUGHT(e);
-           MIL << "Key import from url:'"<<url<<"' failed." << endl;
-         }
-       }
+        // translator: %1% is a gpg key ID like 3DBDC284
+        //             %2% is a repositories name
+        JobReport::info( str::Format(_("Looking for gpg key ID %1% in repository %2%.") ) % keyIDStr % asUserString() );
+        for ( const Url &url : gpgKeyUrls() ) {
+          try {
+            JobReport::info( "  gpgkey=" + url.asString() );
+            ManagedFile f = MediaSetAccess::provideOptionalFileFromUrl( url );
+            if ( f->empty() )
+              continue;
+
+            PublicKey key(f);
+            if ( !key.isValid() )
+              continue;
+
+            // import all keys into our temporary keyring
+            tempKeyRing.multiKeyImport(f, true);
+
+          } catch ( const std::exception & e ) {
+            //ignore and continue to next url
+            ZYPP_CAUGHT(e);
+            MIL << "Key import from url:'"<<url<<"' failed." << endl;
+          }
+        }
       }
       else {
-       // translator: %1% is a repositories name
-       JobReport::info( str::Format(_("Repository %1% does not define additional 'gpgkey=' URLs.") ) % asUserString() );
+        // translator: %1% is a repositories name
+        JobReport::info( str::Format(_("Repository %1% does not define additional 'gpgkey=' URLs.") ) % asUserString() );
       }
     }
 
@@ -635,7 +635,7 @@ namespace zypp
   {
     for ( const auto & url : _pimpl->baseUrls().raw() )        // Raw unique!
       if ( url == url_r )
-       return;
+        return;
     _pimpl->baseUrls().raw().push_back( url_r );
   }
 
@@ -823,7 +823,7 @@ namespace zypp
     // now extract the license file.
     static const std::string licenseFileFallback( "license.txt" );
     std::string licenseFile( !getLang ? licenseFileFallback
-                                     : str::form( "license.%s.txt", getLang.c_str() ) );
+                                      : str::form( "license.%s.txt", getLang.c_str() ) );
 
     ExternalProgram::Arguments cmd;
     cmd.push_back( "tar" );
@@ -895,7 +895,7 @@ namespace zypp
     // print if non empty value
     auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
       if ( ! value_r.empty() )
-       str << tag_r << value_r << std::endl;
+        str << tag_r << value_r << std::endl;
     });
 
     strif( (_pimpl->_mirrorListForceMetalink ? "- metalink    : " : "- mirrorlist  : "), rawMirrorListUrl().asString() );
@@ -907,9 +907,9 @@ namespace zypp
 #define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
     str << "- gpgcheck    : " << OUTS(_pimpl->rawGpgCheck(),gpgCheck())
                               << " repo" << OUTS(_pimpl->rawRepoGpgCheck(),repoGpgCheck()) << (repoGpgCheckIsMandatory() ? "* ": " " )
-                             << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
-                             << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
-                             << std::endl;
+                              << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
+                              << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
+                              << std::endl;
 #undef OUTS
 
     for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
@@ -940,7 +940,7 @@ namespace zypp
       for ( const auto & url : _pimpl->baseUrls().raw() )
       {
         str << indent << hotfix1050625::asString( url ) << endl;
-       if ( indent.empty() ) indent = "        ";      // "baseurl="
+        if ( indent.empty() ) indent = "        ";     // "baseurl="
       }
     }
 
@@ -969,9 +969,9 @@ namespace zypp
       std::string indent( "gpgkey=");
       for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
       {
-       str << indent << url << endl;
-       if ( indent[0] != ' ' )
-         indent = "       ";
+        str << indent << url << endl;
+        if ( indent[0] != ' ' )
+          indent = "       ";
       }
     }
 
@@ -1016,7 +1016,7 @@ namespace zypp
     if ( _pimpl->baseurl2dump() )
     {
       for_( it, baseUrlsBegin(), baseUrlsEnd() )       // !transform iterator replaces variables
-       str << "<url>" << escape((*it).asString()) << "</url>" << endl;
+        str << "<url>" << escape((*it).asString()) << "</url>" << endl;
     }
 
     str << "</repo>" << endl;
index 8a233f3..e625e31 100644 (file)
@@ -85,7 +85,7 @@ namespace zypp
        */
       static unsigned defaultPriority();
       /**
-       * The least priority (<tt>unsigned(-1)</tt>). 
+       * The least priority (<tt>unsigned(-1)</tt>).
        */
       static unsigned noPriority();
       /**
@@ -366,14 +366,14 @@ namespace zypp
 
       /** Some predefined settings */
       enum class GpgCheck {
-       indeterminate,          //< not specified
-       On,                     //< 1** --gpgcheck
-       Strict,                 //< 111 --gpgcheck-strict
-       AllowUnsigned,          //< 100 --gpgcheck-allow-unsigned
-       AllowUnsignedRepo,      //< 10* --gpgcheck-allow-unsigned-repo
-       AllowUnsignedPackage,   //< 1*0 --gpgcheck-allow-unsigned-package
-       Default,                //< *** --default-gpgcheck
-       Off,                    //< 0** --no-gpgcheck
+        indeterminate,         //< not specified
+        On,                    //< 1** --gpgcheck
+        Strict,                        //< 111 --gpgcheck-strict
+        AllowUnsigned,         //< 100 --gpgcheck-allow-unsigned
+        AllowUnsignedRepo,     //< 10* --gpgcheck-allow-unsigned-repo
+        AllowUnsignedPackage,  //< 1*0 --gpgcheck-allow-unsigned-package
+        Default,               //< *** --default-gpgcheck
+        Off,                   //< 0** --no-gpgcheck
       };
 
       /** Adjust *GpgCheck settings according to \a mode_r.
index 6081493..28e887e 100644 (file)
@@ -114,13 +114,13 @@ namespace zypp
       /** Remember credentials stored in URL authority leaving the password in \a url_r. */
       bool collect( const Url & url_r )
       {
-       bool ret = url_r.hasCredentialsInAuthority();
-       if ( ret )
-       {
-         if ( !_cmPtr ) _cmPtr.reset( new media::CredentialManager( _root ) );
-         _cmPtr->addUserCred( url_r );
-       }
-       return ret;
+        bool ret = url_r.hasCredentialsInAuthority();
+        if ( ret )
+        {
+          if ( !_cmPtr ) _cmPtr.reset( new media::CredentialManager( _root ) );
+          _cmPtr->addUserCred( url_r );
+        }
+        return ret;
       }
       /** \overload operating on Url container */
       template<class TContainer>
@@ -130,10 +130,10 @@ namespace zypp
       /** Remember credentials stored in URL authority stripping the passowrd from \a url_r. */
       bool extract( Url & url_r )
       {
-       bool ret = collect( url_r );
-       if ( ret )
-         url_r.setPassword( std::string() );
-       return ret;
+        bool ret = collect( url_r );
+        if ( ret )
+          url_r.setPassword( std::string() );
+        return ret;
       }
       /** \overload operating on Url container */
       template<class TContainer>
@@ -310,33 +310,33 @@ namespace zypp
       bool nonroot( geteuid() != 0 );
       if ( nonroot && ! PathInfo(dir).userMayRX() )
       {
-       JobReport::warning( str::Format(_("Cannot read repo directory '%1%': Permission denied")) % dir );
+        JobReport::warning( str::Format(_("Cannot read repo directory '%1%': Permission denied")) % dir );
       }
       else
       {
-       std::list<Pathname> entries;
-       if ( filesystem::readdir( entries, dir, false ) != 0 )
-       {
-         // TranslatorExplanation '%s' is a pathname
-         ZYPP_THROW(Exception(str::form(_("Failed to read directory '%s'"), dir.c_str())));
-       }
-
-       str::regex allowedRepoExt("^\\.repo(_[0-9]+)?$");
-       for ( std::list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
-       {
-         if ( str::regex_match(it->extension(), allowedRepoExt) )
-         {
-           if ( nonroot && ! PathInfo(*it).userMayR() )
-           {
-             JobReport::warning( str::Format(_("Cannot read repo file '%1%': Permission denied")) % *it );
-           }
-           else
-           {
-             const std::list<RepoInfo> & tmp( repositories_in_file( *it ) );
-             repos.insert( repos.end(), tmp.begin(), tmp.end() );
-           }
-         }
-       }
+        std::list<Pathname> entries;
+        if ( filesystem::readdir( entries, dir, false ) != 0 )
+        {
+          // TranslatorExplanation '%s' is a pathname
+          ZYPP_THROW(Exception(str::form(_("Failed to read directory '%s'"), dir.c_str())));
+        }
+
+        str::regex allowedRepoExt("^\\.repo(_[0-9]+)?$");
+        for ( std::list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
+        {
+          if ( str::regex_match(it->extension(), allowedRepoExt) )
+          {
+            if ( nonroot && ! PathInfo(*it).userMayR() )
+            {
+              JobReport::warning( str::Format(_("Cannot read repo file '%1%': Permission denied")) % *it );
+            }
+            else
+            {
+              const std::list<RepoInfo> & tmp( repositories_in_file( *it ) );
+              repos.insert( repos.end(), tmp.begin(), tmp.end() );
+            }
+          }
+        }
       }
       return repos;
     }
@@ -346,23 +346,23 @@ namespace zypp
     inline void assert_alias( const RepoInfo & info )
     {
       if ( info.alias().empty() )
-       ZYPP_THROW( RepoNoAliasException( info ) );
+        ZYPP_THROW( RepoNoAliasException( info ) );
       // bnc #473834. Maybe we can match the alias against a regex to define
       // and check for valid aliases
       if ( info.alias()[0] == '.')
-       ZYPP_THROW(RepoInvalidAliasException(
-         info, _("Repository alias cannot start with dot.")));
+        ZYPP_THROW(RepoInvalidAliasException(
+          info, _("Repository alias cannot start with dot.")));
     }
 
     inline void assert_alias( const ServiceInfo & info )
     {
       if ( info.alias().empty() )
-       ZYPP_THROW( ServiceNoAliasException( info ) );
+        ZYPP_THROW( ServiceNoAliasException( info ) );
       // bnc #473834. Maybe we can match the alias against a regex to define
       // and check for valid aliases
       if ( info.alias()[0] == '.')
-       ZYPP_THROW(ServiceInvalidAliasException(
-         info, _("Service alias cannot start with dot.")));
+        ZYPP_THROW(ServiceInvalidAliasException(
+          info, _("Service alias cannot start with dot.")));
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -370,13 +370,13 @@ namespace zypp
     inline void assert_urls( const RepoInfo & info )
     {
       if ( info.baseUrlsEmpty() )
-       ZYPP_THROW( RepoNoUrlException( info ) );
+        ZYPP_THROW( RepoNoUrlException( info ) );
     }
 
     inline void assert_url( const ServiceInfo & info )
     {
       if ( ! info.url().isValid() )
-       ZYPP_THROW( ServiceNoUrlException( info ) );
+        ZYPP_THROW( ServiceNoUrlException( info ) );
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -443,8 +443,8 @@ namespace zypp
 
       bool operator()( const ServiceInfo & service_r ) const
       {
-       _services.insert( service_r );
-       return true;
+        _services.insert( service_r );
+        return true;
       }
 
     private:
@@ -532,43 +532,43 @@ namespace zypp
     {
       // trigger appdata refresh if some repos change
       if ( ( _reposDirty || env::ZYPP_PLUGIN_APPDATA_FORCE_COLLECT() )
-       && geteuid() == 0 && ( _options.rootDir.empty() || _options.rootDir == "/" ) )
+        && geteuid() == 0 && ( _options.rootDir.empty() || _options.rootDir == "/" ) )
       {
-       try {
-         std::list<Pathname> entries;
-         filesystem::readdir( entries, _options.pluginsPath/"appdata", false );
-         if ( ! entries.empty() )
-         {
-           ExternalProgram::Arguments cmd;
-           cmd.push_back( "<" );               // discard stdin
-           cmd.push_back( ">" );               // discard stdout
-           cmd.push_back( "PROGRAM" );         // [2] - fix index below if changing!
-           for ( const auto & rinfo : repos() )
-           {
-             if ( ! rinfo.enabled() )
-               continue;
-             cmd.push_back( "-R" );
-             cmd.push_back( rinfo.alias() );
-             cmd.push_back( "-t" );
-             cmd.push_back( rinfo.type().asString() );
-             cmd.push_back( "-p" );
-             cmd.push_back( rinfo.metadataPath().asString() );
-           }
-
-           for_( it, entries.begin(), entries.end() )
-           {
-             PathInfo pi( *it );
-             //DBG << "/tmp/xx ->" << pi << endl;
-             if ( pi.isFile() && pi.userMayRX() )
-             {
-               // trigger plugin
-               cmd[2] = pi.asString();         // [2] - PROGRAM
-               ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
-             }
-           }
-         }
-       }
-       catch (...) {}  // no throw in dtor
+        try {
+          std::list<Pathname> entries;
+          filesystem::readdir( entries, _options.pluginsPath/"appdata", false );
+          if ( ! entries.empty() )
+          {
+            ExternalProgram::Arguments cmd;
+            cmd.push_back( "<" );              // discard stdin
+            cmd.push_back( ">" );              // discard stdout
+            cmd.push_back( "PROGRAM" );                // [2] - fix index below if changing!
+            for ( const auto & rinfo : repos() )
+            {
+              if ( ! rinfo.enabled() )
+                continue;
+              cmd.push_back( "-R" );
+              cmd.push_back( rinfo.alias() );
+              cmd.push_back( "-t" );
+              cmd.push_back( rinfo.type().asString() );
+              cmd.push_back( "-p" );
+              cmd.push_back( rinfo.metadataPath().asString() );
+            }
+
+            for_( it, entries.begin(), entries.end() )
+            {
+              PathInfo pi( *it );
+              //DBG << "/tmp/xx ->" << pi << endl;
+              if ( pi.isFile() && pi.userMayRX() )
+              {
+                // trigger plugin
+                cmd[2] = pi.asString();                // [2] - PROGRAM
+                ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
+              }
+            }
+          }
+        }
+        catch (...) {} // no throw in dtor
       }
     }
 
@@ -802,34 +802,34 @@ namespace zypp
      * we may easily remove user data (zypper --pkg-cache-dir . download ...)
      */
     inline void cleanupNonRepoMetadtaFolders( const Pathname & cachePath_r,
-                                             const Pathname & defaultCachePath_r,
-                                             const std::list<std::string> & repoEscAliases_r )
+                                              const Pathname & defaultCachePath_r,
+                                              const std::list<std::string> & repoEscAliases_r )
     {
       if ( cachePath_r != defaultCachePath_r )
-       return;
+        return;
 
       std::list<std::string> entries;
       if ( filesystem::readdir( entries, cachePath_r, false ) == 0 )
       {
-       entries.sort();
-       std::set<std::string> oldfiles;
-       set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(),
-                       std::inserter( oldfiles, oldfiles.end() ) );
-
-       // bsc#1178966: Files or symlinks here have been created by the user
-       // for whatever purpose. It's our cache, so we purge them now before
-       // they may later conflict with directories we need.
-       PathInfo pi;
-       for ( const std::string & old : oldfiles )
-       {
-         if ( old == Repository::systemRepoAlias() )   // don't remove the @System solv file
-           continue;
-         pi( cachePath_r/old );
-         if ( pi.isDir() )
-           filesystem::recursive_rmdir( pi.path() );
-         else
-           filesystem::unlink( pi.path() );
-       }
+        entries.sort();
+        std::set<std::string> oldfiles;
+        set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(),
+                        std::inserter( oldfiles, oldfiles.end() ) );
+
+        // bsc#1178966: Files or symlinks here have been created by the user
+        // for whatever purpose. It's our cache, so we purge them now before
+        // they may later conflict with directories we need.
+        PathInfo pi;
+        for ( const std::string & old : oldfiles )
+        {
+          if ( old == Repository::systemRepoAlias() )  // don't remove the @System solv file
+            continue;
+          pi( cachePath_r/old );
+          if ( pi.isDir() )
+            filesystem::recursive_rmdir( pi.path() );
+          else
+            filesystem::unlink( pi.path() );
+        }
       }
     }
   } // namespace
@@ -846,19 +846,19 @@ namespace zypp
       {
         // set the metadata path for the repo
         repoInfo.setMetadataPath( rawcache_path_for_repoinfo(_options, repoInfo) );
-       // set the downloaded packages path for the repo
-       repoInfo.setPackagesPath( packagescache_path_for_repoinfo(_options, repoInfo) );
-       // remember it
+        // set the downloaded packages path for the repo
+        repoInfo.setPackagesPath( packagescache_path_for_repoinfo(_options, repoInfo) );
+        // remember it
         _reposX.insert( repoInfo );    // direct access via _reposX in ctor! no reposManip.
 
-       // detect orphaned repos belonging to a deleted service
-       const std::string & serviceAlias( repoInfo.service() );
-       if ( ! ( serviceAlias.empty() || hasService( serviceAlias ) ) )
-       {
-         WAR << "Schedule orphaned service repo for deletion: " << repoInfo << endl;
-         orphanedRepos.push_back( repoInfo );
-         continue;     // don't remember it in repoEscAliases
-       }
+        // detect orphaned repos belonging to a deleted service
+        const std::string & serviceAlias( repoInfo.service() );
+        if ( ! ( serviceAlias.empty() || hasService( serviceAlias ) ) )
+        {
+          WAR << "Schedule orphaned service repo for deletion: " << repoInfo << endl;
+          orphanedRepos.push_back( repoInfo );
+          continue;    // don't remember it in repoEscAliases
+        }
 
         repoEscAliases.push_back(repoInfo.escaped_alias());
       }
@@ -866,23 +866,23 @@ namespace zypp
       // Cleanup orphanded service repos:
       if ( ! orphanedRepos.empty() )
       {
-       for ( const auto & repoInfo : orphanedRepos )
-       {
-         MIL << "Delete orphaned service repo " << repoInfo.alias() << endl;
-         // translators: Cleanup a repository previously owned by a meanwhile unknown (deleted) service.
-         //   %1% = service name
-         //   %2% = repository name
-         JobReport::warning( str::Format(_("Unknown service '%1%': Removing orphaned service repository '%2%'"))
-                             % repoInfo.service()
-                             % repoInfo.alias() );
-         try {
-           removeRepository( repoInfo );
-         }
-         catch ( const Exception & caugth )
-         {
-           JobReport::error( caugth.asUserHistory() );
-         }
-       }
+        for ( const auto & repoInfo : orphanedRepos )
+        {
+          MIL << "Delete orphaned service repo " << repoInfo.alias() << endl;
+          // translators: Cleanup a repository previously owned by a meanwhile unknown (deleted) service.
+          //   %1% = service name
+          //   %2% = repository name
+          JobReport::warning( str::Format(_("Unknown service '%1%': Removing orphaned service repository '%2%'"))
+                              % repoInfo.service()
+                              % repoInfo.alias() );
+          try {
+            removeRepository( repoInfo );
+          }
+          catch ( const Exception & caugth )
+          {
+            JobReport::error( caugth.asUserHistory() );
+          }
+        }
       }
 
       // delete metadata folders without corresponding repo (e.g. old tmp directories)
@@ -892,14 +892,14 @@ namespace zypp
       // we may easily remove user data (zypper --pkg-cache-dir . download ...)
       repoEscAliases.sort();
       cleanupNonRepoMetadtaFolders( _options.repoRawCachePath,
-                                   Pathname::assertprefix( _options.rootDir, ZConfig::instance().builtinRepoMetadataPath() ),
-                                   repoEscAliases );
+                                    Pathname::assertprefix( _options.rootDir, ZConfig::instance().builtinRepoMetadataPath() ),
+                                    repoEscAliases );
       cleanupNonRepoMetadtaFolders( _options.repoSolvCachePath,
-                                   Pathname::assertprefix( _options.rootDir, ZConfig::instance().builtinRepoSolvfilesPath() ),
-                                   repoEscAliases );
+                                    Pathname::assertprefix( _options.rootDir, ZConfig::instance().builtinRepoSolvfilesPath() ),
+                                    repoEscAliases );
       cleanupNonRepoMetadtaFolders( _options.repoPackagesCachePath,
-                                   Pathname::assertprefix( _options.rootDir, ZConfig::instance().builtinRepoPackagesPath() ),
-                                   repoEscAliases );
+                                    Pathname::assertprefix( _options.rootDir, ZConfig::instance().builtinRepoPackagesPath() ),
+                                    repoEscAliases );
     }
     MIL << "end construct known repos" << endl;
   }
@@ -925,21 +925,21 @@ namespace zypp
     {
       case RepoType::RPMMD_e :
         status = RepoStatus( productdatapath/"repodata/repomd.xml") && RepoStatus( mediarootpath/"media.1/media" );
-       break;
+        break;
 
       case RepoType::YAST2_e :
         status = RepoStatus( productdatapath/"content" ) && RepoStatus( mediarootpath/"media.1/media" );
-       break;
+        break;
 
       case RepoType::RPMPLAINDIR_e :
-       status = RepoStatus::fromCookieFile( productdatapath/"cookie" );        // dir status at last refresh
-       break;
+        status = RepoStatus::fromCookieFile( productdatapath/"cookie" );       // dir status at last refresh
+        break;
 
       case RepoType::NONE_e :
-       // Return default RepoStatus in case of RepoType::NONE
-       // indicating it should be created?
+        // Return default RepoStatus in case of RepoType::NONE
+        // indicating it should be created?
         // ZYPP_THROW(RepoUnknownTypeException());
-       break;
+        break;
     }
 
     if ( ! status.empty() )
@@ -1006,98 +1006,98 @@ namespace zypp
 
       if ( url.schemeIsVolatile() )
       {
-       MIL << "Never refresh CD/DVD" << endl;
-       return REPO_UP_TO_DATE;
+        MIL << "Never refresh CD/DVD" << endl;
+        return REPO_UP_TO_DATE;
       }
 
       if ( policy == RefreshForced )
       {
-       MIL << "Forced refresh!" << endl;
-       return REFRESH_NEEDED;
+        MIL << "Forced refresh!" << endl;
+        return REFRESH_NEEDED;
       }
 
       if ( url.schemeIsLocal() )
       {
-       policy = RefreshIfNeededIgnoreDelay;
+        policy = RefreshIfNeededIgnoreDelay;
       }
 
       // Check whether repo.refresh.delay applies...
       if ( policy != RefreshIfNeededIgnoreDelay )
       {
-       // bsc#1174016: Prerequisite to skipping the refresh is that metadata
-       // and solv cache status match. They will not, if the repos URL was
-       // changed e.g. due to changed repovars.
-       RepoStatus cachestatus = cacheStatus( info );
-
-       if ( oldstatus == cachestatus )
-       {
-         // difference in seconds
-         double diff = ::difftime( (Date::ValueType)Date::now(), (Date::ValueType)oldstatus.timestamp() ) / 60;
-         if ( diff < ZConfig::instance().repo_refresh_delay() )
-         {
-           if ( diff < 0 )
-           {
-             WAR << "Repository '" << info.alias() << "' was refreshed in the future!" << endl;
-           }
-           else
-           {
-             MIL << "Repository '" << info.alias()
-             << "' has been refreshed less than repo.refresh.delay ("
-             << ZConfig::instance().repo_refresh_delay()
-             << ") minutes ago. Advising to skip refresh" << endl;
-             return REPO_CHECK_DELAYED;
-           }
-         }
-       }
-       else {
-         MIL << "Metadata and solv cache don't match. Check data on server..." << endl;
-       }
+        // bsc#1174016: Prerequisite to skipping the refresh is that metadata
+        // and solv cache status match. They will not, if the repos URL was
+        // changed e.g. due to changed repovars.
+        RepoStatus cachestatus = cacheStatus( info );
+
+        if ( oldstatus == cachestatus )
+        {
+          // difference in seconds
+          double diff = ::difftime( (Date::ValueType)Date::now(), (Date::ValueType)oldstatus.timestamp() ) / 60;
+          if ( diff < ZConfig::instance().repo_refresh_delay() )
+          {
+            if ( diff < 0 )
+            {
+              WAR << "Repository '" << info.alias() << "' was refreshed in the future!" << endl;
+            }
+            else
+            {
+              MIL << "Repository '" << info.alias()
+              << "' has been refreshed less than repo.refresh.delay ("
+              << ZConfig::instance().repo_refresh_delay()
+              << ") minutes ago. Advising to skip refresh" << endl;
+              return REPO_CHECK_DELAYED;
+            }
+          }
+        }
+        else {
+          MIL << "Metadata and solv cache don't match. Check data on server..." << endl;
+        }
       }
 
       repo::RepoType repokind = info.type();
       // if unknown: probe it
       if ( repokind == RepoType::NONE )
-       repokind = probe( url, info.path() );
+        repokind = probe( url, info.path() );
 
       // retrieve newstatus
       RepoStatus newstatus;
       switch ( repokind.toEnum() )
       {
-       case RepoType::RPMMD_e:
-       {
-         MediaSetAccess media( url );
-         newstatus = RepoStatus( info ) && yum::Downloader( info, mediarootpath ).status( media );
-       }
-       break;
-
-       case RepoType::YAST2_e:
-       {
-         MediaSetAccess media( url );
-         newstatus = RepoStatus( info ) && susetags::Downloader( info, mediarootpath ).status( media );
-       }
-       break;
-
-       case RepoType::RPMPLAINDIR_e:
-         newstatus = RepoStatus( info ) && RepoStatus( MediaMounter(url).getPathName(info.path()) );   // dir status
-         break;
-
-       default:
-       case RepoType::NONE_e:
-         ZYPP_THROW( RepoUnknownTypeException( info ) );
-         break;
+        case RepoType::RPMMD_e:
+        {
+          MediaSetAccess media( url );
+          newstatus = RepoStatus( info ) && yum::Downloader( info, mediarootpath ).status( media );
+        }
+        break;
+
+        case RepoType::YAST2_e:
+        {
+          MediaSetAccess media( url );
+          newstatus = RepoStatus( info ) && susetags::Downloader( info, mediarootpath ).status( media );
+        }
+        break;
+
+        case RepoType::RPMPLAINDIR_e:
+          newstatus = RepoStatus( info ) && RepoStatus( MediaMounter(url).getPathName(info.path()) );  // dir status
+          break;
+
+        default:
+        case RepoType::NONE_e:
+          ZYPP_THROW( RepoUnknownTypeException( info ) );
+          break;
       }
 
       // check status
       if ( oldstatus == newstatus )
       {
-       MIL << "repo has not changed" << endl;
-       touchIndexFile( info );
-       return REPO_UP_TO_DATE;
+        MIL << "repo has not changed" << endl;
+        touchIndexFile( info );
+        return REPO_UP_TO_DATE;
       }
       else // includes newstatus.empty() if e.g. repo format changed
       {
-       MIL << "repo has changed, going to refresh" << endl;
-       return REFRESH_NEEDED;
+        MIL << "repo has changed, going to refresh" << endl;
+        return REFRESH_NEEDED;
       }
     }
     catch ( const Exception &e )
@@ -1118,8 +1118,8 @@ namespace zypp
 
     // we will throw this later if no URL checks out fine
     RepoException rexception( info, PL_("Valid metadata not found at specified URL",
-                                       "Valid metadata not found at specified URLs",
-                                       info.baseUrlsSize() ) );
+                                        "Valid metadata not found at specified URLs",
+                                        info.baseUrlsSize() ) );
 
     // Suppress (interactive) media::MediaChangeReport if we in have multiple basurls (>1)
     media::ScopedDisableMediaChangeReport guard( info.baseUrlsSize() > 1 );
@@ -1137,34 +1137,34 @@ namespace zypp
 
         MIL << "Going to refresh metadata from " << url << endl;
 
-       // bsc#1048315: Always re-probe in case of repo format change.
-       // TODO: Would be sufficient to verify the type and re-probe
-       // if verification failed (or type is RepoType::NONE)
+        // bsc#1048315: Always re-probe in case of repo format change.
+        // TODO: Would be sufficient to verify the type and re-probe
+        // if verification failed (or type is RepoType::NONE)
         repo::RepoType repokind = info.type();
-       {
-         repo::RepoType probed = probe( *it, info.path() );
-         if ( repokind != probed )
-         {
-           repokind = probed;
-           // update probed type only for repos in system
-           for_( it, repoBegin(), repoEnd() )
-           {
-             if ( info.alias() == (*it).alias() )
-             {
-               RepoInfo modifiedrepo = *it;
-               modifiedrepo.setType( repokind );
-               // don't modify .repo in refresh.
-               // modifyRepository( info.alias(), modifiedrepo );
-               break;
-             }
-           }
-           // Adjust the probed type in RepoInfo
-           info.setProbedType( repokind ); // lazy init!
-         }
-         // no need to continue with an unknown type
-         if ( repokind.toEnum() == RepoType::NONE_e )
-           ZYPP_THROW(RepoUnknownTypeException( info ));
-       }
+        {
+          repo::RepoType probed = probe( *it, info.path() );
+          if ( repokind != probed )
+          {
+            repokind = probed;
+            // update probed type only for repos in system
+            for_( it, repoBegin(), repoEnd() )
+            {
+              if ( info.alias() == (*it).alias() )
+              {
+                RepoInfo modifiedrepo = *it;
+                modifiedrepo.setType( repokind );
+                // don't modify .repo in refresh.
+                // modifyRepository( info.alias(), modifiedrepo );
+                break;
+              }
+            }
+            // Adjust the probed type in RepoInfo
+            info.setProbedType( repokind ); // lazy init!
+          }
+          // no need to continue with an unknown type
+          if ( repokind.toEnum() == RepoType::NONE_e )
+            ZYPP_THROW(RepoUnknownTypeException( info ));
+        }
 
         Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info );
         if( filesystem::assert_dir(mediarootpath) )
@@ -1211,13 +1211,13 @@ namespace zypp
         }
         else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
         {
-         // as substitute for real metadata remember the checksum of the directory we refreshed
+          // as substitute for real metadata remember the checksum of the directory we refreshed
           MediaMounter media( url );
           RepoStatus newstatus = RepoStatus( media.getPathName( info.path() ) );       // dir status
 
           Pathname productpath( tmpdir.path() / info.path() );
           filesystem::assert_dir( productpath );
-         newstatus.saveToCookieFile( productpath/"cookie" );
+          newstatus.saveToCookieFile( productpath/"cookie" );
         }
         else
         {
@@ -1226,9 +1226,9 @@ namespace zypp
 
         // ok we have the metadata, now exchange
         // the contents
-       filesystem::exchange( tmpdir.path(), mediarootpath );
-       if ( ! isTmpRepo( info ) )
-         reposManip(); // remember to trigger appdata refresh
+        filesystem::exchange( tmpdir.path(), mediarootpath );
+        if ( ! isTmpRepo( info ) )
+          reposManip();        // remember to trigger appdata refresh
 
         // we are done.
         return;
@@ -1243,8 +1243,8 @@ namespace zypp
         // cause of the problem of the first URL remembered
         if (it == info.baseUrlsBegin())
           rexception.remember(e);
-       else
-         rexception.addHistory(  e.asUserString() );
+        else
+          rexception.addHistory(  e.asUserString() );
 
       }
     } // for every url
@@ -1305,13 +1305,13 @@ namespace zypp
       {
         MIL << info.alias() << " cache is up to date with metadata." << endl;
         if ( policy == BuildIfNeeded )
-       {
-         // On the fly add missing solv.idx files for bash completion.
-         const Pathname & base = solv_path_for_repoinfo( _options, info);
-         if ( ! PathInfo(base/"solv.idx").isExist() )
-           sat::updateSolvFileIndex( base/"solv" );
+        {
+          // On the fly add missing solv.idx files for bash completion.
+          const Pathname & base = solv_path_for_repoinfo( _options, info);
+          if ( ! PathInfo(base/"solv.idx").isExist() )
+            sat::updateSolvFileIndex( base/"solv" );
 
-         return;
+          return;
         }
         else {
           MIL << info.alias() << " cache rebuild is forced" << endl;
@@ -1380,7 +1380,7 @@ namespace zypp
         // repo2solv expects -o as 1st arg!
         cmd.push_back( "-o" );
         cmd.push_back( solvfile.asString() );
-       cmd.push_back( "-X" );  // autogenerate pattern from pattern-package
+        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 )
@@ -1416,7 +1416,7 @@ namespace zypp
 
         // We keep it.
         guard.resetDispose();
-       sat::updateSolvFileIndex( solvfile );   // content digest for zypper bash completion
+        sat::updateSolvFileIndex( solvfile );  // content digest for zypper bash completion
       }
       break;
       default:
@@ -1494,8 +1494,8 @@ namespace zypp
         gotMediaException = true;
       }
 
-      // if it is a non-downloading URL denoting a directory
-      if ( ! url.schemeIsDownloading() )
+      // if it is a non-downloading URL denoting a directory (bsc#1191286: and no plugin)
+      if ( ! ( url.schemeIsDownloading() || url.schemeIsPlugin() ) )
       {
         MediaMounter media( url );
         if ( PathInfo(media.getPathName()/path).isDir() )
@@ -1665,9 +1665,9 @@ namespace zypp
 
       RepoType probedtype( probe( tosave.url(), info.path() ) );
       if ( probedtype == RepoType::NONE )
-       ZYPP_THROW(RepoUnknownTypeException(info));
+        ZYPP_THROW(RepoUnknownTypeException(info));
       else
-       tosave.setType(probedtype);
+        tosave.setType(probedtype);
     }
 
     progress.set(50);
@@ -1803,10 +1803,10 @@ namespace zypp
         // figure how many repos are there in the file:
         std::list<RepoInfo> filerepos = repositories_in_file(todelete.filepath());
         if ( filerepos.size() == 0     // bsc#984494: file may have already been deleted
-         ||(filerepos.size() == 1 && filerepos.front().alias() == todelete.alias() ) )
+          ||(filerepos.size() == 1 && filerepos.front().alias() == todelete.alias() ) )
         {
           // easy: file does not exist, contains no or only the repo to delete: delete the file
-         int ret = filesystem::unlink( todelete.filepath() );
+          int ret = filesystem::unlink( todelete.filepath() );
           if ( ! ( ret == 0 || ret == ENOENT ) )
           {
             // TranslatorExplanation '%s' is a filename
@@ -1847,7 +1847,7 @@ namespace zypp
           cleanCache( todelete, cSubprogrcv);
         // now delete metadata (#301037)
         cleanMetadata( todelete, mSubprogrcv );
-       cleanPackages( todelete, pSubprogrcv );
+        cleanPackages( todelete, pSubprogrcv );
         reposManip().erase(todelete);
         MIL << todelete.alias() << " successfully deleted." << endl;
         HistoryLog(_options.rootDir).removeRepository(todelete);
@@ -1909,22 +1909,22 @@ namespace zypp
 
       if ( toedit.enabled() && !newinfo.enabled() )
       {
-       // On the fly remove solv.idx files for bash completion if a repo gets disabled.
-       const Pathname & solvidx = solv_path_for_repoinfo(_options, newinfo)/"solv.idx";
-       if ( PathInfo(solvidx).isExist() )
-         filesystem::unlink( solvidx );
+        // On the fly remove solv.idx files for bash completion if a repo gets disabled.
+        const Pathname & solvidx = solv_path_for_repoinfo(_options, newinfo)/"solv.idx";
+        if ( PathInfo(solvidx).isExist() )
+          filesystem::unlink( solvidx );
       }
 
       newinfo.setFilepath(toedit.filepath());
       newinfo.setMetadataPath( rawcache_path_for_repoinfo( _options, newinfo ) );
       newinfo.setPackagesPath( packagescache_path_for_repoinfo( _options, newinfo ) );
       {
-       // We should fix the API as we must inject those paths
-       // into the repoinfo in order to keep it usable.
-       RepoInfo & oinfo( const_cast<RepoInfo &>(newinfo_r) );
-       oinfo.setFilepath(toedit.filepath());
-       oinfo.setMetadataPath( rawcache_path_for_repoinfo( _options, newinfo ) );
-       oinfo.setPackagesPath( packagescache_path_for_repoinfo( _options, newinfo ) );
+        // We should fix the API as we must inject those paths
+        // into the repoinfo in order to keep it usable.
+        RepoInfo & oinfo( const_cast<RepoInfo &>(newinfo_r) );
+        oinfo.setFilepath(toedit.filepath());
+        oinfo.setMetadataPath( rawcache_path_for_repoinfo( _options, newinfo ) );
+        oinfo.setPackagesPath( packagescache_path_for_repoinfo( _options, newinfo ) );
       }
       reposManip().erase(toedit);
       reposManip().insert(newinfo);
@@ -1955,7 +1955,7 @@ namespace zypp
       for_( urlit, (*it).baseUrlsBegin(), (*it).baseUrlsEnd() )
       {
         if ( (*urlit).asString(urlview) == url.asString(urlview) )
-         return *it;
+          return *it;
       }
     }
     RepoInfo info;
@@ -2039,7 +2039,7 @@ namespace zypp
     // now remove all repositories added by this service
     RepoCollector rcollector;
     getRepositoriesInService( alias,
-                             boost::make_function_output_iterator( bind( &RepoCollector::collect, &rcollector, _1 ) ) );
+                              boost::make_function_output_iterator( bind( &RepoCollector::collect, &rcollector, _1 ) ) );
     // cannot do this directly in getRepositoriesInService - would invalidate iterators
     for_(rit, rcollector.repos.begin(), rcollector.repos.end())
       removeRepository(*rit);
@@ -2058,7 +2058,7 @@ namespace zypp
         continue;
 
       try {
-       refreshService(*it, options_r);
+        refreshService(*it, options_r);
       }
       catch ( const repo::ServicePluginInformalException & e )
       { ;/* ignore ServicePluginInformalException */ }
@@ -2078,17 +2078,17 @@ namespace zypp
       Date lrf = service.lrf();
       if ( lrf )
       {
-       Date now( Date::now() );
-       if ( lrf <= now )
-       {
-         if ( (lrf+=service.ttl()) > now ) // lrf+= !
-         {
-           MIL << "Skip: '" << service.alias() << "' metadata valid until " << lrf << endl;
-           return;
-         }
-       }
-       else
-         WAR << "Force: '" << service.alias() << "' metadata last refresh in the future: " << lrf << endl;
+        Date now( Date::now() );
+        if ( lrf <= now )
+        {
+          if ( (lrf+=service.ttl()) > now ) // lrf+= !
+          {
+            MIL << "Skip: '" << service.alias() << "' metadata valid until " << lrf << endl;
+            return;
+          }
+        }
+        else
+          WAR << "Force: '" << service.alias() << "' metadata last refresh in the future: " << lrf << endl;
       }
     }
 
@@ -2144,7 +2144,7 @@ namespace zypp
     if ( service.ttl() != origTtl )    // repoindex.xml changed ttl
     {
       if ( !service.ttl() )
-       service.setLrf( Date() );       // don't need lrf when zero ttl
+        service.setLrf( Date() );      // don't need lrf when zero ttl
       serviceModified = true;
     }
     ////////////////////////////////////////////////////////////////////////////
@@ -2171,26 +2171,26 @@ namespace zypp
       Pathname path;
       if ( !it->path().empty() )
       {
-       if ( it->path() != "/" )
-         path = it->path();
-       it->setPath("");
+        if ( it->path() != "/" )
+          path = it->path();
+        it->setPath("");
       }
 
       if ( it->baseUrlsEmpty() )
       {
-       Url url( service.rawUrl() );
-       if ( !path.empty() )
-         url.setPathName( url.getPathName() / path );
-       it->setBaseUrl( std::move(url) );
+        Url url( service.rawUrl() );
+        if ( !path.empty() )
+          url.setPathName( url.getPathName() / path );
+        it->setBaseUrl( std::move(url) );
       }
       else if ( !path.empty() )
       {
-       RepoInfo::url_set urls( it->rawBaseUrls() );
-       for ( Url & url : urls )
-       {
-         url.setPathName( url.getPathName() / path );
-       }
-       it->setBaseUrls( std::move(urls) );
+        RepoInfo::url_set urls( it->rawBaseUrls() );
+        for ( Url & url : urls )
+        {
+          url.setPathName( url.getPathName() / path );
+        }
+        it->setBaseUrls( std::move(urls) );
       }
     }
 
@@ -2206,21 +2206,21 @@ namespace zypp
     {
       if ( ! foundAliasIn( oldRepo->alias(), collector.repos ) )
       {
-       if ( oldRepo->enabled() )
-       {
-         // Currently enabled. If this was a user modification remember the state.
-         const auto & last = service.repoStates().find( oldRepo->alias() );
-         if ( last != service.repoStates().end() && ! last->second.enabled )
-         {
-           DBG << "Service removes user enabled repo " << oldRepo->alias() << endl;
-           service.addRepoToEnable( oldRepo->alias() );
-           serviceModified = true;
-         }
-         else
-           DBG << "Service removes enabled repo " << oldRepo->alias() << endl;
-       }
-       else
-         DBG << "Service removes disabled repo " << oldRepo->alias() << endl;
+        if ( oldRepo->enabled() )
+        {
+          // Currently enabled. If this was a user modification remember the state.
+          const auto & last = service.repoStates().find( oldRepo->alias() );
+          if ( last != service.repoStates().end() && ! last->second.enabled )
+          {
+            DBG << "Service removes user enabled repo " << oldRepo->alias() << endl;
+            service.addRepoToEnable( oldRepo->alias() );
+            serviceModified = true;
+          }
+          else
+            DBG << "Service removes enabled repo " << oldRepo->alias() << endl;
+        }
+        else
+          DBG << "Service removes disabled repo " << oldRepo->alias() << endl;
 
         removeRepository( *oldRepo );
       }
@@ -2240,31 +2240,31 @@ namespace zypp
 
       if ( options_r.testFlag( RefreshService_restoreStatus ) )
       {
-       DBG << "Opt RefreshService_restoreStatus " << it->alias() << endl;
-       // this overrides any pending request!
-       // Remove from enable request list.
-       // NOTE: repoToDisable is handled differently.
-       //       It gets cleared on each refresh.
-       service.delRepoToEnable( it->alias() );
-       // toBeEnabled stays indeterminate!
+        DBG << "Opt RefreshService_restoreStatus " << it->alias() << endl;
+        // this overrides any pending request!
+        // Remove from enable request list.
+        // NOTE: repoToDisable is handled differently.
+        //       It gets cleared on each refresh.
+        service.delRepoToEnable( it->alias() );
+        // toBeEnabled stays indeterminate!
       }
       else
       {
-       if ( service.repoToEnableFind( it->alias() ) )
-       {
-         DBG << "User request to enable service repo " << it->alias() << endl;
-         toBeEnabled = true;
-         // Remove from enable request list.
-         // NOTE: repoToDisable is handled differently.
-         //       It gets cleared on each refresh.
-         service.delRepoToEnable( it->alias() );
-         serviceModified = true;
-       }
-       else if ( service.repoToDisableFind( it->alias() ) )
-       {
-         DBG << "User request to disable service repo " << it->alias() << endl;
-         toBeEnabled = false;
-       }
+        if ( service.repoToEnableFind( it->alias() ) )
+        {
+          DBG << "User request to enable service repo " << it->alias() << endl;
+          toBeEnabled = true;
+          // Remove from enable request list.
+          // NOTE: repoToDisable is handled differently.
+          //       It gets cleared on each refresh.
+          service.delRepoToEnable( it->alias() );
+          serviceModified = true;
+        }
+        else if ( service.repoToDisableFind( it->alias() ) )
+        {
+          DBG << "User request to disable service repo " << it->alias() << endl;
+          toBeEnabled = false;
+        }
       }
 
       RepoInfoList::iterator oldRepo( findAlias( it->alias(), oldRepos ) );
@@ -2272,9 +2272,9 @@ namespace zypp
       {
         // Not found in oldRepos ==> a new repo to add
 
-       // Make sure the service repo is created with the appropriate enablement
-       if ( ! indeterminate(toBeEnabled) )
-         it->setEnabled( ( bool ) toBeEnabled );
+        // Make sure the service repo is created with the appropriate enablement
+        if ( ! indeterminate(toBeEnabled) )
+          it->setEnabled( ( bool ) toBeEnabled );
 
         DBG << "Service adds repo " << it->alias() << " " << (it->enabled()?"enabled":"disabled") << endl;
         addRepository( *it );
@@ -2284,106 +2284,106 @@ namespace zypp
         // ==> an exising repo to check
         bool oldRepoModified = false;
 
-       if ( indeterminate(toBeEnabled) )
-       {
-         // No user request: check for an old user modificaton otherwise follow service request.
-         // NOTE: Assert toBeEnabled is boolean afterwards!
-         if ( oldRepo->enabled() == it->enabled() )
-           toBeEnabled = it->enabled();        // service requests no change to the system
-         else if (options_r.testFlag( RefreshService_restoreStatus ) )
-         {
-           toBeEnabled = it->enabled();        // RefreshService_restoreStatus forced
-           DBG << "Opt RefreshService_restoreStatus " << it->alias() <<  " forces " << (toBeEnabled?"enabled":"disabled") << endl;
-         }
-         else
-         {
-           const auto & last = service.repoStates().find( oldRepo->alias() );
-           if ( last == service.repoStates().end() || last->second.enabled != it->enabled() )
-             toBeEnabled = it->enabled();      // service request has changed since last refresh -> follow
-           else
-           {
-             toBeEnabled = oldRepo->enabled(); // service request unchaned since last refresh -> keep user modification
-             DBG << "User modified service repo " << it->alias() <<  " may stay " << (toBeEnabled?"enabled":"disabled") << endl;
-           }
-         }
-       }
+        if ( indeterminate(toBeEnabled) )
+        {
+          // No user request: check for an old user modificaton otherwise follow service request.
+          // NOTE: Assert toBeEnabled is boolean afterwards!
+          if ( oldRepo->enabled() == it->enabled() )
+            toBeEnabled = it->enabled();       // service requests no change to the system
+          else if (options_r.testFlag( RefreshService_restoreStatus ) )
+          {
+            toBeEnabled = it->enabled();       // RefreshService_restoreStatus forced
+            DBG << "Opt RefreshService_restoreStatus " << it->alias() <<  " forces " << (toBeEnabled?"enabled":"disabled") << endl;
+          }
+          else
+          {
+            const auto & last = service.repoStates().find( oldRepo->alias() );
+            if ( last == service.repoStates().end() || last->second.enabled != it->enabled() )
+              toBeEnabled = it->enabled();     // service request has changed since last refresh -> follow
+            else
+            {
+              toBeEnabled = oldRepo->enabled();        // service request unchaned since last refresh -> keep user modification
+              DBG << "User modified service repo " << it->alias() <<  " may stay " << (toBeEnabled?"enabled":"disabled") << endl;
+            }
+          }
+        }
 
         // changed enable?
-       if ( toBeEnabled == oldRepo->enabled() )
-       {
-         DBG << "Service repo " << it->alias() << " stays " <<  (oldRepo->enabled()?"enabled":"disabled") << endl;
-       }
-       else if ( toBeEnabled )
-       {
-         DBG << "Service repo " << it->alias() << " gets enabled" << endl;
-         oldRepo->setEnabled( true );
-         oldRepoModified = true;
-       }
-       else
+        if ( toBeEnabled == oldRepo->enabled() )
         {
-         DBG << "Service repo " << it->alias() << " gets disabled" << endl;
-         oldRepo->setEnabled( false );
-         oldRepoModified = true;
-       }
-
-       // all other attributes follow the service request:
-
-       // changed name (raw!)
-       if ( oldRepo->rawName() != it->rawName() )
-       {
-         DBG << "Service repo " << it->alias() << " gets new NAME " << it->rawName() << endl;
-         oldRepo->setName( it->rawName() );
-         oldRepoModified = true;
-       }
-
-       // changed autorefresh
-       if ( oldRepo->autorefresh() != it->autorefresh() )
-       {
-         DBG << "Service repo " << it->alias() << " gets new AUTOREFRESH " << it->autorefresh() << endl;
-         oldRepo->setAutorefresh( it->autorefresh() );
-         oldRepoModified = true;
-       }
-
-       // changed priority?
-       if ( oldRepo->priority() != it->priority() )
-       {
-         DBG << "Service repo " << it->alias() << " gets new PRIORITY " << it->priority() << endl;
-         oldRepo->setPriority( it->priority() );
-         oldRepoModified = true;
-       }
+          DBG << "Service repo " << it->alias() << " stays " <<  (oldRepo->enabled()?"enabled":"disabled") << endl;
+        }
+        else if ( toBeEnabled )
+        {
+          DBG << "Service repo " << it->alias() << " gets enabled" << endl;
+          oldRepo->setEnabled( true );
+          oldRepoModified = true;
+        }
+        else
+        {
+          DBG << "Service repo " << it->alias() << " gets disabled" << endl;
+          oldRepo->setEnabled( false );
+          oldRepoModified = true;
+        }
+
+        // all other attributes follow the service request:
+
+        // changed name (raw!)
+        if ( oldRepo->rawName() != it->rawName() )
+        {
+          DBG << "Service repo " << it->alias() << " gets new NAME " << it->rawName() << endl;
+          oldRepo->setName( it->rawName() );
+          oldRepoModified = true;
+        }
+
+        // changed autorefresh
+        if ( oldRepo->autorefresh() != it->autorefresh() )
+        {
+          DBG << "Service repo " << it->alias() << " gets new AUTOREFRESH " << it->autorefresh() << endl;
+          oldRepo->setAutorefresh( it->autorefresh() );
+          oldRepoModified = true;
+        }
+
+        // changed priority?
+        if ( oldRepo->priority() != it->priority() )
+        {
+          DBG << "Service repo " << it->alias() << " gets new PRIORITY " << it->priority() << endl;
+          oldRepo->setPriority( it->priority() );
+          oldRepoModified = true;
+        }
 
         // changed url?
         {
-         RepoInfo::url_set newUrls( it->rawBaseUrls() );
-         urlCredentialExtractor.extract( newUrls );    // Extract! to prevent passwds from disturbing the comparison below
-         if ( oldRepo->rawBaseUrls() != newUrls )
-         {
-           DBG << "Service repo " << it->alias() << " gets new URLs " << newUrls << endl;
-           oldRepo->setBaseUrls( std::move(newUrls) );
-           oldRepoModified = true;
-         }
-       }
+          RepoInfo::url_set newUrls( it->rawBaseUrls() );
+          urlCredentialExtractor.extract( newUrls );   // Extract! to prevent passwds from disturbing the comparison below
+          if ( oldRepo->rawBaseUrls() != newUrls )
+          {
+            DBG << "Service repo " << it->alias() << " gets new URLs " << newUrls << endl;
+            oldRepo->setBaseUrls( std::move(newUrls) );
+            oldRepoModified = true;
+          }
+        }
 
         // changed gpg check settings?
-       // ATM only plugin services can set GPG values.
-       if ( service.type() == ServiceType::PLUGIN )
-       {
-         TriBool ogpg[3];      // Gpg RepoGpg PkgGpg
-         TriBool ngpg[3];
-         oldRepo->getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
-         it->     getRawGpgChecks( ngpg[0], ngpg[1], ngpg[2] );
+        // ATM only plugin services can set GPG values.
+        if ( service.type() == ServiceType::PLUGIN )
+        {
+          TriBool ogpg[3];     // Gpg RepoGpg PkgGpg
+          TriBool ngpg[3];
+          oldRepo->getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
+          it->     getRawGpgChecks( ngpg[0], ngpg[1], ngpg[2] );
 #define Z_CHKGPG(I,N)                                                                          \
-         if ( ! sameTriboolState( ogpg[I], ngpg[I] ) )                                         \
-                                                                                             \
-           DBG << "Service repo " << it->alias() << " gets new "#N"Check " << ngpg[I] << endl; \
-           oldRepo->set##N##Check( ngpg[I] );                                                  \
-           oldRepoModified = true;                                                             \
-         }
-         Z_CHKGPG( 0, Gpg );
-         Z_CHKGPG( 1, RepoGpg );
-         Z_CHKGPG( 2, PkgGpg );
+          if ( ! sameTriboolState( ogpg[I], ngpg[I] ) )                                                \
+          {                                                                                    \
+            DBG << "Service repo " << it->alias() << " gets new "#N"Check " << ngpg[I] << endl;        \
+            oldRepo->set##N##Check( ngpg[I] );                                                 \
+            oldRepoModified = true;                                                            \
+          }
+          Z_CHKGPG( 0, Gpg );
+          Z_CHKGPG( 1, RepoGpg );
+          Z_CHKGPG( 2, PkgGpg );
 #undef Z_CHKGPG
-       }
+        }
 
         // save if modified:
         if ( oldRepoModified )
@@ -2413,14 +2413,14 @@ namespace zypp
     {
       if ( service.ttl() )
       {
-       service.setLrf( Date::now() );  // remember last refresh
-       serviceModified =  true;        // or use a cookie file
+        service.setLrf( Date::now() ); // remember last refresh
+        serviceModified =  true;       // or use a cookie file
       }
 
       if ( serviceModified )
       {
-       // write out modified service file.
-       modifyService( service.alias(), service );
+        // write out modified service file.
+        modifyService( service.alias(), service );
       }
     }
 
@@ -2482,18 +2482,18 @@ namespace zypp
       getRepositoriesInService(oldAlias, std::back_inserter(toModify));
       for_( it, toModify.begin(), toModify.end() )
       {
-       if ( oldService.enabled() != service.enabled() )
-       {
-         if ( service.enabled() )
-         {
-           // reset to last refreshs state
-           const auto & last = service.repoStates().find( it->alias() );
-           if ( last != service.repoStates().end() )
-             it->setEnabled( last->second.enabled );
-         }
-         else
-           it->setEnabled( false );
-       }
+        if ( oldService.enabled() != service.enabled() )
+        {
+          if ( service.enabled() )
+          {
+            // reset to last refreshs state
+            const auto & last = service.repoStates().find( it->alias() );
+            if ( last != service.repoStates().end() )
+              it->setEnabled( last->second.enabled );
+          }
+          else
+            it->setEnabled( false );
+        }
 
         if ( oldAlias != service.alias() )
           it->setService(service.alias());
index 2e70a68..4ce4fda 100644 (file)
@@ -33,17 +33,17 @@ namespace zypp
     {
       std::list<std::string> dircontent;
       if ( filesystem::readdir( dircontent, dir_r, false/*no dots*/ ) != 0 )
-       return; // readdir logged the error
+        return; // readdir logged the error
 
       for_( it, dircontent.begin(), dircontent.end() )
       {
-       PathInfo pi( dir_r + *it, PathInfo::LSTAT );
-       if ( pi.isDir() )
-       {
-         if ( pi.mtime() > max_r )
-           max_r = pi.mtime();
-         recursiveTimestamp( pi.path(), max_r );
-       }
+        PathInfo pi( dir_r + *it, PathInfo::LSTAT );
+        if ( pi.isDir() )
+        {
+          if ( pi.mtime() > max_r )
+            max_r = pi.mtime();
+          recursiveTimestamp( pi.path(), max_r );
+        }
       }
     }
   } // namespace
@@ -69,9 +69,9 @@ namespace zypp
     void assignFromCtor( std::string && checksum_r, Date && timestamp_r )
     {
       if ( !checksum_r.empty() ) {
-       static const std::string magic( "43" );
-       checksum_r += magic;
-       _checksums.insert( std::move(checksum_r) );
+        static const std::string magic( "43" );
+        checksum_r += magic;
+        _checksums.insert( std::move(checksum_r) );
       }
       _timestamp = std::move(timestamp_r);
     }
@@ -80,27 +80,27 @@ namespace zypp
     void inject( std::string && checksum_r, Date && timestamp_r )
     {
       if ( !checksum_r.empty() ) {
-       _checksums.insert( std::move(checksum_r) );
-       _cachedchecksum.reset();
+        _checksums.insert( std::move(checksum_r) );
+        _cachedchecksum.reset();
       }
 
       if ( timestamp_r > _timestamp )
-       _timestamp = timestamp_r;
+        _timestamp = timestamp_r;
     }
 
     /** Inject the raw data from rhs */
     void injectFrom( const Impl & rhs )
     {
       if ( &rhs == this )      // no self insert
-       return;
+        return;
 
       if ( !rhs._checksums.empty() ) {
-       _checksums.insert( rhs._checksums.begin(), rhs._checksums.end() );
-       _cachedchecksum.reset();
+        _checksums.insert( rhs._checksums.begin(), rhs._checksums.end() );
+        _cachedchecksum.reset();
       }
 
       if ( rhs._timestamp > _timestamp )
-       _timestamp = rhs._timestamp;
+        _timestamp = rhs._timestamp;
     }
 
     bool empty() const
@@ -110,18 +110,18 @@ namespace zypp
     {
       std::string ret;
       if ( _checksums.empty() )
-       return ret;
+        return ret;
 
       if ( _checksums.size() == 1 )
-       ret = *_checksums.begin();
+        ret = *_checksums.begin();
       else {
-       if ( !_cachedchecksum ) {
-         std::stringstream ss;
-         for ( std::string_view c : _checksums )
-           ss << c;
-         _cachedchecksum = CheckSum::sha1(ss).checksum();
-       }
-       ret = *_cachedchecksum;
+        if ( !_cachedchecksum ) {
+          std::stringstream ss;
+          for ( std::string_view c : _checksums )
+            ss << c;
+          _cachedchecksum = CheckSum::sha1(ss).checksum();
+        }
+        ret = *_cachedchecksum;
       }
       return ret;
     }
@@ -165,13 +165,13 @@ namespace zypp
     {
       if ( info.isFile() )
       {
-       _pimpl->assignFromCtor( filesystem::sha1sum( path_r ), Date( info.mtime() ) );
+        _pimpl->assignFromCtor( filesystem::sha1sum( path_r ), Date( info.mtime() ) );
       }
       else if ( info.isDir() )
       {
-       time_t t = info.mtime();
-       recursiveTimestamp( path_r, t );
-       _pimpl->assignFromCtor( CheckSum::sha1FromString( str::numstring( t ) ).checksum(), Date( t ) );
+        time_t t = info.mtime();
+        recursiveTimestamp( path_r, t );
+        _pimpl->assignFromCtor( CheckSum::sha1FromString( str::numstring( t ) ).checksum(), Date( t ) );
       }
     }
   }
index 78d92b6..8cef4b4 100644 (file)
@@ -52,8 +52,8 @@ namespace zypp
 
     bool Repository::isSystemRepo() const
     {
-       NO_REPOSITORY_RETURN( false );
-       return myPool().isSystemRepo( _repo );
+        NO_REPOSITORY_RETURN( false );
+        return myPool().isSystemRepo( _repo );
     }
 
     std::string Repository::alias() const
@@ -101,8 +101,8 @@ namespace zypp
       NO_REPOSITORY_RETURN( false );
       sat::LookupRepoAttr q( sat::SolvAttr::repositoryRepoid, *this );
       for_( it, q.begin(), q.end() )
-       if ( it.asString() == id_r )
-         return true;
+        if ( it.asString() == id_r )
+          return true;
       return false;
     }
 
@@ -136,8 +136,8 @@ namespace zypp
     bool Repository::hasKeyword( const std::string & val_r ) const
     {
       for ( const auto & val : keywords() )
-       if ( val == val_r )
-         return true;
+        if ( val == val_r )
+          return true;
       return false;
     }
 
@@ -161,32 +161,32 @@ namespace zypp
     {
       NO_REPOSITORY_RETURN( false );
       if ( ! cpeid_r )
-       return false;   // filter queries/products without CpeId, as an empty CpeId matches ANYthing.
+        return false;  // filter queries/products without CpeId, as an empty CpeId matches ANYthing.
 
       // check in repository metadata
       for_( it, updatesProductBegin(), updatesProductEnd() )
       {
-       if ( compare( cpeid_r, it.cpeId(), SetRelation::subset ) )
-         return true;
+        if ( compare( cpeid_r, it.cpeId(), SetRelation::subset ) )
+          return true;
       }
 
       // check whether known products refer to this as update repo
       sat::LookupRepoAttr myIds( sat::SolvAttr::repositoryRepoid, *this );     // usually just one, but...
       if ( ! myIds.empty() )
       {
-       const ResPool & pool( ResPool::instance() );
-       for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
-       {
-         Product::constPtr prod( (*it)->asKind<Product>() );
-         if ( compare( cpeid_r, prod->cpeId(), SetRelation::superset ) )
-         {
-           for_( myId, myIds.begin(), myIds.end() )
-           {
-             if ( prod->hasUpdateContentIdentifier( myId.asString() ) )
-               return true;
-           }
-         }
-       }
+        const ResPool & pool( ResPool::instance() );
+        for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
+        {
+          Product::constPtr prod( (*it)->asKind<Product>() );
+          if ( compare( cpeid_r, prod->cpeId(), SetRelation::superset ) )
+          {
+            for_( myId, myIds.begin(), myIds.end() )
+            {
+              if ( prod->hasUpdateContentIdentifier( myId.asString() ) )
+                return true;
+            }
+          }
+        }
       }
       return false;
     }
@@ -197,21 +197,21 @@ namespace zypp
 
       // check in repository metadata
       if ( updatesProductBegin() != updatesProductEnd() )
-       return true;
+        return true;
 
       // check whether known products refer to this as update repo
       sat::LookupRepoAttr myIds( sat::SolvAttr::repositoryRepoid, *this );     // usually just one, but...
       if ( ! myIds.empty() )
       {
-       const ResPool & pool( ResPool::instance() );
-       for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
-       {
-         for_( myId, myIds.begin(), myIds.end() )
-         {
-           if ( (*it)->asKind<Product>()->hasUpdateContentIdentifier( myId.asString() ) )
-             return true;
-         }
-       }
+        const ResPool & pool( ResPool::instance() );
+        for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
+        {
+          for_( myId, myIds.begin(), myIds.end() )
+          {
+            if ( (*it)->asKind<Product>()->hasUpdateContentIdentifier( myId.asString() ) )
+              return true;
+          }
+        }
       }
       return false;
     }
@@ -278,28 +278,28 @@ namespace zypp
 
     void Repository::setInfo( const RepoInfo & info_r )
     {
-       NO_REPOSITORY_THROW( Exception( "Can't set RepoInfo for norepo." ) );
-       if ( info_r.alias() != alias() )
-       {
-           ZYPP_THROW( Exception( str::form( "RepoInfo alias (%s) does not match repository alias (%s)",
-                                             info_r.alias().c_str(), alias().c_str() ) ) );
-       }
-       myPool().setRepoInfo( _repo, info_r );
+        NO_REPOSITORY_THROW( Exception( "Can't set RepoInfo for norepo." ) );
+        if ( info_r.alias() != alias() )
+        {
+            ZYPP_THROW( Exception( str::form( "RepoInfo alias (%s) does not match repository alias (%s)",
+                                              info_r.alias().c_str(), alias().c_str() ) ) );
+        }
+        myPool().setRepoInfo( _repo, info_r );
         MIL << *this << endl;
     }
 
     void Repository::clearInfo()
     {
-       NO_REPOSITORY_RETURN();
-       myPool().setRepoInfo( _repo, RepoInfo() );
+        NO_REPOSITORY_RETURN();
+        myPool().setRepoInfo( _repo, RepoInfo() );
     }
 
     void Repository::eraseFromPool()
     {
-       NO_REPOSITORY_RETURN();
+        NO_REPOSITORY_RETURN();
         MIL << *this << " removed from pool" << endl;
-       myPool()._deleteRepo( _repo );
-       _id = sat::detail::noRepoId;
+        myPool()._deleteRepo( _repo );
+        _id = sat::detail::noRepoId;
     }
 
     Repository Repository::nextInPool() const
@@ -382,8 +382,8 @@ namespace zypp
 
     sat::detail::SolvableIdType Repository::addSolvables( unsigned count_r )
     {
-       NO_REPOSITORY_THROW( Exception( "Can't add solvables to norepo.") );
-       return myPool()._addSolvables( _repo, count_r );
+        NO_REPOSITORY_THROW( Exception( "Can't add solvables to norepo.") );
+        return myPool()._addSolvables( _repo, count_r );
     }
 
     /******************************************************************
@@ -393,21 +393,21 @@ namespace zypp
      */
     std::ostream & operator<<( std::ostream & str, const Repository & obj )
     {
-       if ( ! obj )
-           return str << "noRepository";
+        if ( ! obj )
+            return str << "noRepository";
 
-       return str << "sat::repo(" << obj.alias() << ")"
-                  << "{"
+        return str << "sat::repo(" << obj.alias() << ")"
+                   << "{"
                    << "prio " << obj.get()->priority << '.' << obj.get()->subpriority
-                  << ", size " << obj.solvablesSize()
-                  << "}";
+                   << ", size " << obj.solvablesSize()
+                   << "}";
     }
 
     std::ostream & dumpAsXmlOn( std::ostream & str, const Repository & obj )
     {
       return xmlout::node( str, "repository", {
-       { "name", obj.name() },
-       { "alias", obj.alias() }
+        { "name", obj.name() },
+        { "alias", obj.alias() }
       } );
     }
 
@@ -416,13 +416,13 @@ namespace zypp
     {
       void RepositoryIterator::increment()
       {
-       if ( base() )
-       {
-         sat::detail::CPool * satpool = sat::Pool::instance().get();
-         do {
-           ++base_reference();
-         } while ( base() < satpool->repos+satpool->nrepos && !*base() );
-       }
+        if ( base() )
+        {
+          sat::detail::CPool * satpool = sat::Pool::instance().get();
+          do {
+            ++base_reference();
+          } while ( base() < satpool->repos+satpool->nrepos && !*base() );
+        }
       }
     } // namespace detail
     //////////////////////////////////////////////////////////////////
index d3092b2..30c9f78 100644 (file)
@@ -45,8 +45,8 @@ namespace zypp
 
         typedef sat::ArrayAttr<std::string,std::string> Keywords;
 
-       typedef std::string ContentRevision;
-       typedef std::string ContentIdentifier;
+        typedef std::string ContentRevision;
+        typedef std::string ContentIdentifier;
 
     public:
         /** Default ctor creates \ref noRepository.*/
@@ -86,34 +86,34 @@ namespace zypp
         /** Label to display for this repo. */
         std::string name() const;
 
-       /** Alias or name, according to \ref ZConfig::repoLabelIsAlias */
-       std::string label() const;
+        /** Alias or name, according to \ref ZConfig::repoLabelIsAlias */
+        std::string label() const;
 
-       /** User string: \ref label (alias or name) */
-       std::string asUserString() const
-       { return label(); }
+        /** User string: \ref label (alias or name) */
+        std::string asUserString() const
+        { return label(); }
 
     public:
-       /** Timestamp or arbitrary user supplied string.
-        * \c /repomd/revision/text() in \c repomd.xml.
-        */
-       ContentRevision contentRevision() const;
-
-       /** Unique string identifying a repositories content.
-        * \c /repomd/tags/repo/text() in \c repomd.xml.
-        * \code
-        * <repomd ....>
-        *  <tags>
-        *   <repo>obsrepository://build.suse.de/SUSE:Factory:Head:Internal/standard</repo>
-        * \endcode
-        * Semantically the value is just a plain string, even
-        * if OBS often uses the location of the project as
-        * unique identifyer.
-        */
-       ContentIdentifier contentIdentifier() const;
-
-       /** Whether \a id_r matches this repos content identifier. */
-       bool hasContentIdentifier( const ContentIdentifier & id_r ) const;
+        /** Timestamp or arbitrary user supplied string.
+         * \c /repomd/revision/text() in \c repomd.xml.
+         */
+        ContentRevision contentRevision() const;
+
+        /** Unique string identifying a repositories content.
+         * \c /repomd/tags/repo/text() in \c repomd.xml.
+         * \code
+         * <repomd ....>
+         *  <tags>
+         *   <repo>obsrepository://build.suse.de/SUSE:Factory:Head:Internal/standard</repo>
+         * \endcode
+         * Semantically the value is just a plain string, even
+         * if OBS often uses the location of the project as
+         * unique identifyer.
+         */
+        ContentIdentifier contentIdentifier() const;
+
+        /** Whether \a id_r matches this repos content identifier. */
+        bool hasContentIdentifier( const ContentIdentifier & id_r ) const;
 
         /**
          * Timestamp when this repository was generated
@@ -156,8 +156,8 @@ namespace zypp
          */
         Keywords keywords() const;
 
-       /** Whether \a val_r is present in keywords. */
-       bool hasKeyword( const std::string & val_r ) const;
+        /** Whether \a val_r is present in keywords. */
+        bool hasKeyword( const std::string & val_r ) const;
 
         /**
          * The suggested expiration date of this repository
@@ -170,19 +170,19 @@ namespace zypp
         bool maybeOutdated() const;
 
         /** Hint whether the Repo may provide updates for a product.
-        *
+         *
          * Either the repository claims to update a product via a repository updates
          * tag in it's metadata or a known product lists the repositories ContentIdentifier
-        * as required update repo.
+         * as required update repo.
          */
         bool isUpdateRepo() const;
 
         /** Hint whether the Repo may provide updates for a product identified by it's \ref CpeId
-        *
+         *
          * Either the repository claims to update a product via a repository updates
          * tag in it's metadata or a known product lists the repositories ContentIdentifier
-        * as required update repo.
-        */
+         * as required update repo.
+         */
         bool providesUpdatesFor( const CpeId & cpeid_r ) const;
 
         /** Whether \ref Repository contains solvables. */
@@ -197,8 +197,8 @@ namespace zypp
         /** Iterator behind the last \ref Solvable. */
         SolvableIterator solvablesEnd() const;
 
-       /** Iterate the repositories Solvables. */
-       Iterable<SolvableIterator> solvables() const;
+        /** Iterate the repositories Solvables. */
+        Iterable<SolvableIterator> solvables() const;
 
     public:
 
@@ -253,10 +253,10 @@ namespace zypp
          * \throws Exception if this is \ref noRepository
          * \throws Exception if the \ref RepoInfo::alias
          *         does not match the \ref Repository::name.
-        */
+         */
         void setInfo( const RepoInfo & info_r );
 
-       /** Remove any \ref RepoInfo set for this repository. */
+        /** Remove any \ref RepoInfo set for this repository. */
         void clearInfo();
 
     public:
@@ -306,7 +306,7 @@ namespace zypp
         sat::Solvable::IdType addSolvables( unsigned count_r );
         /** \overload Add only one new \ref Solvable. */
         sat::Solvable::IdType addSolvable()
-           { return addSolvables( 1 ); }
+            { return addSolvables( 1 ); }
         //@}
 
     public:
@@ -437,8 +437,8 @@ namespace zypp
      */
     struct Repository::EraseFromPool
     {
-       void operator()( Repository repository_r ) const
-           { repository_r.eraseFromPool(); }
+        void operator()( Repository repository_r ) const
+            { repository_r.eraseFromPool(); }
     };
     ///////////////////////////////////////////////////////////////////
 
@@ -451,12 +451,12 @@ namespace zypp
       //
       /** */
       class RepositoryIterator : public boost::iterator_adaptor<
-           RepositoryIterator                            // Derived
-                          , sat::detail::CRepo **        // Base
+            RepositoryIterator                            // Derived
+                           , sat::detail::CRepo **        // Base
                            , Repository                   // Value
-                          , boost::forward_traversal_tag // CategoryOrTraversal
-                          , Repository                   // Reference
-                            >
+                           , boost::forward_traversal_tag // CategoryOrTraversal
+                           , Repository                   // Reference
+                             >
       {
         public:
           RepositoryIterator()
index 66b8b1b..191be61 100644 (file)
@@ -289,7 +289,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().isInstalled();
+        return p.status().isInstalled();
       }
     };
 
@@ -298,7 +298,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().isUninstalled();
+        return p.status().isUninstalled();
       }
     };
 
@@ -307,7 +307,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().transacts();
+        return p.status().transacts();
       }
     };
 
@@ -316,7 +316,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().isLocked();
+        return p.status().isLocked();
       }
     };
 
@@ -325,7 +325,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().isKept();
+        return p.status().isKept();
       }
     };
 
@@ -334,7 +334,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().isRecommended();
+        return p.status().isRecommended();
       }
     };
 
@@ -343,7 +343,7 @@ namespace zypp
     {
       bool operator()( const PoolItem & p ) const
       {
-       return p.status().isSuggested();
+        return p.status().isSuggested();
       }
     };
 
index 1a7bc67..4c07090 100644 (file)
@@ -49,17 +49,17 @@ namespace zypp
     {
       switch ( str_r[3] )
       {
-       // NOTE: it needs to be assertd that the separating ':' is present
-       // if a known kind is retuirned. Dependent code relies on this!
-       #define OUTS(K,S) if ( !::strncmp( str_r, ResKind::K.c_str(), S ) && str_r[S] == ':' ) return ResKind::K
-       //             ----v
-       case 'c': OUTS( patch, 5 );       break;
-       case 'd': OUTS( product, 7 );     break;
-       case 'k': OUTS( package, 7 );     break;
-       case 'l': OUTS( application, 11 );break;
-       case 'p': OUTS( srcpackage, 10 ); break;
-       case 't': OUTS( pattern, 7 );     break;
-       #undef OUTS
+        // NOTE: it needs to be assertd that the separating ':' is present
+        // if a known kind is retuirned. Dependent code relies on this!
+        #define OUTS(K,S) if ( !::strncmp( str_r, ResKind::K.c_str(), S ) && str_r[S] == ':' ) return ResKind::K
+        //             ----v
+        case 'c': OUTS( patch, 5 );       break;
+        case 'd': OUTS( product, 7 );     break;
+        case 'k': OUTS( package, 7 );     break;
+        case 'l': OUTS( application, 11 );break;
+        case 'p': OUTS( srcpackage, 10 ); break;
+        case 't': OUTS( pattern, 7 );     break;
+        #undef OUTS
       }
     }
     return nokind;
index 88b1844..b83c4ce 100644 (file)
@@ -165,7 +165,7 @@ namespace zypp
 
       byIdent_iterator byIdentBegin( const ByIdent & ident_r ) const
       {
-       return make_transform_iterator( id2item().equal_range( ident_r.get() ).first,
+        return make_transform_iterator( id2item().equal_range( ident_r.get() ).first,
                                         pool::PoolTraits::Id2ItemValueSelector() );
       }
 
@@ -196,7 +196,7 @@ namespace zypp
 
       byIdent_iterator byIdentEnd( const ByIdent & ident_r ) const
       {
-       return make_transform_iterator( id2item().equal_range( ident_r.get() ).second,
+        return make_transform_iterator( id2item().equal_range( ident_r.get() ).second,
                                         pool::PoolTraits::Id2ItemValueSelector() );
       }
 
@@ -313,20 +313,20 @@ namespace zypp
       class EstablishedStates
       {
       public:
-       ~EstablishedStates();
-       /** Map holding pseudo installed items where current and established status differ. */
-       typedef std::map<PoolItem,ResStatus::ValidateValue> ChangedPseudoInstalled;
-       /** Return all pseudo installed items whose current state differs from the established one */
-       ChangedPseudoInstalled changedPseudoInstalled() const;
+        ~EstablishedStates();
+        /** Map holding pseudo installed items where current and established status differ. */
+        typedef std::map<PoolItem,ResStatus::ValidateValue> ChangedPseudoInstalled;
+        /** Return all pseudo installed items whose current state differs from the established one */
+        ChangedPseudoInstalled changedPseudoInstalled() const;
       private:
-       class Impl;
-       RW_pointer<Impl> _pimpl;
+        class Impl;
+        RW_pointer<Impl> _pimpl;
       private:
-       friend class pool::PoolImpl;
-       /** Factory: \ref ResPool::establishedStates */
-       EstablishedStates( shared_ptr<Impl> pimpl_r )
-       : _pimpl { pimpl_r }
-       {}
+        friend class pool::PoolImpl;
+        /** Factory: \ref ResPool::establishedStates */
+        EstablishedStates( shared_ptr<Impl> pimpl_r )
+        : _pimpl { pimpl_r }
+        {}
       };
       ///////////////////////////////////////////////////////////////////
 
index 313409b..e43013c 100644 (file)
@@ -230,8 +230,8 @@ namespace zypp
   {
     detail::DumpFilter f;
     return dumpRange( str << obj << " toModify: ",
-                     make_filter_begin( f, obj ),
-                     make_filter_end( f, obj ) );
+                      make_filter_begin( f, obj ),
+                      make_filter_end( f, obj ) );
   }
 
   ///////////////////////////////////////////////////////////////////
index 71bfc8a..009a054 100644 (file)
@@ -57,8 +57,8 @@ namespace zypp
     fieldValueAssign<ValidateField>(v);
     fieldValueAssign<TransactField>(t);
     if (t == TRANSACT) {
-       if (s == INSTALLED) fieldValueAssign<TransactDetailField>(r);
-       else fieldValueAssign<TransactDetailField>(i);
+        if (s == INSTALLED) fieldValueAssign<TransactDetailField>(r);
+        else fieldValueAssign<TransactDetailField>(i);
     }
   }
 
@@ -104,8 +104,8 @@ namespace zypp
     str << (obj.isInstalled() ? "I" : "U");
 
     str << (obj.isBroken() ? "B" :
-       ( obj.isSatisfied() ? "S" :
-       ( obj.isNonRelevant() ? "N" : "_") ) );
+        ( obj.isSatisfied() ? "S" :
+        ( obj.isNonRelevant() ? "N" : "_") ) );
 
     str << (obj.transacts () ? "T"
                              : (obj.isLocked() ? "L" : "_") );
@@ -116,8 +116,8 @@ namespace zypp
     else if (obj.isByUser()) str << "u";
 
     str << (obj.isToBeUninstalledDueToObsolete() ? "O" :
-       ( obj.isToBeUninstalledDueToUpgrade() ? "U" :
-       ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) );
+        ( obj.isToBeUninstalledDueToUpgrade() ? "U" :
+        ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) );
 
     str << (obj.isRecommended() ? "r" : "" );
     str << (obj.isSuggested() ? "s" : "" );
index b64adbc..f2ee0b9 100644 (file)
@@ -92,7 +92,7 @@ namespace zypp
       };
     enum ValidateValue
       {
-       UNDETERMINED = bit::RangeValue<ValidateField,0>::value,
+        UNDETERMINED = bit::RangeValue<ValidateField,0>::value,
         BROKEN       = bit::RangeValue<ValidateField,1>::value,
         SATISFIED    = bit::RangeValue<ValidateField,2>::value,
         NONRELEVANT  = bit::RangeValue<ValidateField,3>::value
@@ -124,7 +124,7 @@ namespace zypp
     enum RemoveDetailValue
       {
         EXPLICIT_REMOVE = bit::RangeValue<TransactDetailField,0>::value,
-       SOFT_REMOVE     = bit::RangeValue<TransactDetailField,1>::value,
+        SOFT_REMOVE     = bit::RangeValue<TransactDetailField,1>::value,
         DUE_TO_OBSOLETE = bit::RangeValue<TransactDetailField,2>::value,
         DUE_TO_UPGRADE  = bit::RangeValue<TransactDetailField,3>::value
       };
@@ -139,9 +139,9 @@ namespace zypp
       {
         NO_WEAK                = bit::RangeValue<WeakField,0>::value,
         SUGGESTED              = bit::RangeValue<WeakField,1<<0>::value,
-       RECOMMENDED             = bit::RangeValue<WeakField,1<<1>::value,
-       ORPHANED                = bit::RangeValue<WeakField,1<<2>::value,
-       UNNEEDED                = bit::RangeValue<WeakField,1<<3>::value
+        RECOMMENDED            = bit::RangeValue<WeakField,1<<1>::value,
+        ORPHANED               = bit::RangeValue<WeakField,1<<2>::value,
+        UNNEEDED               = bit::RangeValue<WeakField,1<<3>::value
       };
 
     enum UserLockQuery // internal
@@ -304,12 +304,12 @@ namespace zypp
 
     bool setTransactByValue(TransactByValue causer)
     {
-       if ( isLessThan<TransactByField>( causer ) ) {
-           fieldValueAssign<TransactByField>( causer );
-           return true;
-       } else {
-           return false;
-       }
+        if ( isLessThan<TransactByField>( causer ) ) {
+            fieldValueAssign<TransactByField>( causer );
+            return true;
+        } else {
+            return false;
+        }
     }
 
     bool isToBeUninstalledDueToObsolete () const
@@ -374,10 +374,10 @@ namespace zypp
 
     bool maySetTransactValue( TransactValue newVal_r, TransactByValue causer_r )
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setTransactValue( newVal_r, causer_r );
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setTransactValue( newVal_r, causer_r );
+        _bitfield = savBitfield;
+        return ret;
     }
 
     /** Apply a lock (prevent transaction).
@@ -412,17 +412,17 @@ namespace zypp
           return false;
         fieldValueAssign<TransactField>( KEEP_STATE );
         fieldValueAssign<TransactByField>( SOLVER ); // reset to lowest causer
-                                                    // in order to distinguish from keep_state_by_user
+                                                     // in order to distinguish from keep_state_by_user
       }
       return true;
     }
 
     bool maySetLock( bool to_r, TransactByValue causer_r )
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setLock( to_r, causer_r );
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setLock( to_r, causer_r );
+        _bitfield = savBitfield;
+        return ret;
     }
 
     /** Toggle between TRANSACT and KEEP_STATE.
@@ -439,12 +439,12 @@ namespace zypp
           if ( transacts() && isLessThan<TransactByField>( causer_r ) )
               fieldValueAssign<TransactByField>( causer_r );
 
-         fieldValueAssign<TransactDetailField>( NO_DETAIL ); // Details has to be set again
+          fieldValueAssign<TransactDetailField>( NO_DETAIL ); // Details has to be set again
           return true;
         }
       // Here: transact status is to be changed:
       if (    ! fieldValueIs<TransactField>( KEEP_STATE )
-             && isGreaterThan<TransactByField>( causer_r ) ) {
+              && isGreaterThan<TransactByField>( causer_r ) ) {
         return false;
       }
 
@@ -463,10 +463,10 @@ namespace zypp
 
     bool maySetTransact( bool val_r, TransactByValue causer )
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setTransact (val_r, causer);
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setTransact (val_r, causer);
+        _bitfield = savBitfield;
+        return ret;
     }
 
     /** */
@@ -519,10 +519,10 @@ namespace zypp
     bool maySetSoftTransact( bool val_r, TransactByValue causer,
                              TransactByValue causerLimit_r )
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setSoftTransact( val_r, causer, causerLimit_r );
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setSoftTransact( val_r, causer, causerLimit_r );
+        _bitfield = savBitfield;
+        return ret;
     }
 
     bool maySetSoftTransact( bool val_r, TransactByValue causer )
@@ -536,10 +536,10 @@ namespace zypp
 
     bool maySetToBeInstalled (TransactByValue causer)
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setToBeInstalled (causer);
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setToBeInstalled (causer);
+        _bitfield = savBitfield;
+        return ret;
     }
 
     bool setToBeUninstalled (TransactByValue causer)
@@ -550,10 +550,10 @@ namespace zypp
 
     bool maySetToBeUninstalled (TransactByValue causer)
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setToBeUninstalled (causer);
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setToBeUninstalled (causer);
+        _bitfield = savBitfield;
+        return ret;
     }
 
     //------------------------------------------------------------------------
@@ -576,8 +576,8 @@ namespace zypp
     bool setToBeInstalledSoft ( )
     {
       if (isInstalled()
-         || !setSoftTransact (true, SOLVER))
-         return false;
+          || !setSoftTransact (true, SOLVER))
+          return false;
 
       fieldValueAssign<TransactDetailField>(SOFT_INSTALL);
       return true;
@@ -586,8 +586,8 @@ namespace zypp
     bool setToBeUninstalledSoft ( )
     {
       if (!isInstalled()
-         || !setSoftTransact (true, SOLVER))
-         return false;
+          || !setSoftTransact (true, SOLVER))
+          return false;
 
       fieldValueAssign<TransactDetailField>(SOFT_REMOVE);
       return true;
@@ -595,10 +595,10 @@ namespace zypp
 
     bool maySetToBeUninstalledSoft ()
     {
-       bit::BitField<FieldType> savBitfield = _bitfield;
-       bool ret = setToBeUninstalledSoft ();
-       _bitfield = savBitfield;
-       return ret;
+        bit::BitField<FieldType> savBitfield = _bitfield;
+        bool ret = setToBeUninstalledSoft ();
+        _bitfield = savBitfield;
+        return ret;
     }
 
     bool isSoftInstall () {
@@ -611,12 +611,12 @@ namespace zypp
 
     bool setSoftInstall (bool flag) {
         fieldValueAssign<TransactDetailField>(flag?SOFT_INSTALL:0);
-       return true;
+        return true;
     }
 
     bool setSoftUninstall (bool flag) {
         fieldValueAssign<TransactDetailField>(flag?SOFT_REMOVE:0);
-       return true;
+        return true;
     }
 
     bool setUndetermined ()
index e17b8da..fc74d0e 100644 (file)
@@ -137,9 +137,9 @@ namespace zypp
     if ( lhs != rhs )
     {
       if ( lhs && rhs )
-       ret = compareByN( *lhs, *rhs );
+        ret = compareByN( *lhs, *rhs );
       else
-       ret = lhs ? 1 : -1;
+        ret = lhs ? 1 : -1;
     }
     return ret;
   }
@@ -151,9 +151,9 @@ namespace zypp
     if ( lhs != rhs )
     {
       if ( lhs && rhs )
-       ret = compareByNVR( *lhs, *rhs );
+        ret = compareByNVR( *lhs, *rhs );
       else
-       ret = lhs ? 1 : -1;
+        ret = lhs ? 1 : -1;
     }
     return ret;
   }
@@ -165,9 +165,9 @@ namespace zypp
     if ( lhs != rhs )
     {
       if ( lhs && rhs )
-       ret = compareByNVRA( *lhs, *rhs );
+        ret = compareByNVRA( *lhs, *rhs );
       else
-       ret = lhs ? 1 : -1;
+        ret = lhs ? 1 : -1;
     }
     return ret;
   }
index a86e643..36a87fc 100644 (file)
@@ -43,28 +43,28 @@ namespace zypp
 #define OUTS(V) if ( ::strcasecmp( val_r.c_str(), #V ) == 0 ) { ret_r = ResolverFocus::V; return true; }
       case 'D':
       case 'd':
-       OUTS( Default );
-       break;
+        OUTS( Default );
+        break;
 
       case 'J':
       case 'j':
-       OUTS( Job );
-       break;
+        OUTS( Job );
+        break;
 
       case 'I':
       case 'i':
-       OUTS( Installed );
-       break;
+        OUTS( Installed );
+        break;
 
       case 'U':
       case 'u':
-       OUTS( Update );
-       break;
+        OUTS( Update );
+        break;
 
       case '\0':
-       ret_r = ResolverFocus::Default;
-       return true;
-       break;
+        ret_r = ResolverFocus::Default;
+        return true;
+        break;
 #undef OUTS
     }
     // Oops!
index 1430247..408ec1c 100644 (file)
@@ -42,10 +42,10 @@ namespace zypp
     {
       for ( const ProblemSolution_Ptr & solution : solutions_r )
       {
-       if ( solution->description()    == solution_r->description()
-         && solution->details()        == solution_r->details()
-         && solution->actions().size() == solution_r->actions().size() )
-         return true;
+        if ( solution->description()   == solution_r->description()
+          && solution->details()       == solution_r->details()
+          && solution->actions().size()        == solution_r->actions().size() )
+          return true;
       }
       return false;
     }
index dc7684a..a98641c 100644 (file)
@@ -165,9 +165,9 @@ namespace zypp
   std::ostream & operator<<( std::ostream & str, const ServiceInfo::RepoState & obj )
   {
     return str
-       << "enabled=" << obj.enabled << " "
-       << "autorefresh=" << obj.autorefresh << " "
-       << "priority=" << obj.priority;
+        << "enabled=" << obj.enabled << " "
+        << "autorefresh=" << obj.autorefresh << " "
+        << "priority=" << obj.priority;
   }
 
   std::ostream & ServiceInfo::dumpAsIniOn( std::ostream & str ) const
@@ -187,16 +187,16 @@ namespace zypp
       unsigned cnt = 0U;
       for ( const auto & el : repoStates() )
       {
-       std::string tag( "repo_" );
-       tag += str::numstring( ++cnt );
-       const RepoState & state( el.second );
-
-       str << tag << "=" << el.first << endl
-           << tag << "_enabled=" << state.enabled << endl
-           << tag << "_autorefresh=" << state.autorefresh << endl;
-       if ( state.priority != RepoInfo::defaultPriority() )
-         str
-           << tag << "_priority=" << state.priority << endl;
+        std::string tag( "repo_" );
+        tag += str::numstring( ++cnt );
+        const RepoState & state( el.second );
+
+        str << tag << "=" << el.first << endl
+            << tag << "_enabled=" << state.enabled << endl
+            << tag << "_autorefresh=" << state.autorefresh << endl;
+        if ( state.priority != RepoInfo::defaultPriority() )
+          str
+            << tag << "_priority=" << state.priority << endl;
       }
     }
 
index fe589ca..b7f9a1b 100644 (file)
@@ -171,10 +171,10 @@ namespace zypp
       unsigned priority;
 
       RepoState()
-       : enabled( false ), autorefresh( true ), priority( RepoInfo::defaultPriority() )
+        : enabled( false ), autorefresh( true ), priority( RepoInfo::defaultPriority() )
       {}
       RepoState( const RepoInfo & repo_r )
-       : enabled( repo_r.enabled() ), autorefresh( repo_r.autorefresh() ), priority( repo_r.priority() )
+        : enabled( repo_r.enabled() ), autorefresh( repo_r.autorefresh() ), priority( repo_r.priority() )
       {}
       bool operator==( const RepoState & rhs ) const
       { return( enabled==rhs.enabled && autorefresh==rhs.autorefresh && priority==rhs.priority ); }
index 18cafd4..f2a26b6 100644 (file)
@@ -17,14 +17,14 @@ namespace zypp
 
   Signature::Signature()
   {
-      
+
   }
-    
+
   std::ostream & Signature::dumpOn( std::ostream & str ) const
   {
     return str;
   }
-  
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index a3d00fb..3db2274 100644 (file)
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  
+
   class Signature
   {
     public:
     Signature();
     ~Signature();
-    
+
     /** Overload to realize stream output. */
     std::ostream & dumpOn( std::ostream & str ) const;
-    
+
     private:
-  };  
-  
+  };
+
   /** \relates Signature Stream output */
   inline std::ostream & operator<<( std::ostream & str, const Signature & obj )
-  { return obj.dumpOn( str ); }  
-  
+  { return obj.dumpOn( str ); }
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index acaf9bc..5866d17 100644 (file)
@@ -69,7 +69,7 @@ namespace zypp
 
   void Target::reload()
   { _pimpl->reload(); }
-  
+
   void Target::unload()
   { _pimpl->unload(); }
 
index a4c2c87..6da25b4 100644 (file)
@@ -72,7 +72,7 @@ namespace zypp
     void load();
 
     void reload();
-    
+
     /**
      * unload target resolvables from the
      * pool
index 436cb7d..08736a8 100644 (file)
@@ -100,16 +100,16 @@ namespace zypp
       /** Whether \a key_r is in \ref data and value is not empty. */
       bool hasvalue( const std::string & key_r ) const
       {
-       bool ret = false;
-       if ( _dataP )
-       {
-         const_iterator it = _dataP->find( key_r );
-         if ( it != _dataP->end() && ! it->second.empty() )
-         {
-           ret = true;
-         }
-       }
-       return ret;
+        bool ret = false;
+        if ( _dataP )
+        {
+          const_iterator it = _dataP->find( key_r );
+          if ( it != _dataP->end() && ! it->second.empty() )
+          {
+            ret = true;
+          }
+        }
+        return ret;
       }
 
       /** Set the value for key (nonconst version always returns true).
@@ -120,14 +120,14 @@ namespace zypp
       /** \overload const version */
       bool set( const std::string & key_r, AnyType val_r ) const
       {
-       bool ret = false;
-       AnyType & val( dataRef()[key_r] );
-       if ( val.empty() )
-       {
-         val = std::move(val_r);
-         ret = true;
-       }
-       return ret;
+        bool ret = false;
+        AnyType & val( dataRef()[key_r] );
+        if ( val.empty() )
+        {
+          val = std::move(val_r);
+          ret = true;
+        }
+        return ret;
       }
 
       /** Set an empty value for \a key_r (if possible). */
@@ -144,16 +144,16 @@ namespace zypp
       /** \ref get helper returning the keys AnyType value or an empty value if key does not exist. */
       const AnyType & getvalue( const std::string & key_r ) const
       {
-       if ( _dataP )
-       {
-         const_iterator it = _dataP->find( key_r );
-         if ( it != _dataP->end() )
-         {
-           return it->second;
-         }
-       }
-       static const AnyType none;
-       return none;
+        if ( _dataP )
+        {
+          const_iterator it = _dataP->find( key_r );
+          if ( it != _dataP->end() )
+          {
+            return it->second;
+          }
+        }
+        static const AnyType none;
+        return none;
       }
 
       /** Pass back a <tt>const Tp &</tt> reference to \a key_r value.
@@ -199,21 +199,21 @@ namespace zypp
       template <class Tp>
       bool get( const std::string & key_r, Tp & ret_r ) const
       {
-       bool ret = false;
-       if ( _dataP )
-       {
-         const_iterator it = _dataP->find( key_r );
-         if ( it != _dataP->end() )
-         {
-           auto ptr = boost::any_cast<const Tp>(&it->second);
-           if ( ptr )
-           {
-             ret_r = *ptr;
-             ret = true;
-           }
-         }
-       }
-       return ret;
+        bool ret = false;
+        if ( _dataP )
+        {
+          const_iterator it = _dataP->find( key_r );
+          if ( it != _dataP->end() )
+          {
+            auto ptr = boost::any_cast<const Tp>(&it->second);
+            if ( ptr )
+            {
+              ret_r = *ptr;
+              ret = true;
+            }
+          }
+        }
+        return ret;
       }
 
     private:
index 6454f01..5c1a7eb 100644 (file)
@@ -62,14 +62,14 @@ namespace zypp
     bool relaxedEquivalent( IdString lVendor, IdString rVendor ) const
     {
       if ( equivalent( lVendor, rVendor ) )
-       return true;
+        return true;
 
       static const IdString suse { "suse" };
       static const IdString opensuse { "opensuse" };
       unsigned sid = vendorMatchId( suse );
       unsigned oid = vendorMatchId( opensuse );
       if ( sid == oid )
-       return false; // (suse/opensuse) are equivalent, so these are not
+        return false; // (suse/opensuse) are equivalent, so these are not
 
       auto isSuse = [sid,oid]( unsigned v )-> bool { return v==sid || v==oid; };
       return isSuse( vendorMatchId(lVendor) ) && isSuse( vendorMatchId(rVendor) );
@@ -79,16 +79,16 @@ namespace zypp
     {
       std::map<unsigned,VendorList> lists;
       for( const auto & el : _vendorGroupMap )
-       lists[el.second].push_back( el.first );
+        lists[el.second].push_back( el.first );
 
       unsigned ret = 0;
       for ( auto el : lists ) {
-       VendorList & vlist { el.second };
-       if ( vlist.empty() )
-         continue;
-       ++ret;
-       if ( fnc_r && !fnc_r( std::move(vlist) ) )
-         break;
+        VendorList & vlist { el.second };
+        if ( vlist.empty() )
+          continue;
+        ++ret;
+        if ( fnc_r && !fnc_r( std::move(vlist) ) )
+          break;
       }
       return ret;
     }
@@ -136,36 +136,36 @@ namespace zypp
       VendorMatchEntry & lcent( _vendorMatch[lcvendor] );
       if ( ! lcent )
       {
-       // Cache miss - check whether it belongs to a vendor group.
-       // Otherwise assign a new class ID to it.
-       unsigned myid = 0;
-
-       // bnc#812608: no prefix compare in opensuse namespace
-       if ( str::hasPrefix( lcvendor.c_str(), "opensuse" ) )
-       {
-         if ( auto it = _vendorGroupMap.find( lcvendor.c_str() ); it != _vendorGroupMap.end() )
-           myid = it->second;
-       }
-       else
-       {
-         // Compare this entry with the global vendor map.
-         // Reversed to get the longest prefix.
-         for ( VendorGroupMap::const_reverse_iterator it = _vendorGroupMap.rbegin(); it != _vendorGroupMap.rend(); ++it )
-         {
-           if ( str::hasPrefix( lcvendor.c_str(), it->first ) ) {
-             myid = it->second;
-             break; // found
-           }
-         }
-       }
-
-       if ( ! myid )
-         myid = --_nextId; // get a new class ID
-
-       ent = lcent = myid; // remember the new DI
+        // Cache miss - check whether it belongs to a vendor group.
+        // Otherwise assign a new class ID to it.
+        unsigned myid = 0;
+
+        // bnc#812608: no prefix compare in opensuse namespace
+        if ( str::hasPrefix( lcvendor.c_str(), "opensuse" ) )
+        {
+          if ( auto it = _vendorGroupMap.find( lcvendor.c_str() ); it != _vendorGroupMap.end() )
+            myid = it->second;
+        }
+        else
+        {
+          // Compare this entry with the global vendor map.
+          // Reversed to get the longest prefix.
+          for ( VendorGroupMap::const_reverse_iterator it = _vendorGroupMap.rbegin(); it != _vendorGroupMap.rend(); ++it )
+          {
+            if ( str::hasPrefix( lcvendor.c_str(), it->first ) ) {
+              myid = it->second;
+              break; // found
+            }
+          }
+        }
+
+        if ( ! myid )
+          myid = --_nextId; // get a new class ID
+
+        ent = lcent = myid; // remember the new DI
       }
       else
-       ent = lcent; // take the ID from the lowercased vendor string
+        ent = lcent; // take the ID from the lowercased vendor string
     }
     return ent;
   }
@@ -183,25 +183,25 @@ namespace zypp
 
       if ( _vendorGroupMap.count( vendor ) )
       {
-       unsigned joinId = _vendorGroupMap[vendor];
-       if ( targetId == _vendorGroupId + 1 ) {
-         targetId = joinId;    // will extend the existing group
-       }
-       else if ( targetId != joinId ) {
-         // yet another existing group -> join it into the target group
-         for ( auto & el : _vendorGroupMap ) {
-           if ( el.second == joinId )
-             el.second = targetId;
-         }
-       }
-       vendor.clear(); // no need to add it later
+        unsigned joinId = _vendorGroupMap[vendor];
+        if ( targetId == _vendorGroupId + 1 ) {
+          targetId = joinId;   // will extend the existing group
+        }
+        else if ( targetId != joinId ) {
+          // yet another existing group -> join it into the target group
+          for ( auto & el : _vendorGroupMap ) {
+            if ( el.second == joinId )
+              el.second = targetId;
+          }
+        }
+        vendor.clear();        // no need to add it later
       }
     }
 
     // Now add the new entries
     for ( std::string & vendor : vendorList_r ) {
       if ( ! vendor.empty() )
-       _vendorGroupMap[vendor] = targetId;
+        _vendorGroupMap[vendor] = targetId;
     }
 
     if ( targetId == _vendorGroupId + 1 )
@@ -263,11 +263,11 @@ namespace zypp
     }
 
     filesystem::dirForEach( dirname_r, filesystem::matchNoDots(),
-                           [this]( const Pathname & dir_r, const std::string & str_r )->bool
-                           {
-                             this->addVendorFile( dir_r/str_r );
-                             return true;
-                           }
+                            [this]( const Pathname & dir_r, const std::string & str_r )->bool
+                            {
+                              this->addVendorFile( dir_r/str_r );
+                              return true;
+                            }
     );
     return true;
   }
@@ -284,14 +284,14 @@ namespace zypp
     {
       if ( el.first == "vendors" )
       {
-       VendorList tmp;
-       strv::split( el.second, ",", strv::Trim::trim,
-                    [&tmp]( std::string_view word ) {
-                      if ( ! word.empty() )
-                        tmp.push_back( std::string(word) );
-                    } );
-       _addVendorList( std::move(tmp) );
-       break;
+        VendorList tmp;
+        strv::split( el.second, ",", strv::Trim::trim,
+                     [&tmp]( std::string_view word ) {
+                       if ( ! word.empty() )
+                         tmp.push_back( std::string(word) );
+                     } );
+        _addVendorList( std::move(tmp) );
+        break;
       }
     }
     return true;
index 8509ea6..eceb4bc 100644 (file)
@@ -116,7 +116,7 @@ class VendorAttr
     {
       VendorList tmp;
       for ( const auto & el : container_r )
-       tmp.push_back( std::string(el) );
+        tmp.push_back( std::string(el) );
       _addVendorList( std::move(tmp) );
     }
     /** \overload from std::initializer_list */
@@ -125,7 +125,7 @@ class VendorAttr
     {
       VendorList tmp;
       for ( const auto & el : container_r )
-       tmp.push_back( std::string(el) );
+        tmp.push_back( std::string(el) );
       _addVendorList( std::move(tmp) );
     }
 
index 2dd36cd..0b78bf6 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace zypp
 {
-    
+
 std::string
 asUserString( VendorSupportOption opt )
 {
@@ -15,7 +15,7 @@ asUserString( VendorSupportOption opt )
         break;
     case VendorSupportUnsupported:
         return _("unsupported");
-        break;        
+        break;
     case VendorSupportLevel1:
         return _("Level 1");
         break;
@@ -30,7 +30,7 @@ asUserString( VendorSupportOption opt )
     }
     return _("invalid");
 }
-    
+
 std::string asUserStringDescription( VendorSupportOption opt )
 {
     switch (opt)
@@ -40,7 +40,7 @@ std::string asUserStringDescription( VendorSupportOption opt )
         break;
     case VendorSupportUnsupported:
         return _("The vendor does not provide support.");
-        break;        
+        break;
     case VendorSupportLevel1:
         return _("Problem determination, which means technical support designed to provide compatibility information, installation assistance, usage support, on-going maintenance and basic troubleshooting. Level 1 Support is not intended to correct product defect errors.");
         break;
@@ -55,7 +55,7 @@ std::string asUserStringDescription( VendorSupportOption opt )
     }
     return _("Unknown support option. Description not available");
 }
-    
+
 }
 
 
index 1aba37a..4343346 100644 (file)
@@ -74,9 +74,9 @@ namespace zypp
 
       if ( architecture == Arch_i686 )
       {
-       // some CPUs report i686 but dont implement cx8 and cmov
-       // check for both flags in /proc/cpuinfo and downgrade
-       // to i586 if either is missing (cf bug #18885)
+        // some CPUs report i686 but dont implement cx8 and cmov
+        // check for both flags in /proc/cpuinfo and downgrade
+        // to i586 if either is missing (cf bug #18885)
         std::ifstream cpuinfo( "/proc/cpuinfo" );
         if ( cpuinfo )
         {
@@ -101,8 +101,8 @@ namespace zypp
       }
       else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
       {
-       // Check for sun4[vum] to get the real arch. (bug #566291)
-       std::ifstream cpuinfo( "/proc/cpuinfo" );
+        // Check for sun4[vum] to get the real arch. (bug #566291)
+        std::ifstream cpuinfo( "/proc/cpuinfo" );
         if ( cpuinfo )
         {
           for( iostr::EachLine in( cpuinfo ); in; in.next() )
@@ -135,33 +135,33 @@ namespace zypp
       }
       else if ( architecture == Arch_armv7l || architecture == Arch_armv6l )
       {
-       std::ifstream platform( "/etc/rpm/platform" );
-       if (platform)
-       {
-         for( iostr::EachLine in( platform ); in; in.next() )
-         {
-           if ( str::hasPrefix( *in, "armv7hl-" ) )
-           {
-             architecture = Arch_armv7hl;
-             WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl;
-             break;
-           }
-           if ( str::hasPrefix( *in, "armv6hl-" ) )
-           {
-             architecture = Arch_armv6hl;
-             WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl;
-             break;
-           }
-         }
-       }
+        std::ifstream platform( "/etc/rpm/platform" );
+        if (platform)
+        {
+          for( iostr::EachLine in( platform ); in; in.next() )
+          {
+            if ( str::hasPrefix( *in, "armv7hl-" ) )
+            {
+              architecture = Arch_armv7hl;
+              WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl;
+              break;
+            }
+            if ( str::hasPrefix( *in, "armv6hl-" ) )
+            {
+              architecture = Arch_armv6hl;
+              WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl;
+              break;
+            }
+          }
+        }
       }
 #if __GLIBC_PREREQ (2,16)
       else if ( architecture == Arch_ppc64 )
       {
-       const char * platform = (const char *)getauxval( AT_PLATFORM );
-       int powerlvl;
-       if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 )
-         architecture = Arch_ppc64p7;
+        const char * platform = (const char *)getauxval( AT_PLATFORM );
+        int powerlvl;
+        if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 )
+          architecture = Arch_ppc64p7;
       }
 #endif
       return architecture;
@@ -233,65 +233,65 @@ namespace zypp
   template<class Tp>
       struct Option
       {
-       typedef Tp value_type;
+        typedef Tp value_type;
 
-       /** No default ctor, explicit initialisation! */
-       Option( value_type initial_r )
-         : _val( std::move(initial_r) )
-       {}
+        /** No default ctor, explicit initialisation! */
+        Option( value_type initial_r )
+          : _val( std::move(initial_r) )
+        {}
 
-       Option & operator=( value_type newval_r )
-       { set( std::move(newval_r) ); return *this; }
+        Option & operator=( value_type newval_r )
+        { set( std::move(newval_r) ); return *this; }
 
-       /** Get the value.  */
-       const value_type & get() const
-       { return _val; }
+        /** Get the value.  */
+        const value_type & get() const
+        { return _val; }
 
         /** Autoconversion to value_type.  */
         operator const value_type &() const
         { return _val; }
 
-       /** Set a new value.  */
-       void set( value_type newval_r )
-       { _val = std::move(newval_r); }
+        /** Set a new value.  */
+        void set( value_type newval_r )
+        { _val = std::move(newval_r); }
 
-       private:
-         value_type _val;
+        private:
+          value_type _val;
       };
 
   /** Mutable option with initial value also remembering a config value. */
   template<class Tp>
       struct DefaultOption : public Option<Tp>
       {
-       typedef Tp         value_type;
-       typedef Option<Tp> option_type;
+        typedef Tp         value_type;
+        typedef Option<Tp> option_type;
 
-       explicit DefaultOption( value_type initial_r )
-       : Option<Tp>( initial_r )
-       , _default( std::move(initial_r) )
-       {}
+        explicit DefaultOption( value_type initial_r )
+        : Option<Tp>( initial_r )
+        , _default( std::move(initial_r) )
+        {}
 
-       DefaultOption & operator=( value_type newval_r )
-       { this->set( std::move(newval_r) ); return *this; }
+        DefaultOption & operator=( value_type newval_r )
+        { this->set( std::move(newval_r) ); return *this; }
 
-       /** Reset value to the current default. */
-       void restoreToDefault()
-       { this->set( _default.get() ); }
+        /** Reset value to the current default. */
+        void restoreToDefault()
+        { this->set( _default.get() ); }
 
-       /** Reset value to a new default. */
-       void restoreToDefault( value_type newval_r )
-       { setDefault( std::move(newval_r) ); restoreToDefault(); }
+        /** Reset value to a new default. */
+        void restoreToDefault( value_type newval_r )
+        { setDefault( std::move(newval_r) ); restoreToDefault(); }
 
-       /** Get the current default value. */
-       const value_type & getDefault() const
-       { return _default.get(); }
+        /** Get the current default value. */
+        const value_type & getDefault() const
+        { return _default.get(); }
 
-       /** Set a new default value. */
-       void setDefault( value_type newval_r )
-       { _default.set( std::move(newval_r) ); }
+        /** Set a new default value. */
+        void setDefault( value_type newval_r )
+        { _default.set( std::move(newval_r) ); }
 
-       private:
-         option_type _default;
+        private:
+          option_type _default;
       };
 
   ///////////////////////////////////////////////////////////////////
@@ -323,23 +323,23 @@ namespace zypp
         , download_use_deltarpm        ( true )
         , download_use_deltarpm_always  ( false )
         , download_media_prefer_download( true )
-       , download_mediaMountdir        ( "/var/adm/mount" )
+        , download_mediaMountdir       ( "/var/adm/mount" )
         , download_max_concurrent_connections( 5 )
         , download_min_download_speed  ( 0 )
         , download_max_download_speed  ( 0 )
         , download_max_silent_tries    ( 5 )
         , download_transfer_timeout    ( 180 )
         , commit_downloadMode          ( DownloadDefault )
-       , gpgCheck                      ( true )
-       , repoGpgCheck                  ( indeterminate )
-       , pkgGpgCheck                   ( indeterminate )
-       , solver_focus                  ( ResolverFocus::Default )
+        , gpgCheck                     ( true )
+        , repoGpgCheck                 ( indeterminate )
+        , pkgGpgCheck                  ( indeterminate )
+        , solver_focus                 ( ResolverFocus::Default )
         , solver_onlyRequires          ( false )
         , solver_allowVendorChange     ( false )
-       , solver_dupAllowDowngrade      ( true )
-       , solver_dupAllowNameChange     ( true )
-       , solver_dupAllowArchChange     ( true )
-       , solver_dupAllowVendorChange   ( true )
+        , solver_dupAllowDowngrade     ( true )
+        , solver_dupAllowNameChange    ( true )
+        , solver_dupAllowArchChange    ( true )
+        , solver_dupAllowVendorChange  ( true )
         , solver_cleandepsOnRemove     ( false )
         , solver_upgradeTestcasesToKeep        ( 2 )
         , solverUpgradeRemoveDroppedPackages( true )
@@ -430,16 +430,16 @@ namespace zypp
                   str::strtonum(value, repo_refresh_delay);
                 }
                 else if ( entry == "repo.refresh.locales" )
-               {
-                 std::vector<std::string> tmp;
-                 str::split( value, back_inserter( tmp ), ", \t" );
-
-                 boost::function<Locale(const std::string &)> transform(
-                   [](const std::string & str_r)->Locale{ return Locale(str_r); }
-                 );
-                 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
-                                            make_transform_iterator( tmp.end(), transform ) );
-               }
+                {
+                  std::vector<std::string> tmp;
+                  str::split( value, back_inserter( tmp ), ", \t" );
+
+                  boost::function<Locale(const std::string &)> transform(
+                    [](const std::string & str_r)->Locale{ return Locale(str_r); }
+                  );
+                  repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
+                                             make_transform_iterator( tmp.end(), transform ) );
+                }
                 else if ( entry == "download.use_deltarpm" )
                 {
                   download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
@@ -448,14 +448,14 @@ namespace zypp
                 {
                   download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
                 }
-               else if ( entry == "download.media_preference" )
+                else if ( entry == "download.media_preference" )
                 {
-                 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
+                  download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
                 }
 
-               else if ( entry == "download.media_mountdir" )
+                else if ( entry == "download.media_mountdir" )
                 {
-                 download_mediaMountdir.restoreToDefault( Pathname(value) );
+                  download_mediaMountdir.restoreToDefault( Pathname(value) );
                 }
 
                 else if ( entry == "download.max_concurrent_connections" )
@@ -477,25 +477,25 @@ namespace zypp
                 else if ( entry == "download.transfer_timeout" )
                 {
                   str::strtonum(value, download_transfer_timeout);
-                 if ( download_transfer_timeout < 0 )          download_transfer_timeout = 0;
-                 else if ( download_transfer_timeout > 3600 )  download_transfer_timeout = 3600;
+                  if ( download_transfer_timeout < 0 )         download_transfer_timeout = 0;
+                  else if ( download_transfer_timeout > 3600 ) download_transfer_timeout = 3600;
                 }
                 else if ( entry == "commit.downloadMode" )
                 {
                   commit_downloadMode.set( deserializeDownloadMode( value ) );
                 }
                 else if ( entry == "gpgcheck" )
-               {
-                 gpgCheck.restoreToDefault( str::strToBool( value, gpgCheck ) );
-               }
-               else if ( entry == "repo_gpgcheck" )
-               {
-                 repoGpgCheck.restoreToDefault( str::strToTriBool( value ) );
-               }
-               else if ( entry == "pkg_gpgcheck" )
-               {
-                 pkgGpgCheck.restoreToDefault( str::strToTriBool( value ) );
-               }
+                {
+                  gpgCheck.restoreToDefault( str::strToBool( value, gpgCheck ) );
+                }
+                else if ( entry == "repo_gpgcheck" )
+                {
+                  repoGpgCheck.restoreToDefault( str::strToTriBool( value ) );
+                }
+                else if ( entry == "pkg_gpgcheck" )
+                {
+                  pkgGpgCheck.restoreToDefault( str::strToTriBool( value ) );
+                }
                 else if ( entry == "vendordir" )
                 {
                   cfg_vendor_path = Pathname(value);
@@ -510,7 +510,7 @@ namespace zypp
                 }
                 else if ( entry == "solver.focus" )
                 {
-                 fromString( value, solver_focus );
+                  fromString( value, solver_focus );
                 }
                 else if ( entry == "solver.onlyRequires" )
                 {
@@ -521,21 +521,21 @@ namespace zypp
                   solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
                 }
                 else if ( entry == "solver.dupAllowDowngrade" )
-               {
-                 solver_dupAllowDowngrade.set( str::strToBool( value, solver_dupAllowDowngrade ) );
-               }
-               else if ( entry == "solver.dupAllowNameChange" )
-               {
-                 solver_dupAllowNameChange.set( str::strToBool( value, solver_dupAllowNameChange ) );
-               }
-               else if ( entry == "solver.dupAllowArchChange" )
-               {
-                 solver_dupAllowArchChange.set( str::strToBool( value, solver_dupAllowArchChange ) );
-               }
-               else if ( entry == "solver.dupAllowVendorChange" )
-               {
-                 solver_dupAllowVendorChange.set( str::strToBool( value, solver_dupAllowVendorChange ) );
-               }
+                {
+                  solver_dupAllowDowngrade.set( str::strToBool( value, solver_dupAllowDowngrade ) );
+                }
+                else if ( entry == "solver.dupAllowNameChange" )
+                {
+                  solver_dupAllowNameChange.set( str::strToBool( value, solver_dupAllowNameChange ) );
+                }
+                else if ( entry == "solver.dupAllowArchChange" )
+                {
+                  solver_dupAllowArchChange.set( str::strToBool( value, solver_dupAllowArchChange ) );
+                }
+                else if ( entry == "solver.dupAllowVendorChange" )
+                {
+                  solver_dupAllowVendorChange.set( str::strToBool( value, solver_dupAllowVendorChange ) );
+                }
                 else if ( entry == "solver.cleandepsOnRemove" )
                 {
                   solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
@@ -558,7 +558,7 @@ namespace zypp
                 }
                 else if ( entry == "multiversion" )
                 {
-                 MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
+                  MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
                   str::splitEscaped( value, std::inserter( defSpec, defSpec.end() ), ", \t" );
                 }
                 else if ( entry == "locksfile.path" )
@@ -603,15 +603,15 @@ namespace zypp
                   credentials_global_file_path = Pathname(value);
                 }
                 else if ( entry == "techpreview.ZYPP_SINGLE_RPMTRANS" )
-               {
-                 DBG << "techpreview.ZYPP_SINGLE_RPMTRANS=" << value << endl;
-                 ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 1 );
-               }
+                {
+                  DBG << "techpreview.ZYPP_SINGLE_RPMTRANS=" << value << endl;
+                  ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 1 );
+                }
                 else if ( entry == "techpreview.ZYPP_MEDIANETWORK" )
-               {
-                 DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
-                 ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
-               }
+                {
+                  DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
+                  ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
+                }
               }
             }
           }
@@ -731,26 +731,26 @@ namespace zypp
 
       MultiversionSpec & getSpec( Pathname root_r, const Impl & zConfImpl_r )  // from system at root
       {
-       // _specMap[]     - the plain zypp.conf value
-       // _specMap[/]    - combine [] and multiversion.d scan
-       // _specMap[root] - scan root/zypp.conf and root/multiversion.d
-
-       if ( root_r.empty() )
-         root_r = "/";
-       bool cacheHit = _specMap.count( root_r );
-       MultiversionSpec & ret( _specMap[root_r] );     // creates new entry on the fly
-
-       if ( ! cacheHit )
-       {
-         if ( root_r == "/" )
-           ret.swap( _specMap[Pathname()] );           // original zypp.conf
-         else
-           scanConfAt( root_r, ret, zConfImpl_r );     // scan zypp.conf at root_r
-         scanDirAt( root_r, ret, zConfImpl_r );        // add multiversion.d at root_r
-         using zypp::operator<<;
-         MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
-       }
-       return ret;
+        // _specMap[]     - the plain zypp.conf value
+        // _specMap[/]    - combine [] and multiversion.d scan
+        // _specMap[root] - scan root/zypp.conf and root/multiversion.d
+
+        if ( root_r.empty() )
+          root_r = "/";
+        bool cacheHit = _specMap.count( root_r );
+        MultiversionSpec & ret( _specMap[root_r] );    // creates new entry on the fly
+
+        if ( ! cacheHit )
+        {
+          if ( root_r == "/" )
+            ret.swap( _specMap[Pathname()] );          // original zypp.conf
+          else
+            scanConfAt( root_r, ret, zConfImpl_r );    // scan zypp.conf at root_r
+          scanDirAt( root_r, ret, zConfImpl_r );       // add multiversion.d at root_r
+          using zypp::operator<<;
+          MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
+        }
+        return ret;
       }
 
       MultiversionSpec & getDefaultSpec()      // Spec from zypp.conf parsing; called before any getSpec
@@ -759,42 +759,42 @@ namespace zypp
     private:
       void scanConfAt( const Pathname root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
       {
-       static const str::regex rx( "^multiversion *= *(.*)" );
-       str::smatch what;
-       iostr::simpleParseFile( InputStream( Pathname::assertprefix( root_r, _autodetectZyppConfPath() ) ),
-                               [&]( int num_r, std::string line_r )->bool
-                               {
-                                 if ( line_r[0] == 'm' && str::regex_match( line_r, what, rx ) )
-                                 {
-                                   str::splitEscaped( what[1], std::inserter( spec_r, spec_r.end() ), ", \t" );
-                                   return false;       // stop after match
-                                 }
-                                 return true;
-                               } );
+        static const str::regex rx( "^multiversion *= *(.*)" );
+        str::smatch what;
+        iostr::simpleParseFile( InputStream( Pathname::assertprefix( root_r, _autodetectZyppConfPath() ) ),
+                                [&]( int num_r, std::string line_r )->bool
+                                {
+                                  if ( line_r[0] == 'm' && str::regex_match( line_r, what, rx ) )
+                                  {
+                                    str::splitEscaped( what[1], std::inserter( spec_r, spec_r.end() ), ", \t" );
+                                    return false;      // stop after match
+                                  }
+                                  return true;
+                                } );
       }
 
       void scanDirAt( const Pathname root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
       {
-       // NOTE:  Actually we'd need to scan and use the root_r! zypp.conf values.
-       Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
-       if ( multiversionDir.empty() )
-         multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
-                           ? Pathname("/etc/zypp")
-                           : zConfImpl_r.cfg_config_path ) / "multiversion.d";
-
-       filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
-                               [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
-                               {
-                                 MIL << "Parsing " << dir_r/name_r << endl;
-                                 iostr::simpleParseFile( InputStream( dir_r/name_r ),
-                                                         [&spec_r]( int num_r, std::string line_r )->bool
-                                                         {
-                                                           DBG << "  found " << line_r << endl;
-                                                           spec_r.insert( std::move(line_r) );
-                                                           return true;
-                                                         } );
-                                 return true;
-                               } );
+        // NOTE:  Actually we'd need to scan and use the root_r! zypp.conf values.
+        Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
+        if ( multiversionDir.empty() )
+          multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
+                            ? Pathname("/etc/zypp")
+                            : zConfImpl_r.cfg_config_path ) / "multiversion.d";
+
+        filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
+                                [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
+                                {
+                                  MIL << "Parsing " << dir_r/name_r << endl;
+                                  iostr::simpleParseFile( InputStream( dir_r/name_r ),
+                                                          [&spec_r]( int num_r, std::string line_r )->bool
+                                                          {
+                                                            DBG << "  found " << line_r << endl;
+                                                            spec_r.insert( std::move(line_r) );
+                                                            return true;
+                                                          } );
+                                  return true;
+                                } );
       }
 
     private:
@@ -917,8 +917,8 @@ namespace zypp
     {
       if ( *ch < ' ' && *ch != '\t' )
       {
-       ERR << "New user data string rejectded: char " << (int)*ch << " at position " <<  (ch - str_r.begin()) << endl;
-       return false;
+        ERR << "New user data string rejectded: char " << (int)*ch << " at position " <<  (ch - str_r.begin()) << endl;
+        return false;
       }
     }
     MIL << "Set user data string to '" << str_r << "'" << endl;
index be07039..e2ecfc7 100644 (file)
@@ -161,8 +161,8 @@ namespace zypp
 
       virtual Action problem(
         Resolvable::constPtr /*resolvable_ptr*/
-       , Error /*error*/
-       , const std::string &/*description*/
+        , Error /*error*/
+        , const std::string &/*description*/
       ) { return ABORT; }
 
 
@@ -384,14 +384,14 @@ namespace zypp
 
         virtual Action problem(
           const Url &/*file*/
-         , Error /*error*/
-         , const std::string &/*description*/
+          , Error /*error*/
+          , const std::string &/*description*/
         ) { return ABORT; }
 
         virtual void finish(
           const Url &/*file*/
           , Error /*error*/
-         , const std::string &/*reason*/
+          , const std::string &/*reason*/
         ) {}
     };
 
@@ -518,14 +518,14 @@ namespace zypp
         enum Action {
           ABORT,  // abort and return error
           RETRY,       // retry
-         IGNORE        // ignore the failure
+          IGNORE       // ignore the failure
         };
 
         enum Error {
-         NO_ERROR,
+          NO_ERROR,
           NOT_FOUND,   // the requested Url was not found
-         IO,           // IO error
-         INVALID               // th resolvable is invalid
+          IO,          // IO error
+          INVALID              // th resolvable is invalid
         };
 
         // the level of RPM pushing
@@ -537,7 +537,7 @@ namespace zypp
         };
 
         virtual void start(
-         Resolvable::constPtr /*resolvable*/
+          Resolvable::constPtr /*resolvable*/
         ) {}
 
         virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
@@ -545,25 +545,25 @@ namespace zypp
 
         virtual Action problem(
           Resolvable::constPtr /*resolvable*/
-         , Error /*error*/
-         , const std::string &/*description*/
-         , RpmLevel /*level*/
+          , Error /*error*/
+          , const std::string &/*description*/
+          , RpmLevel /*level*/
         ) { return ABORT; }
 
         virtual void finish(
           Resolvable::constPtr /*resolvable*/
           , Error /*error*/
-         , const std::string &/*reason*/
-         , RpmLevel /*level*/
+          , const std::string &/*reason*/
+          , RpmLevel /*level*/
         ) {}
 
         /** "rpmout/installpkg": Additional rpm output (sent immediately).
-        * Data:
-        * solvable : satSolvable processed
-        * line     : std::reference_wrapper<const std::string>
-        * lineno   : unsigned
-        */
-       static const UserData::ContentType contentRpmout;
+         * Data:
+         * solvable : satSolvable processed
+         * line     : std::reference_wrapper<const std::string>
+         * lineno   : unsigned
+         */
+        static const UserData::ContentType contentRpmout;
       };
 
       // progress for removing a resolvable
@@ -572,18 +572,18 @@ namespace zypp
         enum Action {
           ABORT,  // abort and return error
           RETRY,       // retry
-         IGNORE        // ignore the failure
+          IGNORE       // ignore the failure
         };
 
         enum Error {
-         NO_ERROR,
+          NO_ERROR,
           NOT_FOUND,   // the requested Url was not found
-         IO,           // IO error
-         INVALID               // th resolvable is invalid
+          IO,          // IO error
+          INVALID              // th resolvable is invalid
         };
 
         virtual void start(
-         Resolvable::constPtr /*resolvable*/
+          Resolvable::constPtr /*resolvable*/
         ) {}
 
         virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
@@ -591,19 +591,19 @@ namespace zypp
 
         virtual Action problem(
           Resolvable::constPtr /*resolvable*/
-         , Error /*error*/
-         , const std::string &/*description*/
+          , Error /*error*/
+          , const std::string &/*description*/
         ) { return ABORT; }
 
         virtual void finish(
           Resolvable::constPtr /*resolvable*/
           , Error /*error*/
-         , const std::string &/*reason*/
+          , const std::string &/*reason*/
         ) {}
 
         /** "rpmout/removepkg": Additional rpm output (sent immediately).
-        * For data \see \ref InstallResolvableReport::contentRpmout
-        */
+         * For data \see \ref InstallResolvableReport::contentRpmout
+         */
         static const UserData::ContentType contentRpmout;
       };
 
@@ -613,12 +613,12 @@ namespace zypp
         enum Action {
           ABORT,  // abort and return error
           RETRY,       // retry
-         IGNORE        // ignore the failure
+          IGNORE       // ignore the failure
         };
 
         enum Error {
-         NO_ERROR,
-         FAILED                // failed to rebuild
+          NO_ERROR,
+          FAILED               // failed to rebuild
         };
 
         virtual void start(Pathname /*path*/) {}
@@ -627,15 +627,15 @@ namespace zypp
         { return true; }
 
         virtual Action problem(
-         Pathname /*path*/
-        , Error /*error*/
-        , const std::string &/*description*/
+          Pathname /*path*/
+         , Error /*error*/
+         , const std::string &/*description*/
         ) { return ABORT; }
 
         virtual void finish(
-         Pathname /*path*/
+          Pathname /*path*/
           , Error /*error*/
-         , const std::string &/*reason*/
+          , const std::string &/*reason*/
         ) {}
       };
 
@@ -647,25 +647,25 @@ namespace zypp
         enum Action {
           ABORT,  // abort and return error
           RETRY,  // retry
-         IGNORE  // ignore the failure
+          IGNORE  // ignore the failure
         };
 
         enum Error {
-         NO_ERROR,
-         FAILED // conversion failed
+          NO_ERROR,
+          FAILED // conversion failed
         };
 
         virtual void start( Pathname /*path*/ )
-       {}
+        {}
 
         virtual bool progress( int/*value*/, Pathname/*path*/ )
         { return true; }
 
         virtual Action problem( Pathname/*path*/, Error/*error*/, const std::string &/*description*/ )
-       { return ABORT; }
+        { return ABORT; }
 
         virtual void finish( Pathname/*path*/, Error/*error*/, const std::string &/*reason*/ )
-       {}
+        {}
       };
 #endif
 
@@ -946,7 +946,7 @@ namespace zypp
      * When user unlock something which is locked by non-identical query
      */
     virtual Action conflict(
-        const PoolQuery&, /**< problematic query*/
+         const PoolQuery&, /**< problematic query*/
        ConflictState
      ) { return DELETE; }
 
index 964334b..73bb917 100644 (file)
@@ -42,24 +42,24 @@ namespace zypp
       // While the bug is not fixed, we don't allow ZYPP_SINGLE_RPMTRANS=1 on a not UsrMerged system.
       // I.e. if /lib is a directory and not a symlink.
       if ( ret && PathInfo( "/lib", PathInfo::LSTAT ).isDir() ) {
-       WAR << "Ignore $ZYPP_SINGLE_RPMTRANS=1: Bug 1189788 - UsrMerge: filesystem package breaks system when upgraded in a single rpm transaction" << std::endl;
-       JobReport::info(
-       "[boo#1189788] Tumbleweeds filesystem package seems to be unable to perform the\n"
-       "              UsrMerge reliably in a single transaction. The requested\n"
-       "              $ZYPP_SINGLE_RPMTRANS=1 will therefore be IGNORED because\n"
-       "              the UsrMerge did not yet happen on this system."
-       , JobReport::UserData( "cmdout", "[boo#1189788]" ) );
-       return false;
+        WAR << "Ignore $ZYPP_SINGLE_RPMTRANS=1: Bug 1189788 - UsrMerge: filesystem package breaks system when upgraded in a single rpm transaction" << std::endl;
+        JobReport::info(
+        "[boo#1189788] Tumbleweeds filesystem package seems to be unable to perform the\n"
+        "              UsrMerge reliably in a single transaction. The requested\n"
+        "              $ZYPP_SINGLE_RPMTRANS=1 will therefore be IGNORED because\n"
+        "              the UsrMerge did not yet happen on this system."
+        , JobReport::UserData( "cmdout", "[boo#1189788]" ) );
+        return false;
       }
 #endif
       if ( ret ) {
-       JobReport::info(
-         "[TechPreview] $ZYPP_SINGLE_RPMTRANS=1 : New rpm install backend is enabled\n"
-         "              If you find any bugs or issues please let us know:\n"
-         "              https://bugzilla.opensuse.org/\n"
-         "              Component: libzypp (or zypper)\n"
-         "              And please attach the /var/log/zypper.log to the bug report."
-       , JobReport::UserData( "cmdout" ) );
+        JobReport::info(
+          "[TechPreview] $ZYPP_SINGLE_RPMTRANS=1 : New rpm install backend is enabled\n"
+          "              If you find any bugs or issues please let us know:\n"
+          "              https://bugzilla.opensuse.org/\n"
+          "              Component: libzypp (or zypper)\n"
+          "              And please attach the /var/log/zypper.log to the bug report."
+        , JobReport::UserData( "cmdout" ) );
       }
       return ret;
 #endif // SINGLE_RPMTRANS_AS_DEFAULT_FOR_ZYPPER
index 6e5e711..04379df 100644 (file)
@@ -109,9 +109,9 @@ namespace zypp
       ++result[0];
       switch ( it->stepStage() )
       {
-       case sat::Transaction::STEP_DONE :      ++result[1]; break;
-       case sat::Transaction::STEP_ERROR :     ++result[2]; break;
-       case sat::Transaction::STEP_TODO :      ++result[3]; break;
+        case sat::Transaction::STEP_DONE :     ++result[1]; break;
+        case sat::Transaction::STEP_ERROR :    ++result[2]; break;
+        case sat::Transaction::STEP_TODO :     ++result[3]; break;
       }
     }
     str << "CommitResult "
index dc972b8..d66e540 100644 (file)
@@ -172,13 +172,13 @@ namespace zypp
        * \see \ref Transaction, \ref transaction()
        */
       //@{
-       /** Whether all steps were performed successfully (none skipped or error) */
-       bool allDone() const
-       { return transaction().actionEmpty( ~sat::Transaction::STEP_DONE ); }
+        /** Whether all steps were performed successfully (none skipped or error) */
+        bool allDone() const
+        { return transaction().actionEmpty( ~sat::Transaction::STEP_DONE ); }
 
-       /** Whether an error ocurred (skipped streps are ok). */
-       bool noError() const
-       { return transaction().actionEmpty( sat::Transaction::STEP_ERROR ); }
+        /** Whether an error ocurred (skipped streps are ok). */
+        bool noError() const
+        { return transaction().actionEmpty( sat::Transaction::STEP_ERROR ); }
       //@}
 
     public:
index a16f861..e992add 100644 (file)
@@ -108,19 +108,19 @@ namespace zypp
 
     ~ZYppGlobalLock()
     {
-       if ( _cleanLock )
-       try {
-         // Exception safe access to the lockfile.
-         ScopedGuard closeOnReturn( accessLockFile() );
-         {
-           scoped_lock<file_lock> flock( _zyppLockFileLock );  // aquire write lock
-           // Truncate the file rather than deleting it. Other processes may
-           // still use it to synchronsize.
-           ftruncate( fileno(_zyppLockFile), 0 );
-         }
-         MIL << "Cleaned lock file. (" << getpid() << ")" << std::endl;
-       }
-       catch(...) {} // let no exception escape.
+        if ( _cleanLock )
+        try {
+          // Exception safe access to the lockfile.
+          ScopedGuard closeOnReturn( accessLockFile() );
+          {
+            scoped_lock<file_lock> flock( _zyppLockFileLock ); // aquire write lock
+            // Truncate the file rather than deleting it. Other processes may
+            // still use it to synchronsize.
+            ftruncate( fileno(_zyppLockFile), 0 );
+          }
+          MIL << "Cleaned lock file. (" << getpid() << ")" << std::endl;
+        }
+        catch(...) {} // let no exception escape.
     }
 
     pid_t lockerPid() const
@@ -155,19 +155,19 @@ namespace zypp
     {
       _openLockFile();
       return ScopedGuard( static_cast<void*>(0),
-                         bind( mem_fun_ref( &ZYppGlobalLock::_closeLockFile ), ref(*this) ) );
+                          bind( mem_fun_ref( &ZYppGlobalLock::_closeLockFile ), ref(*this) ) );
     }
 
     /** Use \ref accessLockFile. */
     void _openLockFile()
     {
       if ( _zyppLockFile != NULL )
-       return; // is open
+        return;        // is open
 
       // open pid file rw so we are sure it exist when creating the flock
       _zyppLockFile = fopen( _zyppLockFilePath.c_str(), "a+" );
       if ( _zyppLockFile == NULL )
-       ZYPP_THROW( Exception( "Cant open " + _zyppLockFilePath.asString() ) );
+        ZYPP_THROW( Exception( "Cant open " + _zyppLockFilePath.asString() ) );
       _zyppLockFileLock = _zyppLockFilePath.c_str();
       MIL << "Open lockfile " << _zyppLockFilePath << endl;
     }
@@ -176,7 +176,7 @@ namespace zypp
     void _closeLockFile()
     {
       if ( _zyppLockFile == NULL )
-       return; // is closed
+        return;        // is closed
 
       clearerr( _zyppLockFile );
       fflush( _zyppLockFile );
@@ -200,8 +200,8 @@ namespace zypp
 
       if ( ! status.isDir() )
       {
-       DBG << "No such process." << endl;
-       return false;
+        DBG << "No such process." << endl;
+        return false;
       }
 
       static char buffer[513];
@@ -209,9 +209,9 @@ namespace zypp
       // man proc(5): /proc/[pid]/cmdline is empty if zombie.
       if ( std::ifstream( (procdir/"cmdline").c_str() ).read( buffer, 512 ).gcount() > 0 )
       {
-       _lockerName = buffer;
-       DBG << "Is running: " <<  _lockerName << endl;
-       return true;
+        _lockerName = buffer;
+        DBG << "Is running: " <<  _lockerName << endl;
+        return true;
       }
 
       DBG << "In zombie state." << endl;
@@ -247,40 +247,40 @@ namespace zypp
     bool zyppLocked()
     {
       if ( geteuid() != 0 )
-       return false;   // no lock as non-root
+        return false;  // no lock as non-root
 
       // Exception safe access to the lockfile.
       ScopedGuard closeOnReturn( accessLockFile() );
       {
-       scoped_lock<file_lock> flock( _zyppLockFileLock );      // aquire write lock
-
-       _lockerPid = readLockFile();
-       if ( _lockerPid == 0 )
-       {
-         // no or empty lock file
-         writeLockFile();
-         return false;
-       }
-       else if ( _lockerPid == getpid() )
-       {
-         // keep my own lock
-         return false;
-       }
-       else
-       {
-         // a foreign pid in lock
-         if ( isProcessRunning( _lockerPid ) )
-         {
-           WAR << _lockerPid << " is running and has a ZYpp lock. Sorry." << std::endl;
-           return true;
-         }
-         else
-         {
-           MIL << _lockerPid << " is dead. Taking the lock file." << std::endl;
-           writeLockFile();
-           return false;
-         }
-       }
+        scoped_lock<file_lock> flock( _zyppLockFileLock );     // aquire write lock
+
+        _lockerPid = readLockFile();
+        if ( _lockerPid == 0 )
+        {
+          // no or empty lock file
+          writeLockFile();
+          return false;
+        }
+        else if ( _lockerPid == getpid() )
+        {
+          // keep my own lock
+          return false;
+        }
+        else
+        {
+          // a foreign pid in lock
+          if ( isProcessRunning( _lockerPid ) )
+          {
+            WAR << _lockerPid << " is running and has a ZYpp lock. Sorry." << std::endl;
+            return true;
+          }
+          else
+          {
+            MIL << _lockerPid << " is dead. Taking the lock file." << std::endl;
+            writeLockFile();
+            return false;
+          }
+        }
       }
       INT << "Oops! We should not be here!" << std::endl;
       return true;
@@ -297,7 +297,7 @@ namespace zypp
     ZYppGlobalLock & globalLock()
     {
       if ( !_theGlobalLock )
-       _theGlobalLock.reset( new ZYppGlobalLock );
+        _theGlobalLock.reset( new ZYppGlobalLock );
       return *_theGlobalLock;
     }
   } //namespace
@@ -361,57 +361,57 @@ namespace zypp
     {
       if ( geteuid() != 0 )
       {
-       MIL << "Running as user. Skip creating " << globalLock().zyppLockFilePath() << std::endl;
+        MIL << "Running as user. Skip creating " << globalLock().zyppLockFilePath() << std::endl;
       }
       else if ( zypp_readonly_hack::active )
       {
-       MIL << "ZYPP_READONLY active." << endl;
+        MIL << "ZYPP_READONLY active." << endl;
       }
       else if ( globalLock().zyppLocked() )
       {
-       bool failed = true;
-       const long LOCK_TIMEOUT = str::strtonum<long>( getenv( "ZYPP_LOCK_TIMEOUT" ) );
-       if ( LOCK_TIMEOUT > 0 )
-       {
-         MIL << "Waiting whether pid " << globalLock().lockerPid() << " ends within $LOCK_TIMEOUT=" << LOCK_TIMEOUT << " sec." << endl;
-         unsigned delay = 1;
+        bool failed = true;
+        const long LOCK_TIMEOUT = str::strtonum<long>( getenv( "ZYPP_LOCK_TIMEOUT" ) );
+        if ( LOCK_TIMEOUT > 0 )
+        {
+          MIL << "Waiting whether pid " << globalLock().lockerPid() << " ends within $LOCK_TIMEOUT=" << LOCK_TIMEOUT << " sec." << endl;
+          unsigned delay = 1;
           Pathname procdir( Pathname("/proc")/str::numstring(globalLock().lockerPid()) );
-         for ( long i = 0; i < LOCK_TIMEOUT; i += delay )
-         {
-           if ( PathInfo( procdir ).isDir() )  // wait for /proc/pid to disapear
-             sleep( delay );
-           else
-           {
-             MIL << "Retry after " << i << " sec." << endl;
-             failed = globalLock().zyppLocked();
-             if ( failed )
-             {
-               // another proc locked faster. maybe it ends fast as well....
-               MIL << "Waiting whether pid " << globalLock().lockerPid() << " ends within " << (LOCK_TIMEOUT-i) << " sec." << endl;
+          for ( long i = 0; i < LOCK_TIMEOUT; i += delay )
+          {
+            if ( PathInfo( procdir ).isDir() ) // wait for /proc/pid to disapear
+              sleep( delay );
+            else
+            {
+              MIL << "Retry after " << i << " sec." << endl;
+              failed = globalLock().zyppLocked();
+              if ( failed )
+              {
+                // another proc locked faster. maybe it ends fast as well....
+                MIL << "Waiting whether pid " << globalLock().lockerPid() << " ends within " << (LOCK_TIMEOUT-i) << " sec." << endl;
                 procdir = Pathname( Pathname("/proc")/str::numstring(globalLock().lockerPid()) );
-             }
-             else
-             {
-               MIL << "Finally got the lock!" << endl;
-               break;  // gotcha
-             }
-           }
-         }
-       }
-       if ( failed )
-       {
-         std::string t = str::form(_("System management is locked by the application with pid %d (%s).\n"
-                                     "Close this application before trying again."),
-                                     globalLock().lockerPid(),
-                                     globalLock().lockerName().c_str()
-                                   );
-         ZYPP_THROW(ZYppFactoryException(t, globalLock().lockerPid(), globalLock().lockerName() ));
-       }
+              }
+              else
+              {
+                MIL << "Finally got the lock!" << endl;
+                break; // gotcha
+              }
+            }
+          }
+        }
+        if ( failed )
+        {
+          std::string t = str::form(_("System management is locked by the application with pid %d (%s).\n"
+                                      "Close this application before trying again."),
+                                      globalLock().lockerPid(),
+                                      globalLock().lockerName().c_str()
+                                    );
+          ZYPP_THROW(ZYppFactoryException(t, globalLock().lockerPid(), globalLock().lockerName() ));
+        }
       }
       // Here we go...
       static ZYpp::Impl_Ptr _theImplInstance;  // for now created once
       if ( !_theImplInstance )
-       _theImplInstance.reset( new ZYpp::Impl );
+        _theImplInstance.reset( new ZYpp::Impl );
       _instance.reset( new ZYpp( _theImplInstance ) );
       _theZYppInstance = _instance;
     }
index 70729f3..80afbf3 100644 (file)
@@ -38,64 +38,64 @@ namespace zypp
       static const size_t first = 0;
       for ( size_t i = first; i < size; ++i )
       {
-       char * mangled_name = 0;
-       char * offset_begin = 0;
-       char * offset_end = 0;
+        char * mangled_name = 0;
+        char * offset_begin = 0;
+        char * offset_end = 0;
 
-       // find parentheses and +address offset surrounding mangled name
-       for ( char * p = messages[i]; *p; ++p )
-       {
-         if ( *p == '(' )
-         {
-           mangled_name = p;
-         }
-         else if ( *p == '+' )
-         {
-           offset_begin = p;
-         }
-         else if ( *p == ')' )
-         {
-           offset_end = p;
-           break;
-         }
-       }
+        // find parentheses and +address offset surrounding mangled name
+        for ( char * p = messages[i]; *p; ++p )
+        {
+          if ( *p == '(' )
+          {
+            mangled_name = p;
+          }
+          else if ( *p == '+' )
+          {
+            offset_begin = p;
+          }
+          else if ( *p == ')' )
+          {
+            offset_end = p;
+            break;
+          }
+        }
 
-       int btLevel = i-handlerStack; // negative level in sigsegvHandler
-       if ( i > first )
-       {
-         stream_r << endl;
-         if ( btLevel == 0 )
-           stream_r << "vvvvvvvvvv----------------------------------------" << endl;
-       }
-       stream_r << "[" << (btLevel<0 ?"hd":"bt") << "]: (" << btLevel << ") ";
+        int btLevel = i-handlerStack; // negative level in sigsegvHandler
+        if ( i > first )
+        {
+          stream_r << endl;
+          if ( btLevel == 0 )
+            stream_r << "vvvvvvvvvv----------------------------------------" << endl;
+        }
+        stream_r << "[" << (btLevel<0 ?"hd":"bt") << "]: (" << btLevel << ") ";
 
-       // if the line could be processed, attempt to demangle the symbol
-       if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin )
-       {
-         *mangled_name++ = '\0';
-         *offset_begin++ = '\0';
-         *offset_end++ = '\0';
+        // if the line could be processed, attempt to demangle the symbol
+        if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin )
+        {
+          *mangled_name++ = '\0';
+          *offset_begin++ = '\0';
+          *offset_end++ = '\0';
 
-         int status;
-         char * real_name = ::abi::__cxa_demangle( mangled_name, 0, 0, &status );
+          int status;
+          char * real_name = ::abi::__cxa_demangle( mangled_name, 0, 0, &status );
 
-         // if demangling is successful, output the demangled function name
-         if ( status == 0 )
-         {
-           stream_r << messages[i] << " : " << real_name << "+" << offset_begin << offset_end;
-         }
-         // otherwise, output the mangled function name
-         else
-         {
-           stream_r << messages[i] << " : " << mangled_name << "+" << offset_begin << offset_end;
-         }
-         ::free( real_name );
-       }
-       else
-       {
-         // otherwise, print the whole line
-         stream_r << messages[i];
-       }
+          // if demangling is successful, output the demangled function name
+          if ( status == 0 )
+          {
+            stream_r << messages[i] << " : " << real_name << "+" << offset_begin << offset_end;
+          }
+          // otherwise, output the mangled function name
+          else
+          {
+            stream_r << messages[i] << " : " << mangled_name << "+" << offset_begin << offset_end;
+          }
+          ::free( real_name );
+        }
+        else
+        {
+          // otherwise, print the whole line
+          stream_r << messages[i];
+        }
       }
       ::free( messages );
     }
index 20f83ee..e587845 100644 (file)
@@ -126,7 +126,7 @@ namespace zypp
 
         TraceCAD( TraceCAD && rhs )
         { ++_totalTraceCAD();
-         traceCAD( MOVECTOR, *this, rhs ); }
+          traceCAD( MOVECTOR, *this, rhs ); }
 
         TraceCAD & operator=( const TraceCAD & rhs )
         { traceCAD( ASSIGN, *this, rhs ); return *this; }
index 41417fb..5d4fa55 100644 (file)
@@ -29,10 +29,10 @@ namespace zypp
       /** Direction the drunken Bishop wants to move. */
       enum class Direction : std::uint8_t      // actually 2 bits
       {
-       NW = 0x0,
-       NE = 0x1,
-       SW = 0x2,
-       SE = 0x3,
+        NW = 0x0,
+        NE = 0x1,
+        SW = 0x2,
+        SE = 0x3,
       };
 
       /** Convert a hex digit (case insensitive) into it's (4bit) integral value.
@@ -40,26 +40,26 @@ namespace zypp
        */
       inline std::uint8_t hexDigit( char ch_r )
       {
-       switch ( ch_r )
-       {
-         case 'F': case 'f': return 15;
-         case 'E': case 'e': return 14;
-         case 'D': case 'd': return 13;
-         case 'C': case 'c': return 12;
-         case 'B': case 'b': return 11;
-         case 'A': case 'a': return 10;
-         case '9': return 9;
-         case '8': return 8;
-         case '7': return 7;
-         case '6': return 6;
-         case '5': return 5;
-         case '4': return 4;
-         case '3': return 3;
-         case '2': return 2;
-         case '1': return 1;
-         case '0': return 0;
-       }
-       throw std::invalid_argument( str::Str() << "Not a hex digit '" << ch_r << "'" );
+        switch ( ch_r )
+        {
+          case 'F': case 'f': return 15;
+          case 'E': case 'e': return 14;
+          case 'D': case 'd': return 13;
+          case 'C': case 'c': return 12;
+          case 'B': case 'b': return 11;
+          case 'A': case 'a': return 10;
+          case '9': return 9;
+          case '8': return 8;
+          case '7': return 7;
+          case '6': return 6;
+          case '5': return 5;
+          case '4': return 4;
+          case '3': return 3;
+          case '2': return 2;
+          case '1': return 1;
+          case '0': return 0;
+        }
+        throw std::invalid_argument( str::Str() << "Not a hex digit '" << ch_r << "'" );
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -85,77 +85,77 @@ namespace zypp
        */
       void compute( const std::string & data_r, const std::string & title_r, unsigned height_r = Auto, unsigned width_r = Auto )
       {
-       // store rendering details
-       _renderSSH = ( data_r.size() <= 32 );   // up to the ssh fingerprint size
-       _fp = str::toUpper( data_r.size() <= 8 ? data_r : data_r.substr( data_r.size()-8 ) );
-       _tt = title_r;
-
-       // init the board
-       _h = odd(height_r);
-       _w = odd(width_r);
-
-       if ( _h == Auto )
-       {
-         if ( _renderSSH )
-         { _w = 17; _h = 9; }
-         else
-         { _w = 19; _h = 11; }
-       }
-       else if ( _w == Auto )
-       {
-         _w = (2*_h)-1;
-       }
-
-       _board = std::vector<std::uint8_t>( _w*_h, 0 );
-       _s = _w*_h/2;   // start
-       _e = _s;        // current/end
-       ++_board[_e];
-
-       // go
-       for ( const char * ch = data_r.c_str(); *ch; /*NOOP*/ )
-       {
-         std::uint8_t next4 = bite( ch );
-         // next4:     0x94
-         // bits:  10 01 01 00
-         // step:   4  3  2  1
-         static const std::uint8_t stepMask(0x3);
-         move( Direction(  next4     & stepMask ) );
-         move( Direction( (next4>>2) & stepMask ) );
-         move( Direction( (next4>>4) & stepMask ) );
-         move( Direction( (next4>>6) ) );
-       }
+        // store rendering details
+        _renderSSH = ( data_r.size() <= 32 );  // up to the ssh fingerprint size
+        _fp = str::toUpper( data_r.size() <= 8 ? data_r : data_r.substr( data_r.size()-8 ) );
+        _tt = title_r;
+
+        // init the board
+        _h = odd(height_r);
+        _w = odd(width_r);
+
+        if ( _h == Auto )
+        {
+          if ( _renderSSH )
+          { _w = 17; _h = 9; }
+          else
+          { _w = 19; _h = 11; }
+        }
+        else if ( _w == Auto )
+        {
+          _w = (2*_h)-1;
+        }
+
+        _board = std::vector<std::uint8_t>( _w*_h, 0 );
+        _s = _w*_h/2;  // start
+        _e = _s;       // current/end
+        ++_board[_e];
+
+        // go
+        for ( const char * ch = data_r.c_str(); *ch; /*NOOP*/ )
+        {
+          std::uint8_t next4 = bite( ch );
+          // next4:     0x94
+          // bits:  10 01 01 00
+          // step:   4  3  2  1
+          static const std::uint8_t stepMask(0x3);
+          move( Direction(  next4     & stepMask ) );
+          move( Direction( (next4>>2) & stepMask ) );
+          move( Direction( (next4>>4) & stepMask ) );
+          move( Direction( (next4>>6) ) );
+        }
       }
 
       /** Render board to a stream. */
       std::ostream & dumpOn( std::ostream & str, const std::string & prefix_r, Options options_r ) const
       {
-       if ( _board.empty() )
-       {
-         // "++\n"
-         // "++"
-         return str << prefix_r << "++" << endl << prefix_r << "++";
-       }
-
-       static const char * colorReset = "\033[0m";
-       static const char * colorBg = "\033[48;5;242m";
-       bool useColor = options_r.testFlag( USE_COLOR );
-
-       renderTitleOn( str << prefix_r , _tt );
-
-       for ( unsigned p = 0; p < _board.size(); ++p )
-       {
-         if ( ( p % _w ) == 0 )
-         {
-           if ( p )
-             str << ( useColor ? colorReset: "" ) << '|';
-           str << endl << prefix_r << '|' << ( useColor ? colorBg : "" );
-         }
-         renderOn( str, useColor, p );
-       }
-       str << ( useColor ? colorReset: "" ) << '|';
-
-       renderTitleOn( str << endl << prefix_r, _fp );
-       return str;
+        if ( _board.empty() )
+        {
+          // "++\n"
+          // "++"
+          return str << prefix_r << "++" << endl << prefix_r << "++";
+        }
+
+        static const char * colorReset = "\033[0m";
+        static const char * colorBg = "\033[48;5;242m";
+        bool useColor = options_r.testFlag( USE_COLOR );
+
+        renderTitleOn( str << prefix_r , _tt );
+
+        for ( unsigned p = 0; p < _board.size(); ++p )
+        {
+          if ( ( p % _w ) == 0 )
+          {
+            if ( p )
+              str << ( useColor ? colorReset: "" ) << '|';
+            str << endl << prefix_r << '|' << ( useColor ? colorBg : "" );
+          }
+          renderOn( str, useColor, p );
+        }
+        str << ( useColor ? colorReset: "" ) << '|';
+
+        renderTitleOn( str << endl << prefix_r, _fp );
+        return str;
       }
 
     private:
@@ -168,67 +168,67 @@ namespace zypp
        */
       static std::uint8_t bite( const char *& ch_r )
       {
-       std::uint8_t ret = hexDigit( *ch_r ) << 4;
-       if ( *(++ch_r) )
-         ret |= hexDigit( *(ch_r++) );
-       return ret;
+        std::uint8_t ret = hexDigit( *ch_r ) << 4;
+        if ( *(++ch_r) )
+          ret |= hexDigit( *(ch_r++) );
+        return ret;
       }
 
     private:
       /** Move Bishop from \ref _e into \a direction_r and update the \ref _board. */
       void move( Direction direction_r )
       {
-       switch ( direction_r )
-       {
-         case Direction::NW:
-           if ( atTL() )
-             /*no move*/;
-           else if ( atT() )
-             _e -= 1;
-           else if ( atL() )
-             _e -= _w;
-           else
-             _e -= _w+1;
-           break;
-
-         case Direction::NE:
-           if ( atTR() )
-             /*no move*/;
-           else if ( atT() )
-             _e += 1;
-           else if ( atR() )
-             _e -= _w;
-           else
-             _e -= _w-1;
-           break;
-
-         case Direction::SW:
-           if ( atBL() )
-             /*no move*/;
-           else if ( atB() )
-             _e -= 1;
-           else if ( atL() )
-             _e += _w;
-           else
-             _e += _w-1;
-           break;
-
-         case Direction::SE:
-           if ( atBR() )
-             /*no move*/;
-           else if ( atB() )
-             _e += 1;
-           else if ( atR() )
-             _e += _w;
-           else
-             _e += _w+1;
-           break;
-
-         default:
-           throw std::invalid_argument( str::Str() << "Bad Direction " << unsigned(direction_r) );
-       }
-       // update the board
-       ++_board[_e];
+        switch ( direction_r )
+        {
+          case Direction::NW:
+            if ( atTL() )
+              /*no move*/;
+            else if ( atT() )
+              _e -= 1;
+            else if ( atL() )
+              _e -= _w;
+            else
+              _e -= _w+1;
+            break;
+
+          case Direction::NE:
+            if ( atTR() )
+              /*no move*/;
+            else if ( atT() )
+              _e += 1;
+            else if ( atR() )
+              _e -= _w;
+            else
+              _e -= _w-1;
+            break;
+
+          case Direction::SW:
+            if ( atBL() )
+              /*no move*/;
+            else if ( atB() )
+              _e -= 1;
+            else if ( atL() )
+              _e += _w;
+            else
+              _e += _w-1;
+            break;
+
+          case Direction::SE:
+            if ( atBR() )
+              /*no move*/;
+            else if ( atB() )
+              _e += 1;
+            else if ( atR() )
+              _e += _w;
+            else
+              _e += _w+1;
+            break;
+
+          default:
+            throw std::invalid_argument( str::Str() << "Bad Direction " << unsigned(direction_r) );
+        }
+        // update the board
+        ++_board[_e];
       }
 
       /** Whether \ref _e is in the top left corner. */
@@ -267,74 +267,74 @@ namespace zypp
       /** ANSI color heatmap. */
       const char * color( std::uint8_t idx_r ) const
       {
-       static const std::vector<const char *> colors = {
-         "",                   // no coin
-         "\033[38;5;21m",      // blue (cold)
-         "\033[38;5;39m",
-         "\033[38;5;50m",
-         "\033[38;5;48m",
-         "\033[38;5;46m",      // green
-         "\033[38;5;118m",
-         "\033[38;5;190m",
-         "\033[38;5;226m",     // yellow
-         "\033[38;5;220m",
-         "\033[38;5;214m",     // orange
-         "\033[38;5;208m",
-         "\033[38;5;202m",
-         "\033[38;5;196m",     // red
-         "\033[38;5;203m",
-         "\033[38;5;210m",
-         "\033[38;5;217m",     // pink
-         "\033[38;5;224m",
-         "\033[38;5;231m",     // white (hot)
-       };
+        static const std::vector<const char *> colors = {
+          "",                  // no coin
+          "\033[38;5;21m",     // blue (cold)
+          "\033[38;5;39m",
+          "\033[38;5;50m",
+          "\033[38;5;48m",
+          "\033[38;5;46m",     // green
+          "\033[38;5;118m",
+          "\033[38;5;190m",
+          "\033[38;5;226m",    // yellow
+          "\033[38;5;220m",
+          "\033[38;5;214m",    // orange
+          "\033[38;5;208m",
+          "\033[38;5;202m",
+          "\033[38;5;196m",    // red
+          "\033[38;5;203m",
+          "\033[38;5;210m",
+          "\033[38;5;217m",    // pink
+          "\033[38;5;224m",
+          "\033[38;5;231m",    // white (hot)
+        };
 #if 0
-       // cycle through heat map to test all colors
-       if ( ! idx_r )
-         return "";
-       static unsigned i = 0;
-       if ( ++i == colors.size() )
-         i = 1;
-       return colors[i];
+        // cycle through heat map to test all colors
+        if ( ! idx_r )
+          return "";
+        static unsigned i = 0;
+        if ( ++i == colors.size() )
+          i = 1;
+        return colors[i];
 #endif
-       return ( idx_r < colors.size() ? colors[idx_r] : *colors.rbegin() );
+        return ( idx_r < colors.size() ? colors[idx_r] : *colors.rbegin() );
       }
 
       /** Render non empty title strings */
       std::ostream & renderTitleOn( std::ostream & str, const std::string & title_r ) const
       {
-       std::string buffer( _w+2, '-' );
-       *buffer.begin() = *buffer.rbegin() = '+';
-
-       if ( !title_r.empty() && _w >= 2 )      // extra 2 for "[]"
-       {
-         std::string::size_type tlen = std::min( title_r.size(), std::string::size_type(_w-2) );
-         std::string::size_type tpos = (_w-tlen)/2;    // not (_w-2-tlen) because buffer is size _w+2
-         buffer[tpos++] = '[';
-         for ( std::string::size_type p = 0; p < tlen; ++p, ++tpos )
-           buffer[tpos] = title_r[p];
-         buffer[tpos] = ']';
-       }
-       return str << buffer;
+        std::string buffer( _w+2, '-' );
+        *buffer.begin() = *buffer.rbegin() = '+';
+
+        if ( !title_r.empty() && _w >= 2 )     // extra 2 for "[]"
+        {
+          std::string::size_type tlen = std::min( title_r.size(), std::string::size_type(_w-2) );
+          std::string::size_type tpos = (_w-tlen)/2;   // not (_w-2-tlen) because buffer is size _w+2
+          buffer[tpos++] = '[';
+          for ( std::string::size_type p = 0; p < tlen; ++p, ++tpos )
+            buffer[tpos] = title_r[p];
+          buffer[tpos] = ']';
+        }
+        return str << buffer;
       }
 
       /** Render board numbers to printable chars. */
       std::ostream & renderOn( std::ostream & str, bool useColor_r, unsigned pos_r ) const
       {
-       static const std::string sshSet( " .o+=*BOX@%&#/^" );
-       static const std::string gpgSet( " .^:li?(fxXZ#MW&8%@" );
-       const std::string & charSet( _renderSSH ? sshSet : gpgSet );
+        static const std::string sshSet( " .o+=*BOX@%&#/^" );
+        static const std::string gpgSet( " .^:li?(fxXZ#MW&8%@" );
+        const std::string & charSet( _renderSSH ? sshSet : gpgSet );
 
-       if ( useColor_r )
-         str << color( _board[pos_r] );
+        if ( useColor_r )
+          str << color( _board[pos_r] );
 
-       if ( pos_r == _e )
-         return str << 'E';
+        if ( pos_r == _e )
+          return str << 'E';
 
-       if ( pos_r == _s )
-         return str << 'S';
+        if ( pos_r == _s )
+          return str << 'S';
 
-       return str << ( _board[pos_r] < charSet.size() ? charSet[_board[pos_r]] : *charSet.rbegin() );
+        return str << ( _board[pos_r] < charSet.size() ? charSet[_board[pos_r]] : *charSet.rbegin() );
       }
 
     private:
@@ -357,8 +357,8 @@ namespace zypp
       /** Offer default Impl. */
       static shared_ptr<Impl> nullimpl()
       {
-       static shared_ptr<Impl> _nullimpl( new Impl );
-       return _nullimpl;
+        static shared_ptr<Impl> _nullimpl( new Impl );
+        return _nullimpl;
       }
     };
 
index 8ca3850..6de1a56 100644 (file)
@@ -89,7 +89,7 @@ namespace zypp
     public:
       /* Rendering options */
       enum OptionBits {
-       USE_COLOR       = (1<<0),       ///< use colors
+        USE_COLOR      = (1<<0),       ///< use colors
       };
       ZYPP_DECLARE_FLAGS(Options,OptionBits);
 
index 5ff01d1..9dd846a 100644 (file)
@@ -42,28 +42,28 @@ namespace zypp
       ScopedSet( std::string var_r, const char * val_r )
       : _var { std::move(var_r) }
       {
-       if ( !_var.empty() )
-       {
-         if ( const char * orig = ::getenv( _var.c_str() ) )
-           _val.reset( new std::string( orig ) );
-         setval( val_r );
-       }
+        if ( !_var.empty() )
+        {
+          if ( const char * orig = ::getenv( _var.c_str() ) )
+            _val.reset( new std::string( orig ) );
+          setval( val_r );
+        }
       }
 
       /** Restore the original setting. */
       ~ScopedSet()
       {
-       if ( !_var.empty() )
-         setval( _val ? _val->c_str() : nullptr );
+        if ( !_var.empty() )
+          setval( _val ? _val->c_str() : nullptr );
       }
 
     private:
       void setval( const char * val_r )
       {
-       if ( val_r )
-         ::setenv( _var.c_str(), val_r, 1 );
-       else
-         ::unsetenv( _var.c_str() );
+        if ( val_r )
+          ::setenv( _var.c_str(), val_r, 1 );
+        else
+          ::unsetenv( _var.c_str() );
       }
 
     private:
index 83e0830..df29e01 100644 (file)
@@ -114,7 +114,7 @@ namespace zypp
         {
           bool failed = false;
 
-         // it also closes _fd, fine
+          // it also closes _fd, fine
           int r = gzclose( _file );
           if ( r != Z_OK )
             {
@@ -125,7 +125,7 @@ namespace zypp
             }
 
           // Reset everything
-         _fd = -1;
+          _fd = -1;
           _file = NULL;
           _mode = std::ios_base::openmode(0);
           if ( ! failed )
@@ -196,8 +196,8 @@ namespace zypp
     off_t
     gzstreambufimpl::compressed_tell() const
     {
-       off_t pos = lseek (_fd, 0, SEEK_CUR);
-       // hopefully the conversion is ok
+        off_t pos = lseek (_fd, 0, SEEK_CUR);
+        // hopefully the conversion is ok
         return pos;
     }
 
index 02461cd..5da3e46 100644 (file)
@@ -35,7 +35,7 @@ namespace zypp
     {
       PathInfo p( file_r );
       if ( p.isFile() && filesystem::zipType( file_r ) == filesystem::ZT_NONE )
-       return p.size();
+        return p.size();
       return -1;
     }
 
index ee844ee..0d26519 100644 (file)
@@ -38,96 +38,96 @@ namespace zypp
     {
       inline std::string strEncode( std::string val_r )
       {
-       typedef unsigned char uchar;
-
-       std::string::size_type add = 2; // enclosing "s
-       for_( r, val_r.begin(), val_r.end() )
-       {
-         if ( uchar(*r) < 32u )
-         {
-           switch ( *r )
-           {
-             case '\b':
-             case '\f':
-             case '\n':
-             case '\r':
-             case '\t':
-               add += 1;       // "\c"
-               break;
-             default:
-               add += 5;       // "\uXXXX"
-               break;
-           }
-         }
-         else
-         {
-           switch ( *r )
-           {
-             case '"':
-             case '/':
-             case '\\':
-               add += 1;       // \-escape
-               break;
-           }
-         }
-       }
-
-       val_r.resize( val_r.size() + add, '@' );
-       auto w( val_r.rbegin() );
-       auto r( w + add );
-
-       *w++ = '"';
-       for ( ; r != val_r.rend(); ++r )
-       {
-         if ( uchar(*r) < 32u )
-         {
-           static const char * digit = "0123456789abcdef";
-           switch ( *r )
-           {
-             case '\b':        // "\c"
-               *w++ = 'b';
-               *w++ = '\\';
-               break;
-             case '\f':        // "\c"
-               *w++ = 'f';
-               *w++ = '\\';
-               break;
-             case '\n':        // "\c"
-               *w++ = 'n';
-               *w++ = '\\';
-               break;
-             case '\r':        // "\c"
-               *w++ = 'r';
-               *w++ = '\\';
-               break;
-             case '\t':        // "\c"
-               *w++ = 't';
-               *w++ = '\\';
-               break;
-             default:          // "\uXXXX"
-               *w++ = digit[uchar(*r) % 15];
-               *w++ = digit[uchar(*r) / 16];
-               *w++ = '0';
-               *w++ = '0';
-               *w++ = 'u';
-               *w++ = '\\';
-               break;
-           }
-         }
-         else
-         {
-           switch ( (*w++ = *r) )
-           {
-             case '"':
-             case '/':
-             case '\\':        // \-escape
-               *w++ = '\\';
-               break;
-           }
-         }
-       }
-       *w++ = '"';
-       return val_r;
+        typedef unsigned char uchar;
+
+        std::string::size_type add = 2;        // enclosing "s
+        for_( r, val_r.begin(), val_r.end() )
+        {
+          if ( uchar(*r) < 32u )
+          {
+            switch ( *r )
+            {
+              case '\b':
+              case '\f':
+              case '\n':
+              case '\r':
+              case '\t':
+                add += 1;      // "\c"
+                break;
+              default:
+                add += 5;      // "\uXXXX"
+                break;
+            }
+          }
+          else
+          {
+            switch ( *r )
+            {
+              case '"':
+              case '/':
+              case '\\':
+                add += 1;      // \-escape
+                break;
+            }
+          }
+        }
+
+        val_r.resize( val_r.size() + add, '@' );
+        auto w( val_r.rbegin() );
+        auto r( w + add );
+
+        *w++ = '"';
+        for ( ; r != val_r.rend(); ++r )
+        {
+          if ( uchar(*r) < 32u )
+          {
+            static const char * digit = "0123456789abcdef";
+            switch ( *r )
+            {
+              case '\b':       // "\c"
+                *w++ = 'b';
+                *w++ = '\\';
+                break;
+              case '\f':       // "\c"
+                *w++ = 'f';
+                *w++ = '\\';
+                break;
+              case '\n':       // "\c"
+                *w++ = 'n';
+                *w++ = '\\';
+                break;
+              case '\r':       // "\c"
+                *w++ = 'r';
+                *w++ = '\\';
+                break;
+              case '\t':       // "\c"
+                *w++ = 't';
+                *w++ = '\\';
+                break;
+              default:         // "\uXXXX"
+                *w++ = digit[uchar(*r) % 15];
+                *w++ = digit[uchar(*r) / 16];
+                *w++ = '0';
+                *w++ = '0';
+                *w++ = 'u';
+                *w++ = '\\';
+                break;
+            }
+          }
+          else
+          {
+            switch ( (*w++ = *r) )
+            {
+              case '"':
+              case '/':
+              case '\\':       // \-escape
+                *w++ = '\\';
+                break;
+            }
+          }
+        }
+        *w++ = '"';
+        return val_r;
       }
     } // namespace detail
     ///////////////////////////////////////////////////////////////////
@@ -264,7 +264,7 @@ namespace zypp
 
       /** Construct from container initializer list { v1, v2,... } */
       Array( const std::initializer_list<Value> & contents_r )
-       : Array( contents_r.begin(), contents_r.end() )
+        : Array( contents_r.begin(), contents_r.end() )
       {}
 
       /** Push JSON Value to Array */
@@ -286,12 +286,12 @@ namespace zypp
       /** Stream output */
       std::ostream & dumpOn( std::ostream & str ) const
       {
-       if ( _data.empty() )
-         return str << "[]";
-       str << '[' << *_data.begin();
-       for_( val, ++_data.begin(), _data.end() )
-         str << ", " << *val;
-       return str << ']';
+        if ( _data.empty() )
+          return str << "[]";
+        str << '[' << *_data.begin();
+        for_( val, ++_data.begin(), _data.end() )
+          str << ", " << *val;
+        return str << ']';
       }
 
     private:
@@ -329,7 +329,7 @@ namespace zypp
 
       /** Construct from map-initializer list { {k1,v1}, {k2,v2},... } */
       Object( const std::initializer_list<std::pair<String, Value>> & contents_r )
-       : Object( contents_r.begin(), contents_r.end() )
+        : Object( contents_r.begin(), contents_r.end() )
       {}
 
       /** Add key/value pair */
@@ -351,13 +351,13 @@ namespace zypp
       /** Stream output */
       std::ostream & dumpOn( std::ostream & str ) const
       {
-       using std::endl;
-       if ( _data.empty() )
-         return str << "{}";
-       dumpOn( str << '{' << endl, _data.begin() );
-       for_ ( val, ++_data.begin(), _data.end() )
-         dumpOn( str << ',' << endl, val );
-       return str << endl << '}';
+        using std::endl;
+        if ( _data.empty() )
+          return str << "{}";
+        dumpOn( str << '{' << endl, _data.begin() );
+        for_ ( val, ++_data.begin(), _data.end() )
+          dumpOn( str << ',' << endl, val );
+        return str << endl << '}';
       }
 
     private:
index 35e8a96..f8d6ccd 100644 (file)
@@ -37,9 +37,9 @@ namespace zypp
       const char * ovalue = ::setlocale( category_r, nullptr );
       if ( ovalue && ovalue != value_r )
       {
-       _category = category_r;
-       _value    = ovalue;
-       ::setlocale( _category, value_r.c_str() );
+        _category = category_r;
+        _value    = ovalue;
+        ::setlocale( _category, value_r.c_str() );
       }
     }
 
@@ -52,8 +52,8 @@ namespace zypp
     {
       if ( _category != -1 )
       {
-       ::setlocale( _category, _value.c_str() );
-       _category = -1;
+        ::setlocale( _category, _value.c_str() );
+        _category = -1;
       }
     }
 
index 05eaccd..f32ea70 100644 (file)
@@ -144,7 +144,7 @@ namespace zypp
       , _seq    ( 0 )
       , _log    ( log_r )
       {
-       _glevel += "..";
+        _glevel += "..";
         log() << _level << "START MEASURE(" << _ident << ")" << endl;
         _start.get();
       }
@@ -155,7 +155,7 @@ namespace zypp
         ++_seq;
         std::ostream & str( log() << _level << "MEASURE(" << _ident << ") " );
         dumpMeasure( str );
-       _glevel.erase( 0, 2 );
+        _glevel.erase( 0, 2 );
       }
 
       void restart()
@@ -187,8 +187,8 @@ namespace zypp
           {
             str_r << " [" << ( _stop - _elapsed ) << "]";
           }
-       if ( ! tag_r.empty() )
-         str_r << " - " << tag_r;
+        if ( ! tag_r.empty() )
+          str_r << " - " << tag_r;
         return str_r << endl;
       }
 
index 4a82d40..c4b4f8f 100644 (file)
@@ -87,7 +87,7 @@ namespace zypp
 
       /** re start the timer without reset-ing it. */
       void restart();
-      
+
       /** Print elapsed time for a running timer.
        * Timer keeps on running.
       */
index 09ec183..b75d61d 100644 (file)
@@ -55,8 +55,8 @@ namespace zypp
        */
       bool haveValue( const std::string & name_r ) const
       {
-       typename NameMap::const_iterator it( _nameMap.find( name_r ) );
-       return( it != _nameMap.end() );
+        typename NameMap::const_iterator it( _nameMap.find( name_r ) );
+        return( it != _nameMap.end() );
       }
 
       /** Get value mapped for name or alias.
@@ -64,11 +64,11 @@ namespace zypp
        */
       bool getValue( const std::string & name_r, Tp & value_r ) const
       {
-       typename NameMap::const_iterator it( _nameMap.find( name_r ) );
-       if ( it == _nameMap.end() )
-         return false;
-       value_r = it->second;
-       return true;
+        typename NameMap::const_iterator it( _nameMap.find( name_r ) );
+        if ( it == _nameMap.end() )
+          return false;
+        value_r = it->second;
+        return true;
       }
       /** \overload \throws std::out_of_range exception if \a name_r was not found. */
       const Tp & getValue( const std::string & name_r ) const
@@ -82,8 +82,8 @@ namespace zypp
        */
       bool haveName( const std::string & value_r ) const
       {
-       typename ValueMap::const_iterator it( _valueMap.find( value_r ) );
-       return( it != _valueMap.end() );
+        typename ValueMap::const_iterator it( _valueMap.find( value_r ) );
+        return( it != _valueMap.end() );
       }
 
       /** Get name of value.
@@ -91,11 +91,11 @@ namespace zypp
        */
       bool getName( const Tp & value_r, std::string & name_r ) const
       {
-       typename ValueMap::const_iterator it( _valueMap.find( value_r ) );
-       if ( it == _valueMap.end() )
-         return false;
-       value_r = it->second;
-       return true;
+        typename ValueMap::const_iterator it( _valueMap.find( value_r ) );
+        if ( it == _valueMap.end() )
+          return false;
+        value_r = it->second;
+        return true;
       }
       /** \overload \throws std::out_of_range exception if \a value_r was not found. */
       const std::string & getName( const Tp & value_r ) const
@@ -109,15 +109,15 @@ namespace zypp
       class TInserter
       {
       public:
-       TInserter( NamedValue & parent_r, const Tp & value_r )
-       : _parent( &parent_r )
-       , _value( value_r )
-       {}
-       TInserter & operator|( const std::string & name_r )
-       { _parent->insert( _value, name_r ); return *this; }
+        TInserter( NamedValue & parent_r, const Tp & value_r )
+        : _parent( &parent_r )
+        , _value( value_r )
+        {}
+        TInserter & operator|( const std::string & name_r )
+        { _parent->insert( _value, name_r ); return *this; }
       private:
-       NamedValue * _parent;
-       Tp _value;
+        NamedValue * _parent;
+        Tp _value;
       };
 
       TInserter operator()( const Tp & value_r )
@@ -133,16 +133,16 @@ namespace zypp
     {
       typename NameMap::const_iterator nit( _nameMap.find( name_r ) );
       if ( nit != _nameMap.end() )     // duplicate name
-       throw std::logic_error( "NamedValue::insert name" );
+        throw std::logic_error( "NamedValue::insert name" );
 
       typename ValueMap::const_iterator tit( _valueMap.find( value_r ) );
       if ( tit != _valueMap.end() )    // duplicate value, i.e. an alias
       {
-       if ( !_tWithAlias )
-         throw std::logic_error( "NamedValue::insert alias" );
+        if ( !_tWithAlias )
+          throw std::logic_error( "NamedValue::insert alias" );
 
-       _nameMap[name_r] = value_r;
-       return false;
+        _nameMap[name_r] = value_r;
+        return false;
       }
       // here: 1st entry for value_r
       _nameMap[name_r] = value_r;
index 98fcfa7..7e7ed60 100644 (file)
@@ -214,22 +214,22 @@ namespace zypp
   { return src.compare( DERIVED_TYPE(trg) ); } \
   inline SetCompare compare( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg )        \
   { return DERIVED_TYPE(src).compare( trg ); } \
-       \
+        \
   inline bool compare( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg, SetCompare cmp )      \
   { return src.compare( DERIVED_TYPE(trg), cmp ); }    \
   inline bool compare( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg, SetCompare cmp )      \
   { return DERIVED_TYPE(src).compare( trg, cmp ); }    \
-       \
+        \
   inline bool compare( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg, SetRelation rel )     \
   { return src.compare( DERIVED_TYPE(trg), rel ); }    \
   inline bool compare( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg, SetRelation rel )     \
   { return DERIVED_TYPE(src).compare( trg, rel ); }    \
-       \
+        \
   inline bool operator==( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg )   \
   { return src.compare( DERIVED_TYPE(trg), SetRelation::equal ); }     \
   inline bool operator==( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg )   \
   { return DERIVED_TYPE(src).compare( trg, SetRelation::equal ); }     \
-       \
+        \
   inline bool operator!=( const base::SetRelationMixin<DERIVED_TYPE> & src, OTHER_TYPE trg )   \
   { return !( src == trg ); }  \
   inline bool operator!=( OTHER_TYPE src, const base::SetRelationMixin<DERIVED_TYPE> & trg )   \
index 9d4b7d9..795033d 100644 (file)
@@ -62,13 +62,13 @@ namespace zypp
        */
       bool setInitial( set_type new_r )
       {
-       setInitial();
-       bool changed = ( new_r != _current );
-       if ( changed )
-       {
-         _current = std::move(new_r);
-       }
-       return changed;
+        setInitial();
+        bool changed = ( new_r != _current );
+        if ( changed )
+        {
+          _current = std::move(new_r);
+        }
+        return changed;
       }
 
 
@@ -77,21 +77,21 @@ namespace zypp
        */
       bool set( set_type new_r )
       {
-       bool changed = ( new_r != _current );
-       if ( changed )
-       {
-         // build the initial (cur-add+rem) set in _current
-         setDifference( _current, _added, _removed );
-         _current.swap( _removed );
-         _added.clear();
-         _removed.clear();
-
-         const set_type & initial( _current );
-         setDifference( initial, new_r, _removed );
-         setDifference( new_r, initial, _added );
-         _current.swap( new_r );
-       }
-       return changed;
+        bool changed = ( new_r != _current );
+        if ( changed )
+        {
+          // build the initial (cur-add+rem) set in _current
+          setDifference( _current, _added, _removed );
+          _current.swap( _removed );
+          _added.clear();
+          _removed.clear();
+
+          const set_type & initial( _current );
+          setDifference( initial, new_r, _removed );
+          setDifference( new_r, initial, _added );
+          _current.swap( new_r );
+        }
+        return changed;
       }
 
       /** Add an element to the set and track changes.
@@ -99,13 +99,13 @@ namespace zypp
        */
       bool add( const value_type & val_r )
       {
-       bool done = _current.insert( val_r ).second;
-       if ( done )
-       {
-         if ( ! _removed.erase( val_r ) )
-           _added.insert( val_r );
-       }
-       return done;
+        bool done = _current.insert( val_r ).second;
+        if ( done )
+        {
+          if ( ! _removed.erase( val_r ) )
+            _added.insert( val_r );
+        }
+        return done;
       }
 
       /** Remove an element from the set and track changes.
@@ -113,13 +113,13 @@ namespace zypp
        */
       bool remove( const value_type & val_r )
       {
-       bool done = _current.erase( val_r );
-       if ( done )
-       {
-         if ( ! _added.erase( val_r ) )
-           _removed.insert( val_r );
-       }
-       return done;
+        bool done = _current.erase( val_r );
+        if ( done )
+        {
+          if ( ! _added.erase( val_r ) )
+            _removed.insert( val_r );
+        }
+        return done;
       }
       //@}
 
@@ -165,18 +165,18 @@ namespace zypp
       template <class TORDERED_SET, typename enable_if = typename TORDERED_SET::key_compare>
       static void setDifference( const TORDERED_SET & lhs, const TORDERED_SET & rhs, TORDERED_SET & result_r )
       {
-       // std::set_difference requires ordered sets!
-       std::set_difference( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
-                            std::inserter( result_r, result_r.end() ),
-                            typename TORDERED_SET::key_compare() );
+        // std::set_difference requires ordered sets!
+        std::set_difference( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
+                             std::inserter( result_r, result_r.end() ),
+                             typename TORDERED_SET::key_compare() );
       }
 
       template <class TUNORDERED_SET, typename enable_if = typename TUNORDERED_SET::hasher, typename = void>
       static void setDifference( const TUNORDERED_SET & lhs, const TUNORDERED_SET & rhs, TUNORDERED_SET & result_r )
       {
-       // std::set_difference requires ordered sets!
-       for ( const auto & l : lhs )
-       { if ( rhs.find( l ) == rhs.end() ) result_r.insert( l ); }
+        // std::set_difference requires ordered sets!
+        for ( const auto & l : lhs )
+        { if ( rhs.find( l ) == rhs.end() ) result_r.insert( l ); }
       }
 
     private:
index e4ffd6a..d733acb 100644 (file)
@@ -51,25 +51,25 @@ namespace zypp
       /** Temporary block signal. */
       void block( int signum_r )
       {
-       ::sigset_t mask;
-       ::sigemptyset( & mask );
-       ::sigaddset( & mask, signum_r );
-       ::sigprocmask( SIG_BLOCK, &mask, NULL );
+        ::sigset_t mask;
+        ::sigemptyset( & mask );
+        ::sigaddset( & mask, signum_r );
+        ::sigprocmask( SIG_BLOCK, &mask, NULL );
       }
       /** Temporary unblock signal. */
       void unblock( int signum_r )
       {
-       ::sigset_t mask;
-       ::sigemptyset( & mask );
-       ::sigaddset( & mask, signum_r );
-       ::sigprocmask( SIG_UNBLOCK, &mask, NULL );
+        ::sigset_t mask;
+        ::sigemptyset( & mask );
+        ::sigaddset( & mask, signum_r );
+        ::sigprocmask( SIG_UNBLOCK, &mask, NULL );
       }
       /** Whether signal delivery is pending. */
       bool pending( int signum_r )
       {
-       ::sigset_t mask;
-       ::sigpending( &mask );
-       return ::sigismember( &mask, signum_r );
+        ::sigset_t mask;
+        ::sigpending( &mask );
+        return ::sigismember( &mask, signum_r );
       }
       /** Wait for signals not blocked in original sigprocmask. */
       void suspend()
index 1df1ed6..be74ed6 100644 (file)
@@ -183,16 +183,16 @@ namespace zypp
     {
       if ( !_matcher )
       {
-       if ( _flags.mode() == Match::OTHER )
-         ZYPP_THROW( MatchUnknownModeException( _flags, _search ) );
-
-       _matcher.reset( new sat::detail::CDatamatcher );
-       int res = ::datamatcher_init( _matcher.get(), _search.c_str(), _flags.get() );
-       if ( res )
-       {
-         _matcher.reset();
-         ZYPP_THROW( MatchInvalidRegexException( _search, res ) );
-       }
+        if ( _flags.mode() == Match::OTHER )
+          ZYPP_THROW( MatchUnknownModeException( _flags, _search ) );
+
+        _matcher.reset( new sat::detail::CDatamatcher );
+        int res = ::datamatcher_init( _matcher.get(), _search.c_str(), _flags.get() );
+        if ( res )
+        {
+          _matcher.reset();
+          ZYPP_THROW( MatchInvalidRegexException( _search, res ) );
+        }
       }
     }
 
@@ -206,7 +206,7 @@ namespace zypp
       compile(); // nop if already compiled.
 
       if ( ! string_r )
-       return false; // NULL never matches
+        return false; // NULL never matches
       return ::datamatcher_match( _matcher.get(), string_r );
     }
 
@@ -231,7 +231,7 @@ namespace zypp
     void invalidate()
     {
       if ( _matcher )
-       ::datamatcher_free( _matcher.get() );
+        ::datamatcher_free( _matcher.get() );
       _matcher.reset();
     }
 
index f3c4106..f82e46c 100644 (file)
@@ -109,18 +109,18 @@ namespace zypp
     void set( const Match & rhs )
     {
       if ( rhs.modeval() )
-       _val = rhs._val | flagval(); // also set the rhs mode
-       else
-         _val |= rhs._val; // just set the flags
+        _val = rhs._val | flagval(); // also set the rhs mode
+        else
+          _val |= rhs._val; // just set the flags
     }
 
     /** Unset all of the \a rhs bits (unsets mode if the same as \a rhs). */
     void unset( const Match & rhs )
     {
       if ( modeval() == rhs.modeval() )
-       _val = flagval() & ~rhs.flagval(); // also unset mode
-       else
-         _val &= ~rhs.flagval(); // just unset falgs
+        _val = flagval() & ~rhs.flagval(); // also unset mode
+        else
+          _val &= ~rhs.flagval(); // just unset falgs
     }
 
     /** Depending on the value of \a onoff, set or unset flags. */
index 314d662..d01f46f 100644 (file)
@@ -33,121 +33,121 @@ namespace zypp {
 
       std::map<std::string,std::string> read( const Pathname & _path )
       {
-       DBG << "Load '" << _path << "'" << endl;
-       std::map<std::string,std::string> ret;
-
-       std::string line;
-       std::ifstream in( _path.asString().c_str() );
-       if ( in.fail() ) {
-         WAR << "Unable to load '" << _path << "'" << endl;
-         return ret;
-       }
-
-       while( getline( in, line ) ) {
-         if ( *line.begin() != '#' ) {
-
-           std::string::size_type pos = line.find( '=', 0 );
-
-           if ( pos != std::string::npos ) {
-
-             std::string key = str::trim( line.substr( 0, pos ) );
-             std::string value = str::trim( line.substr( pos + 1, line.length() - pos - 1 ) );
-
-             if ( value.length() >= 2
-                  && *(value.begin()) == '"'
-                  && *(value.rbegin()) == '"' )
-             {
-               value = value.substr( 1, value.length() - 2 );
-             }
-             if ( value.length() >= 2
-                  && *(value.begin()) == '\''
-                  && *(value.rbegin()) == '\'' )
-             {
-               value = value.substr( 1, value.length() - 2 );
-             }
-             XXX << "KEY: '" << key << "' VALUE: '" << value << "'" << endl;
-             ret[key] = value;
-
-           } // '=' found
-
-         } // not comment
-
-       } // while getline
-       MIL << "done reading '" << _path << "'" << endl;
-       return ret;
+        DBG << "Load '" << _path << "'" << endl;
+        std::map<std::string,std::string> ret;
+
+        std::string line;
+        std::ifstream in( _path.asString().c_str() );
+        if ( in.fail() ) {
+          WAR << "Unable to load '" << _path << "'" << endl;
+          return ret;
+        }
+
+        while( getline( in, line ) ) {
+          if ( *line.begin() != '#' ) {
+
+            std::string::size_type pos = line.find( '=', 0 );
+
+            if ( pos != std::string::npos ) {
+
+              std::string key = str::trim( line.substr( 0, pos ) );
+              std::string value = str::trim( line.substr( pos + 1, line.length() - pos - 1 ) );
+
+              if ( value.length() >= 2
+                   && *(value.begin()) == '"'
+                   && *(value.rbegin()) == '"' )
+              {
+                value = value.substr( 1, value.length() - 2 );
+              }
+              if ( value.length() >= 2
+                   && *(value.begin()) == '\''
+                   && *(value.rbegin()) == '\'' )
+              {
+                value = value.substr( 1, value.length() - 2 );
+              }
+              XXX << "KEY: '" << key << "' VALUE: '" << value << "'" << endl;
+              ret[key] = value;
+
+            } // '=' found
+
+          } // not comment
+
+        } // while getline
+        MIL << "done reading '" << _path << "'" << endl;
+        return ret;
       }
 
       bool write( const Pathname & path_r, const std::string & key_r, const std::string & val_r, const std::string & newcomment_r )
       {
-       if ( key_r.empty() )
-       {
-         WAR << "Empty key in write " << path_r << endl;
-         return false;
-       }
-
-       PathInfo pi( path_r );
-       if ( ! pi.isFile() )
-         ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(ENOENT) ) );
-       if ( ! pi.userMayRW() )
-         ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(EACCES) ) );
-
-       bool found = false;
-       filesystem::TmpFile tmpf( filesystem::TmpFile::makeSibling( path_r ) );
-       {
-         StrMatcher matches( "^[ \t]*"+key_r+"[ \t]*=", Match::REGEX );
-         std::ofstream o( tmpf.path().c_str() );
-         iostr::forEachLine( InputStream( path_r ),
-                             [&]( int num_r, std::string line_r )->bool
-                             {
-                               if ( !found && matches( line_r ) )
-                               {
-                                 o << key_r << '=' << val_r << endl;
-                                 found = true;
-                                 MIL << path_r << ": " << key_r << '=' << val_r << " changed on line " << num_r << endl;
-                               }
-                               else
-                                 o << line_r << endl;
-                               return true;
-                             } );
-         if ( !found )
-         {
-           if ( newcomment_r.empty() )
-           {
-             WAR << path_r << ": " << key_r << '=' << val_r << " can not be added (no comment provided)." << endl;
-           }
-           else
-           {
-             std::vector<std::string> lines;
-             str::split( newcomment_r, std::back_inserter(lines), "\r\n" );
-             o << endl;
-             for ( const std::string & line : lines )
-             {
-               if ( line[0] != '#' )
-                 o << "# ";
-               o << line << endl;
-             }
-             o << key_r << '=' << val_r << endl;
-             found = true;
-             MIL << path_r << ": " << key_r << '=' << val_r << " appended. " << endl;
-           }
-         }
-
-         if ( ! o )
-           ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(EIO) ) );
-       }
-
-       // If everything is fine, exchange the files:
-       int res = exchange( tmpf.path(), path_r );
-       if ( res )
-       {
-         ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(res) ) );
-       }
-       return found;
+        if ( key_r.empty() )
+        {
+          WAR << "Empty key in write " << path_r << endl;
+          return false;
+        }
+
+        PathInfo pi( path_r );
+        if ( ! pi.isFile() )
+          ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(ENOENT) ) );
+        if ( ! pi.userMayRW() )
+          ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(EACCES) ) );
+
+        bool found = false;
+        filesystem::TmpFile tmpf( filesystem::TmpFile::makeSibling( path_r ) );
+        {
+          StrMatcher matches( "^[ \t]*"+key_r+"[ \t]*=", Match::REGEX );
+          std::ofstream o( tmpf.path().c_str() );
+          iostr::forEachLine( InputStream( path_r ),
+                              [&]( int num_r, std::string line_r )->bool
+                              {
+                                if ( !found && matches( line_r ) )
+                                {
+                                  o << key_r << '=' << val_r << endl;
+                                  found = true;
+                                  MIL << path_r << ": " << key_r << '=' << val_r << " changed on line " << num_r << endl;
+                                }
+                                else
+                                  o << line_r << endl;
+                                return true;
+                              } );
+          if ( !found )
+          {
+            if ( newcomment_r.empty() )
+            {
+              WAR << path_r << ": " << key_r << '=' << val_r << " can not be added (no comment provided)." << endl;
+            }
+            else
+            {
+              std::vector<std::string> lines;
+              str::split( newcomment_r, std::back_inserter(lines), "\r\n" );
+              o << endl;
+              for ( const std::string & line : lines )
+              {
+                if ( line[0] != '#' )
+                  o << "# ";
+                o << line << endl;
+              }
+              o << key_r << '=' << val_r << endl;
+              found = true;
+              MIL << path_r << ": " << key_r << '=' << val_r << " appended. " << endl;
+            }
+          }
+
+          if ( ! o )
+            ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(EIO) ) );
+        }
+
+        // If everything is fine, exchange the files:
+        int res = exchange( tmpf.path(), path_r );
+        if ( res )
+        {
+          ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(res) ) );
+        }
+        return found;
       }
 
       bool writeStringVal( const Pathname & path_r, const std::string & key_r, const std::string & val_r, const std::string & newcomment_r )
       {
-       return write( path_r, key_r, str::Str() << '"' << str::escape( val_r, '"' )<< '"', newcomment_r );
+        return write( path_r, key_r, str::Str() << '"' << str::escape( val_r, '"' )<< '"', newcomment_r );
       }
 
     } // namespace sysconfig
index 39969fc..e10df58 100644 (file)
@@ -53,7 +53,7 @@ namespace zypp {
        * \endcode
        */
       bool write( const Pathname & path_r, const std::string & key_r, const std::string & val_r,
-                 const std::string & newcomment_r = std::string() );
+                  const std::string & newcomment_r = std::string() );
 
       /** Convenience to add or change a string-value in sysconfig file \a path_r.
        *
@@ -63,7 +63,7 @@ namespace zypp {
        * \see \ref write
        */
       bool writeStringVal( const Pathname & path_r, const std::string & key_r, const std::string & val_r,
-                          const std::string & newcomment_r = std::string() );
+                           const std::string & newcomment_r = std::string() );
 
     } // namespace sysconfig
   } // namespace base
index 7bd5ad8..71c8ac8 100644 (file)
@@ -55,7 +55,7 @@ namespace zypp
       case SKIP:        str << "SKIP";        break;
       case RETRY:       str << "RETRY";       break;
       case ABORT:       str << "ABORT";       break;
-       // no default !
+        // no default !
     }
     return str << " request: " << msg();
   }
index 3702a1d..815d8bd 100644 (file)
@@ -54,12 +54,12 @@ namespace zypp
     public:
       /** */
       WatchFile( const Pathname & path_r = Pathname(),
-                Initial mode            = INIT )
+                 Initial mode            = INIT )
       : _path( path_r )
       {
-       PathInfo pi( mode == INIT ? path_r : Pathname() );
-       _size  = pi.size();
-       _mtime = pi.mtime();
+        PathInfo pi( mode == INIT ? path_r : Pathname() );
+        _size  = pi.size();
+        _mtime = pi.mtime();
       }
 
       const Pathname & path() const
@@ -73,20 +73,20 @@ namespace zypp
 
       bool isDirty() const
       {
-       PathInfo pi( _path );
-       return( _size != pi.size() || _mtime != pi.mtime() );
+        PathInfo pi( _path );
+        return( _size != pi.size() || _mtime != pi.mtime() );
       }
 
       bool hasChanged()
       {
-       PathInfo pi( _path );
-       if ( _size != pi.size() || _mtime != pi.mtime() )
-       {
-         _size = pi.size();
-         _mtime = pi.mtime();
-         return true;
-       }
-       return false;
+        PathInfo pi( _path );
+        if ( _size != pi.size() || _mtime != pi.mtime() )
+        {
+          _size = pi.size();
+          _mtime = pi.mtime();
+          return true;
+        }
+        return false;
       }
 
     private:
index b148518..6015d19 100644 (file)
@@ -50,82 +50,82 @@ namespace zypp
       // -------------------------------------
       struct CredentialFileReaderImpl : public parser::IniParser
       {
-       typedef CredentialFileReader::ProcessCredentials ProcessCredentials;
+        typedef CredentialFileReader::ProcessCredentials ProcessCredentials;
 
-       struct StopParsing {};
+        struct StopParsing {};
 
-       CredentialFileReaderImpl( const Pathname & input_r, const ProcessCredentials & callback_r )
-       : _input( input_r )
-       , _callback( callback_r )
-       {
+        CredentialFileReaderImpl( const Pathname & input_r, const ProcessCredentials & callback_r )
+        : _input( input_r )
+        , _callback( callback_r )
+        {
           zypp::PathInfo pi( input_r );
           _lastChange = pi.mtime();
 
-         try
-         {
-           parse( input_r );
-         }
-         catch ( StopParsing )
-         { /* NO error but consumer aborted parsing */ }
-       }
-
-       // NO-OP; new sections are opened in consume()
-       virtual void beginParse()
-       { /*EMPTY*/ }
-
-       // start a new section [url]
-       virtual void consume( const std::string & section_r )
-       {
-         endParse();   // close any open section
-         _secret.reset( new AuthData );
-         try
-         {
-           _secret->setUrl( Url(section_r) );
-         }
-         catch ( const url::UrlException & )
-         {
-           ERR << "Ignore invalid URL '" << section_r << "' in file " << _input << endl;
-           _secret.reset();    // ignore this section
-         }
-       }
-
-       virtual void consume( const std::string & section_r, const std::string & key_r, const std::string & value_r )
-       {
-         if ( !_secret && section_r.empty() )
-           _secret.reset( new AuthData );      // a initial global section without [URL]
-
-         if ( _secret )
-         {
-           if ( key_r == "username" )
-             _secret->setUsername( value_r );
-           else if ( key_r == "password" )
-             _secret->setPassword( value_r );
-           else
-             WAR << "Ignore unknown attribute '" << key_r << "=" << value_r << "' in file " << _input << endl;
-         }
-         // else: ignored section due to wrong URL
-       }
-
-       // send any valid pending section
-       virtual void endParse()
-       {
-         if ( _secret )
-         {
-           if ( _secret->valid() )
-           {
+          try
+          {
+            parse( input_r );
+          }
+          catch ( StopParsing )
+          { /* NO error but consumer aborted parsing */ }
+        }
+
+        // NO-OP; new sections are opened in consume()
+        virtual void beginParse()
+        { /*EMPTY*/ }
+
+        // start a new section [url]
+        virtual void consume( const std::string & section_r )
+        {
+          endParse();  // close any open section
+          _secret.reset( new AuthData );
+          try
+          {
+            _secret->setUrl( Url(section_r) );
+          }
+          catch ( const url::UrlException & )
+          {
+            ERR << "Ignore invalid URL '" << section_r << "' in file " << _input << endl;
+            _secret.reset();   // ignore this section
+          }
+        }
+
+        virtual void consume( const std::string & section_r, const std::string & key_r, const std::string & value_r )
+        {
+          if ( !_secret && section_r.empty() )
+            _secret.reset( new AuthData );     // a initial global section without [URL]
+
+          if ( _secret )
+          {
+            if ( key_r == "username" )
+              _secret->setUsername( value_r );
+            else if ( key_r == "password" )
+              _secret->setPassword( value_r );
+            else
+              WAR << "Ignore unknown attribute '" << key_r << "=" << value_r << "' in file " << _input << endl;
+          }
+          // else: ignored section due to wrong URL
+        }
+
+        // send any valid pending section
+        virtual void endParse()
+        {
+          if ( _secret )
+          {
+            if ( _secret->valid() )
+            {
               _secret->setLastDatabaseUpdate( _lastChange );
-             if ( !_callback( _secret ) )
-               throw( StopParsing() );
-           }
-           else
-             ERR << "Ignore invalid credentials for URL '" << _secret->url() << "' in file " << _input << endl;
-         }
-       }
+              if ( !_callback( _secret ) )
+                throw( StopParsing() );
+            }
+            else
+              ERR << "Ignore invalid credentials for URL '" << _secret->url() << "' in file " << _input << endl;
+          }
+        }
 
       private:
-       const Pathname &                _input;
-       const ProcessCredentials &      _callback;
-       AuthData_Ptr                    _secret;
+        const Pathname &               _input;
+        const ProcessCredentials &     _callback;
+        AuthData_Ptr                   _secret;
         time_t                          _lastChange;
       };
     } // namespace
index 9884b6b..91173c8 100644 (file)
@@ -49,9 +49,9 @@ namespace zypp
   bool AuthDataComparator::operator()( const AuthData_Ptr & lhs, const AuthData_Ptr & rhs ) const
   {
     static const url::ViewOption vopt = url::ViewOption::DEFAULTS
-                                     - url::ViewOption::WITH_USERNAME
-                                     - url::ViewOption::WITH_PASSWORD
-                                     - url::ViewOption::WITH_QUERY_STR;
+                                      - url::ViewOption::WITH_USERNAME
+                                      - url::ViewOption::WITH_PASSWORD
+                                      - url::ViewOption::WITH_QUERY_STR;
     // std::less semantic!
     int cmp = lhs->url().asString(vopt).compare( rhs->url().asString(vopt) );
     if ( ! cmp )
index 2f2bdac..9adddc9 100644 (file)
@@ -30,7 +30,7 @@ namespace zypp
       // attempts to load .curlrc from the homedir
       char *home = getenv("HOME");
       if(home)
-       curlrcFile = std::string( home ) + std::string( "/.curlrc" );
+        curlrcFile = std::string( home ) + std::string( "/.curlrc" );
     }
     else
       curlrcFile = filename;
@@ -111,7 +111,7 @@ namespace zypp
         if (value[0] == '\"')
         {
           // remove the quotes
-         std::string::size_type pos = value.rfind('\"');
+          std::string::size_type pos = value.rfind('\"');
           bool cut_last =
             pos == value.size() - 1 && pos > 1 && value[pos-1] != '\\';
           value = value.substr(1,
@@ -119,7 +119,7 @@ namespace zypp
 
           // replace special characters:
           pos = 0;
-         while ((pos = value.find('\\', pos)) != std::string::npos)
+          while ((pos = value.find('\\', pos)) != std::string::npos)
           {
             // just erase the backslash if it is found at the end
             if (pos == value.size() - 1)
index 7814bf0..4fa91f1 100644 (file)
@@ -18,7 +18,7 @@ namespace zypp
   public:
     /**
      * Parse a curlrc file and store the result in the \a config structure.
-     * 
+     *
      * \param config   a CurlConfig structure
      * \param filename path to the curlrc file. If empty, ~/.curlrc is used.
      * \return         0 on success, 1 if problem occurs.
@@ -28,7 +28,7 @@ namespace zypp
     /**
      * Stores the \a value of the \a option in the \a config structure or
      * logs an unknown option.
-     * 
+     *
      * \return         0 on success, 1 if problem occurs.
      */
     static int setParameter(CurlConfig & config,
index 703ae45..816d7d1 100644 (file)
@@ -21,14 +21,14 @@ namespace zypp
     {
       inline int getZYPP_MEDIA_CURL_IPRESOLVE()
       {
-       int ret = 0;
-       if ( const char * envp = getenv( "ZYPP_MEDIA_CURL_IPRESOLVE" ) )
-       {
-         WAR << "env set: $ZYPP_MEDIA_CURL_IPRESOLVE='" << envp << "'" << std::endl;
-         if (      strcmp( envp, "4" ) == 0 )  ret = 4;
-         else if ( strcmp( envp, "6" ) == 0 )  ret = 6;
-       }
-         return ret;
+        int ret = 0;
+        if ( const char * envp = getenv( "ZYPP_MEDIA_CURL_IPRESOLVE" ) )
+        {
+          WAR << "env set: $ZYPP_MEDIA_CURL_IPRESOLVE='" << envp << "'" << std::endl;
+          if (      strcmp( envp, "4" ) == 0 ) ret = 4;
+          else if ( strcmp( envp, "6" ) == 0 ) ret = 6;
+        }
+          return ret;
       }
     } //namespace
 
@@ -77,7 +77,7 @@ int log_curl(CURL *curl, curl_infotype info,
     if ( str::startsWith( line, "Authorization:" ) ) {
       std::string::size_type pos { line.find( " ", 15 ) }; // Authorization: <type> <credentials>
       if ( pos == std::string::npos )
-       pos = 15;
+        pos = 15;
       DBG << pfx << " " << line.substr( 0, pos ) << " <credentials removed>" << std::endl;
     }
     else
index ebda74c..cb9dc2c 100644 (file)
@@ -37,7 +37,7 @@ namespace zypp
     {
       long ret = 0L;
       if ( char *ptr = ::getenv("ZYPP_MEDIA_CURL_DEBUG"); ptr && *ptr )
-       str::strtonum( ptr, ret );
+        str::strtonum( ptr, ret );
       return ret;
     }
 
index 2a29049..a7e52b6 100644 (file)
@@ -91,7 +91,7 @@ MediaBlockList::setChecksum(size_t blkno, std::string cstype, int csl, unsigned
   if (!chksumlen)
     {
       if (blkno)
-       return;
+        return;
       chksumlen = csl;
       chksumtype = cstype;
       chksumpad = cspad;
@@ -110,7 +110,7 @@ MediaBlockList::setRsum(size_t blkno, int rsl, unsigned int rs, size_t rspad)
   if (!rsumlen)
     {
       if (blkno)
-       return;
+        return;
       rsumlen = rsl;
       rsumpad = rspad;
     }
@@ -309,27 +309,27 @@ MediaBlockList::reuseBlocks(FILE *wfp, std::string filename)
     {
       size_t blksize = blocks[0].size;
       if (nblks == 1 && rsumpad && rsumpad > blksize)
-       blksize = rsumpad;
+        blksize = rsumpad;
       // create hash of checksums
       unsigned int hm = rsums.size() * 2;
       while (hm & (hm - 1))
-       hm &= hm - 1;
+        hm &= hm - 1;
       hm = hm * 2 - 1;
       if (hm < 16383)
-       hm = 16383;
+        hm = 16383;
       unsigned int *ht = new unsigned int[hm + 1];
       memset(ht, 0, (hm + 1) * sizeof(unsigned int));
       for (unsigned int i = 0; i < rsums.size(); i++)
-       {
-         if (blocks[i].size != blksize && (i != nblks - 1 || rsumpad != blksize))
-           continue;
-         unsigned int r = rsums[i];
-         unsigned int h = r & hm;
-         unsigned int hh = 7;
-         while (ht[h])
-           h = (h + hh++) & hm;
-         ht[h] = i + 1;
-       }
+        {
+          if (blocks[i].size != blksize && (i != nblks - 1 || rsumpad != blksize))
+            continue;
+          unsigned int r = rsums[i];
+          unsigned int h = r & hm;
+          unsigned int hh = 7;
+          while (ht[h])
+            h = (h + hh++) & hm;
+          ht[h] = i + 1;
+        }
 
       unsigned char *buf = new unsigned char[blksize];
       unsigned char *buf2 = new unsigned char[blksize];
@@ -337,8 +337,8 @@ MediaBlockList::reuseBlocks(FILE *wfp, std::string filename)
       unsigned char *pushbackp = 0;
       int bshift = 0;
       if ((blksize & (blksize - 1)) == 0)
-       for (bshift = 0; size_t(1 << bshift) != blksize; bshift++)
-         ;
+        for (bshift = 0; size_t(1 << bshift) != blksize; bshift++)
+          ;
       unsigned short a, b;
       a = b = 0;
       memset(buf, 0, blksize);
@@ -346,104 +346,104 @@ MediaBlockList::reuseBlocks(FILE *wfp, std::string filename)
       bool init = 1;
       int sql = nblks > 1 && chksumlen < 16 ? 2 : 1;
       while (!eof)
-       {
-         for (size_t i = 0; i < blksize; i++)
-           {
-             int c;
-             if (eof)
-               c = 0;
-             else
-               {
-                  if (pushback)
-                   {
-                     c = *pushbackp++;
-                     pushback--;
-                   }
-                 else
-                   c = getc(fp);
-                 if (c == EOF)
-                   {
-                     eof = true;
-                     c = 0;
-                     if (!i || sql == 2)
-                       break;
-                   }
-               }
-             int oc = buf[i];
-             buf[i] = c;
-             a += c - oc;
-             if (bshift)
-               b += a - (oc << bshift);
-             else
-               b += a - oc * blksize;
-             if (init)
-               {
-                 if (size_t(i) != blksize - 1)
-                   continue;
-                 init = 0;
-               }
-             unsigned int r;
-             if (rsumlen == 1)
-               r = ((unsigned int)b & 255);
-             else if (rsumlen == 2)
-               r = ((unsigned int)b & 65535);
-             else if (rsumlen == 3)
-               r = ((unsigned int)a & 255) << 16 | ((unsigned int)b & 65535);
-             else
-               r = ((unsigned int)a & 65535) << 16 | ((unsigned int)b & 65535);
-             unsigned int h = r & hm;
-             unsigned int hh = 7;
-             for (; ht[h]; h = (h + hh++) & hm)
-               {
-                 size_t blkno = ht[h] - 1;
-                 if (rsums[blkno] != r)
-                   continue;
-                 if (found[blkno])
-                   continue;
-                 if (sql == 2)
-                   {
-                     if (eof || blkno + 1 >= nblks)
-                       continue;
-                     pushback = fetchnext(fp, buf2, blksize, pushback, pushbackp);
-                     pushbackp = buf2;
-                     if (!pushback)
-                       continue;
-                     if (!checkRsum(blkno + 1, buf2, blksize))
-                       continue;
-                   }
-                 if (!checkChecksumRotated(blkno, buf, blksize, i + 1))
-                   continue;
-                 if (sql == 2 && !checkChecksum(blkno + 1, buf2, blksize))
-                   continue;
-                 writeBlock(blkno, wfp, buf, blksize, i + 1, found);
-                 if (sql == 2)
-                   {
-                     writeBlock(blkno + 1, wfp, buf2, blksize, 0, found);
-                     pushback = 0;
-                     blkno++;
-                   }
-                 while (!eof)
-                   {
-                     blkno++;
-                     pushback = fetchnext(fp, buf2, blksize, pushback, pushbackp);
-                     pushbackp = buf2;
-                     if (!pushback)
-                       break;
-                     if (!checkRsum(blkno, buf2, blksize))
-                       break;
-                     if (!checkChecksum(blkno, buf2, blksize))
-                       break;
-                     writeBlock(blkno, wfp, buf2, blksize, 0, found);
-                     pushback = 0;
-                   }
-                 init = false;
-                 memset(buf, 0, blksize);
-                 a = b = 0;
-                 i = size_t(-1);       // start with 0 on next iteration
-                 break;
-               }
-           }
-       }
+        {
+          for (size_t i = 0; i < blksize; i++)
+            {
+              int c;
+              if (eof)
+                c = 0;
+              else
+                {
+                   if (pushback)
+                    {
+                      c = *pushbackp++;
+                      pushback--;
+                    }
+                  else
+                    c = getc(fp);
+                  if (c == EOF)
+                    {
+                      eof = true;
+                      c = 0;
+                      if (!i || sql == 2)
+                        break;
+                    }
+                }
+              int oc = buf[i];
+              buf[i] = c;
+              a += c - oc;
+              if (bshift)
+                b += a - (oc << bshift);
+              else
+                b += a - oc * blksize;
+              if (init)
+                {
+                  if (size_t(i) != blksize - 1)
+                    continue;
+                  init = 0;
+                }
+              unsigned int r;
+              if (rsumlen == 1)
+                r = ((unsigned int)b & 255);
+              else if (rsumlen == 2)
+                r = ((unsigned int)b & 65535);
+              else if (rsumlen == 3)
+                r = ((unsigned int)a & 255) << 16 | ((unsigned int)b & 65535);
+              else
+                r = ((unsigned int)a & 65535) << 16 | ((unsigned int)b & 65535);
+              unsigned int h = r & hm;
+              unsigned int hh = 7;
+              for (; ht[h]; h = (h + hh++) & hm)
+                {
+                  size_t blkno = ht[h] - 1;
+                  if (rsums[blkno] != r)
+                    continue;
+                  if (found[blkno])
+                    continue;
+                  if (sql == 2)
+                    {
+                      if (eof || blkno + 1 >= nblks)
+                        continue;
+                      pushback = fetchnext(fp, buf2, blksize, pushback, pushbackp);
+                      pushbackp = buf2;
+                      if (!pushback)
+                        continue;
+                      if (!checkRsum(blkno + 1, buf2, blksize))
+                        continue;
+                    }
+                  if (!checkChecksumRotated(blkno, buf, blksize, i + 1))
+                    continue;
+                  if (sql == 2 && !checkChecksum(blkno + 1, buf2, blksize))
+                    continue;
+                  writeBlock(blkno, wfp, buf, blksize, i + 1, found);
+                  if (sql == 2)
+                    {
+                      writeBlock(blkno + 1, wfp, buf2, blksize, 0, found);
+                      pushback = 0;
+                      blkno++;
+                    }
+                  while (!eof)
+                    {
+                      blkno++;
+                      pushback = fetchnext(fp, buf2, blksize, pushback, pushbackp);
+                      pushbackp = buf2;
+                      if (!pushback)
+                        break;
+                      if (!checkRsum(blkno, buf2, blksize))
+                        break;
+                      if (!checkChecksum(blkno, buf2, blksize))
+                        break;
+                      writeBlock(blkno, wfp, buf2, blksize, 0, found);
+                      pushback = 0;
+                    }
+                  init = false;
+                  memset(buf, 0, blksize);
+                  a = b = 0;
+                  i = size_t(-1);      // start with 0 on next iteration
+                  break;
+                }
+            }
+        }
       delete[] buf2;
       delete[] buf;
       delete[] ht;
@@ -455,31 +455,31 @@ MediaBlockList::reuseBlocks(FILE *wfp, std::string filename)
       off_t off = 0;
       unsigned char *buf = new unsigned char[bufl];
       for (size_t blkno = 0; blkno < blocks.size(); ++blkno)
-       {
-         if (off > blocks[blkno].off)
-           continue;
-         size_t blksize = blocks[blkno].size;
-         if (blksize > bufl)
-           {
-             delete[] buf;
-             bufl = blksize;
+        {
+          if (off > blocks[blkno].off)
+            continue;
+          size_t blksize = blocks[blkno].size;
+          if (blksize > bufl)
+            {
+              delete[] buf;
+              bufl = blksize;
               buf = new unsigned char[bufl];
-           }
-         size_t skip = blocks[blkno].off - off;
-         while (skip)
-           {
-             size_t l = skip > bufl ? bufl : skip;
-             if (fread(buf, l, 1, fp) != 1)
-               break;
-             skip -= l;
-             off += l;
-           }
-         if (fread(buf, blksize, 1, fp) != 1)
-           break;
-         if (checkChecksum(blkno, buf, blksize))
-           writeBlock(blkno, wfp, buf, blksize, 0, found);
-         off += blksize;
-       }
+            }
+          size_t skip = blocks[blkno].off - off;
+          while (skip)
+            {
+              size_t l = skip > bufl ? bufl : skip;
+              if (fread(buf, l, 1, fp) != 1)
+                break;
+              skip -= l;
+              off += l;
+            }
+          if (fread(buf, blksize, 1, fp) != 1)
+            break;
+          if (checkChecksum(blkno, buf, blksize))
+            writeBlock(blkno, wfp, buf, blksize, 0, found);
+          off += blksize;
+        }
     }
   if (!found[nblks])
     return;
@@ -491,17 +491,17 @@ MediaBlockList::reuseBlocks(FILE *wfp, std::string filename)
   for (size_t blkno = 0; blkno < blocks.size(); ++blkno)
     {
       if (!found[blkno])
-       {
-         // still need it
-         nblocks.push_back(blocks[blkno]);
-         if (chksumlen && (blkno + 1) * chksumlen <= chksums.size())
-           {
-             nchksums.resize(nblocks.size() * chksumlen);
-             memcpy(&nchksums[(nblocks.size() - 1) * chksumlen], &chksums[blkno * chksumlen], chksumlen);
-           }
-         if (rsumlen && (blkno + 1) <= rsums.size())
-           nrsums.push_back(rsums[blkno]);
-       }
+        {
+          // still need it
+          nblocks.push_back(blocks[blkno]);
+          if (chksumlen && (blkno + 1) * chksumlen <= chksums.size())
+            {
+              nchksums.resize(nblocks.size() * chksumlen);
+              memcpy(&nchksums[(nblocks.size() - 1) * chksumlen], &chksums[blkno * chksumlen], chksumlen);
+            }
+          if (rsumlen && (blkno + 1) <= rsums.size())
+            nrsums.push_back(rsums[blkno]);
+        }
     }
   blocks = nblocks;
   chksums = nchksums;
@@ -533,16 +533,16 @@ MediaBlockList::asString() const
       long long size=blocks[i].size;
       s += zypp::str::form("  (%8lld, %8lld)", off, size);
       if (chksumlen && chksums.size() >= (i + 1) * chksumlen)
-       {
-         s += "  " + chksumtype + ":";
-         for (j = 0; j < size_t(chksumlen); j++)
-           s += zypp::str::form("%02hhx", chksums[i * chksumlen + j]);
-       }
+        {
+          s += "  " + chksumtype + ":";
+          for (j = 0; j < size_t(chksumlen); j++)
+            s += zypp::str::form("%02hhx", chksums[i * chksumlen + j]);
+        }
       if (rsumlen && rsums.size() > i)
-       {
-         s += "  RSUM:";
-         s += zypp::str::form("%0*x", 2 * rsumlen, rsums[i]);
-       }
+        {
+          s += "  RSUM:";
+          s += zypp::str::form("%0*x", 2 * rsumlen, rsums[i]);
+        }
       s += "\n";
     }
   s += "]";
index fce1c6e..62ba549 100644 (file)
@@ -64,69 +64,69 @@ namespace zypp
       //////////////////////////////////////////////////////////////////
       DeviceList systemDetectDevices( bool supportingDVD_r )
       {
-       DeviceList detected;
+        DeviceList detected;
 
 #ifdef HAVE_UDEV
-       // http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/index.html
-       zypp::AutoDispose<struct udev *> udev( ::udev_new(), ::udev_unref );
-       if ( ! udev )
-       {
-         ERR << "Can't create udev context." << endl;
-         return DeviceList();
-       }
-
-       zypp::AutoDispose<struct udev_enumerate *> enumerate( ::udev_enumerate_new(udev), ::udev_enumerate_unref );
-       if ( ! enumerate )
-       {
-         ERR << "Can't create udev list entry." << endl;
-         return DeviceList();
-       }
-
-       ::udev_enumerate_add_match_subsystem( enumerate, "block" );
-       ::udev_enumerate_add_match_property( enumerate, "ID_CDROM", "1" );
-       ::udev_enumerate_scan_devices( enumerate );
-
-       struct udev_list_entry * entry = 0;
-       udev_list_entry_foreach( entry, ::udev_enumerate_get_list_entry( enumerate ) )
-       {
-         zypp::AutoDispose<struct udev_device *> device( ::udev_device_new_from_syspath( ::udev_enumerate_get_udev( enumerate ),
-                                                                                         ::udev_list_entry_get_name( entry ) ),
-                                                         ::udev_device_unref );
-         if ( ! device )
-         {
-           ERR << "Can't create udev device." << endl;
-           continue;
-         }
-
-         if ( supportingDVD_r && ! ::udev_device_get_property_value( device, "ID_CDROM_DVD" ) )
-         {
-           continue;   // looking for dvd only
-         }
-
-         const char * devnodePtr( ::udev_device_get_devnode( device ) );
-         if ( ! devnodePtr )
-         {
-           ERR << "Got NULL devicenode." << endl;
-           continue;
-         }
-
-         // In case we need it someday:
-         //const char * mountpath = ::udev_device_get_property_value( device, "FSTAB_DIR" );
-
-         PathInfo devnode( devnodePtr );
-         if ( devnode.isBlk() )
-         {
-           MediaSource media( "cdrom", devnode.path().asString(), devnode.devMajor(), devnode.devMinor() );
-           DBG << "Found (udev): " << media << std::endl;
-           detected.push_back( media );
-         }
-       }
-       if ( detected.empty() )
-       {
-         WAR << "Did not find any CD/DVD device." << endl;
-       }
+        // http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/index.html
+        zypp::AutoDispose<struct udev *> udev( ::udev_new(), ::udev_unref );
+        if ( ! udev )
+        {
+          ERR << "Can't create udev context." << endl;
+          return DeviceList();
+        }
+
+        zypp::AutoDispose<struct udev_enumerate *> enumerate( ::udev_enumerate_new(udev), ::udev_enumerate_unref );
+        if ( ! enumerate )
+        {
+          ERR << "Can't create udev list entry." << endl;
+          return DeviceList();
+        }
+
+        ::udev_enumerate_add_match_subsystem( enumerate, "block" );
+        ::udev_enumerate_add_match_property( enumerate, "ID_CDROM", "1" );
+        ::udev_enumerate_scan_devices( enumerate );
+
+        struct udev_list_entry * entry = 0;
+        udev_list_entry_foreach( entry, ::udev_enumerate_get_list_entry( enumerate ) )
+        {
+          zypp::AutoDispose<struct udev_device *> device( ::udev_device_new_from_syspath( ::udev_enumerate_get_udev( enumerate ),
+                                                                                          ::udev_list_entry_get_name( entry ) ),
+                                                          ::udev_device_unref );
+          if ( ! device )
+          {
+            ERR << "Can't create udev device." << endl;
+            continue;
+          }
+
+          if ( supportingDVD_r && ! ::udev_device_get_property_value( device, "ID_CDROM_DVD" ) )
+          {
+            continue;  // looking for dvd only
+          }
+
+          const char * devnodePtr( ::udev_device_get_devnode( device ) );
+          if ( ! devnodePtr )
+          {
+            ERR << "Got NULL devicenode." << endl;
+            continue;
+          }
+
+          // In case we need it someday:
+          //const char * mountpath = ::udev_device_get_property_value( device, "FSTAB_DIR" );
+
+          PathInfo devnode( devnodePtr );
+          if ( devnode.isBlk() )
+          {
+            MediaSource media( "cdrom", devnode.path().asString(), devnode.devMajor(), devnode.devMinor() );
+            DBG << "Found (udev): " << media << std::endl;
+            detected.push_back( media );
+          }
+        }
+        if ( detected.empty() )
+        {
+          WAR << "Did not find any CD/DVD device." << endl;
+        }
 #endif
-       return detected;
+        return detected;
       }
 
     } // namespace
@@ -153,12 +153,12 @@ namespace zypp
       str::split( devices, std::back_inserter(words), "," );
       for ( const std::string & device : words )
       {
-       if ( device.empty() )
-         continue;
+        if ( device.empty() )
+          continue;
 
-       MediaSource media( "cdrom", device, 0, 0 );
-       _devices.push_back( media );
-       DBG << "use device (delayed verify)" << device << endl;
+        MediaSource media( "cdrom", device, 0, 0 );
+        _devices.push_back( media );
+        DBG << "use device (delayed verify)" << device << endl;
       }
     }
     else
@@ -268,16 +268,16 @@ namespace zypp
       PathInfo cdrinfo( "/dev/cdrom" );
       if ( dvdinfo.isBlk() )
       {
-       MediaSource media( "cdrom", dvdinfo.path().asString(), dvdinfo.devMajor(), dvdinfo.devMinor() );
-       DBG << "Found (GUESS): " << media << std::endl;
-       detected.push_back( media );
+        MediaSource media( "cdrom", dvdinfo.path().asString(), dvdinfo.devMajor(), dvdinfo.devMinor() );
+        DBG << "Found (GUESS): " << media << std::endl;
+        detected.push_back( media );
       }
       if ( cdrinfo.isBlk()
-       && ! ( cdrinfo.devMajor() == dvdinfo.devMajor() && cdrinfo.devMinor() == dvdinfo.devMinor() ) )
+        && ! ( cdrinfo.devMajor() == dvdinfo.devMajor() && cdrinfo.devMinor() == dvdinfo.devMinor() ) )
       {
-       MediaSource media( "cdrom", cdrinfo.path().asString(), cdrinfo.devMajor(), cdrinfo.devMinor() );
-       DBG << "Found (GUESS): " << media << std::endl;
-       detected.push_back( media );
+        MediaSource media( "cdrom", cdrinfo.path().asString(), cdrinfo.devMajor(), cdrinfo.devMinor() );
+        DBG << "Found (GUESS): " << media << std::endl;
+        detected.push_back( media );
       }
     }
 
@@ -297,27 +297,27 @@ namespace zypp
       PathInfo dinfo( device );
       if ( dinfo.isBlk() )
       {
-       MediaSource media( "cdrom", device, dinfo.devMajor(), dinfo.devMinor() );
-       if ( detected.empty() )
-       {
-         _devices.push_front( media ); // better try this than nothing
-       }
-       else
-       {
-         for( const auto & d : detected )
-         {
-           // /dev/cdrom or /dev/dvd to the front
-           if ( media.equals( d ) )
-             _devices.push_front( d );
-           else
-             _devices.push_back( d );
-         }
-       }
+        MediaSource media( "cdrom", device, dinfo.devMajor(), dinfo.devMinor() );
+        if ( detected.empty() )
+        {
+          _devices.push_front( media );        // better try this than nothing
+        }
+        else
+        {
+          for( const auto & d : detected )
+          {
+            // /dev/cdrom or /dev/dvd to the front
+            if ( media.equals( d ) )
+              _devices.push_front( d );
+            else
+              _devices.push_back( d );
+          }
+        }
       }
       else
       {
-       // no /dev/cdrom or /dev/dvd link
-       _devices = detected;
+        // no /dev/cdrom or /dev/dvd link
+        _devices = detected;
       }
     }
 
@@ -381,8 +381,8 @@ namespace zypp
       PathInfo dinfo( temp.name );
       if ( ! dinfo.isBlk() )
       {
-       WAR <<  "skipping non block device: " << dinfo << endl;
-       continue;
+        WAR <<  "skipping non block device: " << dinfo << endl;
+        continue;
       }
       DBG << "trying device " << dinfo << endl;
 
@@ -459,11 +459,11 @@ namespace zypp
       {
         try
         {
-         if( !isUseableAttachPoint( attachPoint() ) )
-         {
-           setAttachPoint( createAttachPoint(), true );
-           mountpoint = attachPoint().asString();
-         }
+          if( !isUseableAttachPoint( attachPoint() ) )
+          {
+            setAttachPoint( createAttachPoint(), true );
+            mountpoint = attachPoint().asString();
+          }
 
           mount.mount(it->name, mountpoint, *fsit, options);
 
@@ -474,7 +474,7 @@ namespace zypp
           int limit = 2;
           while( !(mountsucceeded=isAttached()) && --limit)
           {
-           WAR << "Wait for /proc/mounts update and retry...." << endl;
+            WAR << "Wait for /proc/mounts update and retry...." << endl;
             sleep(1);
           }
 
@@ -599,16 +599,16 @@ namespace zypp
         if ( media->name != ejectDev_r )
           continue;
 
-       // bnc#755815: _devices contains either devices passed as url option
-       //      or autodetected ones. Accept both as long as they are block
-       //      devices.
-       PathInfo dinfo( media->name );
-       if( ! dinfo.isBlk() )
-       {
-         WAR <<  "skipping non block device: " << dinfo << endl;
-         continue;
-       }
-       DBG << "trying device " << dinfo << endl;
+        // bnc#755815: _devices contains either devices passed as url option
+        //     or autodetected ones. Accept both as long as they are block
+        //     devices.
+        PathInfo dinfo( media->name );
+        if( ! dinfo.isBlk() )
+        {
+          WAR <<  "skipping non block device: " << dinfo << endl;
+          continue;
+        }
+        DBG << "trying device " << dinfo << endl;
 
         // FIXME: we have also to check if it is mounted in the system
         AttachedMedia ret( findAttachedMedia( media));
index a328046..6232ece 100644 (file)
@@ -39,14 +39,14 @@ namespace zypp {
         static bool openTray( const std::string & device_r );
         static bool closeTray( const std::string & device_r );
 
-       DeviceList  detectDevices(bool supportingDVD) const;
+        DeviceList  detectDevices(bool supportingDVD) const;
 
       protected:
 
-       virtual void attachTo (bool next = false) override;
+        virtual void attachTo (bool next = false) override;
         virtual void releaseFrom( const std::string & ejectDev ) override;
-       virtual void getFile(const OnMediaLocation & file) const override;
-       virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
+        virtual void getFile(const OnMediaLocation & file) const override;
+        virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
         virtual void getDirInfo( std::list<std::string> & retlist,
                                  const Pathname & dirname, bool dots = true ) const override;
         virtual void getDirInfo( filesystem::DirContent & retlist,
@@ -64,11 +64,11 @@ namespace zypp {
       public:
 
         MediaCD( const Url &      url_r,
-                const Pathname & attach_point_hint_r );
+                 const Pathname & attach_point_hint_r );
 
         virtual ~MediaCD() override { try { release(); } catch(...) {} }
 
-       virtual bool isAttached() const override;
+        virtual bool isAttached() const override;
     };
 
 ///////////////////////////////////////////////////////////////////
index 41f1900..0246914 100644 (file)
@@ -99,12 +99,12 @@ namespace zypp {
     // DESCRIPTION :
     //
     MediaCIFS::MediaCIFS( const Url &      url_r,
-                       const Pathname & attach_point_hint_r )
+                        const Pathname & attach_point_hint_r )
         : MediaHandler( url_r, attach_point_hint_r,
-                   stripShare( url_r.getPathName() ), // urlpath WITHOUT share name at attachpoint
-                   false )       // does_download
+                    stripShare( url_r.getPathName() ), // urlpath WITHOUT share name at attachpoint
+                    false )       // does_download
     {
-       MIL << "MediaCIFS::MediaCIFS(" << url_r << ", " << attach_point_hint_r << ")" << endl;
+        MIL << "MediaCIFS::MediaCIFS(" << url_r << ", " << attach_point_hint_r << ")" << endl;
     }
 
     ///////////////////////////////////////////////////////////////////
@@ -129,9 +129,9 @@ namespace zypp {
     void MediaCIFS::attachTo(bool next)
     {
       if(_url.getHost().empty())
-       ZYPP_THROW(MediaBadUrlEmptyHostException(_url));
+        ZYPP_THROW(MediaBadUrlEmptyHostException(_url));
       if(next)
-       ZYPP_THROW(MediaNotSupportedException(_url));
+        ZYPP_THROW(MediaNotSupportedException(_url));
 
       std::string path = "//";
       path += _url.getHost() + "/" + getShare( _url.getPathName() );
@@ -140,24 +140,24 @@ namespace zypp {
       AttachedMedia  ret( findAttachedMedia( media));
 
       if( ret.mediaSource &&
-         ret.attachPoint &&
-         !ret.attachPoint->empty())
+          ret.attachPoint &&
+          !ret.attachPoint->empty())
       {
-       DBG << "Using a shared media "
-           << ret.mediaSource->name
-           << " attached on "
-           << ret.attachPoint->path
-           << endl;
-
-       removeAttachPoint();
-       setAttachPoint(ret.attachPoint);
-       setMediaSource(ret.mediaSource);
-       return;
+        DBG << "Using a shared media "
+            << ret.mediaSource->name
+            << " attached on "
+            << ret.attachPoint->path
+            << endl;
+
+        removeAttachPoint();
+        setAttachPoint(ret.attachPoint);
+        setMediaSource(ret.mediaSource);
+        return;
       }
 
       if( !isUseableAttachPoint( attachPoint() ) )
       {
-       setAttachPoint( createAttachPoint(), true );
+        setAttachPoint( createAttachPoint(), true );
       }
       std::string mountpoint( attachPoint().asString() );
 
@@ -376,7 +376,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaCIFS::getDirInfo( std::list<std::string> & retlist,
-                              const Pathname & dirname, bool dots ) const
+                               const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
@@ -390,7 +390,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaCIFS::getDirInfo( filesystem::DirContent & retlist,
-                              const Pathname & dirname, bool dots ) const
+                               const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
index 755927e..9fbd44b 100644 (file)
@@ -45,7 +45,7 @@ namespace zypp {
 
     public:
       MediaCIFS( const Url&       url_r,
-               const Pathname & attach_point_hint_r );
+                const Pathname & attach_point_hint_r );
 
       virtual ~MediaCIFS() override { try { release(); } catch(...) {} }
 
index b366fc1..102799e 100644 (file)
@@ -66,8 +66,8 @@ Pathname MediaCurl::_cookieFile = "/var/lib/YaST2/cookies";
 MediaCurl::MediaCurl( const Url &      url_r,
                       const Pathname & attach_point_hint_r )
     : MediaNetworkCommonHandler( url_r, attach_point_hint_r,
-                                "/", // urlpath at attachpoint
-                                true ), // does_download
+                                 "/", // urlpath at attachpoint
+                                 true ), // does_download
       _curl( NULL ),
       _customHeaders(0L)
 {
@@ -295,7 +295,7 @@ void MediaCurl::setupEasy()
     if( auth != CURLAUTH_NONE)
     {
       DBG << "Enabling HTTP authentication methods: " << use_auth
-         << " (CURLOPT_HTTPAUTH=" << auth << ")" << std::endl;
+          << " (CURLOPT_HTTPAUTH=" << auth << ")" << std::endl;
       SET_OPTION(CURLOPT_HTTPAUTH, auth);
     }
   }
@@ -319,11 +319,11 @@ void MediaCurl::setupEasy()
       CurlConfig curlconf;
       CurlConfig::parseConfig(curlconf); // parse ~/.curlrc
       if ( curlconf.proxyuserpwd.empty() )
-       DBG << "Proxy: ~/.curlrc does not contain the proxy-user option" << endl;
+        DBG << "Proxy: ~/.curlrc does not contain the proxy-user option" << endl;
       else
       {
-       proxyuserpwd = curlconf.proxyuserpwd;
-       DBG << "Proxy: using proxy-user from ~/.curlrc" << endl;
+        proxyuserpwd = curlconf.proxyuserpwd;
+        DBG << "Proxy: using proxy-user from ~/.curlrc" << endl;
       }
     }
     else
@@ -520,9 +520,9 @@ void MediaCurl::getFileCopy( const OnMediaLocation & srcFile , const Pathname &
     {
       media::DownloadProgressReport::Error reason = media::DownloadProgressReport::ERROR;
       if( typeid(excpt_r) == typeid( media::MediaFileNotFoundException )  ||
-         typeid(excpt_r) == typeid( media::MediaNotAFileException ) )
+          typeid(excpt_r) == typeid( media::MediaNotAFileException ) )
       {
-       reason = media::DownloadProgressReport::NOT_FOUND;
+        reason = media::DownloadProgressReport::NOT_FOUND;
       }
       report->finish(fileurl, reason, excpt_r.asUserHistory());
       ZYPP_RETHROW(excpt_r);
@@ -583,14 +583,14 @@ void MediaCurl::evaluateCurlCode(const Pathname &filename,
       switch ( code )
       {
       case CURLE_UNSUPPORTED_PROTOCOL:
-         err = " Unsupported protocol";
-         if ( !_lastRedirect.empty() )
-         {
-           err += " or redirect (";
-           err += _lastRedirect;
-           err += ")";
-         }
-         break;
+          err = " Unsupported protocol";
+          if ( !_lastRedirect.empty() )
+          {
+            err += " or redirect (";
+            err += _lastRedirect;
+            err += ")";
+          }
+          break;
       case CURLE_URL_MALFORMAT:
       case CURLE_URL_MALFORMAT_USER:
           err = " Bad URL";
@@ -630,9 +630,9 @@ void MediaCurl::evaluateCurlCode(const Pathname &filename,
           case 403:
           {
             std::string msg403;
-           if ( url.getHost().find(".suse.com") != std::string::npos )
-             msg403 = _("Visit the SUSE Customer Center to check whether your registration is valid and has not expired.");
-           else if (url.asString().find("novell.com") != std::string::npos)
+            if ( url.getHost().find(".suse.com") != std::string::npos )
+              msg403 = _("Visit the SUSE Customer Center to check whether your registration is valid and has not expired.");
+            else if (url.asString().find("novell.com") != std::string::npos)
               msg403 = _("Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
             ZYPP_THROW(MediaForbiddenException(url, msg403));
           }
@@ -676,8 +676,8 @@ void MediaCurl::evaluateCurlCode(const Pathname &filename,
         break;
       case CURLE_PARTIAL_FILE:
       case CURLE_OPERATION_TIMEDOUT:
-       timeout_reached = true; // fall though to TimeoutException
-       // fall though...
+        timeout_reached        = true; // fall though to TimeoutException
+        // fall though...
       case CURLE_ABORTED_BY_CALLBACK:
          if( timeout_reached )
         {
@@ -867,8 +867,8 @@ bool MediaCurl::detectDirIndex() const
   bool      not_a_file = false;
   char     *ptr = NULL;
   CURLcode  ret = curl_easy_getinfo( _curl,
-                                    CURLINFO_EFFECTIVE_URL,
-                                    &ptr);
+                                     CURLINFO_EFFECTIVE_URL,
+                                     &ptr);
   if ( ret == CURLE_OK && ptr != NULL)
   {
     try
@@ -877,11 +877,11 @@ bool MediaCurl::detectDirIndex() const
       std::string path( eurl.getPathName());
       if( !path.empty() && path != "/" && *path.rbegin() == '/')
       {
-       DBG << "Effective url ("
-           << eurl
-           << ") seems to provide the index of a directory"
-           << endl;
-       not_a_file = true;
+        DBG << "Effective url ("
+            << eurl
+            << ") seems to provide the index of a directory"
+            << endl;
+        not_a_file = true;
       }
     }
     catch( ... )
@@ -908,23 +908,23 @@ void MediaCurl::doGetFileCopy( const OnMediaLocation &srcFile , const Pathname &
       AutoFREE<char> buf { ::strdup( (*destNew).c_str() ) };
       if( ! buf )
       {
-       ERR << "out of memory for temp file name" << endl;
-       ZYPP_THROW(MediaSystemException(getFileUrl(srcFile.filename()), "out of memory for temp file name"));
+        ERR << "out of memory for temp file name" << endl;
+        ZYPP_THROW(MediaSystemException(getFileUrl(srcFile.filename()), "out of memory for temp file name"));
       }
 
       AutoFD tmp_fd { ::mkostemp( buf, O_CLOEXEC ) };
       if( tmp_fd == -1 )
       {
-       ERR << "mkstemp failed for file '" << destNew << "'" << endl;
-       ZYPP_THROW(MediaWriteException(destNew));
+        ERR << "mkstemp failed for file '" << destNew << "'" << endl;
+        ZYPP_THROW(MediaWriteException(destNew));
       }
       destNew = ManagedFile( (*buf), filesystem::unlink );
 
       file = ::fdopen( tmp_fd, "we" );
       if ( ! file )
       {
-       ERR << "fopen failed for file '" << destNew << "'" << endl;
-       ZYPP_THROW(MediaWriteException(destNew));
+        ERR << "fopen failed for file '" << destNew << "'" << endl;
+        ZYPP_THROW(MediaWriteException(destNew));
       }
       tmp_fd.resetDispose();   // don't close it here! ::fdopen moved ownership to file
     }
@@ -1062,14 +1062,14 @@ void MediaCurl::doGetFileCopyFile( const OnMediaLocation & srcFile, const Pathna
       long httpReturnCode = 33;
       if ( curl_easy_getinfo( _curl, CURLINFO_RESPONSE_CODE, &httpReturnCode ) == CURLE_OK && httpReturnCode == 200 )
       {
-       long conditionUnmet = 33;
-       if ( curl_easy_getinfo( _curl, CURLINFO_CONDITION_UNMET, &conditionUnmet ) == CURLE_OK && conditionUnmet )
-       {
-         WAR << "TIMECONDITION unmet - retry without." << endl;
-         curl_easy_setopt(_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
-         curl_easy_setopt(_curl, CURLOPT_TIMEVALUE, 0L);
-         ret = curl_easy_perform( _curl );
-       }
+        long conditionUnmet = 33;
+        if ( curl_easy_getinfo( _curl, CURLINFO_CONDITION_UNMET, &conditionUnmet ) == CURLE_OK && conditionUnmet )
+        {
+          WAR << "TIMECONDITION unmet - retry without." << endl;
+          curl_easy_setopt(_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
+          curl_easy_setopt(_curl, CURLOPT_TIMEVALUE, 0L);
+          ret = curl_easy_perform( _curl );
+        }
       }
     }
 #endif
@@ -1103,7 +1103,7 @@ void MediaCurl::doGetFileCopyFile( const OnMediaLocation & srcFile, const Pathna
 #if DETECT_DIR_INDEX
     if (!ret && detectDirIndex())
       {
-       ZYPP_THROW(MediaNotAFileException(_url, filename));
+        ZYPP_THROW(MediaNotAFileException(_url, filename));
       }
 #endif // DETECT_DIR_INDEX
 }
index 5891873..18becf4 100644 (file)
@@ -95,7 +95,7 @@ class MediaCurl : public MediaNetworkCommonHandler
   public:
 
     MediaCurl( const Url &      url_r,
-              const Pathname & attach_point_hint_r );
+               const Pathname & attach_point_hint_r );
 
     virtual ~MediaCurl() override { try { release(); } catch(...) {} }
 
@@ -104,7 +104,7 @@ class MediaCurl : public MediaNetworkCommonHandler
     class Callbacks
     {
       public:
-       virtual ~Callbacks();
+        virtual ~Callbacks();
         virtual bool progress( int percent ) = 0;
     };
 
index 0ab8127..4f416b5 100644 (file)
@@ -40,18 +40,18 @@ namespace zypp {
     //                Thus attach_point_hint_r is ignored.
     //
     MediaDIR::MediaDIR( const Url &      url_r,
-                       const Pathname & /*attach_point_hint_r*/ )
+                        const Pathname & /*attach_point_hint_r*/ )
         : MediaHandler( url_r, url_r.getPathName(),
-                   "/",    // urlpath below attachpoint
-                   false ) // does_download
+                    "/",    // urlpath below attachpoint
+                    false ) // does_download
     {
-       MIL << "MediaDIR::MediaDIR(" << url_r << ")" << endl;
-       if( !url_r.getHost().empty())
-       {
-         ZYPP_THROW(MediaBadUrlException(url_r,
-           "Hostname not allowed in the Url"
-         ));
-       }
+        MIL << "MediaDIR::MediaDIR(" << url_r << ")" << endl;
+        if( !url_r.getHost().empty())
+        {
+          ZYPP_THROW(MediaBadUrlException(url_r,
+            "Hostname not allowed in the Url"
+          ));
+        }
     }
 
     ///////////////////////////////////////////////////////////////////
@@ -65,7 +65,7 @@ namespace zypp {
     void MediaDIR::attachTo(bool next)
     {
       if(next)
-       ZYPP_THROW(MediaNotSupportedException(url()));
+        ZYPP_THROW(MediaNotSupportedException(url()));
 
       // fetch attach point from url again if needed ...
       // it may happen that attachPointHint (and attachPoint())
@@ -73,20 +73,20 @@ namespace zypp {
       // not existed while the handler was constructed.
       if( attachPoint().empty() && !url().getPathName().empty())
       {
-       Pathname real( getRealPath(url().getPathName()));
-
-       PathInfo adir( real);
-       if( adir.isDir())
-       {
-         // set attachpoint only if the dir exists
-         setAttachPoint( real, false);
-       }
-       else
-       {
+        Pathname real( getRealPath(url().getPathName()));
+
+        PathInfo adir( real);
+        if( adir.isDir())
+        {
+          // set attachpoint only if the dir exists
+          setAttachPoint( real, false);
+        }
+        else
+        {
           ZYPP_THROW(MediaBadUrlException(url(),
             "Specified path '" + url().getPathName() + "' is not a directory"
-         ));
-       }
+          ));
+        }
       }
 
       // attach point is same as source path... we do not mount here
@@ -94,14 +94,14 @@ namespace zypp {
       {
         ZYPP_THROW(MediaBadUrlException(url(),
           "The media URL does not provide any useable directory path"
-       ));
+        ));
       }
       else
       if(!PathInfo(attachPoint()).isDir())
       {
         ZYPP_THROW(MediaBadUrlException(url(),
-         "Specified path '" + attachPoint().asString() + "' is not a directory"
-       ));
+          "Specified path '" + attachPoint().asString() + "' is not a directory"
+        ));
       }
 
       MediaSourceRef media(new MediaSource("dir", attachPoint().asString()));
@@ -156,7 +156,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaDIR::getDirInfo( std::list<std::string> & retlist,
-                              const Pathname & dirname, bool dots ) const
+                               const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
@@ -170,7 +170,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaDIR::getDirInfo( filesystem::DirContent & retlist,
-                              const Pathname & dirname, bool dots ) const
+                               const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
index fb25e18..364ba1f 100644 (file)
@@ -29,10 +29,10 @@ namespace zypp {
 
       protected:
 
-       virtual void attachTo (bool next = false) override;
+        virtual void attachTo (bool next = false) override;
         virtual void releaseFrom( const std::string & ejectDev ) override;
-       virtual void getFile( const OnMediaLocation & file ) const override;
-       virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
+        virtual void getFile( const OnMediaLocation & file ) const override;
+        virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
         virtual void getDirInfo( std::list<std::string> & retlist,
                                  const Pathname & dirname, bool dots = true ) const override;
         virtual void getDirInfo( filesystem::DirContent & retlist,
@@ -42,7 +42,7 @@ namespace zypp {
       public:
 
         MediaDIR( const Url &      url_r,
-                 const Pathname & attach_point_hint_r );
+                  const Pathname & attach_point_hint_r );
 
         virtual ~MediaDIR() override { try { release(); } catch(...) {} }
     };
index e8cb675..9984867 100644 (file)
@@ -51,31 +51,31 @@ namespace zypp {
     // DESCRIPTION :
     //
     MediaDISK::MediaDISK( const Url &      url_r,
-                         const Pathname & attach_point_hint_r )
+                          const Pathname & attach_point_hint_r )
         : MediaHandler( url_r, attach_point_hint_r,
-                   url_r.getPathName(), // urlpath below attachpoint
-                   false ) // does_download
+                    url_r.getPathName(), // urlpath below attachpoint
+                    false ) // does_download
     {
       MIL << "MediaDISK::MediaDISK(" << url_r << ", " << attach_point_hint_r << ")" << endl;
 
       _device = Pathname(_url.getQueryParam("device")).asString();
       if( _device.empty())
       {
-       ERR << "Media url does not contain a device specification" << std::endl;
-       ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
+        ERR << "Media url does not contain a device specification" << std::endl;
+        ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
       }
 #if DELAYED_VERIFY
       DBG << "Verify of " << _device << " delayed" << std::endl;
 #else
       if( !verifyIfDiskVolume( _device))
       {
-       ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
+        ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
       }
 #endif
 
       _filesystem = _url.getQueryParam("filesystem");
       if(_filesystem.empty())
-       _filesystem="auto";
+        _filesystem="auto";
 
     }
 
@@ -90,66 +90,66 @@ namespace zypp {
     bool MediaDISK::verifyIfDiskVolume(const Pathname &dev_name)
     {
       if( dev_name.empty() ||
-         dev_name.asString().compare(0, sizeof("/dev/")-1, "/dev/"))
+          dev_name.asString().compare(0, sizeof("/dev/")-1, "/dev/"))
       {
-       ERR << "Specified device name " << dev_name
-           << " is not allowed" << std::endl;
-       return false;
+        ERR << "Specified device name " << dev_name
+            << " is not allowed" << std::endl;
+        return false;
       }
 
       PathInfo dev_info(dev_name);
       if( !dev_info.isBlk())
       {
-       ERR << "Specified device name " << dev_name
-           << " is not a block device" << std::endl;
-       return false;
+        ERR << "Specified device name " << dev_name
+            << " is not a block device" << std::endl;
+        return false;
       }
 
       // check if a volume using /dev/disk/by-uuid links first
       {
-       Pathname            dpath("/dev/disk/by-uuid");
-       std::list<Pathname> dlist;
-       if( zypp::filesystem::readdir(dlist, dpath) == 0)
-       {
-         std::list<Pathname>::const_iterator it;
-         for(it = dlist.begin(); it != dlist.end(); ++it)
-         {
-           PathInfo vol_info(*it);
-           if( vol_info.isBlk() && vol_info.devMajor() == dev_info.devMajor() &&
-                                   vol_info.devMinor() == dev_info.devMinor())
-           {
-             DBG << "Specified device name " << dev_name
-                 << " is a volume (disk/by-uuid link "
-                 << vol_info.path() << ")"
-                 << std::endl;
-             return true;
-           }
-         }
-       }
+        Pathname            dpath("/dev/disk/by-uuid");
+        std::list<Pathname> dlist;
+        if( zypp::filesystem::readdir(dlist, dpath) == 0)
+        {
+          std::list<Pathname>::const_iterator it;
+          for(it = dlist.begin(); it != dlist.end(); ++it)
+          {
+            PathInfo vol_info(*it);
+            if( vol_info.isBlk() && vol_info.devMajor() == dev_info.devMajor() &&
+                                    vol_info.devMinor() == dev_info.devMinor())
+            {
+              DBG << "Specified device name " << dev_name
+                  << " is a volume (disk/by-uuid link "
+                  << vol_info.path() << ")"
+                  << std::endl;
+              return true;
+            }
+          }
+        }
       }
 
       // check if a volume using /dev/disk/by-label links
       // (e.g. vbd mapped volumes in a XEN vm)
       {
-       Pathname            dpath("/dev/disk/by-label");
-       std::list<Pathname> dlist;
-       if( zypp::filesystem::readdir(dlist, dpath) == 0)
-       {
-         std::list<Pathname>::const_iterator it;
-         for(it = dlist.begin(); it != dlist.end(); ++it)
-         {
-           PathInfo vol_info(*it);
-           if( vol_info.isBlk() && vol_info.devMajor() == dev_info.devMajor() &&
-                                   vol_info.devMinor() == dev_info.devMinor())
-           {
-             DBG << "Specified device name " << dev_name
-                 << " is a volume (disk/by-label link "
-                 << vol_info.path() << ")"
-                 << std::endl;
-             return true;
-           }
-         }
-       }
+        Pathname            dpath("/dev/disk/by-label");
+        std::list<Pathname> dlist;
+        if( zypp::filesystem::readdir(dlist, dpath) == 0)
+        {
+          std::list<Pathname>::const_iterator it;
+          for(it = dlist.begin(); it != dlist.end(); ++it)
+          {
+            PathInfo vol_info(*it);
+            if( vol_info.isBlk() && vol_info.devMajor() == dev_info.devMajor() &&
+                                    vol_info.devMinor() == dev_info.devMinor())
+            {
+              DBG << "Specified device name " << dev_name
+                  << " is a volume (disk/by-label link "
+                  << vol_info.path() << ")"
+                  << std::endl;
+              return true;
+            }
+          }
+        }
       }
 
       // check if a filesystem volume using the 'blkid' tool
@@ -163,11 +163,11 @@ namespace zypp {
       cmd >> DBG;
       if ( cmd.close() != 0 )
       {
-       ERR << cmd.execError() << endl
-           << "Specified device name " << dev_name
-           << " is not a usable disk volume"
-           << std::endl;
-       return false;
+        ERR << cmd.execError() << endl
+            << "Specified device name " << dev_name
+            << " is not a usable disk volume"
+            << std::endl;
+        return false;
       }
       return true;
     }
@@ -183,7 +183,7 @@ namespace zypp {
     void MediaDISK::attachTo(bool next)
     {
       if(next)
-       ZYPP_THROW(MediaNotSupportedException(url()));
+        ZYPP_THROW(MediaNotSupportedException(url()));
       // FIXME
       // do mount --bind <partition>/<dir> to <to>
       //   mount /dev/<partition> /tmp_mount
@@ -191,7 +191,7 @@ namespace zypp {
       // FIXME: try all filesystems
 
       if(_device.empty())
-       ZYPP_THROW(MediaBadUrlEmptyDestinationException(url()));
+        ZYPP_THROW(MediaBadUrlEmptyDestinationException(url()));
 
       PathInfo dev_info(_device);
       if(!dev_info.isBlk())
@@ -200,32 +200,32 @@ namespace zypp {
       DBG << "Verifying " << _device << " ..." << std::endl;
       if( !verifyIfDiskVolume( _device))
       {
-       ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
+        ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
       }
 #endif
 
       if(_filesystem.empty())
-       ZYPP_THROW(MediaBadUrlEmptyFilesystemException(url()));
+        ZYPP_THROW(MediaBadUrlEmptyFilesystemException(url()));
 
       MediaSourceRef media( new MediaSource(
-       "disk", _device, dev_info.devMajor(), dev_info.devMinor()
+        "disk", _device, dev_info.devMajor(), dev_info.devMinor()
       ));
       AttachedMedia  ret( findAttachedMedia( media));
 
       if( ret.mediaSource &&
-         ret.attachPoint &&
-         !ret.attachPoint->empty())
+          ret.attachPoint &&
+          !ret.attachPoint->empty())
       {
-       DBG << "Using a shared media "
-           << ret.mediaSource->name
-           << " attached on "
-           << ret.attachPoint->path
-           << endl;
-
-       removeAttachPoint();
-       setAttachPoint(ret.attachPoint);
-       setMediaSource(ret.mediaSource);
-       return;
+        DBG << "Using a shared media "
+            << ret.mediaSource->name
+            << " attached on "
+            << ret.attachPoint->path
+            << endl;
+
+        removeAttachPoint();
+        setAttachPoint(ret.attachPoint);
+        setMediaSource(ret.mediaSource);
+        return;
       }
 
       MediaManager  manager;
@@ -233,40 +233,40 @@ namespace zypp {
       MountEntries::const_iterator e;
       for( e = entries.begin(); e != entries.end(); ++e)
       {
-       bool        is_device = false;
-       std::string dev_path(Pathname(e->src).asString());
-       PathInfo    dev_info;
-
-       if( dev_path.compare(0, sizeof("/dev/")-1, "/dev/") == 0 &&
-           dev_info(e->src) && dev_info.isBlk())
-       {
-         is_device = true;
-       }
-
-       if( is_device && media->maj_nr == dev_info.devMajor() &&
-                        media->min_nr == dev_info.devMinor())
-       {
-         AttachPointRef ap( new AttachPoint(e->dir, false));
-         AttachedMedia  am( media, ap);
-         {
-           DBG << "Using a system mounted media "
-               << media->name
-               << " attached on "
-               << ap->path
-               << endl;
-
-           media->iown = false; // mark attachment as foreign
-
-           setMediaSource(media);
-           setAttachPoint(ap);
-           return;
-         }
-       }
+        bool        is_device = false;
+        std::string dev_path(Pathname(e->src).asString());
+        PathInfo    dev_info;
+
+        if( dev_path.compare(0, sizeof("/dev/")-1, "/dev/") == 0 &&
+            dev_info(e->src) && dev_info.isBlk())
+        {
+          is_device = true;
+        }
+
+        if( is_device && media->maj_nr == dev_info.devMajor() &&
+                         media->min_nr == dev_info.devMinor())
+        {
+          AttachPointRef ap( new AttachPoint(e->dir, false));
+          AttachedMedia  am( media, ap);
+          {
+            DBG << "Using a system mounted media "
+                << media->name
+                << " attached on "
+                << ap->path
+                << endl;
+
+            media->iown = false; // mark attachment as foreign
+
+            setMediaSource(media);
+            setAttachPoint(ap);
+            return;
+          }
+        }
       }
 
       if( !isUseableAttachPoint( attachPoint() ) )
       {
-       setAttachPoint( createAttachPoint(), true );
+        setAttachPoint( createAttachPoint(), true );
       }
       std::string mountpoint( attachPoint().asString() );
 
@@ -274,17 +274,17 @@ namespace zypp {
       std::string options = _url.getQueryParam("mountoptions");
       if(options.empty())
       {
-       options = "ro";
+        options = "ro";
       }
 
       if( !media->bdir.empty())
       {
-       options += ",bind";
-       mount.mount(media->bdir, mountpoint, "none", options);
+        options += ",bind";
+        mount.mount(media->bdir, mountpoint, "none", options);
       }
       else
       {
-       mount.mount(_device, mountpoint, _filesystem, options);
+        mount.mount(_device, mountpoint, _filesystem, options);
       }
 
       setMediaSource(media);
@@ -311,7 +311,7 @@ namespace zypp {
         }
         ZYPP_THROW(MediaMountException(
           "Unable to verify that the media was mounted",
-         _device, mountpoint
+          _device, mountpoint
         ));
       }
     }
@@ -380,7 +380,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaDISK::getDirInfo( std::list<std::string> & retlist,
-                               const Pathname & dirname, bool dots ) const
+                                const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
@@ -394,7 +394,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaDISK::getDirInfo( filesystem::DirContent & retlist,
-                               const Pathname & dirname, bool dots ) const
+                                const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
index 50e0b89..96bf305 100644 (file)
@@ -32,10 +32,10 @@ namespace zypp {
 
       protected:
 
-       virtual void attachTo (bool next = false) override;
+        virtual void attachTo (bool next = false) override;
         virtual void releaseFrom( const std::string & ejectDev ) override;
-       virtual void getFile( const OnMediaLocation & file ) const override;
-       virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
+        virtual void getFile( const OnMediaLocation & file ) const override;
+        virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
         virtual void getDirInfo( std::list<std::string> & retlist,
                                  const Pathname & dirname, bool dots = true ) const override;
         virtual void getDirInfo( filesystem::DirContent & retlist,
@@ -45,7 +45,7 @@ namespace zypp {
       public:
 
         MediaDISK( const Url &      url_r,
-                  const Pathname & attach_point_hint_r );
+                   const Pathname & attach_point_hint_r );
 
         virtual ~MediaDISK() override { try { release(); } catch(...) {} }
 
index 234aa54..cb0488a 100644 (file)
@@ -32,9 +32,9 @@ namespace zypp
     {
       str << form(_("Failed to mount %s on %s"), _source.c_str(), _target.c_str() );
       if( !_cmdout.empty())
-       str << ": " << _error << " (" << _cmdout << ")";
+        str << ": " << _error << " (" << _cmdout << ")";
       else
-       str << ": " << _error;
+        str << ": " << _error;
       return str;
     }
 
@@ -98,11 +98,11 @@ namespace zypp
     {
       if( _msg.empty())
       {
-       return str << _("Malformed URI") << ": " << _url;
+        return str << _("Malformed URI") << ": " << _url;
       }
       else
       {
-       return str << _msg << ": " << _url;
+        return str << _msg << ": " << _url;
       }
     }
 
@@ -161,9 +161,9 @@ namespace zypp
     std::ostream & MediaNotEjectedException::dumpOn( std::ostream & str ) const
     {
       if( _name.empty() )
-       return str << _("Cannot eject any media");
+        return str << _("Cannot eject any media");
       else
-       return str << form(_("Cannot eject media '%s'"), _name.c_str());
+        return str << form(_("Cannot eject media '%s'"), _name.c_str());
     }
 
     std::ostream & MediaUnauthorizedException::dumpOn( std::ostream & str ) const
index 3e30ec6..60c1967 100644 (file)
@@ -62,9 +62,9 @@ namespace zypp
        * Use \ref ZYPP_THROW to throw exceptions.
       */
       MediaMountException( const std::string & error_r,
-                          const std::string & source_r,
-                          const std::string & target_r,
-                          const std::string & cmdout_r="")
+                           const std::string & source_r,
+                           const std::string & target_r,
+                           const std::string & cmdout_r="")
       : MediaException()
       , _error(error_r)
       , _source(source_r)
@@ -99,7 +99,7 @@ namespace zypp
        * Use \ref ZYPP_THROW to throw exceptions.
       */
       MediaUnmountException( const std::string & error_r,
-                            const std::string & path_r )
+                             const std::string & path_r )
       : MediaException()
       , _error(error_r)
       , _path(path_r)
@@ -146,7 +146,7 @@ namespace zypp
     {
     public:
       MediaFileNotFoundException(const Url & url_r,
-                                const Pathname & filename_r)
+                                 const Pathname & filename_r)
       : MediaException()
       , _url(url_r.asString())
       , _filename(filename_r.asString())
@@ -219,7 +219,7 @@ namespace zypp
     {
     public:
       MediaSystemException(const Url & url_r,
-                          const std::string & message_r)
+                           const std::string & message_r)
       : MediaException()
       , _url(url_r.asString())
       , _message(message_r)
@@ -236,7 +236,7 @@ namespace zypp
     {
     public:
       MediaNotAFileException(const Url & url_r,
-                            const Pathname & path_r)
+                             const Pathname & path_r)
       : MediaException()
       , _url(url_r.asString())
       , _path(path_r.asString())
@@ -253,7 +253,7 @@ namespace zypp
     {
     public:
       MediaNotADirException(const Url & url_r,
-                           const Pathname & path_r)
+                            const Pathname & path_r)
       : MediaException()
       , _url(url_r.asString())
       , _path(path_r.asString())
@@ -343,8 +343,8 @@ namespace zypp
     {
     public:
       MediaCurlException(const Url & url_r,
-                        const std::string & err_r,
-                        const std::string & msg_r)
+                         const std::string & err_r,
+                         const std::string & msg_r)
       : MediaException()
       , _url(url_r.asString())
       , _err(err_r)
index 4e49d6b..2844480 100644 (file)
@@ -52,9 +52,9 @@ namespace zypp {
 //     DESCRIPTION :
 //
 MediaHandler::MediaHandler ( const Url &      url_r,
-                            const Pathname & attach_point_r,
-                            const Pathname & urlpath_below_attachpoint_r,
-                            const bool       does_download_r )
+                             const Pathname & attach_point_r,
+                             const Pathname & urlpath_below_attachpoint_r,
+                             const bool       does_download_r )
     : _mediaSource()
     , _attachPoint( new AttachPoint())
     , _attachPointHint()
@@ -80,9 +80,9 @@ MediaHandler::MediaHandler ( const Url &      url_r,
     // schemes other than "file" and "dir", if it is absolute.
     //
     if ( !adir.isDir()
-        || (_url.getScheme() != "file"
-            && _url.getScheme() != "dir"
-            && !real_attach_point.absolute()) )
+         || (_url.getScheme() != "file"
+             && _url.getScheme() != "dir"
+             && !real_attach_point.absolute()) )
     {
       ERR << "Provided attach point is not a absolute directory: "
           << adir << endl;
@@ -139,7 +139,7 @@ MediaHandler::getRealPath(const std::string &path)
       memset(buff, '\0', sizeof(buff));
       if( ::realpath(path.c_str(), buff) != NULL)
       {
-       real = buff;
+        real = buff;
       }
     }
 #else
@@ -192,7 +192,7 @@ MediaHandler::removeAttachPoint()
       MIL << "Deleted default attach point " << path << endl;
     } else {
       ERR << "Failed to Delete default attach point " << path
-       << " errno(" << res << ")" << endl;
+        << " errno(" << res << ")" << endl;
     }
   }
   else
@@ -298,7 +298,7 @@ MediaHandler::attachPointHint() const
 AttachedMedia
 MediaHandler::findAttachedMedia(const MediaSourceRef &media) const
 {
-       return MediaManager().findAttachedMedia(media);
+        return MediaManager().findAttachedMedia(media);
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -402,14 +402,14 @@ MediaHandler::createAttachPoint(const Pathname &attach_root) const
     for ( const std::string & entry : entries )
     {
       if ( ! str::hasPrefix( entry, "AP_0x" ) )
-       continue;
+        continue;
       PathInfo sdir( attach_root + entry );
       if ( sdir.isDir()
-       && sdir.dev() == adir.dev()
-       && ( Date::now()-sdir.mtime() > Date::month ) )
+        && sdir.dev() == adir.dev()
+        && ( Date::now()-sdir.mtime() > Date::month ) )
       {
-       DBG << "Remove orphaned attach point " << sdir << std::endl;
-       filesystem::recursive_rmdir( sdir.path() );
+        DBG << "Remove orphaned attach point " << sdir << std::endl;
+        filesystem::recursive_rmdir( sdir.path() );
       }
     }
   }
@@ -530,8 +530,8 @@ MediaHandler::checkAttached(bool matchMountFs) const
       MountEntries entries( MediaManager::getMountEntries());
       for_( e, entries.begin(), entries.end() )
       {
-       if ( ref.attachPoint->path != Pathname(e->dir) )
-         continue;     // at least the mount points must match
+        if ( ref.attachPoint->path != Pathname(e->dir) )
+          continue;    // at least the mount points must match
 
         bool        is_device = false;
         PathInfo    dev_info;
@@ -542,7 +542,7 @@ MediaHandler::checkAttached(bool matchMountFs) const
         }
 
         if( is_device &&  (ref.mediaSource->maj_nr &&
-                          ref.mediaSource->bdir.empty()))
+                           ref.mediaSource->bdir.empty()))
         {
           std::string mtype(matchMountFs ? e->type : ref.mediaSource->type);
           MediaSource media(mtype, e->src, dev_info.devMajor(), dev_info.devMinor());
@@ -559,95 +559,95 @@ MediaHandler::checkAttached(bool matchMountFs) const
         }
         else
         if(!is_device && (!ref.mediaSource->maj_nr ||
-                         !ref.mediaSource->bdir.empty()))
+                          !ref.mediaSource->bdir.empty()))
         {
-         if( ref.mediaSource->bdir.empty())
-         {
-           // bnc#710269: Type nfs may appear as nfs4 in in the mount table
-           // and maybe vice versa. Similar cifs/smb. Need to unify these types:
-           if ( matchMountFs && e->type != ref.mediaSource->type )
-           {
-             if ( str::hasPrefix( e->type, "nfs" ) && str::hasPrefix( ref.mediaSource->type, "nfs" ) )
-               matchMountFs = false;
-             else if ( ( e->type == "cifs" || e->type == "smb" ) && ( ref.mediaSource->type == "cifs" || ref.mediaSource->type == "smb" ) )
-               matchMountFs = false;
-             else
-               continue;       // different types cannot match
-           }
-           // Here: Types are ok or not to check.
-           // Check the name except for nfs (bnc#804544; symlink resolution in mount path)
-           //
-           //   [fibonacci]$ ls -l /Local/ma/c12.1
-           //   lrwxrwxrwx  /Local/ma/c12.1 -> zypp-SuSE-Code-12_1-Branch/
-           //
-           //   [localhost]$ mount -t nfs4 fibonacci:/Local/ma/c12.1 /mnt
-           //   [localhost]$ mount
-           //   fibonacci:/Local/ma/zypp-SuSE-Code-12_1-Branch on /mnt
-
-           // std::string mtype(matchMountFs ? e->type : ref.mediaSource->type);
-           // MediaSource media(mtype, e->src);
-
-           if( ref.mediaSource->name == e->src || str::hasPrefix( ref.mediaSource->type, "nfs" ) )
-           {
-             DBG << "Found media name "
-             << ref.mediaSource->asString()
-             << " in the mount table as " << e->src << std::endl;
-             _isAttached = true;
-             break;
-           }
-         }
-         else
-         {
-           if ( ref.mediaSource->bdir == e->src )
-           {
-             DBG << "Found bound media "
-                 << ref.mediaSource->asString()
-                 << " in the mount table as " << e->src << std::endl;
-             _isAttached = true;
-             break;
-           }
-         }
+          if( ref.mediaSource->bdir.empty())
+          {
+            // bnc#710269: Type nfs may appear as nfs4 in in the mount table
+            // and maybe vice versa. Similar cifs/smb. Need to unify these types:
+            if ( matchMountFs && e->type != ref.mediaSource->type )
+            {
+              if ( str::hasPrefix( e->type, "nfs" ) && str::hasPrefix( ref.mediaSource->type, "nfs" ) )
+                matchMountFs = false;
+              else if ( ( e->type == "cifs" || e->type == "smb" ) && ( ref.mediaSource->type == "cifs" || ref.mediaSource->type == "smb" ) )
+                matchMountFs = false;
+              else
+                continue;      // different types cannot match
+            }
+            // Here: Types are ok or not to check.
+            // Check the name except for nfs (bnc#804544; symlink resolution in mount path)
+            //
+            //   [fibonacci]$ ls -l /Local/ma/c12.1
+            //   lrwxrwxrwx  /Local/ma/c12.1 -> zypp-SuSE-Code-12_1-Branch/
+            //
+            //   [localhost]$ mount -t nfs4 fibonacci:/Local/ma/c12.1 /mnt
+            //   [localhost]$ mount
+            //   fibonacci:/Local/ma/zypp-SuSE-Code-12_1-Branch on /mnt
+
+            // std::string mtype(matchMountFs ? e->type : ref.mediaSource->type);
+            // MediaSource media(mtype, e->src);
+
+            if( ref.mediaSource->name == e->src || str::hasPrefix( ref.mediaSource->type, "nfs" ) )
+            {
+              DBG << "Found media name "
+              << ref.mediaSource->asString()
+              << " in the mount table as " << e->src << std::endl;
+              _isAttached = true;
+              break;
+            }
+          }
+          else
+          {
+            if ( ref.mediaSource->bdir == e->src )
+            {
+              DBG << "Found bound media "
+                  << ref.mediaSource->asString()
+                  << " in the mount table as " << e->src << std::endl;
+              _isAttached = true;
+              break;
+            }
+          }
           // differs
         }
         else // mixed cases:
-       {
-         // Type ISO: Since 11.1 mtab might contain the name of
-         // the loop device instead of the iso file:
-         if ( ref.mediaSource->type == "iso"
-           && str::hasPrefix( Pathname(e->src).asString(), "/dev/loop" )
-           && ref.attachPoint->path == Pathname(e->dir) )
-         {
-           DBG << "Found bound media "
-           << ref.mediaSource->asString()
-           << " in the mount table as " << e->src << std::endl;
-           _isAttached = true;
-           break;
-         }
-       }
+        {
+          // Type ISO: Since 11.1 mtab might contain the name of
+          // the loop device instead of the iso file:
+          if ( ref.mediaSource->type == "iso"
+            && str::hasPrefix( Pathname(e->src).asString(), "/dev/loop" )
+            && ref.attachPoint->path == Pathname(e->dir) )
+          {
+            DBG << "Found bound media "
+            << ref.mediaSource->asString()
+            << " in the mount table as " << e->src << std::endl;
+            _isAttached = true;
+            break;
+          }
+        }
       }
 
       if( !_isAttached)
       {
         MIL << "Looking for " << ref << endl;
-       if( entries.empty() )
-       {
-         ERR << "Unable to find any entry in the /etc/mtab file" << std::endl;
-       }
-       else
-       {
+        if( entries.empty() )
+        {
+          ERR << "Unable to find any entry in the /etc/mtab file" << std::endl;
+        }
+        else
+        {
           dumpRange( DBG << "MountEntries: ", entries.begin(), entries.end() ) << endl;
-       }
-       if( old_mtime > 0 )
-       {
+        }
+        if( old_mtime > 0 )
+        {
           ERR << "Attached media not in mount table any more - forcing reset!"
               << std::endl;
 
-         _mediaSource.reset();
-       }
-       else
-       {
+          _mediaSource.reset();
+        }
+        else
+        {
           WAR << "Attached media not in mount table ..." << std::endl;
-       }
+        }
 
         // reset the mtime and force a new check to make sure,
         // that we've found the media at least once in the mtab.
@@ -845,15 +845,15 @@ void MediaHandler::forceRelaseAllMedia(const MediaSourceRef &ref,
         DBG << "Forcing release of media device "
             << ref->asString()
             << " in the mount table as "
-           << e->src << std::endl;
-       try {
-         Mount mount;
-         mount.umount(e->dir);
-       }
-       catch (const Exception &e)
-       {
-         ZYPP_CAUGHT(e);
-       }
+            << e->src << std::endl;
+        try {
+          Mount mount;
+          mount.umount(e->dir);
+        }
+        catch (const Exception &e)
+        {
+          ZYPP_CAUGHT(e);
+        }
       }
     }
     else
@@ -863,18 +863,18 @@ void MediaHandler::forceRelaseAllMedia(const MediaSourceRef &ref,
       MediaSource media(mtype, e->src);
       if( ref->equals( media))
       {
-       DBG << "Forcing release of media name "
-           << ref->asString()
-           << " in the mount table as "
-           << e->src << std::endl;
-       try {
-         Mount mount;
-         mount.umount(e->dir);
-       }
-       catch (const Exception &e)
-       {
-         ZYPP_CAUGHT(e);
-       }
+        DBG << "Forcing release of media name "
+            << ref->asString()
+            << " in the mount table as "
+            << e->src << std::endl;
+        try {
+          Mount mount;
+          mount.umount(e->dir);
+        }
+        catch (const Exception &e)
+        {
+          ZYPP_CAUGHT(e);
+        }
       }
     }
   }
@@ -889,8 +889,8 @@ MediaHandler::checkAttachPoint(const Pathname &apoint) const
 // STATIC
 bool
 MediaHandler::checkAttachPoint(const Pathname &apoint,
-                              bool            emptydir,
-                              bool            writeable)
+                               bool            emptydir,
+                               bool            writeable)
 {
   if( apoint.empty() || !apoint.absolute())
   {
@@ -932,7 +932,7 @@ MediaHandler::checkAttachPoint(const Pathname &apoint,
         (atest=::mkdtemp(atemp)) == NULL)
     {
       if( atemp != NULL)
-       ::free(atemp);
+        ::free(atemp);
 
       ERR << "Attach point '" << ainfo.path()
           << "' is not a writeable directory" << std::endl;
@@ -975,7 +975,7 @@ MediaHandler::dependsOnParent(MediaAccessId parentId, bool exactIdMatch)
       AttachedMedia am2 = mm.getAttachedMedia(parentId);
       if( am1.mediaSource && am2.mediaSource)
       {
-       return am1.mediaSource->equals( *(am2.mediaSource));
+        return am1.mediaSource->equals( *(am2.mediaSource));
       }
     }
   }
@@ -1148,7 +1148,7 @@ bool MediaHandler::doesFileExist( const Pathname & filename ) const
 //     METHOD TYPE : PMError
 //
 void MediaHandler::getDirectoryYast( std::list<std::string> & retlist,
-                                       const Pathname & dirname, bool dots ) const
+                                        const Pathname & dirname, bool dots ) const
 {
   retlist.clear();
 
@@ -1339,11 +1339,11 @@ void MediaHandler::getDirInfo( filesystem::DirContent & retlist,
     int res = readdir( retlist, info.path(), dots );
     if ( res )
     {
-       MediaSystemException nexcpt(url(), "readdir failed");
+        MediaSystemException nexcpt(url(), "readdir failed");
 #if NONREMOTE_DIRECTORY_YAST
-       nexcpt.remember(excpt_r);
+        nexcpt.remember(excpt_r);
 #endif
-       ZYPP_THROW(nexcpt);
+        ZYPP_THROW(nexcpt);
     }
 #if NONREMOTE_DIRECTORY_YAST
   }
index f8ae341..e8149d2 100644 (file)
@@ -52,235 +52,235 @@ class MediaHandler {
     friend std::ostream & operator<<( std::ostream & str, const MediaHandler & obj );
 
     public:
-       typedef shared_ptr<MediaHandler> Ptr;
-       typedef shared_ptr<const MediaHandler> constPtr;
+        typedef shared_ptr<MediaHandler> Ptr;
+        typedef shared_ptr<const MediaHandler> constPtr;
 
-       static bool setAttachPrefix(const Pathname &attach_prefix);
+        static bool setAttachPrefix(const Pathname &attach_prefix);
 
-       static std::string getRealPath(const std::string &path);
-       static Pathname    getRealPath(const Pathname    &path);
+        static std::string getRealPath(const std::string &path);
+        static Pathname    getRealPath(const Pathname    &path);
 
     private:
         /**
-        * User defined default attach point prefix.
-        */
-       static Pathname _attachPrefix;
-
-       /**
-        * The attached media source description reference.
-        */
-       mutable
-       MediaSourceRef  _mediaSource;
-
-       /**
-        * This is where the media will be actually attached ("mounted").
-        * All files are provided bellow this + _relativeRoot directory.
-        **/
-       AttachPointRef  _attachPoint;
-
-       /**
-        * The user provided attach preferred point. It may contain
-        * following values:
-        *
-        *      "",  true  => create temporary attach point bellow of
-        *                    _attachPrefix or a built-in default and
-        *                    remove it if not needed any more.
-        *
-        *      dir, false => user specified attach point (not removed)
-        */
-       AttachPoint     _attachPointHint;
-
-       /**
-        * The relative root directory of the data on the media.
-        * See also localRoot() and urlpath_below_attachpoint_r
-        * constructor argument.
-        */
-       Pathname        _relativeRoot;
-
-       /**
-        * True if concrete handler downloads files to the local
-        * filesystem. If true releaseFile/Dir will delete them.
-        **/
-       bool            _does_download;
+         * User defined default attach point prefix.
+         */
+        static Pathname _attachPrefix;
+
+        /**
+         * The attached media source description reference.
+         */
+        mutable
+        MediaSourceRef  _mediaSource;
+
+        /**
+         * This is where the media will be actually attached ("mounted").
+         * All files are provided bellow this + _relativeRoot directory.
+         **/
+        AttachPointRef  _attachPoint;
+
+        /**
+         * The user provided attach preferred point. It may contain
+         * following values:
+         *
+         *      "",  true  => create temporary attach point bellow of
+         *                    _attachPrefix or a built-in default and
+         *                    remove it if not needed any more.
+         *
+         *      dir, false => user specified attach point (not removed)
+         */
+        AttachPoint     _attachPointHint;
+
+        /**
+         * The relative root directory of the data on the media.
+         * See also localRoot() and urlpath_below_attachpoint_r
+         * constructor argument.
+         */
+        Pathname        _relativeRoot;
+
+        /**
+         * True if concrete handler downloads files to the local
+         * filesystem. If true releaseFile/Dir will delete them.
+         **/
+        bool            _does_download;
 
         /** timestamp of the the last attach verification */
         mutable time_t  _attach_mtime;
 
     protected:
         /**
-        * Url to handle
-        **/
-       const Url        _url;
+         * Url to handle
+         **/
+        const Url        _url;
 
-       /**
-        * Access Id of media handler we depend on.
-        */
-       MediaAccessId    _parentId;
+        /**
+         * Access Id of media handler we depend on.
+         */
+        MediaAccessId    _parentId;
 
      public:
 
-       /**
-        * Check if the current media handler depends on an
-        * another handler specified by media access id.
-        * \param parentId The id of the parent handler to check against.
-        * \return true if it depends, false if not.
-        */
-       bool             dependsOnParent(MediaAccessId parentId,
-                                        bool exactIdMatch);
-       bool             dependsOnParent();
-
-       /**
-        * Called in case, where the media manager takes over the
-        * destruction of the parent id (e.g. while destruction
-        * of the media manager).
-        */
-       void             resetParentId();
-
-        /**
-        * Return the currently used attach point.
-        **/
-       Pathname         attachPoint() const;
-
-       /**
-        * Set a new attach point.
-        * \param path  The attach point directory path.
-        * \param temp  If to remove the attach point while cleanup.
-        */
-       void             setAttachPoint(const Pathname &path, bool temp);
-
-       /**
-        * Set a (shared) attach point.
-        * \param ref New attach point reference.
-        */
-       void             setAttachPoint(const AttachPointRef &ref);
-
-       /**
-        * Get the actual attach point hint.
-        */
-       AttachPoint      attachPointHint() const;
-
-       /**
-        * Set the attach point hint as specified by the user.
-        * \param path  The attach point directory path.
-        * \param temp  If to remove the attach point while cleanup.
-        */
-       void             attachPointHint(const Pathname &path, bool temp);
-
-       /**
-        * Try to create a default / temporary attach point.
-        * It tries to create it in attachPrefix if avaliable,
-        * then in built-in directories.
-        * \throws MediaBadAttachPointException if no attach point can be created
-        * \return The name of the new attach point
-        */
-       Pathname         createAttachPoint() const;
-       /**
-        * Try to create a temporary attach point in specified root.
-        * \param attach_root The attach root dir where to create the
-        *                    attach point in.
-        * \return The name of the new attach point or empty path name.
-        */
+        /**
+         * Check if the current media handler depends on an
+         * another handler specified by media access id.
+         * \param parentId The id of the parent handler to check against.
+         * \return true if it depends, false if not.
+         */
+        bool             dependsOnParent(MediaAccessId parentId,
+                                         bool exactIdMatch);
+        bool             dependsOnParent();
+
+        /**
+         * Called in case, where the media manager takes over the
+         * destruction of the parent id (e.g. while destruction
+         * of the media manager).
+         */
+        void             resetParentId();
+
+        /**
+         * Return the currently used attach point.
+         **/
+        Pathname         attachPoint() const;
+
+        /**
+         * Set a new attach point.
+         * \param path  The attach point directory path.
+         * \param temp  If to remove the attach point while cleanup.
+         */
+        void             setAttachPoint(const Pathname &path, bool temp);
+
+        /**
+         * Set a (shared) attach point.
+         * \param ref New attach point reference.
+         */
+        void             setAttachPoint(const AttachPointRef &ref);
+
+        /**
+         * Get the actual attach point hint.
+         */
+        AttachPoint      attachPointHint() const;
+
+        /**
+         * Set the attach point hint as specified by the user.
+         * \param path  The attach point directory path.
+         * \param temp  If to remove the attach point while cleanup.
+         */
+        void             attachPointHint(const Pathname &path, bool temp);
+
+        /**
+         * Try to create a default / temporary attach point.
+         * It tries to create it in attachPrefix if avaliable,
+         * then in built-in directories.
+         * \throws MediaBadAttachPointException if no attach point can be created
+         * \return The name of the new attach point
+         */
+        Pathname         createAttachPoint() const;
+        /**
+         * Try to create a temporary attach point in specified root.
+         * \param attach_root The attach root dir where to create the
+         *                    attach point in.
+         * \return The name of the new attach point or empty path name.
+         */
         Pathname         createAttachPoint(const Pathname &attach_root) const;
 
-       /**
-        * Remove unused attach point. If the attach point is temporary,
-        * the attach point directory and all it content will be removed.
-        */
-       void             removeAttachPoint();
-
-        /**
-        * Verify if the specified directory as attach point (root)
-        * as requires by the particular media handler implementation.
-        * \param apoint The directory to check.
-        * \return True, if the directory checks succeeded.
-        */
-       virtual bool     checkAttachPoint(const Pathname &apoint) const;
-
-       /**
-        * Verify if the specified directory as attach point (root)
-        * using requested checks.
-        * \param apoint The directory to check.
-        * \param empty_dir Check if the directory is empty.
-        * \param writeable Check if the directory is writeable.
-        * \return True, if the directory checks succeeded.
-        */
-       static bool      checkAttachPoint(const Pathname &apoint,
-                                         bool            empty_dir,
-                                         bool            writeable);
-
-       /**
-        * Ask media manager, if the specified path is already used
-        * as attach point or if there are another attach points
-        * bellow of it.
-        * \param path The attach point path to check.
-        * \param mtab Whether to check against the mtab, too.
-        * \return True, if the path can be used as attach point.
-        */
+        /**
+         * Remove unused attach point. If the attach point is temporary,
+         * the attach point directory and all it content will be removed.
+         */
+        void             removeAttachPoint();
+
+        /**
+         * Verify if the specified directory as attach point (root)
+         * as requires by the particular media handler implementation.
+         * \param apoint The directory to check.
+         * \return True, if the directory checks succeeded.
+         */
+        virtual bool     checkAttachPoint(const Pathname &apoint) const;
+
+        /**
+         * Verify if the specified directory as attach point (root)
+         * using requested checks.
+         * \param apoint The directory to check.
+         * \param empty_dir Check if the directory is empty.
+         * \param writeable Check if the directory is writeable.
+         * \return True, if the directory checks succeeded.
+         */
+        static bool      checkAttachPoint(const Pathname &apoint,
+                                          bool            empty_dir,
+                                          bool            writeable);
+
+        /**
+         * Ask media manager, if the specified path is already used
+         * as attach point or if there are another attach points
+         * bellow of it.
+         * \param path The attach point path to check.
+         * \param mtab Whether to check against the mtab, too.
+         * \return True, if the path can be used as attach point.
+         */
         bool             isUseableAttachPoint(const Pathname &path,
-                                             bool            mtab=true) const;
-
-       /**
-        * Get the media source name or an empty string.
-        * \return media source name or empty string.
-        */
-       std::string      mediaSourceName() const
-       {
-         return _mediaSource ? _mediaSource->name : "";
-       }
-
-       /**
-        * Set new media source reference.
-        * \param ref The new reference.
-        */
-       void             setMediaSource(const MediaSourceRef &ref);
-
-       /**
-        * Ask the media manager if specified media source
-        * is already attached.
-        */
-       AttachedMedia
-       findAttachedMedia(const MediaSourceRef &media) const;
-
-       /**
-        * Returns the attached media. Used by MediaManager
-        * to find other handlers using the same source.
-        * \note This function increments reference counters
-        *       on the mediaSource and attachPoint references
-        *       it contains, for the life time of the returned
-        *       object. That is, it enables a (temporary) sharing
-        *       of them.
-        * \return The AttachedMedia struct containing (shared)
-        *         references to media source and attach point.
-        */
-       AttachedMedia    attachedMedia() const;
-
-       /**
-        * Returns a hint if the media is shared or not.
-        * \return true, if media is shared.
-        */
-       bool             isSharedMedia() const;
-
-       /**
-        * Check actual mediaSource attachment against the current
-        * mount table of the system. Used to implement isAttached().
-        * \param matchMountFs If to use the filesystem type from the
-        *        mount table (nfs, smb and cifs) or from mediaSource
-        *        while compare of a mount entry with mediaSource.
-        * \return true, if the media appears in the mount table.
-        */
-       bool             checkAttached(bool matchMountFs) const;
-
-       /**
-        * Call to this function will try to release all media matching
-        * the currenlty attached media source, that it is able to find
-        * in the mount table. This means also foreign (user) mounts!
-        * \param matchMountFs If to use the filesystem type from the
-        *        mount table (nfs, smb and cifs) or from mediaSource
-        *        while compare of a mount entry with mediaSource.
-        */
-       void             forceRelaseAllMedia(bool matchMountFs);
-       void             forceRelaseAllMedia(const MediaSourceRef &ref,
-                                            bool matchMountFs);
+                                              bool            mtab=true) const;
+
+        /**
+         * Get the media source name or an empty string.
+         * \return media source name or empty string.
+         */
+        std::string      mediaSourceName() const
+        {
+          return _mediaSource ? _mediaSource->name : "";
+        }
+
+        /**
+         * Set new media source reference.
+         * \param ref The new reference.
+         */
+        void             setMediaSource(const MediaSourceRef &ref);
+
+        /**
+         * Ask the media manager if specified media source
+         * is already attached.
+         */
+        AttachedMedia
+        findAttachedMedia(const MediaSourceRef &media) const;
+
+        /**
+         * Returns the attached media. Used by MediaManager
+         * to find other handlers using the same source.
+         * \note This function increments reference counters
+         *       on the mediaSource and attachPoint references
+         *       it contains, for the life time of the returned
+         *       object. That is, it enables a (temporary) sharing
+         *       of them.
+         * \return The AttachedMedia struct containing (shared)
+         *         references to media source and attach point.
+         */
+        AttachedMedia    attachedMedia() const;
+
+        /**
+         * Returns a hint if the media is shared or not.
+         * \return true, if media is shared.
+         */
+        bool             isSharedMedia() const;
+
+        /**
+         * Check actual mediaSource attachment against the current
+         * mount table of the system. Used to implement isAttached().
+         * \param matchMountFs If to use the filesystem type from the
+         *        mount table (nfs, smb and cifs) or from mediaSource
+         *        while compare of a mount entry with mediaSource.
+         * \return true, if the media appears in the mount table.
+         */
+        bool             checkAttached(bool matchMountFs) const;
+
+        /**
+         * Call to this function will try to release all media matching
+         * the currenlty attached media source, that it is able to find
+         * in the mount table. This means also foreign (user) mounts!
+         * \param matchMountFs If to use the filesystem type from the
+         *        mount table (nfs, smb and cifs) or from mediaSource
+         *        while compare of a mount entry with mediaSource.
+         */
+        void             forceRelaseAllMedia(bool matchMountFs);
+        void             forceRelaseAllMedia(const MediaSourceRef &ref,
+                                             bool matchMountFs);
 
     protected:
 
@@ -290,70 +290,70 @@ class MediaHandler {
         //
         ///////////////////////////////////////////////////////////////////
 
-       /**
-        * Call concrete handler to attach the media.
-        *
-        * Asserted that not already attached, and attachPoint is a directory.
-        *
-        * @param next try next available device in turn until end of device
-        * list is reached (for media which are accessible through multiple
-        * devices like cdroms).
-        *
-        * \throws MediaException
-        *
-        **/
-       virtual void attachTo(bool next = false) = 0;
+        /**
+         * Call concrete handler to attach the media.
+         *
+         * Asserted that not already attached, and attachPoint is a directory.
+         *
+         * @param next try next available device in turn until end of device
+         * list is reached (for media which are accessible through multiple
+         * devices like cdroms).
+         *
+         * \throws MediaException
+         *
+         **/
+        virtual void attachTo(bool next = false) = 0;
 
         /**
          * Call concrete handler to disconnect media.
-        *
-        * Asserted that media is attached.
-        *
+         *
+         * Asserted that media is attached.
+         *
          * This is useful for media which e.g. holds open a connection to a
          * server like FTP. After calling disconnect() the media object still is
          * valid and files are present.
-        *
+         *
          * After calling disconnect() it's not possible to call provideFile() or
          * provideDir() anymore.
-        *
-        * \throws MediaException
-        *
-        **/
+         *
+         * \throws MediaException
+         *
+         **/
         virtual void disconnectFrom() { return; }
 
-       /**
-        * Call concrete handler to release the media.
-        *
-        * If eject is true, and the media is used in one handler
-        * instance only, physically eject the media (i.e. CD-ROM).
-        *
-        * Asserted that media is attached.
-        * \param ejectDev Device to eject. None if empty.
-        *
-        * \throws MediaException
-        *
-        **/
-       virtual void releaseFrom( const std::string & ejectDev = "" ) = 0;
-
-       /**
-        * Call concrete handler to physically eject the media (i.e. CD-ROM)
-        * in case the media is not attached..
-        *
-        * Asserted that media is not attached.
-        **/
-       virtual void forceEject( const std::string & device ) {}
-
-        /**
-        * Call concrete handler to provide file below attach point.
-        *
-        * Default implementation provided, that returns whether a file
-        * is located at 'localRoot + filename'.
-        *
-        * Asserted that media is attached.
-        *
-        * \throws MediaException
-        *
-        **/
+        /**
+         * Call concrete handler to release the media.
+         *
+         * If eject is true, and the media is used in one handler
+         * instance only, physically eject the media (i.e. CD-ROM).
+         *
+         * Asserted that media is attached.
+         * \param ejectDev Device to eject. None if empty.
+         *
+         * \throws MediaException
+         *
+         **/
+        virtual void releaseFrom( const std::string & ejectDev = "" ) = 0;
+
+        /**
+         * Call concrete handler to physically eject the media (i.e. CD-ROM)
+         * in case the media is not attached..
+         *
+         * Asserted that media is not attached.
+         **/
+        virtual void forceEject( const std::string & device ) {}
+
+        /**
+         * Call concrete handler to provide file below attach point.
+         *
+         * Default implementation provided, that returns whether a file
+         * is located at 'localRoot + filename'.
+         *
+         * Asserted that media is attached.
+         *
+         * \throws MediaException
+         *
+         **/
         virtual void getFile( const OnMediaLocation &file ) const;
 
         /**
@@ -363,59 +363,59 @@ class MediaHandler {
          *
          * Default implementation provided that calls getFile(srcFilename)
          * and copies the result around.
-        *
-        * \throws MediaException
-        *
+         *
+         * \throws MediaException
+         *
          **/
         virtual void getFileCopy( const OnMediaLocation & file, const Pathname & targetFilename ) const;
 
 
-       /**
-        * Call concrete handler to provide directory content (not recursive!)
-        * below attach point.
-        *
-        * Return E_not_supported_by_media if media does not support retrieval of
-        * directory content.
-        *
-        * Default implementation provided, that returns whether a directory
-        * is located at 'localRoot + dirname'.
-        *
-        * Asserted that media is attached.
-        *
-        * \throws MediaException
-        *
-        **/
-       virtual void getDir( const Pathname & dirname, bool recurse_r ) const = 0;
-
-       /**
-        * Call concrete handler to provide a content list of directory on media
-        * via retlist. If dots is false entries starting with '.' are not reported.
-        *
-        * Return E_not_supported_by_media if media does not support retrieval of
-        * directory content.
-        *
-        * Default implementation provided, that returns the content of a
-        * directory at 'localRoot + dirnname' retrieved via 'readdir'.
-        *
-        * Asserted that media is attached and retlist is empty.
-        *
-        * \throws MediaException
-        *
-        **/
+        /**
+         * Call concrete handler to provide directory content (not recursive!)
+         * below attach point.
+         *
+         * Return E_not_supported_by_media if media does not support retrieval of
+         * directory content.
+         *
+         * Default implementation provided, that returns whether a directory
+         * is located at 'localRoot + dirname'.
+         *
+         * Asserted that media is attached.
+         *
+         * \throws MediaException
+         *
+         **/
+        virtual void getDir( const Pathname & dirname, bool recurse_r ) const = 0;
+
+        /**
+         * Call concrete handler to provide a content list of directory on media
+         * via retlist. If dots is false entries starting with '.' are not reported.
+         *
+         * Return E_not_supported_by_media if media does not support retrieval of
+         * directory content.
+         *
+         * Default implementation provided, that returns the content of a
+         * directory at 'localRoot + dirnname' retrieved via 'readdir'.
+         *
+         * Asserted that media is attached and retlist is empty.
+         *
+         * \throws MediaException
+         *
+         **/
         virtual void getDirInfo( std::list<std::string> & retlist,
                                  const Pathname & dirname, bool dots = true ) const = 0;
 
-       /**
-        * Basically the same as getDirInfo above. The content list is returned as
-        * filesystem::DirContent, which includes name and filetype of each directory
-        * entry. Retrieving the filetype usg. requires an additional ::stat call for
-        * each entry, thus it's more expensive than a simple readdir.
-        *
-        * Asserted that media is attached and retlist is empty.
-        *
-        * \throws MediaException
-        *
-        **/
+        /**
+         * Basically the same as getDirInfo above. The content list is returned as
+         * filesystem::DirContent, which includes name and filetype of each directory
+         * entry. Retrieving the filetype usg. requires an additional ::stat call for
+         * each entry, thus it's more expensive than a simple readdir.
+         *
+         * Asserted that media is attached and retlist is empty.
+         *
+         * \throws MediaException
+         *
+         **/
         virtual void getDirInfo( filesystem::DirContent & retlist,
                                  const Pathname & dirname, bool dots = true ) const = 0;
 
@@ -432,50 +432,50 @@ class MediaHandler {
   protected:
 
         /**
-        * Retrieve and if available scan dirname/directory.yast.
-        *
-        * Asserted that media is attached.
-        *
-        * \throws MediaException
-        *
-        **/
+         * Retrieve and if available scan dirname/directory.yast.
+         *
+         * Asserted that media is attached.
+         *
+         * \throws MediaException
+         *
+         **/
         void getDirectoryYast( std::list<std::string> & retlist,
                                const Pathname & dirname, bool dots = true ) const;
 
         /**
-        * Retrieve and if available scan dirname/directory.yast.
-        *
-        * Asserted that media is attached.
-        *
-        * \throws MediaException
-        *
-        **/
+         * Retrieve and if available scan dirname/directory.yast.
+         *
+         * Asserted that media is attached.
+         *
+         * \throws MediaException
+         *
+         **/
         void getDirectoryYast( filesystem::DirContent & retlist,
                                const Pathname & dirname, bool dots = true ) const;
 
   public:
 
-       /**
-        * If the concrete media handler provides a nonempty
-        * attach_point, it must be an existing directory.
-        *
-        * On an empty attach_point, MediaHandler will create
-        * a temporay directory, which will be erased from
-        * destructor.
-        *
-        * On any error, the attach_point is set to an empty Pathname,
-        * which should lead to E_bad_attachpoint.
-        **/
-       MediaHandler ( const Url&       url_r,
-                      const Pathname & attach_point_r,
-                      const Pathname & urlpath_below_attachpoint_r,
-                      const bool       does_download_r );
-
-       /**
-        * Contolling MediaAccess takes care, that attached media is released
-        * prior to deleting this.
-        **/
-       virtual ~MediaHandler();
+        /**
+         * If the concrete media handler provides a nonempty
+         * attach_point, it must be an existing directory.
+         *
+         * On an empty attach_point, MediaHandler will create
+         * a temporay directory, which will be erased from
+         * destructor.
+         *
+         * On any error, the attach_point is set to an empty Pathname,
+         * which should lead to E_bad_attachpoint.
+         **/
+        MediaHandler ( const Url&       url_r,
+                       const Pathname & attach_point_r,
+                       const Pathname & urlpath_below_attachpoint_r,
+                       const bool       does_download_r );
+
+        /**
+         * Contolling MediaAccess takes care, that attached media is released
+         * prior to deleting this.
+         **/
+        virtual ~MediaHandler();
 
     public:
 
@@ -487,186 +487,186 @@ class MediaHandler {
         //
         ///////////////////////////////////////////////////////////////////
 
-       /**
-        * Hint if files are downloaded or not.
-        */
-       bool        downloads() const { return _does_download; }
+        /**
+         * Hint if files are downloaded or not.
+         */
+        bool        downloads() const { return _does_download; }
 
         /**
-        * Protocol hint for MediaAccess.
-        **/
+         * Protocol hint for MediaAccess.
+         **/
         std::string protocol() const { return _url.getScheme(); }
 
-       /**
-        * Url used.
-        **/
+        /**
+         * Url used.
+         **/
         Url url() const { return _url; }
 
-       /**
-        * Use concrete handler to attach the media.
-        *
-        * @param next try next available device in turn until end of device
-        * list is reached (for media which are accessible through multiple
-        * devices like cdroms).
-        *
-        * \throws MediaException
-        *
-        **/
-       void attach(bool next);
-
-       /**
-        * True if media is attached.
-        **/
-       virtual bool isAttached() const { return _mediaSource != nullptr; }
-
-       /**
-        * Return the local directory that corresponds to medias url,
-        * no matter if media isAttached or not. Files requested will
-        * be available at 'localRoot() + filename' or better
-        * 'localPath( filename )'.
-        *
-        * Returns empty pathname if E_bad_attachpoint
-        **/
-       Pathname localRoot() const;
-
-       /**
-        * Files provided will be available at 'localPath(filename)'.
-        *
-        * Returns empty pathname if E_bad_attachpoint
-        **/
+        /**
+         * Use concrete handler to attach the media.
+         *
+         * @param next try next available device in turn until end of device
+         * list is reached (for media which are accessible through multiple
+         * devices like cdroms).
+         *
+         * \throws MediaException
+         *
+         **/
+        void attach(bool next);
+
+        /**
+         * True if media is attached.
+         **/
+        virtual bool isAttached() const { return _mediaSource != nullptr; }
+
+        /**
+         * Return the local directory that corresponds to medias url,
+         * no matter if media isAttached or not. Files requested will
+         * be available at 'localRoot() + filename' or better
+         * 'localPath( filename )'.
+         *
+         * Returns empty pathname if E_bad_attachpoint
+         **/
+        Pathname localRoot() const;
+
+        /**
+         * Files provided will be available at 'localPath(filename)'.
+         *
+         * Returns empty pathname if E_bad_attachpoint
+         **/
          Pathname localPath( const Pathname & pathname ) const;
 
         /**
-        * Use concrete handler to isconnect media.
-        *
-        * This is useful for media which e.g. holds open a connection to a
-        * server like FTP. After calling disconnect() the media object still is
-        * valid and files are present.
-        *
-        * After calling disconnect() it's not possible to call provideFile() or
-        * provideDir() anymore.
-        *
-        * \throws MediaException
-        *
-        **/
+         * Use concrete handler to isconnect media.
+         *
+         * This is useful for media which e.g. holds open a connection to a
+         * server like FTP. After calling disconnect() the media object still is
+         * valid and files are present.
+         *
+         * After calling disconnect() it's not possible to call provideFile() or
+         * provideDir() anymore.
+         *
+         * \throws MediaException
+         *
+         **/
         void disconnect();
 
-       /**
-        * Use concrete handler to release the media.
-        * @param eject Device to physically eject. None if empty.
-        *
-        * \throws MediaException
-        **/
-       void release( const std::string & ejectDev = "" );
-
-       /**
-        * Use concrete handler to provide file denoted by path below
-        * 'localRoot'. Filename is interpreted relative to the
-        * attached url and a path prefix is preserved.
-        *
-        * \throws MediaException
-        *
-        **/
-       void provideFile( const OnMediaLocation &file ) const;
-
-       /**
-        * Call concrete handler to provide a copy of a file under a different place
+        /**
+         * Use concrete handler to release the media.
+         * @param eject Device to physically eject. None if empty.
+         *
+         * \throws MediaException
+         **/
+        void release( const std::string & ejectDev = "" );
+
+        /**
+         * Use concrete handler to provide file denoted by path below
+         * 'localRoot'. Filename is interpreted relative to the
+         * attached url and a path prefix is preserved.
+         *
+         * \throws MediaException
+         *
+         **/
+        void provideFile( const OnMediaLocation &file ) const;
+
+        /**
+         * Call concrete handler to provide a copy of a file under a different place
          * in the file system (usually not under attach point) as a copy.
          * Media must be attached before by callee.
          *
          * @param srcFilename    Filename of source file on the media
          * @param targetFilename Filename for the target in the file system
-        *
-        * \throws MediaException
-        *
-        **/
+         *
+         * \throws MediaException
+         *
+         **/
         void provideFileCopy( const OnMediaLocation &srcFile, Pathname targetFilename ) const;
 
-       /**
-        * Use concrete handler to provide directory denoted
-        * by path below 'localRoot' (not recursive!).
-        * dirname is interpreted relative to the
-        * attached url and a path prefix is preserved.
-        *
-        * \throws MediaException
-        *
-        **/
-       void provideDir( Pathname dirname ) const;
-
-       /**
-        * Use concrete handler to provide directory tree denoted
-        * by path below 'localRoot' (recursive!!).
-        * dirname is interpreted relative to the
-        * attached url and a path prefix is preserved.
-        *
-        * \throws MediaException
-        *
-        **/
-       void provideDirTree( Pathname dirname ) const;
-
-       /**
-        * Remove filename below localRoot IFF handler downloads files
-        * to the local filesystem. Never remove anything from media.
-        *
-        * \throws MediaException
-        *
-        **/
-       void releaseFile( const Pathname & filename ) const { return releasePath( filename ); }
-
-       /**
-        * Remove directory tree below localRoot IFF handler downloads files
-        * to the local filesystem. Never remove anything from media.
-        *
-        * \throws MediaException
-        *
-        **/
-       void releaseDir( const Pathname & dirname ) const { return releasePath( dirname ); }
-
-       /**
-        * Remove pathname below localRoot IFF handler downloads files
-        * to the local filesystem. Never remove anything from media.
-        *
-        * If pathname denotes a directory it is recursively removed.
-        * If pathname is empty or '/' everything below the localRoot
-        * is recursively removed.
-        * If pathname denotes a file it is unlinked.
-        *
-        * \throws MediaException
-        *
-        **/
-       void releasePath( Pathname pathname ) const;
+        /**
+         * Use concrete handler to provide directory denoted
+         * by path below 'localRoot' (not recursive!).
+         * dirname is interpreted relative to the
+         * attached url and a path prefix is preserved.
+         *
+         * \throws MediaException
+         *
+         **/
+        void provideDir( Pathname dirname ) const;
+
+        /**
+         * Use concrete handler to provide directory tree denoted
+         * by path below 'localRoot' (recursive!!).
+         * dirname is interpreted relative to the
+         * attached url and a path prefix is preserved.
+         *
+         * \throws MediaException
+         *
+         **/
+        void provideDirTree( Pathname dirname ) const;
+
+        /**
+         * Remove filename below localRoot IFF handler downloads files
+         * to the local filesystem. Never remove anything from media.
+         *
+         * \throws MediaException
+         *
+         **/
+        void releaseFile( const Pathname & filename ) const { return releasePath( filename ); }
+
+        /**
+         * Remove directory tree below localRoot IFF handler downloads files
+         * to the local filesystem. Never remove anything from media.
+         *
+         * \throws MediaException
+         *
+         **/
+        void releaseDir( const Pathname & dirname ) const { return releasePath( dirname ); }
+
+        /**
+         * Remove pathname below localRoot IFF handler downloads files
+         * to the local filesystem. Never remove anything from media.
+         *
+         * If pathname denotes a directory it is recursively removed.
+         * If pathname is empty or '/' everything below the localRoot
+         * is recursively removed.
+         * If pathname denotes a file it is unlinked.
+         *
+         * \throws MediaException
+         *
+         **/
+        void releasePath( Pathname pathname ) const;
 
     public:
 
-       /**
-        * Return content of directory on media via retlist. If dots is false
-        * entries starting with '.' are not reported.
-        *
-        * The request is forwarded to the concrete handler,
-        * which may atempt to retieve the content e.g. via 'readdir'
-        *
-        * <B>Caution:</B> This is not supported by all media types.
-        * Be prepared to handle E_not_supported_by_media.
-        *
-        * \throws MediaException
-        *
-        **/
+        /**
+         * Return content of directory on media via retlist. If dots is false
+         * entries starting with '.' are not reported.
+         *
+         * The request is forwarded to the concrete handler,
+         * which may atempt to retieve the content e.g. via 'readdir'
+         *
+         * <B>Caution:</B> This is not supported by all media types.
+         * Be prepared to handle E_not_supported_by_media.
+         *
+         * \throws MediaException
+         *
+         **/
         void dirInfo( std::list<std::string> & retlist,
                       const Pathname & dirname, bool dots = true ) const;
 
-       /**
-        * Basically the same as dirInfo above. The content is returned as
-        * filesystem::DirContent, which includes name and filetype of each directory
-        * entry. Retrieving the filetype usg. requires an additional ::stat call for
-        * each entry, thus it's more expensive than a simple readdir.
-        *
-        * <B>Caution:</B> This is not supported by all media types.
-        * Be prepared to handle E_not_supported_by_media.
-        *
-        * \throws MediaException
-        *
-        **/
-       void dirInfo( filesystem::DirContent & retlist,
+        /**
+         * Basically the same as dirInfo above. The content is returned as
+         * filesystem::DirContent, which includes name and filetype of each directory
+         * entry. Retrieving the filetype usg. requires an additional ::stat call for
+         * each entry, thus it's more expensive than a simple readdir.
+         *
+         * <B>Caution:</B> This is not supported by all media types.
+         * Be prepared to handle E_not_supported_by_media.
+         *
+         * \throws MediaException
+         *
+         **/
+        void dirInfo( filesystem::DirContent & retlist,
                       const Pathname & dirname, bool dots = true ) const;
 
         /**
index 6b26a83..2e04948 100644 (file)
@@ -62,56 +62,56 @@ namespace zypp::media {
       WhichHandler which = choose;
       // Leagcy: choose handler in UUrl query
       if ( const std::string & queryparam = url.getQueryParam("mediahandler"); ! queryparam.empty() ) {
-       if ( queryparam == "network" )
-         which = network;
-       else if ( queryparam == "multicurl" )
-         which = multicurl;
-       else if ( queryparam == "curl" )
-         which = curl;
-       else
-         WAR << "Unknown mediahandler='" << queryparam << "' in URL; Choosing the default" << std::endl;
+        if ( queryparam == "network" )
+          which = network;
+        else if ( queryparam == "multicurl" )
+          which = multicurl;
+        else if ( queryparam == "curl" )
+          which = curl;
+        else
+          WAR << "Unknown mediahandler='" << queryparam << "' in URL; Choosing the default" << std::endl;
       }
       // Otherwise choose handler through ENV
       if ( which == choose ) {
-       auto getenvIs = []( std::string_view var, std::string_view val )->bool {
-         const char * v = ::getenv( var.data() );
-         return v && v == val;
-       };
-
-       if ( getenvIs( "ZYPP_MEDIANETWORK", "1" ) ) {
-         WAR << "network backend manually enabled." << std::endl;
-         which = network;
-       }
-       else if ( getenvIs( "ZYPP_MULTICURL", "0" ) ) {
-         WAR << "multicurl manually disabled." << std::endl;
-         which = curl;
-       }
-       else
-         which = multicurl;
+        auto getenvIs = []( std::string_view var, std::string_view val )->bool {
+          const char * v = ::getenv( var.data() );
+          return v && v == val;
+        };
+
+        if ( getenvIs( "ZYPP_MEDIANETWORK", "1" ) ) {
+          WAR << "network backend manually enabled." << std::endl;
+          which = network;
+        }
+        else if ( getenvIs( "ZYPP_MULTICURL", "0" ) ) {
+          WAR << "multicurl manually disabled." << std::endl;
+          which = curl;
+        }
+        else
+          which = multicurl;
       }
       // Finally use the default
       std::unique_ptr<MediaNetworkCommonHandler> handler;
       switch ( which ) {
-       case network:
-         handler = std::make_unique<zyppng::MediaNetwork>( url, preferred_attach_point );
-         break;
-
-       default:
-       case multicurl:
-         handler = std::make_unique<MediaMultiCurl>( url, preferred_attach_point );
-         break;
-
-       case curl:
-         handler = std::make_unique<MediaCurl>( url, preferred_attach_point );
-         break;
+        case network:
+          handler = std::make_unique<zyppng::MediaNetwork>( url, preferred_attach_point );
+          break;
+
+        default:
+        case multicurl:
+          handler = std::make_unique<MediaMultiCurl>( url, preferred_attach_point );
+          break;
+
+        case curl:
+          handler = std::make_unique<MediaCurl>( url, preferred_attach_point );
+          break;
       }
       // Set up the handler
       for ( const auto & el : custom_headers ) {
-       std::string header { el.first };
-       header += ": ";
-       header += el.second;
-       MIL << "Added custom header -> " << header << std::endl;
-       handler->settings().addHeader( std::move(header) );
+        std::string header { el.first };
+        header += ": ";
+        header += el.second;
+        MIL << "Added custom header -> " << header << std::endl;
+        handler->settings().addHeader( std::move(header) );
       }
       _handler = std::move(handler);
 
index b3c932d..61a4951 100644 (file)
@@ -83,9 +83,9 @@ namespace zypp
       {
         ZYPP_CAUGHT(e);
         ERR << "Unable to parse iso filename source media url" << std::endl;
-       MediaBadUrlException ne(_url);
-       ne.remember(e);
-       ZYPP_THROW(ne);
+        MediaBadUrlException ne(_url);
+        ne.remember(e);
+        ZYPP_THROW(ne);
       }
       if( !src.isValid())
       {
@@ -169,12 +169,12 @@ namespace zypp
           ZYPP_CAUGHT(e2);
         }
 
-       MediaMountException e3(
+        MediaMountException e3(
           "Unable to find iso filename on source media",
           _url.asString(), attachPoint().asString()
         );
-       e3.remember(e1);
-       ZYPP_THROW(e3);
+        e3.remember(e1);
+        ZYPP_THROW(e3);
       }
 
       // if the provided file is a symlink, expand it (#274651)
@@ -205,7 +205,7 @@ namespace zypp
 
       if( !isUseableAttachPoint( attachPoint() ) )
       {
-       setAttachPoint( createAttachPoint(), true );
+        setAttachPoint( createAttachPoint(), true );
       }
       std::string mountpoint( attachPoint().asString() );
       std::string mountopts("ro,loop");
index 3e1505f..366e5e9 100644 (file)
@@ -40,10 +40,10 @@ namespace zypp
 
       protected:
 
-       virtual void attachTo (bool next = false) override;
+        virtual void attachTo (bool next = false) override;
         virtual void releaseFrom( const std::string & ejectDev = "" ) override;
-       virtual void getFile( const OnMediaLocation & file ) const override;
-       virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
+        virtual void getFile( const OnMediaLocation & file ) const override;
+        virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
         virtual void getDirInfo( std::list<std::string> & retlist,
                                  const Pathname & dirname, bool dots = true ) const override;
         virtual void getDirInfo( filesystem::DirContent & retlist,
index d83bbe1..3a2b4db 100644 (file)
@@ -378,7 +378,7 @@ namespace zypp
     }
 
     // ---------------------------------------------------------------
-         bool
+          bool
     MediaManager::downloads(MediaAccessId accessId) const
     {
       ManagedMedia &ref( m_impl->findMM(accessId));
index e1b13db..5e1e87a 100644 (file)
@@ -162,9 +162,9 @@ public:
   int _maxworkers;
 };
 
-#define BLKSIZE                131072
-#define MAXURLS                10
-
+constexpr auto MIN_REQ_MIRRS = 4;
+constexpr auto BLKSIZE       = 131072;
+constexpr auto MAXURLS       = 10;
 
 //////////////////////////////////////////////////////////////////////
 
@@ -200,12 +200,12 @@ multifetchworker::writefunction(void *ptr, size_t size)
       char *effurl;
       (void)curl_easy_getinfo(_curl, CURLINFO_EFFECTIVE_URL, &effurl);
       if (effurl && !strncasecmp(effurl, "http", 4))
-       {
-         long statuscode = 0;
-         (void)curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &statuscode);
-         if (statuscode != 206)
-           return size ? 0 : 1;
-       }
+        {
+          long statuscode = 0;
+          (void)curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &statuscode);
+          if (statuscode != 206)
+            return size ? 0 : 1;
+        }
     }
 
   _blkreceived += len;
@@ -234,7 +234,7 @@ multifetchworker::writefunction(void *ptr, size_t size)
       _off += cnt;
       _size -= cnt;
       if (cnt == len)
-       return size;
+        return size;
     }
   return cnt;
 }
@@ -254,7 +254,7 @@ multifetchworker::headerfunction(char *p, size_t size)
     {
       std::string line(p + 9, l - 9);
       if (line[l - 10] == '\r')
-       line.erase(l - 10, 1);
+        line.erase(l - 10, 1);
       XXX << "#" << _workerno << ": redirecting to" << line << endl;
       return size;
     }
@@ -279,7 +279,7 @@ multifetchworker::headerfunction(char *p, size_t size)
       WAR << "#" << _workerno << ": setting request filesize to " << filesize << endl;
       _request->_filesize = filesize;
       if (_request->_totalsize == 0 && !_request->_blklist)
-       _request->_totalsize = filesize;
+        _request->_totalsize = filesize;
     }
   if (_request->_filesize != (off_t)filesize)
     {
@@ -359,19 +359,19 @@ multifetchworker::multifetchworker(int no, multifetchrequest &request, const Url
       _settings.setPassword(_request->_context->_settings.password());
       _settings.setAuthType(_request->_context->_settings.authType());
       if ( _settings.userPassword().size() )
-       {
-         curl_easy_setopt(_curl, CURLOPT_USERPWD, _settings.userPassword().c_str());
-         std::string use_auth = _settings.authType();
-         if (use_auth.empty())
-           use_auth = "digest,basic";        // our default
-         long auth = CurlAuthData::auth_type_str2long(use_auth);
-         if( auth != CURLAUTH_NONE)
-         {
-           XXX << "#" << _workerno << ": Enabling HTTP authentication methods: " << use_auth
-               << " (CURLOPT_HTTPAUTH=" << auth << ")" << std::endl;
-           curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, auth);
-         }
-       }
+        {
+          curl_easy_setopt(_curl, CURLOPT_USERPWD, _settings.userPassword().c_str());
+          std::string use_auth = _settings.authType();
+          if (use_auth.empty())
+            use_auth = "digest,basic";        // our default
+          long auth = CurlAuthData::auth_type_str2long(use_auth);
+          if( auth != CURLAUTH_NONE)
+          {
+            XXX << "#" << _workerno << ": Enabling HTTP authentication methods: " << use_auth
+                << " (CURLOPT_HTTPAUTH=" << auth << ")" << std::endl;
+            curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, auth);
+          }
+        }
     }
   checkdns();
 }
@@ -383,17 +383,17 @@ multifetchworker::~multifetchworker()
       if (_state == WORKER_FETCH || _state == WORKER_DISCARD)
         curl_multi_remove_handle(_request->_multi, _curl);
       if (_state == WORKER_DONE || _state == WORKER_SLEEP)
-       {
+        {
 #if CURLVERSION_AT_LEAST(7,15,5)
-         curl_easy_setopt(_curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)0);
+          curl_easy_setopt(_curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)0);
 #endif
-         curl_easy_setopt(_curl, CURLOPT_PRIVATE, (void *)0);
-         curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, (void *)0);
-         curl_easy_setopt(_curl, CURLOPT_WRITEDATA, (void *)0);
-         curl_easy_setopt(_curl, CURLOPT_HEADERFUNCTION, (void *)0);
-         curl_easy_setopt(_curl, CURLOPT_HEADERDATA, (void *)0);
+          curl_easy_setopt(_curl, CURLOPT_PRIVATE, (void *)0);
+          curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, (void *)0);
+          curl_easy_setopt(_curl, CURLOPT_WRITEDATA, (void *)0);
+          curl_easy_setopt(_curl, CURLOPT_HEADERFUNCTION, (void *)0);
+          curl_easy_setopt(_curl, CURLOPT_HEADERDATA, (void *)0);
           _request->_context->toEasyPool(_url.getHost(), _curl);
-       }
+        }
       else
         curl_easy_cleanup(_curl);
       _curl = 0;
@@ -404,7 +404,7 @@ multifetchworker::~multifetchworker()
       int status;
       while (waitpid(_pid, &status, 0) == -1)
         if (errno != EINTR)
-         break;
+          break;
       _pid = 0;
     }
   if (_dnspipe != -1)
@@ -453,7 +453,7 @@ multifetchworker::checkdns()
     {
       std::transform(schemeproxy.begin(), schemeproxy.end(), schemeproxy.begin(), ::toupper);
       if (env_isset(schemeproxy))
-       return;
+        return;
     }
 
   XXX << "checking DNS lookup of " << host << endl;
@@ -483,14 +483,14 @@ multifetchworker::checkdns()
       aihints.ai_family = PF_UNSPEC;
       int tstsock = socket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
       if (tstsock == -1)
-       aihints.ai_family = PF_INET;
+        aihints.ai_family = PF_INET;
       else
-       close(tstsock);
+        close(tstsock);
       aihints.ai_socktype = SOCK_STREAM;
       aihints.ai_flags = AI_CANONNAME;
       unsigned int connecttimeout = _request->_connect_timeout;
       if (connecttimeout)
-       alarm(connecttimeout);
+        alarm(connecttimeout);
       signal(SIGALRM, SIG_DFL);
       if (getaddrinfo(host.c_str(), NULL, &aihints, &ai))
         _exit(1);
@@ -573,7 +573,7 @@ multifetchworker::recheckChecksum()
     {
       size_t cnt = l > sizeof(buf) ? sizeof(buf) : l;
       if (fread(buf, cnt, 1, _request->_fp) != 1)
-       return false;
+        return false;
       _dig.update(buf, cnt);
       l -= cnt;
     }
@@ -596,36 +596,36 @@ multifetchworker::stealjob()
     {
       multifetchworker *worker = *workeriter;
       if (worker == this)
-       continue;
+        continue;
       if (worker->_pass == -1)
-       continue;       // do not steal!
+        continue;      // do not steal!
       if (worker->_state == WORKER_DISCARD || worker->_state == WORKER_DONE || worker->_state == WORKER_SLEEP || !worker->_blksize)
-       continue;       // do not steal finished jobs
+        continue;      // do not steal finished jobs
       if (!worker->_avgspeed && worker->_blkreceived)
-       {
-         if (!now)
-           now = currentTime();
-         if (now > worker->_blkstarttime)
-           worker->_avgspeed = worker->_blkreceived / (now - worker->_blkstarttime);
-       }
+        {
+          if (!now)
+            now = currentTime();
+          if (now > worker->_blkstarttime)
+            worker->_avgspeed = worker->_blkreceived / (now - worker->_blkstarttime);
+        }
       if (!best || best->_pass > worker->_pass)
-       {
+        {
           best = worker;
-         continue;
-       }
+          continue;
+        }
       if (best->_pass < worker->_pass)
-       continue;
+        continue;
       // if it is the same block, we want to know the best worker, otherwise the worst
       if (worker->_blkstart == best->_blkstart)
-       {
-         if ((worker->_blksize - worker->_blkreceived) * best->_avgspeed < (best->_blksize - best->_blkreceived) * worker->_avgspeed)
-           best = worker;
-       }
+        {
+          if ((worker->_blksize - worker->_blkreceived) * best->_avgspeed < (best->_blksize - best->_blkreceived) * worker->_avgspeed)
+            best = worker;
+        }
       else
-       {
-         if ((worker->_blksize - worker->_blkreceived) * best->_avgspeed > (best->_blksize - best->_blkreceived) * worker->_avgspeed)
-           best = worker;
-       }
+        {
+          if ((worker->_blksize - worker->_blkreceived) * best->_avgspeed > (best->_blksize - best->_blkreceived) * worker->_avgspeed)
+            best = worker;
+        }
     }
   if (!best)
     {
@@ -638,30 +638,30 @@ multifetchworker::stealjob()
   if (_state != WORKER_SLEEP)
     {
       if (!_avgspeed && _blkreceived)
-       {
-         if (!now)
-           now = currentTime();
-         if (now > _blkstarttime)
-           _avgspeed = _blkreceived / (now - _blkstarttime);
-       }
+        {
+          if (!now)
+            now = currentTime();
+          if (now > _blkstarttime)
+            _avgspeed = _blkreceived / (now - _blkstarttime);
+        }
 
       // lets see if we should sleep a bit
       XXX << "me #" << _workerno << ": " << _avgspeed << ", size " << best->_blksize << endl;
       XXX << "best #" << best->_workerno << ": " << best->_avgspeed << ", size " << (best->_blksize - best->_blkreceived) << endl;
       if (_avgspeed && best->_avgspeed && best->_blksize - best->_blkreceived > 0 &&
           (best->_blksize - best->_blkreceived) * _avgspeed < best->_blksize * best->_avgspeed)
-       {
-         if (!now)
-           now = currentTime();
-         double sl = (best->_blksize - best->_blkreceived) / best->_avgspeed * 2;
-         if (sl > 1)
-           sl = 1;
-         XXX << "#" << _workerno << ": going to sleep for " << sl * 1000 << " ms" << endl;
-         _sleepuntil = now + sl;
-         _state = WORKER_SLEEP;
-         _request->_sleepworkers++;
-         return;
-       }
+        {
+          if (!now)
+            now = currentTime();
+          double sl = (best->_blksize - best->_blkreceived) / best->_avgspeed * 2;
+          if (sl > 1)
+            sl = 1;
+          XXX << "#" << _workerno << ": going to sleep for " << sl * 1000 << " ms" << endl;
+          _sleepuntil = now + sl;
+          _state = WORKER_SLEEP;
+          _request->_sleepworkers++;
+          return;
+        }
     }
 
   _competing = true;
@@ -682,13 +682,13 @@ multifetchworker::disableCompetition()
     {
       multifetchworker *worker = *workeriter;
       if (worker == this)
-       continue;
+        continue;
       if (worker->_blkstart == _blkstart)
-       {
-         if (worker->_state == WORKER_FETCH)
-           worker->_state = WORKER_DISCARD;
-         worker->_pass = -1;   /* do not steal this one, we already have it */
-       }
+        {
+          if (worker->_state == WORKER_FETCH)
+            worker->_state = WORKER_DISCARD;
+          worker->_pass = -1;  /* do not steal this one, we already have it */
+        }
     }
 }
 
@@ -708,33 +708,33 @@ multifetchworker::nextjob()
     {
       _blksize = BLKSIZE;
       if (_request->_filesize != off_t(-1))
-       {
-         if (_request->_blkoff >= _request->_filesize)
-           {
-             stealjob();
-             return;
-           }
-         _blksize = _request->_filesize - _request->_blkoff;
-         if (_blksize > BLKSIZE)
-           _blksize = BLKSIZE;
-       }
+        {
+          if (_request->_blkoff >= _request->_filesize)
+            {
+              stealjob();
+              return;
+            }
+          _blksize = _request->_filesize - _request->_blkoff;
+          if (_blksize > BLKSIZE)
+            _blksize = BLKSIZE;
+        }
     }
   else
     {
       MediaBlock blk = blklist->getBlock(_request->_blkno);
       while (_request->_blkoff >= (off_t)(blk.off + blk.size))
-       {
-         if (++_request->_blkno == blklist->numBlocks())
-           {
-             stealjob();
-             return;
-           }
-         blk = blklist->getBlock(_request->_blkno);
-         _request->_blkoff = blk.off;
-       }
+        {
+          if (++_request->_blkno == blklist->numBlocks())
+            {
+              stealjob();
+              return;
+            }
+          blk = blklist->getBlock(_request->_blkno);
+          _request->_blkoff = blk.off;
+        }
       _blksize = blk.off + blk.size - _request->_blkoff;
       if (_blksize > BLKSIZE && !blklist->haveChecksum(_request->_blkno))
-       _blksize = BLKSIZE;
+        _blksize = BLKSIZE;
     }
   _blkno = _request->_blkno;
   _blkstart = _request->_blkoff;
@@ -816,10 +816,10 @@ multifetchrequest::multifetchrequest(const MediaMultiCurl *context, const Pathna
   if (blklist)
     {
       for (size_t blkno = 0; blkno < blklist->numBlocks(); blkno++)
-       {
-         MediaBlock blk = blklist->getBlock(blkno);
-         _totalsize += blk.size;
-       }
+        {
+          MediaBlock blk = blklist->getBlock(blkno);
+          _totalsize += blk.size;
+        }
     }
   else if (filesize != off_t(-1))
     _totalsize = filesize;
@@ -847,41 +847,41 @@ multifetchrequest::run(std::vector<Url> &urllist)
       int maxfd, nqueue;
 
       if (_finished)
-       {
-         XXX << "finished!" << endl;
-         break;
-       }
+        {
+          XXX << "finished!" << endl;
+          break;
+        }
 
       if ((int)_activeworkers < _maxworkers && urliter != urllist.end() && _workers.size() < MAXURLS)
-       {
-         // spawn another worker!
-         multifetchworker *worker = new multifetchworker(workerno++, *this, *urliter);
-         _workers.push_back(worker);
-         if (worker->_state != WORKER_BROKEN)
-           {
-             _activeworkers++;
-             if (worker->_state != WORKER_LOOKUP)
-               {
-                 worker->nextjob();
-               }
-             else
-               _lookupworkers++;
-           }
-         ++urliter;
-         continue;
-       }
+        {
+          // spawn another worker!
+          multifetchworker *worker = new multifetchworker(workerno++, *this, *urliter);
+          _workers.push_back(worker);
+          if (worker->_state != WORKER_BROKEN)
+            {
+              _activeworkers++;
+              if (worker->_state != WORKER_LOOKUP)
+                {
+                  worker->nextjob();
+                }
+              else
+                _lookupworkers++;
+            }
+          ++urliter;
+          continue;
+        }
       if (!_activeworkers)
-       {
-         WAR << "No more active workers!" << endl;
-         // show the first worker error we find
-         for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
-           {
-             if ((*workeriter)->_state != WORKER_BROKEN)
-               continue;
-             ZYPP_THROW(MediaCurlException(_baseurl, "Server error", (*workeriter)->_curlError));
-           }
-         break;
-       }
+        {
+          WAR << "No more active workers!" << endl;
+          // show the first worker error we find
+          for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
+            {
+              if ((*workeriter)->_state != WORKER_BROKEN)
+                continue;
+              ZYPP_THROW(MediaCurlException(_baseurl, "Server error", (*workeriter)->_curlError));
+            }
+          break;
+        }
 
       FD_ZERO(&rset);
       FD_ZERO(&wset);
@@ -891,7 +891,7 @@ multifetchrequest::run(std::vector<Url> &urllist)
 
       if (_lookupworkers)
         for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
-         (*workeriter)->adddnsfd(rset, maxfd);
+          (*workeriter)->adddnsfd(rset, maxfd);
 
       timeval tv;
       // if we added a new job we have to call multi_perform once
@@ -899,248 +899,248 @@ multifetchrequest::run(std::vector<Url> &urllist)
       tv.tv_sec = 0;
       tv.tv_usec = _havenewjob ? 0 : 200000;
       if (_sleepworkers && !_havenewjob)
-       {
-         if (_minsleepuntil == 0)
-           {
-             for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
-               {
-                 multifetchworker *worker = *workeriter;
-                 if (worker->_state != WORKER_SLEEP)
-                   continue;
-                 if (!_minsleepuntil || _minsleepuntil > worker->_sleepuntil)
-                   _minsleepuntil = worker->_sleepuntil;
-               }
-           }
-         double sl = _minsleepuntil - currentTime();
-         if (sl < 0)
-           {
-             sl = 0;
-             _minsleepuntil = 0;
-           }
-         if (sl < .2)
-           tv.tv_usec = sl * 1000000;
-       }
+        {
+          if (_minsleepuntil == 0)
+            {
+              for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
+                {
+                  multifetchworker *worker = *workeriter;
+                  if (worker->_state != WORKER_SLEEP)
+                    continue;
+                  if (!_minsleepuntil || _minsleepuntil > worker->_sleepuntil)
+                    _minsleepuntil = worker->_sleepuntil;
+                }
+            }
+          double sl = _minsleepuntil - currentTime();
+          if (sl < 0)
+            {
+              sl = 0;
+              _minsleepuntil = 0;
+            }
+          if (sl < .2)
+            tv.tv_usec = sl * 1000000;
+        }
       int r = select(maxfd + 1, &rset, &wset, &xset, &tv);
       if (r == -1 && errno != EINTR)
-       ZYPP_THROW(MediaCurlException(_baseurl, "select() failed", "unknown error"));
+        ZYPP_THROW(MediaCurlException(_baseurl, "select() failed", "unknown error"));
       if (r != 0 && _lookupworkers)
-       for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
-         {
-           multifetchworker *worker = *workeriter;
-           if (worker->_state != WORKER_LOOKUP)
-             continue;
-           (*workeriter)->dnsevent(rset);
-           if (worker->_state != WORKER_LOOKUP)
-             _lookupworkers--;
-         }
+        for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
+          {
+            multifetchworker *worker = *workeriter;
+            if (worker->_state != WORKER_LOOKUP)
+              continue;
+            (*workeriter)->dnsevent(rset);
+            if (worker->_state != WORKER_LOOKUP)
+              _lookupworkers--;
+          }
       _havenewjob = false;
 
       // run curl
       for (;;)
         {
           CURLMcode mcode;
-         int tasks;
+          int tasks;
           mcode = curl_multi_perform(_multi, &tasks);
           if (mcode == CURLM_CALL_MULTI_PERFORM)
             continue;
-         if (mcode != CURLM_OK)
-           ZYPP_THROW(MediaCurlException(_baseurl, "curl_multi_perform", "unknown error"));
-         break;
+          if (mcode != CURLM_OK)
+            ZYPP_THROW(MediaCurlException(_baseurl, "curl_multi_perform", "unknown error"));
+          break;
         }
 
       double now = currentTime();
 
       // update periodavg
       if (now > _lastperiodstart + .5)
-       {
-         if (!_periodavg)
-           _periodavg = (_fetchedsize - _lastperiodfetched) / (now - _lastperiodstart);
-         else
-           _periodavg = (_periodavg + (_fetchedsize - _lastperiodfetched) / (now - _lastperiodstart)) / 2;
-         _lastperiodfetched = _fetchedsize;
-         _lastperiodstart = now;
-       }
+        {
+          if (!_periodavg)
+            _periodavg = (_fetchedsize - _lastperiodfetched) / (now - _lastperiodstart);
+          else
+            _periodavg = (_periodavg + (_fetchedsize - _lastperiodfetched) / (now - _lastperiodstart)) / 2;
+          _lastperiodfetched = _fetchedsize;
+          _lastperiodstart = now;
+        }
 
       // wake up sleepers
       if (_sleepworkers)
-       {
-         for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
-           {
-             multifetchworker *worker = *workeriter;
-             if (worker->_state != WORKER_SLEEP)
-               continue;
-             if (worker->_sleepuntil > now)
-               continue;
-             if (_minsleepuntil == worker->_sleepuntil)
-               _minsleepuntil = 0;
-             XXX << "#" << worker->_workerno << ": sleep done, wake up" << endl;
-             _sleepworkers--;
-             // nextjob chnages the state
-             worker->nextjob();
-           }
-       }
+        {
+          for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
+            {
+              multifetchworker *worker = *workeriter;
+              if (worker->_state != WORKER_SLEEP)
+                continue;
+              if (worker->_sleepuntil > now)
+                continue;
+              if (_minsleepuntil == worker->_sleepuntil)
+                _minsleepuntil = 0;
+              XXX << "#" << worker->_workerno << ": sleep done, wake up" << endl;
+              _sleepworkers--;
+              // nextjob chnages the state
+              worker->nextjob();
+            }
+        }
 
       // collect all curl results, reschedule new jobs
       CURLMsg *msg;
       while ((msg = curl_multi_info_read(_multi, &nqueue)) != 0)
-       {
-         if (msg->msg != CURLMSG_DONE)
-           continue;
-         CURL *easy = msg->easy_handle;
-         CURLcode cc = msg->data.result;
-         multifetchworker *worker;
-         if (curl_easy_getinfo(easy, CURLINFO_PRIVATE, &worker) != CURLE_OK)
-           ZYPP_THROW(MediaCurlException(_baseurl, "curl_easy_getinfo", "unknown error"));
-         if (worker->_blkreceived && now > worker->_blkstarttime)
-           {
-             if (worker->_avgspeed)
-               worker->_avgspeed = (worker->_avgspeed + worker->_blkreceived / (now - worker->_blkstarttime)) / 2;
-             else
-               worker->_avgspeed = worker->_blkreceived / (now - worker->_blkstarttime);
-           }
-         XXX << "#" << worker->_workerno << ": BLK " << worker->_blkno << " done code " << cc << " speed " << worker->_avgspeed << endl;
-         curl_multi_remove_handle(_multi, easy);
-         if (cc == CURLE_HTTP_RETURNED_ERROR)
-           {
-             long statuscode = 0;
-             (void)curl_easy_getinfo(easy, CURLINFO_RESPONSE_CODE, &statuscode);
-             XXX << "HTTP status " << statuscode << endl;
-             if (statuscode == 416 && !_blklist)       /* Range error */
-               {
-                 if (_filesize == off_t(-1))
-                   {
-                     if (!worker->_noendrange)
-                       {
-                         XXX << "#" << worker->_workerno << ": retrying with no end range" << endl;
-                         worker->_noendrange = true;
-                         worker->run();
-                         continue;
-                       }
-                     worker->_noendrange = false;
-                     worker->stealjob();
-                     continue;
-                   }
-                 if (worker->_blkstart >= _filesize)
-                   {
-                     worker->nextjob();
-                     continue;
-                   }
-               }
-           }
-         if (cc == 0)
-           {
-             if (!worker->checkChecksum())
-               {
-                 WAR << "#" << worker->_workerno << ": checksum error, disable worker" << endl;
-                 worker->_state = WORKER_BROKEN;
-                 strncpy(worker->_curlError, "checksum error", CURL_ERROR_SIZE);
-                 _activeworkers--;
-                 continue;
-               }
-             if (worker->_state == WORKER_FETCH)
-               {
-                 if (worker->_competing)
-                   {
-                     worker->disableCompetition();
-                     // multiple workers wrote into this block. We already know that our
-                     // data was correct, but maybe some other worker overwrote our data
-                     // with something broken. Thus we have to re-check the block.
-                     if (!worker->recheckChecksum())
-                       {
-                         XXX << "#" << worker->_workerno << ": recheck checksum error, refetch block" << endl;
-                         // re-fetch! No need to worry about the bad workers,
-                         // they will now be set to DISCARD. At the end of their block
-                         // they will notice that they wrote bad data and go into BROKEN.
-                         worker->run();
-                         continue;
-                       }
-                   }
-                 _fetchedgoodsize += worker->_blksize;
-               }
-
-             // make bad workers sleep a little
-             double maxavg = 0;
-             int maxworkerno = 0;
-             int numbetter = 0;
-             for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
-               {
-                 multifetchworker *oworker = *workeriter;
-                 if (oworker->_state == WORKER_BROKEN)
-                   continue;
-                 if (oworker->_avgspeed > maxavg)
-                   {
-                     maxavg = oworker->_avgspeed;
-                     maxworkerno = oworker->_workerno;
-                   }
-                 if (oworker->_avgspeed > worker->_avgspeed)
-                   numbetter++;
-               }
-             if (maxavg && !_stealing)
-               {
-                 double ratio = worker->_avgspeed / maxavg;
-                 ratio = 1 - ratio;
-                 if (numbetter < 3)    // don't sleep that much if we're in the top two
-                   ratio = ratio * ratio;
-                 if (ratio > .01)
-                   {
-                     XXX << "#" << worker->_workerno << ": too slow ("<< ratio << ", " << worker->_avgspeed << ", #" << maxworkerno << ": " << maxavg << "), going to sleep for " << ratio * 1000 << " ms" << endl;
-                     worker->_sleepuntil = now + ratio;
-                     worker->_state = WORKER_SLEEP;
-                     _sleepworkers++;
-                     continue;
-                   }
-               }
-
-             // do rate control (if requested)
-             // should use periodavg, but that's not what libcurl does
-             if (_maxspeed && now > _starttime)
-               {
-                 double avg = _fetchedsize / (now - _starttime);
-                 avg = worker->_maxspeed * _maxspeed / avg;
-                 if (avg < _maxspeed / _maxworkers)
-                   avg = _maxspeed / _maxworkers;
-                 if (avg > _maxspeed)
-                   avg = _maxspeed;
-                 if (avg < 1024)
-                   avg = 1024;
-                 worker->_maxspeed = avg;
+        {
+          if (msg->msg != CURLMSG_DONE)
+            continue;
+          CURL *easy = msg->easy_handle;
+          CURLcode cc = msg->data.result;
+          multifetchworker *worker;
+          if (curl_easy_getinfo(easy, CURLINFO_PRIVATE, &worker) != CURLE_OK)
+            ZYPP_THROW(MediaCurlException(_baseurl, "curl_easy_getinfo", "unknown error"));
+          if (worker->_blkreceived && now > worker->_blkstarttime)
+            {
+              if (worker->_avgspeed)
+                worker->_avgspeed = (worker->_avgspeed + worker->_blkreceived / (now - worker->_blkstarttime)) / 2;
+              else
+                worker->_avgspeed = worker->_blkreceived / (now - worker->_blkstarttime);
+            }
+          XXX << "#" << worker->_workerno << ": BLK " << worker->_blkno << " done code " << cc << " speed " << worker->_avgspeed << endl;
+          curl_multi_remove_handle(_multi, easy);
+          if (cc == CURLE_HTTP_RETURNED_ERROR)
+            {
+              long statuscode = 0;
+              (void)curl_easy_getinfo(easy, CURLINFO_RESPONSE_CODE, &statuscode);
+              XXX << "HTTP status " << statuscode << endl;
+              if (statuscode == 416 && !_blklist)      /* Range error */
+                {
+                  if (_filesize == off_t(-1))
+                    {
+                      if (!worker->_noendrange)
+                        {
+                          XXX << "#" << worker->_workerno << ": retrying with no end range" << endl;
+                          worker->_noendrange = true;
+                          worker->run();
+                          continue;
+                        }
+                      worker->_noendrange = false;
+                      worker->stealjob();
+                      continue;
+                    }
+                  if (worker->_blkstart >= _filesize)
+                    {
+                      worker->nextjob();
+                      continue;
+                    }
+                }
+            }
+          if (cc == 0)
+            {
+              if (!worker->checkChecksum())
+                {
+                  WAR << "#" << worker->_workerno << ": checksum error, disable worker" << endl;
+                  worker->_state = WORKER_BROKEN;
+                  strncpy(worker->_curlError, "checksum error", CURL_ERROR_SIZE);
+                  _activeworkers--;
+                  continue;
+                }
+              if (worker->_state == WORKER_FETCH)
+                {
+                  if (worker->_competing)
+                    {
+                      worker->disableCompetition();
+                      // multiple workers wrote into this block. We already know that our
+                      // data was correct, but maybe some other worker overwrote our data
+                      // with something broken. Thus we have to re-check the block.
+                      if (!worker->recheckChecksum())
+                        {
+                          XXX << "#" << worker->_workerno << ": recheck checksum error, refetch block" << endl;
+                          // re-fetch! No need to worry about the bad workers,
+                          // they will now be set to DISCARD. At the end of their block
+                          // they will notice that they wrote bad data and go into BROKEN.
+                          worker->run();
+                          continue;
+                        }
+                    }
+                  _fetchedgoodsize += worker->_blksize;
+                }
+
+              // make bad workers sleep a little
+              double maxavg = 0;
+              int maxworkerno = 0;
+              int numbetter = 0;
+              for (std::list<multifetchworker *>::iterator workeriter = _workers.begin(); workeriter != _workers.end(); ++workeriter)
+                {
+                  multifetchworker *oworker = *workeriter;
+                  if (oworker->_state == WORKER_BROKEN)
+                    continue;
+                  if (oworker->_avgspeed > maxavg)
+                    {
+                      maxavg = oworker->_avgspeed;
+                      maxworkerno = oworker->_workerno;
+                    }
+                  if (oworker->_avgspeed > worker->_avgspeed)
+                    numbetter++;
+                }
+              if (maxavg && !_stealing)
+                {
+                  double ratio = worker->_avgspeed / maxavg;
+                  ratio = 1 - ratio;
+                  if (numbetter < 3)   // don't sleep that much if we're in the top two
+                    ratio = ratio * ratio;
+                  if (ratio > .01)
+                    {
+                      XXX << "#" << worker->_workerno << ": too slow ("<< ratio << ", " << worker->_avgspeed << ", #" << maxworkerno << ": " << maxavg << "), going to sleep for " << ratio * 1000 << " ms" << endl;
+                      worker->_sleepuntil = now + ratio;
+                      worker->_state = WORKER_SLEEP;
+                      _sleepworkers++;
+                      continue;
+                    }
+                }
+
+              // do rate control (if requested)
+              // should use periodavg, but that's not what libcurl does
+              if (_maxspeed && now > _starttime)
+                {
+                  double avg = _fetchedsize / (now - _starttime);
+                  avg = worker->_maxspeed * _maxspeed / avg;
+                  if (avg < _maxspeed / _maxworkers)
+                    avg = _maxspeed / _maxworkers;
+                  if (avg > _maxspeed)
+                    avg = _maxspeed;
+                  if (avg < 1024)
+                    avg = 1024;
+                  worker->_maxspeed = avg;
 #if CURLVERSION_AT_LEAST(7,15,5)
-                 curl_easy_setopt(worker->_curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)(avg));
+                  curl_easy_setopt(worker->_curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)(avg));
 #endif
-               }
-
-             worker->nextjob();
-           }
-         else
-           {
-             worker->_state = WORKER_BROKEN;
-             _activeworkers--;
-             if (!_activeworkers && !(urliter != urllist.end() && _workers.size() < MAXURLS))
-               {
-                 // end of workers reached! goodbye!
-                 worker->evaluateCurlCode(Pathname(), cc, false);
-               }
-           }
-
-         if ( _filesize > 0 && _fetchedgoodsize > _filesize ) {
-           ZYPP_THROW(MediaFileSizeExceededException(_baseurl, _filesize));
-         }
-       }
+                }
+
+              worker->nextjob();
+            }
+          else
+            {
+              worker->_state = WORKER_BROKEN;
+              _activeworkers--;
+              if (!_activeworkers && !(urliter != urllist.end() && _workers.size() < MAXURLS))
+                {
+                  // end of workers reached! goodbye!
+                  worker->evaluateCurlCode(Pathname(), cc, false);
+                }
+            }
+
+          if ( _filesize > 0 && _fetchedgoodsize > _filesize ) {
+            ZYPP_THROW(MediaFileSizeExceededException(_baseurl, _filesize));
+          }
+        }
 
       // send report
       if (_report)
-       {
-         int percent = _totalsize ? (100 * (_fetchedgoodsize + _fetchedsize)) / (_totalsize + _fetchedsize) : 0;
+        {
+          int percent = _totalsize ? (100 * (_fetchedgoodsize + _fetchedsize)) / (_totalsize + _fetchedsize) : 0;
 
-         double avg = 0;
-         if (now > _starttime)
-           avg = _fetchedsize / (now - _starttime);
-         if (!(*(_report))->progress(percent, _baseurl, avg, _lastperiodstart == _starttime ? avg : _periodavg))
-           ZYPP_THROW(MediaCurlException(_baseurl, "User abort", "cancelled"));
-       }
+          double avg = 0;
+          if (now > _starttime)
+            avg = _fetchedsize / (now - _starttime);
+          if (!(*(_report))->progress(percent, _baseurl, avg, _lastperiodstart == _starttime ? avg : _periodavg))
+            ZYPP_THROW(MediaCurlException(_baseurl, "User abort", "cancelled"));
+        }
 
       if (_timeout && now - _lastprogress > _timeout)
-       break;
+        break;
     }
 
   if (!_finished)
@@ -1184,10 +1184,10 @@ MediaMultiCurl::~MediaMultiCurl()
     {
       CURL *easy = it->second;
       if (easy)
-       {
-         curl_easy_cleanup(easy);
-         it->second = NULL;
-       }
+        {
+          curl_easy_cleanup(easy);
+          it->second = NULL;
+        }
     }
 }
 
@@ -1221,11 +1221,11 @@ static bool looks_like_metalink_fd(int fd)
   if (!strncasecmp(p, "<?xml", 5))
     {
       while (*p && *p != '>')
-       p++;
+        p++;
       if (*p == '>')
-       p++;
+        p++;
       while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')
-       p++;
+        p++;
     }
   bool ret = !strncasecmp(p, "<metalink", 9) ? true : false;
   return ret;
@@ -1267,12 +1267,12 @@ int MediaMultiCurl::progressCallback( void *clientp, double dltotal, double dlno
 
   char *ptr = NULL;
   bool ismetalink = false;
-  if (curl_easy_getinfo(_curl, CURLINFO_CONTENT_TYPE, &ptr) == CURLE_OK && ptr) 
-    {    
+  if (curl_easy_getinfo(_curl, CURLINFO_CONTENT_TYPE, &ptr) == CURLE_OK && ptr)
+    {
       std::string ct = std::string(ptr);
       if (ct.find("application/metalink+xml") == 0 || ct.find("application/metalink4+xml") == 0)
         ismetalink = true;
-    }    
+    }
   if (!ismetalink && dlnow < 256)
     {
       // can't tell yet, ...
@@ -1373,7 +1373,7 @@ void MediaMultiCurl::doGetFileCopy( const OnMediaLocation &srcFile , const Pathn
   {
     DBG << "HTTP response: " + str::numstring(httpReturnCode) << endl;
     if ( httpReturnCode == 304
-        || ( httpReturnCode == 213 && _url.getScheme() == "ftp" ) ) // not modified
+         || ( httpReturnCode == 213 && _url.getScheme() == "ftp" ) ) // not modified
     {
       DBG << "not modified: " << PathInfo(dest) << endl;
       return;
@@ -1391,7 +1391,7 @@ void MediaMultiCurl::doGetFileCopy( const OnMediaLocation &srcFile , const Pathn
     {
       std::string ct = std::string(ptr);
       if (ct.find("application/metalink+xml") == 0 || ct.find("application/metalink4+xml") == 0)
-       ismetalink = true;
+        ismetalink = true;
     }
 
   if (!ismetalink)
@@ -1400,7 +1400,7 @@ void MediaMultiCurl::doGetFileCopy( const OnMediaLocation &srcFile , const Pathn
       // out if we received a metalink (bnc#649925)
       fflush(file);
       if (looks_like_metalink(destNew))
-       ismetalink = true;
+        ismetalink = true;
     }
 
   if (ismetalink)
@@ -1409,10 +1409,10 @@ void MediaMultiCurl::doGetFileCopy( const OnMediaLocation &srcFile , const Pathn
       Pathname failedFile = ZConfig::instance().repoCachePath() / "MultiCurl.failed";
       file = nullptr;  // explicitly close destNew before the parser reads it.
       try
-       {
-         MetaLinkParser mlp;
-         mlp.parse(destNew);
-         MediaBlockList bl = mlp.getBlockList();
+        {
+          MetaLinkParser mlp;
+          mlp.parse(destNew);
+          MediaBlockList bl = mlp.getBlockList();
 
           /*
            * gihub issue libzipp:#277 Multicurl backend breaks with MirrorCache and Metalink with unknown filesize.
@@ -1423,62 +1423,70 @@ void MediaMultiCurl::doGetFileCopy( const OnMediaLocation &srcFile , const Pathn
             ZYPP_THROW( MediaException("Multicurl requires filesize but none was provided.") );
           }
 
-         std::vector<Url> urls = mlp.getUrls();
-         XXX << bl << endl;
-         file = fopen((*destNew).c_str(), "w+e");
-         if (!file)
-           ZYPP_THROW(MediaWriteException(destNew));
-         if (PathInfo(target).isExist())
-           {
-             XXX << "reusing blocks from file " << target << endl;
-             bl.reuseBlocks(file, target.asString());
-             XXX << bl << endl;
-           }
-         if (bl.haveChecksum(1) && PathInfo(failedFile).isExist())
-           {
-             XXX << "reusing blocks from file " << failedFile << endl;
-             bl.reuseBlocks(file, failedFile.asString());
-             XXX << bl << endl;
-             filesystem::unlink(failedFile);
-           }
-         Pathname df = srcFile.deltafile();
-         if (!df.empty())
-           {
-             XXX << "reusing blocks from file " << df << endl;
-             bl.reuseBlocks(file, df.asString());
-             XXX << bl << endl;
-           }
-         try
-           {
-             multifetch(srcFile.filename(), file, &urls, &report, &bl, srcFile.downloadSize());
-           }
-         catch (MediaCurlException &ex)
-           {
-             userabort = ex.errstr() == "User abort";
-             ZYPP_RETHROW(ex);
-           }
-       }
+          std::vector<Url> urls = mlp.getUrls();
+    /*
+     * bsc#1191609 In certain locations we do not receive a suitable number of metalink mirrors, and might even
+     * download chunks serially from one and the same server. In those cases we need to fall back to a normal download.
+     */
+    if ( urls.size() < MIN_REQ_MIRRS ) {
+      ZYPP_THROW( MediaException("Multicurl enabled but not enough mirrors provided") );
+    }
+
+          XXX << bl << endl;
+          file = fopen((*destNew).c_str(), "w+e");
+          if (!file)
+            ZYPP_THROW(MediaWriteException(destNew));
+          if (PathInfo(target).isExist())
+            {
+              XXX << "reusing blocks from file " << target << endl;
+              bl.reuseBlocks(file, target.asString());
+              XXX << bl << endl;
+            }
+          if (bl.haveChecksum(1) && PathInfo(failedFile).isExist())
+            {
+              XXX << "reusing blocks from file " << failedFile << endl;
+              bl.reuseBlocks(file, failedFile.asString());
+              XXX << bl << endl;
+              filesystem::unlink(failedFile);
+            }
+          Pathname df = srcFile.deltafile();
+          if (!df.empty())
+            {
+              XXX << "reusing blocks from file " << df << endl;
+              bl.reuseBlocks(file, df.asString());
+              XXX << bl << endl;
+            }
+          try
+            {
+              multifetch(srcFile.filename(), file, &urls, &report, &bl, srcFile.downloadSize());
+            }
+          catch (MediaCurlException &ex)
+            {
+              userabort = ex.errstr() == "User abort";
+              ZYPP_RETHROW(ex);
+            }
+        }
       catch (MediaFileSizeExceededException &ex) {
         ZYPP_RETHROW(ex);
       }
       catch (Exception &ex)
-       {
-         // something went wrong. fall back to normal download
-         file = nullptr;       // explicitly close destNew before moving it
-         if (PathInfo(destNew).size() >= 63336)
-           {
-             ::unlink(failedFile.asString().c_str());
-             filesystem::hardlinkCopy(destNew, failedFile);
-           }
-         if (userabort)
-           {
-             ZYPP_RETHROW(ex);
-           }
-         file = fopen((*destNew).c_str(), "w+e");
-         if (!file)
-           ZYPP_THROW(MediaWriteException(destNew));
-         MediaCurl::doGetFileCopyFile(srcFile, dest, file, report, options | OPTION_NO_REPORT_START);
-       }
+        {
+          // something went wrong. fall back to normal download
+          file = nullptr;      // explicitly close destNew before moving it
+          if (PathInfo(destNew).size() >= 63336)
+            {
+              ::unlink(failedFile.asString().c_str());
+              filesystem::hardlinkCopy(destNew, failedFile);
+            }
+          if (userabort)
+            {
+              ZYPP_RETHROW(ex);
+            }
+          file = fopen((*destNew).c_str(), "w+e");
+          if (!file)
+            ZYPP_THROW(MediaWriteException(destNew));
+          MediaCurl::doGetFileCopyFile(srcFile, dest, file, report, options | OPTION_NO_REPORT_START);
+        }
     }
 
   if (::fchmod( ::fileno(file), filesystem::applyUmaskTo( 0644 )))
@@ -1522,7 +1530,7 @@ void MediaMultiCurl::multifetch(const Pathname & filename, FILE *fp, std::vector
     {
       _multi = curl_multi_init();
       if (!_multi)
-       ZYPP_THROW(MediaCurlInitException(baseurl));
+        ZYPP_THROW(MediaCurlInitException(baseurl));
     }
 
   multifetchrequest req(this, filename, baseurl, _multi, fp, report, blklist, filesize);
@@ -1538,17 +1546,17 @@ void MediaMultiCurl::multifetch(const Pathname & filename, FILE *fp, std::vector
   for (std::vector<Url>::iterator urliter = urllist->begin(); urliter != urllist->end(); ++urliter)
     {
       try
-       {
-         std::string scheme = urliter->getScheme();
-         if (scheme == "http" || scheme == "https" || scheme == "ftp" || scheme == "tftp")
-           {
-             checkProtocol(*urliter);
+        {
+          std::string scheme = urliter->getScheme();
+          if (scheme == "http" || scheme == "https" || scheme == "ftp" || scheme == "tftp")
+            {
+              checkProtocol(*urliter);
               myurllist.push_back(internal::propagateQueryParams(*urliter, _url));
-           }
-       }
+            }
+        }
       catch (...)
-       {
-       }
+        {
+        }
     }
   if (!myurllist.size())
     myurllist.push_back(baseurl);
index 117d60c..b60e692 100644 (file)
@@ -40,12 +40,12 @@ namespace zypp {
     // DESCRIPTION :
     //
     MediaNFS::MediaNFS( const Url &      url_r,
-                       const Pathname & attach_point_hint_r )
+                        const Pathname & attach_point_hint_r )
       : MediaHandler( url_r, attach_point_hint_r,
-                     "/", // urlpath at attachpoint
-                     false ) // does_download
+                      "/", // urlpath at attachpoint
+                      false ) // does_download
     {
-       MIL << "MediaNFS::MediaNFS(" << url_r << ", " << attach_point_hint_r << ")" << endl;
+        MIL << "MediaNFS::MediaNFS(" << url_r << ", " << attach_point_hint_r << ")" << endl;
     }
 
     ///////////////////////////////////////////////////////////////////
@@ -59,9 +59,9 @@ namespace zypp {
     void MediaNFS::attachTo(bool next)
     {
       if(_url.getHost().empty())
-       ZYPP_THROW(MediaBadUrlEmptyHostException(_url));
+        ZYPP_THROW(MediaBadUrlEmptyHostException(_url));
       if(next)
-       ZYPP_THROW(MediaNotSupportedException(_url));
+        ZYPP_THROW(MediaNotSupportedException(_url));
 
       std::string path = _url.getHost();
       path += ':';
@@ -71,24 +71,24 @@ namespace zypp {
       AttachedMedia  ret( findAttachedMedia( media));
 
       if( ret.mediaSource &&
-         ret.attachPoint &&
-         !ret.attachPoint->empty())
+          ret.attachPoint &&
+          !ret.attachPoint->empty())
       {
-       DBG << "Using a shared media "
-           << ret.mediaSource->name
-           << " attached on "
-           << ret.attachPoint->path
-           << endl;
+        DBG << "Using a shared media "
+            << ret.mediaSource->name
+            << " attached on "
+            << ret.attachPoint->path
+            << endl;
 
-       removeAttachPoint();
-       setAttachPoint(ret.attachPoint);
-       setMediaSource(ret.mediaSource);
-       return;
+        removeAttachPoint();
+        setAttachPoint(ret.attachPoint);
+        setMediaSource(ret.mediaSource);
+        return;
       }
 
       if( !isUseableAttachPoint( attachPoint() ) )
       {
-       setAttachPoint( createAttachPoint(), true );
+        setAttachPoint( createAttachPoint(), true );
       }
       std::string mountpoint( attachPoint().asString() );
 
@@ -101,7 +101,7 @@ namespace zypp {
       std::string options = _url.getQueryParam("mountoptions");
       if(options.empty())
       {
-       options="ro";
+        options="ro";
       }
 
       std::vector<std::string> optionList;
@@ -114,7 +114,7 @@ namespace zypp {
         if ( *it == "lock" || *it == "nolock" ) contains_lock = true;
         else if ( *it == "soft") contains_soft = true;
         else if ( *it == "hard") contains_hard = true;
-       else if ( it->find("timeo") != std::string::npos ) contains_timeo = true;
+        else if ( it->find("timeo") != std::string::npos ) contains_timeo = true;
       }
 
       if ( !(contains_lock && contains_soft) ) {
@@ -132,7 +132,7 @@ namespace zypp {
         if ( !(contains_soft || contains_hard) ) {
           optionList.push_back( "soft" );
           if ( !contains_timeo ) {
-           std::ostringstream s;
+            std::ostringstream s;
             s << "timeo=" << NFS_MOUNT_TIMEOUT;
             optionList.push_back( s.str() );
           }
@@ -167,7 +167,7 @@ namespace zypp {
         }
         ZYPP_THROW(MediaMountException(
           "Unable to verify that the media was mounted",
-         path, mountpoint
+          path, mountpoint
         ));
       }
     }
@@ -232,7 +232,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaNFS::getDirInfo( std::list<std::string> & retlist,
-                             const Pathname & dirname, bool dots ) const
+                              const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
@@ -246,7 +246,7 @@ namespace zypp {
     // DESCRIPTION : Asserted that media is attached and retlist is empty.
     //
     void MediaNFS::getDirInfo( filesystem::DirContent & retlist,
-                          const Pathname & dirname, bool dots ) const
+                           const Pathname & dirname, bool dots ) const
     {
       MediaHandler::getDirInfo( retlist, dirname, dots );
     }
index 6b704ea..7a5112f 100644 (file)
@@ -37,11 +37,11 @@ namespace zypp {
 
       protected:
 
-       virtual void attachTo (bool next = false) override;
+        virtual void attachTo (bool next = false) override;
 
         virtual void releaseFrom( const std::string & ejectDev ) override;
-       virtual void getFile( const OnMediaLocation & file ) const override;
-       virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
+        virtual void getFile( const OnMediaLocation & file ) const override;
+        virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
         virtual void getDirInfo( std::list<std::string> & retlist,
                                  const Pathname & dirname, bool dots = true ) const override;
         virtual void getDirInfo( filesystem::DirContent & retlist,
@@ -51,11 +51,11 @@ namespace zypp {
       public:
 
         MediaNFS( const Url&       url_r,
-                 const Pathname & attach_point_hint_r );
+                  const Pathname & attach_point_hint_r );
 
         virtual ~MediaNFS() override { try { release(); } catch(...) {} }
 
-       virtual bool isAttached() const override;
+        virtual bool isAttached() const override;
     };
 
     ///////////////////////////////////////////////////////////////////
index 810aded..8898091 100644 (file)
@@ -31,9 +31,9 @@ namespace zypp
     {
     public:
       MediaNetworkCommonHandler( const Url &      url_r,
-                                const Pathname & attach_point_r,
-                                const Pathname & urlpath_below_attachpoint_r,
-                                const bool       does_download_r )
+                                 const Pathname & attach_point_r,
+                                 const Pathname & urlpath_below_attachpoint_r,
+                                 const bool       does_download_r )
       : MediaHandler( url_r, attach_point_r, urlpath_below_attachpoint_r, does_download_r )
       {}
 
index 22c130c..27a748b 100644 (file)
@@ -29,18 +29,18 @@ namespace zypp
     class MediaPlugin : public MediaHandler
     {
       public:
-       MediaPlugin( const Url & url_r, const Pathname & attach_point_hint_r );
+        MediaPlugin( const Url & url_r, const Pathname & attach_point_hint_r );
 
         virtual ~MediaPlugin() override { try { release(); } catch(...) {} }
 
       protected:
-       virtual void attachTo( bool next_r = false ) override;
-       virtual void releaseFrom( const std::string & ejectDev_r ) override;
-       virtual void getFile( const OnMediaLocation & file ) const override;
-       virtual void getDir( const Pathname & dirname_r, bool recurse_r ) const override;
-       virtual void getDirInfo( std::list<std::string> & retlist_r, const Pathname & dirname_r, bool dots_r = true ) const override;
-       virtual void getDirInfo( filesystem::DirContent & retlist_r, const Pathname & dirname_r, bool dots_r = true ) const override;
-       virtual bool getDoesFileExist( const Pathname & filename_r ) const override;
+        virtual void attachTo( bool next_r = false ) override;
+        virtual void releaseFrom( const std::string & ejectDev_r ) override;
+        virtual void getFile( const OnMediaLocation & file ) const override;
+        virtual void getDir( const Pathname & dirname_r, bool recurse_r ) const override;
+        virtual void getDirInfo( std::list<std::string> & retlist_r, const Pathname & dirname_r, bool dots_r = true ) const override;
+        virtual void getDirInfo( filesystem::DirContent & retlist_r, const Pathname & dirname_r, bool dots_r = true ) const override;
+        virtual bool getDoesFileExist( const Pathname & filename_r ) const override;
     };
 
     //////////////////////////////////////////////////////////////////
index 931f079..52f8425 100644 (file)
@@ -39,47 +39,47 @@ namespace zypp
       */
       MediaPriority::value_type scheme2priority(  const std::string & scheme_r )
       {
-       switch ( scheme_r[0] )
-       {
+        switch ( scheme_r[0] )
+        {
 #define RETURN_IF(scheme,value) \
-       if ( ::strcmp( scheme+1, scheme_r.c_str()+1 ) == 0 ) return value;
-         case 'c':
-           RETURN_IF( "cd",    ZConfig::instance().download_media_prefer_download() ? 1 : 2 );
-           RETURN_IF( "cifs",  3 );
-           break;
-
-         case 'd':
-           RETURN_IF( "dvd",   ZConfig::instance().download_media_prefer_download() ? 1 : 2 );
-           RETURN_IF( "dir",   4 );
-           break;
-
-         case 'f':
-           RETURN_IF( "file",  4 );
-           RETURN_IF( "ftp",   ZConfig::instance().download_media_prefer_download() ? 2 : 1);
-           break;
-         
-         case 't':
-           RETURN_IF( "tftp",  ZConfig::instance().download_media_prefer_download() ? 2 : 1);
-           break;
-
-         case 'h':
-           RETURN_IF( "http",  ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
-           RETURN_IF( "https", ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
-           RETURN_IF( "hd",    4 );
-           break;
-
-         case 'n':
-           RETURN_IF( "nfs",   3 );
-           RETURN_IF( "nfs4",  3 );
-           break;
-
-         case 's':
-           RETURN_IF( "sftp",  ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
-           RETURN_IF( "smb",   3 );
-           break;
+        if ( ::strcmp( scheme+1, scheme_r.c_str()+1 ) == 0 ) return value;
+          case 'c':
+            RETURN_IF( "cd",   ZConfig::instance().download_media_prefer_download() ? 1 : 2 );
+            RETURN_IF( "cifs", 3 );
+            break;
+
+          case 'd':
+            RETURN_IF( "dvd",  ZConfig::instance().download_media_prefer_download() ? 1 : 2 );
+            RETURN_IF( "dir",  4 );
+            break;
+
+          case 'f':
+            RETURN_IF( "file", 4 );
+            RETURN_IF( "ftp",  ZConfig::instance().download_media_prefer_download() ? 2 : 1);
+            break;
+
+          case 't':
+            RETURN_IF( "tftp", ZConfig::instance().download_media_prefer_download() ? 2 : 1);
+            break;
+
+          case 'h':
+            RETURN_IF( "http", ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
+            RETURN_IF( "https",        ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
+            RETURN_IF( "hd",   4 );
+            break;
+
+          case 'n':
+            RETURN_IF( "nfs",  3 );
+            RETURN_IF( "nfs4", 3 );
+            break;
+
+          case 's':
+            RETURN_IF( "sftp", ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
+            RETURN_IF( "smb",  3 );
+            break;
 #undef RETURN_IF
-       }
-       return 0;
+        }
+        return 0;
       }
 
       /////////////////////////////////////////////////////////////////
index aef3199..4425c02 100644 (file)
@@ -43,53 +43,53 @@ namespace zypp
     class MediaPriority
     {
       public:
-       typedef int value_type;
+        typedef int value_type;
 
       public:
-       /** Default ctor. Least priority \c 0.*/
-       MediaPriority()
-       : _val( 0 )
-       {}
+        /** Default ctor. Least priority \c 0.*/
+        MediaPriority()
+        : _val( 0 )
+        {}
 
-       /** Copy ctor. */
-       MediaPriority( value_type val_r )
-       : _val( val_r )
-       {}
+        /** Copy ctor. */
+        MediaPriority( value_type val_r )
+        : _val( val_r )
+        {}
 
-       /** Ctor from scheme string.*/
-       MediaPriority( const std::string & scheme_r );
+        /** Ctor from scheme string.*/
+        MediaPriority( const std::string & scheme_r );
 
-       /** Ctor from scheme string defined by Url. */
-       MediaPriority( const Url & url_r );
+        /** Ctor from scheme string defined by Url. */
+        MediaPriority( const Url & url_r );
 
       public:
-       /** Assign. */
-       MediaPriority & operator=( value_type rhs )
-       { _val = rhs; return *this; }
+        /** Assign. */
+        MediaPriority & operator=( value_type rhs )
+        { _val = rhs; return *this; }
 
-       /** Assign priority of scheme string. */
-       MediaPriority & operator=( const std::string & scheme_r )
-       { _val = MediaPriority(scheme_r); return *this; }
+        /** Assign priority of scheme string. */
+        MediaPriority & operator=( const std::string & scheme_r )
+        { _val = MediaPriority(scheme_r); return *this; }
 
-       /** Assign priority of scheme string defined by Url. */
-       MediaPriority & operator=( const Url & url_r )
-       { _val = MediaPriority(url_r); return *this; }
+        /** Assign priority of scheme string defined by Url. */
+        MediaPriority & operator=( const Url & url_r )
+        { _val = MediaPriority(url_r); return *this; }
 
       public:
-       /** Conversion to value_type. */
-       //@{
-       /** Explicit */
-       value_type &       get()            { return _val; }
-       /** Explicit */
-       const value_type & get() const      { return _val; }
-       /** Implicit */
-       operator value_type &()             { return get(); }
-       /** Implicit */
-       operator const value_type &() const { return get(); }
-       //@}
+        /** Conversion to value_type. */
+        //@{
+        /** Explicit */
+        value_type &       get()            { return _val; }
+        /** Explicit */
+        const value_type & get() const      { return _val; }
+        /** Implicit */
+        operator value_type &()             { return get(); }
+        /** Implicit */
+        operator const value_type &() const { return get(); }
+        //@}
 
       private:
-       value_type _val;
+        value_type _val;
     };
 
     /////////////////////////////////////////////////////////////////
index 05e43b5..520bcc9 100644 (file)
@@ -38,13 +38,13 @@ namespace zypp {
     public:
       MediaSource(const std::string &_type,  const std::string &_name,
                   unsigned int       _maj=0, unsigned int       _min=0,
-                 const std::string &_bdir=std::string(), bool  _own=true)
+                  const std::string &_bdir=std::string(), bool  _own=true)
         : maj_nr(_maj)
         , min_nr(_min)
         , type(_type)
         , name(_name)
-       , bdir(_bdir)
-       , iown(_own)
+        , bdir(_bdir)
+        , iown(_own)
       {}
 
       MediaSource()
@@ -77,12 +77,12 @@ namespace zypp {
        */
       virtual std::string asString() const
       {
-       std::string tmp1;
+        std::string tmp1;
         if(maj_nr != 0)
-       {
-         tmp1 = "[" + str::numstring(maj_nr) + "," +
-                      str::numstring(min_nr) + "]";
-       }
+        {
+          tmp1 = "[" + str::numstring(maj_nr) + "," +
+                       str::numstring(min_nr) + "]";
+        }
         return type + "<" + name + tmp1 + ">";
       }
 
@@ -137,8 +137,8 @@ namespace zypp {
 
       AttachedMedia(const MediaSourceRef &_mediaSource,
                     const AttachPointRef &_attachPoint)
-       : mediaSource( _mediaSource)
-       , attachPoint( _attachPoint)
+        : mediaSource( _mediaSource)
+        , attachPoint( _attachPoint)
       {}
 
       MediaSourceRef mediaSource;
index 162a833..3917da2 100644 (file)
@@ -240,80 +240,80 @@ startElement(void *userData, const xmlChar *name, const xmlChar **atts)
     case STATE_URL:
     case STATE_M4URL:
       {
-       const char *priority       = find_attr("priority", atts);
-       const char *preference     = find_attr("preference", atts);
+        const char *priority       = find_attr("priority", atts);
+        const char *preference     = find_attr("preference", atts);
         const char *maxconnections = find_attr("maxconnections", atts);
-       int prio;
+        int prio;
         auto &mirr = pd->urls.emplace_back();
         if (priority)
-         prio = str::strtonum<int>(priority);
-       else if (preference)
+          prio = str::strtonum<int>(priority);
+        else if (preference)
           prio = 101 - str::strtonum<int>(preference);
-       else
-         prio = 999999;
+        else
+          prio = 999999;
         mirr.priority = prio;
 
         if ( maxconnections )
           mirr.maxConnections = str::strtonum<int>( maxconnections );
 
-       break;
+        break;
       }
     case STATE_PIECES:
     case STATE_M4PIECES:
       {
-       const char *type = find_attr("type", atts);
-       const char *length = find_attr("length", atts);
-       size_t blksize;
+        const char *type = find_attr("type", atts);
+        const char *length = find_attr("length", atts);
+        size_t blksize;
 
-       if (!type || !length)
-         {
+        if (!type || !length)
+          {
+            pd->popState();
+            break;
+          }
+        blksize = str::strtonum<unsigned long>(length);
+        if (!blksize || (pd->blksize && pd->blksize != blksize))
+          {
             pd->popState();
-           break;
-         }
-       blksize = str::strtonum<unsigned long>(length);
-       if (!blksize || (pd->blksize && pd->blksize != blksize))
-         {
-           pd->popState();
-           break;
-         }
-       pd->blksize = blksize;
+            break;
+          }
+        pd->blksize = blksize;
         pd->piece.clear();
-       if (!strcmp(type, "sha1") || !strcmp(type, "sha-1"))
-         pd->piecel = 20;
-       else if (!strcmp(type, "zsync"))
-         pd->piecel = 4;
-       else
-         {
-           pd->popState();
-           break;
-         }
-       break;
+        if (!strcmp(type, "sha1") || !strcmp(type, "sha-1"))
+          pd->piecel = 20;
+        else if (!strcmp(type, "zsync"))
+          pd->piecel = 4;
+        else
+          {
+            pd->popState();
+            break;
+          }
+        break;
       }
     case STATE_HASH:
     case STATE_M4HASH:
       {
-       const char *type = find_attr("type", atts);
-       if (!type)
-         type = "?";
-       if ((!strcmp(type, "sha1") || !strcmp(type, "sha-1")) && pd->chksuml < 20)
-         pd->chksuml = 20;
-       else if (!strcmp(type, "sha256") || !strcmp(type, "sha-256"))
-         pd->chksuml = 32;
-       else
-         {
-           pd->popState();
-           pd->docontent = 0;
-         }
-       break;
+        const char *type = find_attr("type", atts);
+        if (!type)
+          type = "?";
+        if ((!strcmp(type, "sha1") || !strcmp(type, "sha-1")) && pd->chksuml < 20)
+          pd->chksuml = 20;
+        else if (!strcmp(type, "sha256") || !strcmp(type, "sha-256"))
+          pd->chksuml = 32;
+        else
+          {
+            pd->popState();
+            pd->docontent = 0;
+          }
+        break;
       }
     case STATE_PHASH:
     case STATE_M4PHASH:
       {
-       const char *piece = find_attr("piece", atts);
+        const char *piece = find_attr("piece", atts);
         if ( pd->state == STATE_PHASH && (!piece || str::strtonum<uint>(piece) != pd->piece.size()) )
-         {
-           pd->popState();
-         }
+          {
+            pd->popState();
+          }
         break;
       }
     default:
@@ -347,15 +347,15 @@ endElement(void *userData, const xmlChar *)
       pd->chksum.clear();
       pd->chksum = hexstr2bytes( pd->content );
       if ( pd->content.length() != size_t(pd->chksuml) * 2 || !pd->chksum.size() )
-       {
-         pd->chksum.clear();
+        {
+          pd->chksum.clear();
           pd->chksuml = 0;
-       }
+        }
       break;
     case STATE_PHASH:
     case STATE_M4PHASH: {
       if ( pd->content.length() != size_t(pd->piecel) * 2 )
-       break;
+        break;
       UByteArray pieceHash = hexstr2bytes( pd->content );
       if ( !pieceHash.size() )
         pieceHash.resize( pd->piecel, 0 );
@@ -365,7 +365,7 @@ endElement(void *userData, const xmlChar *)
     case STATE_PIECES:
     case STATE_M4PIECES:
       if (pd->piecel == 4)
-       pd->zsync = pd->piece;
+        pd->zsync = pd->piece;
       else
         pd->sha1 = pd->piece;
 
@@ -482,25 +482,25 @@ MediaBlockList MetaLinkParser::getBlockList() const
       off_t off = 0;
       size_t size = pd->blksize;
       for ( size_t i = 0; i < nb; i++ )
-       {
-         if (i == nb - 1)
-           {
-             size = pd->size % pd->blksize;
-             if (!size)
-               size = pd->blksize;
-           }
+        {
+          if (i == nb - 1)
+            {
+              size = pd->size % pd->blksize;
+              if (!size)
+                size = pd->blksize;
+            }
           size_t blkno = bl.addBlock(off, size);
           if ( i < pd->sha1.size())
-           {
-             bl.setChecksum(blkno, "SHA1", 20, pd->sha1[i].data());
+            {
+              bl.setChecksum(blkno, "SHA1", 20, pd->sha1[i].data());
               if ( i < pd->zsync.size())
-               {
-                 unsigned char *p = pd->zsync[i].data();
-                 bl.setRsum(blkno, 4, p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24, pd->blksize);
-               }
-           }
-         off += pd->blksize;
-       }
+                {
+                  unsigned char *p = pd->zsync[i].data();
+                  bl.setRsum(blkno, 4, p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24, pd->blksize);
+                }
+            }
+          off += pd->blksize;
+        }
     }
   return bl;
 }
index 5f1f076..4be699f 100644 (file)
@@ -71,12 +71,12 @@ void Mount::mount( const std::string & source,
                    const Environment & environment )
 {
     const char *const argv[] = {
-       "/bin/mount",
-       "-t", filesystem.c_str(),
-       "-o", options.c_str(),
-       source.c_str(),
-       target.c_str(),
-       NULL
+        "/bin/mount",
+        "-t", filesystem.c_str(),
+        "-o", options.c_str(),
+        source.c_str(),
+        target.c_str(),
+        NULL
      };
 
     std::string err;
@@ -94,58 +94,58 @@ void Mount::mount( const std::string & source,
     // parse error messages
     while ( output.length() > 0)
     {
-       std::string::size_type  ret;
-
-       // extract \n
-       ret = output.find_first_of ( "\n" );
-       if ( ret != std::string::npos )
-       {
-           value.assign ( output, 0, ret );
-       }
-       else
-       {
-           value = output;
-       }
-
-       DBG << "stdout: " << value << endl;
-
-       if  ( value.find ( "is already mounted on" ) != std::string::npos )
-       {
-           err = "Media already mounted";
-       }
-       else if  ( value.find ( "ermission denied" ) != std::string::npos )
-       {
-           err = "Permission denied";
-       }
-       else if  ( value.find ( "wrong fs type" ) != std::string::npos )
-       {
-           err = "Invalid filesystem on media";
-       }
-       else if  ( value.find ( "No medium found" ) != std::string::npos )
-       {
-           err = "No medium found";
-       }
-       else if  ( value.find ( "Not a directory" ) != std::string::npos )
-       {
-           if( filesystem == "nfs" || filesystem == "nfs4" )
-           {
-               err = "Nfs path is not a directory";
-           }
-           else
-           {
-              err = "Unable to find directory on the media";
-           }
-       }
-
-       output = process->receiveLine();
+        std::string::size_type         ret;
+
+        // extract \n
+        ret = output.find_first_of ( "\n" );
+        if ( ret != std::string::npos )
+        {
+            value.assign ( output, 0, ret );
+        }
+        else
+        {
+            value = output;
+        }
+
+        DBG << "stdout: " << value << endl;
+
+        if  ( value.find ( "is already mounted on" ) != std::string::npos )
+        {
+            err = "Media already mounted";
+        }
+        else if  ( value.find ( "ermission denied" ) != std::string::npos )
+        {
+            err = "Permission denied";
+        }
+        else if  ( value.find ( "wrong fs type" ) != std::string::npos )
+        {
+            err = "Invalid filesystem on media";
+        }
+        else if  ( value.find ( "No medium found" ) != std::string::npos )
+        {
+            err = "No medium found";
+        }
+        else if  ( value.find ( "Not a directory" ) != std::string::npos )
+        {
+            if( filesystem == "nfs" || filesystem == "nfs4" )
+            {
+                err = "Nfs path is not a directory";
+            }
+            else
+            {
+               err = "Unable to find directory on the media";
+            }
+        }
+
+        output = process->receiveLine();
     }
 
     int status = Status();
 
     if ( status == 0 )
     {
-       // return codes overwites parsed error message
-       err = "";
+        // return codes overwites parsed error message
+        err = "";
     }
     else if ( status != 0 && err == "" )
     {
@@ -163,9 +163,9 @@ void Mount::mount( const std::string & source,
 void Mount::umount( const std::string & path )
 {
     const char *const argv[] = {
-       "/bin/umount",
-       path.c_str(),
-       NULL
+        "/bin/umount",
+        path.c_str(),
+        NULL
      };
 
     std::string err;
@@ -183,44 +183,44 @@ void Mount::umount( const std::string & path )
     // parse error messages
     while ( output.length() > 0)
     {
-       std::string::size_type  ret;
-
-       // extract \n
-       ret = output.find_first_of ( "\n" );
-       if ( ret != std::string::npos )
-       {
-           value.assign ( output, 0, ret );
-       }
-       else
-       {
-           value = output;
-       }
-
-       DBG << "stdout: " << value << endl;
-
-       // if  ( value.find ( "not mounted" ) != std::string::npos )
-       // {
-       //    err = Error::E_already_mounted;
-       // }
-
-       if  ( value.find ( "device is busy" ) != std::string::npos )
-       {
-           err = "Device is busy";
-       }
-
-       output = process->receiveLine();
+        std::string::size_type         ret;
+
+        // extract \n
+        ret = output.find_first_of ( "\n" );
+        if ( ret != std::string::npos )
+        {
+            value.assign ( output, 0, ret );
+        }
+        else
+        {
+            value = output;
+        }
+
+        DBG << "stdout: " << value << endl;
+
+        // if  ( value.find ( "not mounted" ) != std::string::npos )
+        // {
+        //    err = Error::E_already_mounted;
+        // }
+
+        if  ( value.find ( "device is busy" ) != std::string::npos )
+        {
+            err = "Device is busy";
+        }
+
+        output = process->receiveLine();
     }
 
     int status = Status();
 
     if ( status == 0 )
     {
-       // return codes overwites parsed error message
-       err = "";
+        // return codes overwites parsed error message
+        err = "";
     }
     else if ( status != 0 && err == "" )
     {
-       err = "Unmounting media failed";
+        err = "Unmounting media failed";
     }
 
     if ( err != "") {
@@ -232,7 +232,7 @@ void Mount::umount( const std::string & path )
 }
 
 void Mount::run( const char *const *argv, const Environment& environment,
-                ExternalProgram::Stderr_Disposition disp )
+                 ExternalProgram::Stderr_Disposition disp )
 {
   exit_code = -1;
 
@@ -325,16 +325,16 @@ Mount::getEntries(const std::string &mtab)
             ent.mnt_freq,   ent.mnt_passno
           );
 
-         // Attempt quick fix for bnc#710269:
-         // MountEntry is "//dist/install/ on /var/adm/mount/AP_0x00000001 type cifs (ro,relatime,unc=\dist\install,username=,domain=suse.de"
-         // but looking for "Looking for media(cifs<//dist/install>)attached(*/var/adm/mount/AP_0x00000001)"
-         // Kick the trailing '/' in "//dist/install/"
-         // TODO: Check and fix comparison in MediaHandler::checkAttached instead.
-         if ( entry.src.size() > 1     // not for "/"
-              && entry.src[entry.src.size()-1] == '/' )
-         {
-           entry.src.erase( entry.src.size()-1 );
-         }
+          // Attempt quick fix for bnc#710269:
+          // MountEntry is "//dist/install/ on /var/adm/mount/AP_0x00000001 type cifs (ro,relatime,unc=\dist\install,username=,domain=suse.de"
+          // but looking for "Looking for media(cifs<//dist/install>)attached(*/var/adm/mount/AP_0x00000001)"
+          // Kick the trailing '/' in "//dist/install/"
+          // TODO: Check and fix comparison in MediaHandler::checkAttached instead.
+          if ( entry.src.size() > 1    // not for "/"
+               && entry.src[entry.src.size()-1] == '/' )
+          {
+            entry.src.erase( entry.src.size()-1 );
+          }
           entries.push_back(entry);
 
           memset(buf,  0, sizeof(buf));
@@ -346,13 +346,13 @@ Mount::getEntries(const std::string &mtab)
       if( entries.empty())
       {
         WAR << "Unable to read any entry from the mount table '" << *t << "'"
-           << std::endl;
+            << std::endl;
       }
       else
       {
-       // OK, have a non-empty mount table.
+        // OK, have a non-empty mount table.
         t = mtabs.end();
-       break;
+        break;
       }
     }
     else
@@ -361,7 +361,7 @@ Mount::getEntries(const std::string &mtab)
       verbose = true;
       WAR << "Failed to read the mount table '" << *t << "': "
           << ::strerror(err)
-         << std::endl;
+          << std::endl;
       errno = err;
     }
   }
index a672c3f..70970df 100644 (file)
@@ -70,109 +70,109 @@ namespace zypp {
     {
     public:
 
-       /**
-        * For passing additional environment variables
-        * to mount
-        **/
-       typedef ExternalProgram::Environment Environment;
+        /**
+         * For passing additional environment variables
+         * to mount
+         **/
+        typedef ExternalProgram::Environment Environment;
 
-       /**
-        * Mount options. 'key' or 'key=value' pairs, separated by ','
-        **/
-       typedef KVMap<kvmap::KVMapBase::CharSep<'=',','> > Options;
+        /**
+         * Mount options. 'key' or 'key=value' pairs, separated by ','
+         **/
+        typedef KVMap<kvmap::KVMapBase::CharSep<'=',','> > Options;
 
     public:
 
-       /**
-       * Create an new instance.
-       */
-       Mount();
-
-       /**
-       * Clean up.
-       */
-       ~Mount();
-
-       /**
-       * mount device
-       *
-       * @param source what to mount (e.g. /dev/hda3)
-       * @param target where to mount (e.g. /mnt)
-       * @param filesystem which filesystem to use (e.g. reiserfs) (-t parameter)
-       * @param options mount options (e.g. ro) (-o parameter)
-       * @param environment optinal environment to pass (e.g. PASSWD="sennah")
+        /**
+        * Create an new instance.
+        */
+        Mount();
+
+        /**
+        * Clean up.
+        */
+        ~Mount();
+
+        /**
+        * mount device
+        *
+        * @param source what to mount (e.g. /dev/hda3)
+        * @param target where to mount (e.g. /mnt)
+        * @param filesystem which filesystem to use (e.g. reiserfs) (-t parameter)
+        * @param options mount options (e.g. ro) (-o parameter)
+        * @param environment optinal environment to pass (e.g. PASSWD="sennah")
         *
         * \throws MediaException
         *
-       */
+        */
 
-       void mount ( const std::string& source,
-                       const std::string& target,
-                       const std::string& filesystem,
-                       const std::string& options,
-                       const Environment& environment = Environment() );
+        void mount ( const std::string& source,
+                        const std::string& target,
+                        const std::string& filesystem,
+                        const std::string& options,
+                        const Environment& environment = Environment() );
 
-       /** umount device
-        *
-        * @param path device or mountpoint to umount
+        /** umount device
+         *
+         * @param path device or mountpoint to umount
         *
         * \throws MediaException
         *
-        * */
-       void umount (const std::string& path);
+         * */
+        void umount (const std::string& path);
 
     public:
 
-       /**
-       * Return mount entries from /etc/mtab or /etc/fstab file.
-       *
-       * @param mtab The name of the (mounted) file system description
-       *             file to read from. This file should be one /etc/mtab,
-       *             /etc/fstab or /proc/mounts. Default is to read
-       *             /proc/mounts and /etc/mtab in case is not a symlink
-       *             to /proc/mounts.
-       * @returns A vector with mount entries or empty vector if reading
-       *          or parsing of the mtab file(s) failed.
-       */
-       static MountEntries
-       getEntries(const std::string &mtab = "");
+        /**
+        * Return mount entries from /etc/mtab or /etc/fstab file.
+        *
+        * @param mtab The name of the (mounted) file system description
+        *             file to read from. This file should be one /etc/mtab,
+        *             /etc/fstab or /proc/mounts. Default is to read
+        *             /proc/mounts and /etc/mtab in case is not a symlink
+        *             to /proc/mounts.
+        * @returns A vector with mount entries or empty vector if reading
+        *          or parsing of the mtab file(s) failed.
+        */
+        static MountEntries
+        getEntries(const std::string &mtab = "");
 
     private:
 
-       /** The connection to the mount process.
-        * */
-       ExternalProgram *process;
-
-       /**
-        * Run mount with the specified arguments and handle stderr.
-        * @param argv Mount arguments
-        * @param environment Addittional environment to set
-        * @param stderr_disp How to handle stderr, merged with stdout by default
-        * */
-       void run( const char *const *argv, const Environment& environment,
-                 ExternalProgram::Stderr_Disposition stderr_disp =
-                 ExternalProgram::Stderr_To_Stdout);
-
-       void run( const char *const *argv,
-                 ExternalProgram::Stderr_Disposition stderr_disp =
-                 ExternalProgram::Stderr_To_Stdout) {
-         Environment notused;
-         run( argv, notused, stderr_disp );
-       }
-
-       /** Return the exit status of the process, closing the connection if
-        * not already done.
-        * */
-       int Status();
-
-       /** Forcably kill the process
-        * */
-       void Kill();
-
-
-       /** The exit code of the process, or -1 if not yet known.
-        * */
-       int exit_code;
+        /** The connection to the mount process.
+         * */
+        ExternalProgram *process;
+
+        /**
+         * Run mount with the specified arguments and handle stderr.
+         * @param argv Mount arguments
+         * @param environment Addittional environment to set
+         * @param stderr_disp How to handle stderr, merged with stdout by default
+         * */
+        void run( const char *const *argv, const Environment& environment,
+                  ExternalProgram::Stderr_Disposition stderr_disp =
+                  ExternalProgram::Stderr_To_Stdout);
+
+        void run( const char *const *argv,
+                  ExternalProgram::Stderr_Disposition stderr_disp =
+                  ExternalProgram::Stderr_To_Stdout) {
+          Environment notused;
+          run( argv, notused, stderr_disp );
+        }
+
+        /** Return the exit status of the process, closing the connection if
+         * not already done.
+         * */
+        int Status();
+
+        /** Forcably kill the process
+         * */
+        void Kill();
+
+
+        /** The exit code of the process, or -1 if not yet known.
+         * */
+        int exit_code;
     };
 
 
index edf457b..0d8d487 100644 (file)
@@ -43,8 +43,8 @@ namespace zypp
       /** Offer default Impl. */
       static shared_ptr<Impl> nullimpl()
       {
-       static shared_ptr<Impl> _nullimpl( new Impl );
-       return _nullimpl;
+        static shared_ptr<Impl> _nullimpl( new Impl );
+        return _nullimpl;
       }
 
     private:
@@ -108,7 +108,7 @@ namespace zypp
     {
       std::string userpwd = username();
       if ( password().size() ) {
-       userpwd += ":" + password();
+        userpwd += ":" + password();
       }
       return userpwd;
     }
@@ -150,7 +150,7 @@ namespace zypp
     {
       std::string userpwd = proxyUsername();
       if ( proxyPassword().size() ) {
-       userpwd += ":" + proxyPassword();
+        userpwd += ":" + proxyPassword();
       }
       return userpwd;
     }
index a9228b8..8847bd1 100644 (file)
@@ -36,11 +36,11 @@ namespace zypp
     Url UrlResolverPlugin::resolveUrl(const Url & o_url, HeaderList &headers)
     {
         if (o_url.getScheme() != "plugin")
-            return o_url;        
-        
+            return o_url;
+
         Url url(o_url);
         std::string name = url.getPathName();
-        Pathname plugin_path = (ZConfig::instance().pluginsPath()/"urlresolver")/name;    
+        Pathname plugin_path = (ZConfig::instance().pluginsPath()/"urlresolver")/name;
         if (PathInfo(plugin_path).isExist()) {
             PluginScript scr;
             scr.open(plugin_path);
@@ -53,7 +53,7 @@ namespace zypp
                  param_it != params.end();
                  ++param_it)
                 f.setHeader(param_it->first, param_it->second);
-            
+
             scr.send(f);
 
             PluginFrame r(scr.receive());
@@ -61,7 +61,7 @@ namespace zypp
                 // now set
                 url = Url(r.body());
                 PluginFrame::HeaderListIterator it;
-                
+
                 for (it = r.headerBegin();
                      it != r.headerEnd();
                      ++it) {
@@ -69,15 +69,15 @@ namespace zypp
                     // curl resets headers that are empty, so we use a workaround
                     if (values.second.empty()) {
                         values.second = "\r\nX-libcurl-Empty-Header-Workaround: *";
-                    }                    
-                    headers.insert(values);                    
+                    }
+                    headers.insert(values);
                 }
             }
             else if (r.command() == "ERROR") {
                 ZYPP_THROW(MediaException(r.body()));
-            }            
+            }
         }
-        return url;        
+        return url;
     }
 
     /** \relates UrlResolverPlugin::Impl Stream output */
index 270c6c2..62944ef 100644 (file)
@@ -27,7 +27,7 @@ namespace zypp
   namespace media
   { /////////////////////////////////////////////////////////////////
 
-    /** 
+    /**
      *
      */
     class UrlResolverPlugin
index b3bcdd3..39e761f 100644 (file)
@@ -74,21 +74,21 @@ ZsyncParser::parse(std::string filename)
     {
       is.getline(buf, sizeof(buf));
       if (!*buf)
-       break;
+        break;
       if (!strncmp(buf, "Length: ", 8))
         filesize = (off_t)strtoull(buf + 8, 0, 10);
       else if (!strncmp(buf, "Hash-Lengths: ", 14))
         (void)sscanf(buf + 14, "%d,%d,%d", &sql, &rsl, &csl);
       else if (!strncmp(buf, "Blocksize: ", 11))
         blksize = atoi(buf + 11);
-      else if (!strncmp(buf, "URL: http://", 12) || !strncmp(buf, "URL: https://", 13) || !strncmp(buf, "URL: ftp://", 11) || !strncmp(buf, "URL: tftp://", 12) ) 
-       urls.push_back(buf + 5);
+      else if (!strncmp(buf, "URL: http://", 12) || !strncmp(buf, "URL: https://", 13) || !strncmp(buf, "URL: ftp://", 11) || !strncmp(buf, "URL: tftp://", 12) )
+        urls.push_back(buf + 5);
       else if (!strncmp(buf, "SHA-1: ", 7))
-       {
-         unsigned char sha1[20];
-         if (hexstr2bytes(sha1, buf + 7, 20) == 20)
-           bl.setFileChecksum("SHA1", 20, sha1);
-       }
+        {
+          unsigned char sha1[20];
+          if (hexstr2bytes(sha1, buf + 7, 20) == 20)
+            bl.setFileChecksum("SHA1", 20, sha1);
+        }
     }
   if (filesize == off_t(-1))
     ZYPP_THROW(Exception("Parse Error"));
@@ -99,28 +99,28 @@ ZsyncParser::parse(std::string filename)
   if (filesize)
     {
       if (csl < 3 || csl > 16 || rsl < 1 || rsl > 4 || sql < 1 || sql > 2)
-       ZYPP_THROW(Exception("Parse Error: illegal hash lengths"));
+        ZYPP_THROW(Exception("Parse Error: illegal hash lengths"));
       size_t nblks = (filesize + blksize - 1) / blksize;
       size_t i;
       off_t off = 0;
       size_t size = blksize;
       for (i = 0; i < nblks; i++)
-       {
-         if (i == nblks - 1)
-           {
-             size = filesize % blksize;
-             if (!size)
-               size = blksize;
-           }
-         size_t blkno = bl.addBlock(off, size);
-         unsigned char rp[16];
-         rp[0] = rp[1] = rp[2] = rp[3] = 0;
-         is.read((char *)rp + 4 - rsl, rsl);
-         bl.setRsum(blkno, rsl, rp[0] << 24 | rp[1] << 16 | rp[2] << 8 | rp[3], blksize);
-         is.read((char *)rp, csl);
-         bl.setChecksum(blkno, "MD4", csl, rp, blksize);
-         off += size;
-       }
+        {
+          if (i == nblks - 1)
+            {
+              size = filesize % blksize;
+              if (!size)
+                size = blksize;
+            }
+          size_t blkno = bl.addBlock(off, size);
+          unsigned char rp[16];
+          rp[0] = rp[1] = rp[2] = rp[3] = 0;
+          is.read((char *)rp + 4 - rsl, rsl);
+          bl.setRsum(blkno, rsl, rp[0] << 24 | rp[1] << 16 | rp[2] << 8 | rp[3], blksize);
+          is.read((char *)rp, csl);
+          bl.setChecksum(blkno, "MD4", csl, rp, blksize);
+          off += size;
+        }
     }
   is.close();
 }
index f93ffa3..01955bb 100644 (file)
@@ -32,21 +32,21 @@ namespace zypp {
       : _set( false )
       , _var( var_r )
       {
-       const char * val = getenv( _var.c_str() );
-       if ( val )
-       {
-         _set = true;
-         _val = val;
-         ::unsetenv( _var.c_str() );
-       }
+        const char * val = getenv( _var.c_str() );
+        if ( val )
+        {
+          _set = true;
+          _val = val;
+          ::unsetenv( _var.c_str() );
+        }
       }
 
       ~TmpUnsetEnv()
       {
-       if ( _set )
-       {
-         setenv( _var.c_str(), _val.c_str(), 1 );
-       }
+        if ( _set )
+        {
+          setenv( _var.c_str(), _val.c_str(), 1 );
+        }
       }
 
       bool _set;
@@ -63,17 +63,17 @@ namespace zypp {
       static WatchFile sysconfigProxy( "/etc/sysconfig/proxy", WatchFile::NO_INIT );
       if ( sysconfigProxy.hasChanged() )
       {
-       MIL << "Build Libproxy Factory from /etc/sysconfig/proxy" << endl;
-       if ( proxyFactory )
-         ::px_proxy_factory_free( proxyFactory );
+        MIL << "Build Libproxy Factory from /etc/sysconfig/proxy" << endl;
+        if ( proxyFactory )
+          ::px_proxy_factory_free( proxyFactory );
 
-       TmpUnsetEnv envguard[] __attribute__ ((__unused__)) = { "KDE_FULL_SESSION", "GNOME_DESKTOP_SESSION_ID", "DESKTOP_SESSION" };
-       proxyFactory = ::px_proxy_factory_new();
+        TmpUnsetEnv envguard[] __attribute__ ((__unused__)) = { "KDE_FULL_SESSION", "GNOME_DESKTOP_SESSION_ID", "DESKTOP_SESSION" };
+        proxyFactory = ::px_proxy_factory_new();
       }
       else if ( ! proxyFactory )
       {
-       MIL << "Build Libproxy Factory" << endl;
-       proxyFactory = ::px_proxy_factory_new();
+        MIL << "Build Libproxy Factory" << endl;
+        proxyFactory = ::px_proxy_factory_new();
       }
 
       return proxyFactory;
@@ -92,34 +92,34 @@ namespace zypp {
     std::string ProxyInfoLibproxy::proxy(const Url & url_r) const
     {
       if (!_enabled)
-       return "";
+        return "";
 
       const url::ViewOption vopt =
-             url::ViewOption::WITH_SCHEME
-             + url::ViewOption::WITH_HOST
-             + url::ViewOption::WITH_PORT
-             + url::ViewOption::WITH_PATH_NAME;
+              url::ViewOption::WITH_SCHEME
+              + url::ViewOption::WITH_HOST
+              + url::ViewOption::WITH_PORT
+              + url::ViewOption::WITH_PATH_NAME;
 
       char **proxies = px_proxy_factory_get_proxies(_factory,
-                                                   (char *)url_r.asString(vopt).c_str());
+                                                    (char *)url_r.asString(vopt).c_str());
       if (!proxies)
-             return "";
+              return "";
 
       /* cURL can only handle HTTP proxies, not SOCKS. And can only handle
-        one. So look through the list and find an appropriate one. */
+         one. So look through the list and find an appropriate one. */
       char *result = NULL;
 
       for (int i = 0; proxies[i]; i++) {
-             if (!result &&
-                 !strncmp(proxies[i], "http://", 7))
-                     result = proxies[i];
-             else
-                     free(proxies[i]);
+              if (!result &&
+                  !strncmp(proxies[i], "http://", 7))
+                      result = proxies[i];
+              else
+                      free(proxies[i]);
       }
       free(proxies);
 
       if (!result)
-             return "";
+              return "";
 
       std::string sresult = result;
       free(result);
index 0868c70..72333cc 100644 (file)
@@ -28,31 +28,31 @@ namespace zypp {
     : ProxyInfo::Impl()
     {
       std::map<std::string,std::string> data = sysconfig::read(
-       path.relative()
-         ? "/etc/sysconfig" + path
-         : path);
+        path.relative()
+          ? "/etc/sysconfig" + path
+          : path);
       std::map<std::string,std::string>::const_iterator it = data.find("PROXY_ENABLED");
       if (it != data.end())
-       _enabled = it->second != "no";
+        _enabled = it->second != "no";
       it = data.find("HTTP_PROXY");
       if (it != data.end())
-       _proxies["http"] = it->second;
+        _proxies["http"] = it->second;
       it = data.find("HTTPS_PROXY");
       if (it != data.end())
-       _proxies["https"] = it->second;
+        _proxies["https"] = it->second;
       it = data.find("FTP_PROXY");
       if (it != data.end())
-       _proxies["ftp"] = it->second;
+        _proxies["ftp"] = it->second;
       it = data.find("NO_PROXY");
       if (it != data.end())
-       str::split(it->second, std::back_inserter(_no_proxy), ", \t");
+        str::split(it->second, std::back_inserter(_no_proxy), ", \t");
     }
 
     std::string ProxyInfoSysconfig::proxy(const Url & url_r) const
     {
       std::map<std::string,std::string>::const_iterator it = _proxies.find(url_r.getScheme());
       if (it != _proxies.end())
-       return it->second;
+        return it->second;
       return "";
     }
 
index feeba20..5071a45 100644 (file)
@@ -175,13 +175,13 @@ namespace zypp
       // RpmDb access is blocked while the Target is not initialized.
       // Launching the Target just for this query would be an overkill.
       struct TmpUnblock {
-       TmpUnblock()
-       : _wasBlocked( librpmDb::isBlocked() )
-       { if ( _wasBlocked ) librpmDb::unblockAccess(); }
-       ~TmpUnblock()
-       { if ( _wasBlocked ) librpmDb::blockAccess(); }
+        TmpUnblock()
+        : _wasBlocked( librpmDb::isBlocked() )
+        { if ( _wasBlocked ) librpmDb::unblockAccess(); }
+        ~TmpUnblock()
+        { if ( _wasBlocked ) librpmDb::blockAccess(); }
       private:
-       bool _wasBlocked;
+        bool _wasBlocked;
       } tmpUnblock;
 
       librpmDb::db_const_iterator it;
@@ -350,7 +350,7 @@ namespace zypp
         , "/dev/"
         , "/tmp/"
         , "/proc/"
-       , "/memfd:"
+        , "/memfd:"
       };
       for_( it, arrayBegin( black ), arrayEnd( black ) )
       {
@@ -536,15 +536,15 @@ namespace zypp
     str::smatch what;
     std::string ret;
     iostr::simpleParseFile( InputStream( Pathname("/proc")/pid/"cgroup" ),
-                           [&]( int num_r, std::string line_r )->bool
-                           {
-                             if ( str::regex_match( line_r, what, rx ) )
-                             {
-                               ret = what[3];
-                               return false;   // stop after match
-                             }
-                             return true;
-                           } );
+                            [&]( int num_r, std::string line_r )->bool
+                            {
+                              if ( str::regex_match( line_r, what, rx ) )
+                              {
+                                ret = what[3];
+                                return false;  // stop after match
+                              }
+                              return true;
+                            } );
     return ret;
   }
 
index 583b4ca..5d9ce96 100644 (file)
@@ -208,11 +208,11 @@ namespace yamltest::detail {
       else if ( key == ("vendors") )
       {
         bool success = readListInlineOrFromFile( [&target]( const YAML::Node & dataNode, std::string * err ) {
-         std::vector<std::string> vlist;
-         for ( const auto & node : dataNode )
-           vlist.push_back( node.as<std::string>() );
-         if ( ! vlist.empty() )
-           target.vendorLists.push_back( std::move(vlist) );
+          std::vector<std::string> vlist;
+          for ( const auto & node : dataNode )
+            vlist.push_back( node.as<std::string>() );
+          if ( ! vlist.empty() )
+            target.vendorLists.push_back( std::move(vlist) );
           return true;
         }, err );
         if ( !success ) return false;
index 99de5e0..35a3b1f 100644 (file)
@@ -50,9 +50,9 @@ namespace zypp
     void addActionFilter( const HistoryActionID & action_r )
     {
       if ( action_r == HistoryActionID::NONE )
-       _actionfilter.clear();
+        _actionfilter.clear();
       else
-       _actionfilter.insert( action_r.asString() );
+        _actionfilter.insert( action_r.asString() );
     }
 
     Pathname _filename;
@@ -87,15 +87,15 @@ namespace zypp
       ZYPP_CAUGHT( excpt );
       if ( _options.testFlag( IGNORE_INVALID_ITEMS ) )
       {
-       WAR << "Ignore invalid history log entry on line #" << lineNr_r << " '"<< line_r << "'" << endl;
-       return true;
+        WAR << "Ignore invalid history log entry on line #" << lineNr_r << " '"<< line_r << "'" << endl;
+        return true;
       }
       else
       {
-       ERR << "Invalid history log entry on line #" << lineNr_r << " '"<< line_r << "'" << endl;
-       ParseException newexcpt( str::Str() << "Error in history log on line #" << lineNr_r );
-       newexcpt.remember( excpt );
-       ZYPP_THROW( newexcpt );
+        ERR << "Invalid history log entry on line #" << lineNr_r << " '"<< line_r << "'" << endl;
+        ParseException newexcpt( str::Str() << "Error in history log on line #" << lineNr_r );
+        newexcpt.remember( excpt );
+        ZYPP_THROW( newexcpt );
       }
     }
 
@@ -124,7 +124,7 @@ namespace zypp
         continue;
 
       if ( ! parseLine( *line, line.lineNo() ) )
-       break;  // requested by consumer callback
+        break; // requested by consumer callback
     }
 
     pd.toMax();
@@ -150,8 +150,8 @@ namespace zypp
 
       if ( pastDate )
       {
-       if ( ! parseLine( s, line.lineNo() ) )
-         break;        // requested by consumer callback
+        if ( ! parseLine( s, line.lineNo() ) )
+          break;       // requested by consumer callback
       }
       else
       {
@@ -160,7 +160,7 @@ namespace zypp
         {
           pastDate = true;
           if ( ! parseLine( s, line.lineNo() ) )
-           break;      // requested by consumer callback
+            break;     // requested by consumer callback
         }
       }
     }
@@ -198,8 +198,8 @@ namespace zypp
 
       if ( pastFromDate )
       {
-       if ( ! parseLine( s, line.lineNo() ) )
-         break;        // requested by consumer callback
+        if ( ! parseLine( s, line.lineNo() ) )
+          break;       // requested by consumer callback
       }
     }
 
index 73c66f2..2d7687a 100644 (file)
@@ -36,7 +36,7 @@ namespace zypp
     /**
      * Parses a INI file and offers its structure as a
      * dictionary.
-     * 
+     *
      */
     class IniDict : public IniParser
     {
@@ -46,12 +46,12 @@ namespace zypp
       typedef std::map<std::string, EntrySet> SectionSet;
       typedef MapKVIteratorTraits<SectionSet>::Key_const_iterator section_const_iterator;
       typedef EntrySet::const_iterator entry_const_iterator;
-      
+
       /**
        * \name Section Iterators
        * Iterate trough ini file sections
        * \code
-       * for ( IniDict::section_const_iterator it = dict.sectionsBegin(); 
+       * for ( IniDict::section_const_iterator it = dict.sectionsBegin();
        *       it != dict.sectionsEnd();
        *       ++it )
        * {
@@ -64,12 +64,12 @@ namespace zypp
       section_const_iterator sectionsEnd() const;
       Iterable<section_const_iterator> sections() const;
       //@}
-      
+
       /**
        * \name Entries Iterators
        * Iterate trough ini file entries in a section
        * \code
-       * for ( IniDict::entry_const_iterator it = dict.entriesBegin("updates"); 
+       * for ( IniDict::entry_const_iterator it = dict.entriesBegin("updates");
        *       it != dict.entriesEnd("updates");
        *       ++it )
        * {
@@ -77,13 +77,13 @@ namespace zypp
        * }
        * \endcode
        */
-       
+
       //@{
       entry_const_iterator entriesBegin(const std::string &section) const;
       entry_const_iterator entriesEnd(const std::string &section) const;
       Iterable<entry_const_iterator> entries(const std::string &section) const;
       //@{
-      
+
       /**
        * Creates a dictionary from a InputStream
        * containing a ini structured file
@@ -95,7 +95,7 @@ namespace zypp
        * Creates a mepty dictionary
        */
       IniDict();
-      
+
       /** Dtor */
       ~IniDict();
 
@@ -115,7 +115,7 @@ namespace zypp
       void insertEntry( const std::string &section,
                         const std::string &key,
                         const std::string &value );
-      
+
       /**
        * \short add an entry
        * \param section
index 1948d53..a785d83 100644 (file)
@@ -70,7 +70,7 @@ void IniParser::endParse()
 void IniParser::garbageLine( const std::string &section, const std::string &line )
 {
   std::string msg = str::form("%s: Section [%s]: Line %d contains garbage (no '=' or '%s' in key)",
-                             _inputname.c_str(), section.c_str(), _line_nr, keyGarbage().c_str());
+                              _inputname.c_str(), section.c_str(), _line_nr, keyGarbage().c_str());
   ZYPP_THROW(ParseException(msg));
 }
 
@@ -102,14 +102,14 @@ void IniParser::parse( const InputStream & input_r, const ProgressData::Receiver
       std::string::size_type pos = trimmed.rfind(']');
       if ( pos != std::string::npos )
       {
-       std::string section = trimmed.substr(1, pos-1);
-       consume(section);
-       section.swap(_current_section);
+        std::string section = trimmed.substr(1, pos-1);
+        consume(section);
+        section.swap(_current_section);
       }
       else
       {
-       _line_nr = line.lineNo();
-       garbageLine( _current_section, trimmed );
+        _line_nr = line.lineNo();
+        garbageLine( _current_section, trimmed );
       }
       continue;
     }
index e4a2b4a..dcb1a1e 100644 (file)
@@ -22,7 +22,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace parser
   { /////////////////////////////////////////////////////////////////
+
     ///////////////////////////////////////////////////////////////////
     //
     // METHOD NAME : ParseException::ParseException
index 9ca0d83..faeaeda 100644 (file)
@@ -23,7 +23,7 @@ namespace parser
   {
     public:
       typedef boost::shared_ptr<ParserProgress> Ptr;
-      
+
       /**
        * initializes a progress objetc, with a callback functor
        * if you are not reporting percentage, then set
@@ -33,12 +33,12 @@ namespace parser
       ParserProgress( boost::function<void (long int)> fnc, long int total_steps = 100 )
       : _fnc(fnc), _previous_progress(0), _total_steps(total_steps)
       {
-        
+
       };
-      
+
       ~ParserProgress()
       {};
-      
+
       /**
        * report progress, which in most cases
        * executes the functor associated with
@@ -53,19 +53,19 @@ namespace parser
           long int current_done = p;
           p = (long int)(((double) current_done/(double) _total_steps)*100);
         }
-        
+
         if (_fnc && ( p !=  _previous_progress ))
         {
           _previous_progress = p;
           _fnc(p);
         }
       }
-      
+
       void setTotalSteps( long int total_steps )
       {
         _total_steps = total_steps;
       }
-      
+
       /**
        * report progress finished
        */
@@ -78,7 +78,7 @@ namespace parser
           _fnc(p);
         }
       }
-      
+
       /**
        * report progress started
        */
@@ -91,7 +91,7 @@ namespace parser
           _fnc(p);
         }
       }
-      
+
     private:
       boost::function<void (long int)> _fnc;
       long int _previous_progress;
index f6be805..31040a5 100644 (file)
@@ -149,7 +149,7 @@ namespace zypp
             ("arch",          MANDTAORY,  xml::parseDefAssign( _pdata._arch ) )
             ("shortsummary",  OPTIONAL,   xml::parseDefAssign( _pdata._shortName ) )
             ("summary",       MULTIPLE_OPTIONAL, xml::parseDefAssign( _ttext )( "lang", _tlocale )
-                                         >>bind( &ProductNode::doneLocalizedDefault, this, _1, boost::ref(_pdata._summary) ))
+                                          >>bind( &ProductNode::doneLocalizedDefault, this, _1, boost::ref(_pdata._summary) ))
             ("productline",   OPTIONAL,   xml::parseDefAssign( _pdata._productline ) )
             ("register",      OPTIONAL)
             ("updaterepokey", OPTIONAL,   xml::parseDefAssign( _pdata._updaterepokey ) )
@@ -191,9 +191,9 @@ namespace zypp
       /** collect localized data */
       void doneLocalizedDefault( const xml::Node & _node, std::string & store_r )
       {
-       // take 1st or default
-       if ( store_r.empty() || _tlocale.empty() )
-         store_r = _ttext;
+        // take 1st or default
+        if ( store_r.empty() || _tlocale.empty() )
+          store_r = _ttext;
       }
 
       /** finaly */
@@ -208,8 +208,8 @@ namespace zypp
         std::string             _version;
         std::string             _release;
 
-       std::string             _ttext;
-       std::string             _tlocale;
+        std::string             _ttext;
+        std::string             _tlocale;
 
         ProductFileData::Upgrade::Impl _upgrade;
     };
index c8bcacd..eded4dd 100644 (file)
@@ -54,8 +54,8 @@ namespace zypp
         Edition     edition() const;
         Arch        arch()    const;
 
-       std::string shortName() const;
-       std::string summary()   const;
+        std::string shortName()        const;
+        std::string summary()  const;
 
       public:
         std::string productline()     const;
index 18f9d60..ffb6127 100644 (file)
@@ -37,95 +37,95 @@ namespace zypp
       class RepoFileParser : public IniDict
       {
       public:
-       RepoFileParser( const InputStream & is_r )
-       { read( is_r ); }
-
-       using IniDict::consume; // don't hide overloads we don't redefine here
-
-       virtual void consume( const std::string & section_r, const std::string & key_r, const std::string & value_r )
-       {
-         if ( key_r == "baseurl" )
-         {
-           _inMultiline = MultiLine::baseurl;
-           storeUrl( _baseurls[section_r], value_r );
-         }
-         else if ( key_r == "gpgkey" )
-         {
-           _inMultiline = MultiLine::gpgkey;
-           storeUrl( _gpgkeys[section_r], value_r );
-         }
-         else if ( key_r == "mirrorlist" )
-         {
-           _inMultiline = MultiLine::mirrorlist;
-           storeUrl( _mirrorlist[section_r], value_r );
-         }
-         else if ( key_r == "metalink" )
-         {
-           _inMultiline = MultiLine::metalink;
-           storeUrl( _metalink[section_r], value_r );
-         }
-         else
-         {
-           _inMultiline = MultiLine::none;
-           IniDict::consume( section_r, key_r, value_r );
-         }
-       }
-
-       virtual void garbageLine( const std::string & section_r, const std::string & line_r )
-       {
-         switch ( _inMultiline )
-         {
-           case MultiLine::baseurl:
-             storeUrl( _baseurls[section_r], line_r );
-             break;
-
-           case MultiLine::gpgkey:
-             storeUrl( _gpgkeys[section_r], line_r );
-             break;
-
-           case MultiLine::mirrorlist:
-             storeUrl( _mirrorlist[section_r], line_r );
-             break;
-
-           case MultiLine::metalink:
-             storeUrl( _metalink[section_r], line_r );
-             break;
-
-           case MultiLine::none:
-             IniDict::garbageLine( section_r, line_r );        // throw
-             break;
-         }
-       }
-
-       std::list<Url> & baseurls( const std::string & section_r )
-       { return _baseurls[section_r]; }
-
-       std::list<Url> & gpgkeys( const std::string & section_r )
-       { return _gpgkeys[section_r]; }
-
-       std::list<Url> & mirrorlist( const std::string & section_r )
-       { return _mirrorlist[section_r]; }
-
-       std::list<Url> & metalink( const std::string & section_r )
-       { return _metalink[section_r]; }
+        RepoFileParser( const InputStream & is_r )
+        { read( is_r ); }
+
+        using IniDict::consume;        // don't hide overloads we don't redefine here
+
+        virtual void consume( const std::string & section_r, const std::string & key_r, const std::string & value_r )
+        {
+          if ( key_r == "baseurl" )
+          {
+            _inMultiline = MultiLine::baseurl;
+            storeUrl( _baseurls[section_r], value_r );
+          }
+          else if ( key_r == "gpgkey" )
+          {
+            _inMultiline = MultiLine::gpgkey;
+            storeUrl( _gpgkeys[section_r], value_r );
+          }
+          else if ( key_r == "mirrorlist" )
+          {
+            _inMultiline = MultiLine::mirrorlist;
+            storeUrl( _mirrorlist[section_r], value_r );
+          }
+          else if ( key_r == "metalink" )
+          {
+            _inMultiline = MultiLine::metalink;
+            storeUrl( _metalink[section_r], value_r );
+          }
+          else
+          {
+            _inMultiline = MultiLine::none;
+            IniDict::consume( section_r, key_r, value_r );
+          }
+        }
+
+        virtual void garbageLine( const std::string & section_r, const std::string & line_r )
+        {
+          switch ( _inMultiline )
+          {
+            case MultiLine::baseurl:
+              storeUrl( _baseurls[section_r], line_r );
+              break;
+
+            case MultiLine::gpgkey:
+              storeUrl( _gpgkeys[section_r], line_r );
+              break;
+
+            case MultiLine::mirrorlist:
+              storeUrl( _mirrorlist[section_r], line_r );
+              break;
+
+            case MultiLine::metalink:
+              storeUrl( _metalink[section_r], line_r );
+              break;
+
+            case MultiLine::none:
+              IniDict::garbageLine( section_r, line_r );       // throw
+              break;
+          }
+        }
+
+        std::list<Url> & baseurls( const std::string & section_r )
+        { return _baseurls[section_r]; }
+
+        std::list<Url> & gpgkeys( const std::string & section_r )
+        { return _gpgkeys[section_r]; }
+
+        std::list<Url> & mirrorlist( const std::string & section_r )
+        { return _mirrorlist[section_r]; }
+
+        std::list<Url> & metalink( const std::string & section_r )
+        { return _metalink[section_r]; }
 
       private:
-       void storeUrl( std::list<Url> & store_r, const std::string & line_r )
-       {
-         // #285: Fedora/dnf allows WS separated urls (and an optional comma)
-         strv::splitRx( line_r, "[,[:blank:]]*[[:blank:]][,[:blank:]]*", [&store_r]( std::string_view w ) {
-           if ( ! w.empty() )
-             store_r.push_back( Url(std::string(w)) );
-         });
-       }
-
-       enum class MultiLine { none, baseurl, gpgkey, mirrorlist, metalink };
-       MultiLine _inMultiline = MultiLine::none;
-
-       std::map<std::string,std::list<Url>> _baseurls;
-       std::map<std::string,std::list<Url>> _gpgkeys;
-       std::map<std::string,std::list<Url>> _mirrorlist;
-       std::map<std::string,std::list<Url>> _metalink;
+        void storeUrl( std::list<Url> & store_r, const std::string & line_r )
+        {
+          // #285: Fedora/dnf allows WS separated urls (and an optional comma)
+          strv::splitRx( line_r, "[,[:blank:]]*[[:blank:]][,[:blank:]]*", [&store_r]( std::string_view w ) {
+            if ( ! w.empty() )
+              store_r.push_back( Url(std::string(w)) );
+          });
+        }
+
+        enum class MultiLine { none, baseurl, gpgkey, mirrorlist, metalink };
+        MultiLine _inMultiline = MultiLine::none;
+
+        std::map<std::string,std::list<Url>> _baseurls;
+        std::map<std::string,std::list<Url>> _gpgkeys;
+        std::map<std::string,std::list<Url>> _mirrorlist;
+        std::map<std::string,std::list<Url>> _metalink;
       };
 
     } //namespace
@@ -144,8 +144,8 @@ namespace zypp
       {
         RepoInfo info;
         info.setAlias(*its);
-       std::string proxy;
-       std::string proxyport;
+        std::string proxy;
+        std::string proxyport;
 
         for_( it, dict.entriesBegin(*its), dict.entriesEnd(*its) )
         {
@@ -168,49 +168,49 @@ namespace zypp
             info.setRepoGpgCheck( str::strToTrue( it->second ) );
           else if ( it->first == "pkg_gpgcheck" )
             info.setPkgGpgCheck( str::strToTrue( it->second ) );
-         else if ( it->first == "keeppackages" )
-           info.setKeepPackages( str::strToTrue( it->second ) );
-         else if ( it->first == "service" )
-           info.setService( it->second );
+          else if ( it->first == "keeppackages" )
+            info.setKeepPackages( str::strToTrue( it->second ) );
+          else if ( it->first == "service" )
+            info.setService( it->second );
           else if ( it->first == "proxy" )
-         {
-           // Translate it into baseurl queryparams
-           // NOTE: The hack here does not add proxy to mirrorlist urls but the
-           //       original code worked without complains, so keep it for now.
-           static const str::regex ex( ":[0-9]+$" );   // portspec
-           str::smatch what;
-           if ( str::regex_match( it->second, what, ex ) )
-           {
-             proxy = it->second.substr( 0, it->second.size() - what[0].size() );
-             proxyport = what[0].substr( 1 );
-           }
-           else
-           {
-             proxy = it->second;
-           }
-         }
+          {
+            // Translate it into baseurl queryparams
+            // NOTE: The hack here does not add proxy to mirrorlist urls but the
+            //       original code worked without complains, so keep it for now.
+            static const str::regex ex( ":[0-9]+$" );  // portspec
+            str::smatch what;
+            if ( str::regex_match( it->second, what, ex ) )
+            {
+              proxy = it->second.substr( 0, it->second.size() - what[0].size() );
+              proxyport = what[0].substr( 1 );
+            }
+            else
+            {
+              proxy = it->second;
+            }
+          }
           else
             ERR << "Unknown attribute in [" << *its << "]: " << it->first << "=" << it->second << " ignored" << endl;
         }
 
-       for ( auto & url : dict.baseurls( *its ) )
-       {
-         if ( ! proxy.empty() && url.getQueryParam( "proxy" ).empty() )
-         {
-           url.setQueryParam( "proxy", proxy );
-           url.setQueryParam( "proxyport", proxyport );
-         }
-         info.addBaseUrl( url );
-       }
+        for ( auto & url : dict.baseurls( *its ) )
+        {
+          if ( ! proxy.empty() && url.getQueryParam( "proxy" ).empty() )
+          {
+            url.setQueryParam( "proxy", proxy );
+            url.setQueryParam( "proxyport", proxyport );
+          }
+          info.addBaseUrl( url );
+        }
 
-       if ( ! dict.gpgkeys( *its ).empty() )
-         info.setGpgKeyUrls( std::move(dict.gpgkeys( *its )) );
+        if ( ! dict.gpgkeys( *its ).empty() )
+          info.setGpgKeyUrls( std::move(dict.gpgkeys( *its )) );
 
-       if ( ! dict.mirrorlist( *its ).empty() )
-         info.setMirrorListUrls( std::move(dict.mirrorlist( *its )) );
+        if ( ! dict.mirrorlist( *its ).empty() )
+          info.setMirrorListUrls( std::move(dict.mirrorlist( *its )) );
 
-       if ( ! dict.metalink( *its ).empty() )
-         info.setMetalinkUrls( std::move(dict.metalink( *its )) );
+        if ( ! dict.metalink( *its ).empty() )
+          info.setMetalinkUrls( std::move(dict.metalink( *its )) );
 
 
         info.setFilepath(is.path());
index ddf4a9a..f41e7e8 100644 (file)
@@ -46,50 +46,50 @@ namespace zypp
       class VarReplacer : private base::NonCopyable
       {
       public:
-       /** */
-       void setVar( const std::string & key_r, const std::string & val_r )
-       {
-         //MIL << "*** Inject " << key_r << " = " << val_r;
-         _vars[key_r] = replace( val_r );
-         //MIL << " (" << _vars[key_r] << ")" << endl;
-       }
-
-       std::string replace( const std::string & val_r ) const
-       {
-         std::string::size_type vbeg = val_r.find( "%{", 0 );
-         if ( vbeg == std::string::npos )
-           return val_r;
-
-         str::Str ret;
-         std::string::size_type cbeg = 0;
-         for( ; vbeg != std::string::npos; vbeg = val_r.find( "%{", vbeg ) )
-         {
-           std::string::size_type nbeg = vbeg+2;
-           std::string::size_type nend = val_r.find( "}", nbeg );
-           if ( nend == std::string::npos )
-           {
-             WAR << "Incomplete variable in '" << val_r << "'" << endl;
-             break;
-           }
-           const auto & iter = _vars.find( val_r.substr( nbeg, nend-nbeg ) );
-           if ( iter != _vars.end() )
-           {
-             if ( cbeg < vbeg )
-               ret << val_r.substr( cbeg, vbeg-cbeg );
-             ret << iter->second;
-             cbeg = nend+1;
-           }
-           else
-             WAR << "Undefined variable %{" << val_r.substr( nbeg, nend-nbeg ) << "} in '" << val_r << "'" << endl;
-           vbeg = nend+1;
-         }
-         if ( cbeg < val_r.size() )
-           ret << val_r.substr( cbeg );
-
-         return ret;
-       }
+        /** */
+        void setVar( const std::string & key_r, const std::string & val_r )
+        {
+          //MIL << "*** Inject " << key_r << " = " << val_r;
+          _vars[key_r] = replace( val_r );
+          //MIL << " (" << _vars[key_r] << ")" << endl;
+        }
+
+        std::string replace( const std::string & val_r ) const
+        {
+          std::string::size_type vbeg = val_r.find( "%{", 0 );
+          if ( vbeg == std::string::npos )
+            return val_r;
+
+          str::Str ret;
+          std::string::size_type cbeg = 0;
+          for( ; vbeg != std::string::npos; vbeg = val_r.find( "%{", vbeg ) )
+          {
+            std::string::size_type nbeg = vbeg+2;
+            std::string::size_type nend = val_r.find( "}", nbeg );
+            if ( nend == std::string::npos )
+            {
+              WAR << "Incomplete variable in '" << val_r << "'" << endl;
+              break;
+            }
+            const auto & iter = _vars.find( val_r.substr( nbeg, nend-nbeg ) );
+            if ( iter != _vars.end() )
+            {
+              if ( cbeg < vbeg )
+                ret << val_r.substr( cbeg, vbeg-cbeg );
+              ret << iter->second;
+              cbeg = nend+1;
+            }
+            else
+              WAR << "Undefined variable %{" << val_r.substr( nbeg, nend-nbeg ) << "} in '" << val_r << "'" << endl;
+            vbeg = nend+1;
+          }
+          if ( cbeg < val_r.size() )
+            ret << val_r.substr( cbeg );
+
+          return ret;
+        }
       private:
-       std::unordered_map<std::string,std::string> _vars;
+        std::unordered_map<std::string,std::string> _vars;
       };
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -121,8 +121,8 @@ namespace zypp
       const XmlString & s( reader_r->getAttribute( key_r ) );
       if ( s.get() )
       {
-       value_r = _replacer.replace( s.asString() );
-       return !value_r.empty();
+        value_r = _replacer.replace( s.asString() );
+        return !value_r.empty();
       }
       value_r.clear();
       return false;
@@ -164,15 +164,15 @@ namespace zypp
       // xpath: /repoindex
       if ( reader_r->name() == "repoindex" )
       {
-       while ( reader_r.nextNodeAttribute() )
-       {
-         const std::string & name( reader_r->localName().asString() );
-         const std::string & value( reader_r->value().asString() );
-         _replacer.setVar( name, value );
-         // xpath: /repoindex@ttl
-         if ( name == "ttl" )
-           _ttl = str::strtonum<Date::Duration>(value);
-       }
+        while ( reader_r.nextNodeAttribute() )
+        {
+          const std::string & name( reader_r->localName().asString() );
+          const std::string & value( reader_r->value().asString() );
+          _replacer.setVar( name, value );
+          // xpath: /repoindex@ttl
+          if ( name == "ttl" )
+            _ttl = str::strtonum<Date::Duration>(value);
+        }
         return true;
       }
 
@@ -182,46 +182,46 @@ namespace zypp
         RepoInfo info;
         // Set some defaults that are not contained in the repo information
         info.setAutorefresh( true );
-       info.setEnabled(false);
+        info.setEnabled(false);
 
-       std::string attrValue;
+        std::string attrValue;
 
-       // required alias
-       // mandatory, so we can allow it in var replacement without reset
-       if ( getAttrValue( "alias", reader_r, attrValue ) )
-       {
-         info.setAlias( attrValue );
-         _replacer.setVar( "alias", attrValue );
-       }
-       else
-         throw ParseException(str::form(_("Required attribute '%s' is missing."), "alias"));
+        // required alias
+        // mandatory, so we can allow it in var replacement without reset
+        if ( getAttrValue( "alias", reader_r, attrValue ) )
+        {
+          info.setAlias( attrValue );
+          _replacer.setVar( "alias", attrValue );
+        }
+        else
+          throw ParseException(str::form(_("Required attribute '%s' is missing."), "alias"));
 
         // required url
-       // SLES HACK: or path, but beware of the hardcoded '/repo' prefix!
-       {
-         std::string urlstr;
-         std::string pathstr;
-         getAttrValue( "url", reader_r, urlstr );
-         getAttrValue( "path", reader_r, pathstr );
-         if ( urlstr.empty() )
-         {
-           if ( pathstr.empty() )
-             throw ParseException(str::form(_("One or both of '%s' or '%s' attributes is required."), "url", "path"));
-           else
-             info.setPath( Pathname("/repo") / pathstr );
-         }
-         else
-         {
-           if ( pathstr.empty() )
-             info.setBaseUrl( Url(urlstr) );
-           else
-           {
-             Url url( urlstr );
-             url.setPathName( Pathname(url.getPathName()) / "repo" / pathstr );
-             info.setBaseUrl( url );
-           }
-         }
-       }
+        // SLES HACK: or path, but beware of the hardcoded '/repo' prefix!
+        {
+          std::string urlstr;
+          std::string pathstr;
+          getAttrValue( "url", reader_r, urlstr );
+          getAttrValue( "path", reader_r, pathstr );
+          if ( urlstr.empty() )
+          {
+            if ( pathstr.empty() )
+              throw ParseException(str::form(_("One or both of '%s' or '%s' attributes is required."), "url", "path"));
+            else
+              info.setPath( Pathname("/repo") / pathstr );
+          }
+          else
+          {
+            if ( pathstr.empty() )
+              info.setBaseUrl( Url(urlstr) );
+            else
+            {
+              Url url( urlstr );
+              url.setPathName( Pathname(url.getPathName()) / "repo" / pathstr );
+              info.setBaseUrl( url );
+            }
+          }
+        }
 
         // optional name
         if ( getAttrValue( "name", reader_r, attrValue ) )
@@ -241,8 +241,8 @@ namespace zypp
           info.setEnabled( str::strToBool( attrValue, info.enabled() ) );
 
         // optional autorefresh
-       if ( getAttrValue( "autorefresh", reader_r, attrValue ) )
-         info.setAutorefresh( str::strToBool( attrValue, info.autorefresh() ) );
+        if ( getAttrValue( "autorefresh", reader_r, attrValue ) )
+          info.setAutorefresh( str::strToBool( attrValue, info.autorefresh() ) );
 
         DBG << info << endl;
 
index af8ee5b..2a54cd9 100644 (file)
@@ -55,7 +55,7 @@ namespace zypp
         MIL << (*its) << endl;
 
         ServiceInfo service(*its);
-       std::map<std::string,std::pair<std::string,ServiceInfo::RepoState>> repoStates; // <repo_NUM,< alias,RepoState >>
+        std::map<std::string,std::pair<std::string,ServiceInfo::RepoState>> repoStates;        // <repo_NUM,< alias,RepoState >>
 
         for ( IniDict::entry_const_iterator it = dict.entriesBegin(*its);
               it != dict.entriesEnd(*its);
@@ -72,10 +72,10 @@ namespace zypp
             service.setAutorefresh( str::strToTrue( it->second ) );
           else if ( it->first == "type" )
             service.setType( repo::ServiceType(it->second) );
-         else if ( it->first == "ttl_sec" )
-           service.setTtl( str::strtonum<Date::Duration>(it->second) );
-         else if ( it->first == "lrf_dat" )
-           service.setLrf( Date( it->second ) );
+          else if ( it->first == "ttl_sec" )
+            service.setTtl( str::strtonum<Date::Duration>(it->second) );
+          else if ( it->first == "lrf_dat" )
+            service.setLrf( Date( it->second ) );
           else if ( it->first == "repostoenable" )
           {
             std::vector<std::string> aliases;
@@ -95,50 +95,50 @@ namespace zypp
             }
           }
           else if ( str::startsWith( it->first, "repo_" ) )
-         {
-           static str::regex rxexpr( "([0-9]+)(_(.*))?" );
-           str::smatch what;
-           if ( str::regex_match( it->first.c_str()+5/*repo_*/, what, rxexpr ) )
-           {
-             std::string tag( what[1] );
-             if (  what.size() > 3 )
-             {
-               // attribute
-               if ( what[3] == "enabled" )
-                 repoStates[tag].second.enabled = str::strToBool( it->second, repoStates[tag].second.enabled );
-               else if ( what[3] == "autorefresh" )
-                 repoStates[tag].second.autorefresh = str::strToBool( it->second, repoStates[tag].second.autorefresh );
-               else if ( what[3] == "priority" )
-                 str::strtonum( it->second, repoStates[tag].second.priority );
-               else
-                 ERR << "Unknown attribute " << it->first << " ignored" << endl;
-             }
-             else
-             {
-               // alias
-               repoStates[tag].first = it->second;
-             }
-           }
-           else
-             ERR << "Unknown attribute " << it->first << " ignored" << endl;
-         }
+          {
+            static str::regex rxexpr( "([0-9]+)(_(.*))?" );
+            str::smatch what;
+            if ( str::regex_match( it->first.c_str()+5/*repo_*/, what, rxexpr ) )
+            {
+              std::string tag( what[1] );
+              if (  what.size() > 3 )
+              {
+                // attribute
+                if ( what[3] == "enabled" )
+                  repoStates[tag].second.enabled = str::strToBool( it->second, repoStates[tag].second.enabled );
+                else if ( what[3] == "autorefresh" )
+                  repoStates[tag].second.autorefresh = str::strToBool( it->second, repoStates[tag].second.autorefresh );
+                else if ( what[3] == "priority" )
+                  str::strtonum( it->second, repoStates[tag].second.priority );
+                else
+                  ERR << "Unknown attribute " << it->first << " ignored" << endl;
+              }
+              else
+              {
+                // alias
+                repoStates[tag].first = it->second;
+              }
+            }
+            else
+              ERR << "Unknown attribute " << it->first << " ignored" << endl;
+          }
           else
             ERR << "Unknown attribute " << it->first << " ignored" << endl;
         }
 
-       if ( ! repoStates.empty() )
-       {
-         ServiceInfo::RepoStates data;
-         for ( const auto & el : repoStates )
-         {
-           if ( el.second.first.empty() )
-             ERR << "Missing alias for repo_" << el.first << "; ignore entry" << endl;
-           else
-             data[el.second.first] = el.second.second;
-         }
-         if ( ! data.empty() )
-           service.setRepoStates( std::move(data) );
-       }
+        if ( ! repoStates.empty() )
+        {
+          ServiceInfo::RepoStates data;
+          for ( const auto & el : repoStates )
+          {
+            if ( el.second.first.empty() )
+              ERR << "Missing alias for repo_" << el.first << "; ignore entry" << endl;
+            else
+              data[el.second.first] = el.second.second;
+          }
+          if ( ! data.empty() )
+            service.setRepoStates( std::move(data) );
+        }
 
         MIL << "Linking ServiceInfo with file " << file << endl;
         service.setFilepath(file);
index d91006c..aa1ee64 100644 (file)
@@ -36,7 +36,7 @@ namespace zypp
      * The \ref _callback is provided on construction.
      *
      * \code
-     * ServiceFileReader reader(service_file, 
+     * ServiceFileReader reader(service_file,
      *                bind( &SomeClass::callbackfunc, &SomeClassInstance, _1 ) );
      * \endcode
      */
@@ -44,7 +44,7 @@ namespace zypp
     {
       friend std::ostream & operator<<( std::ostream & str, const ServiceFileReader & obj );
     public:
-      
+
      /**
       * Callback definition.
       * First parameter is a \ref ServiceInfo object with the resource.
@@ -53,7 +53,7 @@ namespace zypp
       * to be thrown and the processing to be cancelled.
       */
       typedef function< bool( const ServiceInfo & )> ProcessService;
-      
+
       /** Implementation  */
       class Impl;
 
@@ -70,7 +70,7 @@ namespace zypp
       */
       ServiceFileReader( const Pathname & serviceFile,
                       const ProcessService & callback);
-     
+
       /**
        * Dtor
        */
index 53965d2..3204585 100644 (file)
@@ -42,49 +42,49 @@ namespace zypp
       /** ContentFileReader implementation. */
       struct ContentFileReader::Impl
       {
-       public:
-         Impl()
-         {}
+        public:
+          Impl()
+          {}
 
-         RepoIndex & repoindex()
-         {
-           if ( !_repoindex )
-             _repoindex = new RepoIndex;
-           return *_repoindex;
-         }
+          RepoIndex & repoindex()
+          {
+            if ( !_repoindex )
+              _repoindex = new RepoIndex;
+            return *_repoindex;
+          }
 
-         bool hasRepoIndex() const
-         { return _repoindex != nullptr; }
+          bool hasRepoIndex() const
+          { return _repoindex != nullptr; }
 
-         RepoIndex_Ptr handoutRepoIndex()
-         {
-           RepoIndex_Ptr ret;
-           ret.swap( _repoindex );
-           _repoindex = nullptr;
-           return ret;
-         }
+          RepoIndex_Ptr handoutRepoIndex()
+          {
+            RepoIndex_Ptr ret;
+            ret.swap( _repoindex );
+            _repoindex = nullptr;
+            return ret;
+          }
 
-       public:
-         bool setFileCheckSum( std::map<std::string, CheckSum> & map_r, const std::string & value ) const
-         {
-           bool error = false;
-           std::vector<std::string> words;
-           if ( str::split( value, std::back_inserter( words ) ) == 3 )
-           {
-             map_r[words[2]] = CheckSum( words[0], words[1] );
-           }
-           else
-           {
-             error = true;
-           }
-           return error;
-         }
+        public:
+          bool setFileCheckSum( std::map<std::string, CheckSum> & map_r, const std::string & value ) const
+          {
+            bool error = false;
+            std::vector<std::string> words;
+            if ( str::split( value, std::back_inserter( words ) ) == 3 )
+            {
+              map_r[words[2]] = CheckSum( words[0], words[1] );
+            }
+            else
+            {
+              error = true;
+            }
+            return error;
+          }
 
-       public:
-         std::string _inputname;
+        public:
+          std::string _inputname;
 
-       private:
-         RepoIndex_Ptr      _repoindex;
+        private:
+          RepoIndex_Ptr      _repoindex;
       };
       ///////////////////////////////////////////////////////////////////
 
@@ -117,7 +117,7 @@ namespace zypp
       //
       void ContentFileReader::beginParse()
       {
-       _pimpl.reset( new Impl() );
+        _pimpl.reset( new Impl() );
         // actually mandatory, but in case they were forgotten...
         _pimpl->repoindex().descrdir = "suse/setup/descr";
         _pimpl->repoindex().datadir = "suse";
@@ -130,15 +130,15 @@ namespace zypp
       //
       void ContentFileReader::endParse()
       {
-       // consume oldData
-       if ( _pimpl->hasRepoIndex() )
-       {
-         if ( _repoIndexConsumer )
-           _repoIndexConsumer( _pimpl->handoutRepoIndex() );
-       }
+        // consume oldData
+        if ( _pimpl->hasRepoIndex() )
+        {
+          if ( _repoIndexConsumer )
+            _repoIndexConsumer( _pimpl->handoutRepoIndex() );
+        }
 
-       MIL << "[Content]" << endl;
-       _pimpl.reset();
+        MIL << "[Content]" << endl;
+        _pimpl.reset();
       }
 
       ///////////////////////////////////////////////////////////////////
@@ -148,7 +148,7 @@ namespace zypp
       //
       void ContentFileReader::userRequestedAbort( unsigned lineNo_r )
       {
-       ZYPP_THROW( AbortRequestException( errPrefix( lineNo_r ) ) );
+        ZYPP_THROW( AbortRequestException( errPrefix( lineNo_r ) ) );
       }
 
       ///////////////////////////////////////////////////////////////////
@@ -157,14 +157,14 @@ namespace zypp
       //       METHOD TYPE : std::string
       //
       std::string ContentFileReader::errPrefix( unsigned lineNo_r,
-                                               const std::string & msg_r,
-                                               const std::string & line_r ) const
+                                                const std::string & msg_r,
+                                                const std::string & line_r ) const
       {
-       return str::form( "%s:%u:%s | %s",
-                         _pimpl->_inputname.c_str(),
-                         lineNo_r,
-                         line_r.c_str(),
-                         msg_r.c_str() );
+        return str::form( "%s:%u:%s | %s",
+                          _pimpl->_inputname.c_str(),
+                          lineNo_r,
+                          line_r.c_str(),
+                          msg_r.c_str() );
       }
 
       ///////////////////////////////////////////////////////////////////
@@ -173,94 +173,94 @@ namespace zypp
       //       METHOD TYPE : void
       //
       void ContentFileReader::parse( const InputStream & input_r,
-                                    const ProgressData::ReceiverFnc & fnc_r )
+                                     const ProgressData::ReceiverFnc & fnc_r )
       {
-       MIL << "Start parsing content repoindex" << input_r << endl;
-       if ( ! input_r.stream() )
-       {
-         std::ostringstream s;
-         s << "Can't read bad stream: " << input_r;
-         ZYPP_THROW( ParseException( s.str() ) );
-       }
-       beginParse();
-       _pimpl->_inputname = input_r.name();
+        MIL << "Start parsing content repoindex" << input_r << endl;
+        if ( ! input_r.stream() )
+        {
+          std::ostringstream s;
+          s << "Can't read bad stream: " << input_r;
+          ZYPP_THROW( ParseException( s.str() ) );
+        }
+        beginParse();
+        _pimpl->_inputname = input_r.name();
 
-       ProgressData ticks( makeProgressData( input_r ) );
-       ticks.sendTo( fnc_r );
-       if ( ! ticks.toMin() )
-         userRequestedAbort( 0 );
+        ProgressData ticks( makeProgressData( input_r ) );
+        ticks.sendTo( fnc_r );
+        if ( ! ticks.toMin() )
+          userRequestedAbort( 0 );
 
-       iostr::EachLine line( input_r );
-       for( ; line; line.next() )
-       {
-         // strip 1st word from line to separate tag and value.
-         std::string value( *line );
-         std::string key( str::stripFirstWord( value, /*ltrim_first*/true ) );
+        iostr::EachLine line( input_r );
+        for( ; line; line.next() )
+        {
+          // strip 1st word from line to separate tag and value.
+          std::string value( *line );
+          std::string key( str::stripFirstWord( value, /*ltrim_first*/true ) );
 
-         if ( key.empty() || *key.c_str() == '#' ) // empty or comment line
-         {
-           continue;
-         }
+          if ( key.empty() || *key.c_str() == '#' ) // empty or comment line
+          {
+            continue;
+          }
 
-         // strip modifier if exists
-         std::string modifier;
-         std::string::size_type pos = key.rfind( '.' );
-         if ( pos != std::string::npos )
-         {
-           modifier = key.substr( pos+1 );
-           key.erase( pos );
-         }
+          // strip modifier if exists
+          std::string modifier;
+          std::string::size_type pos = key.rfind( '.' );
+          if ( pos != std::string::npos )
+          {
+            modifier = key.substr( pos+1 );
+            key.erase( pos );
+          }
 
-         //
-         // ReppoIndex related data:
-         //
-         else if ( key == "DESCRDIR" )
-         {
-           _pimpl->repoindex().descrdir = value;
-         }
-         else if ( key == "DATADIR" )
-         {
-           _pimpl->repoindex().datadir = value;
-         }
-         else if ( key == "KEY" )
-         {
-           if ( _pimpl->setFileCheckSum( _pimpl->repoindex().signingKeys, value ) )
-           {
-             ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [KEY algorithm checksum filename]", *line ) ) );
-           }
-         }
-         else if ( key == "META" )
-         {
-           if ( _pimpl->setFileCheckSum( _pimpl->repoindex().metaFileChecksums, value ) )
-           {
-             ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [algorithm checksum filename]", *line ) ) );
-           }
-         }
+          //
+          // ReppoIndex related data:
+          //
+          else if ( key == "DESCRDIR" )
+          {
+            _pimpl->repoindex().descrdir = value;
+          }
+          else if ( key == "DATADIR" )
+          {
+            _pimpl->repoindex().datadir = value;
+          }
+          else if ( key == "KEY" )
+          {
+            if ( _pimpl->setFileCheckSum( _pimpl->repoindex().signingKeys, value ) )
+            {
+              ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [KEY algorithm checksum filename]", *line ) ) );
+            }
+          }
+          else if ( key == "META" )
+          {
+            if ( _pimpl->setFileCheckSum( _pimpl->repoindex().metaFileChecksums, value ) )
+            {
+              ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [algorithm checksum filename]", *line ) ) );
+            }
+          }
           else if ( key == "HASH" )
-         {
-           if ( _pimpl->setFileCheckSum( _pimpl->repoindex().mediaFileChecksums, value ) )
-           {
-             ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [algorithm checksum filename]", *line ) ) );
-           }
-         }
+          {
+            if ( _pimpl->setFileCheckSum( _pimpl->repoindex().mediaFileChecksums, value ) )
+            {
+              ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [algorithm checksum filename]", *line ) ) );
+            }
+          }
           else
-         {
+          {
             DBG << errPrefix( line.lineNo(), "ignored", *line ) << endl;
           }
 
 
-         if ( ! ticks.set( input_r.stream().tellg() ) )
-           userRequestedAbort( line.lineNo() );
-       }
+          if ( ! ticks.set( input_r.stream().tellg() ) )
+            userRequestedAbort( line.lineNo() );
+        }
 
-       //
-       // post processing
-       //
-       if ( ! ticks.toMax() )
-         userRequestedAbort( line.lineNo() );
+        //
+        // post processing
+        //
+        if ( ! ticks.toMax() )
+          userRequestedAbort( line.lineNo() );
 
-       endParse();
-       MIL << "Done parsing " << input_r << endl;
+        endParse();
+        MIL << "Done parsing " << input_r << endl;
       }
 
       /////////////////////////////////////////////////////////////////
index 7736f26..45e0d98 100644 (file)
@@ -44,50 +44,50 @@ namespace zypp
       */
       class ContentFileReader : private base::NonCopyable
       {
-       public:
-         typedef function<void(const RepoIndex_Ptr &)> RepoIndexConsumer;
+        public:
+          typedef function<void(const RepoIndex_Ptr &)> RepoIndexConsumer;
 
-       public:
-         /** Default ctor */
-         ContentFileReader();
-         /** Dtor */
-         virtual ~ContentFileReader();
+        public:
+          /** Default ctor */
+          ContentFileReader();
+          /** Dtor */
+          virtual ~ContentFileReader();
           /** Parse the stream.
-          * \throw ParseException on errors.
-          * \throw AbortRequestException on user request.
-          * Invokes \ref consume for each tag. \ref consume might throw
-          * other exceptions as well.
-          */
-         virtual void parse( const InputStream & imput_r,
-                             const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
+           * \throw ParseException on errors.
+           * \throw AbortRequestException on user request.
+           * Invokes \ref consume for each tag. \ref consume might throw
+           * other exceptions as well.
+           */
+          virtual void parse( const InputStream & imput_r,
+                              const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
 
-       public:
-         /** Consumer to call when repo index was parsed. */
-         void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r )
-         { _repoIndexConsumer = fnc_r; }
+        public:
+          /** Consumer to call when repo index was parsed. */
+          void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r )
+          { _repoIndexConsumer = fnc_r; }
 
-       protected:
-         /** Called when start parsing. */
-         virtual void beginParse();
-         /** Called when the parse is done. */
-         virtual void endParse();
+        protected:
+          /** Called when start parsing. */
+          virtual void beginParse();
+          /** Called when the parse is done. */
+          virtual void endParse();
 
-       protected:
+        protected:
           /** Called when user(callback) request to abort.
-          * \throws AbortRequestException unless overloaded.
-          */
-         virtual void userRequestedAbort( unsigned lineNo_r );
+           * \throws AbortRequestException unless overloaded.
+           */
+          virtual void userRequestedAbort( unsigned lineNo_r );
 
-       protected:
-         /** Prefix exception message with line information. */
-         std::string errPrefix( unsigned lineNo_r,
-                                const std::string & msg_r = std::string(),
-                                const std::string & line_r = "-" ) const;
+        protected:
+          /** Prefix exception message with line information. */
+          std::string errPrefix( unsigned lineNo_r,
+                                 const std::string & msg_r = std::string(),
+                                 const std::string & line_r = "-" ) const;
 
-       private:
-         struct Impl;
-         RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
-         RepoIndexConsumer _repoIndexConsumer;
+        private:
+          struct Impl;
+          RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
+          RepoIndexConsumer _repoIndexConsumer;
       };
       ///////////////////////////////////////////////////////////////////
 
index 48ee0f2..220179c 100644 (file)
@@ -48,19 +48,19 @@ namespace zypp
       class RepoIndex : public base::ReferenceCounted, private base::NonCopyable
       {
         friend class ContentFileReader;
-       public:
-         typedef std::map<std::string, CheckSum> FileChecksumMap;
+        public:
+          typedef std::map<std::string, CheckSum> FileChecksumMap;
 
-         Pathname descrdir;
-         Pathname datadir;
+          Pathname descrdir;
+          Pathname datadir;
 
-         FileChecksumMap metaFileChecksums;
+          FileChecksumMap metaFileChecksums;
           FileChecksumMap mediaFileChecksums;
-         FileChecksumMap signingKeys;
+          FileChecksumMap signingKeys;
 
-       protected:
-         /** Overload to realize std::ostream & operator\<\<. */
-         virtual std::ostream & dumpOn( std::ostream & str ) const;
+        protected:
+          /** Overload to realize std::ostream & operator\<\<. */
+          virtual std::ostream & dumpOn( std::ostream & str ) const;
       };
       //////////////////////////////////////////////////////////////////
 
index dc7c81a..674ad0a 100644 (file)
@@ -52,14 +52,14 @@ namespace zypp
       std::list<std::string> structuredErrors;
       void structuredErrorFunc( void * userData, xmlErrorPtr error )
       {
-       if ( error )
-       {
-         // error->message is NL terminated
-         std::string err( str::form( "%s[%d] %s", Pathname::basename(error->file).c_str(), error->line,
-                                     str::stripSuffix( error->message, "\n" ).c_str() ) );
-         structuredErrors.push_back( err );
-         WAR << err << endl;
-       }
+        if ( error )
+        {
+          // error->message is NL terminated
+          std::string err( str::form( "%s[%d] %s", Pathname::basename(error->file).c_str(), error->line,
+                                      str::stripSuffix( error->message, "\n" ).c_str() ) );
+          structuredErrors.push_back( err );
+          WAR << err << endl;
+        }
 #if 0
         if ( error )
         {
@@ -86,12 +86,12 @@ namespace zypp
 
       struct ParseException : public Exception
       {
-       ParseException()
-       : Exception( "Parse error: " + ( structuredErrors.empty() ? std::string("unknown error"): structuredErrors.back() ) )
-       {
-         for_( it, structuredErrors.begin(), --structuredErrors.end() )
-           addHistory( *it );
-       }
+        ParseException()
+        : Exception( "Parse error: " + ( structuredErrors.empty() ? std::string("unknown error"): structuredErrors.back() ) )
+        {
+          for_( it, structuredErrors.begin(), --structuredErrors.end() )
+            addHistory( *it );
+        }
       };
 
       /////////////////////////////////////////////////////////////////
index 176066e..fe4bfdb 100644 (file)
@@ -111,7 +111,7 @@ namespace zypp
       // xpath: /repomd/data (+)
       if ( reader_r->name() == "data" )
       {
-       _typeStr = reader_r->getAttribute("type").asString();
+        _typeStr = reader_r->getAttribute("type").asString();
         return true;
       }
 
@@ -126,14 +126,14 @@ namespace zypp
       // xpath: /repomd/checksum
       if ( reader_r->name() == "checksum" )
       {
-       _location.setChecksum( getChecksum( reader_r ) );
+        _location.setChecksum( getChecksum( reader_r ) );
         return true;
       }
 
       // xpath: /repomd/header-checksum
       if ( reader_r->name() == "header-checksum" )
       {
-       _location.setHeaderChecksum( getChecksum( reader_r ) );
+        _location.setHeaderChecksum( getChecksum( reader_r ) );
         return true;
       }
 
@@ -147,23 +147,23 @@ namespace zypp
       // xpath: /repomd/size
       if ( reader_r->name() == "size" )
       {
-       _location.setDownloadSize( getSize( reader_r ) );
+        _location.setDownloadSize( getSize( reader_r ) );
         return true;
       }
 
       // xpath: /repomd/header-size
       if ( reader_r->name() == "header-size" )
       {
-       _location.setHeaderSize( getSize( reader_r ) );
+        _location.setHeaderSize( getSize( reader_r ) );
         return true;
       }
 
       // xpath: /tags/content
       if ( reader_r->name() == "content" )
       {
-       const auto & tag = reader_r.nodeText();
-       if ( tag.c_str() && *tag.c_str() )
-         _keywords.insert( tag.asString() );   // remember keyword
+        const auto & tag = reader_r.nodeText();
+        if ( tag.c_str() && *tag.c_str() )
+          _keywords.insert( tag.asString() );  // remember keyword
         return true;
       }
     }
@@ -175,9 +175,9 @@ namespace zypp
       {
         if (_callback) {
           _callback( std::move(_location), _typeStr );
-         _location = OnMediaLocation();
-         _typeStr.clear();
-       }
+          _location = OnMediaLocation();
+          _typeStr.clear();
+        }
         return true;
       }
     }
@@ -214,27 +214,27 @@ namespace zypp
       // gpg-pubkey-39db7c82-5847eb1f.asc?fpr=22C07BA534178CD02EFE22AAB88B2FD43DBDC284
       // Fingerprint is explicitely mentioned or id/fpr can be derived from the filename
       if ( tag.compare( 0,10,"gpg-pubkey" ) != 0 )
-       continue;
+        continue;
 
       static const str::regex rx( "^(gpg-pubkey([^?]*))(\\?fpr=([[:xdigit:]]{8,}))?$" );
       str::smatch what;
       if ( str::regex_match( tag.c_str(), what, rx ) ) {
-       std::string keyfile { what[1] };
-       std::string keyident;
-       if ( what.size(4) != std::string::npos ) {      // with fpr=
-         keyident = what[4];
-       }
-       else {
-         static const str::regex rx( /*gpg-pubkey*/"^-([[:xdigit:]]{8,})" );
-         if ( str::regex_match( what[2], what, rx ) ) {
-           keyident = what[1];
-         }
-         else {
-           DBG << "Tag " << tag << " does not contain a keyident. ignore it." << endl;
-           continue;
-         }
-       }
-       ret.push_back( std::make_pair( std::move(keyfile), std::move(keyident) ) );
+        std::string keyfile { what[1] };
+        std::string keyident;
+        if ( what.size(4) != std::string::npos ) {     // with fpr=
+          keyident = what[4];
+        }
+        else {
+          static const str::regex rx( /*gpg-pubkey*/"^-([[:xdigit:]]{8,})" );
+          if ( str::regex_match( what[2], what, rx ) ) {
+            keyident = what[1];
+          }
+          else {
+            DBG << "Tag " << tag << " does not contain a keyident. ignore it." << endl;
+            continue;
+          }
+        }
+        ret.push_back( std::make_pair( std::move(keyfile), std::move(keyident) ) );
       }
     }
     return ret;
index 9d52827..ee0f1b7 100644 (file)
@@ -43,7 +43,7 @@ namespace zypp
 
    /**
     * CTOR. Creates also \ref xml::Reader and starts reading.
-    * 
+    *
     * \param repomd_file is the repomd.xml file you want to read
     * \param callback is a function.
     *
index 1116ef4..081e962 100644 (file)
@@ -126,13 +126,13 @@ namespace zypp
 
       if ( ! _pseudoItems.empty() )
       {
-       for ( sat::Queue::size_type i = 0; i < _pseudoItems.size(); ++i )
-       {
-         PoolItem pi { sat::Solvable(_pseudoItems[i]) };
-         ResStatus::ValidateValue vorig { validateValue( i ) };
-         if ( pi.status().validate() != vorig )
-           ret[pi] = vorig;
-       }
+        for ( sat::Queue::size_type i = 0; i < _pseudoItems.size(); ++i )
+        {
+          PoolItem pi { sat::Solvable(_pseudoItems[i]) };
+          ResStatus::ValidateValue vorig { validateValue( i ) };
+          if ( pi.status().validate() != vorig )
+            ret[pi] = vorig;
+        }
       }
       return ret;
     }
@@ -143,9 +143,9 @@ namespace zypp
       ResStatus::ValidateValue ret { ResStatus::UNDETERMINED };
       switch ( _pseudoFlags[i] )
       {
-       case  0: ret = ResStatus::BROKEN      /*2*/; break;
-       case  1: ret = ResStatus::SATISFIED   /*4*/; break;
-       case -1: ret = ResStatus::NONRELEVANT /*6*/; break;
+        case  0: ret = ResStatus::BROKEN      /*2*/; break;
+        case  1: ret = ResStatus::SATISFIED   /*4*/; break;
+        case -1: ret = ResStatus::NONRELEVANT /*6*/; break;
       }
       return ret;
     }
@@ -173,13 +173,13 @@ namespace zypp
         typedef PoolTraits::ItemContainerT             ContainerT;
         typedef PoolTraits::size_type                  size_type;
         typedef PoolTraits::const_iterator             const_iterator;
-       typedef PoolTraits::Id2ItemT                    Id2ItemT;
+        typedef PoolTraits::Id2ItemT                   Id2ItemT;
 
         typedef PoolTraits::repository_iterator                repository_iterator;
 
         typedef sat::detail::SolvableIdType            SolvableIdType;
 
-       typedef ResPool::EstablishedStates::Impl        EstablishedStatesImpl;
+        typedef ResPool::EstablishedStates::Impl       EstablishedStatesImpl;
 
       public:
         /** Default ctor */
@@ -252,10 +252,10 @@ namespace zypp
         }
 
         /** True factory for \ref ResPool::EstablishedStates.
-        * Internally we maintain the ResPool::EstablishedStates::Impl
-        * reference shared_ptr. Updated whenever the pool content changes.
-        * On demand hand it out as ResPool::EstablishedStates Impl.
-        */
+         * Internally we maintain the ResPool::EstablishedStates::Impl
+         * reference shared_ptr. Updated whenever the pool content changes.
+         * On demand hand it out as ResPool::EstablishedStates Impl.
+         */
         ResPool::EstablishedStates establishedStates() const
         { store(); return ResPool::EstablishedStates( _establishedStates ); }
 
@@ -367,10 +367,10 @@ namespace zypp
           {
             sat::Pool pool( satpool() );
             bool addedItems = false;
-           bool reusedIDs = _watcherIDs.remember( pool.serialIDs() );
+            bool reusedIDs = _watcherIDs.remember( pool.serialIDs() );
             std::list<PoolItem> addedProducts;
 
-           _store.resize( pool.capacity() );
+            _store.resize( pool.capacity() );
 
             if ( pool.capacity() )
             {
@@ -414,20 +414,20 @@ namespace zypp
               reapplyHardLocks();
             }
 
-           // Compute the initial status of Patches etc.
+            // Compute the initial status of Patches etc.
             if ( !_establishedStates )
-             _establishedStates.reset( new EstablishedStatesImpl );
+              _establishedStates.reset( new EstablishedStatesImpl );
           }
           return _store;
         }
 
-       const Id2ItemT & id2item () const
-       {
-         checkSerial();
-         if ( _id2itemDirty )
-         {
-           store();
-           _id2item = Id2ItemT( size() );
+        const Id2ItemT & id2item () const
+        {
+          checkSerial();
+          if ( _id2itemDirty )
+          {
+            store();
+            _id2item = Id2ItemT( size() );
             for_( it, begin(), end() )
             {
               const sat::Solvable &s = (*it)->satSolvable();
@@ -437,10 +437,10 @@ namespace zypp
               _id2item.insert( std::make_pair( id, *it ) );
             }
             //INT << _id2item << endl;
-           _id2itemDirty = false;
+            _id2itemDirty = false;
           }
-         return _id2item;
-       }
+          return _id2item;
+        }
 
         ///////////////////////////////////////////////////////////////////
         //
@@ -456,25 +456,25 @@ namespace zypp
         void invalidate() const
         {
           _storeDirty = true;
-         _id2itemDirty = true;
-         _id2item.clear();
+          _id2itemDirty = true;
+          _id2item.clear();
           _poolProxy.reset();
-         _establishedStates.reset();
+          _establishedStates.reset();
         }
 
       private:
         /** Watch sat pools serial number. */
         SerialNumberWatcher                   _watcher;
-       /** Watch sat pools Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also invalidate it's PoolItems! */
+        /** Watch sat pools Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also invalidate it's PoolItems! */
         SerialNumberWatcher                   _watcherIDs;
         mutable ContainerT                    _store;
         mutable DefaultIntegral<bool,true>    _storeDirty;
-       mutable Id2ItemT                      _id2item;
+        mutable Id2ItemT                     _id2item;
         mutable DefaultIntegral<bool,true>    _id2itemDirty;
 
       private:
         mutable shared_ptr<ResPoolProxy>      _poolProxy;
-       mutable shared_ptr<EstablishedStatesImpl> _establishedStates;
+        mutable shared_ptr<EstablishedStatesImpl> _establishedStates;
 
       private:
         /** Set of queries that define hardlocks. */
index 66f5746..9a69e4f 100644 (file)
@@ -71,7 +71,7 @@ namespace zypp
       typedef std::vector<PoolItem>                    ItemContainerT;
       typedef ItemContainerT::const_iterator            item_iterator;
       typedef filter_iterator<ByPoolItem,ItemContainerT::const_iterator>
-                                                       const_iterator;
+                                                        const_iterator;
       typedef ItemContainerT::size_type                        size_type;
 
       /** ident index */
index 8d41d24..1449d8f 100644 (file)
@@ -45,7 +45,7 @@ namespace repo
     void operator()( const Pathname & file_r ) const
     {
       if ( _preCheckCB )
-       _preCheckCB( file_r );
+        _preCheckCB( file_r );
       SignatureFileChecker::operator()( file_r );
     }
 
@@ -67,39 +67,39 @@ namespace repo
       const std::string & keyid { p.second };
 
       if ( keyRing->trustedPublicKeyData( keyid ) ) {
-       DBG << "Keyhint is already trusted: " << keyid << " (" << file << ")" << endl;
-       continue;       // already a trusted key
+        DBG << "Keyhint is already trusted: " << keyid << " (" << file << ")" << endl;
+        continue;      // already a trusted key
       }
 
       DBG << "Keyhint search key " << keyid << " (" << file << ")" << endl;
       PublicKeyData keyData = keyRing->publicKeyData( keyid );
       if ( not keyData ) {
-       // try to get it from cache or download it...
+        // try to get it from cache or download it...
 
-       // TODO: Enhance the key caching in general...
-       const ZConfig & conf = ZConfig::instance();
-       Pathname cacheFile = conf.repoManagerRoot() / conf.pubkeyCachePath() / file;
+        // TODO: Enhance the key caching in general...
+        const ZConfig & conf = ZConfig::instance();
+        Pathname cacheFile = conf.repoManagerRoot() / conf.pubkeyCachePath() / file;
 
-       PublicKey key { PublicKey::noThrow( cacheFile ) };
-       if ( not key.fileProvidesKey( keyid ) ) {
+        PublicKey key { PublicKey::noThrow( cacheFile ) };
+        if ( not key.fileProvidesKey( keyid ) ) {
 
-         key = PublicKey::noThrow( media_r.provideOptionalFile( file ) );
-         if ( not key.fileProvidesKey( keyid ) ) {
+          key = PublicKey::noThrow( media_r.provideOptionalFile( file ) );
+          if ( not key.fileProvidesKey( keyid ) ) {
 
-           WAR << "Keyhint " << file << " does not contain a key with id " << keyid << ". Skipping it." << endl;
-           continue;
-         }
-         // Try to cache it...
-         filesystem::hardlinkCopy( key.path(), cacheFile );
-       }
+            WAR << "Keyhint " << file << " does not contain a key with id " << keyid << ". Skipping it." << endl;
+            continue;
+          }
+          // Try to cache it...
+          filesystem::hardlinkCopy( key.path(), cacheFile );
+        }
 
-       keyRing->importKey( key, false );               // store in general keyring (not trusted!)
-       keyData = keyRing->publicKeyData( keyid );      // fetch back from keyring in case it was a hidden key
+        keyRing->importKey( key, false );              // store in general keyring (not trusted!)
+        keyData = keyRing->publicKeyData( keyid );     // fetch back from keyring in case it was a hidden key
       }
 
       if ( not PublicKey::isSafeKeyId( keyid ) ) {
-       WAR << "Keyhint " << keyid << " for " << keyData << " is not strong enough for auto import. Just caching it." << endl;
-       continue;
+        WAR << "Keyhint " << keyid << " for " << keyData << " is not strong enough for auto import. Just caching it." << endl;
+        continue;
       }
 
       DBG << "Keyhint remember buddy " << keyData << endl;
@@ -162,11 +162,11 @@ void Downloader::defaultDownloadMasterIndex( MediaSetAccess & media_r, const Pat
     {
       // only add the signature if it exists
       if ( isSigned )
-       sigchecker.signature( destdir_r / sigpath );
+        sigchecker.signature( destdir_r / sigpath );
 
       // only add the key if it exists
       if ( PathInfo(destdir_r / keypath).isExist() )
-       sigchecker.addPublicKey( destdir_r / keypath );
+        sigchecker.addPublicKey( destdir_r / keypath );
 
       // set the checker context even if the key is not known
       // (unsigned repo, key file missing; bnc #495977)
@@ -174,18 +174,18 @@ void Downloader::defaultDownloadMasterIndex( MediaSetAccess & media_r, const Pat
 
       // bsc#1184326: Check and handle extra gpg keys delivered with trusted signed master index.
       if ( masterIndex_r.basename() == "repomd.xml" ) {
-       sigchecker.preCheckCB( [&]( const Pathname & file_r )->void {
-         // Take care no exception escapes! Main job is the signature verification.
-         try {
-           checkExtraKeysInRepomd( media_r, destdir_r, file_r, sigchecker );
-         }
-         catch ( const Exception & exp )
-         { ZYPP_CAUGHT(exp); }
-         catch ( const std::exception & exp )
-         { ZYPP_CAUGHT(exp); }
-         catch (...)
-         { INT << "Oops!" << endl; }
-       });
+        sigchecker.preCheckCB( [&]( const Pathname & file_r )->void {
+          // Take care no exception escapes! Main job is the signature verification.
+          try {
+            checkExtraKeysInRepomd( media_r, destdir_r, file_r, sigchecker );
+          }
+          catch ( const Exception & exp )
+          { ZYPP_CAUGHT(exp); }
+          catch ( const std::exception & exp )
+          { ZYPP_CAUGHT(exp); }
+          catch (...)
+          { INT << "Oops!" << endl; }
+        });
       }
       checker = FileChecker( ref(sigchecker) );        // ref() to the local sigchecker is important as we want back fileValidated!
     }
index ebd34a1..02e90be 100644 (file)
@@ -58,8 +58,8 @@ namespace zypp
       const RepoInfo & repoInfo() const { return _repoinfo; }
 
       protected:
-       /** Common workflow downloading a (signed) master index file */
-       void defaultDownloadMasterIndex( MediaSetAccess & media_r, const Pathname & destdir_r, const Pathname & masterIndex_r );
+        /** Common workflow downloading a (signed) master index file */
+        void defaultDownloadMasterIndex( MediaSetAccess & media_r, const Pathname & destdir_r, const Pathname & masterIndex_r );
 
       private:
         RepoInfo _repoinfo;
index 76ceb0a..134da07 100644 (file)
@@ -35,7 +35,7 @@ void downloadMediaInfo( const Pathname &dest_dir,
   fetcher.reset();
 }
 
-}// ns repo 
+}// ns repo
 } // ns zypp
 
 
index 72de855..c67b8b6 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
 {
   namespace repo
   {
-   
+
     /**
      * \short Downloads the media info (/media.1) to a local directory
      * \param dest_dir Destination directory
index e06d5f3..4aebffd 100644 (file)
@@ -109,7 +109,7 @@ namespace zypp
     public:
       /** Ctor taking the Package to provide. */
       PackageProviderImpl( RepoMediaAccess & access_r, const TPackagePtr & package_r,
-                          const PackageProviderPolicy & policy_r )
+                           const PackageProviderPolicy & policy_r )
       : _policy( policy_r )
       , _package( package_r )
       , _access( access_r )
@@ -128,10 +128,10 @@ namespace zypp
       /** Provide the package if it is cached. */
       virtual ManagedFile providePackageFromCache() const
       {
-       ManagedFile ret( doProvidePackageFromCache() );
-       if ( ! ( ret->empty() ||  _package->repoInfo().keepPackages() ) )
-         ret.setDispose( filesystem::unlink );
-       return ret;
+        ManagedFile ret( doProvidePackageFromCache() );
+        if ( ! ( ret->empty() ||  _package->repoInfo().keepPackages() ) )
+          ret.setDispose( filesystem::unlink );
+        return ret;
       }
 
       /** Whether the package is cached. */
@@ -168,13 +168,13 @@ namespace zypp
        */
       virtual ManagedFile doProvidePackage() const
       {
-       ManagedFile ret;
-       OnMediaLocation loc = _package->location();
+        ManagedFile ret;
+        OnMediaLocation loc = _package->location();
 
-       ProvideFilePolicy policy;
-       policy.progressCB( bind( &Base::progressPackageDownload, this, _1 ) );
-       policy.fileChecker( bind( &Base::rpmSigFileChecker, this, _1 ) );
-       return _access.provideFile( _package->repoInfo(), loc, policy );
+        ProvideFilePolicy policy;
+        policy.progressCB( bind( &Base::progressPackageDownload, this, _1 ) );
+        policy.fileChecker( bind( &Base::rpmSigFileChecker, this, _1 ) );
+        return _access.provideFile( _package->repoInfo(), loc, policy );
       }
 
     protected:
@@ -203,18 +203,18 @@ namespace zypp
       //@{
       void rpmSigFileChecker( const Pathname & file_r ) const
       {
-       RepoInfo info = _package->repoInfo();
-       if ( info.pkgGpgCheck() )
-       {
-         UserData userData( "pkgGpgCheck" );
-         ResObject::constPtr roptr( _package );        // gcc6 needs it more explcit. Has problem deducing
-         userData.set( "ResObject", roptr );           // a type for '_package->asKind<ResObject>()'...
-         /*legacy:*/userData.set( "Package", roptr->asKind<Package>() );
-         userData.set( "Localpath", file_r );
-
-         RpmDb::CheckPackageResult res = RpmDb::CHK_NOKEY;
-         while ( res == RpmDb::CHK_NOKEY ) {
-           res = packageSigCheck( file_r, info.pkgGpgCheckIsMandatory(), userData );
+        RepoInfo info = _package->repoInfo();
+        if ( info.pkgGpgCheck() )
+        {
+          UserData userData( "pkgGpgCheck" );
+          ResObject::constPtr roptr( _package );       // gcc6 needs it more explcit. Has problem deducing
+          userData.set( "ResObject", roptr );          // a type for '_package->asKind<ResObject>()'...
+          /*legacy:*/userData.set( "Package", roptr->asKind<Package>() );
+          userData.set( "Localpath", file_r );
+
+          RpmDb::CheckPackageResult res = RpmDb::CHK_NOKEY;
+          while ( res == RpmDb::CHK_NOKEY ) {
+            res = packageSigCheck( file_r, info.pkgGpgCheckIsMandatory(), userData );
 
             // publish the checkresult, even if it is OK. Apps may want to report something...
             report()->pkgGpgCheck( userData );
@@ -246,37 +246,37 @@ namespace zypp
             }
           }
 
-         if ( res != RpmDb::CHK_OK )
-         {
-           if ( userData.hasvalue( "Action" ) )        // pkgGpgCheck report provided an user error action
-           {
-             resolveSignatureErrorAction( userData.get( "Action", repo::DownloadResolvableReport::ABORT ) );
-           }
-           else if ( userData.haskey( "Action" ) )     // pkgGpgCheck requests the default problem report (wo. details)
-           {
-             defaultReportSignatureError( res );
-           }
-           else                                        // no advice from user => usedefaults
-           {
-             switch ( res )
-             {
-               case RpmDb::CHK_OK:             // Signature is OK
-                 break;
-
-               case RpmDb::CHK_NOKEY:          // Public key is unavailable
-               case RpmDb::CHK_NOTFOUND:       // Signature is unknown type
-               case RpmDb::CHK_FAIL:           // Signature does not verify
-               case RpmDb::CHK_NOTTRUSTED:     // Signature is OK, but key is not trusted
-               case RpmDb::CHK_ERROR:          // File does not exist or can't be opened
-               case RpmDb::CHK_NOSIG:          // File is unsigned
-               default:
-                 // report problem (w. details), throw if to abort, else retry/ignore
-                 defaultReportSignatureError( res, str::Str() << userData.get<RpmDb::CheckPackageDetail>( "CheckPackageDetail" ) );
-                 break;
-             }
-           }
-         }
-       }
+          if ( res != RpmDb::CHK_OK )
+          {
+            if ( userData.hasvalue( "Action" ) )       // pkgGpgCheck report provided an user error action
+            {
+              resolveSignatureErrorAction( userData.get( "Action", repo::DownloadResolvableReport::ABORT ) );
+            }
+            else if ( userData.haskey( "Action" ) )    // pkgGpgCheck requests the default problem report (wo. details)
+            {
+              defaultReportSignatureError( res );
+            }
+            else                                       // no advice from user => usedefaults
+            {
+              switch ( res )
+              {
+                case RpmDb::CHK_OK:            // Signature is OK
+                  break;
+
+                case RpmDb::CHK_NOKEY:         // Public key is unavailable
+                case RpmDb::CHK_NOTFOUND:      // Signature is unknown type
+                case RpmDb::CHK_FAIL:          // Signature does not verify
+                case RpmDb::CHK_NOTTRUSTED:    // Signature is OK, but key is not trusted
+                case RpmDb::CHK_ERROR:         // File does not exist or can't be opened
+                case RpmDb::CHK_NOSIG:         // File is unsigned
+                default:
+                  // report problem (w. details), throw if to abort, else retry/ignore
+                  defaultReportSignatureError( res, str::Str() << userData.get<RpmDb::CheckPackageDetail>( "CheckPackageDetail" ) );
+                  break;
+              }
+            }
+          }
+        }
       }
 
       typedef target::rpm::RpmDb RpmDb;
@@ -284,26 +284,26 @@ namespace zypp
       /** Actual rpm package signature check. */
       RpmDb::CheckPackageResult packageSigCheck( const Pathname & path_r, bool isMandatory_r, UserData & userData ) const
       {
-       if ( !_target )
-         _target = getZYpp()->getTarget();
-
-       RpmDb::CheckPackageResult ret = RpmDb::CHK_ERROR;
-       RpmDb::CheckPackageDetail detail;
-       if ( _target )
-       {
-         ret = _target->rpmDb().checkPackageSignature( path_r, detail );
-         if ( ret == RpmDb::CHK_NOSIG && !isMandatory_r )
-         {
-           WAR << "Relax CHK_NOSIG: Config says unsigned packages are OK" << endl;
-           ret = RpmDb::CHK_OK;
-         }
-       }
-       else
-         detail.push_back( RpmDb::CheckPackageDetail::value_type( ret, "OOps. Target is not initialized!" ) );
-
-       userData.set( "CheckPackageResult", ret );
-       userData.set( "CheckPackageDetail", std::move(detail) );
-       return ret;
+        if ( !_target )
+          _target = getZYpp()->getTarget();
+
+        RpmDb::CheckPackageResult ret = RpmDb::CHK_ERROR;
+        RpmDb::CheckPackageDetail detail;
+        if ( _target )
+        {
+          ret = _target->rpmDb().checkPackageSignature( path_r, detail );
+          if ( ret == RpmDb::CHK_NOSIG && !isMandatory_r )
+          {
+            WAR << "Relax CHK_NOSIG: Config says unsigned packages are OK" << endl;
+            ret = RpmDb::CHK_OK;
+          }
+        }
+        else
+          detail.push_back( RpmDb::CheckPackageDetail::value_type( ret, "OOps. Target is not initialized!" ) );
+
+        userData.set( "CheckPackageResult", ret );
+        userData.set( "CheckPackageDetail", std::move(detail) );
+        return ret;
       }
 
       /** React on signature verification error user action.
@@ -311,27 +311,27 @@ namespace zypp
        */
       void resolveSignatureErrorAction( repo::DownloadResolvableReport::Action action_r ) const
       {
-       switch ( action_r )
-       {
-         case repo::DownloadResolvableReport::IGNORE:
-           WAR << _package->asUserString() << ": " << "User requested to accept insecure file" << endl;
-           break;
-         default:
-         case repo::DownloadResolvableReport::RETRY:
-         case repo::DownloadResolvableReport::ABORT:
-           ZYPP_THROW(RpmSigCheckException(action_r,"Signature verification failed"));
-           break;
-       }
+        switch ( action_r )
+        {
+          case repo::DownloadResolvableReport::IGNORE:
+            WAR << _package->asUserString() << ": " << "User requested to accept insecure file" << endl;
+            break;
+          default:
+          case repo::DownloadResolvableReport::RETRY:
+          case repo::DownloadResolvableReport::ABORT:
+            ZYPP_THROW(RpmSigCheckException(action_r,"Signature verification failed"));
+            break;
+        }
       }
 
       /** Default signature verification error handling. */
       void defaultReportSignatureError( RpmDb::CheckPackageResult ret, const std::string & detail_r = std::string() ) const
       {
-       str::Str msg;
-       msg << _package->asUserString() << ": " << _("Signature verification failed") << " " << ret;
-       if ( ! detail_r.empty() )
-         msg << "\n" << detail_r;
-       resolveSignatureErrorAction( report()->problem( _package, repo::DownloadResolvableReport::INVALID, msg.str() ) );
+        str::Str msg;
+        msg << _package->asUserString() << ": " << _("Signature verification failed") << " " << ret;
+        if ( ! detail_r.empty() )
+          msg << "\n" << detail_r;
+        resolveSignatureErrorAction( report()->problem( _package, repo::DownloadResolvableReport::INVALID, msg.str() ) );
       }
       //@}
 
@@ -345,13 +345,13 @@ namespace zypp
 
       ScopedGuard newReport() const
       {
-       _report.reset( new Report );
-       // Use a custom deleter calling _report.reset() when guard goes out of
-       // scope (cast required as reset is overloaded). We want report to end
-       // when leaving providePackage and not wait for *this going out of scope.
-       return shared_ptr<void>( static_cast<void*>(0),
-                                bind( mem_fun_ref( static_cast<void (shared_ptr<Report>::*)()>(&shared_ptr<Report>::reset) ),
-                                      ref(_report) ) );
+        _report.reset( new Report );
+        // Use a custom deleter calling _report.reset() when guard goes out of
+        // scope (cast required as reset is overloaded). We want report to end
+        // when leaving providePackage and not wait for *this going out of scope.
+        return shared_ptr<void>( static_cast<void*>(0),
+                                 bind( mem_fun_ref( static_cast<void (shared_ptr<Report>::*)()>(&shared_ptr<Report>::reset) ),
+                                       ref(_report) ) );
       }
 
       mutable bool               _retry;
@@ -369,9 +369,9 @@ namespace zypp
       ManagedFile ret( providePackageFromCache() );
       if ( ! ret->empty() )
       {
-       MIL << "provided Package from cache " << _package << " at " << ret << endl;
-       report()->infoInCache( _package, ret );
-       return ret; // <-- cache hit
+        MIL << "provided Package from cache " << _package << " at " << ret << endl;
+        report()->infoInCache( _package, ret );
+        return ret; // <-- cache hit
       }
 
       // HERE: cache misss, check toplevel cache or do download:
@@ -379,30 +379,30 @@ namespace zypp
 
       // Check toplevel cache
       {
-       RepoManagerOptions topCache;
-       if ( info.packagesPath().dirname() != topCache.repoPackagesCachePath )  // not using toplevel cache
-       {
-         const OnMediaLocation & loc( _package->location() );
-         if ( ! loc.checksum().empty() )       // no cache hit without checksum
-         {
-           PathInfo pi( topCache.repoPackagesCachePath / info.packagesPath().basename() / info.path() / loc.filename() );
-           if ( pi.isExist() && loc.checksum() == CheckSum( loc.checksum().type(), std::ifstream( pi.c_str() ) ) )
-           {
-             report()->start( _package, pi.path().asFileUrl() );
-             const Pathname & dest( info.packagesPath() / info.path() / loc.filename() );
-             if ( filesystem::assert_dir( dest.dirname() ) == 0 && filesystem::hardlinkCopy( pi.path(), dest ) == 0 )
-             {
-               ret = ManagedFile( dest );
-               if ( ! info.keepPackages() )
-                 ret.setDispose( filesystem::unlink );
-
-               MIL << "provided Package from toplevel cache " << _package << " at " << ret << endl;
-               report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
-               return ret; // <-- toplevel cache hit
-             }
-           }
-         }
-       }
+        RepoManagerOptions topCache;
+        if ( info.packagesPath().dirname() != topCache.repoPackagesCachePath ) // not using toplevel cache
+        {
+          const OnMediaLocation & loc( _package->location() );
+          if ( ! loc.checksum().empty() )      // no cache hit without checksum
+          {
+            PathInfo pi( topCache.repoPackagesCachePath / info.packagesPath().basename() / info.path() / loc.filename() );
+            if ( pi.isExist() && loc.checksum() == CheckSum( loc.checksum().type(), std::ifstream( pi.c_str() ) ) )
+            {
+              report()->start( _package, pi.path().asFileUrl() );
+              const Pathname & dest( info.packagesPath() / info.path() / loc.filename() );
+              if ( filesystem::assert_dir( dest.dirname() ) == 0 && filesystem::hardlinkCopy( pi.path(), dest ) == 0 )
+              {
+                ret = ManagedFile( dest );
+                if ( ! info.keepPackages() )
+                  ret.setDispose( filesystem::unlink );
+
+                MIL << "provided Package from toplevel cache " << _package << " at " << ret << endl;
+                report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
+                return ret; // <-- toplevel cache hit
+              }
+            }
+          }
+        }
       }
 
       // FIXME we only support the first url for now.
@@ -414,11 +414,11 @@ namespace zypp
       try {
       do {
         _retry = false;
-       if ( ! ret->empty() )
-       {
-         ret.setDispose( filesystem::unlink );
-         ret.reset();
-       }
+        if ( ! ret->empty() )
+        {
+          ret.setDispose( filesystem::unlink );
+          ret.reset();
+        }
         report()->start( _package, url );
         try
           {
@@ -427,58 +427,58 @@ namespace zypp
         catch ( const UserRequestException & excpt )
           {
             ERR << "Failed to provide Package " << _package << endl;
-           if ( ! _retry )
-             ZYPP_RETHROW( excpt );
+            if ( ! _retry )
+              ZYPP_RETHROW( excpt );
+          }
+        catch ( const RpmSigCheckException & excpt )
+          {
+            ERR << "Failed to provide Package " << _package << endl;
+            if ( ! _retry )
+            {
+              // Signature verification error was already reported by the
+              // rpmSigFileChecker. Just handle the users action decision:
+              switch ( excpt.action() )
+              {
+                case repo::DownloadResolvableReport::RETRY:
+                  _retry = true;
+                  break;
+                case repo::DownloadResolvableReport::IGNORE:
+                  ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
+                  break;
+                default:
+                case repo::DownloadResolvableReport::ABORT:
+                  ZYPP_THROW(AbortRequestException("User requested to abort"));
+                  break;
+              }
+            }
           }
-       catch ( const RpmSigCheckException & excpt )
-         {
-           ERR << "Failed to provide Package " << _package << endl;
-           if ( ! _retry )
-           {
-             // Signature verification error was already reported by the
-             // rpmSigFileChecker. Just handle the users action decision:
-             switch ( excpt.action() )
-             {
-               case repo::DownloadResolvableReport::RETRY:
-                 _retry = true;
-                 break;
-               case repo::DownloadResolvableReport::IGNORE:
-                 ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
-                 break;
-               default:
-               case repo::DownloadResolvableReport::ABORT:
-                 ZYPP_THROW(AbortRequestException("User requested to abort"));
-                 break;
-             }
-           }
-         }
         catch ( const FileCheckException & excpt )
           {
-           ERR << "Failed to provide Package " << _package << endl;
-           if ( ! _retry )
-           {
-             const std::string & package_str = _package->asUserString();
-             // TranslatorExplanation %s = package being checked for integrity
-             switch ( report()->problem( _package, repo::DownloadResolvableReport::INVALID, str::form(_("Package %s seems to be corrupted during transfer. Do you want to retry retrieval?"), package_str.c_str() ) ) )
-             {
-               case repo::DownloadResolvableReport::RETRY:
-                 _retry = true;
-                 break;
-               case repo::DownloadResolvableReport::IGNORE:
-                 ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
-                 break;
-               default:
-               case repo::DownloadResolvableReport::ABORT:
-                 ZYPP_THROW(AbortRequestException("User requested to abort"));
-                 break;
-             }
-           }
-         }
+            ERR << "Failed to provide Package " << _package << endl;
+            if ( ! _retry )
+            {
+              const std::string & package_str = _package->asUserString();
+              // TranslatorExplanation %s = package being checked for integrity
+              switch ( report()->problem( _package, repo::DownloadResolvableReport::INVALID, str::form(_("Package %s seems to be corrupted during transfer. Do you want to retry retrieval?"), package_str.c_str() ) ) )
+              {
+                case repo::DownloadResolvableReport::RETRY:
+                  _retry = true;
+                  break;
+                case repo::DownloadResolvableReport::IGNORE:
+                  ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
+                  break;
+                default:
+                case repo::DownloadResolvableReport::ABORT:
+                  ZYPP_THROW(AbortRequestException("User requested to abort"));
+                  break;
+              }
+            }
+          }
         catch ( const Exception & excpt )
           {
             ERR << "Failed to provide Package " << _package << endl;
             if ( ! _retry )
-           {
+            {
                 // Aything else gets reported
                 const std::string & package_str = _package->asUserString();
 
@@ -503,10 +503,10 @@ namespace zypp
           }
       } while ( _retry );
       } catch(...){
-       // bsc#1045735: Be sure no invalid files stay in the cache!
-       if ( ! ret->empty() )
-         ret.setDispose( filesystem::unlink );
-       throw;
+        // bsc#1045735: Be sure no invalid files stay in the cache!
+        if ( ! ret->empty() )
+          ret.setDispose( filesystem::unlink );
+        throw;
       }
 
       report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
@@ -523,9 +523,9 @@ namespace zypp
     {
     public:
       RpmPackageProvider( RepoMediaAccess & access_r,
-                         const Package::constPtr & package_r,
-                         const DeltaCandidates & deltas_r,
-                         const PackageProviderPolicy & policy_r )
+                          const Package::constPtr & package_r,
+                          const DeltaCandidates & deltas_r,
+                          const PackageProviderPolicy & policy_r )
       : PackageProviderImpl<Package>( access_r, package_r, policy_r )
       , _deltas( deltas_r )
       {}
@@ -557,21 +557,21 @@ namespace zypp
       // check whether to process patch/delta rpms
       // FIXME we only check the first url for now.
       if ( ZConfig::instance().download_use_deltarpm()
-       && ( _package->repoInfo().url().schemeIsDownloading() || ZConfig::instance().download_use_deltarpm_always() ) )
+        && ( _package->repoInfo().url().schemeIsDownloading() || ZConfig::instance().download_use_deltarpm_always() ) )
       {
-       std::list<DeltaRpm> deltaRpms;
-       _deltas.deltaRpms( _package ).swap( deltaRpms );
-
-       if ( ! deltaRpms.empty() && queryInstalled() && applydeltarpm::haveApplydeltarpm() )
-       {
-         for_( it, deltaRpms.begin(), deltaRpms.end())
-         {
-           DBG << "tryDelta " << *it << endl;
-           ManagedFile ret( tryDelta( *it ) );
-           if ( ! ret->empty() )
-             return ret;
-         }
-       }
+        std::list<DeltaRpm> deltaRpms;
+        _deltas.deltaRpms( _package ).swap( deltaRpms );
+
+        if ( ! deltaRpms.empty() && queryInstalled() && applydeltarpm::haveApplydeltarpm() )
+        {
+          for_( it, deltaRpms.begin(), deltaRpms.end())
+          {
+            DBG << "tryDelta " << *it << endl;
+            ManagedFile ret( tryDelta( *it ) );
+            if ( ! ret->empty() )
+              return ret;
+          }
+        }
       }
 
       // no patch/delta -> provide full package
@@ -629,7 +629,7 @@ namespace zypp
       // full rpm. It won't be different. So let the exceptions escape...
       rpmSigFileChecker( builddest );
       if ( filesystem::hardlinkCopy( builddest, cachedest ) != 0 )
-       ZYPP_THROW( Exception( str::Str() << "Can't hardlink/copy " << builddest << " to " << cachedest ) );
+        ZYPP_THROW( Exception( str::Str() << "Can't hardlink/copy " << builddest << " to " << cachedest ) );
 
       return ManagedFile( cachedest, filesystem::unlink );
     }
@@ -640,52 +640,52 @@ namespace zypp
     namespace factory
     {
       inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const PoolItem & pi_r,
-                                          const DeltaCandidates & deltas_r,
-                                          const PackageProviderPolicy & policy_r )
+                                           const DeltaCandidates & deltas_r,
+                                           const PackageProviderPolicy & policy_r )
       {
-       if ( pi_r.isKind<Package>() )
-         return new RpmPackageProvider( access_r, pi_r->asKind<Package>(), deltas_r, policy_r );
-       else if ( pi_r.isKind<SrcPackage>() )
-         return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
-       else
-         ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
+        if ( pi_r.isKind<Package>() )
+          return new RpmPackageProvider( access_r, pi_r->asKind<Package>(), deltas_r, policy_r );
+        else if ( pi_r.isKind<SrcPackage>() )
+          return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
+        else
+          ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
       }
 
       inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const PoolItem & pi_r,
-                                                 const PackageProviderPolicy & policy_r )
+                                                  const PackageProviderPolicy & policy_r )
       {
-       if ( pi_r.isKind<Package>() )
-         return new PackageProviderImpl<Package>( access_r, pi_r->asKind<Package>(), policy_r );
-       else if ( pi_r.isKind<SrcPackage>() )
-         return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
-       else
-         ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
+        if ( pi_r.isKind<Package>() )
+          return new PackageProviderImpl<Package>( access_r, pi_r->asKind<Package>(), policy_r );
+        else if ( pi_r.isKind<SrcPackage>() )
+          return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
+        else
+          ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
       }
 
       inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const Package::constPtr & package_r,
-                                          const DeltaCandidates & deltas_r,
-                                          const PackageProviderPolicy & policy_r )
+                                           const DeltaCandidates & deltas_r,
+                                           const PackageProviderPolicy & policy_r )
       { return new RpmPackageProvider( access_r, package_r, deltas_r, policy_r ); }
 
     } // namespace factory
     ///////////////////////////////////////////////////////////////////
 
     PackageProvider::PackageProvider( RepoMediaAccess & access_r, const PoolItem & pi_r,
-                                     const DeltaCandidates & deltas_r, const PackageProviderPolicy & policy_r )
+                                      const DeltaCandidates & deltas_r, const PackageProviderPolicy & policy_r )
 
     : _pimpl( factory::make( access_r, pi_r, deltas_r, policy_r ) )
     {}
 
     PackageProvider::PackageProvider( RepoMediaAccess & access_r, const PoolItem & pi_r,
-                                     const PackageProviderPolicy & policy_r )
+                                      const PackageProviderPolicy & policy_r )
     : _pimpl( factory::make( access_r, pi_r, policy_r ) )
     {}
 
     /* legacy */
     PackageProvider::PackageProvider( RepoMediaAccess & access_r,
-                                     const Package::constPtr & package_r,
-                                     const DeltaCandidates & deltas_r,
-                                     const PackageProviderPolicy & policy_r )
+                                      const Package::constPtr & package_r,
+                                      const DeltaCandidates & deltas_r,
+                                      const PackageProviderPolicy & policy_r )
     : _pimpl( factory::make( access_r, package_r, deltas_r, policy_r ) )
     {}
 
index d4ce249..62922b4 100644 (file)
@@ -71,7 +71,7 @@ namespace zypp
        */
       PackageProvider( RepoMediaAccess & access, const PoolItem & pi_r,
                        const DeltaCandidates & deltas,
-                      const PackageProviderPolicy & policy_r = PackageProviderPolicy() );
+                       const PackageProviderPolicy & policy_r = PackageProviderPolicy() );
 
       /** Legacy Ctor taking a \c Package::constPtr to provide. */
       PackageProvider( RepoMediaAccess & access,
index b285510..10cf5ac 100644 (file)
@@ -60,7 +60,7 @@ namespace zypp
           service_info.setUrl(url);
           service_info.setType(ServiceType::PLUGIN);
           service_info.setAutorefresh( true );
-         DBG << "Plugin Service: " << service_info << endl;
+          DBG << "Plugin Service: " << service_info << endl;
           callback(service_info);
         }
 
index 7ede1c0..35fb419 100644 (file)
@@ -29,7 +29,7 @@ namespace zypp
     {
       friend std::ostream & operator<<( std::ostream & str, const PluginServices& obj );
     public:
-      
+
      /**
       * Callback definition.
       * First parameter is a \ref ServiceInfo object with the resource.
@@ -38,14 +38,14 @@ namespace zypp
       * to be thrown and the processing to be cancelled.
       */
       typedef function< bool( const ServiceInfo & )> ProcessService;
-      
+
       /** Implementation  */
       class Impl;
 
     public:
       PluginServices(const Pathname &path,
                     const ProcessService & callback);
-     
+
       /**
        * Dtor
        */
index 6ffda10..1720d1e 100644 (file)
@@ -40,84 +40,84 @@ namespace zypp
       /// of scope.
       struct RepoMirrorListTempProvider
       {
-       RepoMirrorListTempProvider()
-       {}
-       RepoMirrorListTempProvider( const Pathname & localfile_r )
-       : _localfile( localfile_r )
-       {}
-       RepoMirrorListTempProvider( const Url & url_r )
-       {
-         Url abs_url( url_r );
-         abs_url.setPathName( "/" );
-         abs_url.setQueryParam( "mediahandler", "curl" );
-         _access.reset( new MediaSetAccess( abs_url ) );
-         _localfile = _access->provideFile( url_r.getPathName() );
-       }
-
-       const Pathname & localfile() const
-       { return _localfile; }
+        RepoMirrorListTempProvider()
+        {}
+        RepoMirrorListTempProvider( const Pathname & localfile_r )
+        : _localfile( localfile_r )
+        {}
+        RepoMirrorListTempProvider( const Url & url_r )
+        {
+          Url abs_url( url_r );
+          abs_url.setPathName( "/" );
+          abs_url.setQueryParam( "mediahandler", "curl" );
+          _access.reset( new MediaSetAccess( abs_url ) );
+          _localfile = _access->provideFile( url_r.getPathName() );
+        }
+
+        const Pathname & localfile() const
+        { return _localfile; }
 
       private:
-       shared_ptr<MediaSetAccess> _access;
-       Pathname _localfile;
+        shared_ptr<MediaSetAccess> _access;
+        Pathname _localfile;
       };
       ///////////////////////////////////////////////////////////////////
 
       inline std::vector<Url> RepoMirrorListParseXML( const Pathname &tmpfile )
       {
-       InputStream tmpfstream (tmpfile);
-       media::MetaLinkParser metalink;
-       metalink.parse(tmpfstream);
-       return metalink.getUrls();
+        InputStream tmpfstream (tmpfile);
+        media::MetaLinkParser metalink;
+        metalink.parse(tmpfstream);
+        return metalink.getUrls();
       }
 
       inline std::vector<Url> RepoMirrorListParseTXT( const Pathname &tmpfile )
       {
-       InputStream tmpfstream (tmpfile);
-       std::vector<Url> my_urls;
-       std::string tmpurl;
-       while (getline(tmpfstream.stream(), tmpurl))
-       {
-         if ( tmpurl[0] == '#' )
-           continue;
-         try {
-           my_urls.push_back(Url(tmpurl));
-         }
-         catch (...)
-         {;}   // ignore malformed urls
-       }
-       return my_urls;
+        InputStream tmpfstream (tmpfile);
+        std::vector<Url> my_urls;
+        std::string tmpurl;
+        while (getline(tmpfstream.stream(), tmpurl))
+        {
+          if ( tmpurl[0] == '#' )
+            continue;
+          try {
+            my_urls.push_back(Url(tmpurl));
+          }
+          catch (...)
+          {;}  // ignore malformed urls
+        }
+        return my_urls;
       }
 
       /** Parse a local mirrorlist \a listfile_r and return usable URLs */
       inline std::vector<Url> RepoMirrorListParse( const Url & url_r, const Pathname & listfile_r, bool mirrorListForceMetalink_r )
       {
-       USR << url_r << " " << listfile_r << endl;
-
-       std::vector<Url> mirrorurls;
-       if ( mirrorListForceMetalink_r || url_r.asString().find( "/metalink" ) != std::string::npos )
-         mirrorurls = RepoMirrorListParseXML( listfile_r );
-       else
-         mirrorurls = RepoMirrorListParseTXT( listfile_r );
-
-
-       std::vector<Url> ret;
-       for ( auto & murl : mirrorurls )
-       {
-         if ( murl.getScheme() != "rsync" )
-         {
-           size_t delpos = murl.getPathName().find("repodata/repomd.xml");
-           if( delpos != std::string::npos )
-           {
-             murl.setPathName( murl.getPathName().erase(delpos)  );
-           }
-           ret.push_back( murl );
-
-           if ( ret.size() >= 4 )      // why 4?
-             break;
-         }
-       }
-       return ret;
+        USR << url_r << " " << listfile_r << endl;
+
+        std::vector<Url> mirrorurls;
+        if ( mirrorListForceMetalink_r || url_r.asString().find( "/metalink" ) != std::string::npos )
+          mirrorurls = RepoMirrorListParseXML( listfile_r );
+        else
+          mirrorurls = RepoMirrorListParseTXT( listfile_r );
+
+
+        std::vector<Url> ret;
+        for ( auto & murl : mirrorurls )
+        {
+          if ( murl.getScheme() != "rsync" )
+          {
+            size_t delpos = murl.getPathName().find("repodata/repomd.xml");
+            if( delpos != std::string::npos )
+            {
+              murl.setPathName( murl.getPathName().erase(delpos)  );
+            }
+            ret.push_back( murl );
+
+            if ( ret.size() >= 4 )     // why 4?
+              break;
+          }
+        }
+        return ret;
       }
 
     } // namespace
@@ -127,42 +127,42 @@ namespace zypp
     {
       if ( url_r.getScheme() == "file" )
       {
-       // never cache for local mirrorlist
-       _urls = RepoMirrorListParse( url_r, url_r.getPathName(), mirrorListForceMetalink_r );
+        // never cache for local mirrorlist
+        _urls = RepoMirrorListParse( url_r, url_r.getPathName(), mirrorListForceMetalink_r );
       }
       else if ( ! PathInfo( metadatapath_r).isDir() )
       {
-       // no cachedir
-       RepoMirrorListTempProvider provider( url_r );   // RAII: lifetime of any downloaded files
-       _urls = RepoMirrorListParse( url_r, provider.localfile(), mirrorListForceMetalink_r );
+        // no cachedir
+        RepoMirrorListTempProvider provider( url_r );  // RAII: lifetime of any downloaded files
+        _urls = RepoMirrorListParse( url_r, provider.localfile(), mirrorListForceMetalink_r );
       }
       else
       {
-       // have cachedir
-       Pathname cachefile( metadatapath_r );
-       if ( mirrorListForceMetalink_r || url_r.asString().find( "/metalink" ) != std::string::npos )
-         cachefile /= "mirrorlist.xml";
-       else
-         cachefile /= "mirrorlist.txt";
-
-       zypp::filesystem::PathInfo cacheinfo( cachefile );
-       if ( !cacheinfo.isFile() || cacheinfo.mtime() < time(NULL) - (long) ZConfig::instance().repo_refresh_delay() * 60 )
-       {
-         DBG << "Getting MirrorList from URL: " << url_r << endl;
-         RepoMirrorListTempProvider provider( url_r ); // RAII: lifetime of downloaded file
-
-         // Create directory, if not existing
-         DBG << "Copy MirrorList file to " << cachefile << endl;
-         zypp::filesystem::assert_dir( metadatapath_r );
-         zypp::filesystem::hardlinkCopy( provider.localfile(), cachefile );
-       }
-
-       _urls = RepoMirrorListParse( url_r, cachefile, mirrorListForceMetalink_r );
-       if( _urls.empty() )
-       {
-         DBG << "Removing Cachefile as it contains no URLs" << endl;
-         zypp::filesystem::unlink( cachefile );
-       }
+        // have cachedir
+        Pathname cachefile( metadatapath_r );
+        if ( mirrorListForceMetalink_r || url_r.asString().find( "/metalink" ) != std::string::npos )
+          cachefile /= "mirrorlist.xml";
+        else
+          cachefile /= "mirrorlist.txt";
+
+        zypp::filesystem::PathInfo cacheinfo( cachefile );
+        if ( !cacheinfo.isFile() || cacheinfo.mtime() < time(NULL) - (long) ZConfig::instance().repo_refresh_delay() * 60 )
+        {
+          DBG << "Getting MirrorList from URL: " << url_r << endl;
+          RepoMirrorListTempProvider provider( url_r );        // RAII: lifetime of downloaded file
+
+          // Create directory, if not existing
+          DBG << "Copy MirrorList file to " << cachefile << endl;
+          zypp::filesystem::assert_dir( metadatapath_r );
+          zypp::filesystem::hardlinkCopy( provider.localfile(), cachefile );
+        }
+
+        _urls = RepoMirrorListParse( url_r, cachefile, mirrorListForceMetalink_r );
+        if( _urls.empty() )
+        {
+          DBG << "Removing Cachefile as it contains no URLs" << endl;
+          zypp::filesystem::unlink( cachefile );
+        }
       }
     }
 
index 5ad1874..89a556f 100644 (file)
@@ -21,11 +21,11 @@ namespace zypp
     class RepoMirrorList
     {
       public:
-       RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r );
+        RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r );
 
         RepoMirrorList( const Url & url_r )
-       : RepoMirrorList( url_r, Pathname(), false )
-       {}
+        : RepoMirrorList( url_r, Pathname(), false )
+        {}
 
         const std::vector<Url> & getUrls() const
         { return _urls; }
index 63a6a69..01c9570 100644 (file)
@@ -58,51 +58,51 @@ namespace zypp
       */
       struct DownloadFileReportHack : public callback::ReceiveReport<media::DownloadProgressReport>
       {
-       typedef callback::ReceiveReport<ReportType> BaseType;
-       typedef function<bool(int)>                 RedirectType;
-
-       DownloadFileReportHack( RedirectType redirect_r )
-       : _oldRec( Distributor::instance().getReceiver() )
-       , _redirect( redirect_r )
-       { connect(); }
-       ~DownloadFileReportHack()
-       { if ( _oldRec ) Distributor::instance().setReceiver( *_oldRec ); else Distributor::instance().noReceiver(); }
-
-       virtual void start( const Url & file, Pathname localfile )
-       {
-         if ( _oldRec )
-           _oldRec->start( file, localfile );
-         else
-           BaseType::start( file, localfile );
-       }
-
-       virtual bool progress( int value, const Url & file, double dbps_avg = -1, double dbps_current = -1 )
-       {
-         bool ret = true;
-         if ( _oldRec )
-           ret &= _oldRec->progress( value, file, dbps_avg, dbps_current );
+        typedef callback::ReceiveReport<ReportType> BaseType;
+        typedef function<bool(int)>                 RedirectType;
+
+        DownloadFileReportHack( RedirectType redirect_r )
+        : _oldRec( Distributor::instance().getReceiver() )
+        , _redirect( redirect_r )
+        { connect(); }
+        ~DownloadFileReportHack()
+        { if ( _oldRec ) Distributor::instance().setReceiver( *_oldRec ); else Distributor::instance().noReceiver(); }
+
+        virtual void start( const Url & file, Pathname localfile )
+        {
+          if ( _oldRec )
+            _oldRec->start( file, localfile );
+          else
+            BaseType::start( file, localfile );
+        }
+
+        virtual bool progress( int value, const Url & file, double dbps_avg = -1, double dbps_current = -1 )
+        {
+          bool ret = true;
+          if ( _oldRec )
+            ret &= _oldRec->progress( value, file, dbps_avg, dbps_current );
           if ( _redirect )
             ret &= _redirect( value );
-         return ret;
-       }
-
-       virtual Action problem( const Url & file, Error error, const std::string & description )
-       {
-         if ( _oldRec )
-           return _oldRec->problem( file, error, description );
-         return BaseType::problem( file, error, description );
-       }
-       virtual void finish( const Url & file, Error error, const std::string & reason )
-       {
-         if ( _oldRec )
-           _oldRec->finish( file, error, reason );
-         else
-           BaseType::finish( file, error, reason );
-       }
-
-       private:
-         Receiver * _oldRec;
-         RedirectType _redirect;
+          return ret;
+        }
+
+        virtual Action problem( const Url & file, Error error, const std::string & description )
+        {
+          if ( _oldRec )
+            return _oldRec->problem( file, error, description );
+          return BaseType::problem( file, error, description );
+        }
+        virtual void finish( const Url & file, Error error, const std::string & reason )
+        {
+          if ( _oldRec )
+            _oldRec->finish( file, error, reason );
+          else
+            BaseType::finish( file, error, reason );
+        }
+
+        private:
+          Receiver * _oldRec;
+          RedirectType _redirect;
       };
 
       /////////////////////////////////////////////////////////////////
@@ -185,18 +185,18 @@ namespace zypp
                 }
               }
 
-             SUSEMediaVerifier lverifyer { mediafile };
-             if ( lverifyer ) {
-               DBG << "Verifyer for repo '" << repo.alias() << "':" << lverifyer << endl;
-               for ( media::MediaNr i = 1; i <= lverifyer.totalMedia(); ++i ) {
-                 media::MediaVerifierRef verifier( new repo::SUSEMediaVerifier( lverifyer, i ) );
+              SUSEMediaVerifier lverifyer { mediafile };
+              if ( lverifyer ) {
+                DBG << "Verifyer for repo '" << repo.alias() << "':" << lverifyer << endl;
+                for ( media::MediaNr i = 1; i <= lverifyer.totalMedia(); ++i ) {
+                  media::MediaVerifierRef verifier( new repo::SUSEMediaVerifier( lverifyer, i ) );
                   media->setVerifier( i, verifier);
                 }
                 _verifier[media] = repo;
-             }
-             else {
-               WAR << "Invalid verifier for repo '" << repo.alias() << "' in '" << repo.metadataPath() << "': " << lverifyer << endl;
-             }
+              }
+              else {
+                WAR << "Invalid verifier for repo '" << repo.alias() << "' in '" << repo.metadataPath() << "': " << lverifyer << endl;
+              }
             }
             else
             {
@@ -245,7 +245,7 @@ namespace zypp
       DownloadFileReportHack dumb( bind( mem_fun_ref( &ProvideFilePolicy::progress ), ref( policy_r ), _1 ) );
 
       RepoException repo_excpt(repo_r,
-                              str::form(_("Can't provide file '%s' from repository '%s'"),
+                               str::form(_("Can't provide file '%s' from repository '%s'"),
                                locWithPath.filename().c_str(),
                                repo_r.alias().c_str() ) );
 
@@ -267,15 +267,15 @@ namespace zypp
       PathInfo pi( destinationDir );
       if ( ! pi.isExist() )
       {
-       // try to create it...
-       assert_dir( destinationDir );
-       pi();
+        // try to create it...
+        assert_dir( destinationDir );
+        pi();
       }
       if ( geteuid() != 0 && ! pi.userMayW() )
       {
         WAR << "Destination dir '" << destinationDir << "' is not user writable, using tmp space." << endl;
         destinationDir = getZYpp()->tmpPath() / destinationDir;
-       assert_dir( destinationDir );
+        assert_dir( destinationDir );
         fetcher.addCachePath( destinationDir );
         MIL << "Added cache path " << destinationDir << endl;
       }
@@ -294,10 +294,10 @@ namespace zypp
           MIL << "Providing file of repo '" << repo_r.alias() << "' from " << url << endl;
           shared_ptr<MediaSetAccess> access = _impl->mediaAccessForUrl( url, repo_r );
 
-         fetcher.enqueue( locWithPath, policy_r.fileChecker() );
-         fetcher.start( destinationDir, *access );
+          fetcher.enqueue( locWithPath, policy_r.fileChecker() );
+          fetcher.start( destinationDir, *access );
 
-         // reached if no exception has been thrown, so this is the correct file
+          // reached if no exception has been thrown, so this is the correct file
           ManagedFile ret( destinationDir + locWithPath.filename() );
           if ( !repo_r.keepPackages() )
           {
@@ -308,13 +308,13 @@ namespace zypp
           return ret;
         }
         catch ( const UserRequestException & excpt )
-       {
-         ZYPP_RETHROW( excpt );
-       }
+        {
+          ZYPP_RETHROW( excpt );
+        }
         catch ( const FileCheckException & excpt )
-       {
-         ZYPP_RETHROW( excpt );
-       }
+        {
+          ZYPP_RETHROW( excpt );
+        }
         catch ( const Exception &e )
         {
           ZYPP_CAUGHT( e );
index 1220f60..7be535d 100644 (file)
@@ -24,10 +24,10 @@ namespace repo
       static NamedValue<RepoType::Type> & _t( *new NamedValue<RepoType::Type> );
       if ( _t.empty() )
       {
-       _t( RepoType::RPMMD_e )         | "rpm-md"      | "rpm"|"rpmmd"|"repomd"|"yum"|"up2date";
-       _t( RepoType::YAST2_e )         | "yast2"       | "yast"|"susetags";
-       _t( RepoType::RPMPLAINDIR_e )   | "plaindir";
-       _t( RepoType::NONE_e )          | "NONE"        | "none";
+        _t( RepoType::RPMMD_e )                | "rpm-md"      | "rpm"|"rpmmd"|"repomd"|"yum"|"up2date";
+        _t( RepoType::YAST2_e )                | "yast2"       | "yast"|"susetags";
+        _t( RepoType::RPMPLAINDIR_e )  | "plaindir";
+        _t( RepoType::NONE_e )         | "NONE"        | "none";
       }
       return _t;
     }
index 2eacab8..867cac9 100644 (file)
@@ -53,224 +53,224 @@ namespace zypp
       ///////////////////////////////////////////////////////////////////
       struct FindVar
       {
-       bool _embedded;         ///< A (formerly) embedded string may have esacped \c $, \c closebrace and \c backslash
-       const char * _sbeg;     ///< start of string to scan
-       const char * _vbeg;     ///< [$]{variable:-word} / [$]{variable} / if embedded also on [\\]
-       const char * _nbeg;     ///< ${[v]ariable:-word} / ${[v]ariable}
-       const char * _nend;     ///< ${variable[:]-word} / ${variable[}]
-       const char * _vend;     ///< ${variable:-word}[] / ${variable}[]
-       const char * _send;     ///< end of scan (next $ or nullptr if done)
-
-       FindVar( const std::string & str_r, bool embedded_r )
-       : _embedded( embedded_r )
-       , _sbeg( str_r.c_str() )
-       , _vbeg( nullptr )
-       , _nbeg( nullptr )
-       , _nend( nullptr )
-       , _vend( nullptr )
-       , _send( findVarStart( _sbeg ) )
-       {}
-
-       /** Nullptr in _send indicates we scanned the whole string. */
-       bool done() const
-       { return !_send; }
-
-       /** Advance to first/next var if there is one */
-       bool nextVar()
-       {
-         if ( done() )
-           return false;
-
-         do {
-           if ( _vbeg && !_vend )      // loop internal: no findVarEnd at current $; skip it
-             _send = findVarStart( _vbeg+1 );
-           _vbeg = _send;              // next $ or null if string end
-           _nbeg = _nend = _vend = _send = nullptr;
-           if ( ! _vbeg )              // done!
-             return false;
-         } while( ! findVarEnd() );
-
-         return true;
-       }
-
-       /** Valid _vend indicates valid var data in scan. */
-       bool hasVar() const
-       { return _vend; }
-
-       //
-       // Methods below are only valid if hasVar() == true
-       //
-
-       /** Return the full var text */
-       std::string var() const
-       { return std::string( _vbeg, _vend ); }
-
-       /** Return the var name */
-       std::string varName() const
-       { return std::string( _nbeg, _nend ); }
-
-       /** Whether this is a conditional var (${..:[+-]...}) */
-       bool varIsConditional() const
-       { return( *(_vbeg+1) == '{' && *_nend == ':' ); }
-
-       /** The var type: \c \, \c $, \c - , \c +
-       * \li \c \ backslash escaped literal
-       * \li \c $      plain variable
-       * \li \c - conditional: default value
-       * \li \c + conditional: alternate value
-       */
-       int varType() const
-       { return( varIsConditional() ? *(_nend+1) : *_vbeg ); }
-
-       /** Return embedded value in conditional vars or empty string */
-       std::string varEmbedded() const
-       { return( varIsConditional() ? std::string( _nend+2, _vend-1 ) : std::string() ); }
-
-
-       /** Have unwritten data before var? */
-       bool hasVarPrefix() const
-       { return ( _sbeg != _vbeg ); }
-
-       /** Return unwritten data before var */
-       std::string varPrefix() const
-       { return std::string( _sbeg, _vbeg ); }
-
-       /** Indicate all data up to _vend were written */
-       void wroteVar()
-       { _sbeg = _vend; }
+        bool _embedded;                ///< A (formerly) embedded string may have esacped \c $, \c closebrace and \c backslash
+        const char * _sbeg;    ///< start of string to scan
+        const char * _vbeg;    ///< [$]{variable:-word} / [$]{variable} / if embedded also on [\\]
+        const char * _nbeg;    ///< ${[v]ariable:-word} / ${[v]ariable}
+        const char * _nend;    ///< ${variable[:]-word} / ${variable[}]
+        const char * _vend;    ///< ${variable:-word}[] / ${variable}[]
+        const char * _send;    ///< end of scan (next $ or nullptr if done)
+
+        FindVar( const std::string & str_r, bool embedded_r )
+        : _embedded( embedded_r )
+        , _sbeg( str_r.c_str() )
+        , _vbeg( nullptr )
+        , _nbeg( nullptr )
+        , _nend( nullptr )
+        , _vend( nullptr )
+        , _send( findVarStart( _sbeg ) )
+        {}
+
+        /** Nullptr in _send indicates we scanned the whole string. */
+        bool done() const
+        { return !_send; }
+
+        /** Advance to first/next var if there is one */
+        bool nextVar()
+        {
+          if ( done() )
+            return false;
+
+          do {
+            if ( _vbeg && !_vend )     // loop internal: no findVarEnd at current $; skip it
+              _send = findVarStart( _vbeg+1 );
+            _vbeg = _send;             // next $ or null if string end
+            _nbeg = _nend = _vend = _send = nullptr;
+            if ( ! _vbeg )             // done!
+              return false;
+          } while( ! findVarEnd() );
+
+          return true;
+        }
+
+        /** Valid _vend indicates valid var data in scan. */
+        bool hasVar() const
+        { return _vend; }
+
+        //
+        // Methods below are only valid if hasVar() == true
+        //
+
+        /** Return the full var text */
+        std::string var() const
+        { return std::string( _vbeg, _vend ); }
+
+        /** Return the var name */
+        std::string varName() const
+        { return std::string( _nbeg, _nend ); }
+
+        /** Whether this is a conditional var (${..:[+-]...}) */
+        bool varIsConditional() const
+        { return( *(_vbeg+1) == '{' && *_nend == ':' ); }
+
+        /** The var type: \c \, \c $, \c - , \c +
+        * \li \c \ backslash escaped literal
+        * \li \c $     plain variable
+        * \li \c - conditional: default value
+        * \li \c + conditional: alternate value
+        */
+        int varType() const
+        { return( varIsConditional() ? *(_nend+1) : *_vbeg ); }
+
+        /** Return embedded value in conditional vars or empty string */
+        std::string varEmbedded() const
+        { return( varIsConditional() ? std::string( _nend+2, _vend-1 ) : std::string() ); }
+
+
+        /** Have unwritten data before var? */
+        bool hasVarPrefix() const
+        { return ( _sbeg != _vbeg ); }
+
+        /** Return unwritten data before var */
+        std::string varPrefix() const
+        { return std::string( _sbeg, _vbeg ); }
+
+        /** Indicate all data up to _vend were written */
+        void wroteVar()
+        { _sbeg = _vend; }
 
       private:
-       /** Return next \c $ */
-       const char * findVarStart( const char * sbeg_r ) const
-       {
-         for ( ; *sbeg_r; ++sbeg_r )
-           if ( *sbeg_r == '$' || ( _embedded && *sbeg_r == '\\' ) )
-             return sbeg_r;
-         return nullptr;
-       }
-
-       /** Valid var name char */
-       bool isnamech( int ch ) const
-       { return ch == '_' || isalnum( ch ); }
-
-       /** Scan for a valid variable starting at _vbeg (storing the values) */
-       bool findVarEnd()
-       {
-         // asserted: *_vbeg == '$' || '\\'
-         if ( ! findVarEnd( _vbeg, _nbeg, _nend, _vend ) )
-           return false;
-         _send = findVarStart( _vend );
-         return true;
-       }
-
-       /** Skip over valid variable starting at vbeg (return end in \a vend). */
-       const char * findVarEnd( const char * vbeg ) const
-       {
-         // asserted: *_vbeg == '$'
-         const char * nbeg = nullptr;
-         const char * nend = nullptr;
-         const char * vend = nullptr;
-         findVarEnd( vbeg, nbeg, nend, vend );
-         return vend;
-       }
-
-       /** Scan for a valid variable starting at vbeg (const version returning the values). */
-       bool findVarEnd( const char * vbeg, const char *& nbeg, const char *& nend, const char *& vend ) const
-       {
-         // embedded only: handle backslash escaped chars
-         if ( *_vbeg == '\\' )
-         {
-           nbeg = vbeg+1;
-           if ( *nbeg == '$'
-             || *nbeg == '}'
-             || *nbeg == '\\' )
-           {
-             nend = vend = vbeg+2;
-             return true;
-           }
-           return false;
-         }
-
-         // asserted: *vbeg == '$'
-         // vbeg: [$]{variable:-word} / [$]{variable}
-         // nbeg: ${[v]ariable:-word} / ${[v]ariable}
-         bool braced = ( *(vbeg+1) == '{' ); //}
-         nbeg = vbeg+( braced ? 2 : 1 );
-         if ( !isnamech( *nbeg ) )     // don't allow empty var name
-           return false;
-         for ( nend = nbeg+1; isnamech( *nend ); ++nend )
-         {;} // skip over var name
-         // nend: ${variable[:]-word} / ${variable[}]
-
-         // vend: ${variable:-word}[] / ${variable}[]
-         // stay with ( vend == nullptr ) until you know it's valid
-         if ( braced )
-         {
-           if ( *nend == '}' )
-           {
-             vend = nend+1;
-           }
-           else if ( *nend == ':' )
-           {
-             const char * scan = nend+1;
-             if ( *scan == '+' || *scan == '-' )
-             {
-               ++scan;
-               // find first not escaped '}'
-               while ( *scan )
-               {
-                 if ( *scan == '\\' )
-                 {
-                   ++scan;     // next char is skipped
-                   if ( *scan )
-                     ++scan;
-                 }
-                 else if ( *scan == '$' )
-                 {
-                   // an embedded var?
-                   if ( ! (scan = findVarEnd( scan )) )
-                     return false;
-                 }
-                 else if ( *scan == '}' )
-                 {
-                   vend = scan+1;      // ==> unesacped '}', we're done!
-                   break;
-                 }
-                 else
-                   ++scan;     // literal
-               }
-               // ( ! *scan ) => end of string while looking for unesacped '}'
-             }
-             else
-               ; // err: ':' not followed by '+' or '-'
-           }
-           else
-             ; // err: braced name must end with '}' or ':'
-         }
-         else
-         {
-           vend = nend;        // un-braced
-         }
-         return( vend != nullptr );
-       }
+        /** Return next \c $ */
+        const char * findVarStart( const char * sbeg_r ) const
+        {
+          for ( ; *sbeg_r; ++sbeg_r )
+            if ( *sbeg_r == '$' || ( _embedded && *sbeg_r == '\\' ) )
+              return sbeg_r;
+          return nullptr;
+        }
+
+        /** Valid var name char */
+        bool isnamech( int ch ) const
+        { return ch == '_' || isalnum( ch ); }
+
+        /** Scan for a valid variable starting at _vbeg (storing the values) */
+        bool findVarEnd()
+        {
+          // asserted: *_vbeg == '$' || '\\'
+          if ( ! findVarEnd( _vbeg, _nbeg, _nend, _vend ) )
+            return false;
+          _send = findVarStart( _vend );
+          return true;
+        }
+
+        /** Skip over valid variable starting at vbeg (return end in \a vend). */
+        const char * findVarEnd( const char * vbeg ) const
+        {
+          // asserted: *_vbeg == '$'
+          const char * nbeg = nullptr;
+          const char * nend = nullptr;
+          const char * vend = nullptr;
+          findVarEnd( vbeg, nbeg, nend, vend );
+          return vend;
+        }
+
+        /** Scan for a valid variable starting at vbeg (const version returning the values). */
+        bool findVarEnd( const char * vbeg, const char *& nbeg, const char *& nend, const char *& vend ) const
+        {
+          // embedded only: handle backslash escaped chars
+          if ( *_vbeg == '\\' )
+          {
+            nbeg = vbeg+1;
+            if ( *nbeg == '$'
+              || *nbeg == '}'
+              || *nbeg == '\\' )
+            {
+              nend = vend = vbeg+2;
+              return true;
+            }
+            return false;
+          }
+
+          // asserted: *vbeg == '$'
+          // vbeg: [$]{variable:-word} / [$]{variable}
+          // nbeg: ${[v]ariable:-word} / ${[v]ariable}
+          bool braced = ( *(vbeg+1) == '{' ); //}
+          nbeg = vbeg+( braced ? 2 : 1 );
+          if ( !isnamech( *nbeg ) )    // don't allow empty var name
+            return false;
+          for ( nend = nbeg+1; isnamech( *nend ); ++nend )
+          {;} // skip over var name
+          // nend: ${variable[:]-word} / ${variable[}]
+
+          // vend: ${variable:-word}[] / ${variable}[]
+          // stay with ( vend == nullptr ) until you know it's valid
+          if ( braced )
+          {
+            if ( *nend == '}' )
+            {
+              vend = nend+1;
+            }
+            else if ( *nend == ':' )
+            {
+              const char * scan = nend+1;
+              if ( *scan == '+' || *scan == '-' )
+              {
+                ++scan;
+                // find first not escaped '}'
+                while ( *scan )
+                {
+                  if ( *scan == '\\' )
+                  {
+                    ++scan;    // next char is skipped
+                    if ( *scan )
+                      ++scan;
+                  }
+                  else if ( *scan == '$' )
+                  {
+                    // an embedded var?
+                    if ( ! (scan = findVarEnd( scan )) )
+                      return false;
+                  }
+                  else if ( *scan == '}' )
+                  {
+                    vend = scan+1;     // ==> unesacped '}', we're done!
+                    break;
+                  }
+                  else
+                    ++scan;    // literal
+                }
+                // ( ! *scan ) => end of string while looking for unesacped '}'
+              }
+              else
+                ; // err: ':' not followed by '+' or '-'
+            }
+            else
+              ; // err: braced name must end with '}' or ':'
+          }
+          else
+          {
+            vend = nend;       // un-braced
+          }
+          return( vend != nullptr );
+        }
       };
 
       bool _expand( std::string &, const std::string & value_r, unsigned level_r, RepoVarExpand::VarRetriever & varRetriever_r );
 
       inline std::string expand( const std::string & value_r, unsigned level_r, RepoVarExpand::VarRetriever & varRetriever_r )
       {
-       std::string ret;
-       if ( ! _expand( ret, value_r, level_r, varRetriever_r ) )
-         ret = value_r;
-       return ret;
+        std::string ret;
+        if ( ! _expand( ret, value_r, level_r, varRetriever_r ) )
+          ret = value_r;
+        return ret;
       }
 
       inline std::string expand( std::string && value_r, unsigned level_r, RepoVarExpand::VarRetriever & varRetriever_r )
       {
-       std::string ret;
-       if ( ! _expand( ret, value_r, level_r, varRetriever_r ) )
-         ret = std::move(value_r);
-       return ret;
+        std::string ret;
+        if ( ! _expand( ret, value_r, level_r, varRetriever_r ) )
+          ret = std::move(value_r);
+        return ret;
       }
 
       /** Expand variables in \a value_r depending on \a level-r
@@ -279,100 +279,100 @@ namespace zypp
       inline bool _expand( std::string & result_r, const std::string & value_r, unsigned level_r, RepoVarExpand::VarRetriever & varRetriever_r )
       {
 #if ( ZYPP_DBG_VAREXPAND )
-       cout << std::string(  2*level_r, ' ' ) << "\033[7m>>" << value_r << "<<\033[27m" << endl;
-       std::ostringstream dbg;
-       const char * dbgsbeg = value_r.c_str(); // track vars we already added to dbg
-       unsigned dbgi = 0;                      // color 1-5 var / 6 moved value_r
-       dbg << std::string(  2*level_r, ' ' ) << ">>";
+        cout << std::string(  2*level_r, ' ' ) << "\033[7m>>" << value_r << "<<\033[27m" << endl;
+        std::ostringstream dbg;
+        const char * dbgsbeg = value_r.c_str();        // track vars we already added to dbg
+        unsigned dbgi = 0;                     // color 1-5 var / 6 moved value_r
+        dbg << std::string(  2*level_r, ' ' ) << ">>";
 #endif // ZYPP_DBG_VAREXPAND
 
-       bool expanded = false;
+        bool expanded = false;
 
-       if ( ! value_r.empty() )
-       {
-         FindVar scan( value_r, level_r );     // level_r > 0 is embedded
-         while ( scan.nextVar() )
-         {
-           static const std::string _emptyValue;
-           const std::string *const knownVar = ( varRetriever_r ? varRetriever_r( scan.varName() ) : nullptr );
-           const std::string & varValue( knownVar ? *knownVar : _emptyValue );
+        if ( ! value_r.empty() )
+        {
+          FindVar scan( value_r, level_r );    // level_r > 0 is embedded
+          while ( scan.nextVar() )
+          {
+            static const std::string _emptyValue;
+            const std::string *const knownVar = ( varRetriever_r ? varRetriever_r( scan.varName() ) : nullptr );
+            const std::string & varValue( knownVar ? *knownVar : _emptyValue );
 
 #if ( ZYPP_DBG_VAREXPAND )
-           dbg << std::string(dbgsbeg,scan._vbeg) << "\033[3" << ((dbgi%5)+1) << "m" << scan.var() << "\033[0m";
-           cout << dbg.str() << "|<< " << scan.varName() << " " << (knownVar?"("+varValue+")":"-") << " {" << scan.varEmbedded() << "}" << endl;
-           dbgsbeg = scan._vend;
-           dbgi++;
+            dbg << std::string(dbgsbeg,scan._vbeg) << "\033[3" << ((dbgi%5)+1) << "m" << scan.var() << "\033[0m";
+            cout << dbg.str() << "|<< " << scan.varName() << " " << (knownVar?"("+varValue+")":"-") << " {" << scan.varEmbedded() << "}" << endl;
+            dbgsbeg = scan._vend;
+            dbgi++;
 #endif // ZYPP_DBG_VAREXPAND
 
-           bool mustSubstitute = false;        // keep original text per default
-           std::string substitutionValue;
-
-           int varType = scan.varType();
-           if ( varType == '$' )       // plain var
-           {
-             if ( knownVar )
-             {
-               mustSubstitute = true;
-               substitutionValue = varValue;
-             }
-             else
-               ; // keep original text per default
-           }
-           else if ( varType == '-' ) // ':-' default value
-           {
-             mustSubstitute = true;
-             if ( varValue.empty() )
-               substitutionValue = expand( scan.varEmbedded(), level_r+1, varRetriever_r );
-             else
-               substitutionValue = varValue;
-           }
-           else if ( varType == '+' ) // ':+' alternate value
-           {
-             mustSubstitute = true;
-             if ( ! varValue.empty() )
-               substitutionValue = expand( scan.varEmbedded(), level_r+1, varRetriever_r );
-             else
-               ; // empty substitutionValue
-           }
-           else if ( varType == '\\' ) // backslash escaped literal (in varName)
-           {
-             mustSubstitute = true;
-             substitutionValue = scan.varName();
-           }
-           else
-             ; // keep original text per default
-
-           if ( mustSubstitute  )
-           {
-             if ( scan.hasVarPrefix() )
-               result_r += scan.varPrefix();
-             if ( ! substitutionValue.empty() )
-               result_r += substitutionValue;
-             scan.wroteVar(); // this moves scan._sbeg so we can later see what's already written
-           }
-         }
+            bool mustSubstitute = false;       // keep original text per default
+            std::string substitutionValue;
+
+            int varType = scan.varType();
+            if ( varType == '$' )      // plain var
+            {
+              if ( knownVar )
+              {
+                mustSubstitute = true;
+                substitutionValue = varValue;
+              }
+              else
+                ; // keep original text per default
+            }
+            else if ( varType == '-' ) // ':-' default value
+            {
+              mustSubstitute = true;
+              if ( varValue.empty() )
+                substitutionValue = expand( scan.varEmbedded(), level_r+1, varRetriever_r );
+              else
+                substitutionValue = varValue;
+            }
+            else if ( varType == '+' ) // ':+' alternate value
+            {
+              mustSubstitute = true;
+              if ( ! varValue.empty() )
+                substitutionValue = expand( scan.varEmbedded(), level_r+1, varRetriever_r );
+              else
+                ; // empty substitutionValue
+            }
+            else if ( varType == '\\' ) // backslash escaped literal (in varName)
+            {
+              mustSubstitute = true;
+              substitutionValue = scan.varName();
+            }
+            else
+              ; // keep original text per default
+
+            if ( mustSubstitute  )
+            {
+              if ( scan.hasVarPrefix() )
+                result_r += scan.varPrefix();
+              if ( ! substitutionValue.empty() )
+                result_r += substitutionValue;
+              scan.wroteVar(); // this moves scan._sbeg so we can later see what's already written
+            }
+          }
 
 #if ( ZYPP_DBG_VAREXPAND )
-         dbg << std::string( dbgsbeg ) << (scan._sbeg == value_r.c_str() ? "<<\033[36m(moved)\033[0m" : "");
+          dbg << std::string( dbgsbeg ) << (scan._sbeg == value_r.c_str() ? "<<\033[36m(moved)\033[0m" : "");
 #endif // ZYPP_DBG_VAREXPAND
 
-         // handle unwritten data:
-         if ( scan._sbeg != value_r.c_str() )
-         {
-           expanded = true;
-           if ( *scan._sbeg )
-             result_r += std::string( scan._sbeg );
-         }
-         else
-           ; // no replacements at all
-       }
+          // handle unwritten data:
+          if ( scan._sbeg != value_r.c_str() )
+          {
+            expanded = true;
+            if ( *scan._sbeg )
+              result_r += std::string( scan._sbeg );
+          }
+          else
+            ; // no replacements at all
+        }
 
 #if ( ZYPP_DBG_VAREXPAND )
-       dbg << "<<";
-       cout << dbg.str() << endl;
-       cout << std::string(  2*level_r, ' ' ) << "\033[36m->" << result_r << "<-\033[0m" << endl;
+        dbg << "<<";
+        cout << dbg.str() << endl;
+        cout << std::string(  2*level_r, ' ' ) << "\033[36m->" << result_r << "<-\033[0m" << endl;
 #endif // ZYPP_DBG_VAREXPAND
-       return expanded;
+        return expanded;
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -391,153 +391,153 @@ namespace zypp
       class RepoVarsMap : public std::map<std::string,std::string>
       {
       public:
-       static RepoVarsMap & instance()
-       { static RepoVarsMap _instance; return _instance; }
+        static RepoVarsMap & instance()
+        { static RepoVarsMap _instance; return _instance; }
 
-       static const std::string * lookup( const std::string & name_r )
-       { return instance()._lookup( name_r ); }
+        static const std::string * lookup( const std::string & name_r )
+        { return instance()._lookup( name_r ); }
 
       private:
-       const std::string * _lookup( const std::string & name_r )
-       {
-         // Safe guard in case the caller does not own a zypp instance. In this case
-         // getZYpp()->getTarget() in checkOverride would create a zypp instance which
-         // would clear the variables parsed so far.
-         auto guard { getZYpp() };
-
-         if ( empty() )        // at init / after reset
-         {
-           // load user definitions from vars.d
-           filesystem::dirForEach( ZConfig::instance().repoManagerRoot() / ZConfig::instance().varsPath(),
-                                   filesystem::matchNoDots(), bind( &RepoVarsMap::parse, this, _1, _2 ) );
-           // releasever_major/_minor are per default derived from releasever.
-           // If releasever is userdefined, inject missing _major/_minor too.
-           deriveFromReleasever( "releasever", /*dont't overwrite user defined values*/false );
-
-           dumpOn( DBG );
-           // add builtin vars except for releasever{,_major,_minor} (see checkOverride)
-           {
-             const Arch & arch( ZConfig::instance().systemArchitecture() );
-             {
-               std::string & var( operator[]( "arch" ) );
-               if ( var.empty() ) var = arch.asString();
-             }
-             {
-               std::string & var( operator[]( "basearch" ) );
-               if ( var.empty() ) var = arch.baseArch().asString();
-             }
-           }
-         }
-
-         const std::string * ret = checkOverride( name_r );
-         if ( !ret )
-         {
-           // get value from map
-           iterator it = find( name_r );
-           if ( it != end() )
-             ret = &(it->second);
-         }
-
-         return ret;
-       }
-
-       std::ostream & dumpOn( std::ostream & str ) const
-       {
-         for ( auto && kv : *this )
-         {
-           str << '{' << kv.first << '=' << kv.second << '}' << endl;
-         }
-         return str;
-       }
+        const std::string * _lookup( const std::string & name_r )
+        {
+          // Safe guard in case the caller does not own a zypp instance. In this case
+          // getZYpp()->getTarget() in checkOverride would create a zypp instance which
+          // would clear the variables parsed so far.
+          auto guard { getZYpp() };
+
+          if ( empty() )       // at init / after reset
+          {
+            // load user definitions from vars.d
+            filesystem::dirForEach( ZConfig::instance().repoManagerRoot() / ZConfig::instance().varsPath(),
+                                    filesystem::matchNoDots(), bind( &RepoVarsMap::parse, this, _1, _2 ) );
+            // releasever_major/_minor are per default derived from releasever.
+            // If releasever is userdefined, inject missing _major/_minor too.
+            deriveFromReleasever( "releasever", /*dont't overwrite user defined values*/false );
+
+            dumpOn( DBG );
+            // add builtin vars except for releasever{,_major,_minor} (see checkOverride)
+            {
+              const Arch & arch( ZConfig::instance().systemArchitecture() );
+              {
+                std::string & var( operator[]( "arch" ) );
+                if ( var.empty() ) var = arch.asString();
+              }
+              {
+                std::string & var( operator[]( "basearch" ) );
+                if ( var.empty() ) var = arch.baseArch().asString();
+              }
+            }
+          }
+
+          const std::string * ret = checkOverride( name_r );
+          if ( !ret )
+          {
+            // get value from map
+            iterator it = find( name_r );
+            if ( it != end() )
+              ret = &(it->second);
+          }
+
+          return ret;
+        }
+
+        std::ostream & dumpOn( std::ostream & str ) const
+        {
+          for ( auto && kv : *this )
+          {
+            str << '{' << kv.first << '=' << kv.second << '}' << endl;
+          }
+          return str;
+        }
 
       private:
-       /** Get first line from file */
-       bool parse( const Pathname & dir_r, const std::string & str_r )
-       {
-         std::ifstream file( (dir_r/str_r).c_str() );
-         operator[]( str_r ) = str::getline( file, /*trim*/false );
-         return true;
-       }
-
-       /** Derive \c releasever_major/_minor from \c releasever, keeping or overwrititing existing values. */
-       void deriveFromReleasever( const std::string & stem_r, bool overwrite_r )
-       {
-         if ( count( stem_r ) )        // releasever is defined..
-         {
-           const std::string & stem_major( stem_r+"_major" );
-           const std::string & stem_minor( stem_r+"_minor" );
-           if ( overwrite_r )
-             splitReleaseverTo( operator[]( stem_r ), &operator[]( stem_major ), &operator[]( stem_minor ) );
-           else
-             splitReleaseverTo( operator[]( stem_r ),
-                                count( stem_major ) ? nullptr : &operator[]( stem_major ),
-                                count( stem_minor ) ? nullptr : &operator[]( stem_minor ) );
-         }
-       }
-
-       /** Split \c releasever at \c '.' and store major/minor parts as requested. */
-       void splitReleaseverTo( const std::string & releasever_r, std::string * major_r, std::string * minor_r ) const
-       {
-         if ( major_r || minor_r )
-         {
-           std::string::size_type pos = releasever_r.find( "." );
-           if ( pos == std::string::npos )
-           {
-             if ( major_r ) *major_r = releasever_r;
-             if ( minor_r ) minor_r->clear();
-           }
-           else
-           {
-             if ( major_r ) *major_r = releasever_r.substr( 0, pos );
-             if ( minor_r ) *minor_r = releasever_r.substr( pos+1 ) ;
-           }
-         }
-       }
-
-       /** Check for conditions overwriting the (user) defined values. */
-       const std::string * checkOverride( const std::string & name_r )
-       {
-         ///////////////////////////////////////////////////////////////////
-         // Always check for changing releasever{,_major,_minor} (bnc#943563)
-         if ( str::startsWith( name_r, "releasever" )
-           && ( name_r.size() == 10
-             || strcmp( name_r.c_str()+10, "_minor" ) == 0
-             || strcmp( name_r.c_str()+10, "_major" ) == 0 ) )
-         {
-           std::string val( env::ZYPP_REPO_RELEASEVER() );
-           if ( !val.empty() )
-           {
-             // $ZYPP_REPO_RELEASEVER always overwrites any defined value
-             if ( val != operator[]( "$releasever" ) )
-             {
-               operator[]( "$releasever" ) = std::move(val);
-               deriveFromReleasever( "$releasever", /*overwrite previous values*/true );
-             }
-             return &operator[]( "$"+name_r );
-           }
-           else if ( !count( name_r ) )
-           {
-             // No user defined value, so we follow the target
-             Target_Ptr trg( getZYpp()->getTarget() );
-             if ( trg )
-               val = trg->distributionVersion();
-             else
-               val = Target::distributionVersion( Pathname()/*guess*/ );
-
-             if ( val != operator[]( "$_releasever" ) )
-             {
-               operator[]( "$_releasever" ) = std::move(val);
-               deriveFromReleasever( "$_releasever", /*overwrite previous values*/true );
-             }
-             return &operator[]( "$_"+name_r );
-           }
-           // else:
-           return nullptr;     // get user value from map
-         }
-         ///////////////////////////////////////////////////////////////////
-
-         return nullptr;       // get user value from map
-       }
+        /** Get first line from file */
+        bool parse( const Pathname & dir_r, const std::string & str_r )
+        {
+          std::ifstream file( (dir_r/str_r).c_str() );
+          operator[]( str_r ) = str::getline( file, /*trim*/false );
+          return true;
+        }
+
+        /** Derive \c releasever_major/_minor from \c releasever, keeping or overwrititing existing values. */
+        void deriveFromReleasever( const std::string & stem_r, bool overwrite_r )
+        {
+          if ( count( stem_r ) )       // releasever is defined..
+          {
+            const std::string & stem_major( stem_r+"_major" );
+            const std::string & stem_minor( stem_r+"_minor" );
+            if ( overwrite_r )
+              splitReleaseverTo( operator[]( stem_r ), &operator[]( stem_major ), &operator[]( stem_minor ) );
+            else
+              splitReleaseverTo( operator[]( stem_r ),
+                                 count( stem_major ) ? nullptr : &operator[]( stem_major ),
+                                 count( stem_minor ) ? nullptr : &operator[]( stem_minor ) );
+          }
+        }
+
+        /** Split \c releasever at \c '.' and store major/minor parts as requested. */
+        void splitReleaseverTo( const std::string & releasever_r, std::string * major_r, std::string * minor_r ) const
+        {
+          if ( major_r || minor_r )
+          {
+            std::string::size_type pos = releasever_r.find( "." );
+            if ( pos == std::string::npos )
+            {
+              if ( major_r ) *major_r = releasever_r;
+              if ( minor_r ) minor_r->clear();
+            }
+            else
+            {
+              if ( major_r ) *major_r = releasever_r.substr( 0, pos );
+              if ( minor_r ) *minor_r = releasever_r.substr( pos+1 ) ;
+            }
+          }
+        }
+
+        /** Check for conditions overwriting the (user) defined values. */
+        const std::string * checkOverride( const std::string & name_r )
+        {
+          ///////////////////////////////////////////////////////////////////
+          // Always check for changing releasever{,_major,_minor} (bnc#943563)
+          if ( str::startsWith( name_r, "releasever" )
+            && ( name_r.size() == 10
+              || strcmp( name_r.c_str()+10, "_minor" ) == 0
+              || strcmp( name_r.c_str()+10, "_major" ) == 0 ) )
+          {
+            std::string val( env::ZYPP_REPO_RELEASEVER() );
+            if ( !val.empty() )
+            {
+              // $ZYPP_REPO_RELEASEVER always overwrites any defined value
+              if ( val != operator[]( "$releasever" ) )
+              {
+                operator[]( "$releasever" ) = std::move(val);
+                deriveFromReleasever( "$releasever", /*overwrite previous values*/true );
+              }
+              return &operator[]( "$"+name_r );
+            }
+            else if ( !count( name_r ) )
+            {
+              // No user defined value, so we follow the target
+              Target_Ptr trg( getZYpp()->getTarget() );
+              if ( trg )
+                val = trg->distributionVersion();
+              else
+                val = Target::distributionVersion( Pathname()/*guess*/ );
+
+              if ( val != operator[]( "$_releasever" ) )
+              {
+                operator[]( "$_releasever" ) = std::move(val);
+                deriveFromReleasever( "$_releasever", /*overwrite previous values*/true );
+              }
+              return &operator[]( "$_"+name_r );
+            }
+            // else:
+            return nullptr;    // get user value from map
+          }
+          ///////////////////////////////////////////////////////////////////
+
+          return nullptr;      // get user value from map
+        }
       };
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -564,10 +564,10 @@ namespace zypp
       Url newurl;
       if ( !replaced.empty() )
       {
-       newurl = replaced;
-       newurl.setUsername( value.getUsername( url::E_ENCODED ), url::E_ENCODED );
-       newurl.setPassword( value.getPassword( url::E_ENCODED ), url::E_ENCODED );
-       newurl.setViewOptions( value.getViewOptions() );
+        newurl = replaced;
+        newurl.setUsername( value.getUsername( url::E_ENCODED ), url::E_ENCODED );
+        newurl.setPassword( value.getPassword( url::E_ENCODED ), url::E_ENCODED );
+        newurl.setViewOptions( value.getViewOptions() );
       }
       return newurl;
     }
index 323597e..4fa9015 100644 (file)
@@ -26,17 +26,17 @@ namespace zypp
     {
       SMVData( const Pathname & path_r )
       {
-       std::ifstream inp( path_r.c_str() );
-       if ( !inp ) {
-         ERR << "Can't setup a SUSEMediaVerifier from file: " << path_r.asString() << endl;
-         return;
-       }
-       getline( inp, _mediaVendor );
-       getline( inp, _mediaIdent );
-       std::string buffer;
-       getline( inp, buffer );
-       str::strtonum( buffer, _totalMedia );
-       //if ( !_totalMedia ) _totalMedia = 1;
+        std::ifstream inp( path_r.c_str() );
+        if ( !inp ) {
+          ERR << "Can't setup a SUSEMediaVerifier from file: " << path_r.asString() << endl;
+          return;
+        }
+        getline( inp, _mediaVendor );
+        getline( inp, _mediaIdent );
+        std::string buffer;
+        getline( inp, buffer );
+        str::strtonum( buffer, _totalMedia );
+        //if ( !_totalMedia ) _totalMedia = 1;
       }
 
       /** Validate object in a boolean context: valid */
@@ -93,19 +93,19 @@ namespace zypp
 
       Pathname mediaFilePath( media::MediaNr mediaNr_r = 0 ) const
       {
-       str::Format fmt { "/media.%d/media" };
-       fmt % str::numstring( mediaNr_r ? mediaNr_r : _mediaNr );
-       return fmt.str();
+        str::Format fmt { "/media.%d/media" };
+        fmt % str::numstring( mediaNr_r ? mediaNr_r : _mediaNr );
+        return fmt.str();
       }
 
       std::string expectedAsUserString() const
       {
-       // Translator: %1% the expected medium number; %2% the total number of media in the set; %3% the ident file on the medium.
-       str::Format fmt { _("Expected medium %1%/%2% identified by file '%3%' with content:") };
-       return str::Str()
-       << ( fmt % mediaNr() % smvData()._totalMedia % mediaFilePath() ) << endl
-       << "    " << smvData()._mediaVendor  << endl
-       << "    " << smvData()._mediaIdent;
+        // Translator: %1% the expected medium number; %2% the total number of media in the set; %3% the ident file on the medium.
+        str::Format fmt { _("Expected medium %1%/%2% identified by file '%3%' with content:") };
+        return str::Str()
+        << ( fmt % mediaNr() % smvData()._totalMedia % mediaFilePath() ) << endl
+        << "    " << smvData()._mediaVendor  << endl
+        << "    " << smvData()._mediaIdent;
       }
 
     private:
@@ -155,7 +155,7 @@ namespace zypp
 
       const SMVData & smvData = _pimpl->smvData();
       if ( ! smvData )
-       return ret;     // we have no valid data
+        return ret;    // we have no valid data
 
       // bsc#1180851: If there is just one not-volatile medium in the set
       // tolerate a missing (vanished) media identifier and let the URL rule.
@@ -165,33 +165,33 @@ namespace zypp
 
       Pathname mediaFile { _pimpl->mediaFilePath() };
       try {
-       ref.provideFile( OnMediaLocation(mediaFile) );
-       mediaFile = ref.localPath( mediaFile );
+        ref.provideFile( OnMediaLocation(mediaFile) );
+        mediaFile = ref.localPath( mediaFile );
       }
       catch ( media::MediaFileNotFoundException & excpt_r )
       {
-       if ( relaxed ) {
-         ZYPP_CAUGHT( excpt_r );
-         return ret;
-       }
-       excpt_r.addHistory( _pimpl->expectedAsUserString() );
-       ZYPP_RETHROW( excpt_r );
+        if ( relaxed ) {
+          ZYPP_CAUGHT( excpt_r );
+          return ret;
+        }
+        excpt_r.addHistory( _pimpl->expectedAsUserString() );
+        ZYPP_RETHROW( excpt_r );
       }
       catch ( media::MediaNotAFileException & excpt_r )
       {
-       if ( relaxed ) {
-         ZYPP_CAUGHT( excpt_r );
-         return ret;
-       }
-       excpt_r.addHistory( _pimpl->expectedAsUserString() );
-       ZYPP_CAUGHT( excpt_r ); return ret;
+        if ( relaxed ) {
+          ZYPP_CAUGHT( excpt_r );
+          return ret;
+        }
+        excpt_r.addHistory( _pimpl->expectedAsUserString() );
+        ZYPP_CAUGHT( excpt_r ); return ret;
       }
 
       SMVData remote { mediaFile };
       ret = smvData.matches( remote );
       if ( ! ret ) {
-       DBG << "expect: " << smvData << " medium " << mediaNr() << endl;
-       DBG << "remote: " << remote  << endl;
+        DBG << "expect: " << smvData << " medium " << mediaNr() << endl;
+        DBG << "remote: " << remote  << endl;
       }
       return ret;
     }
index 68c5ee7..1a04a78 100644 (file)
@@ -26,33 +26,33 @@ namespace zypp
     struct RIMServiceRepos : public ServiceRepos::Impl
     {
       RIMServiceRepos( const Pathname & /*root_r*/,
-                      const ServiceInfo & service,
-                      const ServiceRepos::ProcessRepo & callback,
-                      const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() )
+                       const ServiceInfo & service,
+                       const ServiceRepos::ProcessRepo & callback,
+                       const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() )
       {
-       // repoindex.xml must be fetched always without using cookies (bnc #573897)
-       Url serviceUrl( service.url() );
-       serviceUrl.setQueryParam( "cookies", "0" );
+        // repoindex.xml must be fetched always without using cookies (bnc #573897)
+        Url serviceUrl( service.url() );
+        serviceUrl.setQueryParam( "cookies", "0" );
 
-       // download the repo index file
-       media::MediaManager mediamanager;
-       media::MediaAccessId mid = mediamanager.open( serviceUrl );
-       mediamanager.attach( mid );
+        // download the repo index file
+        media::MediaManager mediamanager;
+        media::MediaAccessId mid = mediamanager.open( serviceUrl );
+        mediamanager.attach( mid );
         mediamanager.provideFile( mid, OnMediaLocation("repo/repoindex.xml") );
-       Pathname path = mediamanager.localPath(mid, "repo/repoindex.xml" );
-       try {
-         parser::RepoindexFileReader reader(path, callback);
-         service.setProbedTtl( reader.ttl() ); // hack! Modifying the const Service to set parsed TTL
-         mediamanager.release( mid );
-         mediamanager.close( mid );
-       } catch ( const Exception &e ) {
-         //Reader throws a bare exception, we need to translate it into something our calling
-         //code expects and handles (bnc#1116840)
-         ZYPP_CAUGHT ( e );
-         ServicePluginInformalException ex ( e.msg() );
-         ex.remember( e );
-         ZYPP_THROW( ex );
-       }
+        Pathname path = mediamanager.localPath(mid, "repo/repoindex.xml" );
+        try {
+          parser::RepoindexFileReader reader(path, callback);
+          service.setProbedTtl( reader.ttl() );        // hack! Modifying the const Service to set parsed TTL
+          mediamanager.release( mid );
+          mediamanager.close( mid );
+        } catch ( const Exception &e ) {
+          //Reader throws a bare exception, we need to translate it into something our calling
+          //code expects and handles (bnc#1116840)
+          ZYPP_CAUGHT ( e );
+          ServicePluginInformalException ex ( e.msg() );
+          ex.remember( e );
+          ZYPP_THROW( ex );
+        }
       }
     };
 
@@ -61,42 +61,42 @@ namespace zypp
     struct PluginServiceRepos : public ServiceRepos::Impl
     {
       PluginServiceRepos( const Pathname & root_r,
-                         const ServiceInfo & service,
-                         const ServiceRepos::ProcessRepo & callback,
-                         const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() )
+                          const ServiceInfo & service,
+                          const ServiceRepos::ProcessRepo & callback,
+                          const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() )
       {
-       // bsc#1080693: Service script needs to be executed chrooted to the RepoManagers rootDir.
-       // The service is not aware of the rootDir, so it's explicitly passed and needs to be
-       // stripped from the URLs path.
-       stringstream buffer;
+        // bsc#1080693: Service script needs to be executed chrooted to the RepoManagers rootDir.
+        // The service is not aware of the rootDir, so it's explicitly passed and needs to be
+        // stripped from the URLs path.
+        stringstream buffer;
 
-       ExternalProgram::Arguments args;
-       args.reserve( 3 );
-       args.push_back( "/bin/sh" );
-       args.push_back( "-c" );
-       args.push_back( Pathname::stripprefix( root_r, service.url().getPathName() ).asString() );
-       ExternalProgramWithStderr prog( args, root_r );
-       prog >> buffer;
+        ExternalProgram::Arguments args;
+        args.reserve( 3 );
+        args.push_back( "/bin/sh" );
+        args.push_back( "-c" );
+        args.push_back( Pathname::stripprefix( root_r, service.url().getPathName() ).asString() );
+        ExternalProgramWithStderr prog( args, root_r );
+        prog >> buffer;
 
-       if ( prog.close() != 0 )
-       {
-         // ServicePluginInformalException:
-         // Ignore this error but we'd like to report it somehow...
-         std::string errbuffer;
-         prog.stderrGetUpTo( errbuffer, '\0' );
-         ERR << "Capture plugin error:[" << endl << errbuffer << endl << ']' << endl;
-         ZYPP_THROW( repo::ServicePluginInformalException( service, errbuffer ) );
-       }
-       parser::RepoFileReader parser( buffer, callback );
+        if ( prog.close() != 0 )
+        {
+          // ServicePluginInformalException:
+          // Ignore this error but we'd like to report it somehow...
+          std::string errbuffer;
+          prog.stderrGetUpTo( errbuffer, '\0' );
+          ERR << "Capture plugin error:[" << endl << errbuffer << endl << ']' << endl;
+          ZYPP_THROW( repo::ServicePluginInformalException( service, errbuffer ) );
+        }
+        parser::RepoFileReader parser( buffer, callback );
       }
     };
 
     ///////////////////////////////////////////////////////////////////
 
     ServiceRepos::ServiceRepos( const Pathname & root_r,
-                               const ServiceInfo & service,
-                               const ServiceRepos::ProcessRepo & callback,
-                               const ProgressData::ReceiverFnc &progress )
+                                const ServiceInfo & service,
+                                const ServiceRepos::ProcessRepo & callback,
+                                const ProgressData::ReceiverFnc &progress )
     : _impl( ( service.type() == ServiceType::PLUGIN )
     ? static_cast<ServiceRepos::Impl*>( new PluginServiceRepos( root_r, service, callback, progress ) )
     : static_cast<ServiceRepos::Impl*>( new RIMServiceRepos( root_r, service, callback, progress ) ) )
index 66ddbb6..71f6efe 100644 (file)
@@ -36,7 +36,7 @@ namespace zypp
        * Required to execute plugin services chrooted.
        */
       ServiceRepos( const Pathname & root_r,
-                   const ServiceInfo & service,
+                    const ServiceInfo & service,
                     const ProcessRepo & callback,
                     const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() );
       ~ServiceRepos();
index c1757a2..6573b32 100644 (file)
@@ -97,21 +97,21 @@ void Downloader::download( MediaSetAccess &media,
       str::smatch what;
       if ( str::regex_match( it->first, what, rx_packages ) )
       {
-       if ( what[4].empty() // packages(.gz)?
-         || what[4] == "DU"
-         || what[4] == "en" )
-       { ; /* always downloaded */ }
-       else if ( what[4] == "FL" )
-       { continue; /* never downloaded */ }
-       else
-       {
-         // remember and decide later
-         availablePackageTranslations[what[4]] = it;
-         continue;
-       }
+        if ( what[4].empty() // packages(.gz)?
+          || what[4] == "DU"
+          || what[4] == "en" )
+        { ; /* always downloaded */ }
+        else if ( what[4] == "FL" )
+        { continue; /* never downloaded */ }
+        else
+        {
+          // remember and decide later
+          availablePackageTranslations[what[4]] = it;
+          continue;
+        }
       }
       else
-       continue; // discard
+        continue; // discard
     }
     else if ( it->first == "patterns.pat"
               || it->first == "patterns.pat.gz" )
@@ -166,17 +166,17 @@ void Downloader::download( MediaSetAccess &media,
     auto fnc_checkTransaltions( [&]( const Locale & locale_r ) {
       for ( Locale toGet( locale_r ); toGet; toGet = toGet.fallback() )
       {
-       auto it( availablePackageTranslations.find( toGet.code() ) );
-       if ( it != availablePackageTranslations.end() )
-       {
-         auto mit( it->second );
-         MIL << "adding job " << mit->first << endl;
+        auto it( availablePackageTranslations.find( toGet.code() ) );
+        if ( it != availablePackageTranslations.end() )
+        {
+          auto mit( it->second );
+          MIL << "adding job " << mit->first << endl;
           auto location = std::move( OnMediaLocation( repoInfo().path() + descr_dir + mit->first, 1 )
                                        .setChecksum( mit->second )
                                        .setDeltafile( search_deltafile(_delta_dir + descr_dir, mit->first) ));
-         enqueueDigested(location, FileChecker());
-         break;
-       }
+          enqueueDigested(location, FileChecker());
+          break;
+        }
       }
     });
     for ( const Locale & it : ZConfig::instance().repoRefreshLocales() )
index 26b47c7..ab140d8 100644 (file)
@@ -25,7 +25,7 @@ namespace zypp
   {
     namespace susetags
     {
-  
+
       /**
        * \short Downloader for SUSETags (YaST2) repositories
        * Encapsulates all the knowledge of which files have
@@ -58,7 +58,7 @@ namespace zypp
          * \short Status of the remote repository
          */
         RepoStatus status( MediaSetAccess &media ) override;
-        
+
         /**
          * Content file parser consumer
          */
@@ -66,7 +66,7 @@ namespace zypp
 
       private:
         parser::susetags::RepoIndex_Ptr _repoindex;
-       Pathname _delta_dir;
+        Pathname _delta_dir;
       };
 
     } // ns susetags
index c0a31df..90bbbf2 100644 (file)
@@ -35,7 +35,7 @@ namespace yum
     inline OnMediaLocation loc_with_path_prefix( OnMediaLocation loc_r, const Pathname & prefix_r )
     {
       if ( ! prefix_r.empty() && prefix_r != "/" )
-       loc_r.changeFilename( prefix_r / loc_r.filename() );
+        loc_r.changeFilename( prefix_r / loc_r.filename() );
       return loc_r;
     }
 
@@ -44,23 +44,23 @@ namespace yum
     {
       Pathname deltafile;
       if ( ! PathInfo(dir).isDir() )
-       return deltafile;
+        return deltafile;
 
       // Strip the checksum preceding the file stem so we can look for an
       // old *-primary.xml which may contain some reusable blocks.
       std::string base { file.basename() };
       size_t hypoff = base.find( "-" );
       if ( hypoff != std::string::npos )
-       base.replace( 0, hypoff + 1, "" );
+        base.replace( 0, hypoff + 1, "" );
 
       std::list<std::string> retlist;
       if ( ! filesystem::readdir( retlist, dir, false ) )
       {
-       for ( const auto & fn : retlist )
-       {
-         if ( str::endsWith( fn, base ) )
-           deltafile = fn;
-       }
+        for ( const auto & fn : retlist )
+        {
+          if ( str::endsWith( fn, base ) )
+            deltafile = fn;
+        }
       }
       return deltafile;
     }
@@ -92,7 +92,7 @@ namespace yum
     {
       addWantedLocale( ZConfig::instance().textLocale() );
       for ( const Locale & it : ZConfig::instance().repoRefreshLocales() )
-       addWantedLocale( it );
+        addWantedLocale( it );
     }
 
     /** The callback invoked by the RepomdFileReader.
@@ -102,32 +102,32 @@ namespace yum
     bool operator()( const OnMediaLocation & loc_r, const std::string & typestr_r )
     {
       if ( str::endsWith( typestr_r, "_db" ) )
-       return true;    // skip sqlitedb
+        return true;   // skip sqlitedb
 
       bool zchk { str::endsWith( typestr_r, "_zck" ) };
 #if defined(LIBSOLVEXT_FEATURE_ZCHUNK_COMPRESSION)
       const std::string & basetype { zchk ? typestr_r.substr( 0, typestr_r.size()-4 ) : typestr_r };
 #else
       if ( zchk )
-       return true;    // skip zchunk if not supported by libsolv
+        return true;   // skip zchunk if not supported by libsolv
       const std::string & basetype { typestr_r };
 #endif
 
       // filter well known resource types
       if ( basetype == "other" || basetype == "filelists" )
-       return true;    // skip it
+        return true;   // skip it
 
       // filter localized susedata
       if ( str::startsWith( basetype, "susedata." ) )
       {
-       // susedata.LANG
-       if ( ! wantLocale( Locale(basetype.c_str()+9) ) )
-         return true;  // skip it
+        // susedata.LANG
+        if ( ! wantLocale( Locale(basetype.c_str()+9) ) )
+          return true; // skip it
       }
 
       // may take it... (prefer zchnk)
       if ( zchk || !_wantedFiles.count( basetype ) )
-       _wantedFiles[basetype] = loc_r;
+        _wantedFiles[basetype] = loc_r;
 
       return true;
     }
@@ -137,8 +137,8 @@ namespace yum
       // schedule fileS for download
       for ( const auto & el : _wantedFiles )
       {
-       const OnMediaLocation & loc { el.second };
-       const OnMediaLocation & loc_with_path { loc_with_path_prefix( loc, _downloader.repoInfo().path() ) };
+        const OnMediaLocation & loc { el.second };
+        const OnMediaLocation & loc_with_path { loc_with_path_prefix( loc, _downloader.repoInfo().path() ) };
         _downloader.enqueueDigested( OnMediaLocation(loc_with_path).setDeltafile( search_deltafile( deltaDir()/"repodata", loc.filename() ) ), FileChecker() );
       }
     }
@@ -154,8 +154,8 @@ namespace yum
     {
       while ( locale_r )
       {
-       _wantedLocales.insert( locale_r );
-       locale_r = locale_r.fallback();
+        _wantedLocales.insert( locale_r );
+        locale_r = locale_r.fallback();
       }
     }
 
index 7d25ee3..79c4a79 100644 (file)
@@ -68,9 +68,9 @@ namespace zypp
         RepoStatus status( MediaSetAccess & media_r ) override;
 
       private:
-       class Impl;
-       friend class Impl;
-       Pathname _deltaDir;
+        class Impl;
+        friend class Impl;
+        Pathname _deltaDir;
       };
 
     } // ns yum
index 88eb4c4..820e7d4 100644 (file)
@@ -29,80 +29,80 @@ namespace zypp
     {
       if ( lhsFilename() == rhsFilename() )
       {
-       static const char * text[2][2] = {{ // [lhs][rhs] 0 = installed; 1 = to be installed
-           // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
-           N_( "File %1%\n"
-               "  from package\n"
-               "     %2%\n"
-               "  conflicts with file from package\n"
-               "     %3%" ),
-           // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
-           N_( "File %1%\n"
-               "  from package\n"
-               "     %2%\n"
-               "  conflicts with file from install of\n"
-               "     %3%" )
-       },{
-           // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
-           N_( "File %1%\n"
-               "  from install of\n"
-               "     %2%\n"
-               "  conflicts with file from package\n"
-               "     %3%" ),
-           // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
-           N_( "File %1%\n"
-               "  from install of\n"
-               "     %2%\n"
-               "  conflicts with file from install of\n"
-               "     %3%" )
-       }};
-       return str::Format( text[lhsSolvable().isSystem()?0:1][rhsSolvable().isSystem()?0:1] )
-              % lhsFilename()
-              % lhsSolvable().asUserString()
-              % rhsSolvable().asUserString();
+        static const char * text[2][2] = {{ // [lhs][rhs] 0 = installed; 1 = to be installed
+            // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
+            N_( "File %1%\n"
+                "  from package\n"
+                "     %2%\n"
+                "  conflicts with file from package\n"
+                "     %3%" ),
+            // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
+            N_( "File %1%\n"
+                "  from package\n"
+                "     %2%\n"
+                "  conflicts with file from install of\n"
+                "     %3%" )
+        },{
+            // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
+            N_( "File %1%\n"
+                "  from install of\n"
+                "     %2%\n"
+                "  conflicts with file from package\n"
+                "     %3%" ),
+            // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2)
+            N_( "File %1%\n"
+                "  from install of\n"
+                "     %2%\n"
+                "  conflicts with file from install of\n"
+                "     %3%" )
+        }};
+        return str::Format( text[lhsSolvable().isSystem()?0:1][rhsSolvable().isSystem()?0:1] )
+               % lhsFilename()
+               % lhsSolvable().asUserString()
+               % rhsSolvable().asUserString();
       }
       else
       {
-       static const char * text[2][2] = {{ // [lhs][rhs] 0 = installed; 1 = to be installed
-           // TranslatorExplanation %1%(filename1) %2%(package1) %%3%(filename2) 4%(package2)
-           N_( "File %1%\n"
-               "  from package\n"
-               "     %2%\n"
-               "  conflicts with file\n"
-               "     %3%\n"
-               "  from package\n"
-               "     %4%" ),
-           // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2)
-           N_( "File %1%\n"
-               "  from package\n"
-               "     %2%\n"
-               "  conflicts with file\n"
-               "     %3%\n"
-               "  from install of\n"
-               "     %4%" )
-       },{
-           // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2)
-           N_( "File %1%\n"
-               "  from install of\n"
-               "     %2%\n"
-               "  conflicts with file\n"
-               "     %3%\n"
-               "  from package\n"
-               "     %4%" ),
-           // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2)
-           N_( "File %1%\n"
-               "  from install of\n"
-               "     %2%\n"
-               "  conflicts with file\n"
-               "     %3%\n"
-               "  from install of\n"
-               "     %4%" )
-       }};
-       return str::Format( text[lhsSolvable().isSystem()?0:1][rhsSolvable().isSystem()?0:1] )
-              % lhsFilename()
-              % lhsSolvable().asUserString()
-              % rhsFilename()
-              % rhsSolvable().asUserString();
+        static const char * text[2][2] = {{ // [lhs][rhs] 0 = installed; 1 = to be installed
+            // TranslatorExplanation %1%(filename1) %2%(package1) %%3%(filename2) 4%(package2)
+            N_( "File %1%\n"
+                "  from package\n"
+                "     %2%\n"
+                "  conflicts with file\n"
+                "     %3%\n"
+                "  from package\n"
+                "     %4%" ),
+            // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2)
+            N_( "File %1%\n"
+                "  from package\n"
+                "     %2%\n"
+                "  conflicts with file\n"
+                "     %3%\n"
+                "  from install of\n"
+                "     %4%" )
+        },{
+            // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2)
+            N_( "File %1%\n"
+                "  from install of\n"
+                "     %2%\n"
+                "  conflicts with file\n"
+                "     %3%\n"
+                "  from package\n"
+                "     %4%" ),
+            // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2)
+            N_( "File %1%\n"
+                "  from install of\n"
+                "     %2%\n"
+                "  conflicts with file\n"
+                "     %3%\n"
+                "  from install of\n"
+                "     %4%" )
+        }};
+        return str::Format( text[lhsSolvable().isSystem()?0:1][rhsSolvable().isSystem()?0:1] )
+               % lhsFilename()
+               % lhsSolvable().asUserString()
+               % rhsFilename()
+               % rhsSolvable().asUserString();
       }
     }
 
@@ -112,20 +112,20 @@ namespace zypp
     std::ostream & operator<<( std::ostream & str, const FileConflicts::Conflict & obj )
     {
       if ( obj.lhsFilename() == obj.rhsFilename() )
-       return str << str::Format( "%s:\n    %s[%s]\n    %s[%s]" )
-                     % obj.lhsFilename()
-                     % obj.lhsSolvable()
-                     % obj.lhsFilemd5()
-                     % obj.rhsSolvable()
-                     % obj.rhsFilemd5();
+        return str << str::Format( "%s:\n    %s[%s]\n    %s[%s]" )
+                      % obj.lhsFilename()
+                      % obj.lhsSolvable()
+                      % obj.lhsFilemd5()
+                      % obj.rhsSolvable()
+                      % obj.rhsFilemd5();
 
       return str << str::Format( "%s - %s:\n    %s[%s]\n    %s[%s]" )
-                   % obj.lhsFilename()
-                   % obj.rhsFilename()
-                   % obj.lhsSolvable()
-                   % obj.lhsFilemd5()
-                   % obj.rhsSolvable()
-                   % obj.rhsFilemd5();
+                    % obj.lhsFilename()
+                    % obj.rhsFilename()
+                    % obj.lhsSolvable()
+                    % obj.lhsFilemd5()
+                    % obj.rhsSolvable()
+                    % obj.rhsFilemd5();
     }
 
 
@@ -134,9 +134,9 @@ namespace zypp
       xmlout::Node guard( str, "fileconflicts", { "size", obj.size() } );
       if ( ! obj.empty() )
       {
-       *guard << "\n";
-       for ( const auto & el : obj )
-         dumpAsXmlOn( *guard, el ) << "\n";
+        *guard << "\n";
+        for ( const auto & el : obj )
+          dumpAsXmlOn( *guard, el ) << "\n";
       }
       return str;
     }
@@ -145,11 +145,11 @@ namespace zypp
     {
       std::ostream & dumpAsXmlHelper( std::ostream & str, const std::string & tag_r, IdString filename_r, IdString md5sum_r, Solvable solv_r )
       {
-       xmlout::Node guard( str, tag_r );
-       *xmlout::Node( *guard, "file" ) << filename_r;
-       dumpAsXmlOn( *guard, CheckSum( md5sum_r.asString() ) );
-       dumpAsXmlOn( *guard, solv_r );
-       return str;
+        xmlout::Node guard( str, tag_r );
+        *xmlout::Node( *guard, "file" ) << filename_r;
+        dumpAsXmlOn( *guard, CheckSum( md5sum_r.asString() ) );
+        dumpAsXmlOn( *guard, solv_r );
+        return str;
       }
     }
 
index aa199a3..599727f 100644 (file)
@@ -39,19 +39,19 @@ namespace zypp
        */
       struct Conflict
       {
-       IdString lhsFilename() const    { return IdString( _data[0] ); }
-       Solvable lhsSolvable() const    { return Solvable( _data[1] ); }
-       IdString lhsFilemd5() const     { return IdString( _data[2] ); }
+        IdString lhsFilename() const   { return IdString( _data[0] ); }
+        Solvable lhsSolvable() const   { return Solvable( _data[1] ); }
+        IdString lhsFilemd5() const    { return IdString( _data[2] ); }
 
-       IdString rhsFilename() const    { return IdString( _data[3] ); }
-       Solvable rhsSolvable() const    { return Solvable( _data[4] ); }
-       IdString rhsFilemd5() const     { return IdString( _data[5] ); }
+        IdString rhsFilename() const   { return IdString( _data[3] ); }
+        Solvable rhsSolvable() const   { return Solvable( _data[4] ); }
+        IdString rhsFilemd5() const    { return IdString( _data[5] ); }
 
-       /** Ready to use (translated) string describing the Conflict */
-       std::string asUserString() const;
+        /** Ready to use (translated) string describing the Conflict */
+        std::string asUserString() const;
 
       private:
-       detail::IdType _data[queueBlockSize];
+        detail::IdType _data[queueBlockSize];
       };
 
     public:
index 79f5638..ae34ae0 100644 (file)
@@ -321,7 +321,7 @@ namespace zypp
         {
           _dip = new ::Dataiterator;
           ::dataiterator_init_clone( _dip, rhs._dip );
-         ::dataiterator_strdup( _dip );
+          ::dataiterator_strdup( _dip );
         }
       }
 
@@ -597,10 +597,10 @@ namespace zypp
             break;
 
           case REPOKEY_TYPE_DIRSTRARRAY:
-           // may or may not be stringified depending on SEARCH_FILES flag
+            // may or may not be stringified depending on SEARCH_FILES flag
             return( _dip->flags & SEARCH_FILES
-                   ? _dip->kv.str
-                   : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
+                    ? _dip->kv.str
+                    : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
             break;
         }
       }
@@ -766,15 +766,15 @@ namespace zypp
     {
       if ( _dip )
       {
-       if ( ! ::dataiterator_step( _dip.get() ) )
-       {
-         _dip.reset();
-         base_reference() = 0;
-       }
-       else
-       {
-         ::dataiterator_strdup( _dip.get() );
-       }
+        if ( ! ::dataiterator_step( _dip.get() ) )
+        {
+          _dip.reset();
+          base_reference() = 0;
+        }
+        else
+        {
+          ::dataiterator_strdup( _dip.get() );
+        }
       }
     }
 
index 3a5831d..1da5469 100644 (file)
@@ -159,7 +159,7 @@ namespace zypp
 
         /** TransformIterator returning an \ref iterator vaue of type \c TResult. */
         template<class TResult, class TAttr = TResult>
-       class TransformIterator;
+        class TransformIterator;
         //@}
 
       public:
@@ -331,7 +331,7 @@ namespace zypp
           detail::CDataiterator * get()        const  { return _dip; }
           const std::string & getstr()   const  { return _mstring; }
 
-       private:
+        private:
           detail::CDataiterator * _dip;
           std::string _mstring;
       };
@@ -512,7 +512,7 @@ namespace zypp
          * via \ref c_str and \ref asString.
          */
         IdString idStr() const;
-       /** \overload Directly returning the \c Id */
+        /** \overload Directly returning the \c Id */
         detail::IdType id() const
         { return idStr().id(); }
 
index 717d87d..d55ca01 100644 (file)
@@ -73,7 +73,7 @@ namespace zypp
     void Map::assignAll( bool val_r )
     {
       if ( _pimpl->size )
-       ::memset( _pimpl->map, (val_r?-1:0), _pimpl->size );
+        ::memset( _pimpl->map, (val_r?-1:0), _pimpl->size );
     }
 
 #define M_RANGE_CKECK(IDX,LOC) if ( ((IDX) >> 3) >= size_type(_pimpl->size) ) throw std::out_of_range( "zypp::sat::Map::" LOC )
@@ -108,13 +108,13 @@ namespace zypp
     std::string Map::asString( const char on_r, const char off_r ) const
     {
       if ( empty() )
-       return std::string();
+        return std::string();
 
       std::string ret( size(), off_r );
       for_( idx, size_type(0), size() )
       {
-       if ( test( idx ) )
-         ret[idx] = on_r;
+        if ( test( idx ) )
+          ret[idx] = on_r;
       }
       return ret;
     }
index 5cd86ac..3eeddbe 100644 (file)
@@ -77,9 +77,9 @@ namespace zypp
     {
       if ( myPool()->urepos )
       { // repos[0] == NULL
-       for_( it, myPool()->repos+1, myPool()->repos+myPool()->nrepos )
-         if ( *it )
-           return RepositoryIterator( it );
+        for_( it, myPool()->repos+1, myPool()->repos+myPool()->nrepos )
+          if ( *it )
+            return RepositoryIterator( it );
       }
       return reposEnd();
     }
@@ -276,7 +276,7 @@ namespace zypp
       return str << "sat::pool(" << obj.serial() << ")["
           << obj.capacity() << "]{"
           << obj.reposSize() << "repos|"
-         << obj.solvablesSize() << "solv}";
+          << obj.solvablesSize() << "solv}";
     }
 
     /////////////////////////////////////////////////////////////////
@@ -288,25 +288,25 @@ namespace zypp
       AutoDispose<FILE*> solv( ::fopen( solvfile_r.c_str(), "re" ), ::fclose );
       if ( solv == NULL )
       {
-       solv.resetDispose();
-       ERR << "Can't open solv-file: " << solv << endl;
-       return;
+        solv.resetDispose();
+        ERR << "Can't open solv-file: " << solv << endl;
+        return;
       }
 
       std::string solvidxfile( solvfile_r.extend(".idx").asString() );
       if ( ::unlink( solvidxfile.c_str() ) == -1 && errno != ENOENT )
       {
-       ERR << "Can't unlink solv-idx: " << Errno() << endl;
-       return;
+        ERR << "Can't unlink solv-idx: " << Errno() << endl;
+        return;
       }
       {
-       int fd = ::open( solvidxfile.c_str(), O_CREAT|O_EXCL|O_WRONLY|O_TRUNC, 0644 );
-       if ( fd == -1 )
-       {
-         ERR << "Can't create solv-idx: " << Errno() << endl;
-         return;
-       }
-       ::close( fd );
+        int fd = ::open( solvidxfile.c_str(), O_CREAT|O_EXCL|O_WRONLY|O_TRUNC, 0644 );
+        if ( fd == -1 )
+        {
+          ERR << "Can't create solv-idx: " << Errno() << endl;
+          return;
+        }
+        ::close( fd );
       }
       std::ofstream idx( solvidxfile.c_str() );
 
@@ -315,24 +315,24 @@ namespace zypp
       detail::CRepo * _repo = ::repo_create( _pool, "" );
       if ( ::repo_add_solv( _repo, solv, 0 ) == 0 )
       {
-       int _id = 0;
-       detail::CSolvable * _solv = nullptr;
-       FOR_REPO_SOLVABLES( _repo, _id, _solv )
-       {
-         if ( _solv )
-         {
+        int _id = 0;
+        detail::CSolvable * _solv = nullptr;
+        FOR_REPO_SOLVABLES( _repo, _id, _solv )
+        {
+          if ( _solv )
+          {
 #define SEP '\t'
 #define        idstr(V) pool_id2str( _pool, _solv->V )
-           if ( _solv->arch == ARCH_SRC || _solv->arch == ARCH_NOSRC )
-             idx << "srcpackage:" << idstr(name) << SEP << idstr(evr) << SEP << "noarch" << endl;
-           else
-             idx << idstr(name) << SEP << idstr(evr) << SEP << idstr(arch) << endl;
-         }
-       }
+            if ( _solv->arch == ARCH_SRC || _solv->arch == ARCH_NOSRC )
+              idx << "srcpackage:" << idstr(name) << SEP << idstr(evr) << SEP << "noarch" << endl;
+            else
+              idx << idstr(name) << SEP << idstr(evr) << SEP << idstr(arch) << endl;
+          }
+        }
       }
       else
       {
-       ERR << "Can't read solv-file: " << ::pool_errstr( _pool ) << endl;
+        ERR << "Can't read solv-file: " << ::pool_errstr( _pool ) << endl;
       }
       ::repo_free( _repo, 0 );
       ::pool_free( _pool );
index de5174d..725fde3 100644 (file)
@@ -47,7 +47,7 @@ namespace zypp
     {
       public:
         typedef detail::SolvableIterator SolvableIterator;
-       typedef zypp::detail::RepositoryIterator     RepositoryIterator;
+        typedef zypp::detail::RepositoryIterator     RepositoryIterator;
         typedef detail::size_type        size_type;
 
       public:
@@ -72,11 +72,11 @@ namespace zypp
         /** Update housekeeping data if necessary (e.g. whatprovides). */
         void prepare() const;
 
-       /** Get rootdir (for file conflicts check) */
-       Pathname rootDir() const;
+        /** Get rootdir (for file conflicts check) */
+        Pathname rootDir() const;
 
-       /** Set rootdir (for file conflicts check) */
-       void rootDir( const Pathname & root_r );
+        /** Set rootdir (for file conflicts check) */
+        void rootDir( const Pathname & root_r );
 
       public:
         /** Whether \ref Pool contains repos. */
@@ -91,9 +91,9 @@ namespace zypp
         /** Iterator behind the last \ref Repository. */
         RepositoryIterator reposEnd() const;
 
-       /** Iterate the repositories. */
-       Iterable<RepositoryIterator> repos() const
-       { return makeIterable( reposBegin(), reposEnd() ); }
+        /** Iterate the repositories. */
+        Iterable<RepositoryIterator> repos() const
+        { return makeIterable( reposBegin(), reposEnd() ); }
 
         /** Return a \ref Repository named \c alias_r.
          * It a such a \ref Repository does not already exist
@@ -113,11 +113,11 @@ namespace zypp
         { reposFind( alias_r ).eraseFromPool(); }
 
         /** Remove all repos from the pool.
-        * This also shrinks a pool which may have become large
-        * after having added and removed repos lots of times.
-        */
+         * This also shrinks a pool which may have become large
+         * after having added and removed repos lots of times.
+         */
         void reposEraseAll()
-       { while ( ! reposEmpty() ) reposErase( reposBegin()->alias() ); }
+        { while ( ! reposEmpty() ) reposErase( reposBegin()->alias() ); }
 
       public:
         /** Reserved system repository alias \c @System. */
@@ -171,9 +171,9 @@ namespace zypp
         /** Iterator behind the last \ref Solvable. */
         SolvableIterator solvablesEnd() const;
 
-       /** Iterate the solvables. */
-       Iterable<SolvableIterator> solvables() const
-       { return makeIterable( solvablesBegin(), solvablesEnd() ); }
+        /** Iterate the solvables. */
+        Iterable<SolvableIterator> solvables() const
+        { return makeIterable( solvablesBegin(), solvablesEnd() ); }
 
       public:
         /** \name Iterate all Solvables matching a \c TFilter. */
@@ -199,10 +199,10 @@ namespace zypp
       public:
         /** \name Requested locales. */
         //@{
-       /** Set the default language for retrieving translated texts.
-        * Updated when calling \ref ZConfig::setTextLocale.
-        */
-       void setTextLocale( const Locale & locale_r );
+        /** Set the default language for retrieving translated texts.
+         * Updated when calling \ref ZConfig::setTextLocale.
+         */
+        void setTextLocale( const Locale & locale_r );
 
         /** Set the requested locales.
          * Languages to be supported by the system, e.g. language specific
@@ -229,14 +229,14 @@ namespace zypp
         bool isRequestedLocale( const Locale & locale_r ) const;
 
 
-       /** Start tracking changes based on this \a locales_r. */
-       void initRequestedLocales( const LocaleSet & locales_r );
+        /** Start tracking changes based on this \a locales_r. */
+        void initRequestedLocales( const LocaleSet & locales_r );
 
-       /** Added since last initRequestedLocales. */
-       const LocaleSet & getAddedRequestedLocales() const;
+        /** Added since last initRequestedLocales. */
+        const LocaleSet & getAddedRequestedLocales() const;
 
-       /** Removed since last initRequestedLocales.*/
-       const LocaleSet & getRemovedRequestedLocales() const;
+        /** Removed since last initRequestedLocales.*/
+        const LocaleSet & getRemovedRequestedLocales() const;
 
 
         /** Get the set of available locales.
@@ -250,25 +250,25 @@ namespace zypp
         //@}
 
       public:
-       /** \name Multiversion install.
-        * Whether the pool contains packages which are multiversion installable.
-        * \see \ref Solvable::multiversionInstall
-        * \see \ref ZConfig::multiversionSpec
-        */
-       //@{
-       typedef SolvableSet MultiversionList;
-       const MultiversionList & multiversion() const;
-       /** \deprecated Legacy, use multiversion().empty() instead. */
-       ZYPP_DEPRECATED bool multiversionEmpty() const { return multiversion().empty(); }
-       //@}
+        /** \name Multiversion install.
+         * Whether the pool contains packages which are multiversion installable.
+         * \see \ref Solvable::multiversionInstall
+         * \see \ref ZConfig::multiversionSpec
+         */
+        //@{
+        typedef SolvableSet MultiversionList;
+        const MultiversionList & multiversion() const;
+        /** \deprecated Legacy, use multiversion().empty() instead. */
+        ZYPP_DEPRECATED bool multiversionEmpty() const { return multiversion().empty(); }
+        //@}
 
       public:
         /** \name Autoinstalled */
         //@{
         /** Get ident list of all autoinstalled solvables. */
-       Queue autoInstalled() const;
-       /** Set ident list of all autoinstalled solvables. */
-       void setAutoInstalled( const Queue & autoInstalled_r );
+        Queue autoInstalled() const;
+        /** Set ident list of all autoinstalled solvables. */
+        void setAutoInstalled( const Queue & autoInstalled_r );
         //@}
 
       public:
index 7683827..c4bccd0 100644 (file)
@@ -58,22 +58,22 @@ namespace zypp
     Queue::const_iterator Queue::find( value_type val_r ) const
     {
       for_( it, begin(), end() )
-       if ( *it == val_r )
-         return it;
+        if ( *it == val_r )
+          return it;
       return end();
     }
 
     Queue::value_type Queue::first() const
     {
       if ( _pimpl->count )
-       return *_pimpl->elements;
+        return *_pimpl->elements;
       return 0;
     }
 
     Queue::value_type Queue::last() const
     {
       if ( _pimpl->count )
-       return _pimpl->elements[_pimpl->count-1];
+        return _pimpl->elements[_pimpl->count-1];
       return 0;
     }
 
@@ -97,7 +97,7 @@ namespace zypp
     void Queue::remove( value_type val_r )
     {
       for ( const_iterator it( find( val_r ) ); it != end(); it = find( val_r ) )
-       ::queue_delete( _pimpl.get(), it - begin() );
+        ::queue_delete( _pimpl.get(), it - begin() );
     }
 
     void Queue::push( value_type val_r )
@@ -126,9 +126,9 @@ namespace zypp
       str << "Queue {";
       if ( ! obj.empty() )
       {
-       str << endl;
-       for_( it, obj.begin(), obj.end() )
-         str << "  " << Solvable(*it) << endl;
+        str << endl;
+        for_( it, obj.begin(), obj.end() )
+          str << "  " << Solvable(*it) << endl;
       }
       return str << "}";
     }
index 32ea555..dc83dcb 100644 (file)
@@ -34,9 +34,9 @@ namespace zypp
     class Queue
     {
       public:
-       typedef unsigned size_type;
-       typedef detail::IdType value_type;
-       typedef const value_type* const_iterator;
+        typedef unsigned size_type;
+        typedef detail::IdType value_type;
+        typedef const value_type* const_iterator;
 
       public:
         /** Default ctor: empty Queue. */
@@ -45,73 +45,73 @@ namespace zypp
         /** Dtor */
         ~Queue();
 
-       bool empty() const;
-       size_type size() const;
-       const_iterator begin() const;
-       const_iterator end() const;
+        bool empty() const;
+        size_type size() const;
+        const_iterator begin() const;
+        const_iterator end() const;
 
-       /** Return iterator to the 1st occurance of \a val_r or \ref end. */
-       const_iterator find( value_type val_r ) const;
+        /** Return iterator to the 1st occurance of \a val_r or \ref end. */
+        const_iterator find( value_type val_r ) const;
 
-       /** Return whether the Queue contais at lest one element with value \a val_r. */
-       bool contains( value_type val_r ) const
-       { return( find( val_r ) != end() ); }
+        /** Return whether the Queue contais at lest one element with value \a val_r. */
+        bool contains( value_type val_r ) const
+        { return( find( val_r ) != end() ); }
 
-       /** Return the 1st Id in the queue or \c 0 if empty. */
-       value_type first() const;
+        /** Return the 1st Id in the queue or \c 0 if empty. */
+        value_type first() const;
 
-       /** Return the last Id in the queue or \c 0 if empty. */
-       value_type last() const;
+        /** Return the last Id in the queue or \c 0 if empty. */
+        value_type last() const;
 
-       /** Return the Id at \a idx_r in the queue
-        * \throws std::out_of_range if \a idx_r is out of range
-        */
-       const value_type & at( size_type idx_r ) const;
+        /** Return the Id at \a idx_r in the queue
+         * \throws std::out_of_range if \a idx_r is out of range
+         */
+        const value_type & at( size_type idx_r ) const;
 
-       /** Return the Id at \a idx_r in the queue
-        * \throws std::out_of_range if \a idx_r is out of range
-        */
-       value_type & at( size_type idx_r );
+        /** Return the Id at \a idx_r in the queue
+         * \throws std::out_of_range if \a idx_r is out of range
+         */
+        value_type & at( size_type idx_r );
 
-       /** Return the Id at \a idx_r in the queue (no range check) */
-       const value_type & operator[]( size_type idx_r ) const;
+        /** Return the Id at \a idx_r in the queue (no range check) */
+        const value_type & operator[]( size_type idx_r ) const;
 
-       /** Return the Id at \a idx_r in the queue (no range check) */
-       value_type & operator[]( size_type idx_r );
+        /** Return the Id at \a idx_r in the queue (no range check) */
+        value_type & operator[]( size_type idx_r );
 
-       /** Clear the queue. */
-       void clear();
+        /** Clear the queue. */
+        void clear();
 
-       /** Remove all occurances of \a val_r from the queue. */
-       void remove( value_type val_r );
+        /** Remove all occurances of \a val_r from the queue. */
+        void remove( value_type val_r );
 
-       /** Push a value to the end off the Queue. */
-       void push( value_type val_r );
-       /** \overload */
-       void push_back( value_type val_r )
-       { push( val_r ); }
+        /** Push a value to the end off the Queue. */
+        void push( value_type val_r );
+        /** \overload */
+        void push_back( value_type val_r )
+        { push( val_r ); }
 
-       /** Push a value if it's not yet in the Queue. */
-       void pushUnique( value_type val_r );
+        /** Push a value if it's not yet in the Queue. */
+        void pushUnique( value_type val_r );
 
-       /** Pop and return the last Id from the queue or \c 0 if empty. */
-       value_type pop();
-       /** \overload */
-       value_type pop_back()
-       { return pop(); }
+        /** Pop and return the last Id from the queue or \c 0 if empty. */
+        value_type pop();
+        /** \overload */
+        value_type pop_back()
+        { return pop(); }
 
-       /** Push a value to the beginning off the Queue. */
-       void push_front( value_type val_r );
+        /** Push a value to the beginning off the Queue. */
+        void push_front( value_type val_r );
 
-       /** Pop and return the 1st Id from the queue or \c 0 if empty. */
-       value_type pop_front();
+        /** Pop and return the 1st Id from the queue or \c 0 if empty. */
+        value_type pop_front();
 
      public:
-       operator detail::CQueue *();                    ///< libsolv backdoor
-       operator const detail::CQueue *() const         ///< libsolv backdoor
-       { return _pimpl.get(); }
+        operator detail::CQueue *();                   ///< libsolv backdoor
+        operator const detail::CQueue *() const                ///< libsolv backdoor
+        { return _pimpl.get(); }
       private:
-       RWCOW_pointer<detail::CQueue> _pimpl;           ///< Pointer to implementation
+        RWCOW_pointer<detail::CQueue> _pimpl;          ///< Pointer to implementation
     };
 
     /** \relates Queue Stream output */
index 6b7998a..e2c3075 100644 (file)
@@ -116,15 +116,15 @@ namespace zypp
     class SolvIterMixin
     {
       public:
-       typedef size_t size_type;
+        typedef size_t size_type;
 
       public:
         /** \name Convenience methods.
          * In case \c Derived is able to provide a more efficient implementation,
-        * the methods should be overloaded.
-        */
+         * the methods should be overloaded.
+         */
         //@{
-       /** Whether the collection is epmty. */
+        /** Whether the collection is epmty. */
         bool empty() const
         { return( self().begin() == self().end() ); }
 
@@ -132,17 +132,17 @@ namespace zypp
         size_type size() const
         { size_type s = 0; for_( it, self().begin(), self().end() ) ++s; return s;}
 
-       /** Whether collection contains a specific \ref Solvable. */
-       template<class TSolv>
-       bool contains( const TSolv & solv_r ) const
-       {
-         Solvable solv( asSolvable()( solv_r ) );
-         for_( it, self().begin(), self().end() )
-           if ( *it == solv )
-             return true;
-         return false;
-       }
-       //@}
+        /** Whether collection contains a specific \ref Solvable. */
+        template<class TSolv>
+        bool contains( const TSolv & solv_r ) const
+        {
+          Solvable solv( asSolvable()( solv_r ) );
+          for_( it, self().begin(), self().end() )
+            if ( *it == solv )
+              return true;
+          return false;
+        }
+        //@}
 
       public:
         /** \name Iterate as Solvable */
@@ -152,8 +152,8 @@ namespace zypp
         { return self().begin(); }
         Solvable_iterator solvableEnd() const
         { return self().end(); }
-       Iterable<Solvable_iterator> solvable() const
-       { return makeIterable( solvableBegin(), solvableEnd() ); }
+        Iterable<Solvable_iterator> solvable() const
+        { return makeIterable( solvableBegin(), solvableEnd() ); }
         //@}
 
         /** \name Iterate as PoolItem */
@@ -163,8 +163,8 @@ namespace zypp
         { return make_transform_iterator( solvableBegin(), asPoolItem() ); }
         PoolItem_iterator poolItemEnd() const
         { return make_transform_iterator( solvableEnd(), asPoolItem() ); }
-       Iterable<PoolItem_iterator> poolItem() const
-       { return makeIterable( poolItemBegin(), poolItemEnd() ); }
+        Iterable<PoolItem_iterator> poolItem() const
+        { return makeIterable( poolItemBegin(), poolItemEnd() ); }
         //@}
 
       private:
@@ -177,8 +177,8 @@ namespace zypp
         { return make_transform_iterator( unifiedSolvableBegin(), ui::asSelectable() ); }
         Selectable_iterator selectableEnd() const
         { return make_transform_iterator( unifiedSolvableEnd(), ui::asSelectable() ); }
-       Iterable<Selectable_iterator> selectable() const
-       { return makeIterable( selectableBegin(), selectableEnd() ); }
+        Iterable<Selectable_iterator> selectable() const
+        { return makeIterable( selectableBegin(), selectableEnd() ); }
         //@}
 
       private:
@@ -188,8 +188,8 @@ namespace zypp
         { return make_filter_iterator( solvitermixin_detail::UnifyByIdent(), solvableBegin(), solvableEnd() ); }
         UnifiedSolvable_iterator unifiedSolvableEnd() const
         { return make_filter_iterator( solvitermixin_detail::UnifyByIdent(), solvableEnd(), solvableEnd() ); }
-       Iterable<UnifiedSolvable_iterator> unifiedSolvable() const
-       { return makeIterable( unifiedSolvableBegin(), unifiedSolvableEnd() ); }
+        Iterable<UnifiedSolvable_iterator> unifiedSolvable() const
+        { return makeIterable( unifiedSolvableBegin(), unifiedSolvableEnd() ); }
         //@}
       private:
         const Derived & self() const
index 72039d2..eb75fd4 100644 (file)
@@ -45,26 +45,26 @@ namespace zypp
         if ( ! _ident )
           return;
 
-       ResKind explicitKind = ResKind::explicitBuiltin( _ident.c_str() );
-       // NOTE: kind package and srcpackage do not have namespaced ident!
-       if ( ! explicitKind  )
-       {
+        ResKind explicitKind = ResKind::explicitBuiltin( _ident.c_str() );
+        // NOTE: kind package and srcpackage do not have namespaced ident!
+        if ( ! explicitKind  )
+        {
           _name = _ident;
-         // No kind defaults to package
-         if ( !_kind )
-           _kind = ResKind::package;
-         else if ( ! ( _kind == ResKind::package || _kind == ResKind::srcpackage ) )
-           _ident = IdString( str::form( "%s:%s", _kind.c_str(), _ident.c_str() ) );
-       }
-       else
-       {
-         // strip kind spec from name
-         _name = IdString( ::strchr( _ident.c_str(), ':' )+1 );
-         _kind = explicitKind;
-         if ( _kind == ResKind::package || _kind == ResKind::srcpackage )
-           _ident = _name;
-       }
-       return;
+          // No kind defaults to package
+          if ( !_kind )
+            _kind = ResKind::package;
+          else if ( ! ( _kind == ResKind::package || _kind == ResKind::srcpackage ) )
+            _ident = IdString( str::form( "%s:%s", _kind.c_str(), _ident.c_str() ) );
+        }
+        else
+        {
+          // strip kind spec from name
+          _name = IdString( ::strchr( _ident.c_str(), ':' )+1 );
+          _kind = explicitKind;
+          if ( _kind == ResKind::package || _kind == ResKind::srcpackage )
+            _ident = _name;
+        }
+        return;
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -144,13 +144,13 @@ namespace zypp
       }
       else
       {
-       for ( Locale l( lang_r ); l; l = l.fallback() )
-       {
-         if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
-           return s;
-       }
-       // here: no matching locale, so use default
-       s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
+        for ( Locale l( lang_r ); l; l = l.fallback() )
+        {
+          if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
+            return s;
+        }
+        // here: no matching locale, so use default
+        s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
       }
       return s ? s : std::string();
    }
@@ -230,7 +230,7 @@ namespace zypp
       if ( ! file )
         return OnMediaLocation();
       if ( ! medianr )
-       medianr = 1;
+        medianr = 1;
 
       OnMediaLocation ret;
 
@@ -288,12 +288,12 @@ namespace zypp
       const char * ident = IdString( _solvable->name ).c_str();
       ResKind knownKind( ResKind::explicitBuiltin( ident ) );
       if ( knownKind )
-       return knownKind;
+        return knownKind;
 
       // ...or no ':' in package names (hopefully)...
       const char * sep = ::strchr( ident, ':' );
       if ( ! sep )
-       return ResKind::package;
+        return ResKind::package;
 
       // ...or something unknown.
       return ResKind( std::string( ident, sep-ident ) );
@@ -405,9 +405,9 @@ namespace zypp
     {
       NO_SOLVABLE_RETURN( false );
       if ( isKind<Package>() )
-       return myPool().isRetracted( *this );
+        return myPool().isRetracted( *this );
       if ( isKind<Patch>() )
-       return lookupStrAttribute( SolvAttr::updateStatus ) == "retracted";
+        return lookupStrAttribute( SolvAttr::updateStatus ) == "retracted";
       return false;
     }
 
@@ -476,7 +476,7 @@ namespace zypp
     {
       inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
       {
-       return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
+        return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -696,7 +696,7 @@ namespace zypp
       if ( ! file )
         medianr = 0U;
       else if ( ! medianr )
-       medianr = 1U;
+        medianr = 1U;
       return medianr;
     }
 
@@ -748,13 +748,13 @@ namespace zypp
       std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
       if ( ret.empty() && isKind<Product>() )
       {
-       const RepoInfo & ri( repoInfo() );
-       std::string riname( name() );   // "license-"+name with fallback "license"
-       if ( ! ri.hasLicense( riname ) )
-         riname.clear();
+        const RepoInfo & ri( repoInfo() );
+        std::string riname( name() );  // "license-"+name with fallback "license"
+        if ( ! ri.hasLicense( riname ) )
+          riname.clear();
 
-       if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
-         ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
+        if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
+          ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
       }
       return ret;
     }
@@ -764,12 +764,12 @@ namespace zypp
       NO_SOLVABLE_RETURN( false );
       if ( isKind<Product>() )
       {
-       const RepoInfo & ri( repoInfo() );
-       std::string riname( name() );   // "license-"+name with fallback "license"
-       if ( ! ri.hasLicense( riname ) )
-         riname.clear();
+        const RepoInfo & ri( repoInfo() );
+        std::string riname( name() );  // "license-"+name with fallback "license"
+        if ( ! ri.hasLicense( riname ) )
+          riname.clear();
 
-       return ri.needToAcceptLicense( riname );
+        return ri.needToAcceptLicense( riname );
       }
       return true;
     }
index 662cb0c..6b0d196 100644 (file)
@@ -229,19 +229,19 @@ namespace zypp
       /** Return \ref Capabilities selected by \ref Dep constant. */
       Capabilities dep( Dep which_r ) const
       {
-       switch( which_r.inSwitch() )
-       {
-         case Dep::PROVIDES_e:    return provides();    break;
-         case Dep::REQUIRES_e:    return requires();    break;
-         case Dep::CONFLICTS_e:   return conflicts();   break;
-         case Dep::OBSOLETES_e:   return obsoletes();   break;
-         case Dep::RECOMMENDS_e:  return recommends();  break;
-         case Dep::SUGGESTS_e:    return suggests();    break;
-         case Dep::ENHANCES_e:    return enhances();    break;
-         case Dep::SUPPLEMENTS_e: return supplements(); break;
-         case Dep::PREREQUIRES_e: return prerequires(); break;
-       }
-       return Capabilities();
+        switch( which_r.inSwitch() )
+        {
+          case Dep::PROVIDES_e:    return provides();    break;
+          case Dep::REQUIRES_e:    return requires();    break;
+          case Dep::CONFLICTS_e:   return conflicts();   break;
+          case Dep::OBSOLETES_e:   return obsoletes();   break;
+          case Dep::RECOMMENDS_e:  return recommends();  break;
+          case Dep::SUGGESTS_e:    return suggests();    break;
+          case Dep::ENHANCES_e:    return enhances();    break;
+          case Dep::SUPPLEMENTS_e: return supplements(); break;
+          case Dep::PREREQUIRES_e: return prerequires(); break;
+        }
+        return Capabilities();
       }
       /** \overload operator[] */
       Capabilities operator[]( Dep which_r ) const
@@ -344,21 +344,21 @@ namespace zypp
       class SplitIdent
       {
       public:
-       SplitIdent() {}
-       SplitIdent( IdString ident_r );
-       SplitIdent( const char * ident_r );
-       SplitIdent( const std::string & ident_r );
-       SplitIdent( ResKind kind_r, IdString name_r );
-       SplitIdent( ResKind kind_r, const C_Str & name_r );
+        SplitIdent() {}
+        SplitIdent( IdString ident_r );
+        SplitIdent( const char * ident_r );
+        SplitIdent( const std::string & ident_r );
+        SplitIdent( ResKind kind_r, IdString name_r );
+        SplitIdent( ResKind kind_r, const C_Str & name_r );
 
-       IdString ident() const { return _ident; }
-       ResKind  kind()  const { return _kind; }
-       IdString name()  const { return _name; }
+        IdString ident() const { return _ident; }
+        ResKind  kind()  const { return _kind; }
+        IdString name()  const { return _name; }
 
       private:
-       IdString  _ident;
-       ResKind   _kind;
-       IdString  _name;
+        IdString  _ident;
+        ResKind   _kind;
+        IdString  _name;
       };
 
     public:
@@ -473,8 +473,8 @@ namespace zypp
       int res = 0;
       if ( lhs != rhs )
       {
-       if ( (res = lhs.kind().compare( rhs.kind() )) == 0 )
-         res = lhs.name().compare( rhs.name() );
+        if ( (res = lhs.kind().compare( rhs.kind() )) == 0 )
+          res = lhs.name().compare( rhs.name() );
       }
       return res;
     }
@@ -484,7 +484,7 @@ namespace zypp
     {
       int res = compareByN( lhs, rhs );
       if ( res == 0 )
-       res = lhs.edition().compare( rhs.edition() );
+        res = lhs.edition().compare( rhs.edition() );
       return res;
     }
 
@@ -493,7 +493,7 @@ namespace zypp
     {
       int res = compareByNVR( lhs, rhs );
       if ( res == 0 )
-       res = lhs.arch().compare( rhs.arch() );
+        res = lhs.arch().compare( rhs.arch() );
       return res;
     }
 
index a857dff..f7bf17d 100644 (file)
@@ -63,10 +63,10 @@ namespace zypp
         size_type size() const
         { return _pimpl->size(); }
 
-       /** */
-       template<class TSolv>
-       bool contains( const TSolv & solv_r ) const
-       { return( get().count( asSolvable()( solv_r ) ) ); }
+        /** */
+        template<class TSolv>
+        bool contains( const TSolv & solv_r ) const
+        { return( get().count( asSolvable()( solv_r ) ) ); }
 
         /** Iterator pointing to the first \ref Solvable. */
         const_iterator begin() const
@@ -77,21 +77,21 @@ namespace zypp
         { return _pimpl->end(); }
 
       public:
-       /** Clear the container */
-       void clear()
-       { get().clear(); }
-
-       /** Insert a Solvable.
-        * \return \c true if it was actually inserted, or \c false if already present.
-        */
-       template<class TSolv>
-       bool insert( const TSolv & solv_r )
-       { return get().insert( asSolvable()( solv_r ) ).second; }
-
-       /** Insert a range of Solvables. */
-       template<class TIterator>
-       void insert( TIterator begin_r, TIterator end_r )
-       { for_( it, begin_r, end_r ) insert( *it ); }
+        /** Clear the container */
+        void clear()
+        { get().clear(); }
+
+        /** Insert a Solvable.
+         * \return \c true if it was actually inserted, or \c false if already present.
+         */
+        template<class TSolv>
+        bool insert( const TSolv & solv_r )
+        { return get().insert( asSolvable()( solv_r ) ).second; }
+
+        /** Insert a range of Solvables. */
+        template<class TIterator>
+        void insert( TIterator begin_r, TIterator end_r )
+        { for_( it, begin_r, end_r ) insert( *it ); }
 
       public:
         /** The set. */
index 2e02026..1fdfc15 100644 (file)
@@ -34,14 +34,14 @@ namespace zypp
     public:
       void addIdent( IdString ident_r )
       {
-       if ( ! ident_r.empty() )
-         _idents.insert( ident_r );
+        if ( ! ident_r.empty() )
+          _idents.insert( ident_r );
       }
 
       void addProvides( Capability provides_r )
       {
-       if ( ! provides_r.empty() && _provides.insert( provides_r ).second )
-         setDirty();
+        if ( ! provides_r.empty() && _provides.insert( provides_r ).second )
+          setDirty();
       }
 
       bool addIdenticalInstalledToo() const
@@ -49,19 +49,19 @@ namespace zypp
 
       void addIdenticalInstalledToo( bool yesno_r )
       {
-       if ( yesno_r != _addIdenticalInstalledToo ) {
-         _addIdenticalInstalledToo = yesno_r;
-         if ( not _provides.empty() )
-           setDirty();
-       }
+        if ( yesno_r != _addIdenticalInstalledToo ) {
+          _addIdenticalInstalledToo = yesno_r;
+          if ( not _provides.empty() )
+            setDirty();
+        }
       }
 
       void parse( const C_Str & spec_r )
       {
-       if ( str::hasPrefix( spec_r, "provides:" ) )
-         addProvides( Capability(spec_r.c_str()+9) );
-       else
-         addIdent( IdString(spec_r) );
+        if ( str::hasPrefix( spec_r, "provides:" ) )
+          addProvides( Capability(spec_r.c_str()+9) );
+        else
+          addIdent( IdString(spec_r) );
       }
 
 
@@ -76,33 +76,33 @@ namespace zypp
 
       const WhatProvides & cache() const
       {
-       if ( !_cache )
-       {
-         _cache.reset( new WhatProvides( _provides ) );
-         if ( _addIdenticalInstalledToo ) {
-           for ( const auto & solv : *_cache ) {
-             if ( solv.isSystem() )
-               continue;
-             auto pi { ui::Selectable::get(solv)->identicalInstalledObj( PoolItem(solv) ) };
-             if ( pi )
-               _cacheIdenticalInstalled.insert( pi );
-           }
-         }
-       }
-       return *_cache;
+        if ( !_cache )
+        {
+          _cache.reset( new WhatProvides( _provides ) );
+          if ( _addIdenticalInstalledToo ) {
+            for ( const auto & solv : *_cache ) {
+              if ( solv.isSystem() )
+                continue;
+              auto pi { ui::Selectable::get(solv)->identicalInstalledObj( PoolItem(solv) ) };
+              if ( pi )
+                _cacheIdenticalInstalled.insert( pi );
+            }
+          }
+        }
+        return *_cache;
       }
 
       bool contains( const sat::Solvable & solv_r ) const
       {
-       if ( _idents.count( solv_r.ident() ) )
-         return true;
-       if ( needed() ) {
-         if ( cache().contains( solv_r ) )
-           return true;
-         if ( _addIdenticalInstalledToo && _cacheIdenticalInstalled.contains( solv_r ) )
-           return true;
-       }
-       return false;
+        if ( _idents.count( solv_r.ident() ) )
+          return true;
+        if ( needed() ) {
+          if ( cache().contains( solv_r ) )
+            return true;
+          if ( _addIdenticalInstalledToo && _cacheIdenticalInstalled.contains( solv_r ) )
+            return true;
+        }
+        return false;
       }
 
 
@@ -166,11 +166,11 @@ namespace zypp
     void SolvableSpec::parseFrom( const InputStream & istr_r )
     {
       iostr::simpleParseFile( istr_r,
-                             [this]( int num_r, const std::string & line_r )->bool
-                             {
-                               this->parse( line_r );
-                               return true;
-                             });
+                              [this]( int num_r, const std::string & line_r )->bool
+                              {
+                                this->parse( line_r );
+                                return true;
+                              });
     }
 
     void SolvableSpec::splitParseFrom( const C_Str & multispec_r )
index 9925dff..6a22255 100644 (file)
@@ -47,248 +47,248 @@ namespace zypp
      *
      */
     struct Transaction::Impl : protected detail::PoolMember
-                            , private base::NonCopyable
+                             , private base::NonCopyable
     {
       friend std::ostream & operator<<( std::ostream & str, const Impl & obj );
 
       public:
-       typedef std::unordered_set<detail::IdType> set_type;
-       typedef std::unordered_map<detail::IdType,detail::IdType> map_type;
-
-       struct PostMortem
-       {
-         PostMortem()
-         {}
-         PostMortem( const sat::Solvable & solv_r )
-           : _ident( solv_r.ident() )
-           , _edition( solv_r.edition() )
-           , _arch( solv_r.arch() )
-         {}
-
-         IdString _ident;
-         Edition  _edition;
-         Arch     _arch;
-       };
-       typedef std::unordered_map<detail::IdType,PostMortem> pmmap_type;
+        typedef std::unordered_set<detail::IdType> set_type;
+        typedef std::unordered_map<detail::IdType,detail::IdType> map_type;
+
+        struct PostMortem
+        {
+          PostMortem()
+          {}
+          PostMortem( const sat::Solvable & solv_r )
+            : _ident( solv_r.ident() )
+            , _edition( solv_r.edition() )
+            , _arch( solv_r.arch() )
+          {}
+
+          IdString _ident;
+          Edition  _edition;
+          Arch     _arch;
+        };
+        typedef std::unordered_map<detail::IdType,PostMortem> pmmap_type;
 
       public:
-       Impl()
-         : _trans( ::transaction_create( nullptr ) )
-       { memset( _trans, 0, sizeof(*_trans) ); }
-
-       Impl( LoadFromPoolType )
-         : _watcher( myPool().serial() )
-         , _trans( nullptr )
-       {
-         Queue decisionq;
-         for ( const PoolItem & pi : ResPool::instance() )
-         {
-           if ( ! pi.status().transacts() )
-             continue;
-           decisionq.push( pi.isSystem() ? -pi.id() : pi.id() );
-         }
-         Queue noobsq;
-         for ( const Solvable & solv : myPool().multiversionList() )
-         {
-           noobsq.push( SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
-           noobsq.push( solv.id() );
-         }
-         Map noobsmap;
-         ::solver_calculate_noobsmap( myPool().getPool(), noobsq, noobsmap );
-         _trans = ::transaction_create_decisionq( myPool().getPool(), decisionq, noobsmap );
-
-         // NOTE: package/product buddies share the same ResStatus
-         // so we also link the buddies stepStages. This assumes
-         // only one buddy is acting during commit (package is installed,
-         // but no extra operation for the product).
-         for_( it, _trans->steps.elements, _trans->steps.elements + _trans->steps.count )
-         {
-           sat::Solvable solv( *it );
-           // buddy list:
-           if ( ! solv.isKind<Package>() )
-           {
-             PoolItem pi( solv );
-             if ( pi.buddy() )
-             {
-               _linkMap[*it] = pi.buddy().id();
-             }
-           }
-           if ( solv.isSystem() )
-           {
-             // to delete list:
-             if ( stepType( solv ) == TRANSACTION_ERASE )
-             {
-               _systemErase.insert( *it );
-             }
-             // post mortem data
-             _pmMap[*it] = solv;
-           }
-         }
-       }
-
-       ~Impl()
-       { ::transaction_free( _trans ); }
+        Impl()
+          : _trans( ::transaction_create( nullptr ) )
+        { memset( _trans, 0, sizeof(*_trans) ); }
+
+        Impl( LoadFromPoolType )
+          : _watcher( myPool().serial() )
+          , _trans( nullptr )
+        {
+          Queue decisionq;
+          for ( const PoolItem & pi : ResPool::instance() )
+          {
+            if ( ! pi.status().transacts() )
+              continue;
+            decisionq.push( pi.isSystem() ? -pi.id() : pi.id() );
+          }
+          Queue noobsq;
+          for ( const Solvable & solv : myPool().multiversionList() )
+          {
+            noobsq.push( SOLVER_NOOBSOLETES | SOLVER_SOLVABLE );
+            noobsq.push( solv.id() );
+          }
+          Map noobsmap;
+          ::solver_calculate_noobsmap( myPool().getPool(), noobsq, noobsmap );
+          _trans = ::transaction_create_decisionq( myPool().getPool(), decisionq, noobsmap );
+
+          // NOTE: package/product buddies share the same ResStatus
+          // so we also link the buddies stepStages. This assumes
+          // only one buddy is acting during commit (package is installed,
+          // but no extra operation for the product).
+          for_( it, _trans->steps.elements, _trans->steps.elements + _trans->steps.count )
+          {
+            sat::Solvable solv( *it );
+            // buddy list:
+            if ( ! solv.isKind<Package>() )
+            {
+              PoolItem pi( solv );
+              if ( pi.buddy() )
+              {
+                _linkMap[*it] = pi.buddy().id();
+              }
+            }
+            if ( solv.isSystem() )
+            {
+              // to delete list:
+              if ( stepType( solv ) == TRANSACTION_ERASE )
+              {
+                _systemErase.insert( *it );
+              }
+              // post mortem data
+              _pmMap[*it] = solv;
+            }
+          }
+        }
+
+        ~Impl()
+        { ::transaction_free( _trans ); }
 
       public:
-       bool valid() const
-       { return _watcher.isClean( myPool().serial() ); }
-
-       bool order()
-       {
-         if ( ! valid() )
-           return false;
-         if ( empty() )
-           return true;
+        bool valid() const
+        { return _watcher.isClean( myPool().serial() ); }
+
+        bool order()
+        {
+          if ( ! valid() )
+            return false;
+          if ( empty() )
+            return true;
 #if 0
-         // This is hwo we could implement out own order method.
-         // As ::transaction already groups by MediaNr, we don't
-         // need it for ORDER_BY_MEDIANR.
-         ::transaction_order( _trans, SOLVER_TRANSACTION_KEEP_ORDERDATA );
-         detail::IdType chosen = 0;
-         Queue choices;
-
-         while ( true )
-         {
-           int ret = transaction_order_add_choices( _trans, chosen, choices );
-           MIL << ret << ": " << chosen << ": " << choices << endl;
-           chosen = choices.pop_front(); // pick one out of choices
-           if ( ! chosen )
-             break;
-         }
-         return true;
+          // This is hwo we could implement out own order method.
+          // As ::transaction already groups by MediaNr, we don't
+          // need it for ORDER_BY_MEDIANR.
+          ::transaction_order( _trans, SOLVER_TRANSACTION_KEEP_ORDERDATA );
+          detail::IdType chosen = 0;
+          Queue choices;
+
+          while ( true )
+          {
+            int ret = transaction_order_add_choices( _trans, chosen, choices );
+            MIL << ret << ": " << chosen << ": " << choices << endl;
+            chosen = choices.pop_front(); // pick one out of choices
+            if ( ! chosen )
+              break;
+          }
+          return true;
 #endif
-         if ( !_ordered )
-         {
-           ::transaction_order( _trans, 0 );
-           _ordered = true;
-         }
-         return true;
-       }
-
-       bool empty() const
-       { return( _trans->steps.count == 0 ); }
-
-       size_t size() const
-       { return _trans->steps.count; }
-
-       const_iterator begin( const RW_pointer<Transaction::Impl> & self_r ) const
-       { return const_iterator( self_r, _trans->steps.elements ); }
-       iterator begin( const RW_pointer<Transaction::Impl> & self_r )
-       { return iterator( self_r, _trans->steps.elements ); }
-
-       const_iterator end( const RW_pointer<Transaction::Impl> & self_r ) const
-       { return const_iterator( self_r, _trans->steps.elements + _trans->steps.count ); }
-       iterator end( const RW_pointer<Transaction::Impl> & self_r )
-       { return iterator( self_r, _trans->steps.elements + _trans->steps.count ); }
-
-       const_iterator find(const RW_pointer<Transaction::Impl> & self_r, const sat::Solvable & solv_r ) const
-       { detail::IdType * it( _find( solv_r ) ); return it ? const_iterator( self_r, it ) : end( self_r ); }
-       iterator find(const RW_pointer<Transaction::Impl> & self_r, const sat::Solvable & solv_r )
-       { detail::IdType * it( _find( solv_r ) ); return it ? iterator( self_r, it ) : end( self_r ); }
+          if ( !_ordered )
+          {
+            ::transaction_order( _trans, 0 );
+            _ordered = true;
+          }
+          return true;
+        }
+
+        bool empty() const
+        { return( _trans->steps.count == 0 ); }
+
+        size_t size() const
+        { return _trans->steps.count; }
+
+        const_iterator begin( const RW_pointer<Transaction::Impl> & self_r ) const
+        { return const_iterator( self_r, _trans->steps.elements ); }
+        iterator begin( const RW_pointer<Transaction::Impl> & self_r )
+        { return iterator( self_r, _trans->steps.elements ); }
+
+        const_iterator end( const RW_pointer<Transaction::Impl> & self_r ) const
+        { return const_iterator( self_r, _trans->steps.elements + _trans->steps.count ); }
+        iterator end( const RW_pointer<Transaction::Impl> & self_r )
+        { return iterator( self_r, _trans->steps.elements + _trans->steps.count ); }
+
+        const_iterator find(const RW_pointer<Transaction::Impl> & self_r, const sat::Solvable & solv_r ) const
+        { detail::IdType * it( _find( solv_r ) ); return it ? const_iterator( self_r, it ) : end( self_r ); }
+        iterator find(const RW_pointer<Transaction::Impl> & self_r, const sat::Solvable & solv_r )
+        { detail::IdType * it( _find( solv_r ) ); return it ? iterator( self_r, it ) : end( self_r ); }
 
       public:
-       int installedResult( Queue & result_r ) const
-       { return ::transaction_installedresult( _trans, result_r ); }
+        int installedResult( Queue & result_r ) const
+        { return ::transaction_installedresult( _trans, result_r ); }
 
-       StringQueue autoInstalled() const
-       { return _autoInstalled; }
+        StringQueue autoInstalled() const
+        { return _autoInstalled; }
 
-       void autoInstalled( const StringQueue & queue_r )
-       { _autoInstalled = queue_r; }
+        void autoInstalled( const StringQueue & queue_r )
+        { _autoInstalled = queue_r; }
 
       public:
-       StepType stepType( Solvable solv_r ) const
-       {
-         if ( ! solv_r )
-         {
-           // post mortem @System solvable
-           return isIn( _systemErase, solv_r.id() ) ? TRANSACTION_ERASE : TRANSACTION_IGNORE;
-         }
-
-         switch( ::transaction_type( _trans, solv_r.id(), SOLVER_TRANSACTION_RPM_ONLY ) )
-         {
-           case SOLVER_TRANSACTION_ERASE: return TRANSACTION_ERASE; break;
-           case SOLVER_TRANSACTION_INSTALL: return TRANSACTION_INSTALL; break;
-           case SOLVER_TRANSACTION_MULTIINSTALL: return TRANSACTION_MULTIINSTALL; break;
-         }
-         return TRANSACTION_IGNORE;
-       }
-
-       StepStage stepStage( Solvable solv_r ) const
-       { return stepStage( resolve( solv_r ) ); }
-
-       void stepStage( Solvable solv_r, StepStage newval_r )
-       { stepStage( resolve( solv_r ), newval_r ); }
-
-       const PostMortem & pmdata( Solvable solv_r ) const
-       {
-         static PostMortem _none;
-         pmmap_type::const_iterator it( _pmMap.find( solv_r.id() ) );
-         return( it == _pmMap.end() ? _none : it->second );
-       }
+        StepType stepType( Solvable solv_r ) const
+        {
+          if ( ! solv_r )
+          {
+            // post mortem @System solvable
+            return isIn( _systemErase, solv_r.id() ) ? TRANSACTION_ERASE : TRANSACTION_IGNORE;
+          }
+
+          switch( ::transaction_type( _trans, solv_r.id(), SOLVER_TRANSACTION_RPM_ONLY ) )
+          {
+            case SOLVER_TRANSACTION_ERASE: return TRANSACTION_ERASE; break;
+            case SOLVER_TRANSACTION_INSTALL: return TRANSACTION_INSTALL; break;
+            case SOLVER_TRANSACTION_MULTIINSTALL: return TRANSACTION_MULTIINSTALL; break;
+          }
+          return TRANSACTION_IGNORE;
+        }
+
+        StepStage stepStage( Solvable solv_r ) const
+        { return stepStage( resolve( solv_r ) ); }
+
+        void stepStage( Solvable solv_r, StepStage newval_r )
+        { stepStage( resolve( solv_r ), newval_r ); }
+
+        const PostMortem & pmdata( Solvable solv_r ) const
+        {
+          static PostMortem _none;
+          pmmap_type::const_iterator it( _pmMap.find( solv_r.id() ) );
+          return( it == _pmMap.end() ? _none : it->second );
+        }
 
       private:
-       detail::IdType resolve( const Solvable & solv_r ) const
-       {
-         map_type::const_iterator res( _linkMap.find( solv_r.id() ) );
-         return( res == _linkMap.end() ? solv_r.id() : res->second );
-       }
-
-       bool isIn( const set_type & set_r, detail::IdType sid_r ) const
-       { return( set_r.find( sid_r ) != set_r.end() ); }
-
-       StepStage stepStage( detail::IdType sid_r ) const
-       {
-         if ( isIn( _doneSet, sid_r ) )
-           return STEP_DONE;
-         if ( isIn( _errSet, sid_r ) )
-           return STEP_ERROR;
-         return STEP_TODO;
-       }
-
-       void stepStage( detail::IdType sid_r, StepStage newval_r )
-       {
-         StepStage stage( stepStage( sid_r ) );
-         if ( stage != newval_r )
-         {
-           // reset old stage
-           if ( stage != STEP_TODO )
-           {
-             (stage == STEP_DONE ? _doneSet : _errSet).erase( sid_r );
-           }
-           if ( newval_r != STEP_TODO )
-           {
-             (newval_r == STEP_DONE ? _doneSet : _errSet).insert( sid_r );
-           }
-         }
-       }
+        detail::IdType resolve( const Solvable & solv_r ) const
+        {
+          map_type::const_iterator res( _linkMap.find( solv_r.id() ) );
+          return( res == _linkMap.end() ? solv_r.id() : res->second );
+        }
+
+        bool isIn( const set_type & set_r, detail::IdType sid_r ) const
+        { return( set_r.find( sid_r ) != set_r.end() ); }
+
+        StepStage stepStage( detail::IdType sid_r ) const
+        {
+          if ( isIn( _doneSet, sid_r ) )
+            return STEP_DONE;
+          if ( isIn( _errSet, sid_r ) )
+            return STEP_ERROR;
+          return STEP_TODO;
+        }
+
+        void stepStage( detail::IdType sid_r, StepStage newval_r )
+        {
+          StepStage stage( stepStage( sid_r ) );
+          if ( stage != newval_r )
+          {
+            // reset old stage
+            if ( stage != STEP_TODO )
+            {
+              (stage == STEP_DONE ? _doneSet : _errSet).erase( sid_r );
+            }
+            if ( newval_r != STEP_TODO )
+            {
+              (newval_r == STEP_DONE ? _doneSet : _errSet).insert( sid_r );
+            }
+          }
+        }
 
       private:
-       detail::IdType * _find( const sat::Solvable & solv_r ) const
-       {
-         if ( solv_r && _trans->steps.elements )
-         {
-           for_( it, _trans->steps.elements, _trans->steps.elements + _trans->steps.count )
-           {
-             if ( *it == detail::IdType(solv_r.id()) )
-               return it;
-           }
-         }
-         return 0;
-       }
+        detail::IdType * _find( const sat::Solvable & solv_r ) const
+        {
+          if ( solv_r && _trans->steps.elements )
+          {
+            for_( it, _trans->steps.elements, _trans->steps.elements + _trans->steps.count )
+            {
+              if ( *it == detail::IdType(solv_r.id()) )
+                return it;
+            }
+          }
+          return 0;
+        }
 
      private:
-       SerialNumberWatcher _watcher;
-       mutable ::Transaction * _trans;
-       DefaultIntegral<bool,false> _ordered;
-       //
-       set_type        _doneSet;
-       set_type        _errSet;
-       map_type        _linkMap;       // buddy map to adopt buddies StepResult
-       set_type        _systemErase;   // @System packages to be eased (otherse are TRANSACTION_IGNORE)
-       pmmap_type      _pmMap;         // Post mortem data of deleted @System solvables
-
-       StringQueue     _autoInstalled; // ident strings of all packages that would be auto-installed after the transaction is run.
+        SerialNumberWatcher _watcher;
+        mutable ::Transaction * _trans;
+        DefaultIntegral<bool,false> _ordered;
+        //
+        set_type       _doneSet;
+        set_type       _errSet;
+        map_type       _linkMap;       // buddy map to adopt buddies StepResult
+        set_type       _systemErase;   // @System packages to be eased (otherse are TRANSACTION_IGNORE)
+        pmmap_type     _pmMap;         // Post mortem data of deleted @System solvables
+
+        StringQueue    _autoInstalled; // ident strings of all packages that would be auto-installed after the transaction is run.
 
       public:
         /** Offer default Impl. */
@@ -368,7 +368,7 @@ namespace zypp
     {
       for_( it, obj.begin(), obj.end() )
       {
-       str << *it << endl;
+        str << *it << endl;
       }
       return str;
     }
@@ -407,9 +407,9 @@ namespace zypp
     {
       str << obj.stepType() << obj.stepStage() << " ";
       if ( obj.satSolvable() )
-       str << PoolItem( obj.satSolvable() );
+        str << PoolItem( obj.satSolvable() );
       else
-       str << '[' << obj.ident() << '-' << obj.edition() << '.' << obj.arch() << ']';
+        str << '[' << obj.ident() << '-' << obj.edition() << '.' << obj.arch() << ']';
       return str;
     }
 
@@ -417,12 +417,12 @@ namespace zypp
     {
       switch ( obj )
       {
-       #define OUTS(E,S) case Transaction::E: return str << #S; break
-       OUTS( TRANSACTION_IGNORE,       [ ] );
-       OUTS( TRANSACTION_ERASE,        [-] );
-       OUTS( TRANSACTION_INSTALL,      [+] );
-       OUTS( TRANSACTION_MULTIINSTALL, [M] );
-       #undef OUTS
+        #define OUTS(E,S) case Transaction::E: return str << #S; break
+        OUTS( TRANSACTION_IGNORE,      [ ] );
+        OUTS( TRANSACTION_ERASE,       [-] );
+        OUTS( TRANSACTION_INSTALL,     [+] );
+        OUTS( TRANSACTION_MULTIINSTALL,        [M] );
+        #undef OUTS
       }
       return str << "[?]";
     }
@@ -431,11 +431,11 @@ namespace zypp
     {
       switch ( obj )
       {
-       #define OUTS(E,S) case Transaction::E: return str << #S; break
-       OUTS( STEP_TODO,        [__] );
-       OUTS( STEP_DONE,        [OK] );
-       OUTS( STEP_ERROR,       [**] );
-       #undef OUTS
+        #define OUTS(E,S) case Transaction::E: return str << #S; break
+        OUTS( STEP_TODO,       [__] );
+        OUTS( STEP_DONE,       [OK] );
+        OUTS( STEP_ERROR,      [**] );
+        #undef OUTS
       }
       return str << "[??]";
     }
index abb75fc..f29cdb0 100644 (file)
@@ -61,18 +61,18 @@ namespace zypp
        /** Type of (rpm) action to perform in a \ref Step. */
        enum StepType
        {
-        TRANSACTION_IGNORE             = 0x00, /**< [ ] Nothing (includes implicit deletes due to obsoletes and non-package actions) */
-        TRANSACTION_ERASE              = 0x10, /**< [-] Delete item */
-        TRANSACTION_INSTALL            = 0x20, /**< [+] Install(update) item */
-        TRANSACTION_MULTIINSTALL       = 0x30  /**< [M] Install(multiversion) item (\see \ref ZConfig::multiversion) */
+         TRANSACTION_IGNORE            = 0x00, /**< [ ] Nothing (includes implicit deletes due to obsoletes and non-package actions) */
+         TRANSACTION_ERASE             = 0x10, /**< [-] Delete item */
+         TRANSACTION_INSTALL           = 0x20, /**< [+] Install(update) item */
+         TRANSACTION_MULTIINSTALL      = 0x30  /**< [M] Install(multiversion) item (\see \ref ZConfig::multiversion) */
        };
 
        /** \ref Step action result. */
        enum StepStage
        {
-        STEP_TODO      = (1 << 0),     /**< [__] unprocessed */
-        STEP_DONE      = (1 << 1),     /**< [OK] success */
-        STEP_ERROR     = (1 << 2),     /**< [**] error */
+         STEP_TODO     = (1 << 0),     /**< [__] unprocessed */
+         STEP_DONE     = (1 << 1),     /**< [OK] success */
+         STEP_ERROR    = (1 << 2),     /**< [**] error */
        };
 
        ZYPP_DECLARE_FLAGS(StepStages,StepStage);
@@ -92,94 +92,94 @@ namespace zypp
         ~Transaction();
 
       public:
-       /** Whether transaction actually contains data and also fits the current pools content. */
-       bool valid() const;
+        /** Whether transaction actually contains data and also fits the current pools content. */
+        bool valid() const;
 
         /**  Validate object in a boolean context: valid */
         explicit operator bool() const
         { return valid(); }
 
-       /** Order transaction steps for commit.
-        * It's cheap to call it for an aleready ordered \ref Transaction.
-        * This invalidates outstanding iterators. Returns whether
-        * \ref Transaction is \ref valid.
-        */
-       bool order();
-
-       /** Whether the transaction contains any steps. */
-       bool empty() const;
-
-       /** Number of steps in transaction steps. */
-       size_t size() const;
-
-       typedef detail::Transaction_iterator iterator;
-       typedef detail::Transaction_const_iterator const_iterator;
-
-       /** Iterator to the first \ref TransactionStep */
-       const_iterator begin() const;
-       /** \overload */
-       iterator begin();
-
-       /** Iterator behind the last \ref TransactionStep */
-       const_iterator end() const;
-       /** \overload */
-       iterator end();
-
-       /** Return iterator pointing to \a solv_r or \ref end. */
-       const_iterator find( const sat::Solvable & solv_r ) const;
-       iterator find( const sat::Solvable & solv_r );
-       /** \overload */
-       const_iterator find( const ResObject::constPtr & resolvable_r ) const;
-       iterator find( const ResObject::constPtr & resolvable_r );
-       /** \overload */
-       const_iterator find( const PoolItem & pi_r ) const;
-       iterator find( const PoolItem & pi_r );
+        /** Order transaction steps for commit.
+         * It's cheap to call it for an aleready ordered \ref Transaction.
+         * This invalidates outstanding iterators. Returns whether
+         * \ref Transaction is \ref valid.
+         */
+        bool order();
+
+        /** Whether the transaction contains any steps. */
+        bool empty() const;
+
+        /** Number of steps in transaction steps. */
+        size_t size() const;
+
+        typedef detail::Transaction_iterator iterator;
+        typedef detail::Transaction_const_iterator const_iterator;
+
+        /** Iterator to the first \ref TransactionStep */
+        const_iterator begin() const;
+        /** \overload */
+        iterator begin();
+
+        /** Iterator behind the last \ref TransactionStep */
+        const_iterator end() const;
+        /** \overload */
+        iterator end();
+
+        /** Return iterator pointing to \a solv_r or \ref end. */
+        const_iterator find( const sat::Solvable & solv_r ) const;
+        iterator find( const sat::Solvable & solv_r );
+        /** \overload */
+        const_iterator find( const ResObject::constPtr & resolvable_r ) const;
+        iterator find( const ResObject::constPtr & resolvable_r );
+        /** \overload */
+        const_iterator find( const PoolItem & pi_r ) const;
+        iterator find( const PoolItem & pi_r );
 
       public:
-       /** \name Iterate action steps (omit TRANSACTION_IGNORE steps).
-        *
-        * All these methods allow to pass an optional OR'd combination of
-        * \ref StepStages as filter. Per default all steps are processed/counted.
-        *
-        * \code
-        *    Transaction trans;
-        *    for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() )
-        *    {
-        *       ... // process all steps not DONE (ERROR and TODO)
-        *    }
-        * \endcode
-        */
-       //@{
-       struct FilterAction;
-       typedef filter_iterator<FilterAction,const_iterator> action_iterator;
-
-       /** Whether the [filtered] transaction contains any steps . */
-       bool actionEmpty( StepStages filter_r = StepStages() ) const;
-
-       /** Number of steps in [filtered] transaction steps. */
-       size_t actionSize( StepStages filter_r = StepStages() ) const;
-
-       /** Pointer to the 1st action step in [filtered] transaction. */
-       action_iterator actionBegin( StepStages filter_r = StepStages() ) const;
-
-       /** Pointer behind the last action step in transaction. */
-       action_iterator actionEnd() const;
-
-       /** Iterate the [filtered] transaction steps. */
-       Iterable<action_iterator> action( StepStages filter_r = StepStages() ) const;
-       //@}
+        /** \name Iterate action steps (omit TRANSACTION_IGNORE steps).
+         *
+         * All these methods allow to pass an optional OR'd combination of
+         * \ref StepStages as filter. Per default all steps are processed/counted.
+         *
+         * \code
+         *    Transaction trans;
+         *    for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() )
+         *    {
+         *       ... // process all steps not DONE (ERROR and TODO)
+         *    }
+         * \endcode
+         */
+        //@{
+        struct FilterAction;
+        typedef filter_iterator<FilterAction,const_iterator> action_iterator;
+
+        /** Whether the [filtered] transaction contains any steps . */
+        bool actionEmpty( StepStages filter_r = StepStages() ) const;
+
+        /** Number of steps in [filtered] transaction steps. */
+        size_t actionSize( StepStages filter_r = StepStages() ) const;
+
+        /** Pointer to the 1st action step in [filtered] transaction. */
+        action_iterator actionBegin( StepStages filter_r = StepStages() ) const;
+
+        /** Pointer behind the last action step in transaction. */
+        action_iterator actionEnd() const;
+
+        /** Iterate the [filtered] transaction steps. */
+        Iterable<action_iterator> action( StepStages filter_r = StepStages() ) const;
+        //@}
 
       public:
-       /** Return all packages that would be installed after the transaction is run.
-        * The new packages are put at the head of the queue, the number of new
-        * packages is returned. (wraps libsolv::transaction_installedresult) */
-       int installedResult( Queue & result_r ) const;
+        /** Return all packages that would be installed after the transaction is run.
+         * The new packages are put at the head of the queue, the number of new
+         * packages is returned. (wraps libsolv::transaction_installedresult) */
+        int installedResult( Queue & result_r ) const;
 
-       /** Return the ident strings of all packages that would be auto-installed after the transaction is run. */
-       StringQueue autoInstalled() const;
+        /** Return the ident strings of all packages that would be auto-installed after the transaction is run. */
+        StringQueue autoInstalled() const;
 
-       /** Set the ident strings of all packages that would be auto-installed after the transaction is run. */
-       void autoInstalled( const StringQueue & queue_r );
+        /** Set the ident strings of all packages that would be auto-installed after the transaction is run. */
+        void autoInstalled( const StringQueue & queue_r );
 
       public:
         /** Implementation  */
@@ -220,58 +220,58 @@ namespace zypp
       friend std::ostream & operator<<( std::ostream & str, const Step & obj );
 
       public:
-       Step();
-       Step( const RW_pointer<Impl> & pimpl_r, detail::IdType id_r )
-         : _solv( id_r )
-         , _pimpl( pimpl_r )
-       {}
+        Step();
+        Step( const RW_pointer<Impl> & pimpl_r, detail::IdType id_r )
+          : _solv( id_r )
+          , _pimpl( pimpl_r )
+        {}
 
       public:
-       /** Type of action to perform in this step. */
-       StepType stepType() const;
-
-       /** Step action result. */
-       StepStage stepStage() const;
-
-       /** Set step action result. */
-       void stepStage( StepStage val_r );
-
-       /** Return the corresponding \ref Solvable.
-        * Returns \ref Solvable::noSolvable if the item is meanwhile deleted and
-        * was removed from the pool. \see Post mortem acccess to @System solvables.
-        */
-       Solvable satSolvable() const
-       { return _solv; }
-
-       /** \name Post mortem acccess to @System solvables
-        * \code
-        *   Transaction::Step step;
-        *   if ( step.satSolvable() )
-        *     std::cout << step.satSolvable() << endl;
-        *   else
-        *     std::cout << step.ident() << endl; // deleted @System solvable
-        * \endcode
-        */
-       //@{
-       /** \see \ref sat::Solvable::ident. */
-       IdString ident() const;
-
-       /** \see \ref sat::Solvable::edition. */
-       Edition edition() const;
-
-       /** \see \ref sat::Solvable::arch. */
-       Arch arch() const;
-       //@}
-
-       /** Implicit conversion to \ref Solvable */
-       operator const Solvable &() const { return _solv; }
-       /** \overload nonconst */
-       operator Solvable &() { return _solv; }
+        /** Type of action to perform in this step. */
+        StepType stepType() const;
+
+        /** Step action result. */
+        StepStage stepStage() const;
+
+        /** Set step action result. */
+        void stepStage( StepStage val_r );
+
+        /** Return the corresponding \ref Solvable.
+         * Returns \ref Solvable::noSolvable if the item is meanwhile deleted and
+         * was removed from the pool. \see Post mortem acccess to @System solvables.
+         */
+        Solvable satSolvable() const
+        { return _solv; }
+
+        /** \name Post mortem acccess to @System solvables
+         * \code
+         *   Transaction::Step step;
+         *   if ( step.satSolvable() )
+         *     std::cout << step.satSolvable() << endl;
+         *   else
+         *     std::cout << step.ident() << endl; // deleted @System solvable
+         * \endcode
+         */
+        //@{
+        /** \see \ref sat::Solvable::ident. */
+        IdString ident() const;
+
+        /** \see \ref sat::Solvable::edition. */
+        Edition edition() const;
+
+        /** \see \ref sat::Solvable::arch. */
+        Arch arch() const;
+        //@}
+
+        /** Implicit conversion to \ref Solvable */
+        operator const Solvable &() const { return _solv; }
+        /** \overload nonconst */
+        operator Solvable &() { return _solv; }
 
       private:
-       Solvable _solv;
-       /** Pointer to implementation */
-       RW_pointer<Impl> _pimpl;
+        Solvable _solv;
+        /** Pointer to implementation */
+        RW_pointer<Impl> _pimpl;
     };
 
     /** \relates Transaction::Step Stream output */
@@ -297,23 +297,23 @@ namespace zypp
       , Transaction::Step              // Reference
       >
       {
-       public:
-         Transaction_iterator();
-         Transaction_iterator( const RW_pointer<Transaction::Impl> & pimpl_r, base_type id_r )
-         : Transaction_iterator::iterator_adaptor_( id_r )
-         , _pimpl( pimpl_r )
-         {}
-
-       private:
-         friend class boost::iterator_core_access;
-
-         reference dereference() const
-         { return Transaction::Step( _pimpl, *base() ); }
-
-       private:
-         friend class Transaction_const_iterator;
-         /** Pointer to implementation */
-         RW_pointer<Transaction::Impl> _pimpl;
+        public:
+          Transaction_iterator();
+          Transaction_iterator( const RW_pointer<Transaction::Impl> & pimpl_r, base_type id_r )
+          : Transaction_iterator::iterator_adaptor_( id_r )
+          , _pimpl( pimpl_r )
+          {}
+
+        private:
+          friend class boost::iterator_core_access;
+
+          reference dereference() const
+          { return Transaction::Step( _pimpl, *base() ); }
+
+        private:
+          friend class Transaction_const_iterator;
+          /** Pointer to implementation */
+          RW_pointer<Transaction::Impl> _pimpl;
       };
 
      /** \ref Transaction const_iterator.
@@ -326,23 +326,23 @@ namespace zypp
       , const Transaction::Step                // Reference
       >
       {
-       public:
-         Transaction_const_iterator();
-         Transaction_const_iterator( const Transaction_iterator & iter_r );
-         Transaction_const_iterator( const RW_pointer<Transaction::Impl> & pimpl_r, base_type id_r )
-         : Transaction_const_iterator::iterator_adaptor_( id_r )
-         , _pimpl( pimpl_r )
-         {}
-
-       private:
-         friend class boost::iterator_core_access;
-
-         reference dereference() const
-         { return Transaction::Step( _pimpl, *base() ); }
-
-       private:
-         /** Pointer to implementation */
-         RW_pointer<Transaction::Impl> _pimpl;
+        public:
+          Transaction_const_iterator();
+          Transaction_const_iterator( const Transaction_iterator & iter_r );
+          Transaction_const_iterator( const RW_pointer<Transaction::Impl> & pimpl_r, base_type id_r )
+          : Transaction_const_iterator::iterator_adaptor_( id_r )
+          , _pimpl( pimpl_r )
+          {}
+
+        private:
+          friend class boost::iterator_core_access;
+
+          reference dereference() const
+          { return Transaction::Step( _pimpl, *base() ); }
+
+        private:
+          /** Pointer to implementation */
+          RW_pointer<Transaction::Impl> _pimpl;
       };
 
        /////////////////////////////////////////////////////////////////
@@ -369,9 +369,9 @@ namespace zypp
 
       bool operator()( const Transaction::Step & step_r ) const
       {
-       if ( step_r.stepType() == Transaction::TRANSACTION_IGNORE )
-         return false; // no action
-       return !_filter || _filter.testFlag( step_r.stepStage() );
+        if ( step_r.stepType() == Transaction::TRANSACTION_IGNORE )
+          return false; // no action
+        return !_filter || _filter.testFlag( step_r.stepStage() );
       }
 
       StepStages _filter;
@@ -390,7 +390,7 @@ namespace zypp
     {
       size_t cnt = 0;
       for_( it, actionBegin( filter_r ), actionEnd() )
-       ++cnt;
+        ++cnt;
       return cnt;
     }
 
index e2abb67..17c4118 100644 (file)
@@ -101,31 +101,31 @@ namespace zypp
 
       const Pathname & sysconfigStoragePath()
       {
-       static const Pathname _val( "/etc/sysconfig/storage" );
-       return _val;
+        static const Pathname _val( "/etc/sysconfig/storage" );
+        return _val;
       }
 
       /////////////////////////////////////////////////////////////////
 
       static void logSat( CPool *, void *data, int type, const char *logString )
       {
-       //                            "1234567890123456789012345678901234567890
-       if ( 0 == strncmp( logString, "job: user installed", 19 ) )
-         return;
-       if ( 0 == strncmp( logString, "job: multiversion", 17 ) )
-         return;
-       if ( 0 == strncmp( logString, "  - no rule created", 19 ) )
-         return;
-       if ( 0 == strncmp( logString, "    next rules: 0 0", 19 ) )
-         return;
-
-       if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
-         L_ERR("libsolv") << logString;
-       } else if ( type & SOLV_DEBUG_STATS ) {
-         L_DBG("libsolv") << logString;
-       } else {
-         L_MIL("libsolv") << logString;
-       }
+        //                            "1234567890123456789012345678901234567890
+        if ( 0 == strncmp( logString, "job: user installed", 19 ) )
+          return;
+        if ( 0 == strncmp( logString, "job: multiversion", 17 ) )
+          return;
+        if ( 0 == strncmp( logString, "  - no rule created", 19 ) )
+          return;
+        if ( 0 == strncmp( logString, "    next rules: 0 0", 19 ) )
+          return;
+
+        if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
+          L_ERR("libsolv") << logString;
+        } else if ( type & SOLV_DEBUG_STATS ) {
+          L_DBG("libsolv") << logString;
+        } else {
+          L_MIL("libsolv") << logString;
+        }
       }
 
       detail::IdType PoolImpl::nsCallback( CPool *, void * data, detail::IdType lhs, detail::IdType rhs )
@@ -142,8 +142,8 @@ namespace zypp
         {
           case NAMESPACE_LANGUAGE:
           {
-           const TrackedLocaleIds & localeIds( reinterpret_cast<PoolImpl*>(data)->trackedLocaleIds() );
-           return localeIds.contains( IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
+            const TrackedLocaleIds & localeIds( reinterpret_cast<PoolImpl*>(data)->trackedLocaleIds() );
+            return localeIds.contains( IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
           }
           break;
 
@@ -159,7 +159,7 @@ namespace zypp
 
           case NAMESPACE_FILESYSTEM:
           {
-           const std::set<std::string> & requiredFilesystems( reinterpret_cast<PoolImpl*>(data)->requiredFilesystems() );
+            const std::set<std::string> & requiredFilesystems( reinterpret_cast<PoolImpl*>(data)->requiredFilesystems() );
             return requiredFilesystems.find( IdString(rhs).asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported;
           }
           break;
@@ -198,19 +198,19 @@ namespace zypp
         ::pool_setdisttype(_pool, DISTTYPE_RPM );
 
         // initialialize logging
-       if ( env::LIBSOLV_DEBUGMASK() )
-       {
-         ::pool_setdebugmask(_pool, env::LIBSOLV_DEBUGMASK() );
-       }
-       else
-       {
-         if ( getenv("ZYPP_LIBSOLV_FULLLOG") || getenv("ZYPP_LIBSAT_FULLLOG") )
-           ::pool_setdebuglevel( _pool, 3 );
-         else if ( getenv("ZYPP_FULLLOG") )
-           ::pool_setdebuglevel( _pool, 2 );
-         else
-           ::pool_setdebugmask(_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS );
-       }
+        if ( env::LIBSOLV_DEBUGMASK() )
+        {
+          ::pool_setdebugmask(_pool, env::LIBSOLV_DEBUGMASK() );
+        }
+        else
+        {
+          if ( getenv("ZYPP_LIBSOLV_FULLLOG") || getenv("ZYPP_LIBSAT_FULLLOG") )
+            ::pool_setdebuglevel( _pool, 3 );
+          else if ( getenv("ZYPP_FULLLOG") )
+            ::pool_setdebuglevel( _pool, 2 );
+          else
+            ::pool_setdebugmask(_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS );
+        }
 
         ::pool_setdebugcallback( _pool, logSat, NULL );
 
@@ -218,12 +218,12 @@ namespace zypp
         _pool->nscallback = &nsCallback;
         _pool->nscallbackdata = (void*)this;
 
-       // CAVEAT: We'd like to do it here, but in side the Pool ctor we can not
-       // yet use IdString types. We do in setDirty, when the 1st
-       // _retractedSpec.addProvides( Capability( Solvable::retractedToken.id() ) );
-       // _ptfMasterSpec.addProvides( Capability( Solvable::ptfMasterToken.id() ) );
-       // _ptfPackageSpec.addProvides( Capability( Solvable::ptfPackageToken.id() ) );
-       _retractedSpec.addIdenticalInstalledToo( true ); // retracted indicator is not part of the package!
+        // CAVEAT: We'd like to do it here, but in side the Pool ctor we can not
+        // yet use IdString types. We do in setDirty, when the 1st
+        // _retractedSpec.addProvides( Capability( Solvable::retractedToken.id() ) );
+        // _ptfMasterSpec.addProvides( Capability( Solvable::ptfMasterToken.id() ) );
+        // _ptfPackageSpec.addProvides( Capability( Solvable::ptfPackageToken.id() ) );
+        _retractedSpec.addIdenticalInstalledToo( true ); // retracted indicator is not part of the package!
       }
 
       ///////////////////////////////////////////////////////////////////
@@ -240,12 +240,12 @@ namespace zypp
 
       void PoolImpl::setDirty( const char * a1, const char * a2, const char * a3 )
       {
-       if ( _retractedSpec.empty() ) {
-         // lazy init IdString types we can not use inside the ctor
-         _retractedSpec.addProvides( Capability( Solvable::retractedToken.id() ) );
-         _ptfMasterSpec.addProvides( Capability( Solvable::ptfMasterToken.id() ) );
-         _ptfPackageSpec.addProvides( Capability( Solvable::ptfPackageToken.id() ) );
-       }
+        if ( _retractedSpec.empty() ) {
+          // lazy init IdString types we can not use inside the ctor
+          _retractedSpec.addProvides( Capability( Solvable::retractedToken.id() ) );
+          _ptfMasterSpec.addProvides( Capability( Solvable::ptfMasterToken.id() ) );
+          _ptfPackageSpec.addProvides( Capability( Solvable::ptfPackageToken.id() ) );
+        }
 
         if ( a1 )
         {
@@ -256,11 +256,11 @@ namespace zypp
         _serial.setDirty();           // pool content change
         _availableLocalesPtr.reset(); // available locales may change
         _multiversionListPtr.reset(); // re-evaluate ZConfig::multiversionSpec.
-       _needrebootSpec.setDirty();   // re-evaluate needrebootSpec
+        _needrebootSpec.setDirty();   // re-evaluate needrebootSpec
 
-       _retractedSpec.setDirty();    // re-evaluate blacklisted spec
-       _ptfMasterSpec.setDirty();    //  --"--
-       _ptfPackageSpec.setDirty();   //  --"--
+        _retractedSpec.setDirty();    // re-evaluate blacklisted spec
+        _ptfMasterSpec.setDirty();    //  --"--
+        _ptfPackageSpec.setDirty();   //  --"--
 
         depSetDirty(); // invaldate dependency/namespace related indices
       }
@@ -290,14 +290,14 @@ namespace zypp
 
       void PoolImpl::prepare() const
       {
-       // additional /etc/sysconfig/storage check:
-       static WatchFile sysconfigFile( sysconfigStoragePath(), WatchFile::NO_INIT );
-       if ( sysconfigFile.hasChanged() )
-       {
-         _requiredFilesystemsPtr.reset(); // recreated on demand
-         const_cast<PoolImpl*>(this)->depSetDirty( "/etc/sysconfig/storage change" );
-       }
-       if ( _watcher.remember( _serial ) )
+        // additional /etc/sysconfig/storage check:
+        static WatchFile sysconfigFile( sysconfigStoragePath(), WatchFile::NO_INIT );
+        if ( sysconfigFile.hasChanged() )
+        {
+          _requiredFilesystemsPtr.reset(); // recreated on demand
+          const_cast<PoolImpl*>(this)->depSetDirty( "/etc/sysconfig/storage change" );
+        }
+        if ( _watcher.remember( _serial ) )
         {
           // After repo/solvable add/remove:
           // set pool architecture
@@ -312,8 +312,8 @@ namespace zypp
         }
         if ( ! _pool->languages )
         {
-         // initial seting
-         const_cast<PoolImpl*>(this)->setTextLocale( ZConfig::instance().textLocale() );
+          // initial seting
+          const_cast<PoolImpl*>(this)->setTextLocale( ZConfig::instance().textLocale() );
         }
       }
 
@@ -331,17 +331,17 @@ namespace zypp
       void PoolImpl::_deleteRepo( CRepo * repo_r )
       {
         setDirty(__FUNCTION__, repo_r->name );
-       if ( isSystemRepo( repo_r ) )
-         _autoinstalled.clear();
+        if ( isSystemRepo( repo_r ) )
+          _autoinstalled.clear();
         eraseRepoInfo( repo_r );
         ::repo_free( repo_r, /*resusePoolIDs*/false );
-       // If the last repo is removed clear the pool to actually reuse all IDs.
-       // NOTE: the explicit ::repo_free above asserts all solvables are memset(0)!
-       if ( !_pool->urepos )
-       {
-         _serialIDs.setDirty();        // Indicate resusePoolIDs - ResPool must also invalidate it's PoolItems
-         ::pool_freeallrepos( _pool, /*resusePoolIDs*/true );
-       }
+        // If the last repo is removed clear the pool to actually reuse all IDs.
+        // NOTE: the explicit ::repo_free above asserts all solvables are memset(0)!
+        if ( !_pool->urepos )
+        {
+          _serialIDs.setDirty();       // Indicate resusePoolIDs - ResPool must also invalidate it's PoolItems
+          ::pool_freeallrepos( _pool, /*resusePoolIDs*/true );
+        }
       }
 
       int PoolImpl::_addSolv( CRepo * repo_r, FILE * file_r )
@@ -436,8 +436,8 @@ namespace zypp
             dirty = true;
           }
 
-         // subpriority is used to e.g. prefer http over dvd iff
-         // both have same priority.
+          // subpriority is used to e.g. prefer http over dvd iff
+          // both have same priority.
           int mediaPriority( media::MediaPriority( info_r.url() ) );
           if ( repo->subpriority != mediaPriority )
           {
@@ -455,65 +455,65 @@ namespace zypp
 
       void PoolImpl::setTextLocale( const Locale & locale_r )
       {
-       if ( ! locale_r )
-       {
-         // We need one, so "en" is the last resort
-         const char *needone[] { "en" };
-         ::pool_set_languages( _pool, needone, 1 );
-         return;
-       }
-
-       std::vector<std::string> fallbacklist;
-       for ( Locale l( locale_r ); l; l = l.fallback() )
-       {
-         fallbacklist.push_back( l.code() );
-       }
-       dumpRangeLine( MIL << "pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
-
-       std::vector<const char *> fallbacklist_cstr;
-       for_( it, fallbacklist.begin(), fallbacklist.end() )
-       {
-         fallbacklist_cstr.push_back( it->c_str() );
-       }
-       ::pool_set_languages( _pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
+        if ( ! locale_r )
+        {
+          // We need one, so "en" is the last resort
+          const char *needone[] { "en" };
+          ::pool_set_languages( _pool, needone, 1 );
+          return;
+        }
+
+        std::vector<std::string> fallbacklist;
+        for ( Locale l( locale_r ); l; l = l.fallback() )
+        {
+          fallbacklist.push_back( l.code() );
+        }
+        dumpRangeLine( MIL << "pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl;
+
+        std::vector<const char *> fallbacklist_cstr;
+        for_( it, fallbacklist.begin(), fallbacklist.end() )
+        {
+          fallbacklist_cstr.push_back( it->c_str() );
+        }
+        ::pool_set_languages( _pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() );
       }
 
       void PoolImpl::initRequestedLocales( const LocaleSet & locales_r )
       {
-       if ( _requestedLocalesTracker.setInitial( locales_r ) )
-       {
-         localeSetDirty( "initRequestedLocales" );
-         MIL << "Init RequestedLocales: " << _requestedLocalesTracker << " =" << locales_r << endl;
-       }
+        if ( _requestedLocalesTracker.setInitial( locales_r ) )
+        {
+          localeSetDirty( "initRequestedLocales" );
+          MIL << "Init RequestedLocales: " << _requestedLocalesTracker << " =" << locales_r << endl;
+        }
       }
 
       void PoolImpl::setRequestedLocales( const LocaleSet & locales_r )
       {
-       if ( _requestedLocalesTracker.set( locales_r ) )
-       {
-         localeSetDirty( "setRequestedLocales" );
-         MIL << "New RequestedLocales: " << _requestedLocalesTracker << " =" << locales_r << endl;
-       }
+        if ( _requestedLocalesTracker.set( locales_r ) )
+        {
+          localeSetDirty( "setRequestedLocales" );
+          MIL << "New RequestedLocales: " << _requestedLocalesTracker << " =" << locales_r << endl;
+        }
       }
 
       bool PoolImpl::addRequestedLocale( const Locale & locale_r )
       {
-       bool done = _requestedLocalesTracker.add( locale_r );
+        bool done = _requestedLocalesTracker.add( locale_r );
         if ( done )
         {
           localeSetDirty( "addRequestedLocale", locale_r.code().c_str() );
-         MIL << "New RequestedLocales: " << _requestedLocalesTracker << " +" << locale_r << endl;
+          MIL << "New RequestedLocales: " << _requestedLocalesTracker << " +" << locale_r << endl;
         }
         return done;
       }
 
       bool PoolImpl::eraseRequestedLocale( const Locale & locale_r )
       {
-       bool done = _requestedLocalesTracker.remove( locale_r );
+        bool done = _requestedLocalesTracker.remove( locale_r );
         if ( done )
         {
           localeSetDirty( "addRequestedLocale", locale_r.code().c_str() );
-         MIL << "New RequestedLocales: " << _requestedLocalesTracker << " -" << locale_r << endl;
+          MIL << "New RequestedLocales: " << _requestedLocalesTracker << " -" << locale_r << endl;
         }
         return done;
       }
@@ -521,42 +521,42 @@ namespace zypp
 
       const PoolImpl::TrackedLocaleIds & PoolImpl::trackedLocaleIds() const
       {
-       if ( ! _trackedLocaleIdsPtr )
-       {
-         _trackedLocaleIdsPtr.reset( new TrackedLocaleIds );
-
-         const base::SetTracker<LocaleSet> &   localesTracker( _requestedLocalesTracker );
-         TrackedLocaleIds &                    localeIds( *_trackedLocaleIdsPtr );
-
-         // Add current locales+fallback except for added ones
-         for ( Locale lang: localesTracker.current() )
-         {
-           if ( localesTracker.wasAdded( lang ) )
-             continue;
-           for ( ; lang; lang = lang.fallback() )
-           { localeIds.current().insert( IdString(lang) ); }
-         }
-
-         // Add added locales+fallback except they are already in current
-         for ( Locale lang: localesTracker.added() )
-         {
-           for ( ; lang && localeIds.current().insert( IdString(lang) ).second; lang = lang.fallback() )
-           { localeIds.added().insert( IdString(lang) ); }
-         }
-
-         // Add removed locales+fallback except they are still in current
-         for ( Locale lang: localesTracker.removed() )
-         {
-           for ( ; lang && ! localeIds.current().count( IdString(lang) ); lang = lang.fallback() )
-           { localeIds.removed().insert( IdString(lang) ); }
-         }
-
-         // bsc#1155678: We try to differ between an empty RequestedLocales
-         // and one containing 'en' (explicit or as fallback). An empty RequestedLocales
-         // should not even drag in recommended 'en' packages. So we no longer enforce
-         // 'en' being in the set.
-       }
-       return *_trackedLocaleIdsPtr;
+        if ( ! _trackedLocaleIdsPtr )
+        {
+          _trackedLocaleIdsPtr.reset( new TrackedLocaleIds );
+
+          const base::SetTracker<LocaleSet> &  localesTracker( _requestedLocalesTracker );
+          TrackedLocaleIds &                   localeIds( *_trackedLocaleIdsPtr );
+
+          // Add current locales+fallback except for added ones
+          for ( Locale lang: localesTracker.current() )
+          {
+            if ( localesTracker.wasAdded( lang ) )
+              continue;
+            for ( ; lang; lang = lang.fallback() )
+            { localeIds.current().insert( IdString(lang) ); }
+          }
+
+          // Add added locales+fallback except they are already in current
+          for ( Locale lang: localesTracker.added() )
+          {
+            for ( ; lang && localeIds.current().insert( IdString(lang) ).second; lang = lang.fallback() )
+            { localeIds.added().insert( IdString(lang) ); }
+          }
+
+          // Add removed locales+fallback except they are still in current
+          for ( Locale lang: localesTracker.removed() )
+          {
+            for ( ; lang && ! localeIds.current().count( IdString(lang) ); lang = lang.fallback() )
+            { localeIds.removed().insert( IdString(lang) ); }
+          }
+
+          // bsc#1155678: We try to differ between an empty RequestedLocales
+          // and one containing 'en' (explicit or as fallback). An empty RequestedLocales
+          // should not even drag in recommended 'en' packages. So we no longer enforce
+          // 'en' being in the set.
+        }
+        return *_trackedLocaleIdsPtr;
       }
 
 
@@ -594,16 +594,16 @@ namespace zypp
       {
         if ( !_availableLocalesPtr )
         {
-         _availableLocalesPtr.reset( new LocaleSet );
-         LocaleSet & localeSet( *_availableLocalesPtr );
-
-         for ( const Solvable & pi : Pool::instance().solvables() )
-         {
-           for ( const Capability & cap : pi.supplements() )
-           {
-             _getLocaleDeps( cap, localeSet );
+          _availableLocalesPtr.reset( new LocaleSet );
+          LocaleSet & localeSet( *_availableLocalesPtr );
+
+          for ( const Solvable & pi : Pool::instance().solvables() )
+          {
+            for ( const Capability & cap : pi.supplements() )
+            {
+              _getLocaleDeps( cap, localeSet );
             }
-         }
+          }
         }
         return *_availableLocalesPtr;
       }
@@ -614,22 +614,22 @@ namespace zypp
       {
         _multiversionListPtr.reset( new MultiversionList );
         MultiversionList & multiversionList( *_multiversionListPtr );
-       
-       MultiversionList::size_type size = 0;
+
+        MultiversionList::size_type size = 0;
         for ( const std::string & spec : ZConfig::instance().multiversionSpec() )
-       {
-         static const std::string prefix( "provides:" );
-         bool provides = str::hasPrefix( spec, prefix );
-
-         for ( Solvable solv : WhatProvides( Capability( provides ? spec.c_str() + prefix.size() : spec.c_str() ) ) )
-         {
-           if ( provides || solv.ident() == spec )
-             multiversionList.insert( solv );
-         }
-
-         MultiversionList::size_type nsize = multiversionList.size();
-         MIL << "Multiversion install " << spec << ": " << (nsize-size) << " matches" << endl;
-         size = nsize;
+        {
+          static const std::string prefix( "provides:" );
+          bool provides = str::hasPrefix( spec, prefix );
+
+          for ( Solvable solv : WhatProvides( Capability( provides ? spec.c_str() + prefix.size() : spec.c_str() ) ) )
+          {
+            if ( provides || solv.ident() == spec )
+              multiversionList.insert( solv );
+          }
+
+          MultiversionList::size_type nsize = multiversionList.size();
+          MIL << "Multiversion install " << spec << ": " << (nsize-size) << " matches" << endl;
+          size = nsize;
         }
       }
 
@@ -638,9 +638,9 @@ namespace zypp
 
       const PoolImpl::MultiversionList & PoolImpl::multiversionList() const
       {
-       if ( ! _multiversionListPtr )
-         multiversionListInit();
-       return *_multiversionListPtr;
+        if ( ! _multiversionListPtr )
+          multiversionListInit();
+        return *_multiversionListPtr;
       }
 
       bool PoolImpl::isMultiversion( const Solvable & solv_r ) const
@@ -650,14 +650,14 @@ namespace zypp
 
       const std::set<std::string> & PoolImpl::requiredFilesystems() const
       {
-       if ( ! _requiredFilesystemsPtr )
-       {
-         _requiredFilesystemsPtr.reset( new std::set<std::string> );
-         std::set<std::string> & requiredFilesystems( *_requiredFilesystemsPtr );
-         str::split( base::sysconfig::read( sysconfigStoragePath() )["USED_FS_LIST"],
-                     std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
-       }
-       return *_requiredFilesystemsPtr;
+        if ( ! _requiredFilesystemsPtr )
+        {
+          _requiredFilesystemsPtr.reset( new std::set<std::string> );
+          std::set<std::string> & requiredFilesystems( *_requiredFilesystemsPtr );
+          str::split( base::sysconfig::read( sysconfigStoragePath() )["USED_FS_LIST"],
+                      std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
+        }
+        return *_requiredFilesystemsPtr;
       }
 
       /////////////////////////////////////////////////////////////////
index 882dd11..dc7e751 100644 (file)
@@ -104,20 +104,20 @@ namespace zypp
           { return _pool->installed; }
 
           /** Get rootdir (for file conflicts check) */
-         Pathname rootDir() const
-         {
-           const char * rd = ::pool_get_rootdir( _pool );
-           return( rd ? rd : "/" );
-         }
-
-         /** Set rootdir (for file conflicts check) */
-         void rootDir( const Pathname & root_r )
-         {
-           if ( root_r.empty() || root_r == "/" )
-             ::pool_set_rootdir( _pool, nullptr );
-           else
-             ::pool_set_rootdir( _pool, root_r.c_str() );
-         }
+          Pathname rootDir() const
+          {
+            const char * rd = ::pool_get_rootdir( _pool );
+            return( rd ? rd : "/" );
+          }
+
+          /** Set rootdir (for file conflicts check) */
+          void rootDir( const Pathname & root_r )
+          {
+            if ( root_r.empty() || root_r == "/" )
+              ::pool_set_rootdir( _pool, nullptr );
+            else
+              ::pool_set_rootdir( _pool, root_r.c_str() );
+          }
 
         public:
           /** \name Actions invalidating housekeeping data.
@@ -232,20 +232,20 @@ namespace zypp
 
         public:
           /// \name Requested locales.
-         /// The requested LocaleSets managed in _requestedLocalesTracker
-         /// are unexpanded; i.e. they contain just the pure user selection.
-         /// The resolver however uses expanded sets ('de_DE' will also
-         /// include its fallback locales 'de', (en); here in the namespace:
-         /// callback and in the Resolver itself).
+          /// The requested LocaleSets managed in _requestedLocalesTracker
+          /// are unexpanded; i.e. they contain just the pure user selection.
+          /// The resolver however uses expanded sets ('de_DE' will also
+          /// include its fallback locales 'de', (en); here in the namespace:
+          /// callback and in the Resolver itself).
           //@{
-         /** */
-         void setTextLocale( const Locale & locale_r );
+          /** */
+          void setTextLocale( const Locale & locale_r );
 
 
-         /** Start tracking changes based on this \a locales_r.
-          * Usually called on TargetInit.
-          */
-         void initRequestedLocales( const LocaleSet & locales_r );
+          /** Start tracking changes based on this \a locales_r.
+           * Usually called on TargetInit.
+           */
+          void initRequestedLocales( const LocaleSet & locales_r );
 
           /** Added since last initRequestedLocales. */
           const LocaleSet & getAddedRequestedLocales() const
@@ -269,7 +269,7 @@ namespace zypp
           /** User change (tracked). */
           bool eraseRequestedLocale( const Locale & locale_r );
 
-         /** All Locales occurring in any repo. */
+          /** All Locales occurring in any repo. */
           const LocaleSet & getAvailableLocales() const;
 
           bool isAvailableLocale( const Locale & locale_r ) const
@@ -294,19 +294,19 @@ namespace zypp
 
           bool isMultiversion( const Solvable & solv_r ) const;
 
-         void multiversionSpecChanged();
+          void multiversionSpecChanged();
           //@}
 
         public:
           /** \name Installed on behalf of a user request hint. */
           //@{
           /** Get ident list of all autoinstalled solvables. */
-         StringQueue autoInstalled() const
-         { return _autoinstalled; }
+          StringQueue autoInstalled() const
+          { return _autoinstalled; }
 
-         /** Set ident list of all autoinstalled solvables. */
-         void setAutoInstalled( const StringQueue & autoInstalled_r )
-         { _autoinstalled = autoInstalled_r; }
+          /** Set ident list of all autoinstalled solvables. */
+          void setAutoInstalled( const StringQueue & autoInstalled_r )
+          { _autoinstalled = autoInstalled_r; }
 
           bool isOnSystemByUser( IdString ident_r ) const
           { return !_autoinstalled.contains( ident_r.id() ); }
@@ -315,23 +315,23 @@ namespace zypp
           { return _autoinstalled.contains( ident_r.id() ); }
           //@}
 
-       public:
-         /** \name Solvables which should trigger the reboot-needed hint if installed/updated. */
+        public:
+          /** \name Solvables which should trigger the reboot-needed hint if installed/updated. */
           //@{
           /** Set new Solvable specs.*/
           void setNeedrebootSpec( sat::SolvableSpec needrebootSpec_r )
-         {
-           _needrebootSpec = std::move(needrebootSpec_r);
-           _needrebootSpec.setDirty();
-         }
-
-         /** Whether \a solv_r matches the spec.*/
-         bool isNeedreboot( const Solvable & solv_r ) const
-         { return _needrebootSpec.contains( solv_r ); }
+          {
+            _needrebootSpec = std::move(needrebootSpec_r);
+            _needrebootSpec.setDirty();
+          }
+
+          /** Whether \a solv_r matches the spec.*/
+          bool isNeedreboot( const Solvable & solv_r ) const
+          { return _needrebootSpec.contains( solv_r ); }
           //@}
 
-       public:
-         /** \name Blacklisted Solvables. */
+        public:
+          /** \name Blacklisted Solvables. */
           //@{
           bool isRetracted( const Solvable & solv_r ) const
           { return _retractedSpec.contains( solv_r ); }
@@ -341,9 +341,9 @@ namespace zypp
           { return _ptfPackageSpec.contains( solv_r ); }
           //@}
 
-       public:
-         /** accessor for etc/sysconfig/storage reading file on demand */
-         const std::set<std::string> & requiredFilesystems() const;
+        public:
+          /** accessor for etc/sysconfig/storage reading file on demand */
+          const std::set<std::string> & requiredFilesystems() const;
 
         private:
           /** sat-pool. */
@@ -358,8 +358,8 @@ namespace zypp
           std::map<RepoIdType,RepoInfo> _repoinfos;
 
           /**  */
-         base::SetTracker<LocaleSet> _requestedLocalesTracker;
-         mutable scoped_ptr<TrackedLocaleIds> _trackedLocaleIdsPtr;
+          base::SetTracker<LocaleSet> _requestedLocalesTracker;
+          mutable scoped_ptr<TrackedLocaleIds> _trackedLocaleIdsPtr;
 
           mutable scoped_ptr<LocaleSet> _availableLocalesPtr;
 
@@ -368,18 +368,18 @@ namespace zypp
           mutable scoped_ptr<MultiversionList> _multiversionListPtr;
 
           /**  */
-         sat::StringQueue _autoinstalled;
+          sat::StringQueue _autoinstalled;
 
-         /** Solvables which should trigger the reboot-needed hint if installed/updated. */
-         sat::SolvableSpec _needrebootSpec;
+          /** Solvables which should trigger the reboot-needed hint if installed/updated. */
+          sat::SolvableSpec _needrebootSpec;
 
-         /** Blacklisted specs: */
-         sat::SolvableSpec _retractedSpec;
-         sat::SolvableSpec _ptfMasterSpec;
-         sat::SolvableSpec _ptfPackageSpec;
+          /** Blacklisted specs: */
+          sat::SolvableSpec _retractedSpec;
+          sat::SolvableSpec _ptfMasterSpec;
+          sat::SolvableSpec _ptfPackageSpec;
 
-         /** filesystems mentioned in /etc/sysconfig/storage */
-         mutable scoped_ptr<std::set<std::string> > _requiredFilesystemsPtr;
+          /** filesystems mentioned in /etc/sysconfig/storage */
+          mutable scoped_ptr<std::set<std::string> > _requiredFilesystemsPtr;
       };
       ///////////////////////////////////////////////////////////////////
 
index defbe99..7a4a4b9 100644 (file)
@@ -31,53 +31,53 @@ namespace zypp
       struct ItemCapKind
       {
       public:
-       ItemCapKind() : _pimpl( new Impl ) {}
+        ItemCapKind() : _pimpl( new Impl ) {}
 
-       ItemCapKind( PoolItem i, Capability c, Dep k, bool initial ) : _pimpl( new Impl( i, c, k, initial ) ) {}
+        ItemCapKind( PoolItem i, Capability c, Dep k, bool initial ) : _pimpl( new Impl( i, c, k, initial ) ) {}
 
-       /** Capability which has triggerd this selection */
-       Capability cap() const
-       { return _pimpl->_cap; }
+        /** Capability which has triggerd this selection */
+        Capability cap() const
+        { return _pimpl->_cap; }
 
-       /** Kind of that capability */
-       Dep capKind() const
-       { return _pimpl->_capKind; }
+        /** Kind of that capability */
+        Dep capKind() const
+        { return _pimpl->_capKind; }
 
-       /** Item which has triggered this selection */
-       PoolItem item() const
-       { return _pimpl->_item; }
+        /** Item which has triggered this selection */
+        PoolItem item() const
+        { return _pimpl->_item; }
 
-       /** This item has triggered the installation (Not already fullfilled requierement only). */
-       bool initialInstallation() const
-       { return _pimpl->_initialInstallation; }
+        /** This item has triggered the installation (Not already fullfilled requierement only). */
+        bool initialInstallation() const
+        { return _pimpl->_initialInstallation; }
 
       private:
-       struct Impl
-       {
-         Impl()
-         : _capKind( Dep::PROVIDES )
-         , _initialInstallation( false )
-         {}
+        struct Impl
+        {
+          Impl()
+          : _capKind( Dep::PROVIDES )
+          , _initialInstallation( false )
+          {}
 
-         Impl( PoolItem i, Capability c, Dep k, bool initial )
-         : _cap( c )
-         , _capKind( k )
-         , _item( i )
-         , _initialInstallation( initial )
-         {}
+          Impl( PoolItem i, Capability c, Dep k, bool initial )
+          : _cap( c )
+          , _capKind( k )
+          , _item( i )
+          , _initialInstallation( initial )
+          {}
 
-         Capability    _cap;
-         Dep           _capKind;
-         PoolItem      _item;
-         bool          _initialInstallation;
+          Capability   _cap;
+          Dep          _capKind;
+          PoolItem     _item;
+          bool         _initialInstallation;
 
-       private:
-         friend Impl * rwcowClone<Impl>( const Impl * rhs );
-         /** clone for RWCOW_pointer */
-         Impl * clone() const
-         { return new Impl( *this ); }
-       };
-       RWCOW_pointer<Impl> _pimpl;
+        private:
+          friend Impl * rwcowClone<Impl>( const Impl * rhs );
+          /** clone for RWCOW_pointer */
+          Impl * clone() const
+          { return new Impl( *this ); }
+        };
+        RWCOW_pointer<Impl> _pimpl;
       };
 
       typedef std::multimap<PoolItem,ItemCapKind> ItemCapKindMap;
index 41ac6f8..84e0dd5 100644 (file)
@@ -49,41 +49,41 @@ namespace zypp
       class ProblemSolutionCombi : public ProblemSolution
       {
       public:
-       /** Constructor. */
-       ProblemSolutionCombi();
+        /** Constructor. */
+        ProblemSolutionCombi();
 
-       /**
-        * Add a single action of an item
-        */
-       void addSingleAction( PoolItem item, TransactionKind action );
+        /**
+         * Add a single action of an item
+         */
+        void addSingleAction( PoolItem item, TransactionKind action );
 
-       /**
-        * Add a single action of a capability
-        */
-       void addSingleAction( Capability capability, TransactionKind action );
+        /**
+         * Add a single action of a capability
+         */
+        void addSingleAction( Capability capability, TransactionKind action );
 
-       /**
-        * Add a single action of a SolverQueueItem
-        */
-       void addSingleAction( SolverQueueItem_Ptr item, TransactionKind action );
+        /**
+         * Add a single action of a SolverQueueItem
+         */
+        void addSingleAction( SolverQueueItem_Ptr item, TransactionKind action );
 
-       /**
-        * returns the number of actions
-        */
-       size_t actionCount()
-       { return actions().size(); }
+        /**
+         * returns the number of actions
+         */
+        size_t actionCount()
+        { return actions().size(); }
 
-       /**
-        * Set description text (append)
-        */
-       void addDescription( std::string description )
-       { pushDescriptionDetail( std::move(description) ); }
+        /**
+         * Set description text (append)
+         */
+        void addDescription( std::string description )
+        { pushDescriptionDetail( std::move(description) ); }
 
-       /**
-        * Set description text (prepend)
-        */
-       void addFrontDescription( std::string description )
-       { pushDescriptionDetail( std::move(description), /*front*/true ); }
+        /**
+         * Set description text (prepend)
+         */
+        void addFrontDescription( std::string description )
+        { pushDescriptionDetail( std::move(description), /*front*/true ); }
       };
 
     } // namespace detail
index 2724db1..df36a4e 100644 (file)
@@ -41,14 +41,14 @@ namespace zypp
       // TranslatorExplanation %s = name of package, patch, selection ...
       : ProblemSolution( str::form(_("break %s by ignoring some of its dependencies"), item.satSolvable().asString().c_str() ) )
       {
-       addAction( new InjectSolutionAction( item, WEAK ) );
+        addAction( new InjectSolutionAction( item, WEAK ) );
       }
 
       ProblemSolutionIgnore::ProblemSolutionIgnore( PoolItemList itemList )
       : ProblemSolution( _("generally ignore of some dependencies") )
       {
-       for ( const auto & item : itemList)
-       { addAction( new InjectSolutionAction( item, WEAK ) ); }
+        for ( const auto & item : itemList)
+        { addAction( new InjectSolutionAction( item, WEAK ) ); }
       }
 
     } // namespace detail
index ec548ee..744bdb5 100644 (file)
@@ -49,10 +49,10 @@ namespace zypp
       class ProblemSolutionIgnore : public ProblemSolution
       {
       public:
-       typedef std::list<PoolItem> PoolItemList;
+        typedef std::list<PoolItem> PoolItemList;
 
-       ProblemSolutionIgnore( PoolItem item );
-       ProblemSolutionIgnore( PoolItemList itemList );
+        ProblemSolutionIgnore( PoolItem item );
+        ProblemSolutionIgnore( PoolItemList itemList );
       };
 
     } // namespace detail
index 46e61f1..6e87ffe 100644 (file)
@@ -190,16 +190,16 @@ void Resolver::removeQueueItem( SolverQueueItem_Ptr item )
 {
     bool found = false;
     for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
-        iter != _added_queue_items.end(); iter++) {
-       if (*iter == item) {
-           _added_queue_items.remove(*iter);
-           found = true;
-           break;
-       }
+         iter != _added_queue_items.end(); iter++) {
+        if (*iter == item) {
+            _added_queue_items.remove(*iter);
+            found = true;
+            break;
+        }
     }
     if (!found) {
-       _removed_queue_items.push_back (item);
-       _removed_queue_items.unique ();
+        _removed_queue_items.push_back (item);
+        _removed_queue_items.unique ();
     }
 }
 
@@ -207,16 +207,16 @@ void Resolver::addQueueItem( SolverQueueItem_Ptr item )
 {
     bool found = false;
     for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
-        iter != _removed_queue_items.end(); iter++) {
-       if (*iter == item) {
-           _removed_queue_items.remove(*iter);
-           found = true;
-           break;
-       }
+         iter != _removed_queue_items.end(); iter++) {
+        if (*iter == item) {
+            _removed_queue_items.remove(*iter);
+            found = true;
+            break;
+        }
     }
     if (!found) {
-       _added_queue_items.push_back (item);
-       _added_queue_items.unique ();
+        _added_queue_items.push_back (item);
+        _added_queue_items.unique ();
     }
 }
 
@@ -229,13 +229,13 @@ struct UndoTransact : public resfilter::PoolItemFilterFunctor
 {
     ResStatus::TransactByValue resStatus;
     UndoTransact ( const ResStatus::TransactByValue &status)
-       :resStatus(status)
+        :resStatus(status)
     { }
 
     bool operator()( PoolItem item )           // only transacts() items go here
     {
-       item.status().resetTransact( resStatus );// clear any solver/establish transactions
-       return true;
+        item.status().resetTransact( resStatus );// clear any solver/establish transactions
+        return true;
     }
 };
 
@@ -244,13 +244,13 @@ struct DoTransact : public resfilter::PoolItemFilterFunctor
 {
     ResStatus::TransactByValue resStatus;
     DoTransact ( const ResStatus::TransactByValue &status)
-       :resStatus(status)
+        :resStatus(status)
     { }
 
     bool operator()( PoolItem item )           // only transacts() items go here
     {
-       item.status().setTransact( true, resStatus );
-       return true;
+        item.status().setTransact( true, resStatus );
+        return true;
     }
 };
 
@@ -264,8 +264,8 @@ bool Resolver::verifySystem()
     _verifying = true;
 
     invokeOnEach ( _pool.begin(), _pool.end(),
-                  resfilter::ByTransact( ),                    // Resetting all transcations
-                  functor::functorRef<bool,PoolItem>(resetting) );
+                   resfilter::ByTransact( ),                   // Resetting all transcations
+                   functor::functorRef<bool,PoolItem>(resetting) );
 
     return resolvePool();
 }
@@ -278,8 +278,8 @@ void Resolver::undo()
     UndoTransact info(ResStatus::APPL_LOW);
     MIL << "*** undo ***" << endl;
     invokeOnEach ( _pool.begin(), _pool.end(),
-                  resfilter::ByTransact( ),                    // collect transacts from Pool to resolver queue
-                  functor::functorRef<bool,PoolItem>(info) );
+                   resfilter::ByTransact( ),                   // collect transacts from Pool to resolver queue
+                   functor::functorRef<bool,PoolItem>(info) );
     //  Regard dependencies of the item weak onl
     _addWeak.clear();
 
@@ -296,13 +296,13 @@ void Resolver::solverInit()
     static bool poolDumped = false;
     MIL << "-------------- Calling SAT Solver -------------------" << endl;
     if ( getenv("ZYPP_FULLLOG") and get() ) { // libzypp/issues/317: get() to make sure a satsolver instance is actually present
-       Testcase testcase("/var/log/YaST2/autoTestcase");
-       if (!poolDumped) {
-           testcase.createTestcase (*this, true, false); // dump pool
-           poolDumped = true;
-       } else {
-           testcase.createTestcase (*this, false, false); // write control file only
-       }
+        Testcase testcase("/var/log/YaST2/autoTestcase");
+        if (!poolDumped) {
+            testcase.createTestcase (*this, true, false); // dump pool
+            poolDumped = true;
+        } else {
+            testcase.createTestcase (*this, false, false); // write control file only
+        }
     }
 
     _satResolver->setFixsystem                 ( isVerifyingMode() );
@@ -337,29 +337,29 @@ bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue )
 
     // add/remove additional SolverQueueItems
     for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin();
-        iter != _removed_queue_items.end(); iter++) {
-       for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
-           if ( (*iterQueue)->cmp(*iter) == 0) {
-               MIL << "remove from queue" << *iter;
-               queue.remove(*iterQueue);
-               break;
-           }
-       }
+         iter != _removed_queue_items.end(); iter++) {
+        for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
+            if ( (*iterQueue)->cmp(*iter) == 0) {
+                MIL << "remove from queue" << *iter;
+                queue.remove(*iterQueue);
+                break;
+            }
+        }
     }
 
     for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin();
-        iter != _added_queue_items.end(); iter++) {
-       bool found = false;
-       for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
-           if ( (*iterQueue)->cmp(*iter) == 0) {
-               found = true;
-               break;
-           }
-       }
-       if (!found) {
-           MIL << "add to queue" << *iter;
-           queue.push_back(*iter);
-       }
+         iter != _added_queue_items.end(); iter++) {
+        bool found = false;
+        for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) {
+            if ( (*iterQueue)->cmp(*iter) == 0) {
+                found = true;
+                break;
+            }
+        }
+        if (!found) {
+            MIL << "add to queue" << *iter;
+            queue.push_back(*iter);
+        }
     }
 
     // The application has to take care to write these solutions back to e.g. selectables in order
@@ -418,147 +418,147 @@ bool Resolver::applySolution( const ProblemSolution & solution )
 void Resolver::collectResolverInfo()
 {
     if ( _satResolver
-        && _isInstalledBy.empty()
-        && _installs.empty()) {
-
-       // generating new
-       PoolItemList itemsToInstall = _satResolver->resultItemsToInstall();
-
-       for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
-            instIter != itemsToInstall.end(); instIter++) {
-           // Requires
-           for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::REQUIRES).begin(); capIt != (*instIter)->dep (Dep::REQUIRES).end(); ++capIt)
-           {
-               sat::WhatProvides possibleProviders(*capIt);
-               for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
-                   PoolItem provider = ResPool::instance().find( *iter );
-
-                   // searching if this provider will already be installed
-                   bool found = false;
-                   bool alreadySetForInstallation = false;
-                   ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
-                   while (pos != _isInstalledBy.end()
-                          && pos->first == provider
-                          && !found) {
-                       alreadySetForInstallation = true;
-                       ItemCapKind capKind = pos->second;
-                       if (capKind.item() == *instIter)  found = true;
-                       pos++;
-                   }
-
-                   if (!found
-                       && provider.status().isToBeInstalled()) {
-                       if (provider.status().isBySolver()) {
-                           ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
-                           _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
-                       } else {
-                           // no initial installation cause it has been set be e.g. user
-                           ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, false );
-                           _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
-                       }
-                       ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
-                       _installs.insert (make_pair( *instIter, capKindisInstalledBy));
-                   }
-
-                   if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
-                       ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, false );
-                       _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
-
-                       ItemCapKind installedSatisfied( *instIter, *capIt, Dep::REQUIRES, false );
-                       _installedSatisfied.insert (make_pair( provider, installedSatisfied));
-                   }
-               }
-           }
-
-           if (!(_satResolver->onlyRequires())) {
-               //Recommends
-               for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::RECOMMENDS).begin(); capIt != (*instIter)->dep (Dep::RECOMMENDS).end(); ++capIt)
-               {
-                   sat::WhatProvides possibleProviders(*capIt);
-                   for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
-                       PoolItem provider = ResPool::instance().find( *iter );
-
-                       // searching if this provider will already be installed
-                       bool found = false;
-                       bool alreadySetForInstallation = false;
-                       ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
-                       while (pos != _isInstalledBy.end()
-                              && pos->first == provider
-                              && !found) {
-                           alreadySetForInstallation = true;
-                           ItemCapKind capKind = pos->second;
-                           if (capKind.item() == *instIter)  found = true;
-                           pos++;
-                       }
-
-                       if (!found
-                           && provider.status().isToBeInstalled()) {
-                           if (provider.status().isBySolver()) {
-                               ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
-                               _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
-                           } else {
-                               // no initial installation cause it has been set be e.g. user
-                               ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, false );
-                               _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
-                           }
-                           ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
-                           _installs.insert (make_pair( *instIter, capKindisInstalledBy));
-                       }
-
-                       if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
-                           ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, false );
-                           _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
-
-                           ItemCapKind installedSatisfied( *instIter, *capIt, Dep::RECOMMENDS, false );
-                           _installedSatisfied.insert (make_pair( provider, installedSatisfied));
-                       }
-                   }
-               }
-
-               //Supplements
-               for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::SUPPLEMENTS).begin(); capIt != (*instIter)->dep (Dep::SUPPLEMENTS).end(); ++capIt)
-               {
-                   sat::WhatProvides possibleProviders(*capIt);
-                   for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
-                       PoolItem provider = ResPool::instance().find( *iter );
-                       // searching if this item will already be installed
-                       bool found = false;
-                       bool alreadySetForInstallation = false;
-                       ItemCapKindMap::const_iterator pos = _isInstalledBy.find(*instIter);
-                       while (pos != _isInstalledBy.end()
-                              && pos->first == *instIter
-                              && !found) {
-                           alreadySetForInstallation = true;
-                           ItemCapKind capKind = pos->second;
-                           if (capKind.item() == provider)  found = true;
-                           pos++;
-                       }
-
-                       if (!found
-                           && instIter->status().isToBeInstalled()) {
-                           if (instIter->status().isBySolver()) {
-                               ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
-                               _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
-                           } else {
-                               // no initial installation cause it has been set be e.g. user
-                               ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, false );
-                               _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
-                           }
-                           ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
-                           _installs.insert (make_pair( provider, capKindisInstalledBy));
-                       }
-
-                       if (instIter->status().staysInstalled()) { // Is already satisfied by an item which is installed
-                           ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
-                           _satifiedByInstalled.insert (make_pair( provider, capKindisInstalledBy));
-
-                           ItemCapKind installedSatisfied( provider, *capIt, Dep::SUPPLEMENTS, false );
-                           _installedSatisfied.insert (make_pair( *instIter, installedSatisfied));
-                       }
-                   }
-               }
-           }
-       }
+         && _isInstalledBy.empty()
+         && _installs.empty()) {
+
+        // generating new
+        PoolItemList itemsToInstall = _satResolver->resultItemsToInstall();
+
+        for (PoolItemList::const_iterator instIter = itemsToInstall.begin();
+             instIter != itemsToInstall.end(); instIter++) {
+            // Requires
+            for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::REQUIRES).begin(); capIt != (*instIter)->dep (Dep::REQUIRES).end(); ++capIt)
+            {
+                sat::WhatProvides possibleProviders(*capIt);
+                for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
+                    PoolItem provider = ResPool::instance().find( *iter );
+
+                    // searching if this provider will already be installed
+                    bool found = false;
+                    bool alreadySetForInstallation = false;
+                    ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
+                    while (pos != _isInstalledBy.end()
+                           && pos->first == provider
+                           && !found) {
+                        alreadySetForInstallation = true;
+                        ItemCapKind capKind = pos->second;
+                        if (capKind.item() == *instIter)  found = true;
+                        pos++;
+                    }
+
+                    if (!found
+                        && provider.status().isToBeInstalled()) {
+                        if (provider.status().isBySolver()) {
+                            ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
+                            _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
+                        } else {
+                            // no initial installation cause it has been set be e.g. user
+                            ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, false );
+                            _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
+                        }
+                        ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, !alreadySetForInstallation );
+                        _installs.insert (make_pair( *instIter, capKindisInstalledBy));
+                    }
+
+                    if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
+                        ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, false );
+                        _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
+
+                        ItemCapKind installedSatisfied( *instIter, *capIt, Dep::REQUIRES, false );
+                        _installedSatisfied.insert (make_pair( provider, installedSatisfied));
+                    }
+                }
+            }
+
+            if (!(_satResolver->onlyRequires())) {
+                //Recommends
+                for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::RECOMMENDS).begin(); capIt != (*instIter)->dep (Dep::RECOMMENDS).end(); ++capIt)
+                {
+                    sat::WhatProvides possibleProviders(*capIt);
+                    for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
+                        PoolItem provider = ResPool::instance().find( *iter );
+
+                        // searching if this provider will already be installed
+                        bool found = false;
+                        bool alreadySetForInstallation = false;
+                        ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider);
+                        while (pos != _isInstalledBy.end()
+                               && pos->first == provider
+                               && !found) {
+                            alreadySetForInstallation = true;
+                            ItemCapKind capKind = pos->second;
+                            if (capKind.item() == *instIter)  found = true;
+                            pos++;
+                        }
+
+                        if (!found
+                            && provider.status().isToBeInstalled()) {
+                            if (provider.status().isBySolver()) {
+                                ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
+                                _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
+                            } else {
+                                // no initial installation cause it has been set be e.g. user
+                                ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, false );
+                                _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy));
+                            }
+                            ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation );
+                            _installs.insert (make_pair( *instIter, capKindisInstalledBy));
+                        }
+
+                        if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed
+                            ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, false );
+                            _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy));
+
+                            ItemCapKind installedSatisfied( *instIter, *capIt, Dep::RECOMMENDS, false );
+                            _installedSatisfied.insert (make_pair( provider, installedSatisfied));
+                        }
+                    }
+                }
+
+                //Supplements
+                for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::SUPPLEMENTS).begin(); capIt != (*instIter)->dep (Dep::SUPPLEMENTS).end(); ++capIt)
+                {
+                    sat::WhatProvides possibleProviders(*capIt);
+                    for_( iter, possibleProviders.begin(), possibleProviders.end() ) {
+                        PoolItem provider = ResPool::instance().find( *iter );
+                        // searching if this item will already be installed
+                        bool found = false;
+                        bool alreadySetForInstallation = false;
+                        ItemCapKindMap::const_iterator pos = _isInstalledBy.find(*instIter);
+                        while (pos != _isInstalledBy.end()
+                               && pos->first == *instIter
+                               && !found) {
+                            alreadySetForInstallation = true;
+                            ItemCapKind capKind = pos->second;
+                            if (capKind.item() == provider)  found = true;
+                            pos++;
+                        }
+
+                        if (!found
+                            && instIter->status().isToBeInstalled()) {
+                            if (instIter->status().isBySolver()) {
+                                ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
+                                _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
+                            } else {
+                                // no initial installation cause it has been set be e.g. user
+                                ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, false );
+                                _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy));
+                            }
+                            ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
+                            _installs.insert (make_pair( provider, capKindisInstalledBy));
+                        }
+
+                        if (instIter->status().staysInstalled()) { // Is already satisfied by an item which is installed
+                            ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation );
+                            _satifiedByInstalled.insert (make_pair( provider, capKindisInstalledBy));
+
+                            ItemCapKind installedSatisfied( provider, *capIt, Dep::SUPPLEMENTS, false );
+                            _installedSatisfied.insert (make_pair( *instIter, installedSatisfied));
+                        }
+                    }
+                }
+            }
+        }
     }
 }
 
@@ -569,15 +569,15 @@ ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
     collectResolverInfo();
 
     for (ItemCapKindMap::const_iterator iter = _isInstalledBy.find(item); iter != _isInstalledBy.end();) {
-       ItemCapKind info = iter->second;
-       PoolItem iterItem = iter->first;
-       if (iterItem == item) {
-           ret.push_back(info);
-           iter++;
-       } else {
-           // exit
-           iter = _isInstalledBy.end();
-       }
+        ItemCapKind info = iter->second;
+        PoolItem iterItem = iter->first;
+        if (iterItem == item) {
+            ret.push_back(info);
+            iter++;
+        } else {
+            // exit
+            iter = _isInstalledBy.end();
+        }
     }
     return ret;
 }
@@ -588,15 +588,15 @@ ItemCapKindList Resolver::installs( const PoolItem & item )
     collectResolverInfo();
 
     for (ItemCapKindMap::const_iterator iter = _installs.find(item); iter != _installs.end();) {
-       ItemCapKind info = iter->second;
-       PoolItem iterItem = iter->first;
-       if (iterItem == item) {
-           ret.push_back(info);
-           iter++;
-       } else {
-           // exit
-           iter = _installs.end();
-       }
+        ItemCapKind info = iter->second;
+        PoolItem iterItem = iter->first;
+        if (iterItem == item) {
+            ret.push_back(info);
+            iter++;
+        } else {
+            // exit
+            iter = _installs.end();
+        }
     }
     return ret;
 }
@@ -607,15 +607,15 @@ ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item )
     collectResolverInfo();
 
     for (ItemCapKindMap::const_iterator iter = _satifiedByInstalled.find(item); iter != _satifiedByInstalled.end();) {
-       ItemCapKind info = iter->second;
-       PoolItem iterItem = iter->first;
-       if (iterItem == item) {
-           ret.push_back(info);
-           iter++;
-       } else {
-           // exit
-           iter = _satifiedByInstalled.end();
-       }
+        ItemCapKind info = iter->second;
+        PoolItem iterItem = iter->first;
+        if (iterItem == item) {
+            ret.push_back(info);
+            iter++;
+        } else {
+            // exit
+            iter = _satifiedByInstalled.end();
+        }
     }
     return ret;
 }
@@ -626,15 +626,15 @@ ItemCapKindList Resolver::installedSatisfied( const PoolItem & item )
     collectResolverInfo();
 
     for (ItemCapKindMap::const_iterator iter = _installedSatisfied.find(item); iter != _installedSatisfied.end();) {
-       ItemCapKind info = iter->second;
-       PoolItem iterItem = iter->first;
-       if (iterItem == item) {
-           ret.push_back(info);
-           iter++;
-       } else {
-           // exit
-           iter = _installedSatisfied.end();
-       }
+        ItemCapKind info = iter->second;
+        PoolItem iterItem = iter->first;
+        if (iterItem == item) {
+            ret.push_back(info);
+            iter++;
+        } else {
+            // exit
+            iter = _installedSatisfied.end();
+        }
     }
     return ret;
 }
index df24844..66ef265 100644 (file)
@@ -73,93 +73,93 @@ namespace zypp
       ///////////////////////////////////////////////////////////////////////
       namespace
       {
-       inline void solverSetFocus( sat::detail::CSolver & satSolver_r, const ResolverFocus & focus_r )
-       {
-         switch ( focus_r )
-         {
-           case ResolverFocus::Default:        // fallthrough to Job
-           case ResolverFocus::Job:
-             solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
-             solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST,      0 );
-             break;
-           case ResolverFocus::Installed:
-             solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 1 );
-             solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST,      0 );
-             break;
-           case ResolverFocus::Update:
-             solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
-             solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST,      1 );
-             break;
-         }
-       }
-
-       /** Helper collecting pseudo installed items from the pool.
-        * \todo: pseudoItems are cachable as long as pool content does not change
-        */
-       inline sat::Queue collectPseudoInstalled( const ResPool & pool_r )
-       {
-         sat::Queue ret;
-         for ( const PoolItem & pi : pool_r )
-           if ( traits::isPseudoInstalled( pi.kind() ) ) ret.push( pi.id() );
-         return ret;
-       }
-
-       /** Copy back new \ref WeakValue to \ref PoolItem after solving.
-        * On the fly collect orphaned items (cached by the solver for the UI)
-        */
-       inline void solverCopyBackWeak( sat::detail::CSolver & satSolver_r, PoolItemList & orphanedItems_r )
-       {
-         // NOTE: assert all items weak stati are reset (resetWeak was called)
-         {
-           sat::Queue recommendations;
-           sat::Queue suggestions;
-           ::solver_get_recommendations( &satSolver_r, recommendations, suggestions, 0 );
-           for ( sat::Queue::size_type i = 0; i < recommendations.size(); ++i )
-             PoolItem(sat::Solvable(recommendations[i])).status().setRecommended( true );
-           for ( sat::Queue::size_type i = 0; i < suggestions.size(); ++i )
-             PoolItem(sat::Solvable(suggestions[i])).status().setSuggested( true );
-         }
-         {
-           orphanedItems_r.clear();    // cached on the fly
-           sat::Queue orphaned;
-           ::solver_get_orphaned( &satSolver_r, orphaned );
-           for ( sat::Queue::size_type i = 0; i < orphaned.size(); ++i )
-           {
-             PoolItem pi { sat::Solvable(orphaned[i]) };
-             pi.status().setOrphaned( true );
-             orphanedItems_r.push_back( pi );
-           }
-         }
-         {
-           sat::Queue unneeded;
-           ::solver_get_unneeded( &satSolver_r, unneeded, 1 );
-           for ( sat::Queue::size_type i = 0; i < unneeded.size(); ++i )
-             PoolItem(sat::Solvable(unneeded[i])).status().setUnneeded( true );
-         }
-       }
-
-       /** Copy back new \ref ValidateValue to \ref PoolItem after solving. */
-       inline void solverCopyBackValidate( sat::detail::CSolver & satSolver_r, const ResPool & pool_r )
-       {
-         sat::Queue pseudoItems { collectPseudoInstalled( pool_r ) };
-         if ( ! pseudoItems.empty() )
-         {
-           sat::Queue pseudoFlags;
-           ::solver_trivial_installable( &satSolver_r, pseudoItems, pseudoFlags );
-
-           for ( sat::Queue::size_type i = 0; i < pseudoItems.size(); ++i )
-           {
-             PoolItem pi { sat::Solvable(pseudoItems[i]) };
-             switch ( pseudoFlags[i] )
-             {
-               case 0:  pi.status().setBroken(); break;
-               case 1:  pi.status().setSatisfied(); break;
-               case -1: pi.status().setNonRelevant(); break;
-               default: pi.status().setUndetermined(); break;
-             }
-           }
-         }
-       }
+        inline void solverSetFocus( sat::detail::CSolver & satSolver_r, const ResolverFocus & focus_r )
+        {
+          switch ( focus_r )
+          {
+            case ResolverFocus::Default:       // fallthrough to Job
+            case ResolverFocus::Job:
+              solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
+              solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST,      0 );
+              break;
+            case ResolverFocus::Installed:
+              solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 1 );
+              solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST,      0 );
+              break;
+            case ResolverFocus::Update:
+              solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_INSTALLED, 0 );
+              solver_set_flag( &satSolver_r, SOLVER_FLAG_FOCUS_BEST,      1 );
+              break;
+          }
+        }
+
+        /** Helper collecting pseudo installed items from the pool.
+         * \todo: pseudoItems are cachable as long as pool content does not change
+         */
+        inline sat::Queue collectPseudoInstalled( const ResPool & pool_r )
+        {
+          sat::Queue ret;
+          for ( const PoolItem & pi : pool_r )
+            if ( traits::isPseudoInstalled( pi.kind() ) ) ret.push( pi.id() );
+          return ret;
+        }
+
+        /** Copy back new \ref WeakValue to \ref PoolItem after solving.
+         * On the fly collect orphaned items (cached by the solver for the UI)
+         */
+        inline void solverCopyBackWeak( sat::detail::CSolver & satSolver_r, PoolItemList & orphanedItems_r )
+        {
+          // NOTE: assert all items weak stati are reset (resetWeak was called)
+          {
+            sat::Queue recommendations;
+            sat::Queue suggestions;
+            ::solver_get_recommendations( &satSolver_r, recommendations, suggestions, 0 );
+            for ( sat::Queue::size_type i = 0; i < recommendations.size(); ++i )
+              PoolItem(sat::Solvable(recommendations[i])).status().setRecommended( true );
+            for ( sat::Queue::size_type i = 0; i < suggestions.size(); ++i )
+              PoolItem(sat::Solvable(suggestions[i])).status().setSuggested( true );
+          }
+          {
+            orphanedItems_r.clear();   // cached on the fly
+            sat::Queue orphaned;
+            ::solver_get_orphaned( &satSolver_r, orphaned );
+            for ( sat::Queue::size_type i = 0; i < orphaned.size(); ++i )
+            {
+              PoolItem pi { sat::Solvable(orphaned[i]) };
+              pi.status().setOrphaned( true );
+              orphanedItems_r.push_back( pi );
+            }
+          }
+          {
+            sat::Queue unneeded;
+            ::solver_get_unneeded( &satSolver_r, unneeded, 1 );
+            for ( sat::Queue::size_type i = 0; i < unneeded.size(); ++i )
+              PoolItem(sat::Solvable(unneeded[i])).status().setUnneeded( true );
+          }
+        }
+
+        /** Copy back new \ref ValidateValue to \ref PoolItem after solving. */
+        inline void solverCopyBackValidate( sat::detail::CSolver & satSolver_r, const ResPool & pool_r )
+        {
+          sat::Queue pseudoItems { collectPseudoInstalled( pool_r ) };
+          if ( ! pseudoItems.empty() )
+          {
+            sat::Queue pseudoFlags;
+            ::solver_trivial_installable( &satSolver_r, pseudoItems, pseudoFlags );
+
+            for ( sat::Queue::size_type i = 0; i < pseudoItems.size(); ++i )
+            {
+              PoolItem pi { sat::Solvable(pseudoItems[i]) };
+              switch ( pseudoFlags[i] )
+              {
+                case 0:  pi.status().setBroken(); break;
+                case 1:  pi.status().setSatisfied(); break;
+                case -1: pi.status().setNonRelevant(); break;
+                default: pi.status().setUndetermined(); break;
+              }
+            }
+          }
+        }
 
       } //namespace
       ///////////////////////////////////////////////////////////////////////
@@ -213,10 +213,10 @@ void establish( sat::Queue & pseudoItems_r, sat::Queue & pseudoFlags_r )
       PoolItem pi { sat::Solvable(pseudoItems_r[i]) };
       switch ( pseudoFlags_r[i] )
       {
-       case 0:  pi.status().setBroken(); break;
-       case 1:  pi.status().setSatisfied(); break;
-       case -1: pi.status().setNonRelevant(); break;
-       default: pi.status().setUndetermined(); break;
+        case 0:  pi.status().setBroken(); break;
+        case 1:  pi.status().setSatisfied(); break;
+        case -1: pi.status().setNonRelevant(); break;
+        default: pi.status().setUndetermined(); break;
       }
     }
     MIL << "Establish DONE" << endl;
@@ -249,35 +249,35 @@ SATResolver::dumpOn( std::ostream & os ) const
     os << "<resolver>" << endl;
     if (_satSolver) {
 #define OUTS(X) os << "  " << #X << "\t= " << solver_get_flag(_satSolver, SOLVER_FLAG_##X) << endl
-       OUTS( ALLOW_DOWNGRADE );
-       OUTS( ALLOW_ARCHCHANGE );
-       OUTS( ALLOW_VENDORCHANGE );
-       OUTS( ALLOW_NAMECHANGE );
-       OUTS( ALLOW_UNINSTALL );
-       OUTS( NO_UPDATEPROVIDE );
-       OUTS( SPLITPROVIDES );
-       OUTS( IGNORE_RECOMMENDED );
-       OUTS( ADD_ALREADY_RECOMMENDED );
-       OUTS( NO_INFARCHCHECK );
-       OUTS( KEEP_EXPLICIT_OBSOLETES );
-       OUTS( BEST_OBEY_POLICY );
-       OUTS( NO_AUTOTARGET );
-       OUTS( DUP_ALLOW_DOWNGRADE );
-       OUTS( DUP_ALLOW_ARCHCHANGE );
-       OUTS( DUP_ALLOW_VENDORCHANGE );
-       OUTS( DUP_ALLOW_NAMECHANGE );
-       OUTS( KEEP_ORPHANS );
-       OUTS( BREAK_ORPHANS );
-       OUTS( YUM_OBSOLETES );
+        OUTS( ALLOW_DOWNGRADE );
+        OUTS( ALLOW_ARCHCHANGE );
+        OUTS( ALLOW_VENDORCHANGE );
+        OUTS( ALLOW_NAMECHANGE );
+        OUTS( ALLOW_UNINSTALL );
+        OUTS( NO_UPDATEPROVIDE );
+        OUTS( SPLITPROVIDES );
+        OUTS( IGNORE_RECOMMENDED );
+        OUTS( ADD_ALREADY_RECOMMENDED );
+        OUTS( NO_INFARCHCHECK );
+        OUTS( KEEP_EXPLICIT_OBSOLETES );
+        OUTS( BEST_OBEY_POLICY );
+        OUTS( NO_AUTOTARGET );
+        OUTS( DUP_ALLOW_DOWNGRADE );
+        OUTS( DUP_ALLOW_ARCHCHANGE );
+        OUTS( DUP_ALLOW_VENDORCHANGE );
+        OUTS( DUP_ALLOW_NAMECHANGE );
+        OUTS( KEEP_ORPHANS );
+        OUTS( BREAK_ORPHANS );
+        OUTS( YUM_OBSOLETES );
 #undef OUTS
         os << "  focus = "     << _focus << endl;
-       os << "  distupgrade    = "     << _distupgrade << endl;
+        os << "  distupgrade   = "     << _distupgrade << endl;
         os << "  distupgrade_removeunsupported = " << _distupgrade_removeunsupported << endl;
-       os << "  solveSrcPackages       = "     << _solveSrcPackages << endl;
-       os << "  cleandepsOnRemove      = "     << _cleandepsOnRemove << endl;
+        os << "  solveSrcPackages      = "     << _solveSrcPackages << endl;
+        os << "  cleandepsOnRemove     = "     << _cleandepsOnRemove << endl;
         os << "  fixsystem             = "     << _fixsystem << endl;
     } else {
-       os << "<NULL>";
+        os << "<NULL>";
     }
     return os << "<resolver/>" << endl;
 }
@@ -342,16 +342,16 @@ SATSolutionToPool (PoolItem item, const ResStatus & status, const ResStatus::Tra
 
     // installation/deletion
     if (status.isToBeInstalled()) {
-       r = item.status().setToBeInstalled (causer);
-       XDEBUG("SATSolutionToPool install returns " << item << ", " << r);
+        r = item.status().setToBeInstalled (causer);
+        XDEBUG("SATSolutionToPool install returns " << item << ", " << r);
     }
     else if (status.isToBeUninstalledDueToUpgrade()) {
-       r = item.status().setToBeUninstalledDueToUpgrade (causer);
-       XDEBUG("SATSolutionToPool upgrade returns " << item << ", " <<  r);
+        r = item.status().setToBeUninstalledDueToUpgrade (causer);
+        XDEBUG("SATSolutionToPool upgrade returns " << item << ", " <<  r);
     }
     else if (status.isToBeUninstalled()) {
-       r = item.status().setToBeUninstalled (causer);
-       XDEBUG("SATSolutionToPool remove returns " << item << ", " <<  r);
+        r = item.status().setToBeUninstalled (causer);
+        XDEBUG("SATSolutionToPool remove returns " << item << ", " <<  r);
     }
 
     return;
@@ -372,10 +372,10 @@ SATSolutionToPool (PoolItem item, const ResStatus & status, const ResStatus::Tra
 struct SATCollectTransact : public resfilter::PoolItemFilterFunctor
 {
   SATCollectTransact( PoolItemList & items_to_install_r,
-                     PoolItemList & items_to_remove_r,
-                     PoolItemList & items_to_lock_r,
-                     PoolItemList & items_to_keep_r,
-                     bool solveSrcPackages_r )
+                      PoolItemList & items_to_remove_r,
+                      PoolItemList & items_to_lock_r,
+                      PoolItemList & items_to_keep_r,
+                      bool solveSrcPackages_r )
   : _items_to_install( items_to_install_r )
   , _items_to_remove( items_to_remove_r )
   , _items_to_lock( items_to_lock_r )
@@ -410,8 +410,8 @@ struct SATCollectTransact : public resfilter::PoolItemFilterFunctor
     switch ( itemStatus.getTransactValue() )
     {
       case ResStatus::TRANSACT:
-       itemStatus.isUninstalled() ?    _items_to_install.push_back( item_r )
-                                     _items_to_remove.push_back( item_r );   break;
+        itemStatus.isUninstalled() ?   _items_to_install.push_back( item_r )
+                                   :   _items_to_remove.push_back( item_r );   break;
       case ResStatus::LOCKED:          _items_to_lock.push_back( item_r );     break;
       case ResStatus::KEEP_STATE:      _items_to_keep.push_back( item_r );     break;
     }
@@ -451,38 +451,38 @@ class CheckIfUpdate : public resfilter::PoolItemFilterFunctor
 
     bool operator()( const PoolItem & item )
     {
-       if ( item.status().isToBeInstalled() )
+        if ( item.status().isToBeInstalled() )
         {
           if ( ! item.multiversionInstall() || sameNVRA( _installed, item ) )
           {
             is_updated = true;
             return false;
           }
-       }
-       return true;
+        }
+        return true;
     }
 };
 
 
 bool
 SATResolver::solving(const CapabilitySet & requires_caps,
-                    const CapabilitySet & conflict_caps)
+                     const CapabilitySet & conflict_caps)
 {
     if (_fixsystem) {
-       queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     if (_updatesystem) {
-       queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     if (_distupgrade) {
-       queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     if (_distupgrade_removeunsupported) {
-       queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     solverSetFocus( *_satSolver, _focus );
     solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
@@ -512,45 +512,45 @@ SATResolver::solving(const CapabilitySet & requires_caps,
       // Produtcs unless removeunsupported is active (cleans up all).
       if ( _distupgrade )
       {
-       if ( _distupgrade_removeunsupported )
-         MIL << "Droplist processing not needed. RemoveUnsupported is On." << endl;
-       else if ( ! ZConfig::instance().solverUpgradeRemoveDroppedPackages() )
-         MIL << "Droplist processing is disabled in ZConfig." << endl;
-       else
-       {
-         bool resolve = false;
-         MIL << "Checking droplists ..." << endl;
-         // get Solvables to be installed...
-         sat::SolvableQueue decisionq;
-         solver_get_decisionqueue( _satSolver, decisionq );
-         for ( sat::detail::IdType id : decisionq )
-         {
-           if ( id < 0 )
-             continue;
-           sat::Solvable slv { (sat::detail::SolvableIdType)id };
-           // get product buddies (they carry the weakremover)...
-           static const Capability productCap { "product()" };
-           if ( slv && slv.provides().matches( productCap ) )
-           {
-             CapabilitySet droplist { slv.valuesOfNamespace( "weakremover" ) };
-             MIL << "Droplist for " << slv << ": size " << droplist.size() << endl;
-             if ( !droplist.empty() )
-             {
-               for ( const auto & cap : droplist )
-               {
-                 queue_push( &_jobQueue, SOLVER_DROP_ORPHANED | SOLVER_SOLVABLE_NAME );
-                 queue_push( &_jobQueue, cap.id() );
-               }
-               // PIN product - a safety net to prevent cleanup from changing the decision for this product
-               queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
-               queue_push( &(_jobQueue), id );
-               resolve = true;
-             }
-           }
-         }
-         if ( resolve )
-           solver_solve( _satSolver, &(_jobQueue) );
-       }
+        if ( _distupgrade_removeunsupported )
+          MIL << "Droplist processing not needed. RemoveUnsupported is On." << endl;
+        else if ( ! ZConfig::instance().solverUpgradeRemoveDroppedPackages() )
+          MIL << "Droplist processing is disabled in ZConfig." << endl;
+        else
+        {
+          bool resolve = false;
+          MIL << "Checking droplists ..." << endl;
+          // get Solvables to be installed...
+          sat::SolvableQueue decisionq;
+          solver_get_decisionqueue( _satSolver, decisionq );
+          for ( sat::detail::IdType id : decisionq )
+          {
+            if ( id < 0 )
+              continue;
+            sat::Solvable slv { (sat::detail::SolvableIdType)id };
+            // get product buddies (they carry the weakremover)...
+            static const Capability productCap { "product()" };
+            if ( slv && slv.provides().matches( productCap ) )
+            {
+              CapabilitySet droplist { slv.valuesOfNamespace( "weakremover" ) };
+              MIL << "Droplist for " << slv << ": size " << droplist.size() << endl;
+              if ( !droplist.empty() )
+              {
+                for ( const auto & cap : droplist )
+                {
+                  queue_push( &_jobQueue, SOLVER_DROP_ORPHANED | SOLVER_SOLVABLE_NAME );
+                  queue_push( &_jobQueue, cap.id() );
+                }
+                // PIN product - a safety net to prevent cleanup from changing the decision for this product
+                queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
+                queue_push( &(_jobQueue), id );
+                resolve = true;
+              }
+            }
+          }
+          if ( resolve )
+            solver_solve( _satSolver, &(_jobQueue) );
+        }
       }
     }
     MIL << "....Solver end" << endl;
@@ -568,11 +568,11 @@ SATResolver::solving(const CapabilitySet & requires_caps,
     {
       Id p = decisionq.elements[i];
       if ( p < 0 )
-       continue;
+        continue;
 
       sat::Solvable slv { (sat::detail::SolvableIdType)p };
       if ( ! slv || slv.isSystem() )
-       continue;
+        continue;
 
       PoolItem poolItem( slv );
       SATSolutionToPool (poolItem, ResStatus::toBeInstalled, ResStatus::SOLVER);
@@ -587,36 +587,36 @@ SATResolver::solving(const CapabilitySet & requires_caps,
       bool mustCheckObsoletes = false;
       for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
       {
-       if (solver_get_decisionlevel(_satSolver, it->id()) > 0)
-         continue;
-
-       // Check if this is an update
-       CheckIfUpdate info( *it );
-       PoolItem poolItem( *it );
-       invokeOnEach( _pool.byIdentBegin( poolItem ),
-                     _pool.byIdentEnd( poolItem ),
-                     resfilter::ByUninstalled(),                       // ByUninstalled
-                     functor::functorRef<bool,PoolItem> (info) );
-
-       if (info.is_updated) {
-         SATSolutionToPool( poolItem, ResStatus::toBeUninstalledDueToUpgrade, ResStatus::SOLVER );
-       } else {
-         SATSolutionToPool( poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER );
-         if ( ! mustCheckObsoletes )
-           mustCheckObsoletes = true; // lazy check for UninstalledDueToObsolete
-       }
-       _result_items_to_remove.push_back (poolItem);
+        if (solver_get_decisionlevel(_satSolver, it->id()) > 0)
+          continue;
+
+        // Check if this is an update
+        CheckIfUpdate info( *it );
+        PoolItem poolItem( *it );
+        invokeOnEach( _pool.byIdentBegin( poolItem ),
+                      _pool.byIdentEnd( poolItem ),
+                      resfilter::ByUninstalled(),                      // ByUninstalled
+                      functor::functorRef<bool,PoolItem> (info) );
+
+        if (info.is_updated) {
+          SATSolutionToPool( poolItem, ResStatus::toBeUninstalledDueToUpgrade, ResStatus::SOLVER );
+        } else {
+          SATSolutionToPool( poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER );
+          if ( ! mustCheckObsoletes )
+            mustCheckObsoletes = true; // lazy check for UninstalledDueToObsolete
+        }
+        _result_items_to_remove.push_back (poolItem);
       }
       if ( mustCheckObsoletes )
       {
-       sat::WhatObsoletes obsoleted( _result_items_to_install.begin(), _result_items_to_install.end() );
-       for_( it, obsoleted.poolItemBegin(), obsoleted.poolItemEnd() )
-       {
-         ResStatus & status( it->status() );
-         // WhatObsoletes contains installed items only!
-         if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() )
-           status.setToBeUninstalledDueToObsolete();
-       }
+        sat::WhatObsoletes obsoleted( _result_items_to_install.begin(), _result_items_to_install.end() );
+        for_( it, obsoleted.poolItemBegin(), obsoleted.poolItemEnd() )
+        {
+          ResStatus & status( it->status() );
+          // WhatObsoletes contains installed items only!
+          if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() )
+            status.setToBeUninstalledDueToObsolete();
+        }
       }
     }
 
@@ -629,30 +629,30 @@ SATResolver::solving(const CapabilitySet & requires_caps,
     // be selected by APPL_LOW. We can't use any higher level, because this setting must
     // not serve as a request for the next solver run. APPL_LOW is reset before solving.
     for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
-       sat::WhatProvides rpmProviders(*iter);
-       for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
-           PoolItem poolItem(*iter2);
-           if (poolItem.status().isToBeInstalled()) {
-               MIL << "User requirement " << *iter << " sets " << poolItem << endl;
-               poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
-           }
-       }
+        sat::WhatProvides rpmProviders(*iter);
+        for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
+            PoolItem poolItem(*iter2);
+            if (poolItem.status().isToBeInstalled()) {
+                MIL << "User requirement " << *iter << " sets " << poolItem << endl;
+                poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
+            }
+        }
     }
     for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
-       sat::WhatProvides rpmProviders(*iter);
-       for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
-           PoolItem poolItem(*iter2);
-           if (poolItem.status().isToBeUninstalled()) {
-               MIL << "User conflict " << *iter << " sets " << poolItem << endl;
-               poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
-           }
-       }
+        sat::WhatProvides rpmProviders(*iter);
+        for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
+            PoolItem poolItem(*iter2);
+            if (poolItem.status().isToBeUninstalled()) {
+                MIL << "User conflict " << *iter << " sets " << poolItem << endl;
+                poolItem.status().setTransactByValue (ResStatus::APPL_LOW);
+            }
+        }
     }
 
     if (solver_problem_count(_satSolver) > 0 )
     {
-       ERR << "Solverrun finished with an ERROR" << endl;
-       return false;
+        ERR << "Solverrun finished with an ERROR" << endl;
+        return false;
     }
 
     return true;
@@ -673,13 +673,13 @@ SATResolver::solverInit(const PoolItemList & weakItems)
       // to let (suse/opensuse) vendor being treated as being equivalent.
       bool toRelax = false;
       if ( _distupgrade ) {
-       for ( sat::Solvable solv : sat::WhatProvides( Capability("dup-vendor-relax(suse)") ) ) {
-         if ( ! solv.isSystem() ) {
-           MIL << "Relaxed vendor check requested by " << solv << endl;
-           toRelax = true;
-           break;
-         }
-       }
+        for ( sat::Solvable solv : sat::WhatProvides( Capability("dup-vendor-relax(suse)") ) ) {
+          if ( ! solv.isSystem() ) {
+            MIL << "Relaxed vendor check requested by " << solv << endl;
+            toRelax = true;
+            break;
+          }
+        }
       }
       ::pool_set_custom_vendorcheck( _satPool, toRelax ? &relaxedVendorCheck : &vendorCheck );
     }
@@ -693,12 +693,12 @@ SATResolver::solverInit(const PoolItemList & weakItems)
     }
 
     for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) {
-       Id id = (*iter)->satSolvable().id();
-       if (id == ID_NULL) {
-           ERR << "Weaken: " << *iter << " not found" << endl;
-       }
-       MIL << "Weaken dependencies of " << *iter << endl;
-       queue_push( &(_jobQueue), SOLVER_WEAKENDEPS | SOLVER_SOLVABLE );
+        Id id = (*iter)->satSolvable().id();
+        if (id == ID_NULL) {
+            ERR << "Weaken: " << *iter << " not found" << endl;
+        }
+        MIL << "Weaken dependencies of " << *iter << endl;
+        queue_push( &(_jobQueue), SOLVER_WEAKENDEPS | SOLVER_SOLVABLE );
         queue_push( &(_jobQueue), id );
     }
 
@@ -718,14 +718,14 @@ SATResolver::solverInit(const PoolItemList & weakItems)
       // just track changed locakes
       for ( const auto & locale : trackedLocaleIds.added() )
       {
-       queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
-       queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
+        queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
+        queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
       }
 
       for ( const auto & locale : trackedLocaleIds.removed() )
       {
-       queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | SOLVER_CLEANDEPS ); // needs uncond. SOLVER_CLEANDEPS!
-       queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
+        queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | SOLVER_CLEANDEPS );        // needs uncond. SOLVER_CLEANDEPS!
+        queue_push( &(_jobQueue), Capability( ResolverNamespace::language, IdString(locale) ).id() );
       }
     }
 
@@ -754,8 +754,8 @@ SATResolver::solverEnd()
 
 bool
 SATResolver::resolvePool(const CapabilitySet & requires_caps,
-                        const CapabilitySet & conflict_caps,
-                        const PoolItemList & weakItems,
+                         const CapabilitySet & conflict_caps,
+                         const PoolItemList & weakItems,
                          const std::set<Repository> & upgradeRepos)
 {
     MIL << "SATResolver::resolvePool()" << endl;
@@ -764,44 +764,44 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps,
     solverInit(weakItems);
 
     for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
-       Id id = (*iter)->satSolvable().id();
-       if (id == ID_NULL) {
-           ERR << "Install: " << *iter << " not found" << endl;
-       } else {
-           MIL << "Install " << *iter << endl;
-           queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
-           queue_push( &(_jobQueue), id );
-       }
+        Id id = (*iter)->satSolvable().id();
+        if (id == ID_NULL) {
+            ERR << "Install: " << *iter << " not found" << endl;
+        } else {
+            MIL << "Install " << *iter << endl;
+            queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
+            queue_push( &(_jobQueue), id );
+        }
     }
 
     for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
-       Id id = (*iter)->satSolvable().id();
-       if (id == ID_NULL) {
-           ERR << "Delete: " << *iter << " not found" << endl;
-       } else {
-           MIL << "Delete " << *iter << endl;
-           queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
-           queue_push( &(_jobQueue), id);
-       }
+        Id id = (*iter)->satSolvable().id();
+        if (id == ID_NULL) {
+            ERR << "Delete: " << *iter << " not found" << endl;
+        } else {
+            MIL << "Delete " << *iter << endl;
+            queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
+            queue_push( &(_jobQueue), id);
+        }
     }
 
     for_( iter, upgradeRepos.begin(), upgradeRepos.end() )
     {
-       queue_push( &(_jobQueue), SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_REPO );
-       queue_push( &(_jobQueue), iter->get()->repoid );
+        queue_push( &(_jobQueue), SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_REPO );
+        queue_push( &(_jobQueue), iter->get()->repoid );
         MIL << "Upgrade repo " << *iter << endl;
     }
 
     for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) {
-       queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
-       queue_push( &(_jobQueue), iter->id() );
-       MIL << "Requires " << *iter << endl;
+        queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
+        queue_push( &(_jobQueue), iter->id() );
+        MIL << "Requires " << *iter << endl;
     }
 
     for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) {
-       queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
-       queue_push( &(_jobQueue), iter->id() );
-       MIL << "Conflicts " << *iter << endl;
+        queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
+        queue_push( &(_jobQueue), iter->id() );
+        MIL << "Conflicts " << *iter << endl;
     }
 
     // set requirements for a running system
@@ -820,7 +820,7 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps,
 
 bool
 SATResolver::resolveQueue(const SolverQueueItemList &requestQueue,
-                         const PoolItemList & weakItems)
+                          const PoolItemList & weakItems)
 {
     MIL << "SATResolver::resolvQueue()" << endl;
 
@@ -829,25 +829,25 @@ SATResolver::resolveQueue(const SolverQueueItemList &requestQueue,
 
     // generate solver queue
     for (SolverQueueItemList::const_iterator iter = requestQueue.begin(); iter != requestQueue.end(); iter++) {
-       (*iter)->addRule(_jobQueue);
+        (*iter)->addRule(_jobQueue);
     }
 
     // Add addition item status to the resolve-queue cause these can be set by problem resolutions
     for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) {
-       Id id = (*iter)->satSolvable().id();
-       if (id == ID_NULL) {
-           ERR << "Install: " << *iter << " not found" << endl;
-       } else {
-           MIL << "Install " << *iter << endl;
-           queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
-           queue_push( &(_jobQueue), id );
-       }
+        Id id = (*iter)->satSolvable().id();
+        if (id == ID_NULL) {
+            ERR << "Install: " << *iter << " not found" << endl;
+        } else {
+            MIL << "Install " << *iter << endl;
+            queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
+            queue_push( &(_jobQueue), id );
+        }
     }
     for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
         sat::detail::IdType ident( (*iter)->satSolvable().ident().id() );
-       MIL << "Delete " << *iter << ident << endl;
-       queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS );
-       queue_push( &(_jobQueue), ident);
+        MIL << "Delete " << *iter << ident << endl;
+        queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS );
+        queue_push( &(_jobQueue), ident);
     }
 
     // set requirements for a running system
@@ -878,20 +878,20 @@ void SATResolver::doUpdate()
     setLocks();
 
     if (_fixsystem) {
-       queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     if (1) {
-       queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     if (_distupgrade) {
-       queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     if (_distupgrade_removeunsupported) {
-       queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
-       queue_push( &(_jobQueue), 0 );
+        queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
+        queue_push( &(_jobQueue), 0 );
     }
     solverSetFocus( *_satSolver, _focus );
     solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
@@ -924,11 +924,11 @@ void SATResolver::doUpdate()
     {
       Id p = decisionq.elements[i];
       if ( p < 0 )
-       continue;
+        continue;
 
       sat::Solvable solv { (sat::detail::SolvableIdType)p };
       if ( ! solv || solv.isSystem() )
-       continue;
+        continue;
 
       SATSolutionToPool( PoolItem(solv), ResStatus::toBeInstalled, ResStatus::SOLVER );
     }
@@ -938,26 +938,26 @@ void SATResolver::doUpdate()
     if ( _satSolver->pool->installed ) {
       for (int i = _satSolver->pool->installed->start; i < _satSolver->pool->installed->start + _satSolver->pool->installed->nsolvables; i++)
       {
-       if (solver_get_decisionlevel(_satSolver, i) > 0)
-           continue;
-
-       PoolItem poolItem( _pool.find( sat::Solvable(i) ) );
-       if (poolItem) {
-           // Check if this is an update
-           CheckIfUpdate info( (sat::Solvable(i)) );
-           invokeOnEach( _pool.byIdentBegin( poolItem ),
-                         _pool.byIdentEnd( poolItem ),
-                         resfilter::ByUninstalled(),                   // ByUninstalled
-                         functor::functorRef<bool,PoolItem> (info) );
-
-           if (info.is_updated) {
-               SATSolutionToPool (poolItem, ResStatus::toBeUninstalledDueToUpgrade , ResStatus::SOLVER);
-           } else {
-               SATSolutionToPool (poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER);
-           }
-       } else {
-           ERR << "id " << i << " not found in ZYPP pool." << endl;
-       }
+        if (solver_get_decisionlevel(_satSolver, i) > 0)
+            continue;
+
+        PoolItem poolItem( _pool.find( sat::Solvable(i) ) );
+        if (poolItem) {
+            // Check if this is an update
+            CheckIfUpdate info( (sat::Solvable(i)) );
+            invokeOnEach( _pool.byIdentBegin( poolItem ),
+                          _pool.byIdentEnd( poolItem ),
+                          resfilter::ByUninstalled(),                  // ByUninstalled
+                          functor::functorRef<bool,PoolItem> (info) );
+
+            if (info.is_updated) {
+                SATSolutionToPool (poolItem, ResStatus::toBeUninstalledDueToUpgrade , ResStatus::SOLVER);
+            } else {
+                SATSolutionToPool (poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER);
+            }
+        } else {
+            ERR << "id " << i << " not found in ZYPP pool." << endl;
+        }
       }
     }
 
@@ -988,8 +988,8 @@ struct FindPackage : public resfilter::ResObjectFilterFunctor
     FindPackage (ProblemSolutionCombi *p, const TransactionKind act)
        : problemSolution (p)
        , action (act)
-       {
-       }
+        {
+        }
 
     bool operator()( PoolItem p)
    {
@@ -1085,143 +1085,143 @@ std::string SATResolver::SATproblemRuleInfoString (Id probr, std::string &detail
   switch ( type )
   {
       case SOLVER_RULE_DISTUPGRADE:
-         if ( s.isSystem() )
-           ret = str::Format(_("the installed %1% does not belong to a distupgrade repository and must be replaced") ) % s.asString();
-         else /*just in case*/
-           ret = str::Format(_("the to be installed %1% does not belong to a distupgrade repository") ) % s.asString();
-         break;
+          if ( s.isSystem() )
+            ret = str::Format(_("the installed %1% does not belong to a distupgrade repository and must be replaced") ) % s.asString();
+          else /*just in case*/
+            ret = str::Format(_("the to be installed %1% does not belong to a distupgrade repository") ) % s.asString();
+          break;
       case SOLVER_RULE_INFARCH:
-         if ( s.isSystem() )
-           ret = str::Format(_("the installed %1% has inferior architecture") ) % s.asString();
-         else
-           ret = str::Format(_("the to be installed %1% has inferior architecture") ) % s.asString();
-         break;
+          if ( s.isSystem() )
+            ret = str::Format(_("the installed %1% has inferior architecture") ) % s.asString();
+          else
+            ret = str::Format(_("the to be installed %1% has inferior architecture") ) % s.asString();
+          break;
       case SOLVER_RULE_UPDATE:
-         ret = str::Format(_("problem with the installed %1%") ) % s.asString();
-         break;
+          ret = str::Format(_("problem with the installed %1%") ) % s.asString();
+          break;
       case SOLVER_RULE_JOB:
-         ret = _("conflicting requests");
-         break;
+          ret = _("conflicting requests");
+          break;
       case SOLVER_RULE_PKG:
-         ret = _("some dependency problem");
-         break;
+          ret = _("some dependency problem");
+          break;
       case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
-         ret = str::Format(_("nothing provides the requested '%1%'") ) % pool_dep2str(pool, dep);
-         detail += _("Have you enabled all the required repositories?");
-         break;
+          ret = str::Format(_("nothing provides the requested '%1%'") ) % pool_dep2str(pool, dep);
+          detail += _("Have you enabled all the required repositories?");
+          break;
       case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
-         ret = str::Format(_("the requested package %1% does not exist") ) % pool_dep2str(pool, dep);
-         detail += _("Have you enabled all the required repositories?");
-         break;
+          ret = str::Format(_("the requested package %1% does not exist") ) % pool_dep2str(pool, dep);
+          detail += _("Have you enabled all the required repositories?");
+          break;
       case SOLVER_RULE_JOB_UNSUPPORTED:
-         ret = _("unsupported request");
-         break;
+          ret = _("unsupported request");
+          break;
       case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
-         ret = str::Format(_("'%1%' is provided by the system and cannot be erased") ) % pool_dep2str(pool, dep);
-         break;
+          ret = str::Format(_("'%1%' is provided by the system and cannot be erased") ) % pool_dep2str(pool, dep);
+          break;
       case SOLVER_RULE_PKG_NOT_INSTALLABLE:
-         ret = str::Format(_("%1% is not installable") ) % s.asString();
-         break;
+          ret = str::Format(_("%1% is not installable") ) % s.asString();
+          break;
       case SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP:
-         ignoreId = source; // for setting weak dependencies
-         if ( s.isSystem() )
-           ret = str::Format(_("nothing provides '%1%' needed by the installed %2%") ) % pool_dep2str(pool, dep) % s.asString();
-         else
-           ret = str::Format(_("nothing provides '%1%' needed by the to be installed %2%") ) % pool_dep2str(pool, dep) % s.asString();
-         break;
+          ignoreId = source; // for setting weak dependencies
+          if ( s.isSystem() )
+            ret = str::Format(_("nothing provides '%1%' needed by the installed %2%") ) % pool_dep2str(pool, dep) % s.asString();
+          else
+            ret = str::Format(_("nothing provides '%1%' needed by the to be installed %2%") ) % pool_dep2str(pool, dep) % s.asString();
+          break;
       case SOLVER_RULE_PKG_SAME_NAME:
-         ret = str::Format(_("cannot install both %1% and %2%") ) % s.asString() % s2.asString();
-         break;
+          ret = str::Format(_("cannot install both %1% and %2%") ) % s.asString() % s2.asString();
+          break;
       case SOLVER_RULE_PKG_CONFLICTS:
-         if ( s.isSystem() ) {
-           if ( s2.isSystem() )
-             ret = str::Format(_("the installed %1% conflicts with '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-           else
-             ret = str::Format(_("the installed %1% conflicts with '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-         }
-         else {
-           if ( s2.isSystem() )
-             ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-           else
-             ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-         }
-         break;
+          if ( s.isSystem() ) {
+            if ( s2.isSystem() )
+              ret = str::Format(_("the installed %1% conflicts with '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+            else
+              ret = str::Format(_("the installed %1% conflicts with '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+          }
+          else {
+            if ( s2.isSystem() )
+              ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+            else
+              ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+          }
+          break;
       case SOLVER_RULE_PKG_OBSOLETES:
       case SOLVER_RULE_PKG_INSTALLED_OBSOLETES:
-         if ( s.isSystem() ) {
-           if ( s2.isSystem() )
-             ret = str::Format(_("the installed %1% obsoletes '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-           else
-             ret = str::Format(_("the installed %1% obsoletes '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-         }
-         else {
-           if ( s2.isSystem() )
-             ret = str::Format(_("the to be installed %1% obsoletes '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-           else
-             ret = str::Format(_("the to be installed %1% obsoletes '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
-         }
-         break;
+          if ( s.isSystem() ) {
+            if ( s2.isSystem() )
+              ret = str::Format(_("the installed %1% obsoletes '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+            else
+              ret = str::Format(_("the installed %1% obsoletes '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+          }
+          else {
+            if ( s2.isSystem() )
+              ret = str::Format(_("the to be installed %1% obsoletes '%2%' provided by the installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+            else
+              ret = str::Format(_("the to be installed %1% obsoletes '%2%' provided by the to be installed %3%") ) % s.asString() % pool_dep2str(pool, dep) % s2.asString();
+          }
+          break;
       case SOLVER_RULE_PKG_SELF_CONFLICT:
-         if ( s.isSystem() )
-           ret = str::Format(_("the installed %1% conflicts with '%2%' provided by itself") ) % s.asString() % pool_dep2str(pool, dep);
-         else
-           ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by itself") ) % s.asString() % pool_dep2str(pool, dep);
+          if ( s.isSystem() )
+            ret = str::Format(_("the installed %1% conflicts with '%2%' provided by itself") ) % s.asString() % pool_dep2str(pool, dep);
+          else
+            ret = str::Format(_("the to be installed %1% conflicts with '%2%' provided by itself") ) % s.asString() % pool_dep2str(pool, dep);
           break;
       case SOLVER_RULE_PKG_REQUIRES: {
-         ignoreId = source; // for setting weak dependencies
-         Capability cap(dep);
-         sat::WhatProvides possibleProviders(cap);
-
-         // check, if a provider will be deleted
-         typedef std::list<PoolItem> ProviderList;
-         ProviderList providerlistInstalled, providerlistUninstalled;
-         for_( iter1, possibleProviders.begin(), possibleProviders.end() ) {
-             PoolItem provider1 = ResPool::instance().find( *iter1 );
-             // find pair of an installed/uninstalled item with the same NVR
-             bool found = false;
-             for_( iter2, possibleProviders.begin(), possibleProviders.end() ) {
-                 PoolItem provider2 = ResPool::instance().find( *iter2 );
-                 if (compareByNVR (provider1,provider2) == 0
-                     && ( (provider1.status().isInstalled() && provider2.status().isUninstalled())
-                         || (provider2.status().isInstalled() && provider1.status().isUninstalled()) ))  {
-                     found = true;
-                     break;
-                 }
-             }
-             if (!found) {
-                 if (provider1.status().isInstalled())
-                     providerlistInstalled.push_back(provider1);
-                 else
-                     providerlistUninstalled.push_back(provider1);
-             }
-         }
-
-         if ( s.isSystem() )
-           ret = str::Format(_("the installed %1% requires '%2%', but this requirement cannot be provided") ) % s.asString() % pool_dep2str(pool, dep);
-         else
-           ret = str::Format(_("the to be installed %1% requires '%2%', but this requirement cannot be provided") ) % s.asString() % pool_dep2str(pool, dep);
-         if (providerlistInstalled.size() > 0) {
-             detail += _("deleted providers: ");
-             for (ProviderList::const_iterator iter = providerlistInstalled.begin(); iter != providerlistInstalled.end(); iter++) {
-                 if (iter == providerlistInstalled.begin())
-                     detail += itemToString( *iter );
-                 else
-                     detail += "\n                   " + itemToString( mapItem(*iter) );
-             }
-         }
-         if (providerlistUninstalled.size() > 0) {
-             if (detail.size() > 0)
-                 detail += _("\nnot installable providers: ");
-             else
-                 detail = _("not installable providers: ");
-             for (ProviderList::const_iterator iter = providerlistUninstalled.begin(); iter != providerlistUninstalled.end(); iter++) {
-                 if (iter == providerlistUninstalled.begin())
-                     detail += itemToString( *iter );
-                 else
-                     detail += "\n                   " + itemToString( mapItem(*iter) );
-             }
-         }
-         break;
+          ignoreId = source; // for setting weak dependencies
+          Capability cap(dep);
+          sat::WhatProvides possibleProviders(cap);
+
+          // check, if a provider will be deleted
+          typedef std::list<PoolItem> ProviderList;
+          ProviderList providerlistInstalled, providerlistUninstalled;
+          for_( iter1, possibleProviders.begin(), possibleProviders.end() ) {
+              PoolItem provider1 = ResPool::instance().find( *iter1 );
+              // find pair of an installed/uninstalled item with the same NVR
+              bool found = false;
+              for_( iter2, possibleProviders.begin(), possibleProviders.end() ) {
+                  PoolItem provider2 = ResPool::instance().find( *iter2 );
+                  if (compareByNVR (provider1,provider2) == 0
+                      && ( (provider1.status().isInstalled() && provider2.status().isUninstalled())
+                          || (provider2.status().isInstalled() && provider1.status().isUninstalled()) ))  {
+                      found = true;
+                      break;
+                  }
+              }
+              if (!found) {
+                  if (provider1.status().isInstalled())
+                      providerlistInstalled.push_back(provider1);
+                  else
+                      providerlistUninstalled.push_back(provider1);
+              }
+          }
+
+          if ( s.isSystem() )
+            ret = str::Format(_("the installed %1% requires '%2%', but this requirement cannot be provided") ) % s.asString() % pool_dep2str(pool, dep);
+          else
+            ret = str::Format(_("the to be installed %1% requires '%2%', but this requirement cannot be provided") ) % s.asString() % pool_dep2str(pool, dep);
+          if (providerlistInstalled.size() > 0) {
+              detail += _("deleted providers: ");
+              for (ProviderList::const_iterator iter = providerlistInstalled.begin(); iter != providerlistInstalled.end(); iter++) {
+                  if (iter == providerlistInstalled.begin())
+                      detail += itemToString( *iter );
+                  else
+                      detail += "\n                   " + itemToString( mapItem(*iter) );
+              }
+          }
+          if (providerlistUninstalled.size() > 0) {
+              if (detail.size() > 0)
+                  detail += _("\nnot installable providers: ");
+              else
+                  detail = _("not installable providers: ");
+              for (ProviderList::const_iterator iter = providerlistUninstalled.begin(); iter != providerlistUninstalled.end(); iter++) {
+                  if (iter == providerlistUninstalled.begin())
+                      detail += itemToString( *iter );
+                  else
+                      detail += "\n                   " + itemToString( mapItem(*iter) );
+              }
+          }
+          break;
       }
       default: {
           DBG << "Unknown rule type(" << type << ") going to query libsolv for rule information." << endl;
@@ -1237,315 +1237,315 @@ SATResolver::problems ()
 {
     ResolverProblemList resolverProblems;
     if (_satSolver && solver_problem_count(_satSolver)) {
-       sat::detail::CPool *pool = _satSolver->pool;
-       int pcnt;
-       Id p, rp, what;
-       Id problem, solution, element;
-       sat::Solvable s, sd;
-
-       CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
-       CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
-
-       MIL << "Encountered problems! Here are the solutions:\n" << endl;
-       pcnt = 1;
-       problem = 0;
-       while ((problem = solver_next_problem(_satSolver, problem)) != 0) {
-           MIL << "Problem " <<  pcnt++ << ":" << endl;
-           MIL << "====================================" << endl;
-           std::string detail;
-           Id ignoreId;
-           std::string whatString = SATprobleminfoString (problem,detail,ignoreId);
-           MIL << whatString << endl;
-           MIL << "------------------------------------" << endl;
+        sat::detail::CPool *pool = _satSolver->pool;
+        int pcnt;
+        Id p, rp, what;
+        Id problem, solution, element;
+        sat::Solvable s, sd;
+
+        CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap();
+        CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
+
+        MIL << "Encountered problems! Here are the solutions:\n" << endl;
+        pcnt = 1;
+        problem = 0;
+        while ((problem = solver_next_problem(_satSolver, problem)) != 0) {
+            MIL << "Problem " <<  pcnt++ << ":" << endl;
+            MIL << "====================================" << endl;
+            std::string detail;
+            Id ignoreId;
+            std::string whatString = SATprobleminfoString (problem,detail,ignoreId);
+            MIL << whatString << endl;
+            MIL << "------------------------------------" << endl;
             ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail, SATgetCompleteProblemInfoStrings( problem ));
 
-           solution = 0;
-           while ((solution = solver_next_solution(_satSolver, problem, solution)) != 0) {
-               element = 0;
-               ProblemSolutionCombi *problemSolution = new ProblemSolutionCombi;
-               while ((element = solver_next_solutionelement(_satSolver, problem, solution, element, &p, &rp)) != 0) {
-                   if (p == SOLVER_SOLUTION_JOB) {
-                       /* job, rp is index into job queue */
-                       what = _jobQueue.elements[rp];
-                       switch (_jobQueue.elements[rp-1]&(SOLVER_SELECTMASK|SOLVER_JOBMASK))
-                       {
-                           case SOLVER_INSTALL | SOLVER_SOLVABLE: {
-                               s = mapSolvable (what);
-                               PoolItem poolItem = _pool.find (s);
-                               if (poolItem) {
-                                   if (pool->installed && s.get()->repo == pool->installed) {
-                                       problemSolution->addSingleAction (poolItem, REMOVE);
-                                       std::string description = str::Format(_("remove lock to allow removal of %1%") ) % s.asString();
-                                       MIL << description << endl;
-                                       problemSolution->addDescription (description);
-                                   } else {
-                                       problemSolution->addSingleAction (poolItem, KEEP);
-                                       std::string description = str::Format(_("do not install %1%") ) % s.asString();
-                                       MIL << description << endl;
-                                       problemSolution->addDescription (description);
-                                   }
-                               } else {
-                                   ERR << "SOLVER_INSTALL_SOLVABLE: No item found for " << s.asString() << endl;
-                               }
-                           }
-                               break;
-                           case SOLVER_ERASE | SOLVER_SOLVABLE: {
-                               s = mapSolvable (what);
-                               PoolItem poolItem = _pool.find (s);
-                               if (poolItem) {
-                                   if (pool->installed && s.get()->repo == pool->installed) {
-                                       problemSolution->addSingleAction (poolItem, KEEP);
-                                       std::string description = str::Format(_("keep %1%") ) % s.asString();
-                                       MIL << description << endl;
-                                       problemSolution->addDescription (description);
-                                   } else {
-                                       problemSolution->addSingleAction (poolItem, UNLOCK);
-                                       std::string description = str::Format(_("remove lock to allow installation of %1%") ) % itemToString( poolItem );
-                                       MIL << description << endl;
-                                       problemSolution->addDescription (description);
-                                   }
-                               } else {
-                                   ERR << "SOLVER_ERASE_SOLVABLE: No item found for " << s.asString() << endl;
-                               }
-                           }
-                               break;
-                           case SOLVER_INSTALL | SOLVER_SOLVABLE_NAME:
-                               {
-                               IdString ident( what );
-                               SolverQueueItemInstall_Ptr install =
-                                   new SolverQueueItemInstall(_pool, ident.asString(), false );
-                               problemSolution->addSingleAction (install, REMOVE_SOLVE_QUEUE_ITEM);
-
-                               std::string description = str::Format(_("do not install %1%") ) % ident;
-                               MIL << description << endl;
-                               problemSolution->addDescription (description);
-                               }
-                               break;
-                           case SOLVER_ERASE | SOLVER_SOLVABLE_NAME:
-                               {
-                               // As we do not know, if this request has come from resolvePool or
-                               // resolveQueue we will have to take care for both cases.
+            solution = 0;
+            while ((solution = solver_next_solution(_satSolver, problem, solution)) != 0) {
+                element = 0;
+                ProblemSolutionCombi *problemSolution = new ProblemSolutionCombi;
+                while ((element = solver_next_solutionelement(_satSolver, problem, solution, element, &p, &rp)) != 0) {
+                    if (p == SOLVER_SOLUTION_JOB) {
+                        /* job, rp is index into job queue */
+                        what = _jobQueue.elements[rp];
+                        switch (_jobQueue.elements[rp-1]&(SOLVER_SELECTMASK|SOLVER_JOBMASK))
+                        {
+                            case SOLVER_INSTALL | SOLVER_SOLVABLE: {
+                                s = mapSolvable (what);
+                                PoolItem poolItem = _pool.find (s);
+                                if (poolItem) {
+                                    if (pool->installed && s.get()->repo == pool->installed) {
+                                        problemSolution->addSingleAction (poolItem, REMOVE);
+                                        std::string description = str::Format(_("remove lock to allow removal of %1%") ) % s.asString();
+                                        MIL << description << endl;
+                                        problemSolution->addDescription (description);
+                                    } else {
+                                        problemSolution->addSingleAction (poolItem, KEEP);
+                                        std::string description = str::Format(_("do not install %1%") ) % s.asString();
+                                        MIL << description << endl;
+                                        problemSolution->addDescription (description);
+                                    }
+                                } else {
+                                    ERR << "SOLVER_INSTALL_SOLVABLE: No item found for " << s.asString() << endl;
+                                }
+                            }
+                                break;
+                            case SOLVER_ERASE | SOLVER_SOLVABLE: {
+                                s = mapSolvable (what);
+                                PoolItem poolItem = _pool.find (s);
+                                if (poolItem) {
+                                    if (pool->installed && s.get()->repo == pool->installed) {
+                                        problemSolution->addSingleAction (poolItem, KEEP);
+                                        std::string description = str::Format(_("keep %1%") ) % s.asString();
+                                        MIL << description << endl;
+                                        problemSolution->addDescription (description);
+                                    } else {
+                                        problemSolution->addSingleAction (poolItem, UNLOCK);
+                                        std::string description = str::Format(_("remove lock to allow installation of %1%") ) % itemToString( poolItem );
+                                        MIL << description << endl;
+                                        problemSolution->addDescription (description);
+                                    }
+                                } else {
+                                    ERR << "SOLVER_ERASE_SOLVABLE: No item found for " << s.asString() << endl;
+                                }
+                            }
+                                break;
+                            case SOLVER_INSTALL | SOLVER_SOLVABLE_NAME:
+                                {
                                 IdString ident( what );
-                               FindPackage info (problemSolution, KEEP);
-                               invokeOnEach( _pool.byIdentBegin( ident ),
-                                             _pool.byIdentEnd( ident ),
-                                             functor::chain (resfilter::ByInstalled (),                        // ByInstalled
-                                                             resfilter::ByTransact ()),                        // will be deinstalled
-                                             functor::functorRef<bool,PoolItem> (info) );
-
-                               SolverQueueItemDelete_Ptr del =
-                                   new SolverQueueItemDelete(_pool, ident.asString(), false );
-                               problemSolution->addSingleAction (del, REMOVE_SOLVE_QUEUE_ITEM);
-
-                               std::string description = str::Format(_("keep %1%") ) % ident;
-                               MIL << description << endl;
-                               problemSolution->addDescription (description);
-                               }
-                               break;
-                           case SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES:
-                               {
-                               problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_REQUIRE);
-                               std::string description = "";
-
-                               // Checking if this problem solution would break your system
-                               if (system_requires.find(Capability(what)) != system_requires.end()) {
-                                   // Show a better warning
-                                   resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
-                                   resolverProblem->setDescription(_("This request will break your system!"));
-                                   description = _("ignore the warning of a broken system");
-                                   description += std::string(" (requires:")+pool_dep2str(pool, what)+")";
+                                SolverQueueItemInstall_Ptr install =
+                                    new SolverQueueItemInstall(_pool, ident.asString(), false );
+                                problemSolution->addSingleAction (install, REMOVE_SOLVE_QUEUE_ITEM);
+
+                                std::string description = str::Format(_("do not install %1%") ) % ident;
+                                MIL << description << endl;
+                                problemSolution->addDescription (description);
+                                }
+                                break;
+                            case SOLVER_ERASE | SOLVER_SOLVABLE_NAME:
+                                {
+                                // As we do not know, if this request has come from resolvePool or
+                                // resolveQueue we will have to take care for both cases.
+                                IdString ident( what );
+                                FindPackage info (problemSolution, KEEP);
+                                invokeOnEach( _pool.byIdentBegin( ident ),
+                                              _pool.byIdentEnd( ident ),
+                                              functor::chain (resfilter::ByInstalled (),                       // ByInstalled
+                                                              resfilter::ByTransact ()),                       // will be deinstalled
+                                              functor::functorRef<bool,PoolItem> (info) );
+
+                                SolverQueueItemDelete_Ptr del =
+                                    new SolverQueueItemDelete(_pool, ident.asString(), false );
+                                problemSolution->addSingleAction (del, REMOVE_SOLVE_QUEUE_ITEM);
+
+                                std::string description = str::Format(_("keep %1%") ) % ident;
+                                MIL << description << endl;
+                                problemSolution->addDescription (description);
+                                }
+                                break;
+                            case SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES:
+                                {
+                                problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_REQUIRE);
+                                std::string description = "";
+
+                                // Checking if this problem solution would break your system
+                                if (system_requires.find(Capability(what)) != system_requires.end()) {
+                                    // Show a better warning
+                                    resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
+                                    resolverProblem->setDescription(_("This request will break your system!"));
+                                    description = _("ignore the warning of a broken system");
+                                    description += std::string(" (requires:")+pool_dep2str(pool, what)+")";
                                     MIL << description << endl;
                                     problemSolution->addFrontDescription (description);
-                               } else {
-                                   description = str::Format(_("do not ask to install a solvable providing %1%") ) % pool_dep2str(pool, what);
+                                } else {
+                                    description = str::Format(_("do not ask to install a solvable providing %1%") ) % pool_dep2str(pool, what);
                                     MIL << description << endl;
                                     problemSolution->addDescription (description);
-                               }
-                               }
-                               break;
-                           case SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES:
-                               {
-                               problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_CONFLICT);
-                               std::string description = "";
-
-                               // Checking if this problem solution would break your system
-                               if (system_conflicts.find(Capability(what)) != system_conflicts.end()) {
-                                   // Show a better warning
-                                   resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
-                                   resolverProblem->setDescription(_("This request will break your system!"));
-                                   description = _("ignore the warning of a broken system");
-                                   description += std::string(" (conflicts:")+pool_dep2str(pool, what)+")";
+                                }
+                                }
+                                break;
+                            case SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES:
+                                {
+                                problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_CONFLICT);
+                                std::string description = "";
+
+                                // Checking if this problem solution would break your system
+                                if (system_conflicts.find(Capability(what)) != system_conflicts.end()) {
+                                    // Show a better warning
+                                    resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() );
+                                    resolverProblem->setDescription(_("This request will break your system!"));
+                                    description = _("ignore the warning of a broken system");
+                                    description += std::string(" (conflicts:")+pool_dep2str(pool, what)+")";
                                     MIL << description << endl;
                                     problemSolution->addFrontDescription (description);
 
-                               } else {
-                                   description = str::Format(_("do not ask to delete all solvables providing %1%") ) % pool_dep2str(pool, what);
+                                } else {
+                                    description = str::Format(_("do not ask to delete all solvables providing %1%") ) % pool_dep2str(pool, what);
+                                    MIL << description << endl;
+                                    problemSolution->addDescription (description);
+                                }
+                                }
+                                break;
+                            case SOLVER_UPDATE | SOLVER_SOLVABLE:
+                                {
+                                s = mapSolvable (what);
+                                PoolItem poolItem = _pool.find (s);
+                                if (poolItem) {
+                                    if (pool->installed && s.get()->repo == pool->installed) {
+                                        problemSolution->addSingleAction (poolItem, KEEP);
+                                        std::string description = str::Format(_("do not install most recent version of %1%") ) % s.asString();
+                                        MIL << description << endl;
+                                        problemSolution->addDescription (description);
+                                    } else {
+                                        ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE " << poolItem << " is not selected for installation" << endl;
+                                    }
+                                } else {
+                                    ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE: No item found for " << s.asString() << endl;
+                                }
+                                }
+                                break;
+                            default:
+                                MIL << "- do something different" << endl;
+                                ERR << "No valid solution available" << endl;
+                                break;
+                        }
+                    } else if (p == SOLVER_SOLUTION_INFARCH) {
+                        s = mapSolvable (rp);
+                        PoolItem poolItem = _pool.find (s);
+                        if (pool->installed && s.get()->repo == pool->installed) {
+                            problemSolution->addSingleAction (poolItem, LOCK);
+                            std::string description = str::Format(_("keep %1% despite the inferior architecture") ) % s.asString();
+                            MIL << description << endl;
+                            problemSolution->addDescription (description);
+                        } else {
+                            problemSolution->addSingleAction (poolItem, INSTALL);
+                            std::string description = str::Format(_("install %1% despite the inferior architecture") ) % s.asString();
+                            MIL << description << endl;
+                            problemSolution->addDescription (description);
+                        }
+                    } else if (p == SOLVER_SOLUTION_DISTUPGRADE) {
+                        s = mapSolvable (rp);
+                        PoolItem poolItem = _pool.find (s);
+                        if (pool->installed && s.get()->repo == pool->installed) {
+                            problemSolution->addSingleAction (poolItem, LOCK);
+                            std::string description = str::Format(_("keep obsolete %1%") ) % s.asString();
+                            MIL << description << endl;
+                            problemSolution->addDescription (description);
+                        } else {
+                            problemSolution->addSingleAction (poolItem, INSTALL);
+                            std::string description = str::Format(_("install %1% from excluded repository") ) % s.asString();
+                            MIL << description << endl;
+                            problemSolution->addDescription (description);
+                        }
+                    } else if ( p == SOLVER_SOLUTION_BLACK ) {
+                        // Allow to install a blacklisted package (PTF, retracted,...).
+                        // For not-installed items only
+                        s = mapSolvable (rp);
+                        PoolItem poolItem = _pool.find (s);
+
+                        problemSolution->addSingleAction (poolItem, INSTALL);
+                        std::string description;
+                        if ( s.isRetracted() ) {
+                          // translator: %1% is a package name
+                          description = str::Format(_("install %1% although it has been retracted")) % s.asString();
+                        } else if ( s.isPtf() ) {
+                          // translator: %1% is a package name
+                          description = str::Format(_("allow to install the PTF %1%")) % s.asString();
+                        } else {
+                          // translator: %1% is a package name
+                          description = str::Format(_("install %1% although it is blacklisted")) % s.asString();
+                        }
+                        MIL << description << endl;
+                        problemSolution->addDescription( description );
+                    } else if ( p > 0 ) {
+                        /* policy, replace p with rp */
+                        s = mapSolvable (p);
+                        PoolItem itemFrom = _pool.find (s);
+                        if (rp)
+                        {
+                            int gotone = 0;
+
+                            sd = mapSolvable (rp);
+                            PoolItem itemTo = _pool.find (sd);
+                            if (itemFrom && itemTo) {
+                                problemSolution->addSingleAction (itemTo, INSTALL);
+                                int illegal = policy_is_illegal(_satSolver, s.get(), sd.get(), 0);
+
+                                if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0)
+                                {
+                                    std::string description = str::Format(_("downgrade of %1% to %2%") ) % s.asString() % sd.asString();
+                                    MIL << description << endl;
+                                    problemSolution->addDescription (description);
+                                    gotone = 1;
+                                }
+                                if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0)
+                                {
+                                    std::string description = str::Format(_("architecture change of %1% to %2%") ) % s.asString() % sd.asString();
                                     MIL << description << endl;
                                     problemSolution->addDescription (description);
-                               }
-                               }
-                               break;
-                           case SOLVER_UPDATE | SOLVER_SOLVABLE:
-                               {
-                               s = mapSolvable (what);
-                               PoolItem poolItem = _pool.find (s);
-                               if (poolItem) {
-                                   if (pool->installed && s.get()->repo == pool->installed) {
-                                       problemSolution->addSingleAction (poolItem, KEEP);
-                                       std::string description = str::Format(_("do not install most recent version of %1%") ) % s.asString();
-                                       MIL << description << endl;
-                                       problemSolution->addDescription (description);
-                                   } else {
-                                       ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE " << poolItem << " is not selected for installation" << endl;
-                                   }
-                               } else {
-                                   ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE: No item found for " << s.asString() << endl;
-                               }
-                               }
-                               break;
-                           default:
-                               MIL << "- do something different" << endl;
-                               ERR << "No valid solution available" << endl;
-                               break;
-                       }
-                   } else if (p == SOLVER_SOLUTION_INFARCH) {
-                       s = mapSolvable (rp);
-                       PoolItem poolItem = _pool.find (s);
-                       if (pool->installed && s.get()->repo == pool->installed) {
-                           problemSolution->addSingleAction (poolItem, LOCK);
-                           std::string description = str::Format(_("keep %1% despite the inferior architecture") ) % s.asString();
-                           MIL << description << endl;
-                           problemSolution->addDescription (description);
-                       } else {
-                           problemSolution->addSingleAction (poolItem, INSTALL);
-                           std::string description = str::Format(_("install %1% despite the inferior architecture") ) % s.asString();
-                           MIL << description << endl;
-                           problemSolution->addDescription (description);
-                       }
-                   } else if (p == SOLVER_SOLUTION_DISTUPGRADE) {
-                       s = mapSolvable (rp);
-                       PoolItem poolItem = _pool.find (s);
-                       if (pool->installed && s.get()->repo == pool->installed) {
-                           problemSolution->addSingleAction (poolItem, LOCK);
-                           std::string description = str::Format(_("keep obsolete %1%") ) % s.asString();
-                           MIL << description << endl;
-                           problemSolution->addDescription (description);
-                       } else {
-                           problemSolution->addSingleAction (poolItem, INSTALL);
-                           std::string description = str::Format(_("install %1% from excluded repository") ) % s.asString();
-                           MIL << description << endl;
-                           problemSolution->addDescription (description);
-                       }
-                   } else if ( p == SOLVER_SOLUTION_BLACK ) {
-                       // Allow to install a blacklisted package (PTF, retracted,...).
-                       // For not-installed items only
-                       s = mapSolvable (rp);
-                       PoolItem poolItem = _pool.find (s);
-
-                       problemSolution->addSingleAction (poolItem, INSTALL);
-                       std::string description;
-                       if ( s.isRetracted() ) {
-                         // translator: %1% is a package name
-                         description = str::Format(_("install %1% although it has been retracted")) % s.asString();
-                       } else if ( s.isPtf() ) {
-                         // translator: %1% is a package name
-                         description = str::Format(_("allow to install the PTF %1%")) % s.asString();
-                       } else {
-                         // translator: %1% is a package name
-                         description = str::Format(_("install %1% although it is blacklisted")) % s.asString();
-                       }
-                       MIL << description << endl;
-                       problemSolution->addDescription( description );
-                   } else if ( p > 0 ) {
-                       /* policy, replace p with rp */
-                       s = mapSolvable (p);
-                       PoolItem itemFrom = _pool.find (s);
-                       if (rp)
-                       {
-                           int gotone = 0;
-
-                           sd = mapSolvable (rp);
-                           PoolItem itemTo = _pool.find (sd);
-                           if (itemFrom && itemTo) {
-                               problemSolution->addSingleAction (itemTo, INSTALL);
-                               int illegal = policy_is_illegal(_satSolver, s.get(), sd.get(), 0);
-
-                               if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0)
-                               {
-                                   std::string description = str::Format(_("downgrade of %1% to %2%") ) % s.asString() % sd.asString();
-                                   MIL << description << endl;
-                                   problemSolution->addDescription (description);
-                                   gotone = 1;
-                               }
-                               if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0)
-                               {
-                                   std::string description = str::Format(_("architecture change of %1% to %2%") ) % s.asString() % sd.asString();
-                                   MIL << description << endl;
-                                   problemSolution->addDescription (description);
-                                   gotone = 1;
-                               }
-                               if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0)
-                               {
+                                    gotone = 1;
+                                }
+                                if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0)
+                                {
                                     IdString s_vendor( s.vendor() );
                                     IdString sd_vendor( sd.vendor() );
-                                   std::string description;
-                                   if ( s == sd )
-                                     description = str::Format(_("install %1% (with vendor change)\n  %2%  -->  %3%") )
-                                     % sd.asString()
-                                     % ( s_vendor ? s_vendor.c_str() : " (no vendor) " )
-                                     % ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " );
-                                   else
-                                     description = str::Format(_("install %1% from vendor %2%\n  replacing %3% from vendor %4%") )
-                                     % sd.asString()  % ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " )
-                                     % s.asString() % ( s_vendor ? s_vendor.c_str() : " (no vendor) " );
-
-                                   MIL << description << endl;
-                                   problemSolution->addDescription (description);
-                                   gotone = 1;
-                               }
-                               if (!gotone) {
-                                   std::string description = str::Format(_("replacement of %1% with %2%") ) % s.asString() % sd.asString();
-                                   MIL << description << endl;
-                                   problemSolution->addDescription (description);
-                               }
-                           } else {
-                               ERR << s.asString() << " or "  << sd.asString() << " not found" << endl;
-                           }
-                       }
-                       else
-                       {
-                           if (itemFrom) {
-                               std::string description = str::Format(_("deinstallation of %1%") ) % s.asString();
-                               MIL << description << endl;
-                               problemSolution->addDescription (description);
-                               problemSolution->addSingleAction (itemFrom, REMOVE);
-                           }
-                       }
-                   }
-                   else
-                   {
-                     INT << "Unknown solution " << p << endl;
-                   }
-
-               }
-               resolverProblem->addSolution (problemSolution,
-                                             problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first.
-               MIL << "------------------------------------" << endl;
-           }
-
-           if (ignoreId > 0) {
-               // There is a possibility to ignore this error by setting weak dependencies
-               PoolItem item = _pool.find (sat::Solvable(ignoreId));
-               ProblemSolutionIgnore *problemSolution = new ProblemSolutionIgnore(item);
-               resolverProblem->addSolution (problemSolution,
-                                             false); // Solutions will be shown at the end
-               MIL << "ignore some dependencies of " << item << endl;
-               MIL << "------------------------------------" << endl;
-           }
-
-           // save problem
-           resolverProblems.push_back (resolverProblem);
-       }
+                                    std::string description;
+                                    if ( s == sd ) // FIXME? Actually .ident() must be eq. But the more verbose 'else' isn't bad either.
+                                      description = str::Format(_("install %1% (with vendor change)\n  %2%  -->  %3%") )
+                                      % sd.asString()
+                                      % ( s_vendor ? s_vendor.c_str() : " (no vendor) " )
+                                      % ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " );
+                                    else
+                                      description = str::Format(_("install %1% from vendor %2%\n  replacing %3% from vendor %4%") )
+                                      % sd.asString()  % ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " )
+                                      % s.asString() % ( s_vendor ? s_vendor.c_str() : " (no vendor) " );
+
+                                    MIL << description << endl;
+                                    problemSolution->addDescription (description);
+                                    gotone = 1;
+                                }
+                                if (!gotone) {
+                                    std::string description = str::Format(_("replacement of %1% with %2%") ) % s.asString() % sd.asString();
+                                    MIL << description << endl;
+                                    problemSolution->addDescription (description);
+                                }
+                            } else {
+                                ERR << s.asString() << " or "  << sd.asString() << " not found" << endl;
+                            }
+                        }
+                        else
+                        {
+                            if (itemFrom) {
+                                std::string description = str::Format(_("deinstallation of %1%") ) % s.asString();
+                                MIL << description << endl;
+                                problemSolution->addDescription (description);
+                                problemSolution->addSingleAction (itemFrom, REMOVE);
+                            }
+                        }
+                    }
+                    else
+                    {
+                      INT << "Unknown solution " << p << endl;
+                    }
+
+                }
+                resolverProblem->addSolution (problemSolution,
+                                              problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first.
+                MIL << "------------------------------------" << endl;
+            }
+
+            if (ignoreId > 0) {
+                // There is a possibility to ignore this error by setting weak dependencies
+                PoolItem item = _pool.find (sat::Solvable(ignoreId));
+                ProblemSolutionIgnore *problemSolution = new ProblemSolutionIgnore(item);
+                resolverProblem->addSolution (problemSolution,
+                                              false); // Solutions will be shown at the end
+                MIL << "ignore some dependencies of " << item << endl;
+                MIL << "------------------------------------" << endl;
+            }
+
+            // save problem
+            resolverProblems.push_back (resolverProblem);
+        }
     }
     return resolverProblems;
 }
@@ -1560,15 +1560,15 @@ void SATResolver::setLocks()
 
     for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); ++iter) {
         sat::detail::SolvableIdType ident( (*iter)->satSolvable().id() );
-       if (iter->status().isInstalled()) {
-           ++icnt;
-           queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
-           queue_push( &(_jobQueue), ident );
-       } else {
-           ++acnt;
-           queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
-           queue_push( &(_jobQueue), ident );
-       }
+        if (iter->status().isInstalled()) {
+            ++icnt;
+            queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
+            queue_push( &(_jobQueue), ident );
+        } else {
+            ++acnt;
+            queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
+            queue_push( &(_jobQueue), ident );
+        }
     }
     MIL << "Locked " << icnt << " installed items and " << acnt << " NOT installed items." << endl;
 
@@ -1581,12 +1581,12 @@ void SATResolver::setLocks()
       IdString ident( (*iter)->satSolvable().ident() );
       if ( unifiedByName.insert( ident ).second )
       {
-       if ( ! ui::Selectable::get( *iter )->hasInstalledObj() )
-       {
-         MIL << "Keep NOT installed name " << ident << " (" << *iter << ")" << endl;
-         queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
-         queue_push( &(_jobQueue), ident.id() );
-       }
+        if ( ! ui::Selectable::get( *iter )->hasInstalledObj() )
+        {
+          MIL << "Keep NOT installed name " << ident << " (" << *iter << ")" << endl;
+          queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
+          queue_push( &(_jobQueue), ident.id() );
+        }
       }
     }
 }
@@ -1597,15 +1597,15 @@ void SATResolver::setSystemRequirements()
     CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap();
 
     for (CapabilitySet::const_iterator iter = system_requires.begin(); iter != system_requires.end(); ++iter) {
-       queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
-       queue_push( &(_jobQueue), iter->id() );
-       MIL << "SYSTEM Requires " << *iter << endl;
+        queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES );
+        queue_push( &(_jobQueue), iter->id() );
+        MIL << "SYSTEM Requires " << *iter << endl;
     }
 
     for (CapabilitySet::const_iterator iter = system_conflicts.begin(); iter != system_conflicts.end(); ++iter) {
-       queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
-       queue_push( &(_jobQueue), iter->id() );
-       MIL << "SYSTEM Conflicts " << *iter << endl;
+        queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS );
+        queue_push( &(_jobQueue), iter->id() );
+        MIL << "SYSTEM Conflicts " << *iter << endl;
     }
 
     // Lock the architecture of the running systems rpm
index cc2a4eb..5f26c4b 100644 (file)
@@ -117,7 +117,7 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable, pr
     void solverInit(const PoolItemList & weakItems);
     // common solver run with the _jobQueue; Save results back to pool
     bool solving(const CapabilitySet & requires_caps = CapabilitySet(),
-                const CapabilitySet & conflict_caps = CapabilitySet());
+                 const CapabilitySet & conflict_caps = CapabilitySet());
     // cleanup solver
     void solverEnd();
     // set locks for the solver
@@ -150,14 +150,14 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable, pr
 
     // solver run with pool selected items
     bool resolvePool(const CapabilitySet & requires_caps,
-                    const CapabilitySet & conflict_caps,
-                    const PoolItemList & weakItems,
-                    const std::set<Repository> & upgradeRepos
-                    );
+                     const CapabilitySet & conflict_caps,
+                     const PoolItemList & weakItems,
+                     const std::set<Repository> & upgradeRepos
+                     );
     // solver run with the given request queue
     bool resolveQueue(const SolverQueueItemList &requestQueue,
-                     const PoolItemList & weakItems
-                     );
+                      const PoolItemList & weakItems
+                      );
     // searching for new packages
     void doUpdate();
 
index 51e7430..b7c10e8 100644 (file)
@@ -63,15 +63,15 @@ TransactionSolutionAction::dumpOn( std::ostream& os) const
 {
     os << "TransactionSolutionAction: ";
     switch (_action) {
-       case KEEP:                      os << "Keep " << _item; break;
-       case INSTALL:                   os << "Install " << _item; break;
-       case REMOVE:                    os << "Remove " << _item; break;
-       case UNLOCK:                    os << "Unlock " << _item; break;
-       case LOCK:                      os << "Lock " << _item; break;
-       case REMOVE_EXTRA_REQUIRE:      os << "Remove require " << _capability; break;
-       case REMOVE_EXTRA_CONFLICT:     os << "Remove conflict " << _capability; break;
-       case ADD_SOLVE_QUEUE_ITEM:      os << "Add SolveQueueItem " <<  _solverQueueItem; break;
-       case REMOVE_SOLVE_QUEUE_ITEM:   os << "Remove SolveQueueItem " <<  _solverQueueItem; break;
+        case KEEP:                     os << "Keep " << _item; break;
+        case INSTALL:                  os << "Install " << _item; break;
+        case REMOVE:                   os << "Remove " << _item; break;
+        case UNLOCK:                   os << "Unlock " << _item; break;
+        case LOCK:                     os << "Lock " << _item; break;
+        case REMOVE_EXTRA_REQUIRE:     os << "Remove require " << _capability; break;
+        case REMOVE_EXTRA_CONFLICT:    os << "Remove conflict " << _capability; break;
+        case ADD_SOLVE_QUEUE_ITEM:     os << "Add SolveQueueItem " <<  _solverQueueItem; break;
+        case REMOVE_SOLVE_QUEUE_ITEM:  os << "Remove SolveQueueItem " <<  _solverQueueItem; break;
     }
     return os;
 }
@@ -81,8 +81,8 @@ std::ostream&
 operator<<( std::ostream& os, const SolutionActionList & actionlist)
 {
     for (SolutionActionList::const_iterator iter = actionlist.begin(); iter != actionlist.end(); ++iter) {
-       os << *(*iter);
-       os << endl;
+        os << *(*iter);
+        os << endl;
     }
     return os;
 }
@@ -94,8 +94,8 @@ InjectSolutionAction::dumpOn( std::ostream& os ) const
 {
     os << "InjectSolutionAction: ";
     switch (_kind) {
-       case WEAK:      os << "Weak"; break;
-       default: os << "Wrong kind"; break;
+        case WEAK:     os << "Weak"; break;
+        default: os << "Wrong kind"; break;
     }
     os << " ";
     os << _item;
@@ -120,49 +120,49 @@ TransactionSolutionAction::execute(ResolverInternal & resolver) const
 {
     bool ret = true;
     switch (action()) {
-       case KEEP:
-           _item.status().resetTransact (ResStatus::USER);
-           ret = _item.status().setTransact (false, ResStatus::APPL_HIGH); // APPL_HIGH: Locking should not be saved permanently
-           break;
-       case INSTALL:
-           if (_item.status().isToBeUninstalled())
-               ret = _item.status().setTransact (false, ResStatus::USER);
-           else
-               _item.status().setToBeInstalled (ResStatus::USER);
-           break;
-       case REMOVE:
-           if (_item.status().isToBeInstalled()) {
-               _item.status().setTransact (false,ResStatus::USER);
-               _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
-           } else if (_item.status().isInstalled())
-               _item.status().setToBeUninstalled (ResStatus::USER);
-           else
-               _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
-           break;
-       case UNLOCK:
-           ret = _item.status().setLock (false, ResStatus::USER);
-           if (!ret) ERR << "Cannot unlock " << _item << endl;
-           break;
-       case LOCK:
-           _item.status().resetTransact (ResStatus::USER);
-           ret = _item.status().setLock (true, ResStatus::APPL_HIGH); // APPL_HIGH: Locking should not be saved permanently
-           if (!ret) ERR << "Cannot lock " << _item << endl;
-           break;
-       case REMOVE_EXTRA_REQUIRE:
-           resolver.removeExtraRequire (_capability);
-           break;
-       case REMOVE_EXTRA_CONFLICT:
-           resolver.removeExtraConflict (_capability);
-           break;
-       case ADD_SOLVE_QUEUE_ITEM:
-           resolver.addQueueItem(_solverQueueItem);
-           break;
-       case REMOVE_SOLVE_QUEUE_ITEM:
-           resolver.removeQueueItem(_solverQueueItem);
-           break;
-       default:
-           ERR << "Wrong TransactionKind" << endl;
-           ret = false;
+        case KEEP:
+            _item.status().resetTransact (ResStatus::USER);
+            ret = _item.status().setTransact (false, ResStatus::APPL_HIGH); // APPL_HIGH: Locking should not be saved permanently
+            break;
+        case INSTALL:
+            if (_item.status().isToBeUninstalled())
+                ret = _item.status().setTransact (false, ResStatus::USER);
+            else
+                _item.status().setToBeInstalled (ResStatus::USER);
+            break;
+        case REMOVE:
+            if (_item.status().isToBeInstalled()) {
+                _item.status().setTransact (false,ResStatus::USER);
+                _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
+            } else if (_item.status().isInstalled())
+                _item.status().setToBeUninstalled (ResStatus::USER);
+            else
+                _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
+            break;
+        case UNLOCK:
+            ret = _item.status().setLock (false, ResStatus::USER);
+            if (!ret) ERR << "Cannot unlock " << _item << endl;
+            break;
+        case LOCK:
+            _item.status().resetTransact (ResStatus::USER);
+            ret = _item.status().setLock (true, ResStatus::APPL_HIGH); // APPL_HIGH: Locking should not be saved permanently
+            if (!ret) ERR << "Cannot lock " << _item << endl;
+            break;
+        case REMOVE_EXTRA_REQUIRE:
+            resolver.removeExtraRequire (_capability);
+            break;
+        case REMOVE_EXTRA_CONFLICT:
+            resolver.removeExtraConflict (_capability);
+            break;
+        case ADD_SOLVE_QUEUE_ITEM:
+            resolver.addQueueItem(_solverQueueItem);
+            break;
+        case REMOVE_SOLVE_QUEUE_ITEM:
+            resolver.removeQueueItem(_solverQueueItem);
+            break;
+        default:
+            ERR << "Wrong TransactionKind" << endl;
+            ret = false;
     }
     return ret;
 }
@@ -172,12 +172,12 @@ InjectSolutionAction::execute(ResolverInternal & resolver) const
 {
     switch (_kind) {
         case WEAK:
-           // set item dependencies to weak
-           resolver.addWeak (_item);
+            // set item dependencies to weak
+            resolver.addWeak (_item);
             break;
         default:
-           ERR << "No valid InjectSolutionAction kind found" << endl;
-           return false;
+            ERR << "No valid InjectSolutionAction kind found" << endl;
+            return false;
     }
 
     return true;
index 8e03415..4553846 100644 (file)
@@ -37,140 +37,140 @@ namespace zypp
       DEFINE_PTR_TYPE(SolutionAction);
       typedef std::list<SolutionAction_Ptr> SolutionActionList;
 
-       /**
-        * Abstract base class for one action of a problem solution.
-        **/
-       class SolutionAction : public base::ReferenceCounted
-       {
-       protected:
-           typedef Resolver ResolverInternal;
-           SolutionAction ();
-       public:
-           virtual ~SolutionAction();
-
-           // ---------------------------------- I/O
-           virtual std::ostream & dumpOn( std::ostream & str ) const;
-           friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
-               { return action.dumpOn (str); }
-           friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
-
-           // ---------------------------------- methods
-           /**
-            * Execute this action.
-            * Returns 'true' on success, 'false' on error.
-            **/
-           virtual bool execute (ResolverInternal & resolver) const = 0;
-       };
-
-
-       /**
-        * A problem solution action that performs a transaction
-        * (installs, removes, keep ...)  one resolvable
-        * (package, patch, pattern, product).
-        **/
-       typedef enum
-       {
-           KEEP,
-           INSTALL,
-           REMOVE,
-           UNLOCK,
-           LOCK,
-           REMOVE_EXTRA_REQUIRE,
-           REMOVE_EXTRA_CONFLICT,
-           ADD_SOLVE_QUEUE_ITEM,
-           REMOVE_SOLVE_QUEUE_ITEM,
-       } TransactionKind;
-
-
-       class TransactionSolutionAction: public SolutionAction
-       {
-       public:
-           TransactionSolutionAction( PoolItem item,
-                                      TransactionKind action )
-               : SolutionAction(),
-                 _item( item ), _action( action ) {}
-
-           TransactionSolutionAction( Capability capability,
-                                      TransactionKind action )
-               : SolutionAction(),
-                 _capability( capability ), _action( action ) {}
-
-
-           TransactionSolutionAction( SolverQueueItem_Ptr item,
-                                      TransactionKind action )
-               : SolutionAction(),
-                 _solverQueueItem( item ), _action( action ) {}
-
-           TransactionSolutionAction( TransactionKind action )
-               : SolutionAction(),
-                 _item(), _action( action ) {}
-
-         // ---------------------------------- I/O
-         virtual std::ostream & dumpOn( std::ostream & str ) const;
-         friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
-               { return action.dumpOn (str); }
-
-         // ---------------------------------- accessors
-
-         const PoolItem item() const { return _item; }
-         const Capability capability() const { return _capability; }
-         TransactionKind action() const { return _action; }
-
-         // ---------------------------------- methods
-           virtual bool execute(ResolverInternal & resolver) const;
-
-       protected:
-
-           PoolItem _item;
-           Capability _capability;
-           SolverQueueItem_Ptr _solverQueueItem;
-
-           const TransactionKind _action;
-       };
-
-
-       /**
-        * Type of ignoring; currently only WEAK
-        **/
-
-       typedef enum
-       {
-           WEAK
-       } InjectSolutionKind;
-
-
-       /**
-        * A problem solution action that injects an artificial "provides" to
-        * the pool to satisfy open requirements or remove the conflict of
-        * concerning resolvable
-        *
-        * This is typically used by "ignore" (user override) solutions.
-        **/
-       class InjectSolutionAction: public SolutionAction
-       {
-       public:
-
-           InjectSolutionAction( PoolItem item,
-                                 const InjectSolutionKind & kind)
-               : SolutionAction(),
-                 _item( item ),
-                 _kind( kind ) {}
-
-         // ---------------------------------- I/O
-         virtual std::ostream & dumpOn( std::ostream & str ) const;
-         friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
-               { return action.dumpOn (str); }
-
-         // ---------------------------------- accessors
-           const PoolItem item() const { return _item; }
-
-         // ---------------------------------- methods
-           virtual bool execute(ResolverInternal & resolver) const;
-
-       protected:
-           PoolItem _item;
-           const InjectSolutionKind _kind;
-       };
+        /**
+         * Abstract base class for one action of a problem solution.
+         **/
+        class SolutionAction : public base::ReferenceCounted
+        {
+        protected:
+            typedef Resolver ResolverInternal;
+            SolutionAction ();
+        public:
+            virtual ~SolutionAction();
+
+            // ---------------------------------- I/O
+            virtual std::ostream & dumpOn( std::ostream & str ) const;
+            friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
+                { return action.dumpOn (str); }
+            friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
+
+            // ---------------------------------- methods
+            /**
+             * Execute this action.
+             * Returns 'true' on success, 'false' on error.
+             **/
+            virtual bool execute (ResolverInternal & resolver) const = 0;
+        };
+
+
+        /**
+         * A problem solution action that performs a transaction
+         * (installs, removes, keep ...)  one resolvable
+         * (package, patch, pattern, product).
+         **/
+        typedef enum
+        {
+            KEEP,
+            INSTALL,
+            REMOVE,
+            UNLOCK,
+            LOCK,
+            REMOVE_EXTRA_REQUIRE,
+            REMOVE_EXTRA_CONFLICT,
+            ADD_SOLVE_QUEUE_ITEM,
+            REMOVE_SOLVE_QUEUE_ITEM,
+        } TransactionKind;
+
+
+        class TransactionSolutionAction: public SolutionAction
+        {
+        public:
+            TransactionSolutionAction( PoolItem item,
+                                       TransactionKind action )
+                : SolutionAction(),
+                  _item( item ), _action( action ) {}
+
+            TransactionSolutionAction( Capability capability,
+                                       TransactionKind action )
+                : SolutionAction(),
+                  _capability( capability ), _action( action ) {}
+
+
+            TransactionSolutionAction( SolverQueueItem_Ptr item,
+                                       TransactionKind action )
+                : SolutionAction(),
+                  _solverQueueItem( item ), _action( action ) {}
+
+            TransactionSolutionAction( TransactionKind action )
+                : SolutionAction(),
+                  _item(), _action( action ) {}
+
+          // ---------------------------------- I/O
+          virtual std::ostream & dumpOn( std::ostream & str ) const;
+          friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
+                { return action.dumpOn (str); }
+
+          // ---------------------------------- accessors
+
+          const PoolItem item() const { return _item; }
+          const Capability capability() const { return _capability; }
+          TransactionKind action() const { return _action; }
+
+          // ---------------------------------- methods
+            virtual bool execute(ResolverInternal & resolver) const;
+
+        protected:
+
+            PoolItem _item;
+            Capability _capability;
+            SolverQueueItem_Ptr _solverQueueItem;
+
+            const TransactionKind _action;
+        };
+
+
+        /**
+         * Type of ignoring; currently only WEAK
+         **/
+
+        typedef enum
+        {
+            WEAK
+        } InjectSolutionKind;
+
+
+        /**
+         * A problem solution action that injects an artificial "provides" to
+         * the pool to satisfy open requirements or remove the conflict of
+         * concerning resolvable
+         *
+         * This is typically used by "ignore" (user override) solutions.
+         **/
+        class InjectSolutionAction: public SolutionAction
+        {
+        public:
+
+            InjectSolutionAction( PoolItem item,
+                                  const InjectSolutionKind & kind)
+                : SolutionAction(),
+                  _item( item ),
+                  _kind( kind ) {}
+
+          // ---------------------------------- I/O
+          virtual std::ostream & dumpOn( std::ostream & str ) const;
+          friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
+                { return action.dumpOn (str); }
+
+          // ---------------------------------- accessors
+            const PoolItem item() const { return _item; }
+
+          // ---------------------------------- methods
+            virtual bool execute(ResolverInternal & resolver) const;
+
+        protected:
+            PoolItem _item;
+            const InjectSolutionKind _kind;
+        };
 
 
       ///////////////////////////////////////////////////////////////////
index d448ff3..6774233 100644 (file)
@@ -64,9 +64,9 @@ std::ostream&
 operator<<( std::ostream & os, const SolverQueueItemList & itemlist )
 {
     for (SolverQueueItemList::const_iterator iter = itemlist.begin(); iter != itemlist.end(); ++iter) {
-       if (iter != itemlist.begin())
-           os << "," << endl << "\t";
-       os << **iter;
+        if (iter != itemlist.begin())
+            os << "," << endl << "\t";
+        os << **iter;
     }
     return os;
 }
index 57409a4..55c16ab 100644 (file)
@@ -77,14 +77,14 @@ bool SolverQueueItemDelete::addRule (sat::detail::CQueue & q)
 
     ::Id id = IdString(_name).id();
     if (_soft) {
-       queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
+        queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS );
     } else {
-       queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS );
+        queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS );
     }
     queue_push( &(q), id);
 
     MIL << "Delete " << _name << (_soft ? "(soft)" : "")
-       << " with SAT-Pool: " << id << endl;
+        << " with SAT-Pool: " << id << endl;
     return true;
 }
 
@@ -106,7 +106,7 @@ SolverQueueItemDelete::cmp (SolverQueueItem_constPtr item) const
         return cmp;
     SolverQueueItemDelete_constPtr del = dynamic_pointer_cast<const SolverQueueItemDelete>(item);
     if (_name != del->_name) {
-       return _name.compare(del->_name);
+        return _name.compare(del->_name);
     }
     return 0;
 }
index 31f86e0..0e56a5b 100644 (file)
@@ -43,7 +43,7 @@ namespace zypp
 //     CLASS NAME : SolverQueueItemDelete
 
 class SolverQueueItemDelete : public SolverQueueItem {
-    
+
   private:
 
     std::string _name;
@@ -53,7 +53,7 @@ class SolverQueueItemDelete : public SolverQueueItem {
 
     SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft = false);
     virtual ~SolverQueueItemDelete();
-    
+
     // ---------------------------------- I/O
 
     virtual std::ostream & dumpOn( std::ostream & str ) const;
@@ -63,10 +63,10 @@ class SolverQueueItemDelete : public SolverQueueItem {
 
     // ---------------------------------- accessors
 
-    bool isSoft (void) const { return _soft; }    
+    bool isSoft (void) const { return _soft; }
 
     // ---------------------------------- methods
-    
+
     virtual bool addRule (sat::detail::CQueue & q);
     virtual SolverQueueItem_Ptr copy (void) const;
     virtual int cmp (SolverQueueItem_constPtr item) const;
index 602dda3..f7ba00b 100644 (file)
@@ -76,14 +76,14 @@ bool SolverQueueItemInstall::addRule (sat::detail::CQueue & q)
 {
     ::Id id = IdString(_name).id();
     if (_soft) {
-       queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_WEAK  );
+        queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_WEAK  );
     } else {
-       queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME );
+        queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME );
     }
     queue_push( &(q), id);
 
     MIL << "Install " << _name << (_soft ? "(soft)" : "")
-       << " with SAT-PoolID: " << id << endl;
+        << " with SAT-PoolID: " << id << endl;
     return true;
 }
 
@@ -105,7 +105,7 @@ SolverQueueItemInstall::cmp (SolverQueueItem_constPtr item) const
         return cmp;
     SolverQueueItemInstall_constPtr ins = dynamic_pointer_cast<const SolverQueueItemInstall>(item);
     if (_name != ins->_name) {
-       return _name.compare(ins->_name);
+        return _name.compare(ins->_name);
     }
     return 0;
 }
index c4b6698..9c1c58c 100644 (file)
@@ -42,7 +42,7 @@ namespace zypp
 //     CLASS NAME : SolverQueueItemInstall
 
 class SolverQueueItemInstall : public SolverQueueItem {
-    
+
   private:
 
     std::string _name;
@@ -52,7 +52,7 @@ class SolverQueueItemInstall : public SolverQueueItem {
 
     SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft = false);
     virtual ~SolverQueueItemInstall();
-    
+
     // ---------------------------------- I/O
 
     virtual std::ostream & dumpOn( std::ostream & str ) const;
@@ -62,7 +62,7 @@ class SolverQueueItemInstall : public SolverQueueItem {
 
     // ---------------------------------- accessors
 
-    bool isSoft (void) const { return _soft; }    
+    bool isSoft (void) const { return _soft; }
 
     // ---------------------------------- methods
 
index 68585fd..de3e8b9 100644 (file)
@@ -50,9 +50,9 @@ SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const
 {
     os << "[" << (_soft?"Soft":"") << "InstallOneOf: ";
     for (PoolItemList::const_iterator iter = _oneOfList.begin();
-        iter != _oneOfList.end();
-        iter++)
-       os << *iter;
+         iter != _oneOfList.end();
+         iter++)
+        os << *iter;
     os << "]";
 
     return os;
@@ -61,7 +61,7 @@ SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const
 //---------------------------------------------------------------------------
 
 SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList,
-                                                         bool soft)
+                                                          bool soft)
     : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool)
     , _oneOfList (itemList)
     , _soft (soft)
@@ -82,21 +82,21 @@ bool SolverQueueItemInstallOneOf::addRule (sat::detail::CQueue & q)
     Queue qs;
 
     if (_soft) {
-       queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_ONE_OF | SOLVER_WEAK);
+        queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_ONE_OF | SOLVER_WEAK);
     } else {
-       queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_ONE_OF );
+        queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_ONE_OF );
     }
 
     queue_init(&qs);
     for (PoolItemList::const_iterator iter = _oneOfList.begin(); iter != _oneOfList.end(); iter++) {
-       Id id = (*iter)->satSolvable().id();
-       if (id == ID_NULL) {
-           ERR << *iter << " not found" << endl;
-           ret = false;
-       } else {
-           MIL << "    candidate:" << *iter << " with the SAT-Pool ID: " << id << endl;
-           queue_push( &(qs), id );
-       }
+        Id id = (*iter)->satSolvable().id();
+        if (id == ID_NULL) {
+            ERR << *iter << " not found" << endl;
+            ret = false;
+        } else {
+            MIL << "    candidate:" << *iter << " with the SAT-Pool ID: " << id << endl;
+            queue_push( &(qs), id );
+        }
     }
     sat::Pool satPool( sat::Pool::instance() );
     queue_push( &(q), pool_queuetowhatprovides(satPool.get(), &qs));
index a5afc55..e6b6807 100644 (file)
@@ -44,17 +44,17 @@ class SolverQueueItemInstallOneOf : public SolverQueueItem {
 
   public:
     typedef std::list<PoolItem> PoolItemList;
-    
+
   private:
 
     PoolItemList _oneOfList; // List of candidates
-    bool _soft;          // if triggered by a soft requirement (a recommends)    
+    bool _soft;          // if triggered by a soft requirement (a recommends)
 
   public:
 
     SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft = false);
     virtual ~SolverQueueItemInstallOneOf();
-    
+
     // ---------------------------------- I/O
 
     virtual std::ostream & dumpOn( std::ostream & str ) const;
@@ -64,8 +64,8 @@ class SolverQueueItemInstallOneOf : public SolverQueueItem {
 
     // ---------------------------------- accessors
 
-    bool isSoft (void) const { return _soft; }    
-    
+    bool isSoft (void) const { return _soft; }
+
     // ---------------------------------- methods
 
     virtual bool addRule (sat::detail::CQueue & q);
index 53139d3..033558d 100644 (file)
@@ -48,7 +48,7 @@ std::ostream &
 SolverQueueItemLock::dumpOn( std::ostream & os ) const
 {
     os << "[" << (_soft?"Soft":"") << "Lock: " <<
-       _item << "]";
+        _item << "]";
 
     return os;
 }
@@ -56,7 +56,7 @@ SolverQueueItemLock::dumpOn( std::ostream & os ) const
 //---------------------------------------------------------------------------
 
 SolverQueueItemLock::SolverQueueItemLock (const ResPool & pool,
-                                             const PoolItem & item, bool soft)
+                                              const PoolItem & item, bool soft)
     : SolverQueueItem (QUEUE_ITEM_TYPE_LOCK, pool)
     , _item (item)
     , _soft (soft)
@@ -74,22 +74,22 @@ bool SolverQueueItemLock::addRule (sat::detail::CQueue & q)
 {
     ::Id id = _item.satSolvable().id();
     if (id == ID_NULL) {
-       ERR << "Lock : " << _item << " not found" << endl;
-       return false;
+        ERR << "Lock : " << _item << " not found" << endl;
+        return false;
     }
     MIL << "Lock " << _item << " with the SAT-Pool ID: " << id << endl;
     if (_item.status().isInstalled()) {
-       if (_soft) {
-           queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE | SOLVER_WEAK );
-       } else {
-           queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE );
-       }
+        if (_soft) {
+            queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE | SOLVER_WEAK );
+        } else {
+            queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE );
+        }
     } else {
-       if (_soft) {
-           queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE | SOLVER_WEAK );
-       } else {
-           queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE );
-       }
+        if (_soft) {
+            queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE | SOLVER_WEAK );
+        } else {
+            queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE );
+        }
     }
     queue_push( &(q), id );
     return true;
index adc13ee..09db28f 100644 (file)
@@ -42,7 +42,7 @@ namespace zypp
 //     CLASS NAME : SolverQueueItemLock
 
 class SolverQueueItemLock : public SolverQueueItem {
-    
+
   private:
 
     PoolItem _item;    // the item to-be-locked
@@ -52,7 +52,7 @@ class SolverQueueItemLock : public SolverQueueItem {
 
     SolverQueueItemLock (const ResPool & pool, const PoolItem & item, bool soft = false);
     virtual ~SolverQueueItemLock();
-    
+
     // ---------------------------------- I/O
 
     virtual std::ostream & dumpOn( std::ostream & str ) const;
@@ -62,10 +62,10 @@ class SolverQueueItemLock : public SolverQueueItem {
 
     // ---------------------------------- accessors
 
-    bool isSoft (void) const { return _soft; }    
+    bool isSoft (void) const { return _soft; }
 
     // ---------------------------------- methods
-    
+
     virtual bool addRule (sat::detail::CQueue & q);
     virtual SolverQueueItem_Ptr copy (void) const;
     virtual int cmp (SolverQueueItem_constPtr item) const;
index 1829186..d16eb89 100644 (file)
@@ -48,7 +48,7 @@ std::ostream &
 SolverQueueItemUpdate::dumpOn( std::ostream & os ) const
 {
     os << "[" << (_soft?"Soft":"") << "Update: " <<
-       _item << "]";
+        _item << "]";
 
     return os;
 }
@@ -56,7 +56,7 @@ SolverQueueItemUpdate::dumpOn( std::ostream & os ) const
 //---------------------------------------------------------------------------
 
 SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool,
-                                             const PoolItem & item, bool soft)
+                                              const PoolItem & item, bool soft)
     : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool)
     , _item (item)
     , _soft (soft)
@@ -74,8 +74,8 @@ bool SolverQueueItemUpdate::addRule (sat::detail::CQueue & q)
 {
     ::Id id = _item.satSolvable().id();
     if (id == ID_NULL) {
-       ERR << "Update explicit: " << _item << " not found" << endl;
-       return false;
+        ERR << "Update explicit: " << _item << " not found" << endl;
+        return false;
     }
     MIL << "Update explicit " << _item << " with the SAT-Pool ID: " << id << endl;
     queue_push( &(q), SOLVER_UPDATE | SOLVER_SOLVABLE );
index 4e2d3d5..faaf6c9 100644 (file)
@@ -42,7 +42,7 @@ namespace zypp
 //     CLASS NAME : SolverQueueItemUpdate
 
 class SolverQueueItemUpdate : public SolverQueueItem {
-    
+
   private:
 
     PoolItem _item;    // the item to-be-updated
@@ -52,7 +52,7 @@ class SolverQueueItemUpdate : public SolverQueueItem {
 
     SolverQueueItemUpdate (const ResPool & pool, const PoolItem & item, bool soft = false);
     virtual ~SolverQueueItemUpdate();
-    
+
     // ---------------------------------- I/O
 
     virtual std::ostream & dumpOn( std::ostream & str ) const;
@@ -62,10 +62,10 @@ class SolverQueueItemUpdate : public SolverQueueItem {
 
     // ---------------------------------- accessors
 
-    bool isSoft (void) const { return _soft; }    
+    bool isSoft (void) const { return _soft; }
 
     // ---------------------------------- methods
-    
+
     virtual bool addRule (sat::detail::CQueue & q);
     virtual SolverQueueItem_Ptr copy (void) const;
     virtual int cmp (SolverQueueItem_constPtr item) const;
index bf69404..8a13561 100644 (file)
@@ -40,16 +40,16 @@ namespace zypp
 
     const SystemCheck & SystemCheck::instance()
     {
-       static SystemCheck _val;
-       return _val;
+        static SystemCheck _val;
+        return _val;
     }
 
 
   SystemCheck::SystemCheck() {
-       if (_file.empty()) {
-           _file = ZConfig::instance().solver_checkSystemFile();
-           loadFile(_file);
-       }
+        if (_file.empty()) {
+            _file = ZConfig::instance().solver_checkSystemFile();
+            loadFile(_file);
+        }
         if (_dir.empty()) {
           _dir = ZConfig::instance().solver_checkSystemFileDir();
           loadFiles();
@@ -57,10 +57,10 @@ namespace zypp
     }
 
     bool SystemCheck::setFile(const Pathname & file) const{
-       MIL << "Setting checkFile to : " << file << endl;
-       _file = file;
-       loadFile(_file);
-       return true;
+        MIL << "Setting checkFile to : " << file << endl;
+        _file = file;
+        loadFile(_file);
+        return true;
     }
 
     bool SystemCheck::setDir(const Pathname & dir) const {
@@ -72,19 +72,19 @@ namespace zypp
     }
 
     const Pathname & SystemCheck::file() {
-       return _file;
+        return _file;
     }
 
     const Pathname & SystemCheck::dir() {
-       return _dir;
+        return _dir;
     }
 
     const CapabilitySet & SystemCheck::requiredSystemCap() const{
-       return _require;
+        return _require;
     }
 
     const CapabilitySet & SystemCheck::conflictSystemCap() const{
-       return _conflict;
+        return _conflict;
     }
 
     bool SystemCheck::loadFile(Pathname & file, bool reset_caps) const{
@@ -92,40 +92,40 @@ namespace zypp
         if ( trg )
           file = trg->assertRootPrefix( file );
 
-       PathInfo pi( file );
-       if ( ! pi.isFile() ) {
-           WAR << "Can't read " << file << " " << pi << endl;
-           return false;
-       }
+        PathInfo pi( file );
+        if ( ! pi.isFile() ) {
+            WAR << "Can't read " << file << " " << pi << endl;
+            return false;
+        }
 
         if (reset_caps) {
           _require.clear();
           _conflict.clear();
         }
 
-       std::ifstream infile( file.c_str() );
-       for( iostr::EachLine in( infile ); in; in.next() ) {
-           std::string l( str::trim(*in) );
-           if ( ! l.empty() && l[0] != '#' )
-           {
-               CapList capList;
-               str::split( l, back_inserter(capList), ":" );
-               if (capList.size() == 2 ) {
-                   CapList::iterator it = capList.begin();
-                   if (*it == "requires") {
-                       _require.insert(Capability(*(it+1)));
-                   } else if (*it == "conflicts") {
-                       _conflict.insert(Capability(*(it+1)));
-                   } else {
-                       ERR << "Wrong parameter: " << l << endl;
-                   }
-               } else {
-                   ERR << "Wrong line: " << l << endl;
-               }
-           }
-       }
-       MIL << "Read " << pi << endl;
-       return true;
+        std::ifstream infile( file.c_str() );
+        for( iostr::EachLine in( infile ); in; in.next() ) {
+            std::string l( str::trim(*in) );
+            if ( ! l.empty() && l[0] != '#' )
+            {
+                CapList capList;
+                str::split( l, back_inserter(capList), ":" );
+                if (capList.size() == 2 ) {
+                    CapList::iterator it = capList.begin();
+                    if (*it == "requires") {
+                        _require.insert(Capability(*(it+1)));
+                    } else if (*it == "conflicts") {
+                        _conflict.insert(Capability(*(it+1)));
+                    } else {
+                        ERR << "Wrong parameter: " << l << endl;
+                    }
+                } else {
+                    ERR << "Wrong line: " << l << endl;
+                }
+            }
+        }
+        MIL << "Read " << pi << endl;
+        return true;
     }
 
   bool SystemCheck::loadFiles() const {
@@ -158,11 +158,11 @@ namespace zypp
       str << _file << endl;
       str << "requires" << endl;
       for (CapabilitySet::const_iterator it = _require.begin(); it != _require.end(); ++it)
-         str << "  " << *it << endl;
+          str << "  " << *it << endl;
 
       str << "conflicts" << endl;
       for (CapabilitySet::const_iterator it = _conflict.begin(); it != _conflict.end(); ++it)
-         str << "  " << *it << endl;
+          str << "  " << *it << endl;
 
       return str;
     }
index 81c0e87..b98a129 100644 (file)
@@ -35,8 +35,8 @@ namespace zypp
 
       public:
 
-       /** Singleton */
-       static const SystemCheck & instance();
+        /** Singleton */
+        static const SystemCheck & instance();
 
         /** Return the file path. */
         const Pathname & file();
@@ -45,14 +45,14 @@ namespace zypp
         const Pathname & dir();
 
         /** Set configuration file of system requirements
-        *  Should be used for testcase only   
-        */
+         *  Should be used for testcase only
+         */
         bool setFile(const Pathname & file) const;
 
         /** Set configuration directory for files of system
-        *  requirements.
+         *  requirements.
          *  Should be used for testcase only
-        */
+         */
         bool setDir(const Pathname & dir) const;
 
         /** Returns a list of required system capabilities.
@@ -67,7 +67,7 @@ namespace zypp
         /** Ctor taking the file to read. */
         SystemCheck();
         bool loadFile(Pathname &file, bool reset_caps = true) const;
-       bool loadFiles() const;
+        bool loadFiles() const;
     };
     ///////////////////////////////////////////////////////////////////
 
index 7941ad7..7fcf119 100644 (file)
@@ -71,13 +71,13 @@ namespace zypp
 
       bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool runSolver)
       {
-       // libzypp/issues/317: make sure a satsolver instance is actually present
-       if ( not resolver.get() ) {
-         WAR << "Can't createTestcase if the satsolver is not yet initialized." << endl;
-         return false;
-       }
+        // libzypp/issues/317: make sure a satsolver instance is actually present
+        if ( not resolver.get() ) {
+          WAR << "Can't createTestcase if the satsolver is not yet initialized." << endl;
+          return false;
+        }
 
-       MIL << "createTestcase at " << dumpPath << (dumpPool?" dumpPool":"") << (runSolver?" runSolver":"") << endl;
+        MIL << "createTestcase at " << dumpPath << (dumpPool?" dumpPool":"") << (runSolver?" runSolver":"") << endl;
         PathInfo path (dumpPath);
 
         if ( !path.isExist() ) {
@@ -213,16 +213,16 @@ namespace zypp
 
         // Vendor settings
         yOut << YAML::Key << "vendors" << YAML::Value << YAML::BeginSeq ;
-       VendorAttr::instance().foreachVendorList( [&]( VendorAttr::VendorList vlist )->bool {
-         if ( ! vlist.empty() ) {
-           yOut << YAML::Value << YAML::BeginSeq;
-           for( const auto & v : vlist )
-             yOut << YAML::Value << v ;
-           yOut << YAML::EndSeq;
-         }
-         return true;
-       } );
-       yOut << YAML::EndSeq; // vendors
+        VendorAttr::instance().foreachVendorList( [&]( VendorAttr::VendorList vlist )->bool {
+          if ( ! vlist.empty() ) {
+            yOut << YAML::Value << YAML::BeginSeq;
+            for( const auto & v : vlist )
+              yOut << YAML::Value << v ;
+            yOut << YAML::EndSeq;
+          }
+          return true;
+        } );
+        yOut << YAML::EndSeq; // vendors
 
         // helper lambda to write a list of elements into a external file instead of the main file
         const auto &writeListOrFile = [&]( const std::string &name, const auto &list, const auto &callback ) {
@@ -385,7 +385,7 @@ namespace zypp
         std::ofstream fout( dumpPath+"/zypp-control.yaml" );
         fout << yOut.c_str();
 
-       MIL << "createTestcase done at " << dumpPath << endl;
+        MIL << "createTestcase done at " << dumpPath << endl;
         return true;
       }
       ///////////////////////////////////////////////////////////////////
index 72ba5a0..4e363da 100644 (file)
@@ -39,13 +39,13 @@ namespace zypp
        **/
       class Testcase
       {
-       private:
-         std::string dumpPath; // Path of the generated testcase
+        private:
+          std::string dumpPath; // Path of the generated testcase
 
-       public:
-         Testcase();
-         Testcase( const std::string & path );
-         ~Testcase();
+        public:
+          Testcase();
+          Testcase( const std::string & path );
+          ~Testcase();
 
           bool createTestcase( Resolver & resolver, bool dumpPool = true, bool runSolver = true );
       };
index 3316690..22154dd 100644 (file)
@@ -84,9 +84,9 @@ std::string helixXML( const Edition &edition )
     std::stringstream str;
     str << xml_tag_enclose(edition.version(), "version");
     if (!edition.release().empty())
-       str << xml_tag_enclose(edition.release(), "release");
+        str << xml_tag_enclose(edition.release(), "release");
     if (edition.epoch() != Edition::noepoch)
-       str << xml_tag_enclose(numstring(edition.epoch()), "epoch");
+        str << xml_tag_enclose(numstring(edition.epoch()), "epoch");
     return str.str();
 }
 
@@ -104,49 +104,49 @@ std::string helixXML( const Capability &cap )
     std::stringstream str;
     CapDetail detail = cap.detail();
     if (detail.isSimple()) {
-       if (detail.isVersioned()) {
-           str << "<dep name='" << xml_escape(detail.name().asString()) << "'"
-               << " op='" << xml_escape(detail.op().asString()) << "'"
-               << " version='" <<  xml_escape(detail.ed().version()) << "'";
-           if (!detail.ed().release().empty())
-               str << " release='" << xml_escape(detail.ed().release()) << "'";
-           if (detail.ed().epoch() != Edition::noepoch)
-               str << " epoch='" << xml_escape(numstring(detail.ed().epoch())) << "'";
-           str << " />" << endl;
-       } else {
-           str << "<dep name='" << xml_escape(cap.asString()) << "' />" << endl;
-       }
+        if (detail.isVersioned()) {
+            str << "<dep name='" << xml_escape(detail.name().asString()) << "'"
+                << " op='" << xml_escape(detail.op().asString()) << "'"
+                << " version='" <<  xml_escape(detail.ed().version()) << "'";
+            if (!detail.ed().release().empty())
+                str << " release='" << xml_escape(detail.ed().release()) << "'";
+            if (detail.ed().epoch() != Edition::noepoch)
+                str << " epoch='" << xml_escape(numstring(detail.ed().epoch())) << "'";
+            str << " />" << endl;
+        } else {
+            str << "<dep name='" << xml_escape(cap.asString()) << "' />" << endl;
+        }
     } else if (detail.isExpression()) {
-       if (detail.capRel() == CapDetail::CAP_AND
-           && detail.lhs().detail().isNamed()
-           && detail.rhs().detail().isNamed()) {
-           // packageand dependency
-           str << "<dep name='packageand("
-               << IdString(detail.lhs().id()) << ":"
-               << IdString(detail.rhs().id()) << ")' />" << endl;
-       } else if (detail.capRel() == CapDetail::CAP_NAMESPACE
-           && detail.lhs().id() == NAMESPACE_OTHERPROVIDERS) {
-           str << "<dep name='otherproviders("
-               << IdString(detail.rhs().id()) << ")' />" << endl;
-       } else {
-           // modalias ?
-           IdString packageName;
-           if (detail.capRel() == CapDetail::CAP_AND) {
-               packageName = IdString(detail.lhs().id());
-               detail = detail.rhs().detail();
-           }
-           if (detail.capRel() == CapDetail::CAP_NAMESPACE
-               && detail.lhs().id() == NAMESPACE_MODALIAS) {
-               str << "<dep name='modalias(";
-               if (!packageName.empty())
-                   str << packageName << ":";
-               str << IdString(detail.rhs().id()) << ")' />" << endl;
-           } else {
-               str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
-           }
-       }
+        if (detail.capRel() == CapDetail::CAP_AND
+            && detail.lhs().detail().isNamed()
+            && detail.rhs().detail().isNamed()) {
+            // packageand dependency
+            str << "<dep name='packageand("
+                << IdString(detail.lhs().id()) << ":"
+                << IdString(detail.rhs().id()) << ")' />" << endl;
+        } else if (detail.capRel() == CapDetail::CAP_NAMESPACE
+            && detail.lhs().id() == NAMESPACE_OTHERPROVIDERS) {
+            str << "<dep name='otherproviders("
+                << IdString(detail.rhs().id()) << ")' />" << endl;
+        } else {
+            // modalias ?
+            IdString packageName;
+            if (detail.capRel() == CapDetail::CAP_AND) {
+                packageName = IdString(detail.lhs().id());
+                detail = detail.rhs().detail();
+            }
+            if (detail.capRel() == CapDetail::CAP_NAMESPACE
+                && detail.lhs().id() == NAMESPACE_MODALIAS) {
+                str << "<dep name='modalias(";
+                if (!packageName.empty())
+                    str << packageName << ":";
+                str << IdString(detail.rhs().id()) << ")' />" << endl;
+            } else {
+                str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
+            }
+        }
     } else {
-       str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
+        str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
     }
 
     return str.str();
@@ -160,7 +160,7 @@ std::string helixXML( const Capabilities &caps )
     str << endl;
     for ( ; it != caps.end(); ++it)
     {
-       str << TAB2 << helixXML((*it));
+        str << TAB2 << helixXML((*it));
     }
     str << TAB;
     return str.str();
@@ -174,7 +174,7 @@ std::string helixXML( const CapabilitySet &caps )
     str << endl;
     for ( ; it != caps.end(); ++it)
     {
-       str << TAB2 << helixXML((*it));
+        str << TAB2 << helixXML((*it));
     }
     str << TAB;
     return str.str();
@@ -253,7 +253,7 @@ HelixResolvable::HelixResolvable(const std::string & path)
 {
     file = new ofgzstream(path.c_str());
     if (!file) {
-       ZYPP_THROW (Exception( "Can't open " + path ) );
+        ZYPP_THROW (Exception( "Can't open " + path ) );
     }
 
     *file << "<channel><subchannel>" << endl;
@@ -281,19 +281,19 @@ class  HelixControl {
 
   public:
     HelixControl (const std::string & controlPath,
-                 const RepositoryTable & sourceTable,
-                 const Arch & systemArchitecture,
-                 const target::Modalias::ModaliasList & modaliasList,
-                 const std::set<std::string> & multiversionSpec,
-                 const std::string & systemPath);
+                  const RepositoryTable & sourceTable,
+                  const Arch & systemArchitecture,
+                  const target::Modalias::ModaliasList & modaliasList,
+                  const std::set<std::string> & multiversionSpec,
+                  const std::string & systemPath);
     ~HelixControl ();
 
     void closeSetup()
     {
       if ( _inSetup )
       {
-       *file << "</setup>" << endl << "<trial>" << endl;
-       _inSetup = false;
+        *file << "</setup>" << endl << "<trial>" << endl;
+        _inSetup = false;
       }
     }
 
@@ -303,7 +303,7 @@ class  HelixControl {
     void addTagIf( const std::string & tag_r, bool yesno_r = true )
     {
       if ( yesno_r )
-       writeTag() << "<" << tag_r << "/>" << endl;
+        writeTag() << "<" << tag_r << "/>" << endl;
     }
 
     void installResolvable( const PoolItem & pi_r );
@@ -317,45 +317,45 @@ class  HelixControl {
 };
 
 HelixControl::HelixControl(const std::string & controlPath,
-                          const RepositoryTable & repoTable,
-                          const Arch & systemArchitecture,
-                          const target::Modalias::ModaliasList & modaliasList,
-                          const std::set<std::string> & multiversionSpec,
-                          const std::string & systemPath)
+                           const RepositoryTable & repoTable,
+                           const Arch & systemArchitecture,
+                           const target::Modalias::ModaliasList & modaliasList,
+                           const std::set<std::string> & multiversionSpec,
+                           const std::string & systemPath)
     :dumpFile (controlPath)
     ,_inSetup( true )
 {
     file = new std::ofstream(controlPath.c_str());
     if (!file) {
-       ZYPP_THROW (Exception( "Can't open " + controlPath ) );
+        ZYPP_THROW (Exception( "Can't open " + controlPath ) );
     }
 
     *file << "<?xml version=\"1.0\"?>" << endl
-         << "<!-- libzypp resolver testcase -->" << endl
-         << "<test>" << endl
-         << "<setup arch=\"" << systemArchitecture << "\">" << endl
-         << TAB << "<system file=\"" << systemPath << "\"/>" << endl << endl;
+          << "<!-- libzypp resolver testcase -->" << endl
+          << "<test>" << endl
+          << "<setup arch=\"" << systemArchitecture << "\">" << endl
+          << TAB << "<system file=\"" << systemPath << "\"/>" << endl << endl;
     for ( RepositoryTable::const_iterator it = repoTable.begin();
-         it != repoTable.end(); ++it ) {
-       RepoInfo repo = it->first.info();
-       *file << TAB << "<!-- " << endl
-             << TAB << "- alias       : " << repo.alias() << endl;
-       for ( RepoInfo::urls_const_iterator itUrl = repo.baseUrlsBegin();
-             itUrl != repo.baseUrlsEnd();
-             ++itUrl )
-       {
-           *file << TAB << "- url         : " << *itUrl << endl;
-       }
-       *file << TAB << "- path        : " << repo.path() << endl;
-       *file << TAB << "- type        : " << repo.type() << endl;
-       *file << TAB << "- generated   : " << (it->first.generatedTimestamp()).form( "%Y-%m-%d %H:%M:%S" ) << endl;
-       *file << TAB << "- outdated    : " << (it->first.suggestedExpirationTimestamp()).form( "%Y-%m-%d %H:%M:%S" ) << endl;
-       *file << TAB << " -->" << endl;
-
-       *file << TAB << "<channel file=\"" << str::numstring((long)it->first.id())
-             << "-package.xml.gz\" name=\"" << repo.alias() << "\""
-             << " priority=\"" << repo.priority()
-             << "\" />" << endl << endl;
+          it != repoTable.end(); ++it ) {
+        RepoInfo repo = it->first.info();
+        *file << TAB << "<!-- " << endl
+              << TAB << "- alias       : " << repo.alias() << endl;
+        for ( RepoInfo::urls_const_iterator itUrl = repo.baseUrlsBegin();
+              itUrl != repo.baseUrlsEnd();
+              ++itUrl )
+        {
+            *file << TAB << "- url         : " << *itUrl << endl;
+        }
+        *file << TAB << "- path        : " << repo.path() << endl;
+        *file << TAB << "- type        : " << repo.type() << endl;
+        *file << TAB << "- generated   : " << (it->first.generatedTimestamp()).form( "%Y-%m-%d %H:%M:%S" ) << endl;
+        *file << TAB << "- outdated    : " << (it->first.suggestedExpirationTimestamp()).form( "%Y-%m-%d %H:%M:%S" ) << endl;
+        *file << TAB << " -->" << endl;
+
+        *file << TAB << "<channel file=\"" << str::numstring((long)it->first.id())
+              << "-package.xml.gz\" name=\"" << repo.alias() << "\""
+              << " priority=\"" << repo.priority()
+              << "\" />" << endl << endl;
     }
 
     // HACK: directly access sat::pool
@@ -385,13 +385,13 @@ HelixControl::HelixControl(const std::string & controlPath,
 
 
     for_( it, modaliasList.begin(), modaliasList.end() ) {
-       *file << TAB << "<modalias name=\"" <<  xml_escape(*it)
-             << "\" />" << endl;
+        *file << TAB << "<modalias name=\"" <<  xml_escape(*it)
+              << "\" />" << endl;
     }
 
     for_( it, multiversionSpec.begin(), multiversionSpec.end() ) {
-       *file << TAB << "<multiversion name=\"" <<  *it
-             << "\" />" << endl;
+        *file << TAB << "<multiversion name=\"" <<  *it
+              << "\" />" << endl;
     }
 
     // setup continued outside....
@@ -401,7 +401,7 @@ HelixControl::~HelixControl()
 {
     closeSetup();      // in case it is still open
     *file << "</trial>" << endl
-         << "</test>" << endl;
+          << "</test>" << endl;
     delete(file);
 }
 
@@ -409,53 +409,53 @@ void HelixControl::installResolvable( const PoolItem & pi_r )
 {
     *file << "<install channel=\"" << pi_r.repoInfo().alias() << "\""
           << " kind=\"" << pi_r.kind() << "\""
-         << " name=\"" << pi_r.name() << "\""
-         << " arch=\"" << pi_r.arch() << "\""
-         << " version=\"" << pi_r.edition().version() << "\""
-         << " release=\"" << pi_r.edition().release() << "\""
-         << " status=\"" << pi_r.status() << "\""
-         << "/>" << endl;
+          << " name=\"" << pi_r.name() << "\""
+          << " arch=\"" << pi_r.arch() << "\""
+          << " version=\"" << pi_r.edition().version() << "\""
+          << " release=\"" << pi_r.edition().release() << "\""
+          << " status=\"" << pi_r.status() << "\""
+          << "/>" << endl;
 }
 
 void HelixControl::lockResolvable( const PoolItem & pi_r )
 {
     *file << "<lock channel=\"" << pi_r.repoInfo().alias() << "\""
           << " kind=\"" << pi_r.kind() << "\""
-         << " name=\"" << pi_r.name() << "\""
-         << " arch=\"" << pi_r.arch() << "\""
-         << " version=\"" << pi_r.edition().version() << "\""
-         << " release=\"" << pi_r.edition().release() << "\""
-         << " status=\"" << pi_r.status() << "\""
-         << "/>" << endl;
+          << " name=\"" << pi_r.name() << "\""
+          << " arch=\"" << pi_r.arch() << "\""
+          << " version=\"" << pi_r.edition().version() << "\""
+          << " release=\"" << pi_r.edition().release() << "\""
+          << " status=\"" << pi_r.status() << "\""
+          << "/>" << endl;
 }
 
 void HelixControl::keepResolvable( const PoolItem & pi_r )
 {
     *file << "<keep channel=\"" << pi_r.repoInfo().alias() << "\""
           << " kind=\"" << pi_r.kind() << "\""
-         << " name=\"" << pi_r.name() << "\""
-         << " arch=\"" << pi_r.arch() << "\""
-         << " version=\"" << pi_r.edition().version() << "\""
-         << " release=\"" << pi_r.edition().release() << "\""
-         << " status=\"" << pi_r.status() << "\""
-         << "/>" << endl;
+          << " name=\"" << pi_r.name() << "\""
+          << " arch=\"" << pi_r.arch() << "\""
+          << " version=\"" << pi_r.edition().version() << "\""
+          << " release=\"" << pi_r.edition().release() << "\""
+          << " status=\"" << pi_r.status() << "\""
+          << "/>" << endl;
 }
 
 void HelixControl::deleteResolvable( const PoolItem & pi_r )
 {
     *file << "<uninstall  kind=\"" << pi_r.kind() << "\""
-         << " name=\"" << pi_r.name() << "\""
-         << " status=\"" << pi_r.status() << "\""
-         << "/>" << endl;
+          << " name=\"" << pi_r.name() << "\""
+          << " status=\"" << pi_r.status() << "\""
+          << "/>" << endl;
 }
 
 void HelixControl::addDependencies (const CapabilitySet & capRequire, const CapabilitySet & capConflict)
 {
     for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
-       *file << "<addRequire " <<  " name=\"" << iter->asString() << "\"" << "/>" << endl;
+        *file << "<addRequire " <<  " name=\"" << iter->asString() << "\"" << "/>" << endl;
     }
     for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
-       *file << "<addConflict " << " name=\"" << iter->asString() << "\"" << "/>" << endl;
+        *file << "<addConflict " << " name=\"" << iter->asString() << "\"" << "/>" << endl;
     }
 }
 
@@ -485,26 +485,26 @@ bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool runSolver
     PathInfo path (dumpPath);
 
     if ( !path.isExist() ) {
-       if (zypp::filesystem::assert_dir (dumpPath)!=0) {
-           ERR << "Cannot create directory " << dumpPath << endl;
-           return false;
-       }
+        if (zypp::filesystem::assert_dir (dumpPath)!=0) {
+            ERR << "Cannot create directory " << dumpPath << endl;
+            return false;
+        }
     } else {
-       if (!path.isDir()) {
-           ERR << dumpPath << " is not a directory." << endl;
-           return false;
-       }
-       // remove old stuff if pool will be dump
-       if (dumpPool)
-           zypp::filesystem::clean_dir (dumpPath);
+        if (!path.isDir()) {
+            ERR << dumpPath << " is not a directory." << endl;
+            return false;
+        }
+        // remove old stuff if pool will be dump
+        if (dumpPool)
+            zypp::filesystem::clean_dir (dumpPath);
     }
 
     if (runSolver) {
         zypp::base::LogControl::TmpLineWriter tempRedirect;
-       zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" );
-       zypp::base::LogControl::TmpExcessive excessive;
+        zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" );
+        zypp::base::LogControl::TmpExcessive excessive;
 
-       resolver.resolvePool();
+        resolver.resolvePool();
     }
 
     ResPool pool       = resolver.pool();
@@ -516,51 +516,51 @@ bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool runSolver
     HelixResolvable_Ptr        system = NULL;
 
     if (dumpPool)
-       system = new HelixResolvable(dumpPath + "/solver-system.xml.gz");
+        system = new HelixResolvable(dumpPath + "/solver-system.xml.gz");
 
     for ( const PoolItem & pi : pool )
     {
-       if ( system && pi.status().isInstalled() ) {
-           // system channel
-           system->addResolvable( pi );
-       } else {
-           // repo channels
-           Repository repo  = pi.repository();
-           if (dumpPool) {
-               if (repoTable.find (repo) == repoTable.end()) {
-                   repoTable[repo] = new HelixResolvable(dumpPath + "/"
-                                                         + str::numstring((long)repo.id())
-                                                         + "-package.xml.gz");
-               }
-               repoTable[repo]->addResolvable( pi );
-           }
-       }
-
-       if ( pi.status().isToBeInstalled()
-            && !(pi.status().isBySolver())) {
-           items_to_install.push_back( pi );
-       }
-       if ( pi.status().isKept()
-            && !(pi.status().isBySolver())) {
-           items_keep.push_back( pi );
-       }
-       if ( pi.status().isToBeUninstalled()
-            && !(pi.status().isBySolver())) {
-           items_to_remove.push_back( pi );
-       }
-       if ( pi.status().isLocked()
-            && !(pi.status().isBySolver())) {
-           items_locked.push_back( pi );
-       }
+        if ( system && pi.status().isInstalled() ) {
+            // system channel
+            system->addResolvable( pi );
+        } else {
+            // repo channels
+            Repository repo  = pi.repository();
+            if (dumpPool) {
+                if (repoTable.find (repo) == repoTable.end()) {
+                    repoTable[repo] = new HelixResolvable(dumpPath + "/"
+                                                          + str::numstring((long)repo.id())
+                                                          + "-package.xml.gz");
+                }
+                repoTable[repo]->addResolvable( pi );
+            }
+        }
+
+        if ( pi.status().isToBeInstalled()
+             && !(pi.status().isBySolver())) {
+            items_to_install.push_back( pi );
+        }
+        if ( pi.status().isKept()
+             && !(pi.status().isBySolver())) {
+            items_keep.push_back( pi );
+        }
+        if ( pi.status().isToBeUninstalled()
+             && !(pi.status().isBySolver())) {
+            items_to_remove.push_back( pi );
+        }
+        if ( pi.status().isLocked()
+             && !(pi.status().isBySolver())) {
+            items_locked.push_back( pi );
+        }
     }
 
     // writing control file "*-test.xml"
     HelixControl control (dumpPath + "/solver-test.xml",
-                         repoTable,
-                         ZConfig::instance().systemArchitecture(),
-                         target::Modalias::instance().modaliasList(),
-                         ZConfig::instance().multiversionSpec(),
-                         "solver-system.xml.gz");
+                          repoTable,
+                          ZConfig::instance().systemArchitecture(),
+                          target::Modalias::instance().modaliasList(),
+                          ZConfig::instance().multiversionSpec(),
+                          "solver-system.xml.gz");
 
     // In <setup>: resolver flags,...
     control.writeTag() << "<focus value=\"" << resolver.focus() << "\"/>" << endl;
@@ -598,7 +598,7 @@ bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool runSolver
 
     control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
     control.addDependencies (SystemCheck::instance().requiredSystemCap(),
-                            SystemCheck::instance().conflictSystemCap());
+                             SystemCheck::instance().conflictSystemCap());
     control.addUpgradeRepos( resolver.upgradeRepos() );
 
     control.addTagIf( "distupgrade",   resolver.isUpgradeMode() );
index 016c2e4..993d8af 100644 (file)
@@ -25,7 +25,7 @@
 #include <zypp/base/PtrTypes.h>
 
 /////////////////////////////////////////////////////////////////////////
-namespace zypp 
+namespace zypp
 {
   ///////////////////////////////////////////////////////////////////////
   namespace solver
index e4a36a2..256f189 100644 (file)
@@ -39,19 +39,19 @@ namespace zypp
       ///////////////////////////////////////////////////////////////////
       struct QueryInstalledEditionHelper
       {
-       bool operator()( const std::string & name_r, const Edition & ed_r, const Arch & arch_r ) const
-       {
-         rpm::librpmDb::db_const_iterator it;
-         for ( it.findByName( name_r ); *it; ++it )
-         {
-           if ( arch_r == it->tag_arch()
-             && ( ed_r == Edition::noedition || ed_r == it->tag_edition() ) )
-           {
-             return true;
-           }
-         }
-         return false;
-       }
+        bool operator()( const std::string & name_r, const Edition & ed_r, const Arch & arch_r ) const
+        {
+          rpm::librpmDb::db_const_iterator it;
+          for ( it.findByName( name_r ); *it; ++it )
+          {
+            if ( arch_r == it->tag_arch()
+              && ( ed_r == Edition::noedition || ed_r == it->tag_edition() ) )
+            {
+              return true;
+            }
+          }
+          return false;
+        }
       };
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -85,19 +85,19 @@ namespace zypp
       ManagedFile ret;
       if ( fromCache_r )
       {
-       repo::PackageProvider pkgProvider( _impl->_access, pi_r, _impl->_packageProviderPolicy );
-       ret = pkgProvider.providePackageFromCache();
+        repo::PackageProvider pkgProvider( _impl->_access, pi_r, _impl->_packageProviderPolicy );
+        ret = pkgProvider.providePackageFromCache();
       }
       else if ( pi_r.isKind<Package>() )       // may make use of deltas
       {
-       repo::DeltaCandidates deltas( _impl->_repos, pi_r.name() );
-       repo::PackageProvider pkgProvider( _impl->_access, pi_r, deltas, _impl->_packageProviderPolicy );
-       return pkgProvider.providePackage();
+        repo::DeltaCandidates deltas( _impl->_repos, pi_r.name() );
+        repo::PackageProvider pkgProvider( _impl->_access, pi_r, deltas, _impl->_packageProviderPolicy );
+        return pkgProvider.providePackage();
       }
       else     // SrcPackage or throws
       {
-       repo::PackageProvider pkgProvider( _impl->_access, pi_r, _impl->_packageProviderPolicy );
-       return pkgProvider.providePackage();
+        repo::PackageProvider pkgProvider( _impl->_access, pi_r, _impl->_packageProviderPolicy );
+        return pkgProvider.providePackage();
       }
       return ret;
     }
index 32d320a..366bc0b 100644 (file)
@@ -102,33 +102,33 @@ namespace zypp
       // _lastInteractive media. (just the PoolItem data)
       for_( it, commitList().begin(), commitList().end() )
       {
-       PoolItem pi( *it );
-       if ( ! sawCitem )
-       {
-         if ( pi == citem_r )
-           sawCitem = true;
-         continue;
-       }
-       if ( IMediaKey( pi ) == _lastInteractive
-         && pi.status().isToBeInstalled()
-         && isKind<Package>(pi.resolvable()) )
-       {
-         if ( ! pi->asKind<Package>()->isCached() )
-         {
-           ManagedFile fromSource( sourceProvidePackage( pi ) );
-           if ( fromSource->empty() )
-           {
-             ERR << "Copy to cache failed on " << fromSource << endl;
-             ZYPP_THROW( Exception("Copy to cache failed.") );
-           }
-           fromSource.resetDispose(); // keep the package file in the cache
-           ++addToCache;
-         }
-       }
+        PoolItem pi( *it );
+        if ( ! sawCitem )
+        {
+          if ( pi == citem_r )
+            sawCitem = true;
+          continue;
+        }
+        if ( IMediaKey( pi ) == _lastInteractive
+          && pi.status().isToBeInstalled()
+          && isKind<Package>(pi.resolvable()) )
+        {
+          if ( ! pi->asKind<Package>()->isCached() )
+          {
+            ManagedFile fromSource( sourceProvidePackage( pi ) );
+            if ( fromSource->empty() )
+            {
+              ERR << "Copy to cache failed on " << fromSource << endl;
+              ZYPP_THROW( Exception("Copy to cache failed.") );
+            }
+            fromSource.resetDispose(); // keep the package file in the cache
+            ++addToCache;
+          }
+        }
       }
 
       if ( addToCache )
-       MIL << "Cached " << _lastInteractive << ": " << addToCache << " items." << endl;
+        MIL << "Cached " << _lastInteractive << ": " << addToCache << " items." << endl;
     }
 
     ///////////////////////////////////////////////////////////////////
@@ -141,10 +141,10 @@ namespace zypp
       ManagedFile ret;
       if ( preloaded() )
       {
-       // Check whether it's cached.
-       ManagedFile ret( sourceProvideCachedPackage( citem_r ) );
-       if ( ! ret->empty() )
-         return ret;
+        // Check whether it's cached.
+        ManagedFile ret( sourceProvideCachedPackage( citem_r ) );
+        if ( ! ret->empty() )
+          return ret;
       }
       // else: we head for sourceProvidePackage(), even if the package
       // was cached. The actual difference is that sourceProvidePackage
@@ -156,21 +156,21 @@ namespace zypp
       // switching back and forth...
       if ( onInteractiveMedia( citem_r ) )
       {
-       ret = sourceProvideCachedPackage( citem_r );
-       if ( ! ret->empty() )
-         return ret;
-
-       IMediaKey current( citem_r );
-       if ( current != _lastInteractive )
-       {
-         if ( _lastInteractive != IMediaKey() )
-         {
-           cacheLastInteractive( citem_r );
-         }
-
-         DBG << "Interactive change [" << ++_dbgChanges << "] from " << _lastInteractive << " to " << current << endl;
-         _lastInteractive = current;
-       }
+        ret = sourceProvideCachedPackage( citem_r );
+        if ( ! ret->empty() )
+          return ret;
+
+        IMediaKey current( citem_r );
+        if ( current != _lastInteractive )
+        {
+          if ( _lastInteractive != IMediaKey() )
+          {
+            cacheLastInteractive( citem_r );
+          }
+
+          DBG << "Interactive change [" << ++_dbgChanges << "] from " << _lastInteractive << " to " << current << endl;
+          _lastInteractive = current;
+        }
       }
 
       // Provide and return the file from media.
index 8566991..0169ea2 100644 (file)
@@ -73,11 +73,11 @@ namespace zypp
         void setData( const Data & data_r )
         {
           if ( !_dataPtr )
-         {
-           if ( data_r.empty() )
-             return;   // bsc#1096803: Prevent against empty commit without Target having been been loaded (!_dataPtr )
+          {
+            if ( data_r.empty() )
+              return;  // bsc#1096803: Prevent against empty commit without Target having been been loaded (!_dataPtr )
             _dataPtr.reset( new Data );
-         }
+          }
 
           if ( differs( *_dataPtr, data_r ) )
           {
index 778ad32..0f2e390 100644 (file)
@@ -45,81 +45,81 @@ namespace zypp
       friend std::ostream & operator<<( std::ostream & str, const Impl & obj );
       friend std::ostream & dumpOn( std::ostream & str, const Impl & obj );
       public:
-       Impl( const Pathname & root_r )
-       : _root( root_r )
-       {}
-
-       ~Impl()
-       { if ( !_scripts.empty() ) discardScripts(); }
-
-       /** Extract and remember a packages %posttrans script for later execution. */
-       bool collectScriptFromPackage( ManagedFile rpmPackage_r )
-       {
-         rpm::RpmHeader::constPtr pkg( rpm::RpmHeader::readPackage( rpmPackage_r, rpm::RpmHeader::NOVERIFY ) );
-         if ( ! pkg )
-         {
-           WAR << "Unexpectedly this is no package: " << rpmPackage_r << endl;
-           return false;
-         }
-
-         std::string prog( pkg->tag_posttransprog() );
-         if ( prog.empty() || prog == "<lua>" )        // by now leave lua to rpm
-           return false;
-
-         filesystem::TmpFile script( tmpDir(), rpmPackage_r->basename() );
-         filesystem::addmod( script.path(), 0500 );
-         script.autoCleanup( false );  // no autodelete; within a tmpdir
-         {
-           std::ofstream out( script.path().c_str() );
-           out << "#! " << pkg->tag_posttransprog() << endl
-               << pkg->tag_posttrans() << endl;
-         }
+        Impl( const Pathname & root_r )
+        : _root( root_r )
+        {}
+
+        ~Impl()
+        { if ( !_scripts.empty() ) discardScripts(); }
+
+        /** Extract and remember a packages %posttrans script for later execution. */
+        bool collectScriptFromPackage( ManagedFile rpmPackage_r )
+        {
+          rpm::RpmHeader::constPtr pkg( rpm::RpmHeader::readPackage( rpmPackage_r, rpm::RpmHeader::NOVERIFY ) );
+          if ( ! pkg )
+          {
+            WAR << "Unexpectedly this is no package: " << rpmPackage_r << endl;
+            return false;
+          }
+
+          std::string prog( pkg->tag_posttransprog() );
+          if ( prog.empty() || prog == "<lua>" )       // by now leave lua to rpm
+            return false;
+
+          filesystem::TmpFile script( tmpDir(), rpmPackage_r->basename() );
+          filesystem::addmod( script.path(), 0500 );
+          script.autoCleanup( false ); // no autodelete; within a tmpdir
+          {
+            std::ofstream out( script.path().c_str() );
+            out << "#! " << pkg->tag_posttransprog() << endl
+                << pkg->tag_posttrans() << endl;
+          }
           _scripts.push_back( std::make_pair( script.path().basename(), pkg->tag_name() ) );
           MIL << "COLLECT posttrans: '" << PathInfo( script.path() ) << "' for package: '" << pkg->tag_name() << "'" << endl;
-         //DBG << "PROG:  " << pkg->tag_posttransprog() << endl;
-         //DBG << "SCRPT: " << pkg->tag_posttrans() << endl;
-         return true;
-       }
-
-       /** Execute the remembered scripts. */
-       bool executeScripts()
-       {
-         if ( _scripts.empty() )
-           return true;
-
-         HistoryLog historylog;
-
-         Pathname noRootScriptDir( ZConfig::instance().update_scriptsPath() / tmpDir().basename() );
-
-         ProgressData scriptProgress( static_cast<ProgressData::value_type>(_scripts.size()) );
-         callback::SendReport<ProgressReport> report;
-         scriptProgress.sendTo( ProgressReportAdaptor( ProgressData::ReceiverFnc(), report ) );
-
-         bool firstScript = true;
-         while ( ! _scripts.empty() )
-         {
-           const auto &scriptPair = _scripts.front();
-           const std::string & script = scriptPair.first;
-           const std::string & pkgident( script.substr( 0, script.size()-6 ) );        // strip tmp file suffix
-
-           scriptProgress.name( str::Format(_("Executing %%posttrans script '%1%'")) % pkgident );
-
-           bool canContinue = true;
-           if (firstScript)  {
-             firstScript = false;
-             canContinue = scriptProgress.toMin();
-           } else {
-             canContinue = scriptProgress.incr();
-           }
-
-           if (!canContinue) {
-             str::Str msg;
-             msg << "Execution of %posttrans scripts cancelled";
-             WAR << msg << endl;
-             historylog.comment( msg, true /*timestamp*/);
-             JobReport::warning( msg );
-             return false;
-           }
+          //DBG << "PROG:  " << pkg->tag_posttransprog() << endl;
+          //DBG << "SCRPT: " << pkg->tag_posttrans() << endl;
+          return true;
+        }
+
+        /** Execute the remembered scripts. */
+        bool executeScripts()
+        {
+          if ( _scripts.empty() )
+            return true;
+
+          HistoryLog historylog;
+
+          Pathname noRootScriptDir( ZConfig::instance().update_scriptsPath() / tmpDir().basename() );
+
+          ProgressData scriptProgress( static_cast<ProgressData::value_type>(_scripts.size()) );
+          callback::SendReport<ProgressReport> report;
+          scriptProgress.sendTo( ProgressReportAdaptor( ProgressData::ReceiverFnc(), report ) );
+
+          bool firstScript = true;
+          while ( ! _scripts.empty() )
+          {
+            const auto &scriptPair = _scripts.front();
+            const std::string & script = scriptPair.first;
+            const std::string & pkgident( script.substr( 0, script.size()-6 ) );       // strip tmp file suffix
+
+            scriptProgress.name( str::Format(_("Executing %%posttrans script '%1%'")) % pkgident );
+
+            bool canContinue = true;
+            if (firstScript)  {
+              firstScript = false;
+              canContinue = scriptProgress.toMin();
+            } else {
+              canContinue = scriptProgress.incr();
+            }
+
+            if (!canContinue) {
+              str::Str msg;
+              msg << "Execution of %posttrans scripts cancelled";
+              WAR << msg << endl;
+              historylog.comment( msg, true /*timestamp*/);
+              JobReport::warning( msg );
+              return false;
+            }
 
             int npkgs = 0;
             rpm::librpmDb::db_const_iterator it;
@@ -127,92 +127,92 @@ namespace zypp
               npkgs++;
 
             MIL << "EXECUTE posttrans: " << script << " with argument: " << npkgs << endl;
-           ExternalProgram::Arguments cmd {
-             "/bin/sh",
-             (noRootScriptDir/script).asString(),
-             str::numstring( npkgs )
-           };
+            ExternalProgram::Arguments cmd {
+              "/bin/sh",
+              (noRootScriptDir/script).asString(),
+              str::numstring( npkgs )
+            };
             ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout, false, -1, true, _root );
 
-           str::Str collect;
-           for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() )
-           {
-             DBG << line;
-             collect << "    " << line;
-           }
-
-           //script was executed, remove it from the list
-           _scripts.pop_front();
-
-           int ret = prog.close();
-           const std::string & scriptmsg( collect );
-
-           if ( ret != 0 || ! scriptmsg.empty() )
-           {
-             if ( ! scriptmsg.empty() )
-             {
-               str::Str msg;
-               msg << "Output of " << pkgident << " %posttrans script:\n" << scriptmsg;
-               historylog.comment( msg, true /*timestamp*/);
-               JobReport::UserData userData( "cmdout", "%posttrans" );
-               JobReport::info( msg, userData );
-             }
-
-             if ( ret != 0 )
-             {
-               str::Str msg;
-               msg << pkgident << " %posttrans script failed (returned " << ret << ")";
-               WAR << msg << endl;
-               historylog.comment( msg, true /*timestamp*/);
-               JobReport::warning( msg );
-             }
-           }
-         }
-
-         //show a final message
-         scriptProgress.name( _("Executing %posttrans scripts") );
-         scriptProgress.toMax();
-         _scripts.clear();
-         return true;
-       }
-
-       /** Discard all remembered scrips. */
-       void discardScripts()
-       {
-         if ( _scripts.empty() )
-           return;
-
-         HistoryLog historylog;
-
-         str::Str msg;
-         msg << "%posttrans scripts skipped while aborting:\n";
-         for ( const auto & script : _scripts )
-         {
-           const std::string & pkgident( script.first.substr( 0, script.first.size()-6 ) );    // strip tmp file suffix
-           WAR << "UNEXECUTED posttrans: " << script.first << endl;
-           msg << "    " << pkgident << "\n";
-         }
-
-         historylog.comment( msg, true /*timestamp*/);
-         JobReport::warning( msg );
-
-         _scripts.clear();
-       }
+            str::Str collect;
+            for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() )
+            {
+              DBG << line;
+              collect << "    " << line;
+            }
+
+            //script was executed, remove it from the list
+            _scripts.pop_front();
+
+            int ret = prog.close();
+            const std::string & scriptmsg( collect );
+
+            if ( ret != 0 || ! scriptmsg.empty() )
+            {
+              if ( ! scriptmsg.empty() )
+              {
+                str::Str msg;
+                msg << "Output of " << pkgident << " %posttrans script:\n" << scriptmsg;
+                historylog.comment( msg, true /*timestamp*/);
+                JobReport::UserData userData( "cmdout", "%posttrans" );
+                JobReport::info( msg, userData );
+              }
+
+              if ( ret != 0 )
+              {
+                str::Str msg;
+                msg << pkgident << " %posttrans script failed (returned " << ret << ")";
+                WAR << msg << endl;
+                historylog.comment( msg, true /*timestamp*/);
+                JobReport::warning( msg );
+              }
+            }
+          }
+
+          //show a final message
+          scriptProgress.name( _("Executing %posttrans scripts") );
+          scriptProgress.toMax();
+          _scripts.clear();
+          return true;
+        }
+
+        /** Discard all remembered scrips. */
+        void discardScripts()
+        {
+          if ( _scripts.empty() )
+            return;
+
+          HistoryLog historylog;
+
+          str::Str msg;
+          msg << "%posttrans scripts skipped while aborting:\n";
+          for ( const auto & script : _scripts )
+          {
+            const std::string & pkgident( script.first.substr( 0, script.first.size()-6 ) );   // strip tmp file suffix
+            WAR << "UNEXECUTED posttrans: " << script.first << endl;
+            msg << "    " << pkgident << "\n";
+          }
+
+          historylog.comment( msg, true /*timestamp*/);
+          JobReport::warning( msg );
+
+          _scripts.clear();
+        }
 
 
       private:
-       /** Lazy create tmpdir on demand. */
-       Pathname tmpDir()
-       {
-         if ( !_ptrTmpdir ) _ptrTmpdir.reset( new filesystem::TmpDir( _root / ZConfig::instance().update_scriptsPath(), "posttrans" ) );
-         DBG << _ptrTmpdir->path() << endl;
-         return _ptrTmpdir->path();
-       }
+        /** Lazy create tmpdir on demand. */
+        Pathname tmpDir()
+        {
+          if ( !_ptrTmpdir ) _ptrTmpdir.reset( new filesystem::TmpDir( _root / ZConfig::instance().update_scriptsPath(), "posttrans" ) );
+          DBG << _ptrTmpdir->path() << endl;
+          return _ptrTmpdir->path();
+        }
 
       private:
-       Pathname _root;
+        Pathname _root;
         std::list< std::pair< std::string, std::string > > _scripts;
-       boost::scoped_ptr<filesystem::TmpDir> _ptrTmpdir;
+        boost::scoped_ptr<filesystem::TmpDir> _ptrTmpdir;
     };
 
     /** \relates RpmPostTransCollector::Impl Stream output */
index eebddab..0d1fa65 100644 (file)
@@ -41,18 +41,18 @@ namespace zypp
         ~RpmPostTransCollector();
 
       public:
-       /** Extract and remember a packages %posttrans script for later execution.
-        * \return whether a script was collected.
-        */
-       bool collectScriptFromPackage( ManagedFile rpmPackage_r );
+        /** Extract and remember a packages %posttrans script for later execution.
+         * \return whether a script was collected.
+         */
+        bool collectScriptFromPackage( ManagedFile rpmPackage_r );
 
-       /** Execute the remembered scripts.
-        * \return false if execution was aborted by a user callback
-        */
-       bool executeScripts();
+        /** Execute the remembered scripts.
+         * \return false if execution was aborted by a user callback
+         */
+        bool executeScripts();
 
-       /** Discard all remembered scrips. */
-       void discardScripts();
+        /** Discard all remembered scrips. */
+        void discardScripts();
 
       public:
         class Impl;              ///< Implementation class.
index 016e76b..26b1f9f 100644 (file)
@@ -60,12 +60,12 @@ namespace zypp
       outs << "# " << file_r.basename() << " generated " << Date::now() << endl;
       if ( true )
       {
-       std::set<IdString> sorted( data_r.begin(), data_r.end() );
-       dumpRange( outs, sorted.begin(), sorted.end(), "#", "\n", "\n", "\n", "#\n" );
+        std::set<IdString> sorted( data_r.begin(), data_r.end() );
+        dumpRange( outs, sorted.begin(), sorted.end(), "#", "\n", "\n", "\n", "#\n" );
       }
       else
       {
-       dumpRange( outs, data_r.begin(), data_r.end(), "#", "\n", "\n", "\n", "#\n" );
+        dumpRange( outs, data_r.begin(), data_r.end(), "#", "\n", "\n", "\n", "#\n" );
       }
       outs.close();
 
index c110331..2a853ec 100644 (file)
@@ -22,72 +22,72 @@ namespace zypp
   namespace target
   { /////////////////////////////////////////////////////////////////
 
-       RpmInstallPackageReceiver::RpmInstallPackageReceiver (Resolvable::constPtr res)
-           : callback::ReceiveReport<rpm::RpmInstallReport> ()
-           , _resolvable (res)
-           , _level( target::rpm::InstallResolvableReport::RPM )
-           , _abort (false)
-       {
-       }
-
-       RpmInstallPackageReceiver::~RpmInstallPackageReceiver ()
-       {
-       }
-
-       void RpmInstallPackageReceiver::reportbegin()
-       {
-       }
-
-       void RpmInstallPackageReceiver::reportend()
-       {
-       }
-
-       void RpmInstallPackageReceiver::report( const UserData & userData_r )
-       {
-         if ( ! userData_r.haskey( "solvable" ) )
-           userData_r.set( "solvable", _resolvable->satSolvable() );
-         _report->report( userData_r );
-       }
+        RpmInstallPackageReceiver::RpmInstallPackageReceiver (Resolvable::constPtr res)
+            : callback::ReceiveReport<rpm::RpmInstallReport> ()
+            , _resolvable (res)
+            , _level( target::rpm::InstallResolvableReport::RPM )
+            , _abort (false)
+        {
+        }
+
+        RpmInstallPackageReceiver::~RpmInstallPackageReceiver ()
+        {
+        }
+
+        void RpmInstallPackageReceiver::reportbegin()
+        {
+        }
+
+        void RpmInstallPackageReceiver::reportend()
+        {
+        }
+
+        void RpmInstallPackageReceiver::report( const UserData & userData_r )
+        {
+          if ( ! userData_r.haskey( "solvable" ) )
+            userData_r.set( "solvable", _resolvable->satSolvable() );
+          _report->report( userData_r );
+        }
 
         /** Start the operation */
         void RpmInstallPackageReceiver::start( const Pathname & name )
-       {
-           _report->start( _resolvable );
-           _abort = false;
-       }
+        {
+            _report->start( _resolvable );
+            _abort = false;
+        }
 
         /**
          * Inform about progress
          * Return true on abort
          */
         bool RpmInstallPackageReceiver::progress( unsigned percent )
-       {
-           _abort = ! _report->progress( percent, _resolvable );
-           return _abort;
-       }
-
-       rpm::RpmInstallReport::Action
-       RpmInstallPackageReceiver::problem( Exception & excpt_r )
-       {
-           rpm::InstallResolvableReport::Action user =
-               _report->problem( _resolvable
-                   , rpm::InstallResolvableReport::INVALID
-                   , excpt_r.asUserHistory()
-                   , _level
-               );
-
-           switch (user) {
-               case rpm::InstallResolvableReport::RETRY:
-                   return rpm::RpmInstallReport::RETRY;
-               case rpm::InstallResolvableReport::ABORT:
+        {
+            _abort = ! _report->progress( percent, _resolvable );
+            return _abort;
+        }
+
+        rpm::RpmInstallReport::Action
+        RpmInstallPackageReceiver::problem( Exception & excpt_r )
+        {
+            rpm::InstallResolvableReport::Action user =
+                _report->problem( _resolvable
+                    , rpm::InstallResolvableReport::INVALID
+                    , excpt_r.asUserHistory()
+                    , _level
+                );
+
+            switch (user) {
+                case rpm::InstallResolvableReport::RETRY:
+                    return rpm::RpmInstallReport::RETRY;
+                case rpm::InstallResolvableReport::ABORT:
                     _abort = true;
-                   return rpm::RpmInstallReport::ABORT;
-               case rpm::InstallResolvableReport::IGNORE:
-                   return rpm::RpmInstallReport::IGNORE;
-           }
+                    return rpm::RpmInstallReport::ABORT;
+                case rpm::InstallResolvableReport::IGNORE:
+                    return rpm::RpmInstallReport::IGNORE;
+            }
 
-           return rpm::RpmInstallReport::problem( excpt_r );
-       }
+            return rpm::RpmInstallReport::problem( excpt_r );
+        }
 
         void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
         {
@@ -96,90 +96,90 @@ namespace zypp
 
         /** Finish operation in case of success */
         void RpmInstallPackageReceiver::finish()
-       {
-           _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, _finishInfo, _level );
-       }
+        {
+            _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, _finishInfo, _level );
+        }
 
         /** Finish operation in case of success */
         void RpmInstallPackageReceiver::finish( Exception & excpt_r )
-       {
-           _report->finish( _resolvable, rpm::InstallResolvableReport::INVALID, std::string(), _level );
-       }
+        {
+            _report->finish( _resolvable, rpm::InstallResolvableReport::INVALID, std::string(), _level );
+        }
 
-       void RpmInstallPackageReceiver::tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r )
-       {
-           _level = level_r;
-       }
+        void RpmInstallPackageReceiver::tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r )
+        {
+            _level = level_r;
+        }
 
 
-       /////////////////////////////////////////////////////////////////
-       ///  RpmRemovePackageReceiver
-       /////////////////////////////////////////////////////////////////
+        /////////////////////////////////////////////////////////////////
+        ///  RpmRemovePackageReceiver
+        /////////////////////////////////////////////////////////////////
 
-       RpmRemovePackageReceiver::RpmRemovePackageReceiver (Resolvable::constPtr res)
-           : callback::ReceiveReport<rpm::RpmRemoveReport> ()
-           , _resolvable (res)
+        RpmRemovePackageReceiver::RpmRemovePackageReceiver (Resolvable::constPtr res)
+            : callback::ReceiveReport<rpm::RpmRemoveReport> ()
+            , _resolvable (res)
             , _abort(false)
-       {
-       }
+        {
+        }
 
-       RpmRemovePackageReceiver::~RpmRemovePackageReceiver ()
-       {
-       }
+        RpmRemovePackageReceiver::~RpmRemovePackageReceiver ()
+        {
+        }
 
-       void RpmRemovePackageReceiver::reportbegin()
-       {
-       }
+        void RpmRemovePackageReceiver::reportbegin()
+        {
+        }
 
-       void RpmRemovePackageReceiver::reportend()
-       {
-       }
+        void RpmRemovePackageReceiver::reportend()
+        {
+        }
 
         /** Start the operation */
-       void RpmRemovePackageReceiver::report( const UserData & userData_r )
-       {
-         if ( ! userData_r.haskey( "solvable" ) )
-           userData_r.set( "solvable", _resolvable->satSolvable() );
-         _report->report( userData_r );
-       }
+        void RpmRemovePackageReceiver::report( const UserData & userData_r )
+        {
+          if ( ! userData_r.haskey( "solvable" ) )
+            userData_r.set( "solvable", _resolvable->satSolvable() );
+          _report->report( userData_r );
+        }
 
         void RpmRemovePackageReceiver::start( const std::string & name )
-       {
-           _report->start( _resolvable );
+        {
+            _report->start( _resolvable );
             _abort = false;
-       }
+        }
 
         /**
          * Inform about progress
          * Return true on abort
          */
         bool RpmRemovePackageReceiver::progress( unsigned percent )
-       {
-           _abort = ! _report->progress( percent, _resolvable );
-           return _abort;
-       }
-
-       rpm::RpmRemoveReport::Action
-       RpmRemovePackageReceiver::problem( Exception & excpt_r )
-       {
-           rpm::RemoveResolvableReport::Action user =
-               _report->problem( _resolvable
-                   , rpm::RemoveResolvableReport::INVALID
-                   , excpt_r.asUserHistory()
-               );
-
-           switch (user) {
-               case rpm::RemoveResolvableReport::RETRY:
-                   return rpm::RpmRemoveReport::RETRY;
-               case rpm::RemoveResolvableReport::ABORT:
+        {
+            _abort = ! _report->progress( percent, _resolvable );
+            return _abort;
+        }
+
+        rpm::RpmRemoveReport::Action
+        RpmRemovePackageReceiver::problem( Exception & excpt_r )
+        {
+            rpm::RemoveResolvableReport::Action user =
+                _report->problem( _resolvable
+                    , rpm::RemoveResolvableReport::INVALID
+                    , excpt_r.asUserHistory()
+                );
+
+            switch (user) {
+                case rpm::RemoveResolvableReport::RETRY:
+                    return rpm::RpmRemoveReport::RETRY;
+                case rpm::RemoveResolvableReport::ABORT:
                     _abort = true;
-                   return rpm::RpmRemoveReport::ABORT;
-               case rpm::RemoveResolvableReport::IGNORE:
-                   return rpm::RpmRemoveReport::IGNORE;
-           }
+                    return rpm::RpmRemoveReport::ABORT;
+                case rpm::RemoveResolvableReport::IGNORE:
+                    return rpm::RpmRemoveReport::IGNORE;
+            }
 
-           return rpm::RpmRemoveReport::problem( excpt_r );
-       }
+            return rpm::RpmRemoveReport::problem( excpt_r );
+        }
 
         void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
         {
@@ -188,16 +188,16 @@ namespace zypp
 
         /** Finish operation in case of success */
         void RpmRemovePackageReceiver::finish()
-       {
+        {
             _report->progress( 100, _resolvable );
-           _report->finish( _resolvable, rpm::RemoveResolvableReport::NO_ERROR, _finishInfo );
-       }
+            _report->finish( _resolvable, rpm::RemoveResolvableReport::NO_ERROR, _finishInfo );
+        }
 
         /** Finish operation in case of success */
         void RpmRemovePackageReceiver::finish( Exception & excpt_r )
-       {
-           _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() );
-       }
+        {
+            _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() );
+        }
 
     /////////////////////////////////////////////////////////////////
   } // namespace target
index 18dcc89..40952f0 100644 (file)
@@ -23,32 +23,32 @@ namespace zypp
   { /////////////////////////////////////////////////////////////////
 
     class RpmInstallPackageReceiver
-       : public callback::ReceiveReport<rpm::RpmInstallReport>
+        : public callback::ReceiveReport<rpm::RpmInstallReport>
     {
-       callback::SendReport <rpm::InstallResolvableReport> _report;
-       Resolvable::constPtr _resolvable;
-       target::rpm::InstallResolvableReport::RpmLevel _level;
-       bool _abort;
+        callback::SendReport <rpm::InstallResolvableReport> _report;
+        Resolvable::constPtr _resolvable;
+        target::rpm::InstallResolvableReport::RpmLevel _level;
+        bool _abort;
         std::string _finishInfo;
 
       public:
 
-       RpmInstallPackageReceiver (Resolvable::constPtr res);
-       virtual ~RpmInstallPackageReceiver ();
+        RpmInstallPackageReceiver (Resolvable::constPtr res);
+        virtual ~RpmInstallPackageReceiver ();
 
-       virtual void reportbegin();
+        virtual void reportbegin();
 
-       virtual void reportend();
+        virtual void reportend();
 
-       /** Forwards generic reports. */
-       void report( const UserData & userData_r ) override;
+        /** Forwards generic reports. */
+        void report( const UserData & userData_r ) override;
 
         /** Start the operation */
         virtual void start( const Pathname & name );
 
-       void tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r );
+        void tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r );
 
-       bool aborted() const { return _abort; }
+        bool aborted() const { return _abort; }
 
         /**
          * Inform about progress
@@ -56,8 +56,8 @@ namespace zypp
          */
         virtual bool progress( unsigned percent );
 
-       /** inform user about a problem */
-       virtual rpm::RpmInstallReport::Action problem( Exception & excpt_r );
+        /** inform user about a problem */
+        virtual rpm::RpmInstallReport::Action problem( Exception & excpt_r );
 
         /** Additional rpm output to be reported in \ref finish in case of success. */
         virtual void finishInfo( const std::string & info_r );
@@ -70,25 +70,25 @@ namespace zypp
     };
 
     class RpmRemovePackageReceiver
-       : public callback::ReceiveReport<rpm::RpmRemoveReport>
+        : public callback::ReceiveReport<rpm::RpmRemoveReport>
     {
-       callback::SendReport <rpm::RemoveResolvableReport> _report;
-       Resolvable::constPtr _resolvable;
-       bool _abort;
+        callback::SendReport <rpm::RemoveResolvableReport> _report;
+        Resolvable::constPtr _resolvable;
+        bool _abort;
         std::string _finishInfo;
 
       public:
 
-       RpmRemovePackageReceiver (Resolvable::constPtr res);
-       virtual ~RpmRemovePackageReceiver ();
+        RpmRemovePackageReceiver (Resolvable::constPtr res);
+        virtual ~RpmRemovePackageReceiver ();
 
-       virtual void reportbegin();
+        virtual void reportbegin();
 
-       virtual void reportend();
+        virtual void reportend();
 
         /** Start the operation */
-       /** Forwards generic reports. */
-       void report( const UserData & userData_r ) override;
+        /** Forwards generic reports. */
+        void report( const UserData & userData_r ) override;
 
         virtual void start( const std::string & name );
 
@@ -101,10 +101,10 @@ namespace zypp
         /**
          *  Returns true if removing is aborted during progress
          */
-       bool aborted() const { return _abort; }
+        bool aborted() const { return _abort; }
 
-       /** inform user about a problem */
-       virtual rpm::RpmRemoveReport::Action problem( Exception & excpt_r );
+        /** inform user about a problem */
+        virtual rpm::RpmRemoveReport::Action problem( Exception & excpt_r );
 
         /** Additional rpm output to be reported in \ref finish in case of success. */
         virtual void finishInfo( const std::string & info_r );
index 8f51bf2..1776e18 100644 (file)
@@ -96,16 +96,16 @@ namespace zypp
       std::string ret;
       AutoDispose<void*> state { ::rpm_state_create( sat::Pool::instance().get(), root_r.c_str() ), ::rpm_state_free };
       AutoDispose<Chksum*> chk { ::solv_chksum_create( REPOKEY_TYPE_SHA1 ), []( Chksum *chk ) -> void {
-       ::solv_chksum_free( chk, nullptr );
+        ::solv_chksum_free( chk, nullptr );
       } };
       if ( ::rpm_hash_database_state( state, chk ) == 0 )
       {
-       int md5l;
-       const unsigned char * md5 = ::solv_chksum_get( chk, &md5l );
-       ret = ::pool_bin2hex( sat::Pool::instance().get(), md5, md5l );
+        int md5l;
+        const unsigned char * md5 = ::solv_chksum_get( chk, &md5l );
+        ret = ::pool_bin2hex( sat::Pool::instance().get(), md5, md5l );
       }
       else
-       WAR << "rpm_hash_database_state failed" << endl;
+        WAR << "rpm_hash_database_state failed" << endl;
       return ret;
     }
 
@@ -144,9 +144,9 @@ namespace zypp
       json::Array ret;
 
       for ( const Transaction::Step & step : steps_r )
-       // ignore implicit deletes due to obsoletes and non-package actions
-       if ( step.stepType() != Transaction::TRANSACTION_IGNORE )
-         ret.add( step );
+        // ignore implicit deletes due to obsoletes and non-package actions
+        if ( step.stepType() != Transaction::TRANSACTION_IGNORE )
+          ret.add( step );
 
       return ret.asJSON();
     }
@@ -177,47 +177,47 @@ namespace zypp
 
       switch ( step_r.stepType() )
       {
-       case Transaction::TRANSACTION_IGNORE:   /*empty*/ break;
-       case Transaction::TRANSACTION_ERASE:    ret.add( strType, strTypeDel ); break;
-       case Transaction::TRANSACTION_INSTALL:  ret.add( strType, strTypeIns ); break;
-       case Transaction::TRANSACTION_MULTIINSTALL: ret.add( strType, strTypeMul ); break;
+        case Transaction::TRANSACTION_IGNORE:  /*empty*/ break;
+        case Transaction::TRANSACTION_ERASE:   ret.add( strType, strTypeDel ); break;
+        case Transaction::TRANSACTION_INSTALL: ret.add( strType, strTypeIns ); break;
+        case Transaction::TRANSACTION_MULTIINSTALL: ret.add( strType, strTypeMul ); break;
       }
 
       switch ( step_r.stepStage() )
       {
-       case Transaction::STEP_TODO:            /*empty*/ break;
-       case Transaction::STEP_DONE:            ret.add( strStage, strStageDone ); break;
-       case Transaction::STEP_ERROR:           ret.add( strStage, strStageFailed ); break;
+        case Transaction::STEP_TODO:           /*empty*/ break;
+        case Transaction::STEP_DONE:           ret.add( strStage, strStageDone ); break;
+        case Transaction::STEP_ERROR:          ret.add( strStage, strStageFailed ); break;
       }
 
       {
-       IdString ident;
-       Edition ed;
-       Arch arch;
-       if ( sat::Solvable solv = step_r.satSolvable() )
-       {
-         ident = solv.ident();
-         ed    = solv.edition();
-         arch  = solv.arch();
-       }
-       else
-       {
-         // deleted package; post mortem data stored in Transaction::Step
-         ident = step_r.ident();
-         ed    = step_r.edition();
-         arch  = step_r.arch();
-       }
-
-       json::Object s {
-         { strSolvableN, ident.asString() },
-         { strSolvableV, ed.version() },
-         { strSolvableR, ed.release() },
-         { strSolvableA, arch.asString() }
-       };
-       if ( Edition::epoch_t epoch = ed.epoch() )
-         s.add( strSolvableE, epoch );
-
-       ret.add( strSolvable, s );
+        IdString ident;
+        Edition ed;
+        Arch arch;
+        if ( sat::Solvable solv = step_r.satSolvable() )
+        {
+          ident        = solv.ident();
+          ed   = solv.edition();
+          arch = solv.arch();
+        }
+        else
+        {
+          // deleted package; post mortem data stored in Transaction::Step
+          ident        = step_r.ident();
+          ed   = step_r.edition();
+          arch = step_r.arch();
+        }
+
+        json::Object s {
+          { strSolvableN, ident.asString() },
+          { strSolvableV, ed.version() },
+          { strSolvableR, ed.release() },
+          { strSolvableA, arch.asString() }
+        };
+        if ( Edition::epoch_t epoch = ed.epoch() )
+          s.add( strSolvableE, epoch );
+
+        ret.add( strSolvable, s );
       }
 
       return ret.asJSON();
@@ -235,45 +235,45 @@ namespace zypp
       /// bsc#1181328: Some systemd tools require /proc to be mounted
       class AssertProcMounted
       {
-       NON_COPYABLE(AssertProcMounted);
-       NON_MOVABLE(AssertProcMounted);
+        NON_COPYABLE(AssertProcMounted);
+        NON_MOVABLE(AssertProcMounted);
       public:
 
-       AssertProcMounted( Pathname root_r )
-       {
-         root_r /= "/proc";
-         if ( ! PathInfo(root_r/"self").isDir() ) {
-           MIL << "Try to make sure proc is mounted at" << _mountpoint << endl;
-           if ( filesystem::assert_dir(root_r) == 0
-             && execute({ "mount", "-t", "proc", "proc", root_r.asString() }) == 0 ) {
-             _mountpoint = std::move(root_r);  // so we'll later unmount it
-           }
-           else {
-             WAR << "Mounting proc at " << _mountpoint << " failed" << endl;
-           }
-         }
-       }
-
-       ~AssertProcMounted( )
-       {
-         if ( ! _mountpoint.empty() ) {
-           // we mounted it so we unmount...
-           MIL << "We mounted " << _mountpoint << " so we unmount it" << endl;
-           execute({ "umount", "-l", _mountpoint.asString() });
-         }
-       }
+        AssertProcMounted( Pathname root_r )
+        {
+          root_r /= "/proc";
+          if ( ! PathInfo(root_r/"self").isDir() ) {
+            MIL << "Try to make sure proc is mounted at" << _mountpoint << endl;
+            if ( filesystem::assert_dir(root_r) == 0
+              && execute({ "mount", "-t", "proc", "proc", root_r.asString() }) == 0 ) {
+              _mountpoint = std::move(root_r); // so we'll later unmount it
+            }
+            else {
+              WAR << "Mounting proc at " << _mountpoint << " failed" << endl;
+            }
+          }
+        }
+
+        ~AssertProcMounted( )
+        {
+          if ( ! _mountpoint.empty() ) {
+            // we mounted it so we unmount...
+            MIL << "We mounted " << _mountpoint << " so we unmount it" << endl;
+            execute({ "umount", "-l", _mountpoint.asString() });
+          }
+        }
 
       private:
-       int execute( ExternalProgram::Arguments && cmd_r ) const
-       {
-         ExternalProgram prog( cmd_r, ExternalProgram::Stderr_To_Stdout );
-         for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() )
-         { DBG << line; }
-         return prog.close();
-       }
+        int execute( ExternalProgram::Arguments && cmd_r ) const
+        {
+          ExternalProgram prog( cmd_r, ExternalProgram::Stderr_To_Stdout );
+          for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() )
+          { DBG << line; }
+          return prog.close();
+        }
 
       private:
-       Pathname _mountpoint;
+        Pathname _mountpoint;
       };
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -283,58 +283,58 @@ namespace zypp
     {
       SolvIdentFile::Data getUserInstalledFromHistory( const Pathname & historyFile_r )
       {
-       SolvIdentFile::Data onSystemByUserList;
-       // go and parse it: 'who' must constain an '@', then it was installed by user request.
-       // 2009-09-29 07:25:19|install|lirc-remotes|0.8.5-3.2|x86_64|root@opensuse|InstallationImage|a204211eb0...
-       std::ifstream infile( historyFile_r.c_str() );
-       for( iostr::EachLine in( infile ); in; in.next() )
-       {
-         const char * ch( (*in).c_str() );
-         // start with year
-         if ( *ch < '1' || '9' < *ch )
-           continue;
-         const char * sep1 = ::strchr( ch, '|' );      // | after date
-         if ( !sep1 )
-           continue;
-         ++sep1;
-         // if logs an install or delete
-         bool installs = true;
-         if ( ::strncmp( sep1, "install|", 8 ) )
-         {
-           if ( ::strncmp( sep1, "remove |", 8 ) )
-             continue; // no install and no remove
-             else
-               installs = false; // remove
-         }
-         sep1 += 8;                                    // | after what
-         // get the package name
-         const char * sep2 = ::strchr( sep1, '|' );    // | after name
-         if ( !sep2 || sep1 == sep2 )
-           continue;
-         (*in)[sep2-ch] = '\0';
-         IdString pkg( sep1 );
-         // we're done, if a delete
-         if ( !installs )
-         {
-           onSystemByUserList.erase( pkg );
-           continue;
-         }
-         // now guess whether user installed or not (3rd next field contains 'user@host')
-         if ( (sep1 = ::strchr( sep2+1, '|' ))         // | after version
-           && (sep1 = ::strchr( sep1+1, '|' ))         // | after arch
-           && (sep2 = ::strchr( sep1+1, '|' )) )       // | after who
-         {
-           (*in)[sep2-ch] = '\0';
-           if ( ::strchr( sep1+1, '@' ) )
-           {
-             // by user
-             onSystemByUserList.insert( pkg );
-             continue;
-           }
-         }
-       }
-       MIL << "onSystemByUserList found: " << onSystemByUserList.size() << endl;
-       return onSystemByUserList;
+        SolvIdentFile::Data onSystemByUserList;
+        // go and parse it: 'who' must constain an '@', then it was installed by user request.
+        // 2009-09-29 07:25:19|install|lirc-remotes|0.8.5-3.2|x86_64|root@opensuse|InstallationImage|a204211eb0...
+        std::ifstream infile( historyFile_r.c_str() );
+        for( iostr::EachLine in( infile ); in; in.next() )
+        {
+          const char * ch( (*in).c_str() );
+          // start with year
+          if ( *ch < '1' || '9' < *ch )
+            continue;
+          const char * sep1 = ::strchr( ch, '|' );     // | after date
+          if ( !sep1 )
+            continue;
+          ++sep1;
+          // if logs an install or delete
+          bool installs = true;
+          if ( ::strncmp( sep1, "install|", 8 ) )
+          {
+            if ( ::strncmp( sep1, "remove |", 8 ) )
+              continue; // no install and no remove
+              else
+                installs = false; // remove
+          }
+          sep1 += 8;                                   // | after what
+          // get the package name
+          const char * sep2 = ::strchr( sep1, '|' );   // | after name
+          if ( !sep2 || sep1 == sep2 )
+            continue;
+          (*in)[sep2-ch] = '\0';
+          IdString pkg( sep1 );
+          // we're done, if a delete
+          if ( !installs )
+          {
+            onSystemByUserList.erase( pkg );
+            continue;
+          }
+          // now guess whether user installed or not (3rd next field contains 'user@host')
+          if ( (sep1 = ::strchr( sep2+1, '|' ))                // | after version
+            && (sep1 = ::strchr( sep1+1, '|' ))                // | after arch
+            && (sep2 = ::strchr( sep1+1, '|' )) )      // | after who
+          {
+            (*in)[sep2-ch] = '\0';
+            if ( ::strchr( sep1+1, '@' ) )
+            {
+              // by user
+              onSystemByUserList.insert( pkg );
+              continue;
+            }
+          }
+        }
+        MIL << "onSystemByUserList found: " << onSystemByUserList.size() << endl;
+        return onSystemByUserList;
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -344,9 +344,9 @@ namespace zypp
     {
       inline PluginFrame transactionPluginFrame( const std::string & command_r, ZYppCommitResult::TransactionStepList & steps_r )
       {
-       return PluginFrame( command_r, json::Object {
-         { "TransactionStepList", steps_r }
-       }.asJSON() );
+        return PluginFrame( command_r, json::Object {
+          { "TransactionStepList", steps_r }
+        }.asJSON() );
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -511,7 +511,7 @@ namespace zypp
         // - "name-version-release"
         // - "name-version-release-*"
         bool abort = false;
-       std::map<std::string, Pathname> unify; // scripts <md5,path>
+        std::map<std::string, Pathname> unify; // scripts <md5,path>
         for_( it, checkPackages_r.begin(), checkPackages_r.end() )
         {
           std::string prefix( str::form( "%s-%s", it->name().c_str(), it->edition().c_str() ) );
@@ -527,38 +527,38 @@ namespace zypp
             Pathname localPath( scriptsPath_r/(*sit) );        // without root prefix
             std::string unifytag;                      // must not stay empty
 
-           if ( script.isFile() )
-           {
-             // Assert it's set executable, unify by md5sum.
-             filesystem::addmod( script.path(), 0500 );
-             unifytag = filesystem::md5sum( script.path() );
-           }
-           else if ( ! script.isExist() )
-           {
-             // Might be a dangling symlink, might be ok if we are in
-             // instsys (absolute symlink within the system below /mnt).
-             // readlink will tell....
-             unifytag = filesystem::readlink( script.path() ).asString();
-           }
-
-           if ( unifytag.empty() )
-             continue;
-
-           // Unify scripts
-           if ( unify[unifytag].empty() )
-           {
-             unify[unifytag] = localPath;
-           }
-           else
-           {
-             // translators: We may find the same script content in files with different names.
-             // Only the first occurence is executed, subsequent ones are skipped. It's a one-line
-             // message for a log file. Preferably start translation with "%s"
-             std::string msg( str::form(_("%s already executed as %s)"), localPath.asString().c_str(), unify[unifytag].c_str() ) );
+            if ( script.isFile() )
+            {
+              // Assert it's set executable, unify by md5sum.
+              filesystem::addmod( script.path(), 0500 );
+              unifytag = filesystem::md5sum( script.path() );
+            }
+            else if ( ! script.isExist() )
+            {
+              // Might be a dangling symlink, might be ok if we are in
+              // instsys (absolute symlink within the system below /mnt).
+              // readlink will tell....
+              unifytag = filesystem::readlink( script.path() ).asString();
+            }
+
+            if ( unifytag.empty() )
+              continue;
+
+            // Unify scripts
+            if ( unify[unifytag].empty() )
+            {
+              unify[unifytag] = localPath;
+            }
+            else
+            {
+              // translators: We may find the same script content in files with different names.
+              // Only the first occurence is executed, subsequent ones are skipped. It's a one-line
+              // message for a log file. Preferably start translation with "%s"
+              std::string msg( str::form(_("%s already executed as %s)"), localPath.asString().c_str(), unify[unifytag].c_str() ) );
               MIL << "Skip update script: " << msg << endl;
               HistoryLog().comment( msg, /*timestamp*/true );
-             continue;
-           }
+              continue;
+            }
 
             if ( abort || aborting_r )
             {
@@ -676,7 +676,7 @@ namespace zypp
         else if ( format == DIGEST || format == BULK )
         {
           filesystem::TmpFile tmpfile;
-         std::ofstream out( tmpfile.path().c_str() );
+          std::ofstream out( tmpfile.path().c_str() );
           for_( it, notifications_r.begin(), notifications_r.end() )
           {
             if ( format == DIGEST )
@@ -774,24 +774,24 @@ namespace zypp
        */
       void logPatchStatusChanges( const sat::Transaction & transaction_r, TargetImpl & target_r )
       {
-       ResPool::ChangedPseudoInstalled changedPseudoInstalled { ResPool::instance().changedPseudoInstalled() };
-       if ( changedPseudoInstalled.empty() )
-         return;
-
-       if ( ! transaction_r.actionEmpty( ~sat::Transaction::STEP_DONE ) )
-       {
-         // Need to recompute the patch list if commit is incomplete!
-         // We remember the initially established status, then reload the
-         // Target to get the current patch status. Then compare.
-         WAR << "Need to recompute the patch status changes as commit is incomplete!" << endl;
-         ResPool::EstablishedStates establishedStates{ ResPool::instance().establishedStates() };
-         target_r.load();
-         changedPseudoInstalled = establishedStates.changedPseudoInstalled();
-       }
-
-       HistoryLog historylog;
-       for ( const auto & el : changedPseudoInstalled )
-         historylog.patchStateChange( el.first, el.second );
+        ResPool::ChangedPseudoInstalled changedPseudoInstalled { ResPool::instance().changedPseudoInstalled() };
+        if ( changedPseudoInstalled.empty() )
+          return;
+
+        if ( ! transaction_r.actionEmpty( ~sat::Transaction::STEP_DONE ) )
+        {
+          // Need to recompute the patch list if commit is incomplete!
+          // We remember the initially established status, then reload the
+          // Target to get the current patch status. Then compare.
+          WAR << "Need to recompute the patch status changes as commit is incomplete!" << endl;
+          ResPool::EstablishedStates establishedStates{ ResPool::instance().establishedStates() };
+          target_r.load();
+          changedPseudoInstalled = establishedStates.changedPseudoInstalled();
+        }
+
+        HistoryLog historylog;
+        for ( const auto & el : changedPseudoInstalled )
+          historylog.patchStateChange( el.first, el.second );
       }
 
       /////////////////////////////////////////////////////////////////
@@ -845,7 +845,7 @@ namespace zypp
      */
     void updateFileContent( const Pathname &filename,
                             boost::function<bool ()> condition,
-                           boost::function<std::string ()> value )
+                            boost::function<std::string ()> value )
     {
         std::string val = value();
         // if the value is empty, then just dont
@@ -887,7 +887,7 @@ namespace zypp
     {
       // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
       if ( root() != "/" )
-       return;
+        return;
 
       // Create the anonymous unique id, used for download statistics
       Pathname idpath( home() / "AnonymousUniqueId");
@@ -927,7 +927,7 @@ namespace zypp
         updateFileContent( flavorpath,
                            // only if flavor is not empty
                            functor::Constant<bool>( ! flavor.empty() ),
-                          functor::Constant<std::string>(flavor) );
+                           functor::Constant<std::string>(flavor) );
       }
       catch ( const Exception &e )
       {
@@ -987,9 +987,9 @@ namespace zypp
           RepoStatus status = RepoStatus::fromCookieFile(rpmsolvcookie);
           // now compare it with the rpm database
           if ( status == rpmstatus )
-           build_rpm_solv = false;
-         MIL << "Read cookie: " << rpmsolvcookie << " says: "
-         << (build_rpm_solv ? "outdated" : "uptodate") << endl;
+            build_rpm_solv = false;
+          MIL << "Read cookie: " << rpmsolvcookie << " says: "
+          << (build_rpm_solv ? "outdated" : "uptodate") << endl;
         }
       }
 
@@ -1061,7 +1061,7 @@ namespace zypp
         cmd.push_back( tmpsolv.path().asString() );
 
         ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
-       std::string errdetail;
+        std::string errdetail;
 
         for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) {
           WAR << "  " << output;
@@ -1090,22 +1090,22 @@ namespace zypp
 
         // We keep it.
         guard.resetDispose();
-       sat::updateSolvFileIndex( rpmsolv );    // content digest for zypper bash completion
-
-       // system-hook: Finally send notification to plugins
-       if ( root() == "/" )
-       {
-         PluginExecutor plugins;
-         plugins.load( ZConfig::instance().pluginsPath()/"system" );
-         if ( plugins )
-           plugins.send( PluginFrame( "PACKAGESETCHANGED" ) );
-       }
+        sat::updateSolvFileIndex( rpmsolv );   // content digest for zypper bash completion
+
+        // system-hook: Finally send notification to plugins
+        if ( root() == "/" )
+        {
+          PluginExecutor plugins;
+          plugins.load( ZConfig::instance().pluginsPath()/"system" );
+          if ( plugins )
+            plugins.send( PluginFrame( "PACKAGESETCHANGED" ) );
+        }
       }
       else
       {
-       // On the fly add missing solv.idx files for bash completion.
-       if ( ! PathInfo(base/"solv.idx").isExist() )
-         sat::updateSolvFileIndex( rpmsolv );
+        // On the fly add missing solv.idx files for bash completion.
+        if ( ! PathInfo(base/"solv.idx").isExist() )
+          sat::updateSolvFileIndex( rpmsolv );
       }
       return build_rpm_solv;
     }
@@ -1182,60 +1182,60 @@ namespace zypp
         }
       }
       {
-       if ( ! PathInfo( _autoInstalledFile.file() ).isExist() )
-       {
-         // Initialize from history, if it does not exist
-         Pathname historyFile( Pathname::assertprefix( _root, ZConfig::instance().historyLogFile() ) );
-         if ( PathInfo( historyFile ).isExist() )
-         {
-           SolvIdentFile::Data onSystemByUser( getUserInstalledFromHistory( historyFile ) );
-           SolvIdentFile::Data onSystemByAuto;
-           for_( it, system.solvablesBegin(), system.solvablesEnd() )
-           {
-             IdString ident( (*it).ident() );
-             if ( onSystemByUser.find( ident ) == onSystemByUser.end() )
-               onSystemByAuto.insert( ident );
-           }
-           _autoInstalledFile.setData( onSystemByAuto );
-         }
-         // on the fly removed any obsolete SoftLocks file
-         filesystem::unlink( home() / "SoftLocks" );
-       }
-       // read from AutoInstalled file
-       sat::StringQueue q;
-       for ( const auto & idstr : _autoInstalledFile.data() )
-         q.push( idstr.id() );
-       satpool.setAutoInstalled( q );
+        if ( ! PathInfo( _autoInstalledFile.file() ).isExist() )
+        {
+          // Initialize from history, if it does not exist
+          Pathname historyFile( Pathname::assertprefix( _root, ZConfig::instance().historyLogFile() ) );
+          if ( PathInfo( historyFile ).isExist() )
+          {
+            SolvIdentFile::Data onSystemByUser( getUserInstalledFromHistory( historyFile ) );
+            SolvIdentFile::Data onSystemByAuto;
+            for_( it, system.solvablesBegin(), system.solvablesEnd() )
+            {
+              IdString ident( (*it).ident() );
+              if ( onSystemByUser.find( ident ) == onSystemByUser.end() )
+                onSystemByAuto.insert( ident );
+            }
+            _autoInstalledFile.setData( onSystemByAuto );
+          }
+          // on the fly removed any obsolete SoftLocks file
+          filesystem::unlink( home() / "SoftLocks" );
+        }
+        // read from AutoInstalled file
+        sat::StringQueue q;
+        for ( const auto & idstr : _autoInstalledFile.data() )
+          q.push( idstr.id() );
+        satpool.setAutoInstalled( q );
       }
 
       // Load the needreboot package specs
       {
-       sat::SolvableSpec needrebootSpec;
-       needrebootSpec.addProvides( Capability("installhint(reboot-needed)") );
-       needrebootSpec.addProvides( Capability("kernel") );
-       needrebootSpec.addIdent( IdString("kernel-firmware") );
+        sat::SolvableSpec needrebootSpec;
+        needrebootSpec.addProvides( Capability("installhint(reboot-needed)") );
+        needrebootSpec.addProvides( Capability("kernel") );
+        needrebootSpec.addIdent( IdString("kernel-firmware") );
 
-       Pathname needrebootFile { Pathname::assertprefix( root(), ZConfig::instance().needrebootFile() ) };
-       if ( PathInfo( needrebootFile ).isFile() )
-         needrebootSpec.parseFrom( needrebootFile );
+        Pathname needrebootFile { Pathname::assertprefix( root(), ZConfig::instance().needrebootFile() ) };
+        if ( PathInfo( needrebootFile ).isFile() )
+          needrebootSpec.parseFrom( needrebootFile );
 
-       Pathname needrebootDir { Pathname::assertprefix( root(), ZConfig::instance().needrebootPath() ) };
+        Pathname needrebootDir { Pathname::assertprefix( root(), ZConfig::instance().needrebootPath() ) };
         if ( PathInfo( needrebootDir ).isDir() )
-       {
-         static const StrMatcher isRpmConfigBackup( "\\.rpm(new|save|orig)$", Match::REGEX );
-
-         filesystem::dirForEach( needrebootDir, filesystem::matchNoDots(),
-                                 [&]( const Pathname & dir_r, const char *const str_r )->bool
-                                 {
-                                   if ( ! isRpmConfigBackup( str_r ) )
-                                   {
-                                     Pathname needrebootFile { needrebootDir / str_r };
-                                     if ( PathInfo( needrebootFile ).isFile() )
-                                       needrebootSpec.parseFrom( needrebootFile );
-                                   }
-                                   return true;
-                                 });
-       }
+        {
+          static const StrMatcher isRpmConfigBackup( "\\.rpm(new|save|orig)$", Match::REGEX );
+
+          filesystem::dirForEach( needrebootDir, filesystem::matchNoDots(),
+                                  [&]( const Pathname & dir_r, const char *const str_r )->bool
+                                  {
+                                    if ( ! isRpmConfigBackup( str_r ) )
+                                    {
+                                      Pathname needrebootFile { needrebootDir / str_r };
+                                      if ( PathInfo( needrebootFile ).isFile() )
+                                        needrebootSpec.parseFrom( needrebootFile );
+                                    }
+                                    return true;
+                                  });
+        }
         satpool.setNeedrebootSpec( std::move(needrebootSpec) );
       }
 
@@ -1299,19 +1299,19 @@ namespace zypp
       ZYppCommitResult::TransactionStepList & steps( result.rTransactionStepList() );
       if ( policy_r.restrictToMedia() )
       {
-       // Collect until the 1st package from an unwanted media occurs.
+        // Collect until the 1st package from an unwanted media occurs.
         // Further collection could violate install order.
-       MIL << "Restrict to media number " << policy_r.restrictToMedia() << endl;
-       for_( it, result.transaction().begin(), result.transaction().end() )
-       {
-         if ( makeResObject( *it )->mediaNr() > 1 )
-           break;
-         steps.push_back( *it );
-       }
+        MIL << "Restrict to media number " << policy_r.restrictToMedia() << endl;
+        for_( it, result.transaction().begin(), result.transaction().end() )
+        {
+          if ( makeResObject( *it )->mediaNr() > 1 )
+            break;
+          steps.push_back( *it );
+        }
       }
       else
       {
-       result.rTransactionStepList().insert( steps.end(), result.transaction().begin(), result.transaction().end() );
+        result.rTransactionStepList().insert( steps.end(), result.transaction().begin(), result.transaction().end() );
       }
       MIL << "Todo: " << result << endl;
 
@@ -1321,10 +1321,10 @@ namespace zypp
       PluginExecutor commitPlugins;
       if ( root() == "/" && ! policy_r.dryRun() )
       {
-       commitPlugins.load( ZConfig::instance().pluginsPath()/"commit" );
+        commitPlugins.load( ZConfig::instance().pluginsPath()/"commit" );
       }
       if ( commitPlugins )
-       commitPlugins.send( transactionPluginFrame( "COMMITBEGIN", steps ) );
+        commitPlugins.send( transactionPluginFrame( "COMMITBEGIN", steps ) );
 
       ///////////////////////////////////////////////////////////////////
       // Write out a testcase if we're in dist upgrade mode.
@@ -1349,12 +1349,12 @@ namespace zypp
         filesystem::assert_dir( home() );
         // requested locales
         _requestedLocalesFile.setLocales( pool_r.getRequestedLocales() );
-       // autoinstalled
+        // autoinstalled
         {
-         SolvIdentFile::Data newdata;
-         for ( sat::Queue::value_type id : result.rTransaction().autoInstalled() )
-           newdata.insert( IdString(id) );
-         _autoInstalledFile.setData( newdata );
+          SolvIdentFile::Data newdata;
+          for ( sat::Queue::value_type id : result.rTransaction().autoInstalled() )
+            newdata.insert( IdString(id) );
+          _autoInstalledFile.setData( newdata );
         }
         // hard locks
         if ( ZConfig::instance().apply_locks_file() )
@@ -1377,23 +1377,23 @@ namespace zypp
       {
         for_( it, steps.begin(), steps.end() )
         {
-         if ( ! it->satSolvable().isKind<Patch>() )
-           continue;
+          if ( ! it->satSolvable().isKind<Patch>() )
+            continue;
 
-         PoolItem pi( *it );
+          PoolItem pi( *it );
           if ( ! pi.status().isToBeInstalled() )
             continue;
 
           Patch::constPtr patch( asKind<Patch>(pi.resolvable()) );
-         if ( ! patch ||patch->message().empty()  )
-           continue;
-
-         MIL << "Show message for " << patch << endl;
-         callback::SendReport<target::PatchMessageReport> report;
-         if ( ! report->show( patch ) )
-         {
-           WAR << "commit aborted by the user" << endl;
-           ZYPP_THROW( TargetAbortedException( ) );
+          if ( ! patch ||patch->message().empty()  )
+            continue;
+
+          MIL << "Show message for " << patch << endl;
+          callback::SendReport<target::PatchMessageReport> report;
+          if ( ! report->show( patch ) )
+          {
+            WAR << "commit aborted by the user" << endl;
+            ZYPP_THROW( TargetAbortedException( ) );
           }
         }
       }
@@ -1411,9 +1411,9 @@ namespace zypp
       DBG << "commit log file is set to: " << HistoryLog::fname() << endl;
       if ( ! policy_r.dryRun() || policy_r.downloadMode() == DownloadOnly || singleTransMode )
       {
-       // Prepare the package cache. Pass all items requiring download.
+        // Prepare the package cache. Pass all items requiring download.
         CommitPackageCache packageCache;
-       packageCache.setCommitList( steps.begin(), steps.end() );
+        packageCache.setCommitList( steps.begin(), steps.end() );
 
         bool miss = false;
         if ( policy_r.downloadMode() != DownloadAsNeeded || singleTransMode )
@@ -1423,31 +1423,31 @@ namespace zypp
           // we may actually have more than one heap.
           for_( it, steps.begin(), steps.end() )
           {
-           switch ( it->stepType() )
-           {
-             case sat::Transaction::TRANSACTION_INSTALL:
-             case sat::Transaction::TRANSACTION_MULTIINSTALL:
-               // proceed: only install actionas may require download.
-               break;
-
-             default:
-               // next: no download for or non-packages and delete actions.
-               continue;
-               break;
-           }
-
-           PoolItem pi( *it );
+            switch ( it->stepType() )
+            {
+              case sat::Transaction::TRANSACTION_INSTALL:
+              case sat::Transaction::TRANSACTION_MULTIINSTALL:
+                // proceed: only install actionas may require download.
+                break;
+
+              default:
+                // next: no download for or non-packages and delete actions.
+                continue;
+                break;
+            }
+
+            PoolItem pi( *it );
             if ( pi->isKind<Package>() || pi->isKind<SrcPackage>() )
             {
               ManagedFile localfile;
               try
               {
-               localfile = packageCache.get( pi );
+                localfile = packageCache.get( pi );
                 localfile.resetDispose(); // keep the package file in the cache
               }
               catch ( const AbortRequestException & exp )
               {
-               it->stepStage( sat::Transaction::STEP_ERROR );
+                it->stepStage( sat::Transaction::STEP_ERROR );
                 miss = true;
                 WAR << "commit cache preload aborted by the user" << endl;
                 ZYPP_THROW( TargetAbortedException( ) );
@@ -1456,7 +1456,7 @@ namespace zypp
               catch ( const SkipRequestException & exp )
               {
                 ZYPP_CAUGHT( exp );
-               it->stepStage( sat::Transaction::STEP_ERROR );
+                it->stepStage( sat::Transaction::STEP_ERROR );
                 miss = true;
                 WAR << "Skipping cache preload package " << pi->asKind<Package>() << " in commit" << endl;
                 continue;
@@ -1466,7 +1466,7 @@ namespace zypp
                 // bnc #395704: missing catch causes abort.
                 // TODO see if packageCache fails to handle errors correctly.
                 ZYPP_CAUGHT( exp );
-               it->stepStage( sat::Transaction::STEP_ERROR );
+                it->stepStage( sat::Transaction::STEP_ERROR );
                 miss = true;
                 INT << "Unexpected Error: Skipping cache preload package " << pi->asKind<Package>() << " in commit" << endl;
                 continue;
@@ -1481,7 +1481,7 @@ namespace zypp
           ERR << "Some packages could not be provided. Aborting commit."<< endl;
         }
         else
-       {
+        {
           // single trans mode does a test install via rpm
           if ( policy_r.singleTransModeEnabled() ) {
             commitInSingleTransaction( policy_r, packageCache, result );
@@ -1506,29 +1506,29 @@ namespace zypp
       else
       {
         DBG << "dryRun: Not downloading/installing/deleting anything." << endl;
-       if ( explicitDryRun ) {
-         // if cache is preloaded, check for file conflicts
-         commitFindFileConflicts( policy_r, result );
-       }
+        if ( explicitDryRun ) {
+          // if cache is preloaded, check for file conflicts
+          commitFindFileConflicts( policy_r, result );
+        }
       }
 
       {
-       // NOTE: Removing rpm in a transaction, rpm removes the /var/lib/rpm compat symlink.
-       // We re-create it, in case it was lost to prevent legacy tools from accidentally
-       // assuming no database is present.
-       if ( ! PathInfo(_root/"/var/lib/rpm",PathInfo::LSTAT).isExist()
-         && PathInfo(_root/"/usr/lib/sysimage/rpm").isDir() ) {
-         WAR << "(rpm removed in commit?) Inject missing /var/lib/rpm compat symlink to /usr/lib/sysimage/rpm" << endl;
-         filesystem::assert_dir( _root/"/var/lib" );
-         filesystem::symlink( "../../usr/lib/sysimage/rpm", _root/"/var/lib/rpm" );
-       }
+        // NOTE: Removing rpm in a transaction, rpm removes the /var/lib/rpm compat symlink.
+        // We re-create it, in case it was lost to prevent legacy tools from accidentally
+        // assuming no database is present.
+        if ( ! PathInfo(_root/"/var/lib/rpm",PathInfo::LSTAT).isExist()
+          && PathInfo(_root/"/usr/lib/sysimage/rpm").isDir() ) {
+          WAR << "(rpm removed in commit?) Inject missing /var/lib/rpm compat symlink to /usr/lib/sysimage/rpm" << endl;
+          filesystem::assert_dir( _root/"/var/lib" );
+          filesystem::symlink( "../../usr/lib/sysimage/rpm", _root/"/var/lib/rpm" );
+        }
       }
 
       ///////////////////////////////////////////////////////////////////
       // Send result to commit plugins:
       ///////////////////////////////////////////////////////////////////
       if ( commitPlugins )
-       commitPlugins.send( transactionPluginFrame( "COMMITEND", steps ) );
+        commitPlugins.send( transactionPluginFrame( "COMMITEND", steps ) );
 
       ///////////////////////////////////////////////////////////////////
       // Try to rebuild solv file while rpm database is still in cache
@@ -1551,19 +1551,19 @@ namespace zypp
     {
       struct NotifyAttemptToModify
       {
-       NotifyAttemptToModify( ZYppCommitResult & result_r ) : _result( result_r ) {}
+        NotifyAttemptToModify( ZYppCommitResult & result_r ) : _result( result_r ) {}
 
-       void operator()()
-       { if ( _guard ) { _result.attemptToModify( true ); _guard = false; } }
+        void operator()()
+        { if ( _guard ) { _result.attemptToModify( true ); _guard = false; } }
 
-       TrueBool           _guard;
-       ZYppCommitResult & _result;
+        TrueBool           _guard;
+        ZYppCommitResult & _result;
       };
     } // namespace
 
     void TargetImpl::commit( const ZYppCommitPolicy & policy_r,
-                            CommitPackageCache & packageCache_r,
-                            ZYppCommitResult & result_r )
+                             CommitPackageCache & packageCache_r,
+                             ZYppCommitResult & result_r )
     {
       // steps: this is our todo-list
       ZYppCommitResult::TransactionStepList & steps( result_r.rTransactionStepList() );
@@ -1585,17 +1585,17 @@ namespace zypp
 
       for_( step, steps.begin(), steps.end() )
       {
-       PoolItem citem( *step );
-       if ( step->stepType() == sat::Transaction::TRANSACTION_IGNORE )
-       {
-         if ( citem->isKind<Package>() )
-         {
-           // for packages this means being obsoleted (by rpm)
-           // thius no additional action is needed.
-           step->stepStage( sat::Transaction::STEP_DONE );
-           continue;
-         }
-       }
+        PoolItem citem( *step );
+        if ( step->stepType() == sat::Transaction::TRANSACTION_IGNORE )
+        {
+          if ( citem->isKind<Package>() )
+          {
+            // for packages this means being obsoleted (by rpm)
+            // thius no additional action is needed.
+            step->stepStage( sat::Transaction::STEP_DONE );
+            continue;
+          }
+        }
 
         if ( citem->isKind<Package>() )
         {
@@ -1605,20 +1605,20 @@ namespace zypp
             ManagedFile localfile;
             try
             {
-             localfile = packageCache_r.get( citem );
+              localfile = packageCache_r.get( citem );
             }
             catch ( const AbortRequestException &e )
             {
               WAR << "commit aborted by the user" << endl;
               abort = true;
-             step->stepStage( sat::Transaction::STEP_ERROR );
-             break;
+              step->stepStage( sat::Transaction::STEP_ERROR );
+              break;
             }
             catch ( const SkipRequestException &e )
             {
               ZYPP_CAUGHT( e );
               WAR << "Skipping package " << p << " in commit" << endl;
-             step->stepStage( sat::Transaction::STEP_ERROR );
+              step->stepStage( sat::Transaction::STEP_ERROR );
               continue;
             }
             catch ( const Exception &e )
@@ -1627,7 +1627,7 @@ namespace zypp
               // TODO see if packageCache fails to handle errors correctly.
               ZYPP_CAUGHT( e );
               INT << "Unexpected Error: Skipping package " << p << " in commit" << endl;
-             step->stepStage( sat::Transaction::STEP_ERROR );
+              step->stepStage( sat::Transaction::STEP_ERROR );
               continue;
             }
 
@@ -1652,13 +1652,13 @@ namespace zypp
             if (policy_r.rpmExcludeDocs()) flags |= rpm::RPMINST_EXCLUDEDOCS;
             if (policy_r.rpmNoSignature()) flags |= rpm::RPMINST_NOSIGNATURE;
 
-           attemptToModify();
+            attemptToModify();
             try
             {
               progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE );
-             if ( postTransCollector.collectScriptFromPackage( localfile ) )
-               flags |= rpm::RPMINST_NOPOSTTRANS;
-             rpm().installPackage( localfile, flags );
+              if ( postTransCollector.collectScriptFromPackage( localfile ) )
+                flags |= rpm::RPMINST_NOPOSTTRANS;
+              rpm().installPackage( localfile, flags );
               HistoryLog().install(citem);
 
               if ( progress.aborted() )
@@ -1666,7 +1666,7 @@ namespace zypp
                 WAR << "commit aborted by the user" << endl;
                 localfile.resetDispose(); // keep the package file in the cache
                 abort = true;
-               step->stepStage( sat::Transaction::STEP_ERROR );
+                step->stepStage( sat::Transaction::STEP_ERROR );
                 break;
               }
               else
@@ -1678,7 +1678,7 @@ namespace zypp
                 }
 
                 success = true;
-               step->stepStage( sat::Transaction::STEP_DONE );
+                step->stepStage( sat::Transaction::STEP_DONE );
               }
             }
             catch ( Exception & excpt_r )
@@ -1689,7 +1689,7 @@ namespace zypp
               if ( policy_r.dryRun() )
               {
                 WAR << "dry run failed" << endl;
-               step->stepStage( sat::Transaction::STEP_ERROR );
+                step->stepStage( sat::Transaction::STEP_ERROR );
                 break;
               }
               // else
@@ -1710,7 +1710,7 @@ namespace zypp
             {
               citem.status().resetTransact( ResStatus::USER );
               successfullyInstalledPackages.push_back( citem.satSolvable() );
-             step->stepStage( sat::Transaction::STEP_DONE );
+              step->stepStage( sat::Transaction::STEP_DONE );
             }
           }
           else
@@ -1723,23 +1723,23 @@ namespace zypp
             flags |= rpm::RPMINST_NODEPS;
             if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST;
 
-           attemptToModify();
+            attemptToModify();
             try
             {
-             rpm().removePackage( p, flags );
+              rpm().removePackage( p, flags );
               HistoryLog().remove(citem);
 
               if ( progress.aborted() )
               {
                 WAR << "commit aborted by the user" << endl;
                 abort = true;
-               step->stepStage( sat::Transaction::STEP_ERROR );
+                step->stepStage( sat::Transaction::STEP_ERROR );
                 break;
               }
               else
               {
                 success = true;
-               step->stepStage( sat::Transaction::STEP_DONE );
+                step->stepStage( sat::Transaction::STEP_DONE );
               }
             }
             catch (Exception & excpt_r)
@@ -1749,17 +1749,17 @@ namespace zypp
               {
                 WAR << "commit aborted by the user" << endl;
                 abort = true;
-               step->stepStage( sat::Transaction::STEP_ERROR );
+                step->stepStage( sat::Transaction::STEP_ERROR );
                 break;
               }
               // else
               WAR << "removal of " << p << " failed";
-             step->stepStage( sat::Transaction::STEP_ERROR );
+              step->stepStage( sat::Transaction::STEP_ERROR );
             }
             if ( success && !policy_r.dryRun() )
             {
               citem.status().resetTransact( ResStatus::USER );
-             step->stepStage( sat::Transaction::STEP_DONE );
+              step->stepStage( sat::Transaction::STEP_DONE );
             }
           }
         }
@@ -1787,18 +1787,18 @@ namespace zypp
                 }
                 else
                 {
-                 Pathname referencePath { Pathname("/etc/products.d") / referenceFilename };   // no root prefix for rpmdb lookup!
-                 if ( ! rpm().hasFile( referencePath.asString() ) )
-                 {
-                   // If it's not owned by a package, we can delete it.
-                   referencePath = Pathname::assertprefix( _root, referencePath );     // now add a root prefix
-                   if ( filesystem::unlink( referencePath ) != 0 )
-                     ERR << "Delete orphan product failed: " << referencePath << endl;
-                 }
-                 else
-                 {
-                   WAR << "Won't remove orphan product: '/etc/products.d/" << referenceFilename << "' is owned by a package." << endl;
-                 }
+                  Pathname referencePath { Pathname("/etc/products.d") / referenceFilename };  // no root prefix for rpmdb lookup!
+                  if ( ! rpm().hasFile( referencePath.asString() ) )
+                  {
+                    // If it's not owned by a package, we can delete it.
+                    referencePath = Pathname::assertprefix( _root, referencePath );    // now add a root prefix
+                    if ( filesystem::unlink( referencePath ) != 0 )
+                      ERR << "Delete orphan product failed: " << referencePath << endl;
+                  }
+                  else
+                  {
+                    WAR << "Won't remove orphan product: '/etc/products.d/" << referenceFilename << "' is owned by a package." << endl;
+                  }
                 }
               }
             }
@@ -1810,7 +1810,7 @@ namespace zypp
             }
 
             citem.status().resetTransact( ResStatus::USER );
-           step->stepStage( sat::Transaction::STEP_DONE );
+            step->stepStage( sat::Transaction::STEP_DONE );
           }
 
         }  // other resolvables
@@ -1820,7 +1820,7 @@ namespace zypp
       // process all remembered posttrans scripts. If aborting,
       // at least log omitted scripts.
       if ( abort || (abort = !postTransCollector.executeScripts()) )
-       postTransCollector.discardScripts();
+        postTransCollector.discardScripts();
 
       // Check presence of update scripts/messages. If aborting,
       // at least log omitted scripts.
@@ -1835,8 +1835,8 @@ namespace zypp
         // send messages after scripts in case some script generates output,
         // that should be kept in t %ghost message file.
         RunUpdateMessages( _root, ZConfig::instance().update_messagesPath(),
-                          successfullyInstalledPackages,
-                          result_r );
+                           successfullyInstalledPackages,
+                           result_r );
       }
 
       // jsc#SLE-5116: Log patch status changes to history
@@ -1846,7 +1846,7 @@ namespace zypp
 
       if ( abort )
       {
-       HistoryLog().comment( "Commit was aborted." );
+        HistoryLog().comment( "Commit was aborted." );
         ZYPP_THROW( TargetAbortedException( ) );
       }
     }
@@ -1895,10 +1895,15 @@ namespace zypp
       commit.set_root( rpm().root().asString() );
 
       bool abort = false;
-      std::vector<ManagedFile> locFiles;
+      zypp::AutoDispose<std::unordered_map<int, ManagedFile>> locCache([]( std::unordered_map<int, ManagedFile> &data ){
+        for ( auto &[key, value] : data ) {
+          value.resetDispose();
+        }
+        data.clear();
+      });
 
       // fill the transaction
-      for( int stepId = 0; (ZYppCommitResult::TransactionStepList::size_type)stepId < steps.size() && !abort ; stepId++ ) {
+      for ( int stepId = 0; (ZYppCommitResult::TransactionStepList::size_type)stepId < steps.size() && !abort ; ++stepId ) {
         auto &step = steps[stepId];
         PoolItem citem( step );
         if ( step.stepType() == sat::Transaction::TRANSACTION_IGNORE ) {
@@ -1916,11 +1921,11 @@ namespace zypp
           if ( citem.status().isToBeInstalled() )
           {
             try {
-              locFiles.push_back( packageCache_r.get( citem ) );
+              locCache.value()[stepId] = packageCache_r.get( citem );
 
               zpt::TransactionStep tStep;
               tStep.set_stepid( stepId );
-              tStep.mutable_install()->set_pathname( locFiles.back()->asString() );
+              tStep.mutable_install()->set_pathname( locCache.value()[stepId]->asString() );
               tStep.mutable_install()->set_multiversion( p->multiversionInstall() );
 
               *commit.mutable_steps()->Add( ) = std::move(tStep);
@@ -1966,11 +1971,11 @@ namespace zypp
 
           try {
             // provide on local disk
-            locFiles.push_back( provideSrcPackage( p ) );
+            locCache.value()[stepId] = provideSrcPackage( p );
 
             zpt::TransactionStep tStep;
             tStep.set_stepid( stepId );
-            tStep.mutable_install()->set_pathname( locFiles.back()->asString() );
+            tStep.mutable_install()->set_pathname( locCache.value()[stepId]->asString() );
             tStep.mutable_install()->set_multiversion( false );
             *commit.mutable_steps()->Add() = std::move(tStep);
 
@@ -2158,6 +2163,8 @@ namespace zypp
               ( *installreport)->progress( 100, resObj );
               ( *installreport)->finish( resObj, rpm::InstallResolvableReportSA::NO_ERROR );
 
+              if ( currentStepId >= 0 )
+                locCache.value().erase( currentStepId );
               successfullyInstalledPackages.push_back( step->satSolvable() );
 
               PoolItem citem( *step );
@@ -2660,7 +2667,7 @@ namespace zypp
             break;
         }
 
-        for( int stepId = 0; (ZYppCommitResult::TransactionStepList::size_type)stepId < steps.size() && !abort ; stepId++ ) {
+        for ( int stepId = 0; (ZYppCommitResult::TransactionStepList::size_type)stepId < steps.size() && !abort; ++stepId ) {
           auto &step = steps[stepId];
           PoolItem citem( step );
 
@@ -2747,7 +2754,7 @@ namespace zypp
     {
       parser::ProductFileData baseproductdata( const Pathname & root_r )
       {
-       parser::ProductFileData ret;
+        parser::ProductFileData ret;
         PathInfo baseproduct( Pathname::assertprefix( root_r, "/etc/products.d/baseproduct" ) );
 
         if ( baseproduct.isFile() )
@@ -2761,10 +2768,10 @@ namespace zypp
             ZYPP_CAUGHT( excpt );
           }
         }
-       else if ( PathInfo( Pathname::assertprefix( root_r, "/etc/products.d" ) ).isDir() )
-       {
-         ERR << "baseproduct symlink is dangling or missing: " << baseproduct << endl;
-       }
+        else if ( PathInfo( Pathname::assertprefix( root_r, "/etc/products.d" ) ).isDir() )
+        {
+          ERR << "baseproduct symlink is dangling or missing: " << baseproduct << endl;
+        }
         return ret;
       }
 
@@ -2812,7 +2819,7 @@ namespace zypp
       const Pathname needroot( staticGuessRoot(root_r) );
       const Target_constPtr target( getZYpp()->getTarget() );
       if ( target && target->root() == needroot )
-       return target->requestedLocales();
+        return target->requestedLocales();
       return RequestedLocalesFile( home(needroot) / "RequestedLocales" ).locales();
     }
 
@@ -2821,7 +2828,7 @@ namespace zypp
       MIL << "updateAutoInstalled if changed..." << endl;
       SolvIdentFile::Data newdata;
       for ( auto id : sat::Pool::instance().autoInstalled() )
-       newdata.insert( IdString(id) ); // explicit ctor!
+        newdata.insert( IdString(id) );        // explicit ctor!
       _autoInstalledFile.setData( std::move(newdata) );
     }
 
@@ -2917,14 +2924,14 @@ namespace zypp
     {
       std::string guessAnonymousUniqueId( const Pathname & root_r )
       {
-       // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
-       std::string ret( firstNonEmptyLineIn( root_r / "/var/lib/zypp/AnonymousUniqueId" ) );
-       if ( ret.empty() && root_r != "/" )
-       {
-         // if it has nonoe, use the outer systems one
-         ret = firstNonEmptyLineIn( "/var/lib/zypp/AnonymousUniqueId" );
-       }
-       return ret;
+        // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
+        std::string ret( firstNonEmptyLineIn( root_r / "/var/lib/zypp/AnonymousUniqueId" ) );
+        if ( ret.empty() && root_r != "/" )
+        {
+          // if it has nonoe, use the outer systems one
+          ret = firstNonEmptyLineIn( "/var/lib/zypp/AnonymousUniqueId" );
+        }
+        return ret;
       }
     }
 
index 341de66..1d9bc3a 100644 (file)
@@ -50,70 +50,70 @@ namespace zypp
       /** libsolv::pool_findfileconflicts callback providing package header. */
       struct FileConflictsCB
       {
-       FileConflictsCB( sat::detail::CPool * pool_r, ProgressData & progress_r )
-       : _progress( progress_r )
-       , _state( ::rpm_state_create( pool_r, ::pool_get_rootdir(pool_r) ), ::rpm_state_free )
-       {}
-
-       void * operator()( sat::detail::CPool * pool_r, sat::detail::IdType id_r )
-       {
-         void * ret = lookup( id_r );
-
-         // report progress on 1st visit only, ticks later
-         // (there may be up to 3 visits)
-         if ( _visited.find( id_r ) == _visited.end() )
-         {
-           //DBG << "FCCB: " << sat::Solvable( id_r ) << " " << ret << endl;
-           _visited.insert( id_r );
-           if ( ! ret && sat::Solvable( id_r ).isKind<Package>() )     // only packages have filelists
-             _noFilelist.push( id_r );
-           _progress.incr();
-         }
-         else
-         {
-           _progress.tick();
-         }
-         return ret;
-       }
-
-       const sat::Queue & noFilelist() const
-       { return _noFilelist; }
-
-       static void * invoke( sat::detail::CPool * pool_r, sat::detail::IdType id_r, void * cbdata_r )
-       { return (*reinterpret_cast<FileConflictsCB*>(cbdata_r))( pool_r, id_r ); }
+        FileConflictsCB( sat::detail::CPool * pool_r, ProgressData & progress_r )
+        : _progress( progress_r )
+        , _state( ::rpm_state_create( pool_r, ::pool_get_rootdir(pool_r) ), ::rpm_state_free )
+        {}
+
+        void * operator()( sat::detail::CPool * pool_r, sat::detail::IdType id_r )
+        {
+          void * ret = lookup( id_r );
+
+          // report progress on 1st visit only, ticks later
+          // (there may be up to 3 visits)
+          if ( _visited.find( id_r ) == _visited.end() )
+          {
+            //DBG << "FCCB: " << sat::Solvable( id_r ) << " " << ret << endl;
+            _visited.insert( id_r );
+            if ( ! ret && sat::Solvable( id_r ).isKind<Package>() )    // only packages have filelists
+              _noFilelist.push( id_r );
+            _progress.incr();
+          }
+          else
+          {
+            _progress.tick();
+          }
+          return ret;
+        }
+
+        const sat::Queue & noFilelist() const
+        { return _noFilelist; }
+
+        static void * invoke( sat::detail::CPool * pool_r, sat::detail::IdType id_r, void * cbdata_r )
+        { return (*reinterpret_cast<FileConflictsCB*>(cbdata_r))( pool_r, id_r ); }
 
       private:
-       void * lookup( sat::detail::IdType id_r )
-       {
-         sat::Solvable solv( id_r );
-         if ( solv.isSystem() )
-         {
-           Solvable * s = solv.get();
-           if ( ! s->repo->rpmdbid )
-             return nullptr;
-           sat::detail::IdType rpmdbid = s->repo->rpmdbid[id_r - s->repo->start];
-           if ( ! rpmdbid )
-             return nullptr;
-           return ::rpm_byrpmdbid( _state, rpmdbid );
-         }
-         else
-         {
-           Package::Ptr pkg( make<Package>( solv ) );
-           if ( ! pkg )
-             return nullptr;
-           Pathname localfile( pkg->cachedLocation() );
-           if ( localfile.empty() )
-             return nullptr;
-           AutoDispose<FILE*> fp( ::fopen( localfile.c_str(), "re" ), ::fclose );
-           return ::rpm_byfp( _state, fp, localfile.c_str() );
-         }
-       }
+        void * lookup( sat::detail::IdType id_r )
+        {
+          sat::Solvable solv( id_r );
+          if ( solv.isSystem() )
+          {
+            Solvable * s = solv.get();
+            if ( ! s->repo->rpmdbid )
+              return nullptr;
+            sat::detail::IdType rpmdbid = s->repo->rpmdbid[id_r - s->repo->start];
+            if ( ! rpmdbid )
+              return nullptr;
+            return ::rpm_byrpmdbid( _state, rpmdbid );
+          }
+          else
+          {
+            Package::Ptr pkg( make<Package>( solv ) );
+            if ( ! pkg )
+              return nullptr;
+            Pathname localfile( pkg->cachedLocation() );
+            if ( localfile.empty() )
+              return nullptr;
+            AutoDispose<FILE*> fp( ::fopen( localfile.c_str(), "re" ), ::fclose );
+            return ::rpm_byfp( _state, fp, localfile.c_str() );
+          }
+        }
 
       private:
-       ProgressData & _progress;
-       AutoDispose<void*> _state;
-       std::unordered_set<sat::detail::IdType> _visited;
-       sat::Queue _noFilelist;
+        ProgressData & _progress;
+        AutoDispose<void*> _state;
+        std::unordered_set<sat::detail::IdType> _visited;
+        sat::Queue _noFilelist;
       };
 
     } // namespace
@@ -126,46 +126,46 @@ namespace zypp
       int newpkgs = result_r.transaction().installedResult( todo );
       MIL << "Checking for file conflicts in " << newpkgs << " new packages..." << endl;
       if ( ! newpkgs )
-       return;
+        return;
 
       try {
-       callback::SendReport<FindFileConflictstReport> report;
-       ProgressData progress( todo.size() );
-       if ( ! report->start( progress ) )
-         ZYPP_THROW( AbortRequestException() );
-
-       FileConflictsCB cb( sat::Pool::instance().get(), progress );
-       // lambda receives progress trigger and translates into report
-       auto sendProgress = [&]( const ProgressData & progress_r )->bool {
-         if ( ! report->progress( progress_r, cb.noFilelist() ) )
-         {
-           progress.noSend();  // take care progress DTOR does not trigger a final report (2nd exeption)
-           ZYPP_THROW( AbortRequestException() );
-         }
-         return true;
-       };
-       progress.sendTo( sendProgress );
-
-       unsigned count =
-         ::pool_findfileconflicts( sat::Pool::instance().get(),
-                                   todo,
-                                   newpkgs,
-                                   conflicts,
-                                   FINDFILECONFLICTS_USE_SOLVABLEFILELIST | FINDFILECONFLICTS_CHECK_DIRALIASING | FINDFILECONFLICTS_USE_ROOTDIR,
-                                   &FileConflictsCB::invoke,
-                                   &cb );
-       progress.toMax();
-       progress.noSend();
-
-       (count?WAR:MIL) << "Found " << count << " file conflicts." << endl;
-       if ( ! report->result( progress, cb.noFilelist(), conflicts ) )
-         ZYPP_THROW( AbortRequestException() );
+        callback::SendReport<FindFileConflictstReport> report;
+        ProgressData progress( todo.size() );
+        if ( ! report->start( progress ) )
+          ZYPP_THROW( AbortRequestException() );
+
+        FileConflictsCB cb( sat::Pool::instance().get(), progress );
+        // lambda receives progress trigger and translates into report
+        auto sendProgress = [&]( const ProgressData & progress_r )->bool {
+          if ( ! report->progress( progress_r, cb.noFilelist() ) )
+          {
+            progress.noSend(); // take care progress DTOR does not trigger a final report (2nd exeption)
+            ZYPP_THROW( AbortRequestException() );
+          }
+          return true;
+        };
+        progress.sendTo( sendProgress );
+
+        unsigned count =
+          ::pool_findfileconflicts( sat::Pool::instance().get(),
+                                    todo,
+                                    newpkgs,
+                                    conflicts,
+                                    FINDFILECONFLICTS_USE_SOLVABLEFILELIST | FINDFILECONFLICTS_CHECK_DIRALIASING | FINDFILECONFLICTS_USE_ROOTDIR,
+                                    &FileConflictsCB::invoke,
+                                    &cb );
+        progress.toMax();
+        progress.noSend();
+
+        (count?WAR:MIL) << "Found " << count << " file conflicts." << endl;
+        if ( ! report->result( progress, cb.noFilelist(), conflicts ) )
+          ZYPP_THROW( AbortRequestException() );
       }
       catch ( const AbortRequestException & e )
       {
-       TargetAbortedException excpt;
-       excpt.remember( e );
-       ZYPP_THROW( excpt );
+        TargetAbortedException excpt;
+        excpt.remember( e );
+        ZYPP_THROW( excpt );
       }
     }
 
index 5cadeff..8eee15f 100644 (file)
@@ -208,8 +208,8 @@ namespace zypp
     private:
       /** Commit ordered changes (internal helper) */
       void commit( const ZYppCommitPolicy & policy_r,
-                  CommitPackageCache & packageCache_r,
-                  ZYppCommitResult & result_r );
+                   CommitPackageCache & packageCache_r,
+                   ZYppCommitResult & result_r );
 
       /** Commit ordered changes (internal helper) */
       void commitInSingleTransaction( const ZYppCommitPolicy & policy_r,
index c33be22..5ff18d1 100644 (file)
@@ -44,68 +44,68 @@ namespace zypp
       inline bool isBlackListed( const Pathname & dir_r, const char * file_r )
       {
 #define PATH_IS( D, F ) ( ::strcmp( file_r, F ) == 0 && ::strcmp( dir_r.c_str(), D ) == 0 )
-       switch ( file_r[0] )
-       {
-         case 'm':
-           return PATH_IS( "/sys/devices/system", "memory" );  // bnc#824110: huge tree for systems with large RAM
-           break;
-       }
-       return false;
+        switch ( file_r[0] )
+        {
+          case 'm':
+            return PATH_IS( "/sys/devices/system", "memory" ); // bnc#824110: huge tree for systems with large RAM
+            break;
+        }
+        return false;
 #undef PATH_IS
       }
 
       void foreach_file_recursive( const Pathname & dir_r, std::set<std::string> & arg_r )
       {
-       AutoDispose<DIR *> dir( ::opendir( dir_r.c_str() ), ::closedir );
-       if ( ! dir )
-         return;
-
-       struct dirent * dirent = NULL;
-       while ( (dirent = ::readdir(dir)) != NULL )
-       {
-         if ( dirent->d_name[0] == '.' )
-           continue;
-
-         if ( isBlackListed( dir_r, dirent->d_name ) )
-           continue;
-
-         Pathname path;        // lazy init as needed
-         unsigned char d_type = dirent->d_type;
-         if ( d_type == DT_UNKNOWN )
-         {
-           path = dir_r/dirent->d_name;
-           PathInfo pi( path, PathInfo::LSTAT );
-           if ( pi.isDir() )
-             d_type = DT_DIR;
-           else if ( pi.isFile() )
-             d_type = DT_REG;
-         }
-
-         if ( d_type == DT_DIR )
-         {
-           if ( path.empty() )
-             path = dir_r/dirent->d_name;
-           foreach_file_recursive( path, arg_r );
-         }
-         else if ( d_type == DT_REG && ::strcmp( dirent->d_name, "modalias" ) == 0 )
-         {
-           if ( path.empty() )
-             path = dir_r/dirent->d_name;
-           // read modalias line from file
-           std::ifstream str( path.c_str() );
-           std::string line( iostr::getline( str ) );
-           if ( ! line.empty() )
-             arg_r.insert( line );
-         }
-       }
+        AutoDispose<DIR *> dir( ::opendir( dir_r.c_str() ), ::closedir );
+        if ( ! dir )
+          return;
+
+        struct dirent * dirent = NULL;
+        while ( (dirent = ::readdir(dir)) != NULL )
+        {
+          if ( dirent->d_name[0] == '.' )
+            continue;
+
+          if ( isBlackListed( dir_r, dirent->d_name ) )
+            continue;
+
+          Pathname path;       // lazy init as needed
+          unsigned char d_type = dirent->d_type;
+          if ( d_type == DT_UNKNOWN )
+          {
+            path = dir_r/dirent->d_name;
+            PathInfo pi( path, PathInfo::LSTAT );
+            if ( pi.isDir() )
+              d_type = DT_DIR;
+            else if ( pi.isFile() )
+              d_type = DT_REG;
+          }
+
+          if ( d_type == DT_DIR )
+          {
+            if ( path.empty() )
+              path = dir_r/dirent->d_name;
+            foreach_file_recursive( path, arg_r );
+          }
+          else if ( d_type == DT_REG && ::strcmp( dirent->d_name, "modalias" ) == 0 )
+          {
+            if ( path.empty() )
+              path = dir_r/dirent->d_name;
+            // read modalias line from file
+            std::ifstream str( path.c_str() );
+            std::string line( iostr::getline( str ) );
+            if ( ! line.empty() )
+              arg_r.insert( line );
+          }
+        }
       }
 
       /** Recursively scan for modalias files and scan them to \a arg. */
       void foreach_file_recursive( const Pathname & dir_r, Modalias::ModaliasList & arg_r )
       {
-       std::set<std::string> arg;      // we want the aliases to be unified (the public API uses a vector)
-       foreach_file_recursive( dir_r, arg );
-       arg_r.insert( arg_r.end(), arg.begin(), arg.end() );
+        std::set<std::string> arg;     // we want the aliases to be unified (the public API uses a vector)
+        foreach_file_recursive( dir_r, arg );
+        arg_r.insert( arg_r.end(), arg.begin(), arg.end() );
       }
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -120,33 +120,33 @@ namespace zypp
       /** Ctor. */
       Impl()
       {
-       const char * dir = getenv("ZYPP_MODALIAS_SYSFS");
-       if ( dir )
-       {
-         PathInfo pi( dir );
-         if (  pi.isFile() )
-         {
-           // Debug/testcases:
-           //   find /sys/ -type f -name modalias -print0 | xargs -0 cat >/tmp/modaliases
-           //   ZYPP_MODALIAS_SYSFS=/tmp/modaliases
-           DBG << "Using $ZYPP_MODALIAS_SYSFS modalias file: " << dir << endl;
-           iostr::forEachLine( InputStream( pi.path() ),
-                               [&]( int num_r, std::string line_r )->bool
-                               {
-                                 this->_modaliases.push_back( line_r );
-                                 return true;
-                               } );
-           return;
-         }
-         DBG << "Using $ZYPP_MODALIAS_SYSFS: " << dir << endl;
-       }
-       else
-       {
-         dir = "/sys";
-         DBG << "Using /sys directory." << endl;
-       }
-
-       foreach_file_recursive( dir, _modaliases );
+        const char * dir = getenv("ZYPP_MODALIAS_SYSFS");
+        if ( dir )
+        {
+          PathInfo pi( dir );
+          if (  pi.isFile() )
+          {
+            // Debug/testcases:
+            //   find /sys/ -type f -name modalias -print0 | xargs -0 cat >/tmp/modaliases
+            //   ZYPP_MODALIAS_SYSFS=/tmp/modaliases
+            DBG << "Using $ZYPP_MODALIAS_SYSFS modalias file: " << dir << endl;
+            iostr::forEachLine( InputStream( pi.path() ),
+                                [&]( int num_r, std::string line_r )->bool
+                                {
+                                  this->_modaliases.push_back( line_r );
+                                  return true;
+                                } );
+            return;
+          }
+          DBG << "Using $ZYPP_MODALIAS_SYSFS: " << dir << endl;
+        }
+        else
+        {
+          dir = "/sys";
+          DBG << "Using /sys directory." << endl;
+        }
+
+        foreach_file_recursive( dir, _modaliases );
       }
 
       /** Dtor. */
@@ -169,15 +169,15 @@ namespace zypp
        */
       bool query( const char * cap_r ) const
       {
-       if ( cap_r && *cap_r )
-       {
-         for_( it, _modaliases.begin(), _modaliases.end() )
-         {
-           if ( fnmatch( cap_r, (*it).c_str(), 0 ) == 0 )
-             return true;
-         }
-       }
-       return false;
+        if ( cap_r && *cap_r )
+        {
+          for_( it, _modaliases.begin(), _modaliases.end() )
+          {
+            if ( fnmatch( cap_r, (*it).c_str(), 0 ) == 0 )
+              return true;
+          }
+        }
+        return false;
       }
 
     public:
@@ -187,8 +187,8 @@ namespace zypp
       /** Offer default Impl. */
       static shared_ptr<Impl> nullimpl()
       {
-       static shared_ptr<Impl> _nullimpl( new Impl );
-       return _nullimpl;
+        static shared_ptr<Impl> _nullimpl( new Impl );
+        return _nullimpl;
       }
 
     };
index 6e6794c..cafbd38 100644 (file)
@@ -41,7 +41,7 @@ namespace zypp
         struct Impl;
 
       public:
-       typedef std::vector<std::string> ModaliasList;
+        typedef std::vector<std::string> ModaliasList;
 
         /** Singleton access. */
         static Modalias & instance();
@@ -77,8 +77,8 @@ namespace zypp
         /** List of modaliases found on system */
         const ModaliasList & modaliasList() const;
 
-       /** Manually set list of modaliases to use */
-       void modaliasList( ModaliasList newlist_r );
+        /** Manually set list of modaliases to use */
+        void modaliasList( ModaliasList newlist_r );
 
       private:
         /** Singleton ctor. */
index 9fb3b60..ad4473c 100644 (file)
@@ -99,26 +99,26 @@ unsigned BinHeader::intList::set( void * val_r, unsigned cnt_r, rpmTagType type_
     {
 #if RPM_CHAR_TYPE != RPM_INT8_TYPE
       case RPM_CHAR_TYPE:
-       std::vector<long>( (char*)val_r, ((char*)val_r)+cnt_r ).swap( _data );
-       break;
+        std::vector<long>( (char*)val_r, ((char*)val_r)+cnt_r ).swap( _data );
+        break;
 #endif
       case RPM_INT8_TYPE:
-       std::vector<long>( (int8_t*)val_r, ((int8_t*)val_r)+cnt_r ).swap( _data );
-       break;
+        std::vector<long>( (int8_t*)val_r, ((int8_t*)val_r)+cnt_r ).swap( _data );
+        break;
       case RPM_INT16_TYPE:
-       std::vector<long>( (int16_t*)val_r, ((int16_t*)val_r)+cnt_r ).swap( _data );
-       break;
+        std::vector<long>( (int16_t*)val_r, ((int16_t*)val_r)+cnt_r ).swap( _data );
+        break;
       case RPM_INT32_TYPE:
-       std::vector<long>( (int32_t*)val_r, ((int32_t*)val_r)+cnt_r ).swap( _data );
-       break;
+        std::vector<long>( (int32_t*)val_r, ((int32_t*)val_r)+cnt_r ).swap( _data );
+        break;
 #ifndef _RPM_5
       case RPM_INT64_TYPE:
-       std::vector<long>( (int64_t*)val_r, ((int64_t*)val_r)+cnt_r ).swap( _data );
-       break;
+        std::vector<long>( (int64_t*)val_r, ((int64_t*)val_r)+cnt_r ).swap( _data );
+        break;
 #endif
       default:
-       std::vector<long>( cnt_r, 0L ).swap( _data );
-       break;
+        std::vector<long>( cnt_r, 0L ).swap( _data );
+        break;
     }
   else
     _data.clear();
index fa76a6e..ca4e7b9 100644 (file)
@@ -78,8 +78,8 @@ namespace zypp
     inline bool ZYPP_RPM_DEBUG()
     {
       static bool val = [](){
-       const char * env = getenv("ZYPP_RPM_DEBUG");
-       return( env && str::strToBool( env, true ) );
+        const char * env = getenv("ZYPP_RPM_DEBUG");
+        return( env && str::strToBool( env, true ) );
       }();
       return val;
     }
@@ -124,7 +124,7 @@ inline std::string rpmQuoteFilename( const Pathname & path_r )
       // try to prepend cwd
       AutoDispose<char*> cwd( ::get_current_dir_name(), ::free );
       if ( cwd )
-       return Pathname( cwd ) / path_r;
+        return Pathname( cwd ) / path_r;
       WAR << "Can't get cwd!" << endl;
     }
 #endif
@@ -446,17 +446,17 @@ void RpmDb::doRebuildDatabase(callback::SendReport<RebuildDBReport> & report)
     {
       if ( ! str::endsWith( line, ignoreSuffix ) )
       {
-       errmsg += line;
-       errmsg += '\n';
-       WAR << line << endl;
+        errmsg += line;
+        errmsg += '\n';
+        WAR << line << endl;
       }
     }
     else if ( str::startsWith( line, progressPrefix ) )
     {
       if ( ! tics.incr() )
       {
-       WAR << "User requested abort." << endl;
-       systemKill();
+        WAR << "User requested abort." << endl;
+        systemKill();
       }
     }
   }
@@ -486,56 +486,56 @@ namespace
     struct Key
     {
       Key()
-       : _inRpmKeys( nullptr )
-       , _inZyppKeys( nullptr )
+        : _inRpmKeys( nullptr )
+        , _inZyppKeys( nullptr )
       {}
 
       void updateIf( const Edition & rpmKey_r )
       {
-       std::string keyRelease( rpmKey_r.release() );
-       int comp = _release.compare( keyRelease );
-       if ( comp < 0 )
-       {
-         // update to newer release
-         _release.swap( keyRelease );
-         _inRpmKeys  = &rpmKey_r;
-         _inZyppKeys = nullptr;
-         if ( !keyRelease.empty() )
-           DBG << "Old key in Z: gpg-pubkey-" << rpmKey_r.version() << "-" <<  keyRelease << endl;
-       }
-       else if ( comp == 0 )
-       {
-         // stay with this release
-         if ( ! _inRpmKeys )
-           _inRpmKeys = &rpmKey_r;
-       }
-       // else: this is an old release
-       else
-         DBG << "Old key in R: gpg-pubkey-" << rpmKey_r.version() << "-" <<  keyRelease << endl;
+        std::string keyRelease( rpmKey_r.release() );
+        int comp = _release.compare( keyRelease );
+        if ( comp < 0 )
+        {
+          // update to newer release
+          _release.swap( keyRelease );
+          _inRpmKeys  = &rpmKey_r;
+          _inZyppKeys = nullptr;
+          if ( !keyRelease.empty() )
+            DBG << "Old key in Z: gpg-pubkey-" << rpmKey_r.version() << "-" <<  keyRelease << endl;
+        }
+        else if ( comp == 0 )
+        {
+          // stay with this release
+          if ( ! _inRpmKeys )
+            _inRpmKeys = &rpmKey_r;
+        }
+        // else: this is an old release
+        else
+          DBG << "Old key in R: gpg-pubkey-" << rpmKey_r.version() << "-" <<  keyRelease << endl;
       }
 
       void updateIf( const PublicKeyData & zyppKey_r )
       {
-       std::string keyRelease( zyppKey_r.gpgPubkeyRelease() );
-       int comp = _release.compare( keyRelease );
-       if ( comp < 0 )
-       {
-         // update to newer release
-         _release.swap( keyRelease );
-         _inRpmKeys  = nullptr;
-         _inZyppKeys = &zyppKey_r;
-         if ( !keyRelease.empty() )
-           DBG << "Old key in R: gpg-pubkey-" << zyppKey_r.gpgPubkeyVersion() << "-" << keyRelease << endl;
-       }
-       else if ( comp == 0 )
-       {
-         // stay with this release
-         if ( ! _inZyppKeys )
-           _inZyppKeys = &zyppKey_r;
-       }
-       // else: this is an old release
-       else
-         DBG << "Old key in Z: gpg-pubkey-" << zyppKey_r.gpgPubkeyVersion() << "-" << keyRelease << endl;
+        std::string keyRelease( zyppKey_r.gpgPubkeyRelease() );
+        int comp = _release.compare( keyRelease );
+        if ( comp < 0 )
+        {
+          // update to newer release
+          _release.swap( keyRelease );
+          _inRpmKeys  = nullptr;
+          _inZyppKeys = &zyppKey_r;
+          if ( !keyRelease.empty() )
+            DBG << "Old key in R: gpg-pubkey-" << zyppKey_r.gpgPubkeyVersion() << "-" << keyRelease << endl;
+        }
+        else if ( comp == 0 )
+        {
+          // stay with this release
+          if ( ! _inZyppKeys )
+            _inZyppKeys = &zyppKey_r;
+        }
+        // else: this is an old release
+        else
+          DBG << "Old key in Z: gpg-pubkey-" << zyppKey_r.gpgPubkeyVersion() << "-" << keyRelease << endl;
       }
 
       std::string _release;
@@ -564,14 +564,14 @@ namespace
     {
       DBG << "gpg-pubkey-" << (*it).first << "-" << (*it).second._release << " "
           << ( (*it).second._inRpmKeys  ? "R" : "_" )
-         << ( (*it).second._inZyppKeys ? "Z" : "_" ) << endl;
+          << ( (*it).second._inZyppKeys ? "Z" : "_" ) << endl;
       if ( ! (*it).second._inRpmKeys )
       {
-       zyppKeys.push_back( *(*it).second._inZyppKeys );
+        zyppKeys.push_back( *(*it).second._inZyppKeys );
       }
       if ( ! (*it).second._inZyppKeys )
       {
-       rpmKeys.insert( *(*it).second._inRpmKeys );
+        rpmKeys.insert( *(*it).second._inRpmKeys );
       }
     }
     rpmKeys_r.swap( rpmKeys );
@@ -604,9 +604,9 @@ void RpmDb::syncTrustedKeys( SyncTrustedKeyBits mode_r )
     {
       if ( ! rpmKeys.count( keyData.gpgPubkeyEdition() ) )
       {
-       DBG << "Excess key in Z to delete: gpg-pubkey-" << keyData.gpgPubkeyEdition() << endl;
-       getZYpp()->keyRing()->deleteKey( keyData.id(), /*trusted*/true );
-       if ( !dirty ) dirty = true;
+        DBG << "Excess key in Z to delete: gpg-pubkey-" << keyData.gpgPubkeyEdition() << endl;
+        getZYpp()->keyRing()->deleteKey( keyData.id(), /*trusted*/true );
+        if ( !dirty ) dirty = true;
       }
     }
     if ( dirty )
@@ -631,10 +631,10 @@ void RpmDb::syncTrustedKeys( SyncTrustedKeyBits mode_r )
       std::ofstream tmpos( tmpfile.path().c_str() );
       for_( it, rpmKeys.begin(), rpmKeys.end() )
       {
-       // we export the rpm key into a file
-       RpmHeader::constPtr result;
-       getData( "gpg-pubkey", *it, result );
-       tmpos << result->tag_description() << endl;
+        // we export the rpm key into a file
+        RpmHeader::constPtr result;
+        getData( "gpg-pubkey", *it, result );
+        tmpos << result->tag_description() << endl;
       }
     }
     try
@@ -646,10 +646,10 @@ void RpmDb::syncTrustedKeys( SyncTrustedKeyBits mode_r )
       std::set<Edition> missingKeys;
       for ( const Edition & key : rpmKeys )
       {
-       if ( getZYpp()->keyRing()->isKeyTrusted( key.version() ) ) // key.version is the gpgkeys short ID
-         continue;
-       ERR << "Could not import key:" << str::Format("gpg-pubkey-%s") % key << " into zypp keyring (V3 key?)" << endl;
-       missingKeys.insert( key );
+        if ( getZYpp()->keyRing()->isKeyTrusted( key.version() ) ) // key.version is the gpgkeys short ID
+          continue;
+        ERR << "Could not import key:" << str::Format("gpg-pubkey-%s") % key << " into zypp keyring (V3 key?)" << endl;
+        missingKeys.insert( key );
       }
       if ( ! missingKeys.empty() )
         callback::SendReport<KeyRingReport>()->reportNonImportedKeys(missingKeys);
@@ -670,11 +670,11 @@ void RpmDb::syncTrustedKeys( SyncTrustedKeyBits mode_r )
     {
       try
       {
-       importPubkey( getZYpp()->keyRing()->exportTrustedPublicKey( *it ) );
+        importPubkey( getZYpp()->keyRing()->exportTrustedPublicKey( *it ) );
       }
       catch ( const RpmException & exp )
       {
-       ZYPP_CAUGHT( exp );
+        ZYPP_CAUGHT( exp );
       }
     }
   }
@@ -820,8 +820,8 @@ void RpmDb::removePubkey( const PublicKey & pubkey_r )
   {
     if ( (*it).version() == pubkeyVersion )
     {
-       found_edition = it;
-       break;
+        found_edition = it;
+        break;
     }
   }
 
@@ -1138,9 +1138,9 @@ namespace
   };
 
   RpmDb::CheckPackageResult doCheckPackageSig( const Pathname & path_r,                        // rpm file to check
-                                              const Pathname & root_r,                 // target root
-                                              bool  requireGPGSig_r,                   // whether no gpg signature is to be reported
-                                              RpmDb::CheckPackageDetail & detail_r )   // detailed result
+                                               const Pathname & root_r,                        // target root
+                                               bool  requireGPGSig_r,                  // whether no gpg signature is to be reported
+                                               RpmDb::CheckPackageDetail & detail_r )  // detailed result
   {
     PathInfo file( path_r );
     if ( ! file.isFile() )
@@ -1154,7 +1154,7 @@ namespace
     {
       ERR << "Can't open file for reading: " << file << " (" << ::Fstrerror(fd) << ")" << endl;
       if ( fd )
-       ::Fclose( fd );
+        ::Fclose( fd );
       return RpmDb::CHK_ERROR;
     }
     rpmts ts = ::rpmtsCreate();
@@ -1195,9 +1195,9 @@ namespace
       RpmDb::CheckPackageResult lineres = RpmDb::CHK_ERROR;
       if ( line.find( ": OK" ) != std::string::npos )
       {
-       lineres = RpmDb::CHK_OK;
-       if ( line.find( "Signature, key ID" ) == std::string::npos )
-         ++count[RpmDb::CHK_NOSIG];    // Valid but no gpg signature -> CHK_NOSIG
+        lineres = RpmDb::CHK_OK;
+        if ( line.find( "Signature, key ID" ) == std::string::npos )
+          ++count[RpmDb::CHK_NOSIG];   // Valid but no gpg signature -> CHK_NOSIG
       }
       else if ( line.find( ": NOKEY" ) != std::string::npos )
       { lineres = RpmDb::CHK_NOKEY; }
@@ -1232,9 +1232,9 @@ namespace
     {
       if ( count[RpmDb::CHK_OK] == count[RpmDb::CHK_NOSIG]  )
       {
-       detail_r.push_back( RpmDb::CheckPackageDetail::value_type( RpmDb::CHK_NOSIG, std::string("    ")+_("Package is not signed!") ) );
-       if ( requireGPGSig_r )
-         ret = RpmDb::CHK_NOSIG;
+        detail_r.push_back( RpmDb::CheckPackageDetail::value_type( RpmDb::CHK_NOSIG, std::string("    ")+_("Package is not signed!") ) );
+        if ( requireGPGSig_r )
+          ret = RpmDb::CHK_NOSIG;
       }
     }
 
@@ -1728,7 +1728,7 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal
 
     if ( lineno >= MAXRPMMESSAGELINES ) {
       if ( line.find( " scriptlet failed, " ) == std::string::npos )   // always log %script errors
-       continue;
+        continue;
     }
 
     rpmmsg += line+'\n';
@@ -1905,7 +1905,7 @@ void RpmDb::doRemovePackage( const std::string & name_r, RpmInstFlags flags, cal
 
     if ( lineno >= MAXRPMMESSAGELINES ) {
       if ( line.find( " scriptlet failed, " ) == std::string::npos )   // always log %script errors
-       continue;
+        continue;
     }
     rpmmsg += line+'\n';
   }
index 7c1c0a3..cf1ca9e 100644 (file)
@@ -47,7 +47,7 @@ namespace zypp
         RPMINST_NOSIGNATURE     = 0x0080,
         RPMINST_NOUPGRADE       = 0x0100,
         RPMINST_TEST            = 0x0200,
-       RPMINST_NOPOSTTRANS     = 0x0400,
+        RPMINST_NOPOSTTRANS     = 0x0400,
         RPMINST_ALLOWDOWNGRADE  = 0x0800,
         RPMINST_REPLACEFILES    = 0x1000,
         RPMINST_ALLOWUNTRUSTED  = 0x2000,
index c21996e..7d3d0f3 100644 (file)
@@ -38,37 +38,37 @@ int unameToUid(const char * thisUname, uid_t * uid)
     size_t thisUnameLen;
 
     if (!thisUname) {
-       lastUnameLen = 0;
-       return -1;
+        lastUnameLen = 0;
+        return -1;
     } else if (strcmp(thisUname, "root") == 0) {
 /*@-boundswrite@*/
-       *uid = 0;
+        *uid = 0;
 /*@=boundswrite@*/
-       return 0;
+        return 0;
     }
 
     thisUnameLen = strlen(thisUname);
     if (lastUname == NULL || thisUnameLen != lastUnameLen ||
-       strcmp(thisUname, lastUname) != 0)
+        strcmp(thisUname, lastUname) != 0)
     {
-       if (lastUnameAlloced < thisUnameLen + 1) {
-           lastUnameAlloced = thisUnameLen + 10;
-           lastUname = (char *)realloc(lastUname, lastUnameAlloced);   /* XXX memory leak */
-       }
+        if (lastUnameAlloced < thisUnameLen + 1) {
+            lastUnameAlloced = thisUnameLen + 10;
+            lastUname = (char *)realloc(lastUname, lastUnameAlloced);  /* XXX memory leak */
+        }
 /*@-boundswrite@*/
-       strcpy(lastUname, thisUname);
+        strcpy(lastUname, thisUname);
 /*@=boundswrite@*/
 
-       pwent = getpwnam(thisUname);
-       if (pwent == NULL) {
-           /*@-internalglobs@*/ /* FIX: shrug */
-           endpwent();
-           /*@=internalglobs@*/
-           pwent = getpwnam(thisUname);
-           if (pwent == NULL) return -1;
-       }
+        pwent = getpwnam(thisUname);
+        if (pwent == NULL) {
+            /*@-internalglobs@*/ /* FIX: shrug */
+            endpwent();
+            /*@=internalglobs@*/
+            pwent = getpwnam(thisUname);
+            if (pwent == NULL) return -1;
+        }
 
-       lastUid = pwent->pw_uid;
+        lastUid = pwent->pw_uid;
     }
 
 /*@-boundswrite@*/
@@ -88,51 +88,51 @@ int gnameToGid(const char * thisGname, gid_t * gid)
     struct group * grent;
 
     if (thisGname == NULL) {
-       lastGnameLen = 0;
-       return -1;
+        lastGnameLen = 0;
+        return -1;
     } else if (strcmp(thisGname, "root") == 0) {
 /*@-boundswrite@*/
-       *gid = 0;
+        *gid = 0;
 /*@=boundswrite@*/
-       return 0;
+        return 0;
     }
 
     thisGnameLen = strlen(thisGname);
     if (lastGname == NULL || thisGnameLen != lastGnameLen ||
-       strcmp(thisGname, lastGname) != 0)
+        strcmp(thisGname, lastGname) != 0)
     {
-       if (lastGnameAlloced < thisGnameLen + 1) {
-           lastGnameAlloced = thisGnameLen + 10;
-           lastGname = (char *)realloc(lastGname, lastGnameAlloced);   /* XXX memory leak */
-       }
+        if (lastGnameAlloced < thisGnameLen + 1) {
+            lastGnameAlloced = thisGnameLen + 10;
+            lastGname = (char *)realloc(lastGname, lastGnameAlloced);  /* XXX memory leak */
+        }
 /*@-boundswrite@*/
-       strcpy(lastGname, thisGname);
+        strcpy(lastGname, thisGname);
 /*@=boundswrite@*/
 
-       grent = getgrnam(thisGname);
-       if (grent == NULL) {
-           /*@-internalglobs@*/ /* FIX: shrug */
-           endgrent();
-           /*@=internalglobs@*/
-           grent = getgrnam(thisGname);
-           if (grent == NULL) {
-               /* XXX The filesystem package needs group/lock w/o getgrnam. */
-               if (strcmp(thisGname, "lock") == 0) {
+        grent = getgrnam(thisGname);
+        if (grent == NULL) {
+            /*@-internalglobs@*/ /* FIX: shrug */
+            endgrent();
+            /*@=internalglobs@*/
+            grent = getgrnam(thisGname);
+            if (grent == NULL) {
+                /* XXX The filesystem package needs group/lock w/o getgrnam. */
+                if (strcmp(thisGname, "lock") == 0) {
 /*@-boundswrite@*/
-                   *gid = lastGid = 54;
+                    *gid = lastGid = 54;
 /*@=boundswrite@*/
-                   return 0;
-               } else
-               if (strcmp(thisGname, "mail") == 0) {
+                    return 0;
+                } else
+                if (strcmp(thisGname, "mail") == 0) {
 /*@-boundswrite@*/
-                   *gid = lastGid = 12;
+                    *gid = lastGid = 12;
 /*@=boundswrite@*/
-                   return 0;
-               } else
-               return -1;
-           }
-       }
-       lastGid = grent->gr_gid;
+                    return 0;
+                } else
+                return -1;
+            }
+        }
+        lastGid = grent->gr_gid;
     }
 
 /*@-boundswrite@*/
index 05adeb8..077c11b 100644 (file)
@@ -200,8 +200,8 @@ Pathname librpmDb::suggestedDbPath( const Pathname & root_r )
     // If a known dbpath exsists, we continue to use it
     for ( auto p : { "/var/lib/rpm", "/usr/lib/sysimage/rpm" } ) {
       if ( PathInfo( root_r/p, PathInfo::LSTAT/*!no symlink*/ ).isDir() ) {
-       MIL << "Suggest existing database at " << stringPath( root_r, p ) << endl;
-       return p;
+        MIL << "Suggest existing database at " << stringPath( root_r, p ) << endl;
+        return p;
       }
     }
   }
index 76fd49a..e938ceb 100644 (file)
@@ -163,9 +163,9 @@ namespace zypp
       picklist_size_type idx = picklist_size_type(0);
       for ( const auto & pi : picklist() )
       {
-       if ( pi == solv_r )
-         return idx;
-       ++idx;
+        if ( pi == solv_r )
+          return idx;
+        ++idx;
       }
       return picklistNoPos;
     }
index 6cfcd16..4e6f61e 100644 (file)
@@ -104,25 +104,25 @@ namespace zypp
 
         /** highlevel remove transact from non-multiversion packages. */
         bool unsetNonMultiTransact(  const PoolItem & pi_r, Causer causer_r )
-       {
-         ResStatus & status( backup( pi_r ) );
-         if ( status.transacts() && ! pi_r.multiversionInstall() )
-         {
-           if ( ! status.setTransact( false, causer_r ) ) return false;
-         }
-         return true;
-       }
+        {
+          ResStatus & status( backup( pi_r ) );
+          if ( status.transacts() && ! pi_r.multiversionInstall() )
+          {
+            if ( ! status.setTransact( false, causer_r ) ) return false;
+          }
+          return true;
+        }
 
         /** highlevel remove transact from multiversion packages. */
         bool unsetMultiTransact(  const PoolItem & pi_r, Causer causer_r )
-       {
-         ResStatus & status( backup( pi_r ) );
-         if ( status.transacts() && pi_r.multiversionInstall() )
-         {
-           if ( ! status.setTransact( false, causer_r ) ) return false;
-         }
-         return true;
-       }
+        {
+          ResStatus & status( backup( pi_r ) );
+          if ( status.transacts() && pi_r.multiversionInstall() )
+          {
+            if ( ! status.setTransact( false, causer_r ) ) return false;
+          }
+          return true;
+        }
 
         /** Highlevel action. */
         typedef bool (StatusBackup::*Action)( const PoolItem &, Causer );
@@ -336,10 +336,10 @@ namespace zypp
         }
 
       if ( installedObj() && allInstalledLocked() )
-         return S_Protected;
+          return S_Protected;
 
       if ( !installedObj() && allCandidatesLocked() )
-         return S_Taboo;
+          return S_Taboo;
 
       // KEEP state:
       if ( installedObj() )
@@ -359,9 +359,9 @@ namespace zypp
       switch ( state_r )
         {
         case S_Protected:
-           return self.setProtected();
+            return self.setProtected();
         case S_Taboo:
-           return self.setTaboo();
+            return self.setTaboo();
         case S_AutoDel:
         case S_AutoInstall:
         case S_AutoUpdate:
@@ -498,57 +498,57 @@ namespace zypp
           }
           break;
 
-       case S_Install:
-         if ( i.empty() && ! a.empty() )
-         {
-           const PoolItem & cand( pi_r.status().isInstalled() ? *a.begin() : pi_r );
-           if ( cand.multiversionInstall() )
-           {
-             if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetNonMultiTransact, causer_r ) ) return backup.restore();
-             // maybe unlock candidate only?
-             if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore();
-             if ( ! cand.status().setTransact( true, causer_r ) ) return backup.restore();
-             return true;
-           }
-           else
-           {
-             // For non-multiversion use ordinary setStatus
-             // NOTE that S_Update/S_Install here depends on !installedEmpty()
-             // and not on picklists identicalInstalled.
-             if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetMultiTransact, causer_r ) ) return backup.restore();
-             if ( ! setCandidate( cand, causer_r ) )  return backup.restore();
-             if ( ! setStatus( installedEmpty() ? S_Install : S_Update, causer_r ) )  return backup.restore();
-             return true;
-           }
-         }
-         break;
-
-       case S_Update:
-         if ( ! i.empty() && ! a.empty() )
-         {
-           const PoolItem & cand( pi_r.status().isInstalled() ? *a.begin() : pi_r );
-           if ( cand.multiversionInstall() )
-           {
-             if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore();
-             if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::setTransactTrue, ResStatus::SOLVER ) ) return backup.restore();
-             if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetNonMultiTransact, causer_r ) ) return backup.restore();
-             // maybe unlock candidate only?
-             if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore();
-             if ( ! cand.status().setTransact( true, causer_r ) ) return backup.restore();
-             return true;
-           }
-           else
-           {
-             // For non-multiversion use ordinary setStatus
-             // NOTE that S_Update/S_Install here depends on !installedEmpty()
-             // and not on picklists identicalInstalled.
-             if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetMultiTransact, causer_r ) ) return backup.restore();
-             if ( ! setCandidate( cand, causer_r ) )  return backup.restore();
-             if ( ! setStatus( installedEmpty() ? S_Install : S_Update, causer_r ) )  return backup.restore();
-             return true;
-           }
-         }
-         break;
+        case S_Install:
+          if ( i.empty() && ! a.empty() )
+          {
+            const PoolItem & cand( pi_r.status().isInstalled() ? *a.begin() : pi_r );
+            if ( cand.multiversionInstall() )
+            {
+              if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetNonMultiTransact, causer_r ) ) return backup.restore();
+              // maybe unlock candidate only?
+              if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore();
+              if ( ! cand.status().setTransact( true, causer_r ) ) return backup.restore();
+              return true;
+            }
+            else
+            {
+              // For non-multiversion use ordinary setStatus
+              // NOTE that S_Update/S_Install here depends on !installedEmpty()
+              // and not on picklists identicalInstalled.
+              if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetMultiTransact, causer_r ) ) return backup.restore();
+              if ( ! setCandidate( cand, causer_r ) )  return backup.restore();
+              if ( ! setStatus( installedEmpty() ? S_Install : S_Update, causer_r ) )  return backup.restore();
+              return true;
+            }
+          }
+          break;
+
+        case S_Update:
+          if ( ! i.empty() && ! a.empty() )
+          {
+            const PoolItem & cand( pi_r.status().isInstalled() ? *a.begin() : pi_r );
+            if ( cand.multiversionInstall() )
+            {
+              if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore();
+              if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::setTransactTrue, ResStatus::SOLVER ) ) return backup.restore();
+              if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetNonMultiTransact, causer_r ) ) return backup.restore();
+              // maybe unlock candidate only?
+              if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore();
+              if ( ! cand.status().setTransact( true, causer_r ) ) return backup.restore();
+              return true;
+            }
+            else
+            {
+              // For non-multiversion use ordinary setStatus
+              // NOTE that S_Update/S_Install here depends on !installedEmpty()
+              // and not on picklists identicalInstalled.
+              if ( ! backup.forEach( availableBegin(), availableEnd(), &StatusBackup::unsetMultiTransact, causer_r ) ) return backup.restore();
+              if ( ! setCandidate( cand, causer_r ) )  return backup.restore();
+              if ( ! setStatus( installedEmpty() ? S_Install : S_Update, causer_r ) )  return backup.restore();
+              return true;
+            }
+          }
+          break;
 
         case S_KeepInstalled:
           if ( ! i.empty()  )
index ad2f3af..9ff0129 100644 (file)
@@ -110,8 +110,8 @@ namespace zypp
       {
         PoolItem ret( transactingCandidate() );
         if ( ! ret )
-         ret = _candidate ? _candidate : defaultCandidate();
-       return ret;
+          ret = _candidate ? _candidate : defaultCandidate();
+        return ret;
       }
 
       /** Set a userCandidate (out of available objects).
@@ -129,8 +129,8 @@ namespace zypp
       {
         for ( const PoolItem & pi : available() )
         {
-         if ( pi.isBlacklisted() )
-           continue;
+          if ( pi.isBlacklisted() )
+            continue;
           if ( pi.repository() == repo_r )
             return pi;
         }
@@ -145,13 +145,13 @@ namespace zypp
        */
       PoolItem updateCandidateObj() const
       {
-       PoolItem defaultCand( defaultCandidate() );
+        PoolItem defaultCand( defaultCandidate() );
 
-       // multiversionInstall: This returns the candidate for the last
-       // instance installed. Actually we'd need a list here.
+        // multiversionInstall: This returns the candidate for the last
+        // instance installed. Actually we'd need a list here.
 
-       if ( ! defaultCand || defaultCand.isBlacklisted() )
-         return PoolItem();
+        if ( ! defaultCand || defaultCand.isBlacklisted() )
+          return PoolItem();
 
         if ( installedEmpty() )
           return defaultCand;
@@ -180,15 +180,15 @@ namespace zypp
       PoolItem highestAvailableVersionObj() const
       {
         PoolItem ret;
-       bool blacklistedOk = false;
+        bool blacklistedOk = false;
         for ( const PoolItem & pi : available() )
         {
-         if ( !blacklistedOk && pi.isBlacklisted() )
-         {
-           if ( ret )
-             break;    // prefer a not retracted candidate
-           blacklistedOk = true;
-         }
+          if ( !blacklistedOk && pi.isBlacklisted() )
+          {
+            if ( ret )
+              break;   // prefer a not retracted candidate
+            blacklistedOk = true;
+          }
           if ( !ret || pi.edition() > ret.edition() )
             ret = pi;
         }
@@ -311,56 +311,56 @@ namespace zypp
       ////////////////////////////////////////////////////////////////////////
       bool hasBlacklisted() const
       { // Blacklisted items are sorted to the end of the available list.
-       return !_availableItems.empty() && _availableItems.rbegin()->isBlacklisted();
+        return !_availableItems.empty() && _availableItems.rbegin()->isBlacklisted();
       }
 
       bool hasBlacklistedInstalled() const
       { // Blacklisted items may be embedded in the installed list.
-       for ( const PoolItem & pi : installed() ) {
-         if ( pi.isBlacklisted() )
-           return true;
-       }
-       return false;
+        for ( const PoolItem & pi : installed() ) {
+          if ( pi.isBlacklisted() )
+            return true;
+        }
+        return false;
       }
 
       bool hasRetracted() const
       {
-       for ( const PoolItem & pi : makeIterable( _availableItems.rbegin(), _availableItems.rend() ) ) {
-         if ( not pi.isBlacklisted() )
-           break;
-         if ( pi.isRetracted() )
-           return true;
-       }
-       return false;
+        for ( const PoolItem & pi : makeIterable( _availableItems.rbegin(), _availableItems.rend() ) ) {
+          if ( not pi.isBlacklisted() )
+            break;
+          if ( pi.isRetracted() )
+            return true;
+        }
+        return false;
       }
 
       bool hasRetractedInstalled() const
       {
-       for ( const PoolItem & pi : installed() ) {
-         if ( pi.isRetracted() )
-           return true;
-       }
-       return false;
+        for ( const PoolItem & pi : installed() ) {
+          if ( pi.isRetracted() )
+            return true;
+        }
+        return false;
       }
 
       bool hasPtf() const
       {
-       for ( const PoolItem & pi : makeIterable( _availableItems.rbegin(), _availableItems.rend() ) ) {
-         if ( not pi.isBlacklisted() )
-           break;
-         if ( pi.isPtf() )
-           return true;
-       }
-       return false;
+        for ( const PoolItem & pi : makeIterable( _availableItems.rbegin(), _availableItems.rend() ) ) {
+          if ( not pi.isBlacklisted() )
+            break;
+          if ( pi.isPtf() )
+            return true;
+        }
+        return false;
       }
 
       bool hasPtfInstalled() const
       {
-       for ( const PoolItem & pi : installed() ) {
-         if ( pi.isPtf() )
-           return true;
-       }
-       return false;
+        for ( const PoolItem & pi : installed() ) {
+          if ( pi.isPtf() )
+            return true;
+        }
+        return false;
       }
 
 
@@ -369,12 +369,12 @@ namespace zypp
 
       bool multiversionInstall() const
       {
-       for ( const PoolItem & pi : picklist() )
-       {
-         if ( pi.multiversionInstall() )
-           return true;
-       }
-       return false;
+        for ( const PoolItem & pi : picklist() )
+        {
+          if ( pi.multiversionInstall() )
+            return true;
+        }
+        return false;
       }
 
       bool pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r );
@@ -422,17 +422,17 @@ namespace zypp
       /** \copydoc Selectable::hasLocks()const */
       bool hasLocks() const
       {
-       for ( const PoolItem & pi : available() )
-       {
-         if ( pi.status().isLocked() )
-           return true;
-       }
+        for ( const PoolItem & pi : available() )
+        {
+          if ( pi.status().isLocked() )
+            return true;
+        }
         for ( const PoolItem & pi : installed() )
-       {
-         if ( pi.status().isLocked() )
-           return true;
-       }
-       return false;
+        {
+          if ( pi.status().isLocked() )
+            return true;
+        }
+        return false;
       }
 
     private:
index dbfd345..8aaf87e 100644 (file)
@@ -50,8 +50,8 @@ namespace zypp
         //
         bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const
         {
-         if ( lhs.isBlacklisted() != rhs.isBlacklisted() )
-           return rhs.isBlacklisted();
+          if ( lhs.isBlacklisted() != rhs.isBlacklisted() )
+            return rhs.isBlacklisted();
 
           int lprio = lhs->satSolvable().repository().satInternalPriority();
           int rprio = rhs->satSolvable().repository().satInternalPriority();
@@ -70,9 +70,9 @@ namespace zypp
           if ( res )
             return res > 0;
 
-         lprio = lhs->buildtime();
-         rprio = rhs->buildtime();
-         if ( lprio != rprio )
+          lprio = lhs->buildtime();
+          rprio = rhs->buildtime();
+          if ( lprio != rprio )
             return( lprio > rprio );
 
           lprio = lhs->satSolvable().repository().satInternalSubPriority();
index 8536725..50dfb7c 100644 (file)
@@ -34,64 +34,64 @@ namespace zypp
 {
     namespace ui
     {
-       typedef ResPoolProxy::const_iterator    PoolProxyIterator;
+        typedef ResPoolProxy::const_iterator   PoolProxyIterator;
 
         static inline ResPoolProxy             poolProxy()     { return getZYpp()->poolProxy();        }
 
-       template<class T> PoolProxyIterator poolProxyBegin()    { return poolProxy().byKindBegin<T>();  }
-       template<class T> PoolProxyIterator poolProxyEnd()      { return poolProxy().byKindEnd<T>();    }
+        template<class T> PoolProxyIterator poolProxyBegin()   { return poolProxy().byKindBegin<T>();  }
+        template<class T> PoolProxyIterator poolProxyEnd()     { return poolProxy().byKindEnd<T>();    }
 
-       static inline PoolProxyIterator pkgBegin()              { return poolProxyBegin<Package>();     }
-       static inline PoolProxyIterator pkgEnd()                { return poolProxyEnd<Package>();       }
+        static inline PoolProxyIterator pkgBegin()             { return poolProxyBegin<Package>();     }
+        static inline PoolProxyIterator pkgEnd()               { return poolProxyEnd<Package>();       }
 
-       static inline PoolProxyIterator patchesBegin()          { return poolProxyBegin<Patch>();       }
-       static inline PoolProxyIterator patchesEnd()            { return poolProxyEnd<Patch>();         }
+        static inline PoolProxyIterator patchesBegin()         { return poolProxyBegin<Patch>();       }
+        static inline PoolProxyIterator patchesEnd()           { return poolProxyEnd<Patch>();         }
 
-       template<typename T> bool contains( const std::set<T> & container, T search )
-       {
-           return container.find( search ) != container.end();
-       }
+        template<typename T> bool contains( const std::set<T> & container, T search )
+        {
+            return container.find( search ) != container.end();
+        }
 
 
 
-       static void addDirectlySelectedPackages ( set<string> & pkgNames );
+        static void addDirectlySelectedPackages        ( set<string> & pkgNames );
         template<class PkgSet_T> void addPkgSetPackages( set<string> & pkgNames );
 
-       static void addPatchPackages            ( set<string> & pkgNames );
+        static void addPatchPackages           ( set<string> & pkgNames );
 
 
 
-       set<string> userWantedPackageNames()
-       {
-           set<string> pkgNames;
+        set<string> userWantedPackageNames()
+        {
+            set<string> pkgNames;
 
-           DBG << "Collecting packages the user explicitly asked for" << endl;
+            DBG << "Collecting packages the user explicitly asked for" << endl;
 
-           addDirectlySelectedPackages ( pkgNames );
-           addPatchPackages            ( pkgNames );
+            addDirectlySelectedPackages        ( pkgNames );
+            addPatchPackages           ( pkgNames );
 
-           return pkgNames;
-       }
+            return pkgNames;
+        }
 
 
 
-       static void addDirectlySelectedPackages( set<string> & pkgNames )
-       {
-           for ( PoolProxyIterator it = pkgBegin();
-                 it != pkgEnd();
-                 ++it )
-           {
-               // Add all packages the user wanted to transact directly,
-               // no matter what the transaction is (install, update, delete)
+        static void addDirectlySelectedPackages( set<string> & pkgNames )
+        {
+            for ( PoolProxyIterator it = pkgBegin();
+                  it != pkgEnd();
+                  ++it )
+            {
+                // Add all packages the user wanted to transact directly,
+                // no matter what the transaction is (install, update, delete)
 
-               if ( (*it)->toModify() && (*it)->modifiedBy() == ResStatus::USER )
-               {
-                   DBG << "Explicit user transaction on pkg \"" << (*it)->name() << "\"" << endl;
+                if ( (*it)->toModify() && (*it)->modifiedBy() == ResStatus::USER )
+                {
+                    DBG << "Explicit user transaction on pkg \"" << (*it)->name() << "\"" << endl;
 
-                   pkgNames.insert( (*it)->name() );
-               }
-           }
-       }
+                    pkgNames.insert( (*it)->name() );
+                }
+            }
+        }
 
 
         static void addPatchPackages( set<string> & pkgNames )
@@ -103,18 +103,18 @@ namespace zypp
                 Patch::constPtr patch = dynamic_pointer_cast<const Patch>( (*patch_it)->theObj() ? (*patch_it)->theObj().resolvable() : 0 );
 
                 if ( patch && (*patch_it)->toModify() )
-               {
-                   DBG << "Patch will be transacted: \"" << patch->name()
-                       << "\" - \"" << patch->summary() << "\"" << endl;
+                {
+                    DBG << "Patch will be transacted: \"" << patch->name()
+                        << "\" - \"" << patch->summary() << "\"" << endl;
 
                     Patch::Contents contents( patch->contents() );
                     for_( it, contents.begin(), contents.end() )
                     {
                       pkgNames.insert( it->name() );
                     }
-               }
-           }
-       }
+                }
+            }
+        }
 
     } // namespace ui
 } // namespace zypp
index 6f8709a..9df54b0 100644 (file)
@@ -22,22 +22,22 @@ namespace zypp
 {
     namespace ui
     {
-       /**
-        * This returns a set of package names the user explicitly wanted to
-        * transact ( to install, to update, or to delete) for any of the
-        * following reasons:
-        *
-        * - The user wanted to transact the pkg directly
-        *
-        * - Pkg is part of a pattern   the user wanted to transact
-        * - Pkg is part of a language  the user wanted to transact
+        /**
+         * This returns a set of package names the user explicitly wanted to
+         * transact ( to install, to update, or to delete) for any of the
+         * following reasons:
+         *
+         * - The user wanted to transact the pkg directly
+         *
+         * - Pkg is part of a pattern   the user wanted to transact
+         * - Pkg is part of a language  the user wanted to transact
          *   (? No more transacting Languages)
-        * - Pkg is part of a patch     the user wanted to transact
-        *
-        * - Pkg is part of a pattern that is required by a pattern the
-        *   user wanted to transact
-        **/
-       std::set<std::string> userWantedPackageNames();
+         * - Pkg is part of a patch     the user wanted to transact
+         *
+         * - Pkg is part of a pattern that is required by a pattern the
+         *   user wanted to transact
+         **/
+        std::set<std::string> userWantedPackageNames();
 
     } // namespace ui
 } // namespace zypp
index 6f45cff..c74c45f 100644 (file)
@@ -40,9 +40,9 @@ namespace zypp
       static weak_ptr<callback::TempConnect<media::MediaChangeReport> > globalguard;
       if ( condition_r && ! (_guard = globalguard.lock()) )
       {
-       // aquire a new one....
-       _guard.reset( new callback::TempConnect<media::MediaChangeReport>() );
-       globalguard = _guard;
+        // aquire a new one....
+        _guard.reset( new callback::TempConnect<media::MediaChangeReport>() );
+        globalguard = _guard;
       }
     }
   } // namespace media
@@ -114,7 +114,7 @@ namespace zypp
     Target_Ptr ZYppImpl::target() const
     {
       if (! _target)
-       ZYPP_THROW(Exception("Target not initialized."));
+        ZYPP_THROW(Exception("Target not initialized."));
       return _target;
      }
 
@@ -156,13 +156,13 @@ namespace zypp
 
       MIL << "Attempt to commit (" << policy_r << ")" << endl;
       if (! _target)
-       ZYPP_THROW( Exception("Target not initialized.") );
+        ZYPP_THROW( Exception("Target not initialized.") );
 
 
       env::ScopedSet ea { "ZYPP_IS_RUNNING", str::numstring(getpid()).c_str() };
       env::ScopedSet eb;
       if ( _target->chrooted() )
-       eb = env::ScopedSet( "SYSTEMD_OFFLINE", "1" );  // bsc#1118758 - indicate no systemd if chrooted install
+        eb = env::ScopedSet( "SYSTEMD_OFFLINE", "1" ); // bsc#1118758 - indicate no systemd if chrooted install
 
       ZYppCommitResult res = _target->_pimpl->commit( pool(), policy_r );
 
index 2bb1ce0..011ca5e 100644 (file)
@@ -401,8 +401,8 @@ namespace zyppng {
 
   MediaNetwork::MediaNetwork( const Url & url_r, const zypp::Pathname & attach_point_hint_r )
   : MediaNetworkCommonHandler( url_r, attach_point_hint_r,
-                              "/", // urlpath at attachpoint
-                              true ) // does_download
+                               "/", // urlpath at attachpoint
+                               true ) // does_download
   {
     _workingDir.autoCleanup( true );
 
index 1bc73b2..7dcf10e 100644 (file)
@@ -157,10 +157,10 @@ void NetworkRequestDispatcherPrivate::onSocketActivated( const SocketNotifier &l
 void NetworkRequestDispatcherPrivate::handleMultiSocketAction(curl_socket_t nativeSocket, int evBitmask)
 {
   int running = 0;
-  
-  // when inside a curl callback we can not call another multi curl API, 
-  // for now just lock the thing, but we should consider rewriting this 
-  // to post events instead of doing direct calls simply to decouple from 
+
+  // when inside a curl callback we can not call another multi curl API,
+  // for now just lock the thing, but we should consider rewriting this
+  // to post events instead of doing direct calls simply to decouple from
   // that limitation
   CURLMcode rc = CURLM_OK;
   {
@@ -177,7 +177,7 @@ void NetworkRequestDispatcherPrivate::handleMultiSocketAction(curl_socket_t nati
     _sigError.emit( *z_func() );
     return;
   }
-  
+
   // make sure we dequeue pending requests ( in case a call to dequeue was blocked during the API call )
   zypp::OnScopeExit scopeFinally([this](){
     this->dequeuePending();
index f5ccb3e..d9a74e3 100644 (file)
@@ -291,7 +291,7 @@ namespace zyppng {
     if ( req->_myMirror )
       req->_myMirror->startTransfer();
   }
+
   bool RangeDownloaderBaseState::assertExpectedFilesize( off_t currentFilesize )
   {
     const off_t expFSize = stateMachine()._spec.expectedFileSize();
index d67a318..09e02c6 100644 (file)
@@ -291,10 +291,10 @@ namespace zyppng {
       {
 #if CURLVERSION_AT_LEAST(7,19,4)
         // restrict following of redirections from https to https only
-       if ( _url.getHost() == "download.opensuse.org" )
-         setCurlOption( CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
-       else
-         setCurlOption( CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS );
+        if ( _url.getHost() == "download.opensuse.org" )
+          setCurlOption( CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
+        else
+          setCurlOption( CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS );
 #endif
 
         if( locSet.verifyPeerEnabled() ||