Allow scripts and messages also to be named 'n-v-r', not just 'n-v-r-*'
authorMichael Andres <ma@suse.de>
Mon, 23 Nov 2009 10:33:18 +0000 (11:33 +0100)
committerMichael Andres <ma@suse.de>
Mon, 23 Nov 2009 10:33:18 +0000 (11:33 +0100)
zypp/target/TargetImpl.cc

index 87c1bbe..5ebd361 100644 (file)
@@ -223,10 +223,12 @@ namespace zypp
 
         // Now collect and execute all matching scripts.
         // On ABORT: at least log all outstanding scripts.
+        // - "name-version-release"
+        // - "name-version-release-*"
         bool abort = false;
         for_( it, checkPackages_r.begin(), checkPackages_r.end() )
         {
-          std::string prefix( str::form( "%s-%s-", it->name().c_str(), it->edition().c_str() ) );
+          std::string prefix( str::form( "%s-%s", it->name().c_str(), it->edition().c_str() ) );
           for_( sit, scripts.begin(), scripts.end() )
           {
             if ( ! str::hasPrefix( *sit, prefix ) )
@@ -236,6 +238,9 @@ namespace zypp
             if ( ! script.isFile() )
               continue;
 
+            if ( (*sit)[prefix.size()] != '\0' && (*sit)[prefix.size()] != '-' )
+              continue; // if not exact match it had to continue with '-'
+
             if ( abort || aborting_r )
             {
               WAR << "Aborting: Skip update script " << *sit << endl;
@@ -418,15 +423,20 @@ namespace zypp
           return; // no messages in message dir
 
         // Now collect all matching messages in result and send them
+        // - "name-version-release"
+        // - "name-version-release-*"
         HistoryLog historylog;
         for_( it, checkPackages_r.begin(), checkPackages_r.end() )
         {
-          std::string prefix( str::form( "%s-%s-", it->name().c_str(), it->edition().c_str() ) );
+          std::string prefix( str::form( "%s-%s", it->name().c_str(), it->edition().c_str() ) );
           for_( sit, messages.begin(), messages.end() )
           {
             if ( ! str::hasPrefix( *sit, prefix ) )
               continue;
 
+            if ( (*sit)[prefix.size()] != '\0' && (*sit)[prefix.size()] != '-' )
+              continue; // if not exact match it had to continue with '-'
+
             PathInfo message( messagesDir / *sit );
             if ( ! message.isFile() || message.size() == 0 )
               continue;