std::string Target::distributionVersion() const
{ return _pimpl->distributionVersion(); }
+ Product::constPtr Target::baseProduct() const
+ { return _pimpl->baseProduct(); }
+
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#include "zypp/base/PtrTypes.h"
#include "zypp/base/Deprecated.h"
+#include "zypp/Product.h"
#include "zypp/Pathname.h"
#include "zypp/ResPool.h"
/** return the last modification date of the target */
Date timestamp() const;
+ /**
+ * returns the target base installed product, also known as
+ * the distribution or platform.
+ *
+ * returns 0 if there is no base installed product in the
+ * pool.
+ *
+ * \note this method requires the target to be loaded,
+ * otherwise it will return 0 as no product is found.
+ *
+ * if you require some base product attributes when the
+ * target is not loaded into the pool, see
+ * \ref targetDistribution , \ref targetDistributionRelease
+ * and \ref distributionVersion that obtain the data
+ * on demand from the installed product information.
+ */
+ Product::constPtr baseProduct() const;
+
/** \name Base product and registration. */
//@{
/** The targets distribution release string (/etc/SuSE-release)
return false;
}
-const char *const MediaAria2c::anonymousIdHeader()
+static const char *const anonymousIdHeader()
{
// we need to add the release and identifier to the
// agent string.
// add the anonymous id.
_args.push_back(str::form("--header=%s", anonymousIdHeader() ));
-
// TODO add debug option
// Transfer timeout
protected:
- /** The user agent string */
static const char *const agentString();
- /** anonymous id header used to count unique users */
- static const char *const anonymousIdHeader();
private:
Pathname MediaCurl::_cookieFile = "/var/lib/YaST2/cookies";
-const char *const MediaCurl::anonymousIdHeader()
+static const char *const anonymousIdHeader()
{
// we need to add the release and identifier to the
// agent string.
);
return _value.c_str();
}
-
-const char *const MediaCurl::agentString()
+
+static const char *const agentString()
{
// we need to add the release and identifier to the
// agent string.
// now add the anonymous id header
_customHeaders = curl_slist_append(_customHeaders, anonymousIdHeader());
+
ret = curl_easy_setopt ( _curl, CURLOPT_HTTPHEADER, _customHeaders );
if ( ret != 0) {
static int progressCallback( void *clientp, double dltotal, double dlnow,
double ultotal, double ulnow );
-
- /** The user agent string */
- static const char *const agentString();
-
- /** anonymous id header used to count unique users */
- static const char *const anonymousIdHeader();
-
private:
/**
* Return a comma separated list of available authentication methods
}
}
+ Product::constPtr TargetImpl::baseProduct() const
+ {
+ ResPool pool(ResPool::instance());
+ for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
+ {
+ Product::constPtr p = asKind<Product>((*it).resolvable());
+ if ( p && (*it).status().isInstalled() )
+ {
+ if ( p->isTargetDistribution() )
+ return p;
+ }
+ }
+
+ return 0L;
+ }
+
std::string TargetImpl::targetDistribution() const
{ return rpmdb2solvAttr( "register.target", _root ); }
/** return the last modification date of the target */
Date timestamp() const;
+ /** \copydoc Target::baseProduct() */
+ Product::constPtr baseProduct() const;
+
/** \copydoc Target::release() */
std::string release() const;