Hello community,
here is the log from the commit of package yast2-pkg-bindings for
openSUSE:Factory checked in at 2015-10-20 16:20:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-pkg-bindings (Old)
and /work/SRC/openSUSE:Factory/.yast2-pkg-bindings.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-pkg-bindings"
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-pkg-bindings/yast2-pkg-bindings.changes
2015-08-29 20:02:01.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.yast2-pkg-bindings.new/yast2-pkg-bindings.changes
2015-10-20 16:20:51.000000000 +0200
@@ -1,0 +2,13 @@
+Thu Oct 8 21:07:44 UTC 2015 - [email protected]
+
+- Add pkgGpgCheck callback (bsc#948608)
+- 3.1.31
+
+-------------------------------------------------------------------
+Mon Oct 5 14:00:31 UTC 2015 - [email protected]
+
+- Added Pkg::SourceRawURL() and Pkg:ExpandedUrl() to deal with
+ repositories including repo variables (bnc#944505)
+- 3.1.30
+
+-------------------------------------------------------------------
Old:
----
yast2-pkg-bindings-3.1.29.tar.bz2
New:
----
yast2-pkg-bindings-3.1.31.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.uK6EBS/_old 2015-10-20 16:20:52.000000000 +0200
+++ /var/tmp/diff_new_pack.uK6EBS/_new 2015-10-20 16:20:52.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-pkg-bindings-devel-doc
-Version: 3.1.29
+Version: 3.1.31
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: yast2-pkg-bindings-%{version}.tar.bz2
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.uK6EBS/_old 2015-10-20 16:20:52.000000000 +0200
+++ /var/tmp/diff_new_pack.uK6EBS/_new 2015-10-20 16:20:52.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-pkg-bindings
-Version: 3.1.29
+Version: 3.1.31
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-pkg-bindings-3.1.29.tar.bz2 -> yast2-pkg-bindings-3.1.31.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-pkg-bindings-3.1.29/package/yast2-pkg-bindings-devel-doc.spec
new/yast2-pkg-bindings-3.1.31/package/yast2-pkg-bindings-devel-doc.spec
--- old/yast2-pkg-bindings-3.1.29/package/yast2-pkg-bindings-devel-doc.spec
2015-08-27 14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/package/yast2-pkg-bindings-devel-doc.spec
2015-10-09 09:40:10.000000000 +0200
@@ -16,7 +16,7 @@
#
Name: yast2-pkg-bindings-devel-doc
-Version: 3.1.29
+Version: 3.1.31
Release: 0
License: GPL-2.0
Group: Documentation/HTML
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-pkg-bindings-3.1.29/package/yast2-pkg-bindings.changes
new/yast2-pkg-bindings-3.1.31/package/yast2-pkg-bindings.changes
--- old/yast2-pkg-bindings-3.1.29/package/yast2-pkg-bindings.changes
2015-08-27 14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/package/yast2-pkg-bindings.changes
2015-10-09 09:40:10.000000000 +0200
@@ -1,4 +1,17 @@
-------------------------------------------------------------------
+Thu Oct 8 21:07:44 UTC 2015 - [email protected]
+
+- Add pkgGpgCheck callback (bsc#948608)
+- 3.1.31
+
+-------------------------------------------------------------------
+Mon Oct 5 14:00:31 UTC 2015 - [email protected]
+
+- Added Pkg::SourceRawURL() and Pkg:ExpandedUrl() to deal with
+ repositories including repo variables (bnc#944505)
+- 3.1.30
+
+-------------------------------------------------------------------
Thu Aug 27 11:39:14 UTC 2015 - [email protected]
- Pkg::SourceGeneralData() - return also the raw URL (without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-pkg-bindings-3.1.29/package/yast2-pkg-bindings.spec
new/yast2-pkg-bindings-3.1.31/package/yast2-pkg-bindings.spec
--- old/yast2-pkg-bindings-3.1.29/package/yast2-pkg-bindings.spec
2015-08-27 14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/package/yast2-pkg-bindings.spec
2015-10-09 09:40:10.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-pkg-bindings
-Version: 3.1.29
+Version: 3.1.31
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Callbacks.YCP.h
new/yast2-pkg-bindings-3.1.31/src/Callbacks.YCP.h
--- old/yast2-pkg-bindings-3.1.29/src/Callbacks.YCP.h 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Callbacks.YCP.h 2015-10-09
09:40:10.000000000 +0200
@@ -78,7 +78,7 @@
CB_StartSourceRefresh, CB_ErrorSourceRefresh, CB_DoneSourceRefresh,
CB_ProgressSourceRefresh,
CB_StartDeltaDownload, CB_ProgressDeltaDownload, CB_ProblemDeltaDownload,
CB_StartDeltaApply, CB_ProgressDeltaApply, CB_ProblemDeltaApply,
- CB_FinishDeltaDownload, CB_FinishDeltaApply,
+ CB_FinishDeltaDownload, CB_FinishDeltaApply, CB_PkgGpgCheck,
CB_StartDownload, CB_ProgressDownload, CB_DoneDownload, CB_InitDownload,
CB_DestDownload,
CB_FileConflictStart, CB_FileConflictProgress, CB_FileConflictReport,
CB_FileConflictFinish,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Callbacks.cc
new/yast2-pkg-bindings-3.1.31/src/Callbacks.cc
--- old/yast2-pkg-bindings-3.1.29/src/Callbacks.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Callbacks.cc 2015-10-09
09:40:10.000000000 +0200
@@ -39,6 +39,8 @@
#include "zypp/Digest.h"
#include "zypp/base/String.h"
#include "zypp/sat/FileConflicts.h"
+#include "zypp/UserData.h"
+#include "zypp/target/rpm/RpmDb.h"
#include <ctime>
@@ -705,6 +707,61 @@
callback.evaluate();
}
}
+
+ ///////////////////////////////////////////////////////////////////
+ // pkgGpgCheck callback
+ //
+ // A map containing the following information will be sent:
+ //
+ // * CheckPackageResult: Check result code.
+ // * Package: Package's name.
+ // * Localpath: Path to RPM file.
+ // * RepoMediaUrl: Repository URL
+ //
+ // It will set userData_r "Action" key according to value returned
+ // by callback.
+ ///////////////////////////////////////////////////////////////////
+ virtual void pkgGpgCheck(const UserData & userData_r = UserData() )
+ {
+ typedef zypp::target::rpm::RpmDb RpmDb;
+ CB callback( ycpcb( YCPCallbacks::CB_PkgGpgCheck ) );
+ YCPMap data;
+
+ if (callback._set) {
+ // Package
+ const zypp::Package::constPtr & package_r =
userData_r.get<zypp::Package::constPtr>("Package");
+ YCPString package = userData_r.get<std::string>("Package",
package_r->name());
+ data->add(YCPString("Package"), package);
+
+ const zypp::RepoInfo repo = package_r->repoInfo();
+ const std::string url = repo.rawUrl().asString();
+ data->add(YCPString("RepoMediaUrl"), YCPString(url));
+
+ // Localpath
+ zypp::Pathname localpath = userData_r.get<zypp::Pathname>("Localpath");
+ data->add(YCPString("Localpath"), YCPString(localpath.asString()));
+
+ // Result
+ YCPInteger checkPackageResult =
userData_r.get<RpmDb::CheckPackageResult>("CheckPackageResult");
+ data->add(YCPString("CheckPackageResult"), checkPackageResult);
+
+ callback.addMap(data);
+
+ std::string ret = callback.evaluateStr();
+
+ if (ret == "A") { // "A" = Abort
+ userData_r.set("Action",
zypp::repo::DownloadResolvableReport::ABORT);
+ }
+
+ if (ret == "I") { // "I" = Ignore
+ userData_r.set("Action",
zypp::repo::DownloadResolvableReport::IGNORE);
+ }
+
+ if (ret == "R") { // "R" = Retry
+ userData_r.set("Action",
zypp::repo::DownloadResolvableReport::RETRY);
+ }
+ }
+ }
};
///////////////////////////////////////////////////////////////////
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Callbacks_Register.cc
new/yast2-pkg-bindings-3.1.31/src/Callbacks_Register.cc
--- old/yast2-pkg-bindings-3.1.29/src/Callbacks_Register.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Callbacks_Register.cc 2015-10-09
09:40:10.000000000 +0200
@@ -78,7 +78,7 @@
/**
* @builtin CallbackAcceptUnknownGpgKey
* @short Register callback function
- * @param string args Name of the callback handler function. Required callback
prototype is <code>boolean(string filename, string keyid)</code>. The callback
function should ask user whether the unknown key can be accepted, returned true
value means to accept the key.
+ * @param string args Name of the callback handler function. Required callback
prototype is <code>boolean(string filename, string keyid)</code>. The callback
function should ask user whether the unknown key can be accepted, returned true
value means to accept the key.
* @return void
*/
YCPValue PkgFunctions::CallbackAcceptUnknownGpgKey( const YCPValue& args ) {
@@ -324,6 +324,17 @@
}
/**
+ * @builtin CallbackPkgGpgCheck
+ * @short Register callback function
+ * @param string args Name of the callback handler function. Required callback
prototype is <code>void()</code>. The callback function is evaluated when a
package GPG signature is checked.
+ * @return void
+ */
+YCPValue PkgFunctions::CallbackPkgGpgCheck( const YCPValue& args)
+{
+ return SET_YCP_CB( CB_PkgGpgCheck, args);
+}
+
+/**
* @builtin CallbackSourceCreateStart
* @short Register callback function
* @param string args Name of the callback handler function. Required callback
prototype is <code>void(string url)</code>. The callback is evaluated when a
source creation has been started.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Package.cc
new/yast2-pkg-bindings-3.1.31/src/Package.cc
--- old/yast2-pkg-bindings-3.1.29/src/Package.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Package.cc 2015-10-09
09:40:10.000000000 +0200
@@ -119,7 +119,7 @@
zypp::PoolItem provider = zypp::ResPool::instance().find(*iter);
// cast to Package object
- zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const
zypp::Package>(provider.resolvable());
+ zypp::Package::constPtr package =
zypp::asKind<zypp::Package>(provider.resolvable());
if (!package)
{
@@ -312,7 +312,7 @@
{
if ((*it)->fate() == zypp::ui::Selectable::TO_INSTALL)
{
- zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const
zypp::Package>((*it)->candidateObj().resolvable());
+ zypp::Package::constPtr pkg =
zypp::asKind<zypp::Package>((*it)->candidateObj().resolvable());
if (!pkg)
continue;
@@ -731,7 +731,7 @@
if (s)
{
- return zypp::dynamic_pointer_cast<const
zypp::Package>(s->theObj().resolvable());
+ return zypp::asKind<zypp::Package>(s->theObj().resolvable());
}
return NULL;
@@ -870,7 +870,7 @@
{
YCPMap data;
- zypp::Package::constPtr pkg = zypp::dynamic_pointer_cast<const
zypp::Package>(item.resolvable());
+ zypp::Package::constPtr pkg =
zypp::asKind<zypp::Package>(item.resolvable());
if (pkg == NULL) {
y2error("NULL pkg");
@@ -1040,7 +1040,7 @@
// a helper function
YCPList _create_filelist(const zypp::PoolItem &pi)
{
- zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const
zypp::Package>(pi.resolvable());
+ zypp::Package::constPtr package =
zypp::asKind<zypp::Package>(pi.resolvable());
YCPList ret;
@@ -1281,7 +1281,7 @@
static void
pkg2list (YCPList &list, const zypp::PoolItem &item, bool names_only)
{
- zypp::Package::constPtr pkg = zypp::dynamic_pointer_cast<const
zypp::Package>(item.resolvable());
+ zypp::Package::constPtr pkg =
zypp::asKind<zypp::Package>(item.resolvable());
if (!pkg)
{
@@ -2625,7 +2625,7 @@
if (s && s->toInstall() && !s->hasLicenceConfirmed())
{
- zypp::Package::constPtr package =
zypp::dynamic_pointer_cast<const zypp::Package>(s->candidateObj().resolvable());
+ zypp::Package::constPtr package =
zypp::asKind<zypp::Package>(s->candidateObj().resolvable());
if (package)
{
return YCPString(package->licenseToConfirm());
@@ -2758,8 +2758,7 @@
res->arch() == base_product->arch)
{
- zypp::Product::constPtr product =
- boost::dynamic_pointer_cast<const zypp::Product>(res);
+ zypp::Product::constPtr product = res->asKind<zypp::Product>();
if (product)
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/PkgFunctions.cc
new/yast2-pkg-bindings-3.1.31/src/PkgFunctions.cc
--- old/yast2-pkg-bindings-3.1.29/src/PkgFunctions.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/PkgFunctions.cc 2015-10-09
09:40:10.000000000 +0200
@@ -501,3 +501,21 @@
return new_target;
}
+
+/**
+ * @builtin ExpandedUrl
+ * @short expands the repo variables in the given zypper URL
+ * @return string copy of url with the variables expanded to the current value
+ */
+YCPValue PkgFunctions::ExpandedUrl(const YCPString &url)
+{
+ if (url.isNull())
+ {
+ y2error("URL is nil");
+ return YCPVoid();
+ }
+
+ zypp::RepoVariablesReplacedUrl replacedUrl;
+ replacedUrl.raw() = zypp::Url(url->asString()->value());
+ return YCPString(replacedUrl.transformed().asString());
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/PkgFunctions.h
new/yast2-pkg-bindings-3.1.31/src/PkgFunctions.h
--- old/yast2-pkg-bindings-3.1.29/src/PkgFunctions.h 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/PkgFunctions.h 2015-10-09
09:40:10.000000000 +0200
@@ -83,7 +83,7 @@
zypp::Pathname _target_root;
bool _target_loaded;
-
+
zypp::ZYpp::Ptr zypp_pointer;
// use a single RepoManager instance to avoid "unused" metadata cleanup
@@ -96,7 +96,7 @@
zypp::Pathname _download_area;
- /**
+ /**
* ZYPP
*/
zypp::ZYpp::Ptr zypp_ptr();
@@ -113,13 +113,13 @@
RepoId current_repo_id() const { return current_repo; }
private: // source related
-
+
// all known installation sources
RepoCont repos;
// table for converting libzypp source type to Yast type (for backward
compatibility)
std::map<std::string, std::string> type_conversion_table;
-
+
// flag for skipping autorefresh
volatile bool autorefresh_skipped;
@@ -164,7 +164,7 @@
YCPValue PkgProp(const zypp::PoolItem &item);
YCPValue PkgMediaSizesOrCount (bool sizes, bool download_size = false);
YCPValue TargetInitInternal(const YCPString& root, bool rebuild_rpmdb);
-
+
bool aliasExists(const std::string &alias, const
std::list<zypp::RepoInfo> &reps) const;
// remember the base product attributes for finding it later in
@@ -243,7 +243,7 @@
* and setLastError AND RETHROW
*/
YRepo_Ptr logFindRepository(RepoId id);
-
+
RepoId createManagedSource(const zypp::Url & url_r,
const zypp::Pathname & path_r, const std::string& type,
const std::string &alias_r, PkgProgress &progress, const
zypp::ProgressData::ReceiverFnc & progressrcv =
zypp::ProgressData::ReceiverFnc());
@@ -257,7 +257,7 @@
// a helper function to add or remove an upgrade repository
YCPValue AddRemoveUpgradeRepo(const YCPInteger &repo, bool add);
-
+
// action for a resolvable
enum ResolvableAction
{
@@ -272,6 +272,11 @@
// it finds the resolvable using attributes saved earlier by
RememberBaseProduct
zypp::Product::constPtr FindInstalledBaseProduct();
+ // adds authentication data to a URL
+ void AddAuthData(zypp::Url url);
+ // helper with common code to SourceURL and SourceRawUrl
+ YCPValue GetSourceUrl(const YCPInteger& id, bool raw);
+
public:
// general
/* TYPEINFO: void(string) */
@@ -292,6 +297,8 @@
YCPValue LastErrorDetails ();
/* TYPEINFO: boolean() */
YCPValue Connect ();
+ /* TYPEINFO: string(string)*/
+ YCPValue ExpandedUrl (const YCPString&);
// callbacks
/* TYPEINFO: void(void(string,integer,boolean)) */
@@ -322,6 +329,8 @@
YCPValue CallbackProblemDeltaApply( const YCPValue& /*nil*/ args);
/* TYPEINFO: void(boolean(integer)) */
YCPValue CallbackFinishDeltaDownload( const YCPValue& /*nil*/ args);
+ /* TYPEINFO: void(boolean(integer)) */
+ YCPValue CallbackPkgGpgCheck( const YCPValue& /*nil*/ args);
/* TYPEINFO: void(void()) */
YCPValue CallbackFinishDeltaApply( const YCPValue& /*nil*/ args);
@@ -451,34 +460,33 @@
YCPValue CallbackResolvableReport( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(map<string,any>,integer)) */
- YCPValue CallbackImportGpgKey( const YCPValue& /*nil*/ args );
+ YCPValue CallbackImportGpgKey( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(string,string,integer)) */
- YCPValue CallbackAcceptUnknownGpgKey( const YCPValue& /*nil*/ args );
+ YCPValue CallbackAcceptUnknownGpgKey( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(string,integer)) */
- YCPValue CallbackAcceptUnsignedFile( const YCPValue& /*nil*/ args );
+ YCPValue CallbackAcceptUnsignedFile( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(string,map<string,any>,integer)) */
- YCPValue CallbackAcceptVerificationFailed( const YCPValue& /*nil*/ args
);
+ YCPValue CallbackAcceptVerificationFailed( const YCPValue& /*nil*/ args
);
/* TYPEINFO: void(boolean(string,string,string)) */
YCPValue CallbackAcceptWrongDigest( const YCPValue& /*nil*/ args);
/* TYPEINFO: void(boolean(string,string)) */
YCPValue CallbackAcceptUnknownDigest( const YCPValue& /*nil*/ args);
/* TYPEINFO: void(void(map<string,any>)) */
- YCPValue CallbackTrustedKeyAdded( const YCPValue& /*nil*/ args );
+ YCPValue CallbackTrustedKeyAdded( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(void(map<string,any>)) */
- YCPValue CallbackTrustedKeyRemoved( const YCPValue& /*nil*/ args );
+ YCPValue CallbackTrustedKeyRemoved( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(string)) */
- YCPValue CallbackAcceptFileWithoutChecksum( const YCPValue& /*nil*/
args );
+ YCPValue CallbackAcceptFileWithoutChecksum( const YCPValue& /*nil*/
args );
/* TYPEINFO: void(void(string,list<string>,string)) */
- YCPValue CallbackProcessStart( const YCPValue& /*nil*/ args );
+ YCPValue CallbackProcessStart( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(integer)) */
- YCPValue CallbackProcessProgress( const YCPValue& /*nil*/ args );
+ YCPValue CallbackProcessProgress( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(void()) */
- YCPValue CallbackProcessNextStage( const YCPValue& /*nil*/ args );
+ YCPValue CallbackProcessNextStage( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(void()) */
- YCPValue CallbackProcessDone( const YCPValue& /*nil*/ args );
-
+ YCPValue CallbackProcessDone( const YCPValue& /*nil*/ args );
// source related
/* TYPEINFO: boolean(boolean)*/
@@ -506,6 +514,8 @@
YCPValue SourceGeneralData (const YCPInteger&);
/* TYPEINFO: string(integer)*/
YCPValue SourceURL (const YCPInteger&);
+ /* TYPEINFO: string(integer)*/
+ YCPValue SourceRawURL (const YCPInteger&);
/* TYPEINFO: map<string,any>(integer)*/
YCPValue SourceMediaData (const YCPInteger&);
/* TYPEINFO: map<string,any>(integer)*/
@@ -800,7 +810,7 @@
* Constructor.
*/
PkgFunctions ();
-
+
/**
* Destructor.
*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Resolvable_Patches.cc
new/yast2-pkg-bindings-3.1.31/src/Resolvable_Patches.cc
--- old/yast2-pkg-bindings-3.1.29/src/Resolvable_Patches.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Resolvable_Patches.cc 2015-10-09
09:40:10.000000000 +0200
@@ -99,7 +99,7 @@
if (s && s->isNeeded() && !s->isUnwanted())
{
- zypp::Patch::constPtr patch = zypp::dynamic_pointer_cast<const
zypp::Patch>
+ zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>
(s->candidateObj().resolvable());
// dont auto-install optional patches
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-pkg-bindings-3.1.29/src/Resolvable_Properties.cc
new/yast2-pkg-bindings-3.1.31/src/Resolvable_Properties.cc
--- old/yast2-pkg-bindings-3.1.29/src/Resolvable_Properties.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Resolvable_Properties.cc 2015-10-09
09:40:10.000000000 +0200
@@ -264,7 +264,7 @@
// package specific info
if( req_kind == "package" )
{
- zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const
zypp::Package>(item.resolvable());
+ zypp::Package::constPtr pkg =
zypp::asKind<zypp::Package>(item.resolvable());
if ( pkg )
{
std::string tmp = pkg->location().filename().asString();
@@ -285,7 +285,7 @@
}
else if( req_kind == "srcpackage" )
{
- zypp::SrcPackage::constPtr pkg = boost::dynamic_pointer_cast<const
zypp::SrcPackage>(item.resolvable());
+ zypp::SrcPackage::constPtr pkg =
zypp::asKind<zypp::SrcPackage>(item.resolvable());
if (pkg)
{
std::string tmp(pkg->location().filename().asString());
@@ -309,7 +309,7 @@
}
// product specific info
else if( req_kind == "product" ) {
- zypp::Product::constPtr product = boost::dynamic_pointer_cast<const
zypp::Product>(item.resolvable());
+ zypp::Product::constPtr product =
zypp::asKind<zypp::Product>(item.resolvable());
if ( !product )
{
y2error("product %s is not a product", item->name().c_str() );
@@ -511,7 +511,7 @@
}
// pattern specific info
else if ( req_kind == "pattern" ) {
- zypp::Pattern::constPtr pattern = boost::dynamic_pointer_cast<const
zypp::Pattern>(item.resolvable());
+ zypp::Pattern::constPtr pattern =
zypp::asKind<zypp::Pattern>(item.resolvable());
info->add(YCPString("category"), YCPString(pattern->category()));
info->add(YCPString("user_visible"),
YCPBoolean(pattern->userVisible()));
info->add(YCPString("default"), YCPBoolean(pattern->isDefault()));
@@ -522,7 +522,7 @@
// patch specific info
else if ( req_kind == "patch" )
{
- zypp::Patch::constPtr patch_ptr = boost::dynamic_pointer_cast<const
zypp::Patch>(item.resolvable());
+ zypp::Patch::constPtr patch_ptr =
zypp::asKind<zypp::Patch>(item.resolvable());
info->add(YCPString("interactive"),
YCPBoolean(patch_ptr->interactive()));
info->add(YCPString("reboot_needed"),
YCPBoolean(patch_ptr->rebootSuggested()));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Source_Create.cc
new/yast2-pkg-bindings-3.1.31/src/Source_Create.cc
--- old/yast2-pkg-bindings-3.1.29/src/Source_Create.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Source_Create.cc 2015-10-09
09:40:10.000000000 +0200
@@ -889,7 +889,7 @@
// check the repository
if (res && res->repoInfo().alias() == alias)
{
- zypp::Product::constPtr product =
boost::dynamic_pointer_cast<const zypp::Product>(res);
+ zypp::Product::constPtr product =
zypp::asKind<zypp::Product>(res);
if (product)
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.29/src/Source_Get.cc
new/yast2-pkg-bindings-3.1.31/src/Source_Get.cc
--- old/yast2-pkg-bindings-3.1.29/src/Source_Get.cc 2015-08-27
14:00:09.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.31/src/Source_Get.cc 2015-10-06
15:00:12.000000000 +0200
@@ -109,7 +109,7 @@
* "product_dir": YCPString,
* "type" : YCPString,
* "url" : YCPString (without password, but see SourceURL),
- * "raw_url" : YCPString (without password, but see SourceURL, raw URL
without variable replacement),
+ * "raw_url" : YCPString (without password, but see SourceRawURL, raw URL
without variable replacement),
* "alias" : YCPString,
* "name" : YCPString,
* "service" : YCPString, (service to which the repo belongs, empty if there
is no service assigned)
@@ -185,63 +185,23 @@
YCPValue
PkgFunctions::SourceURL (const YCPInteger& id)
{
+ return GetSourceUrl(id, false);
+}
- const YRepo_Ptr repo = logFindRepository(id->value());
- if (!repo)
- return YCPVoid();
-
- zypp::Url url;
-
- if (repo->repoInfo().baseUrlsBegin() != repo->repoInfo().baseUrlsEnd())
- {
- // #186842
- url = *(repo->repoInfo().baseUrlsBegin());
-
- // add authentication data if exist
- zypp::media::CredentialManager cm;
-
- zypp::media::AuthData_Ptr auth = cm.getCred(url);
-
- if (auth)
- {
- y2milestone("Authentication data found, adding to URL...");
-
- if (auth->valid())
- {
- if (!auth->username().empty())
- {
- y2debug("Adding username...");
- url.setUsername(auth->username());
- }
-
- if (!auth->password().empty())
- {
- y2debug("Adding password...");
- url.setPassword(auth->password());
- }
- }
- else
- {
- y2warning("Invalid authentication data, returning URL without
username and password");
- }
-
- // does the url contain credentials query?
- zypp::url::ParamMap params = url.getQueryStringMap();
- zypp::url::ParamMap::iterator map_it = params.find("credentials");
-
- if (map_it != params.end())
- {
- y2milestone("Removing credentials query from URL");
- params.erase(map_it);
- url.setQueryStringMap(params);
- }
- }
-
- }
-
- return YCPString(url.asCompleteString());
+/******************************************************************************
+ * @builtin SourceRawURL
+ *
+ * @short Get full source raw URL (no variable replacement), including password
+ * @param integer SrcId Specifies the InstSrc to query.
+ * @return string or nil on failure
+ **/
+YCPValue
+PkgFunctions::SourceRawURL (const YCPInteger& id)
+{
+ return GetSourceUrl(id, true);
}
+
/****************************************************************************************
* @builtin SourceMediaData
* @short Return media data about the source
@@ -283,7 +243,7 @@
aval_it != (*it)->availableEnd();
++aval_it)
{
- zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const
zypp::Package>(aval_it->resolvable());
+ zypp::Package::constPtr pkg =
zypp::asKind<zypp::Package>(aval_it->resolvable());
if (pkg && pkg->repoInfo().alias() == alias)
{
@@ -380,7 +340,7 @@
aval_it != (*it)->availableEnd();
++aval_it)
{
- zypp::Product::constPtr prod =
boost::dynamic_pointer_cast<const zypp::Product>(aval_it->resolvable());
+ zypp::Product::constPtr prod =
zypp::asKind<zypp::Product>(aval_it->resolvable());
if (prod && prod->repoInfo().alias() == alias)
{
product = prod;
@@ -466,3 +426,69 @@
return ret;
}
+// Adds authentication data to the URL if it exists
+void
+PkgFunctions::AddAuthData (zypp::Url url) {
+ zypp::media::CredentialManager cm;
+
+ zypp::media::AuthData_Ptr auth = cm.getCred(url);
+
+ if (auth)
+ {
+ y2milestone("Authentication data found, adding to URL...");
+
+ if (auth->valid())
+ {
+ if (!auth->username().empty())
+ {
+ y2debug("Adding username...");
+ url.setUsername(auth->username());
+ }
+
+ if (!auth->password().empty())
+ {
+ y2debug("Adding password...");
+ url.setPassword(auth->password());
+ }
+ }
+ else
+ {
+ y2warning("Invalid authentication data, returning URL without
username and password");
+ }
+
+ // does the url contain credentials query?
+ zypp::url::ParamMap params = url.getQueryStringMap();
+ zypp::url::ParamMap::iterator map_it = params.find("credentials");
+
+ if (map_it != params.end())
+ {
+ y2milestone("Removing credentials query from URL");
+ params.erase(map_it);
+ url.setQueryStringMap(params);
+ }
+ }
+}
+
+// Helper with common code to SourceURL and SourceRawUrl
+YCPValue
+PkgFunctions::GetSourceUrl (const YCPInteger& id, bool raw)
+{
+ const YRepo_Ptr repo = logFindRepository(id->value());
+ if (!repo)
+ return YCPVoid();
+
+ zypp::Url url;
+
+ if (!repo->repoInfo().baseUrlsEmpty())
+ {
+ if (raw) {
+ url = repo->repoInfo().rawUrl();
+ } else {
+ // #186842
+ url = repo->repoInfo().url();
+ }
+ AddAuthData(url);
+ }
+
+ return YCPString(url.asCompleteString());
+}