Mailinglist Archive: zypp-commit (233 mails)

< Previous Next >
[zypp-commit] <libzypp> master : Allow scripts and messages also to be named 'n-v-r', not just 'n-v-r-*'
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Mon, 23 Nov 2009 11:33:18 +0100
  • Message-id: <E1NCWEX-00070e-W1@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit bdb849d084faba43f39b01ef66b5fb1f88b3e90a
Author: Michael Andres <ma@xxxxxxx>
Date: Mon Nov 23 11:33:18 2009 +0100

Allow scripts and messages also to be named 'n-v-r', not just 'n-v-r-*'
---
zypp/target/TargetImpl.cc | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc
index 87c1bbe..5ebd361 100644
--- a/zypp/target/TargetImpl.cc
+++ b/zypp/target/TargetImpl.cc
@@ -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;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages