Try to send statistics even if the target is not initialized when downloading.
authorMichael Andres <ma@suse.de>
Wed, 7 Oct 2009 12:05:57 +0000 (14:05 +0200)
committerMichael Andres <ma@suse.de>
Wed, 7 Oct 2009 12:05:57 +0000 (14:05 +0200)
zypp/media/MediaAria2c.cc
zypp/media/MediaCurl.cc

index 9c48874..b7edd9c 100644 (file)
@@ -193,7 +193,7 @@ const char *const MediaAria2c::agentString()
        "ZYpp %s (%s) %s"
        , VERSION
        , MediaAria2c::_aria2cVersion.c_str()
-       , target ? target->targetDistribution().c_str() : ""
+       , Target::targetDistribution( Pathname()/*guess root*/ ).c_str()
     )
   );
   return _value.c_str();
index 229f01f..ee6e211 100644 (file)
@@ -317,13 +317,11 @@ static const char *const anonymousIdHeader()
   // we need to add the release and identifier to the
   // agent string.
   // The target could be not initialized, and then this information
-  // is not available.
-  Target_Ptr target = zypp::getZYpp()->getTarget();
-
+  // is guessed.
   static const std::string _value(
       str::trim( str::form(
           "X-ZYpp-AnonymousId: %s",
-          target ? target->anonymousUniqueId().c_str() : "" ) )
+          Target::anonymousUniqueId( Pathname()/*guess root*/ ).c_str() ) )
   );
   return _value.c_str();
 }
@@ -337,13 +335,11 @@ static const char *const distributionFlavorHeader()
   // we need to add the release and identifier to the
   // agent string.
   // The target could be not initialized, and then this information
-  // is not available.
-  Target_Ptr target = zypp::getZYpp()->getTarget();
-
+  // is guessed.
   static const std::string _value(
       str::trim( str::form(
           "X-ZYpp-DistributionFlavor: %s",
-          target ? target->distributionFlavor().c_str() : "" ) )
+          Target::distributionFlavor( Pathname()/*guess root*/ ).c_str() ) )
   );
   return _value.c_str();
 }
@@ -357,15 +353,13 @@ static const char *const agentString()
   // we need to add the release and identifier to the
   // agent string.
   // The target could be not initialized, and then this information
-  // is not available.
-  Target_Ptr target = zypp::getZYpp()->getTarget();
-
+  // is guessed.
   static const std::string _value(
     str::form(
        "ZYpp %s (curl %s) %s"
        , VERSION
        , curl_version_info(CURLVERSION_NOW)->version
-       , target ? target->targetDistribution().c_str() : ""
+       , Target::targetDistribution( Pathname()/*guess root*/ ).c_str()
     )
   );
   return _value.c_str();