Hello community,
here is the log from the commit of package yast2-pkg-bindings
checked in at Thu Sep 25 14:20:11 CEST 2008.
--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-09-12 18:41:20.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-09-25 14:14:10.888106000 +0200
@@ -1,0 +2,39 @@
+Thu Sep 25 13:44:51 CEST 2008 - lslezak@suse.cz
+
+- added Pkg::SourceProvideSignedDirectory() to check the signatures
+ of the downloaded files (bnc#409927)
+- 2.17.13
+
+-------------------------------------------------------------------
+Wed Sep 24 15:40:09 CEST 2008 - lslezak@suse.cz
+
+- create the base product symlink in Pkg::PkgCommit() (bnc#413444)
+
+-------------------------------------------------------------------
+Wed Sep 24 14:56:50 CEST 2008 - ma@suse.de
+
+- fixed retrieval of product data (bnc #429067)
+
+-------------------------------------------------------------------
+Wed Sep 24 09:09:39 CEST 2008 - lslezak@suse.cz
+
+- adapted GPG key callbacks - report also the affected repository
+ (bnc#370223)
+
+-------------------------------------------------------------------
+Fri Sep 19 15:05:31 CEST 2008 - lslezak@suse.cz
+
+- added Pkg::ServiceProbe() function for probing service type
+ (or for checking if there is a service at all) (bnc#427728)
+- use Product::isTargetDistribution() to mark the base product
+ (bnc#413444)
+
+-------------------------------------------------------------------
+Thu Sep 18 17:23:03 CEST 2008 - lslezak@suse.cz
+
+- improved callback evaluation - evaluate the callbacks even when
+ the change is smaller than 5% but at least 3 seconds have elapsed
+ since the last evaluation, makes better response on slow
+ connections (bnc#402593)
+
+-------------------------------------------------------------------
New Changes file:
--- /dev/null 2008-04-22 03:09:48.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings-devel-doc.changes 2008-09-25 14:14:10.742253000 +0200
@@ -0,0 +1,40 @@
+-------------------------------------------------------------------
+Fri May 16 08:18:31 CEST 2008 - lslezak@suse.cz
+
+- documented lock API
+- 2.16.35
+
+-------------------------------------------------------------------
+Thu Apr 3 13:41:41 CEST 2008 - ma@suse.de
+
+- use repo name as mediaset label.
+
+-------------------------------------------------------------------
+Tue Mar 11 07:31:42 CET 2008 - coolo@suse.de
+
+- devtools requires redudant prefix definition
+
+-------------------------------------------------------------------
+Wed Mar 5 22:13:55 CET 2008 - coolo@suse.de
+
+- fixing spec file syntax
+
+-------------------------------------------------------------------
+Tue Dec 18 19:32:50 CET 2007 - lslezak@suse.cz
+
+- updated generating of the documentation to the new source file
+ layout
+- 2.16.7
+
+-------------------------------------------------------------------
+Wed Oct 3 10:06:31 CEST 2007 - mvidner@suse.cz
+
+- Do not try to package COPYRIGHT.english, it is gone from
+ devtools (#299144).
+- 2.16.0
+
+-------------------------------------------------------------------
+Thu Jul 26 15:55:21 CEST 2007 - lslezak@suse.cz
+
+- Initial version
+
Old:
----
yast2-pkg-bindings-2.17.12.tar.bz2
New:
----
yast2-pkg-bindings-2.17.13.tar.bz2
yast2-pkg-bindings-devel-doc.changes
yast2-pkg-bindings-devel-doc.spec
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
#
# spec file for package yast2-pkg-bindings-devel-doc (Version 2.17.13)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: yast2-pkg-bindings-devel-doc
Version: 2.17.13
Release: 1
License: GPL v2 or later
Group: Documentation/HTML
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: yast2-pkg-bindings-2.17.13.tar.bz2
Prefix: %_prefix
# same as in the main package (because we use the same configure.in.in)
BuildRequires: blocxx-devel docbook-xsl-stylesheets doxygen gcc-c++ libgcrypt-devel libxcrypt-devel libxslt libzypp-devel perl-XML-Writer sgml-skel yast2-core-devel yast2-devtools
BuildArch: noarch
Requires: yast2-pkg-bindings = %{version}
Summary: YaST2 - Documentation for yast2-pkg-bindings package
Group: Documentation/HTML
%description
This documenation package describes the package manager API (Pkg::
namespace) used in YaST scripts. The documentation is autogenerated
from the pkg-bindings sources.
Authors:
--------
Ladislav Slez�k
%prep
%setup -n yast2-pkg-bindings-2.17.13
# build only documentation, ignore all other directories
echo "doc" > SUBDIRS
%build
%{prefix}/bin/y2tool y2autoconf
%{prefix}/bin/y2tool y2automake
autoreconf --force --install
export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG"
export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG"
%{?suse_update_config:%{suse_update_config -f}}
./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir}
make %{?jobs:-j%jobs}
%install
make install DESTDIR="$RPM_BUILD_ROOT"
[ -e "%{prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" ] || Y2DIR="$RPM_BUILD_ROOT/usr/share/YaST2" make check DESTDIR="$RPM_BUILD_ROOT"
for f in `find $RPM_BUILD_ROOT/%{prefix}/share/applications/YaST2/ -name "*.desktop"` ; do
d=${f##*/}
%suse_update_desktop_file -d ycc_${d%.desktop} ${d%.desktop}
done
%clean
rm -rf "$RPM_BUILD_ROOT"
%files
%defattr(-,root,root)
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings/html
%dir %{prefix}/share/doc/packages/yast2-pkg-bindings
%exclude %{prefix}/share/doc/packages/yast2-pkg-bindings/COPYING
%exclude %{prefix}/share/doc/packages/yast2-pkg-bindings/README
%changelog
* Fri May 16 2008 lslezak@suse.cz
- documented lock API
- 2.16.35
* Thu Apr 03 2008 ma@suse.de
- use repo name as mediaset label.
* Tue Mar 11 2008 coolo@suse.de
- devtools requires redudant prefix definition
* Thu Mar 06 2008 coolo@suse.de
- fixing spec file syntax
* Tue Dec 18 2007 lslezak@suse.cz
- updated generating of the documentation to the new source file
layout
- 2.16.7
* Wed Oct 03 2007 mvidner@suse.cz
- Do not try to package COPYRIGHT.english, it is gone from
devtools (#299144).
- 2.16.0
* Thu Jul 26 2007 lslezak@suse.cz
- Initial version
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.U11881/_old 2008-09-25 14:19:49.000000000 +0200
+++ /var/tmp/diff_new_pack.U11881/_new 2008-09-25 14:19:49.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.17.12)
+# spec file for package yast2-pkg-bindings (Version 2.17.13)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,17 +19,17 @@
Name: yast2-pkg-bindings
-Version: 2.17.12
+Version: 2.17.13
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.17.12.tar.bz2
+Source0: yast2-pkg-bindings-2.17.13.tar.bz2
Prefix: /usr
BuildRequires: blocxx-devel docbook-xsl-stylesheets doxygen gcc-c++ libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer sgml-skel yast2-core-devel yast2-devtools
BuildRequires: libzypp-devel >= 5.10.0
-# created and expires dates in zypp::PublicKey
-Requires: libzypp >= 5.10.0
+# new GPG callbacks
+Requires: libzypp >= 5.12.0
Summary: YaST2 - Package Manager Access
%description
@@ -47,7 +47,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-pkg-bindings-2.17.12
+%setup -n yast2-pkg-bindings-2.17.13
# build only the library, ignore documentation (it is in devel-doc package)
echo "src" > SUBDIRS
@@ -79,6 +79,27 @@
%{_libdir}/YaST2/plugin/libpy2Pkg.so
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings
%changelog
+* Thu Sep 25 2008 lslezak@suse.cz
+- added Pkg::SourceProvideSignedDirectory() to check the signatures
+ of the downloaded files (bnc#409927)
+- 2.17.13
+* Wed Sep 24 2008 lslezak@suse.cz
+- create the base product symlink in Pkg::PkgCommit() (bnc#413444)
+* Wed Sep 24 2008 ma@suse.de
+- fixed retrieval of product data (bnc #429067)
+* Wed Sep 24 2008 lslezak@suse.cz
+- adapted GPG key callbacks - report also the affected repository
+ (bnc#370223)
+* Fri Sep 19 2008 lslezak@suse.cz
+- added Pkg::ServiceProbe() function for probing service type
+ (or for checking if there is a service at all) (bnc#427728)
+- use Product::isTargetDistribution() to mark the base product
+ (bnc#413444)
+* Thu Sep 18 2008 lslezak@suse.cz
+- improved callback evaluation - evaluate the callbacks even when
+ the change is smaller than 5%% but at least 3 seconds have elapsed
+ since the last evaluation, makes better response on slow
+ connections (bnc#402593)
* Fri Sep 12 2008 ma@suse.de
- Provide product url lists for registration and smolt.
- 2.17.12
++++++ yast2-pkg-bindings-2.17.12.tar.bz2 -> yast2-pkg-bindings-2.17.13.tar.bz2 ++++++
++++ 1970 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/configure.in new/yast2-pkg-bindings-2.17.13/configure.in
--- old/yast2-pkg-bindings-2.17.12/configure.in 2008-07-14 14:05:51.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/configure.in 2008-09-25 13:56:49.000000000 +0200
@@ -1,9 +1,9 @@
dnl configure.in for yast2-pkg-bindings
dnl
-dnl -- This file is generated by y2autoconf 2.16.7 - DO NOT EDIT! --
+dnl -- This file is generated by y2autoconf 2.17.3 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-pkg-bindings, 2.17.1, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.17.13, http://bugs.opensuse.org/, yast2-pkg-bindings)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -18,7 +18,7 @@
AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
dnl Important YaST2 variables
-VERSION="2.17.1"
+VERSION="2.17.13"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
@@ -144,8 +144,14 @@
AC_PROG_CC
AC_PROG_CPP
-CFLAGS="${CFLAGS} -Wall -Wformat=2 -Wmissing-prototypes"
-CXXFLAGS="${CXXFLAGS} -Wall -Wformat=2"
+# If we have core, get its Y2CORE_CFLAGS.
+# When building core itself, it has set Y2CORE_CFLAGS elsewhere already
+PKG_CHECK_EXISTS([yast2-core],[
+ PKG_CHECK_MODULES(Y2CORE, yast2-core)
+])
+
+CFLAGS="${CFLAGS} ${Y2CORE_CFLAGS} -Wall -Wformat=2 -Wmissing-prototypes"
+CXXFLAGS="${CXXFLAGS} ${Y2CORE_CFLAGS} -Wall -Wformat=2"
: ${AGENT_LIBADD:='-L$(libdir) -lscr'}
AC_SUBST(AGENT_LIBADD)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Callbacks.cc new/yast2-pkg-bindings-2.17.13/src/Callbacks.cc
--- old/yast2-pkg-bindings-2.17.12/src/Callbacks.cc 2008-07-14 14:58:03.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Callbacks.cc 2008-09-22 13:54:50.000000000 +0200
@@ -39,6 +39,8 @@
#include "zypp/Digest.h"
#include "zypp/base/String.h"
+#include <ctime>
+
// FIXME: do this nicer, source create use this to avoid user feedback
// on probing of source type
@@ -52,6 +54,10 @@
RedirectMap redirect_map;
+// default timeout for callbacks, evaluate the callbacks after 3 seconds
+// even if the progress percent has not been changed
+static const time_t callback_timeout = 3;
+
///////////////////////////////////////////////////////////////////
namespace ZyppRecipients {
///////////////////////////////////////////////////////////////////
@@ -251,6 +257,7 @@
{
zypp::Resolvable::constPtr _last;
int last_reported;
+ time_t last_reported_time;
InstallPkgReceive(RecipientCtl & construct_r) : Recipient(construct_r)
{
@@ -268,6 +275,7 @@
{
// initialize the counter
last_reported = 0;
+ last_reported_time = time(NULL);
#warning install non-package
zypp::Package::constPtr res =
@@ -293,8 +301,9 @@
{
CB callback( ycpcb( YCPCallbacks::CB_ProgressPackage) );
// call the callback function only if the difference since the last call is at least 5%
- // or if 100% is reached
- if (callback._set && (value - last_reported >= 5 || last_reported - value >= 5 || value == 100))
+ // or if 100% is reached or at least 3 seconds have elapsed
+ time_t current_time = time(NULL);
+ if (callback._set && (value - last_reported >= 5 || last_reported - value >= 5 || value == 100 || current_time - last_reported_time >= callback_timeout))
{
callback.addInt( value );
bool res = callback.evaluateBool();
@@ -303,6 +312,7 @@
y2milestone( "Package installation callback returned abort" );
last_reported = value;
+ last_reported_time = current_time;
return res;
}
@@ -491,9 +501,16 @@
DownloadResolvableReceive( RecipientCtl & construct_r, const PkgFunctions &pk ) : Recipient( construct_r ), _pkg_ref(pk) {}
int last_reported;
+ time_t last_reported_time;
+
int last_reported_delta_download;
+ time_t last_reported_delta_download_time;
+
int last_reported_delta_apply;
+ time_t last_reported_delta_apply_time;
+
int last_reported_patch_download;
+ time_t last_reported_patch_download_time;
virtual void reportbegin()
{
@@ -507,6 +524,7 @@
{
unsigned size = 0;
last_reported = 0;
+ last_reported_time = time(NULL);
if ( zypp::isKindzypp::Package (resolvable_ptr) )
{
@@ -559,9 +577,11 @@
virtual bool progress(int value, zypp::Resolvable::constPtr resolvable_ptr)
{
CB callback( ycpcb( YCPCallbacks::CB_ProgressProvide) );
- if (callback._set && (value - last_reported >= 5 || last_reported - value >= 5 || value == 100))
+ time_t current_time = time(NULL);
+ if (callback._set && (value - last_reported >= 5 || last_reported - value >= 5 || value == 100 || current_time - last_reported_time >= callback_timeout))
{
last_reported = value;
+ last_reported_time = current_time;
callback.addInt( value );
return callback.evaluateBool(); // return value ignored by RpmDb
}
@@ -603,6 +623,7 @@
{
// reset the counter
last_reported_delta_download = 0;
+ last_reported_delta_download_time = time(NULL);
CB callback( ycpcb( YCPCallbacks::CB_StartDeltaDownload) );
if (callback._set) {
@@ -616,9 +637,11 @@
virtual bool progressDeltaDownload( int value )
{
CB callback( ycpcb( YCPCallbacks::CB_ProgressDeltaDownload) );
- if (callback._set && (value - last_reported_delta_download >= 5 || last_reported_delta_download - value >= 5 || value == 100))
+ time_t current_time = time(NULL);
+ if (callback._set && (value - last_reported_delta_download >= 5 || last_reported_delta_download - value >= 5 || value == 100 || current_time - last_reported_delta_download_time >= callback_timeout))
{
last_reported_delta_download = value;
+ last_reported_delta_download_time = current_time;
callback.addInt( value );
return callback.evaluateBool();
@@ -656,6 +679,7 @@
{
// reset the counter
last_reported_delta_apply = 0;
+ last_reported_delta_apply_time = time(NULL);
CB callback( ycpcb( YCPCallbacks::CB_StartDeltaApply) );
if (callback._set) {
@@ -668,9 +692,11 @@
virtual void progressDeltaApply( int value )
{
CB callback( ycpcb( YCPCallbacks::CB_ProgressDeltaApply ) );
- if (callback._set && (value - last_reported_delta_apply >= 5 || last_reported_delta_apply - value >= 5 || value == 100))
+ time_t current_time = time(NULL);
+ if (callback._set && (value - last_reported_delta_apply >= 5 || last_reported_delta_apply - value >= 5 || value == 100 || current_time - last_reported_delta_apply_time >= callback_timeout))
{
last_reported_delta_apply = value;
+ last_reported_delta_apply_time = current_time;
callback.addInt( value );
callback.evaluate();
@@ -707,6 +733,7 @@
{
// reset the counter
last_reported_patch_download = 0;
+ last_reported_patch_download_time = time(NULL);
CB callback( ycpcb( YCPCallbacks::CB_StartPatchDownload ) );
if (callback._set) {
@@ -720,9 +747,11 @@
virtual bool progressPatchDownload( int value )
{
CB callback( ycpcb( YCPCallbacks::CB_ProgressPatchDownload) );
- if (callback._set && (value - last_reported_patch_download >= 5 || last_reported_patch_download - value >= 5 || value == 100))
+ time_t current_time = time(NULL);
+ if (callback._set && (value - last_reported_patch_download >= 5 || last_reported_patch_download - value >= 5 || value == 100 || current_time - last_reported_patch_download_time >= callback_timeout))
{
last_reported_patch_download = value;
+ last_reported_patch_download_time = current_time;
callback.addInt( value );
return callback.evaluateBool();
@@ -764,12 +793,14 @@
struct DownloadProgressReceive : public Recipient, public zypp::callback::ReceiveReportzypp::media::DownloadProgressReport
{
int last_reported;
+ time_t last_reported_time;
DownloadProgressReceive( RecipientCtl & construct_r ) : Recipient( construct_r ) {}
virtual void start( const zypp::Url &file, zypp::Pathname localfile )
{
last_reported = 0;
+ last_reported_time = time(NULL);
CB callback( ycpcb( YCPCallbacks::CB_StartDownload ) );
if ( callback._set )
@@ -784,10 +815,12 @@
{
CB callback( ycpcb( YCPCallbacks::CB_ProgressDownload ) );
// call the callback function only if the difference since the last call is at least 5%
- // or if 100% is reached
- if (callback._set && (value - last_reported >= 5 || last_reported - value >= 5 || value == 100))
+ // or if 100% is reached or if at least 3 seconds have elapsed
+ time_t current_time = time(NULL);
+ if (callback._set && (value - last_reported >= 5 || last_reported - value >= 5 || value == 100 || current_time - last_reported_time >= callback_timeout))
{
last_reported = value;
+ last_reported_time = current_time;
// report changed values
callback.addInt( value );
callback.addInt( (long long) bps_avg );
@@ -1627,9 +1660,10 @@
///////////////////////////////////////////////////////////////////
struct KeyRingReceive : public Recipient, public zypp::callback::ReceiveReportzypp::KeyRingReport
{
- KeyRingReceive( RecipientCtl & construct_r ) : Recipient( construct_r ) {}
+ const PkgFunctions &_pkg_ref;
+ KeyRingReceive( RecipientCtl & construct_r, const PkgFunctions &pk) : Recipient( construct_r ), _pkg_ref(pk) {}
- virtual bool askUserToImportKey( const zypp::PublicKey &key)
+ virtual zypp::KeyRingReport::KeyTrust askUserToAcceptKey( const zypp::PublicKey &key, const zypp::KeyContext &context)
{
CB callback( ycpcb( YCPCallbacks::CB_ImportGpgKey) );
@@ -1638,46 +1672,29 @@
GPGMap gpgmap(key);
callback.addMap(gpgmap.getMap());
+ long long srcid = _pkg_ref.logFindAlias(context.repoInfo().alias());
+ callback.addInt(srcid);
bool res = callback.evaluateBool();
y2milestone("Callback ImportGpgKey value: %s", res ? "true" : "false");
- return res;
- }
-
- y2milestone("Callback ImportGpgKey not registered, using default value: %s", zypp::KeyRingReport::askUserToImportKey(key) ? "true" : "false");
-
- return zypp::KeyRingReport::askUserToImportKey(key);
- }
-
- virtual bool askUserToTrustKey(const zypp::PublicKey& key)
- {
- CB callback( ycpcb( YCPCallbacks::CB_AcceptNonTrustedGpgKey) );
-
- if (callback._set)
- {
- GPGMap gpgmap(key);
-
- callback.addMap(gpgmap.getMap());
-
- bool res = callback.evaluateBool();
- y2milestone("Callback AcceptNonTrustedGpgKey value: %s", res ? "true" : "false");
-
- return res;
+ return res ? KEY_TRUST_AND_IMPORT : KEY_DONT_TRUST;
}
- y2milestone("Callback AcceptNonTrustedGpgKey not registered, using default value: %s", zypp::KeyRingReport::askUserToTrustKey(key) ? "true" : "false");
+ y2milestone("Callback ImportGpgKey not registered, using default value: %s", zypp::KeyRingReport::askUserToAcceptKey(key, context) ? "true" : "false");
- return zypp::KeyRingReport::askUserToTrustKey(key);
+ return zypp::KeyRingReport::askUserToAcceptKey(key, context);
}
- virtual bool askUserToAcceptUnsignedFile(const std::string &file)
+ virtual bool askUserToAcceptUnsignedFile(const std::string &file, const zypp::KeyContext &context)
{
CB callback( ycpcb( YCPCallbacks::CB_AcceptUnsignedFile) );
if (callback._set)
{
callback.addStr(file);
+ long long srcid = _pkg_ref.logFindAlias(context.repoInfo().alias());
+ callback.addInt(srcid);
return callback.evaluateBool();
}
@@ -1685,7 +1702,7 @@
return zypp::KeyRingReport::askUserToAcceptUnsignedFile(file);
}
- virtual bool askUserToAcceptUnknownKey(const std::string &file, const std::string &id)
+ virtual bool askUserToAcceptUnknownKey(const std::string &file, const std::string &id, const zypp::KeyContext &context)
{
CB callback( ycpcb( YCPCallbacks::CB_AcceptUnknownGpgKey) );
@@ -1693,6 +1710,8 @@
{
callback.addStr(file);
callback.addStr(id);
+ long long srcid = _pkg_ref.logFindAlias(context.repoInfo().alias());
+ callback.addInt(srcid);
bool res = callback.evaluateBool();
y2milestone("Callback AcceptUnknownGpgKey value: %s", res ? "true" : "false");
@@ -1705,7 +1724,7 @@
return zypp::KeyRingReport::askUserToAcceptUnknownKey(file,id);
}
- virtual bool askUserToAcceptVerificationFailed(const std::string &file, const zypp::PublicKey &key)
+ virtual bool askUserToAcceptVerificationFailed(const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &context)
{
CB callback( ycpcb( YCPCallbacks::CB_AcceptVerificationFailed) );
@@ -1715,6 +1734,8 @@
callback.addStr(file);
callback.addMap(gpgmap.getMap());
+ long long srcid = _pkg_ref.logFindAlias(context.repoInfo().alias());
+ callback.addInt(srcid);
return callback.evaluateBool();
}
@@ -1829,7 +1850,7 @@
, _probeSourceReceive( *this )
, _progressReceive( *this )
, _digestReceive( *this )
- , _keyRingReceive( *this )
+ , _keyRingReceive( *this, pkg )
, _keyRingSignal( *this )
, _authReceive( *this )
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Callbacks_Register.cc new/yast2-pkg-bindings-2.17.13/src/Callbacks_Register.cc
--- old/yast2-pkg-bindings-2.17.12/src/Callbacks_Register.cc 2008-07-31 13:20:40.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Callbacks_Register.cc 2008-09-24 09:11:40.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Callbacks_Register.cc 49526 2008-07-30 13:28:18Z mvidner $
+ File: $Id: Callbacks_Register.cc 51436 2008-09-24 07:11:38Z lslezak $
Author: Ladislav Slezák
Summary: Functions for registering YCP callbacks from Yast
Namespace: Pkg
@@ -68,7 +68,7 @@
/**
* @builtin CallbackImportGpgKey
* @short Register callback function
- * @param string args Name of the callback handler function. Required callback prototype is <code>boolean(map key)</code>. The callback function should ask user whether the key is trusted, returned true value means the key is trusted.
+ * @param string args Name of the callback handler function. Required callback prototype is <code>boolean(map key, integer repo_id)</code>. The callback function should ask user whether the key is trusted and can be imported, returned 'true' value means to import the trusted key
* @return void
*/
YCPValue PkgFunctions::CallbackImportGpgKey( const YCPValue& args ) {
@@ -92,7 +92,8 @@
* @return void
*/
YCPValue PkgFunctions::CallbackAcceptNonTrustedGpgKey( const YCPValue& args ) {
- return SET_YCP_CB( CB_AcceptNonTrustedGpgKey, args );
+ y2warning("Pkg::CallbackAcceptNonTrustedGpgKey() is obsoleted, ");
+ return YCPVoid();
}
/**
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Callbacks.YCP.cc new/yast2-pkg-bindings-2.17.13/src/Callbacks.YCP.cc
--- old/yast2-pkg-bindings-2.17.12/src/Callbacks.YCP.cc 2008-06-12 12:15:05.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Callbacks.YCP.cc 2008-09-22 13:32:33.000000000 +0200
@@ -112,7 +112,6 @@
ENUM_OUT( SourceChange );
ENUM_OUT( ResolvableReport );
ENUM_OUT( ImportGpgKey );
- ENUM_OUT( AcceptNonTrustedGpgKey );
ENUM_OUT( AcceptUnknownGpgKey );
ENUM_OUT( AcceptUnsignedFile );
ENUM_OUT( AcceptVerificationFailed );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Callbacks.YCP.h new/yast2-pkg-bindings-2.17.13/src/Callbacks.YCP.h
--- old/yast2-pkg-bindings-2.17.12/src/Callbacks.YCP.h 2008-06-12 12:15:05.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Callbacks.YCP.h 2008-09-22 13:27:15.000000000 +0200
@@ -94,7 +94,6 @@
CB_SourceChange,
CB_ResolvableReport,
CB_ImportGpgKey,
- CB_AcceptNonTrustedGpgKey,
CB_AcceptUnknownGpgKey,
CB_AcceptUnsignedFile,
CB_AcceptFileWithoutChecksum,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Package.cc new/yast2-pkg-bindings-2.17.13/src/Package.cc
--- old/yast2-pkg-bindings-2.17.12/src/Package.cc 2008-09-01 10:34:50.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Package.cc 2008-09-24 14:55:47.000000000 +0200
@@ -43,12 +43,21 @@
#include
#include
#include
+#include
#include
#include <fstream>
#include <sstream>
+extern "C"
+{
+// ::stat, ::unlink, ::symlink
+#include
+// errno
+#include
+}
+
/*
Textdomain "pkg-bindings"
*/
@@ -2108,6 +2117,9 @@
SourceReleaseAll();
+ // create the base product link (bnc#413444)
+ CreateBaseProductSymlink();
+
YCPList ret;
ret->add(YCPInteger(result._result));
@@ -2366,3 +2378,115 @@
return MPS2YCPMap(mps);
}
+
+// helper function - create a symbolic link to the created base product (by SourceCreateBase() function)
+// returns 'true' on success
+// see http://en.opensuse.org/Product_Management/Code11/installed
+bool PkgFunctions::CreateBaseProductSymlink()
+{
+ if (base_product)
+ {
+ y2milestone("Creating symlink for the base product...");
+
+ // get the package
+ zypp::sat::Solvable refsolvable = base_product->referencePackage();
+
+ if (refsolvable != zypp::sat::Solvable::noSolvable)
+ {
+ // create a package pointer from the SAT solvable
+ zypp::Package::Ptr refpkg(zypp::makezypp::Package(refsolvable));
+
+ if (refpkg)
+ {
+ y2milestone("Found reference package for the base product: %s-%s",
+ refpkg->name().c_str(), refpkg->edition().asString().c_str());
+
+ // get the package files
+ std::liststd::string files = refpkg->filenames();
+ y2milestone("The reference package has %zd files", files.size());
+
+ std::string product_file;
+ zypp::str::smatch what;
+ const zypp::str::regex product_file_regex("^/etc/products\\.d/(.*\\.prod)$");
+
+ // find the product file
+ for_(iter, files.begin(), files.end())
+ {
+ if (zypp::str::regex_match(*iter, what, product_file_regex))
+ {
+ product_file = what[1];
+ break;
+ }
+ }
+
+ if (product_file.empty())
+ {
+ y2error("The product file has not been found");
+ return false;
+ }
+ else
+ {
+ y2milestone("Found product file %s", product_file.c_str());
+
+ // check and remove the existing link (refresh the link after upgrade)
+ const zypp::Pathname base_link(_target_root / "/etc/products.d/baseproduct");
+
+ struct stat stat_buf;
+ if (::stat(base_link.asString().c_str(), &stat_buf) == 0)
+ {
+ // the file exists, remove it
+ if (::unlink(base_link.asString().c_str()) != 0)
+ {
+ y2error("Cannot remove base link file %s: %s",
+ base_link.asString().c_str(),
+ ::strerror(errno)
+ );
+
+ return false;
+ }
+ }
+ // ENOENT == "No such file or directory", see 'man errno'
+ else if (errno != ENOENT)
+ {
+ y2error("Cannot stat %s file: %s", base_link.asString().c_str(), ::strerror(errno));
+ return false;
+ }
+ else
+ {
+ y2debug("Link %s does not exist", base_link.asString().c_str());
+ }
+
+ if (::symlink(product_file.c_str(), base_link.asString().c_str()) != 0)
+ {
+ y2error("Cannot create symlink %s -> %s: %s",
+ base_link.asString().c_str(),
+ product_file.c_str(),
+ ::strerror(errno)
+ );
+
+ return false;
+ }
+ else
+ {
+ y2milestone("Symlink %s -> %s has been created", base_link.asString().c_str(), product_file.c_str());
+ }
+ }
+ }
+ else
+ {
+ y2error("The reference solvable is not a package");
+ return false;
+ }
+ }
+ else
+ {
+ y2milestone("The base product doesn't have any reference package");
+ }
+ }
+ else
+ {
+ y2debug("A base product has not been added");
+ }
+
+ return true;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/PkgFunctions.cc new/yast2-pkg-bindings-2.17.13/src/PkgFunctions.cc
--- old/yast2-pkg-bindings-2.17.12/src/PkgFunctions.cc 2008-08-05 18:21:56.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/PkgFunctions.cc 2008-09-24 10:46:36.000000000 +0200
@@ -61,6 +61,7 @@
, zypp_pointer(NULL)
,_callbackHandler( *new CallbackHandler(*this) )
,target_log_set(false)
+ , base_product(NULL)
{
const char *domain = "pkg-bindings";
bindtextdomain( domain, LOCALEDIR );
@@ -130,6 +131,11 @@
{
delete &_callbackHandler;
+ if (base_product)
+ {
+ base_product = NULL;
+ }
+
if (zypp_pointer != NULL)
{
y2milestone("Releasing the zypp pointer...");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/PkgFunctions.h new/yast2-pkg-bindings-2.17.13/src/PkgFunctions.h
--- old/yast2-pkg-bindings-2.17.12/src/PkgFunctions.h 2008-09-09 17:54:35.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/PkgFunctions.h 2008-09-25 13:25:28.000000000 +0200
@@ -43,10 +43,12 @@
#include
#include
+#include
#include
#include
#include
+#include
#include
#include
@@ -125,6 +127,7 @@
YCPValue TargetInitInternal(const YCPString& root, bool rebuild_rpmdb);
bool aliasExists(const std::string &alias) const;
+ zypp::Product::constPtr FindBaseProduct(const std::string &alias) const;
zypp::RepoManager CreateRepoManager();
@@ -145,6 +148,9 @@
void ScanProductsWithCallBacks(const zypp::Url &url);
void CallRefreshStarted();
void CallRefreshDone();
+ YCPValue SourceProvideDirectoryInternal(const YCPInteger& id, const YCPInteger& mid,
+ const YCPString& d, const YCPBoolean &optional,
+ const YCPBoolean &recursive, bool check_signatures);
YCPValue SourceLoadImpl(PkgProgress &progress);
YCPValue SourceStartManagerImpl(const YCPBoolean& enable, PkgProgress &progress);
@@ -166,6 +172,8 @@
YCPValue searchPackage(const YCPString &package, bool installed);
+ bool CreateBaseProductSymlink();
+
private:
/**
@@ -180,6 +188,10 @@
ServiceManager service_manager;
+ zypp::Product::constPtr base_product;
+
+ std::vectorzypp::filesystem::TmpDir tmp_dirs;
+
/**
* Logging helper:
* search for a repository and in case of exception, log error
@@ -188,7 +200,7 @@
YRepo_Ptr logFindRepository(RepoId id);
RepoId createManagedSource(const zypp::Url & url_r,
- const zypp::Pathname & path_r, const bool base_source, const std::string& type,
+ const zypp::Pathname & path_r, const std::string& type,
const std::string &alias_r, PkgProgress &progress, const zypp::ProgressData::ReceiverFnc & progressrcv = zypp::ProgressData::ReceiverFnc());
/**
@@ -397,15 +409,15 @@
/* TYPEINFO: void(void(string,string,string)) */
YCPValue CallbackResolvableReport( const YCPValue& /*nil*/ args );
- /* TYPEINFO: void(boolean(map)) */
+ /* TYPEINFO: void(boolean(map,integer)) */
YCPValue CallbackImportGpgKey( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(map)) */
YCPValue CallbackAcceptNonTrustedGpgKey( const YCPValue& /*nil*/ args );
- /* TYPEINFO: void(boolean(string,string)) */
+ /* TYPEINFO: void(boolean(string,string,integer)) */
YCPValue CallbackAcceptUnknownGpgKey( const YCPValue& /*nil*/ args );
- /* TYPEINFO: void(boolean(string)) */
+ /* TYPEINFO: void(boolean(string,integer)) */
YCPValue CallbackAcceptUnsignedFile( const YCPValue& /*nil*/ args );
- /* TYPEINFO: void(boolean(string,map)) */
+ /* TYPEINFO: void(boolean(string,map,integer)) */
YCPValue CallbackAcceptVerificationFailed( const YCPValue& /*nil*/ args );
/* TYPEINFO: void(boolean(string,string,string)) */
YCPValue CallbackAcceptWrongDigest( const YCPValue& /*nil*/ args);
@@ -473,6 +485,8 @@
YCPValue SourceProvideDir (const YCPInteger&, const YCPInteger&, const YCPString&);
/* TYPEINFO: string(integer,integer,string,boolean,boolean)*/
YCPValue SourceProvideDirectory(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive);
+ /* TYPEINFO: string(integer,integer,string,boolean,boolean)*/
+ YCPValue SourceProvideSignedDirectory(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive);
/* TYPEINFO: boolean(string)*/
YCPValue SourceCacheCopyTo (const YCPString&);
/* TYPEINFO: boolean(boolean)*/
@@ -779,6 +793,8 @@
YCPValue ServicesReset();
/* TYPEINFO: string(string)*/
YCPValue ServiceURL(const YCPString &alias);
+ /* TYPEINFO: string(string)*/
+ YCPValue ServiceProbe(const YCPString &url);
YCPValue ResolvablePropertiesEx(const YCPString& name, const YCPSymbol& kind_r, const YCPString& version, bool dependencies);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Resolvable_Properties.cc new/yast2-pkg-bindings-2.17.13/src/Resolvable_Properties.cc
--- old/yast2-pkg-bindings-2.17.12/src/Resolvable_Properties.cc 2008-09-12 13:49:01.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Resolvable_Properties.cc 2008-09-24 08:54:31.000000000 +0200
@@ -77,6 +77,64 @@
if status is `installed and locked is true then the object locked
if status is `selected or `removed there is extra key "transact_by" : symbol, where symbol is `user (the highest level),
`app_high (selected by Yast), `app_low and `solver (the lowest level)
+
+ @example
+ Additionally to keys returned for all resolvables, there also some
+ resolvable-specific ones:
+
+ `product keys:
+ + "category"
+ + "display_name"
+ + "short_name"
+ + "update_urls"
+ + "flags"
+ + "extra_urls"
+ + "optional_urls"
+ + "register_urls"
+ + "smolt_urls"
+ + "replaces"
+ + "name"
+ + "version"
+ + "arch"
+ + "description"
+ + "display_name"
+ + "short_name"
+ `patch keys:
+ + "interactive"
+ + "reboot_needed"
+ + "relogin_needed"
+ + "affects_pkg_manager"
+ + "is_needed"
+ `package keys:
+ + "path"
+ + "location"
+ `pattern keys:
+ + "category"
+ + "user_visible"
+ + "default"
+ + "icon"
+ + "script"
+ + "order"
+ `language keys:
+ + "code"
+ + "packages"
+ + "requested"
+
+ If dependencies are requested, this keys are additionally used:
+ + "provides"
+ + "prerequires"
+ + "requires"
+ + "conflicts"
+ + "obsoletes"
+ + "recommends"
+ + "suggests"
+ + "enhances"
+ + "supplements"
+
+ All the dependencies use maps with these keys:
+ + "res_kind"
+ + "name"
+ + "dep_kind"
*/
YCPValue
@@ -216,6 +274,10 @@
}
info->add(YCPString("status"), YCPSymbol(stat));
+
+ // the current (string) status in libzypp
+ // `S_Protected, `S_Taboo, `S_Del, `S_Update, `S_Install, `S_AutoDel,
+ // `S_AutoUpdate, `S_AutoInstall, `S_KeepInstalled, or `S_NoInst
info->add(YCPString("status_detail"), YCPSymbol(zypp::ui::asString(status)));
// is the resolvable locked? (Locked or Taboo in the UI)
@@ -270,9 +332,11 @@
y2error("product %s is not a product", (*it)->name().c_str() );
continue;
}
-#warning "Product::category is deprecated, remove from YCP code and this map"
- info->add(YCPString("category"), YCPString(product->type()));
- info->add(YCPString("type"), YCPString(product->type()));
+
+ std::string category(product->isTargetDistribution() ? "base" : "addon");
+
+ info->add(YCPString("category"), YCPString(category));
+ info->add(YCPString("type"), YCPString(category));
info->add(YCPString("relnotes_url"), YCPString(product->releaseNotesUrls().first().asString()));
std::string product_summary = product->summary();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Service.cc new/yast2-pkg-bindings-2.17.13/src/Service.cc
--- old/yast2-pkg-bindings-2.17.12/src/Service.cc 2008-09-09 17:54:35.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Service.cc 2008-09-19 15:02:55.000000000 +0200
@@ -290,3 +290,27 @@
return YCPVoid();
}
+/**
+ @builtin ServiceProbe
+ @short Probe service type at a URL
+ @param url URL of the service
+ @return string probed type or "NONE" if there is no service
+*/
+YCPValue PkgFunctions::ServiceProbe(const YCPString &url)
+{
+ if (url.isNull())
+ {
+ y2error("URL is nil");
+ return YCPVoid();
+ }
+
+ try
+ {
+ const zypp::RepoManager repomanager = CreateRepoManager();
+ return YCPString(service_manager.Probe(zypp::Url(url->asString()->value()), repomanager));
+ }
+ catch(...)
+ {
+ return YCPVoid();
+ }
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/ServiceManager.cc new/yast2-pkg-bindings-2.17.13/src/ServiceManager.cc
--- old/yast2-pkg-bindings-2.17.12/src/ServiceManager.cc 2008-09-05 11:39:35.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/ServiceManager.cc 2008-09-19 14:12:19.000000000 +0200
@@ -309,4 +309,12 @@
return false;
}
+std::string ServiceManager::Probe(const zypp::Url &url, const zypp::RepoManager &repomgr) const
+{
+ y2milestone("Probing service at %s...", url.asString().c_str());
+ std::string ret(repomgr.probeService(url).asString());
+ y2milestone("Detected service type: %s", ret.c_str());
+
+ return ret;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/ServiceManager.h new/yast2-pkg-bindings-2.17.13/src/ServiceManager.h
--- old/yast2-pkg-bindings-2.17.12/src/ServiceManager.h 2008-09-01 10:34:50.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/ServiceManager.h 2008-09-19 14:06:58.000000000 +0200
@@ -54,6 +54,8 @@
bool RefreshService(const std::string &alias, zypp::RepoManager &repomgr) const;
+ std::string Probe(const zypp::Url &url, const zypp::RepoManager &repomgr) const;
+
void Reset();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Source_Create.cc new/yast2-pkg-bindings-2.17.13/src/Source_Create.cc
--- old/yast2-pkg-bindings-2.17.12/src/Source_Create.cc 2008-06-12 12:15:05.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Source_Create.cc 2008-09-24 11:01:26.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Create.cc 47956 2008-05-30 07:36:35Z lslezak $
+ File: $Id: Source_Create.cc 51438 2008-09-24 09:01:25Z lslezak $
Author: Ladislav Slezák
Summary: Functions related to repository registration
Namespace: Pkg
@@ -162,10 +162,9 @@
* \return the SourceId
* \throws Exception if Source creation fails
*/
-std::vectorzypp::RepoInfo::size_type
+PkgFunctions::RepoId
PkgFunctions::createManagedSource( const zypp::Url & url_r,
const zypp::Pathname & path_r,
- const bool base_source,
const std::string& type,
const std::string &alias_r,
PkgProgress &progress,
@@ -180,8 +179,6 @@
std::string alias = removeAlias(url_r, url);
y2milestone("Alias from URL: '%s'", alias.c_str());
-#warning FIXME: use base_source (base_source vs. addon) (will be probably not needed)
-
// repository type
zypp::repo::RepoType repotype;
zypp::RepoManager repomanager = CreateRepoManager();
@@ -628,7 +625,7 @@
prg.toMin();
// remember the new ids for loading the resolvables
- std::listzypp::RepoInfo::size_type> new_repos;
+ std::list<RepoId> new_repos;
if (scan) {
// scan all sources
@@ -665,7 +662,7 @@
try
{
- std::vectorzypp::RepoInfo::size_type id = createManagedSource(url, it->_dir, base, type, it->_name, pkgprogress, subprogrcv);
+ RepoId id = createManagedSource(url, it->_dir, type, it->_name, pkgprogress, subprogrcv);
new_repos.push_back(id);
}
@@ -681,7 +678,7 @@
if (!scan_only)
{
// load resolvables
- for(std::listzypp::RepoInfo::size_type>::const_iterator it = new_repos.begin();
+ for(std::list<RepoId>::const_iterator it = new_repos.begin();
it != new_repos.end() ; ++it )
{
zypp::CombinedProgressData subprogrcv2(prg, 10/products.size());
@@ -692,6 +689,13 @@
// no detailed progress needed, refresh has been done in createManagedSource()
LoadResolvablesFrom(repo->repoInfo(), subprogrcv2);
+
+ // search for a base product if it hasn't been set
+ if (base && !base_product)
+ {
+ y2milestone("Searching a base product...");
+ base_product = FindBaseProduct(repo->repoInfo().alias());
+ }
}
catch ( const zypp::Exception& excpt)
{
@@ -710,7 +714,7 @@
try
{
- std::vectorzypp::RepoInfo::size_type new_id = createManagedSource(url, pn, base, type, "", pkgprogress, subprogrcv_create);
+ RepoId new_id = createManagedSource(url, pn, type, "", pkgprogress, subprogrcv_create);
new_repos.push_back(new_id);
if (!scan_only)
@@ -721,6 +725,12 @@
// load the resolvables
LoadResolvablesFrom(repo->repoInfo(), subprogrcv_load);
+
+ if (base && !base_product)
+ {
+ y2milestone("Searching the base product...");
+ base_product = FindBaseProduct(repo->repoInfo().alias());
+ }
}
}
catch ( const zypp::Exception& excpt)
@@ -744,7 +754,7 @@
YCPList ids;
// load resolvables
- for(std::listzypp::RepoInfo::size_type>::const_iterator it = new_repos.begin();
+ for(std::list<RepoId>::const_iterator it = new_repos.begin();
it != new_repos.end() ; ++it )
{
ids->add(YCPInteger(*it));
@@ -884,3 +894,54 @@
return ret;
}
+zypp::Product::constPtr PkgFunctions::FindBaseProduct(const std::string &alias) const
+{
+ zypp::Product::constPtr product = NULL;
+
+ // access to the Pool of Selectables
+ zypp::ResPoolProxy selectablePool(zypp::ResPool::instance().proxy());
+
+ // iterate over zypp::Products
+ for_(it, selectablePool.byKindBeginzypp::Product(), selectablePool.byKindEndzypp::Product())
+ {
+ // search an available product from the required repository
+ for_(avail_it, (*it)->availableBegin(), (*it)->availableEnd())
+ {
+ // get the resolvable
+ zypp::ResObject::constPtr res = *avail_it;
+
+ // check the repository
+ if (res && res->repoInfo().alias() == alias)
+ {
+ product = boost::dynamic_pointer_cast<const zypp::Product>(res);
+
+ if (product)
+ {
+ break;
+ }
+ }
+ }
+
+ if (product)
+ {
+ break;
+ }
+ }
+
+ // no product in the pool
+ if (!product)
+ {
+ y2error("No base product has been found");
+ }
+ else
+ {
+ y2milestone("Found base product: %s %s (%s-%s)",
+ product->summary().c_str(),
+ product->edition().asString().c_str(),
+ product->name().c_str(),
+ product->edition().asString().c_str()
+ );
+ }
+
+ return product;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Source_Download.cc new/yast2-pkg-bindings-2.17.13/src/Source_Download.cc
--- old/yast2-pkg-bindings-2.17.12/src/Source_Download.cc 2008-08-12 20:02:47.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Source_Download.cc 2008-09-25 14:04:28.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Download.cc 49913 2008-08-11 08:56:03Z lslezak $
+ File: $Id: Source_Download.cc 51508 2008-09-25 12:04:27Z lslezak $
Author: Ladislav Slezák
Summary: Functions for downloading files from a repository
Namespace: Pkg
@@ -34,6 +34,8 @@
#include
+#include
+
/*
Textdomain "pkg-bindings"
*/
@@ -171,6 +173,35 @@
YCPValue
PkgFunctions::SourceProvideDirectory(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive)
{
+ // dowanload the directory, do not check the signatures
+ return SourceProvideDirectoryInternal(id, mid, d, optional, recursive, false);
+}
+
+/****************************************************************************************
+ * @builtin SourceProvideSignedDirectory
+ * @short make a directory available at the local filesystem
+ * @description
+ * Download a directory from repository (make it available at the local filesystem) and
+ * all the files within it. Requires that all files have been signed with SHA1 checksum.
+ * If there is no checksum or the checksum doesn't match the download fails.
+ *
+ * @param integer id repository to use (id)
+ * @param integer mid Number of the media where the directory is located on ('1' for the 1st media).
+ * @param string d Directory name relative to the media root.
+ * @param boolean optional set to true if the directory may not exist (do not report errors)
+ * @param boolean recursive set to true to provide all subdirectories recursively
+ * @return string local path as string or nil when an error occured
+ */
+YCPValue
+PkgFunctions::SourceProvideSignedDirectory(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive)
+{
+ // dowanload the directory, force signature checks
+ return SourceProvideDirectoryInternal(id, mid, d, optional, recursive, true);
+}
+
+YCPValue
+PkgFunctions::SourceProvideDirectoryInternal(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive, bool check_signatures)
+{
CallInitDownload(std::string(_("Downloading ") + d->value()));
bool found = true;
@@ -192,7 +223,24 @@
{
try
{
- path = repo->mediaAccess()->provideDir(d->value(), recursive->value(), mid->value());
+ if (check_signatures)
+ {
+ // use a Fetcher for downloading signed files (see bnc#409927)
+ zypp::Fetcher f;
+ zypp::OnMediaLocation mloc(d->value(), mid->value());
+ zypp::filesystem::TmpDir tmpdir;
+
+ // keep the reference to the tmpdir so the directory is not deleted at the and of the block
+ tmp_dirs.push_back(tmpdir);
+ path = tmpdir.path();
+ f.enqueueDir(mloc, recursive->value());
+ f.start(path, *repo->mediaAccess()); // uses MediaAccess to retrieve
+ f.reset();
+ }
+ else
+ {
+ path = repo->mediaAccess()->provideDir(d->value(), recursive->value(), mid->value());
+ }
}
catch (const zypp::Exception& excpt)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Source_Get.cc new/yast2-pkg-bindings-2.17.13/src/Source_Get.cc
--- old/yast2-pkg-bindings-2.17.12/src/Source_Get.cc 2008-09-12 13:55:29.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Source_Get.cc 2008-09-25 08:57:07.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Get.cc 51095 2008-09-12 11:55:28Z mlandres $
+ File: $Id: Source_Get.cc 51491 2008-09-25 06:57:05Z lslezak $
Author: Ladislav Slezák
Summary: Functions for reading repository properties
Namespace: Pkg
@@ -316,7 +316,7 @@
++aval_it)
{
zypp::Product::constPtr prod = boost::dynamic_pointer_cast<const zypp::Product>(aval_it->resolvable());
- if (product && product->repoInfo().alias() == alias)
+ if (prod && prod->repoInfo().alias() == alias)
{
product = prod;
break;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Source_Set.cc new/yast2-pkg-bindings-2.17.13/src/Source_Set.cc
--- old/yast2-pkg-bindings-2.17.12/src/Source_Set.cc 2008-07-31 13:20:40.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Source_Set.cc 2008-09-24 11:01:26.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Set.cc 49505 2008-07-30 08:42:04Z lslezak $
+ File: $Id: Source_Set.cc 51438 2008-09-24 09:01:25Z lslezak $
Author: Ladislav Slezák
Summary: Functions for changing properties of a repository
Namespace: Pkg
@@ -386,22 +386,30 @@
return YCPBoolean(false);
bool success = true;
+ const std::string repo_alias(repo->repoInfo().alias());
try
{
+
// the resolvables cannot be used anymore, remove them
- RemoveResolvablesFrom(repo->repoInfo().alias());
+ RemoveResolvablesFrom(repo_alias);
// update 'repos'
repo->setDeleted();
+ // removing the base product repository?
+ if (base_product && base_product->repoInfo().alias() == repo_alias)
+ {
+ y2warning("Resetting the base product, the base product repository has been removed");
+ base_product = NULL;
+ }
+
PkgFreshen();
}
catch (const zypp::Exception& excpt)
{
- std::string alias = repo->repoInfo().alias();
- y2error ("Error for '%s': %s", alias.c_str(), excpt.asString().c_str());
- _last_error.setLastError(alias + ": " + ExceptionAsString(excpt));
+ y2error ("Error for '%s': %s", repo_alias.c_str(), excpt.asString().c_str());
+ _last_error.setLastError(repo_alias + ": " + ExceptionAsString(excpt));
success = false;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/src/Target.cc new/yast2-pkg-bindings-2.17.13/src/Target.cc
--- old/yast2-pkg-bindings-2.17.12/src/Target.cc 2008-09-12 13:22:30.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/src/Target.cc 2008-09-19 10:37:33.000000000 +0200
@@ -196,9 +196,11 @@
// FIXME unify with code in Pkg::ResolvablePropertiesEx
prod->add( YCPString("name"), YCPString( product->name() ) );
prod->add( YCPString("version"), YCPString( product->edition().version() ) );
- #warning "Product::category is deprecated, remove from map and ycp code"
- prod->add(YCPString("type"), YCPString(product->type()));
- prod->add(YCPString("category"), YCPString(product->type()));
+
+ std::string category(product->isTargetDistribution() ? "base" : "addon");
+ prod->add(YCPString("type"), YCPString(category));
+ prod->add(YCPString("category"), YCPString(category));
+
prod->add(YCPString("vendor"), YCPString(product->vendor()));
prod->add(YCPString("relnotes_url"), YCPString(product->releaseNotesUrls().first().asString()));
std::string product_summary = product->summary();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-pkg-bindings-2.17.12/VERSION new/yast2-pkg-bindings-2.17.13/VERSION
--- old/yast2-pkg-bindings-2.17.12/VERSION 2008-09-12 13:49:42.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.13/VERSION 2008-09-25 13:55:53.000000000 +0200
@@ -1 +1 @@
-2.17.12
+2.17.13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org