Hello community,
here is the log from the commit of package libzypp
checked in at Fri Mar 7 22:49:42 CET 2008.
--------
--- libzypp/libzypp.changes 2008-03-02 18:13:34.000000000 +0100
+++ libzypp/libzypp.changes 2008-03-07 10:56:55.000000000 +0100
@@ -1,0 +2,39 @@
+Thu Mar 6 13:42:53 CET 2008 - ma@suse.de
+
+- Do not filter any installed solvables.
+- revision 9031
+- version 4.3.2
+
+-------------------------------------------------------------------
+Wed Mar 5 11:33:26 CET 2008 - ma@suse.de
+
+- Try to rebuild broken solv files in Target::load.
+- revision 9015
+
+-------------------------------------------------------------------
+Tue Mar 4 18:17:41 CET 2008 - ma@suse.de
+
+- Try to rebuild broken solv files in RepoManager::loadFromCache.
+- Fix RepoStatus::operator&& and RepoStatus testsuite.
+- revision 9008
+
+-------------------------------------------------------------------
+Tue Mar 4 16:09:14 CET 2008 - schubi@suse.de
+
+- improved problem description while a vendor change
+- improved problem description if a requirement cannot be fulfilled. Bug #358560
+- revision 9002
+
+-------------------------------------------------------------------
+Tue Mar 4 12:57:58 CET 2008 - ma@suse.de
+
+- Save and restore requested locales on target load/commit.
+- revision 8999
+
+-------------------------------------------------------------------
+Mon Mar 3 17:10:26 CET 2008 - schubi@suse.de
+
+- (Update) Prevent reinstallation of installed packages.
+- revision 8984
+
+-------------------------------------------------------------------
Old:
----
libzypp-4.3.1.tar.bz2
New:
----
libzypp-4.3.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libzypp.spec ++++++
--- /var/tmp/diff_new_pack.E30792/_old 2008-03-07 22:46:29.000000000 +0100
+++ /var/tmp/diff_new_pack.E30792/_new 2008-03-07 22:46:29.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package libzypp (Version 4.3.1)
+# spec file for package libzypp (Version 4.3.2)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -17,9 +17,9 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on
Summary: Package, Patch, Pattern, and Product Management
-Version: 4.3.1
-Release: 2
-Source: libzypp-4.3.1.tar.bz2
+Version: 4.3.2
+Release: 1
+Source: libzypp-4.3.2.tar.bz2
Source1: libzypp-rpmlintrc
Prefix: /usr
Provides: yast2-packagemanager
@@ -57,7 +57,7 @@
Ladislav Slezak
%package devel
-Requires: libzypp == 4.3.1
+Requires: libzypp == 4.3.2
Requires: libxml2-devel curl-devel openssl-devel rpm-devel glibc-devel zlib-devel
Requires: bzip2 popt-devel dbus-1-devel glib2-devel hal-devel boost-devel libstdc++-devel
Requires: cmake libsatsolver-devel
@@ -146,6 +146,27 @@
%{_libdir}/pkgconfig/libzypp.pc
%changelog
+* Thu Mar 06 2008 ma@suse.de
+- Do not filter any installed solvables.
+- revision 9031
+- version 4.3.2
+* Wed Mar 05 2008 ma@suse.de
+- Try to rebuild broken solv files in Target::load.
+- revision 9015
+* Tue Mar 04 2008 ma@suse.de
+- Try to rebuild broken solv files in RepoManager::loadFromCache.
+- Fix RepoStatus::operator&& and RepoStatus testsuite.
+- revision 9008
+* Tue Mar 04 2008 schubi@suse.de
+- improved problem description while a vendor change
+- improved problem description if a requirement cannot be fulfilled. Bug #358560
+- revision 9002
+* Tue Mar 04 2008 ma@suse.de
+- Save and restore requested locales on target load/commit.
+- revision 8999
+* Mon Mar 03 2008 schubi@suse.de
+- (Update) Prevent reinstallation of installed packages.
+- revision 8984
* Sun Mar 02 2008 coolo@suse.de
- refresh metadata if there is no cache to unbreak compat with
kiwi (that relied on "zypper sa <url> <alias>" to create a repo
++++++ libzypp-4.3.1.tar.bz2 -> libzypp-4.3.2.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/devel/devel.ma/MaTest.cc new/libzypp-4.3.2/devel/devel.ma/MaTest.cc
--- old/libzypp-4.3.1/devel/devel.ma/MaTest.cc 2008-03-02 18:13:25.000000000 +0100
+++ new/libzypp-4.3.2/devel/devel.ma/MaTest.cc 2008-03-07 10:56:48.000000000 +0100
@@ -1,60 +1,38 @@
#include <iostream>
-
-#include
-#include
-#include
-#include
-#include
-
-#include "Tools.h"
-#include "FakePool.h"
-
-#include
-#include
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/ResPoolProxy.h"
-#include "zypp/ResTraits.h"
-#include "zypp/ResPool.h"
-#include "zypp/Package.h"
+#include
+#include
+#include
using std::endl;
+using std::cout;
using namespace zypp;
-///////////////////////////////////////////////////////////////////
-
-void setup( QVBox & top, int argc, char **argv )
+/******************************************************************
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+*/
+int main( int argc, const char * argv[] )
{
- if ( ! argc )
- return;
+ --argc; ++argv; // skip arg 0
+ sat::Pool satpool( sat::Pool::instance() );
- MIL << argv[0] << endl;
-}
+ for ( ; argc; --argc, ++argv )
+ {
+ cout << "Read: " << argv[0] << endl;
+ satpool.addRepoSolv( argv[0] );
+ }
+
+ cout << "Done: " << satpool << endl;
+
+ if ( getenv("VERBOSE") )
+ {
+ for_( it, satpool.solvablesBegin(), satpool.solvablesEnd() )
+ {
+ cout << dump(*it) << endl;
+ }
+ }
-///////////////////////////////////////////////////////////////////
-
-int main( int argc, char **argv )
-{
- base::LogControl::instance().logfile( "-" );
- INT << "===[START]==========================================" << endl;
-
- QApplication app( argc, argv );
- QVBox top;
-
- --argc;
- ++argv;
- setup( top, argc, argv );
-
- QPushButton quit( "Quit", &top );
- QObject::connect( &quit,SIGNAL(clicked()), &app, SLOT(quit()) );
- app.setMainWidget( &top );
- top.show();
- INT << "===[LOOP]==========================================" << endl;
- return app.exec();
+ return 0;
}
-///////////////////////////////////////////////////////////////////
-//#include "QPool.moc"
-///////////////////////////////////////////////////////////////////
-
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/devel/devel.ma/NewPool.cc new/libzypp-4.3.2/devel/devel.ma/NewPool.cc
--- old/libzypp-4.3.1/devel/devel.ma/NewPool.cc 2008-03-02 18:13:25.000000000 +0100
+++ new/libzypp-4.3.2/devel/devel.ma/NewPool.cc 2008-03-07 10:56:48.000000000 +0100
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include
#include
@@ -19,11 +20,13 @@
#include "zypp/ResObjects.h"
#include "zypp/Digest.h"
#include "zypp/PackageKeyword.h"
+#include "zypp/TmpPath.h"
#include "zypp/ManagedFile.h"
#include "zypp/NameKindProxy.h"
#include "zypp/pool/GetResolvablesToInsDel.h"
#include "zypp/RepoManager.h"
+#include "zypp/Repository.h"
#include "zypp/RepoInfo.h"
#include "zypp/repo/PackageProvider.h"
@@ -32,10 +35,7 @@
#include "zypp/ResPoolProxy.h"
#include "zypp/sat/Pool.h"
-#include "zypp/sat/Repo.h"
-#include "zypp/sat/Solvable.h"
-#include "zypp/sat/detail/PoolMember.h"
-#include "zypp/sat/detail/PoolImpl.h"
+//#include "zypp/sat/detail/PoolImpl.h"
#include
@@ -418,14 +418,12 @@
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace sat
-{ /////////////////////////////////////////////////////////////////
+ class RequestedLocalesFile
+ {
+ };
- /////////////////////////////////////////////////////////////////
-} // namespace sat
-///////////////////////////////////////////////////////////////////
+ /** \relates RequestedLocalesFile Stream output */
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
@@ -445,51 +443,68 @@
*/
int main( int argc, char * argv[] )
try {
- //zypp::base::LogControl::instance().logfile( "log.restrict" );
+ zypp::base::LogControl::instance().logToStdErr();
INT << "===[START]==========================================" << endl;
sat::Pool satpool( sat::Pool::instance() );
ResPool pool( ResPool::instance() );
USR << "pool: " << pool << endl;
- RepoManager repoManager( makeRepoManager( sysRoot ) );
- RepoInfoList repos = repoManager.knownRepositories();
-
- // launch repos
- for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
+ if ( 1 )
{
- RepoInfo & nrepo( *it );
- SEC << nrepo << endl;
-
- if ( ! nrepo.enabled() )
- continue;
+ RepoManager repoManager( makeRepoManager( sysRoot ) );
+ RepoInfoList repos = repoManager.knownRepositories();
- if ( ! repoManager.isCached( nrepo ) || /*force*/false )
+ // launch repos
+ for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
{
- if ( repoManager.isCached( nrepo ) )
+ RepoInfo & nrepo( *it );
+ SEC << nrepo << endl;
+
+ if ( ! nrepo.enabled() )
+ continue;
+
+ if ( ! repoManager.isCached( nrepo ) || /*force*/false )
{
- SEC << "cleanCache" << endl;
- repoManager.cleanCache( nrepo );
+ if ( repoManager.isCached( nrepo ) )
+ {
+ SEC << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
+ }
+ SEC << "refreshMetadata" << endl;
+ repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
}
- SEC << "refreshMetadata" << endl;
- repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
- SEC << "buildCache" << endl;
- repoManager.buildCache( nrepo );
}
- }
- // create from cache:
- {
- Measure x( "CREATE FROM CACHE" );
- for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
+ // create from cache:
{
- RepoInfo & nrepo( *it );
- if ( ! nrepo.enabled() )
- continue;
+ Measure x( "CREATE FROM CACHE" );
+ for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
+ {
+ RepoInfo & nrepo( *it );
+ if ( ! nrepo.enabled() )
+ continue;
- Measure x( "CREATE FROM CACHE "+nrepo.alias() );
- repoManager.loadFromCache( nrepo );
- USR << "pool: " << pool << endl;
+ Measure x( "CREATE FROM CACHE "+nrepo.alias() );
+ try
+ {
+ repoManager.loadFromCache( nrepo );
+ }
+ catch ( const Exception & exp )
+ {
+ MIL << "Try to rebuild cache..." << endl;
+ SEC << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
+ SEC << "Create from cache" << endl;
+ repoManager.loadFromCache( nrepo );
+ }
+
+ USR << "pool: " << pool << endl;
+ }
}
}
@@ -506,40 +521,6 @@
///////////////////////////////////////////////////////////////////
- function _sel( bind( boost::mem_fun_ref( &sat::Solvable::isSystem ), _1 ) );
- for_( it,
- satpool.filterBegin( _sel ),
- satpool.filterEnd ( _sel ) )
- {
- INT << *it << endl;
- }
-
- satpool.addRequestedLocale( Locale("de") );
- satpool.addRequestedLocale( Locale("cs") );
-
- LocaleSet s;
- s.insert( Locale("de") );
-
-// MIL << satpool.getAvailableLocales() << endl;
-
- {
- Measure x( "de" );
- filter::ByLocaleSupport f( Locale("de") );
- for_( it, satpool.filterBegin(f), satpool.filterEnd(f) )
- {
- MIL << *it << endl;
- }
- }
-
-
-
-
-
-
-
- //MIL << sat::WhatProvides( Capability("amarok") ) << endl;
- //MIL << sat::WhatProvides( Capability("amarok == 1.4.7-37.4") ) << endl;
-
if ( 0 )
{
Measure x( "Upgrade" );
@@ -571,6 +552,11 @@
zypp::base::LogControl::instance().logNothing();
return 0;
}
+catch ( const Exception & exp )
+{
+ INT << exp << endl << exp.historyAsString();
+}
catch (...)
{}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/package/libzypp.changes new/libzypp-4.3.2/package/libzypp.changes
--- old/libzypp-4.3.1/package/libzypp.changes 2008-03-02 18:13:23.000000000 +0100
+++ new/libzypp-4.3.2/package/libzypp.changes 2008-03-07 10:56:47.000000000 +0100
@@ -1,4 +1,43 @@
-------------------------------------------------------------------
+Thu Mar 6 13:42:53 CET 2008 - ma@suse.de
+
+- Do not filter any installed solvables.
+- revision 9031
+- version 4.3.2
+
+-------------------------------------------------------------------
+Wed Mar 5 11:33:26 CET 2008 - ma@suse.de
+
+- Try to rebuild broken solv files in Target::load.
+- revision 9015
+
+-------------------------------------------------------------------
+Tue Mar 4 18:17:41 CET 2008 - ma@suse.de
+
+- Try to rebuild broken solv files in RepoManager::loadFromCache.
+- Fix RepoStatus::operator&& and RepoStatus testsuite.
+- revision 9008
+
+-------------------------------------------------------------------
+Tue Mar 4 16:09:14 CET 2008 - schubi@suse.de
+
+- improved problem description while a vendor change
+- improved problem description if a requirement cannot be fulfilled. Bug #358560
+- revision 9002
+
+-------------------------------------------------------------------
+Tue Mar 4 12:57:58 CET 2008 - ma@suse.de
+
+- Save and restore requested locales on target load/commit.
+- revision 8999
+
+-------------------------------------------------------------------
+Mon Mar 3 17:10:26 CET 2008 - schubi@suse.de
+
+- (Update) Prevent reinstallation of installed packages.
+- revision 8984
+
+-------------------------------------------------------------------
Sun Mar 2 16:13:16 CET 2008 - coolo@suse.de
- refresh metadata if there is no cache to unbreak compat with
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/tests/zypp/CheckSum_test.cc new/libzypp-4.3.2/tests/zypp/CheckSum_test.cc
--- old/libzypp-4.3.1/tests/zypp/CheckSum_test.cc 2008-03-02 18:13:23.000000000 +0100
+++ new/libzypp-4.3.2/tests/zypp/CheckSum_test.cc 2008-03-07 10:56:47.000000000 +0100
@@ -22,7 +22,4 @@
BOOST_CHECK_THROW( CheckSum( "sha1", "dsdsads" ), Exception ); // wrong size
BOOST_CHECK_THROW( CheckSum( "sha256", "dsdsads" ), Exception ); // wrong size
BOOST_CHECK_THROW( CheckSum( "md5", "dsdsads" ), Exception ); // wrong size
- BOOST_CHECK_THROW( CheckSum( "md4", "dsdsads" ), Exception ); // wrong size
- BOOST_CHECK_THROW( CheckSum( "md2", "dsdsads" ), Exception ); // wrong size
-
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/tests/zypp/CMakeLists.txt new/libzypp-4.3.2/tests/zypp/CMakeLists.txt
--- old/libzypp-4.3.1/tests/zypp/CMakeLists.txt 2008-03-02 18:13:23.000000000 +0100
+++ new/libzypp-4.3.2/tests/zypp/CMakeLists.txt 2008-03-07 10:56:47.000000000 +0100
@@ -1,4 +1,5 @@
ADD_SUBDIRECTORY(base)
-ADD_TESTS(RWPtr Vendor TranslatedText PoolQuery KeyRing MediaSetAccess ResKind Arch Url Edition Capabilities CheckSum PublicKey PathInfo Digest Fetcher FileChecker RepoManager RepoInfo RepoStatus ProgressData )
+ADD_TESTS(RWPtr Vendor Vendor2 TranslatedText PoolQuery KeyRing MediaSetAccess ResKind Arch Url Edition Capabilities CheckSum PublicKey PathInfo Digest Fetcher FileChecker RepoManager RepoInfo RepoStatus ProgressData )
+EXEC_PROGRAM( ln ARGS -sf "${CMAKE_CURRENT_SOURCE_DIR}/data" "${CMAKE_CURRENT_BINARY_DIR}/data" )
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/tests/zypp/data/Vendor/zypp2.conf new/libzypp-4.3.2/tests/zypp/data/Vendor/zypp2.conf
--- old/libzypp-4.3.1/tests/zypp/data/Vendor/zypp2.conf 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/tests/zypp/data/Vendor/zypp2.conf 2008-03-07 10:56:48.000000000 +0100
@@ -122,5 +122,6 @@
## Valid values: A directory
## Default value: /etc/zypp/vondors.d
##
-vendordir = ./../../tests/zypp/data/Vendor/vendors.d
+#vendordir = ./../../tests/zypp/data/Vendor/vendors.d
+vendordir = ./data/Vendor/vendors.d
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/tests/zypp/RepoStatus_test.cc new/libzypp-4.3.2/tests/zypp/RepoStatus_test.cc
--- old/libzypp-4.3.1/tests/zypp/RepoStatus_test.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/tests/zypp/RepoStatus_test.cc 2008-03-07 10:56:48.000000000 +0100
@@ -16,6 +16,18 @@
BOOST_AUTO_TEST_CASE(repostatus_test)
{
- TmpDir tmpPath;
+ TmpFile tmpPath;
+ TmpFile tmpPath2;
RepoStatus status;
+ RepoStatus fstatus( tmpPath );
+ RepoStatus fstatus2( tmpPath2 );
+ BOOST_CHECK_EQUAL( status.empty(), true );
+ BOOST_CHECK_EQUAL( (status&&status).empty(), true );
+
+ BOOST_CHECK_EQUAL( fstatus.empty(), false );
+ BOOST_CHECK_EQUAL( (fstatus&&status).empty(), false );
+
+ BOOST_CHECK_EQUAL( (fstatus&&status).checksum(), (status&&fstatus).checksum() );
+ BOOST_CHECK_EQUAL( (fstatus&&fstatus2).checksum(), (fstatus2&&fstatus).checksum() );
+
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/tests/zypp/Vendor2_test.cc new/libzypp-4.3.2/tests/zypp/Vendor2_test.cc
--- old/libzypp-4.3.1/tests/zypp/Vendor2_test.cc 1970-01-01 01:00:00.000000000 +0100
+++ new/libzypp-4.3.2/tests/zypp/Vendor2_test.cc 2008-03-07 10:56:47.000000000 +0100
@@ -0,0 +1,44 @@
+
+#include <iostream>
+#include <list>
+#include <string>
+
+// Boost.Test
+#include
+
+#include "zypp/base/LogControl.h"
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/ZYpp.h"
+#include "zypp/VendorAttr.h"
+
+using boost::unit_test::test_case;
+using namespace std;
+using namespace zypp;
+
+namespace zypp
+{
+ void reconfigureZConfig( const Pathname & );
+}
+
+#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/Vendor")
+
+
+BOOST_AUTO_TEST_CASE(vendor2_test)
+{
+ reconfigureZConfig( DATADIR / "zypp2.conf" );
+
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("opensuse", "SuSE") );
+ BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") );
+ BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "SuSE") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia_new_new", "SuSE") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "opensuse") );
+ BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "SuSE") );
+ BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "nvidia") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("ati_new", "ati") );
+}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/tests/zypp/Vendor_test.cc new/libzypp-4.3.2/tests/zypp/Vendor_test.cc
--- old/libzypp-4.3.1/tests/zypp/Vendor_test.cc 2008-03-02 18:13:23.000000000 +0100
+++ new/libzypp-4.3.2/tests/zypp/Vendor_test.cc 2008-03-07 10:56:47.000000000 +0100
@@ -16,37 +16,23 @@
using namespace std;
using namespace zypp;
-#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/Vendor")
-
-BOOST_AUTO_TEST_CASE(vendor_test1)
+namespace zypp
{
- setenv("ZYPP_CONF", (DATADIR + "zypp1.conf").c_str(), 1 );
- // No vendor definition files has been readed. So only suse,opensuse vendors are
- // equivalent
- BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("opensuse", "SuSE") );
- BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") );
- BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") );
+ void reconfigureZConfig( const Pathname & );
}
-BOOST_AUTO_TEST_CASE(vendor_test2)
+#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/Vendor")
+
+BOOST_AUTO_TEST_CASE(vendor_test1)
{
- setenv("ZYPP_CONF", (DATADIR + "zypp2.conf").c_str(), 1 );
+ reconfigureZConfig( DATADIR / "zypp1.conf" );
// No vendor definition files has been readed. So only suse,opensuse vendors are
// equivalent
BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") );
BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") );
+ BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") );
BOOST_REQUIRE( VendorAttr::instance().equivalent("opensuse", "SuSE") );
BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") );
BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "SuSE") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia_new_new", "SuSE") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "opensuse") );
- BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "SuSE") );
- BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "nvidia") );
- BOOST_REQUIRE( VendorAttr::instance().equivalent("ati_new", "ati") );
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/VERSION.cmake new/libzypp-4.3.2/VERSION.cmake
--- old/libzypp-4.3.1/VERSION.cmake 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/VERSION.cmake 2008-03-07 10:56:48.000000000 +0100
@@ -47,4 +47,4 @@
SET(LIBZYPP_MAJOR "4")
SET(LIBZYPP_MINOR "3")
SET(LIBZYPP_COMPATMINOR "2")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_PATCH "2")
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/CMakeLists.txt new/libzypp-4.3.2/zypp/CMakeLists.txt
--- old/libzypp-4.3.1/zypp/CMakeLists.txt 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/CMakeLists.txt 2008-03-07 10:56:48.000000000 +0100
@@ -547,6 +547,7 @@
SET( zypp_target_SRCS
+ target/RequestedLocalesFile.cc
target/CommitLog.cc
target/CommitPackageCache.cc
target/CommitPackageCacheImpl.cc
@@ -557,6 +558,7 @@
)
SET( zypp_target_HEADERS
+ target/RequestedLocalesFile.h
target/CommitLog.h
target/CommitPackageCache.h
target/CommitPackageCacheImpl.h
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/PathInfo.cc new/libzypp-4.3.2/zypp/PathInfo.cc
--- old/libzypp-4.3.1/zypp/PathInfo.cc 2008-03-02 18:13:25.000000000 +0100
+++ new/libzypp-4.3.2/zypp/PathInfo.cc 2008-03-07 10:56:48.000000000 +0100
@@ -351,7 +351,7 @@
}
else
{
- MIL << "mkdir " << path << ' ' << str::octstring( mode );
+ MIL << "mkdir " << path << ' ' << str::octstring( mode ) << endl;
}
lastpos = pos+1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/RepoManager.cc new/libzypp-4.3.2/zypp/RepoManager.cc
--- old/libzypp-4.3.1/zypp/RepoManager.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/RepoManager.cc 2008-03-07 10:56:48.000000000 +0100
@@ -335,7 +335,6 @@
case RepoType::YAST2_e :
{
- // the order of RepoStatus && RepoStatus matters! (#304310)
status = RepoStatus( rawpath + "/content") && (RepoStatus( rawpath + "/media.1/media"));
}
break;
@@ -670,7 +669,6 @@
Pathname base = _pimpl->options.repoCachePath + info.escaped_alias();
Pathname solvfile = base.extend(".solv");
- //cache::SolvStore store(_pimpl->options.repoCachePath);
RepoStatus raw_metadata_status = metadataStatus(info);
if ( raw_metadata_status.empty() )
@@ -679,6 +677,7 @@
in case this is the first time - if it's !autorefresh,
we may still refresh */
refreshMetadata(info, RefreshIfNeeded, progressrcv );
+ raw_metadata_status = metadataStatus(info);
}
bool needs_cleaning = false;
@@ -701,12 +700,6 @@
needs_cleaning = true;
}
- else {
- /* if there is no cache at this point, we refresh the raw
- in case this is the first time - if it's !autorefresh,
- we may still refresh */
- refreshMetadata(info, RefreshIfNeeded, progressrcv );
- }
ProgressData progress(100);
callback::SendReport<ProgressReport> report;
@@ -716,18 +709,10 @@
if (needs_cleaning)
{
-// Pathname name = _pimpl->options.repoCachePath;
-// //data::RecordId id = store.lookupRepository(info.alias());
-// ostringstream os;
-// os << id.get();
-// name += os.str() + ".solv";
-// unlink (name);
-// cleanCacheInternal( store, info);
cleanCache(info);
}
MIL << info.alias() << " building cache..." << endl;
- //data::RecordId id = store.lookupOrAppendRepository(info.alias());
// do we have type?
repo::RepoType repokind = info.type();
@@ -910,19 +895,29 @@
status.saveToCookieFile(cookiefile);
}
- void RepoManager::loadFromCache( const RepoInfo &info,
+ void RepoManager::loadFromCache( const RepoInfo & info,
const ProgressData::ReceiverFnc & progressrcv )
{
assert_alias(info);
- sat::Pool satpool( sat::Pool::instance() );
string alias = info.escaped_alias();
-
- Pathname solvfile = (_pimpl->options.repoCachePath + alias).extend(".solv");
+ Pathname solvfile = (_pimpl->options.repoCachePath / alias).extend(".solv");
if ( ! PathInfo(solvfile).isExist() )
ZYPP_THROW(RepoNotCachedException());
- Repository repo = satpool.addRepoSolv(solvfile, info);
+ try
+ {
+ sat::Pool::instance().addRepoSolv( solvfile, info );
+ }
+ catch ( const Exception & exp )
+ {
+ ZYPP_CAUGHT( exp );
+ MIL << "Try to handle exception by rebuilding the solv-file" << endl;
+ cleanCache( info, progressrcv );
+ buildCache( info, BuildIfNeeded, progressrcv );
+
+ sat::Pool::instance().addRepoSolv( solvfile, info );
+ }
}
////////////////////////////////////////////////////////////////////////////
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/Repository.cc new/libzypp-4.3.2/zypp/Repository.cc
--- old/libzypp-4.3.1/zypp/Repository.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/Repository.cc 2008-03-07 10:56:48.000000000 +0100
@@ -132,7 +132,7 @@
ZYPP_THROW( Exception( _("Can't open solv-file: ")+file_r.asString() ) );
}
- if ( myPool()._addSolv( _repo, file ) != 0 )
+ if ( myPool()._addSolv( _repo, file, isSystemRepo() ) != 0 )
{
ZYPP_THROW( Exception( _("Error reading solv-file: ")+file_r.asString() ) );
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/RepoStatus.cc new/libzypp-4.3.2/zypp/RepoStatus.cc
--- old/libzypp-4.3.1/zypp/RepoStatus.cc 2008-03-02 18:13:25.000000000 +0100
+++ new/libzypp-4.3.2/zypp/RepoStatus.cc 2008-03-07 10:56:48.000000000 +0100
@@ -34,10 +34,10 @@
{
public:
-
+
string checksum;
Date timestamp;
-
+
/** Offer default Impl. */
static shared_ptr<Impl> nullimpl()
{
@@ -85,7 +85,7 @@
RepoStatus RepoStatus::fromCookieFile( const Pathname &cookiefile )
{
RepoStatus status;
-
+
std::ifstream file(cookiefile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + cookiefile.asString() ) );
@@ -119,7 +119,7 @@
_pimpl->timestamp = Date(info.mtime());
}
}
-
+
bool RepoStatus::empty() const
{
return _pimpl->checksum.empty();
@@ -136,23 +136,28 @@
_pimpl->timestamp = timestamp;
return *this;
}
-
+
string RepoStatus::checksum() const
{ return _pimpl->checksum; }
Date RepoStatus::timestamp() const
{ return _pimpl->timestamp; }
-
- RepoStatus operator&&( const RepoStatus &lhs, const RepoStatus &rhs )
+
+ RepoStatus operator&&( const RepoStatus & lhs, const RepoStatus & rhs )
{
+ if ( lhs.empty() )
+ return rhs;
+ if ( rhs.empty() )
+ return lhs;
+
+ std::string lchk( lhs.checksum() );
+ std::string rchk( rhs.checksum() );
+ // order strings to assert && is kommutativ
+ stringstream ss( lchk < rchk ? lchk+rchk : rchk+lchk );
+
RepoStatus result;
- string combinedcs = (lhs.checksum() + rhs.checksum());
- stringstream ss(combinedcs);
- CheckSum newcs(CheckSum::sha1(ss));
- result.setChecksum(newcs.checksum());
- result.setTimestamp(lhs.timestamp());
- if ( rhs.timestamp() > lhs.timestamp() )
- result.setTimestamp(rhs.timestamp());
+ result.setChecksum( CheckSum::sha1(ss).checksum() );
+ result.setTimestamp( lhs.timestamp() < rhs.timestamp() ? rhs.timestamp() : lhs.timestamp() );
return result;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/sat/detail/PoolImpl.cc new/libzypp-4.3.2/zypp/sat/detail/PoolImpl.cc
--- old/libzypp-4.3.1/zypp/sat/detail/PoolImpl.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/sat/detail/PoolImpl.cc 2008-03-07 10:56:48.000000000 +0100
@@ -94,6 +94,7 @@
PoolImpl::PoolImpl()
: _pool( ::pool_create() )
{
+ MIL << "Creating sat-pool." << endl;
if ( ! _pool )
{
ZYPP_THROW( Exception( _("Can not create sat-pool.") ) );
@@ -103,9 +104,6 @@
::pool_setdebuglevel( _pool, verbose ? 5 : 1 );
::pool_setdebugcallback( _pool, logSat, NULL );
- // set pool architecture
- ::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() );
-
// set namespace callback
_pool->nscallback = &nsCallback;
_pool->nscallbackdata = (void*)this;
@@ -153,7 +151,9 @@
{
if ( _watcher.remember( _serial ) )
{
- /* nothing to do here, but _watcher MUST remember... */
+ // After repo/solvable add/remove:
+ // set pool architecture
+ ::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() );
}
if ( ! _pool->whatprovides )
{
@@ -165,18 +165,19 @@
///////////////////////////////////////////////////////////////////
- int PoolImpl::_addSolv( ::_Repo * repo_r, FILE * file_r )
+ int PoolImpl::_addSolv( ::_Repo * repo_r, FILE * file_r, bool isSystemRepo_r )
{
setDirty(__FUNCTION__, repo_r->name );
int ret = ::repo_add_solv( repo_r , file_r );
- if ( ret == 0 )
+ if ( ret == 0 && ! isSystemRepo_r )
{
// Filter out unwanted archs
std::setdetail::IdType sysids;
{
Arch::CompatSet sysarchs( Arch::compatSet( ZConfig::instance().systemArchitecture() ) );
for_( it, sysarchs.begin(), sysarchs.end() )
- sysids.insert( it->idStr().id() );
+ sysids.insert( it->idStr().id() );
+
// unfortunately satsolver treats src/nosrc as architecture:
sysids.insert( ARCH_SRC );
sysids.insert( ARCH_NOSRC );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/sat/detail/PoolImpl.h new/libzypp-4.3.2/zypp/sat/detail/PoolImpl.h
--- old/libzypp-4.3.1/zypp/sat/detail/PoolImpl.h 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/sat/detail/PoolImpl.h 2008-03-07 10:56:48.000000000 +0100
@@ -101,8 +101,11 @@
eraseRepoInfo( repo_r );
}
- /** Adding solv file to a repo. */
- int _addSolv( ::_Repo * repo_r, FILE * file_r );
+ /** Adding solv file to a repo.
+ * Except for \c isSystemRepo_r, solvables of incompatible architecture
+ * are filtered out.
+ */
+ int _addSolv( ::_Repo * repo_r, FILE * file_r, bool isSystemRepo_r = false );
/** Adding Solvables to a repo. */
detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r )
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/sat/SATResolver.cc new/libzypp-4.3.2/zypp/sat/SATResolver.cc
--- old/libzypp-4.3.1/zypp/sat/SATResolver.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/sat/SATResolver.cc 2008-03-07 10:56:48.000000000 +0100
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
-
+#include <sstream>
#include "zypp/solver/detail/Helper.h"
#include "zypp/base/String.h"
#include "zypp/Capability.h"
@@ -33,6 +33,7 @@
#include "zypp/CapFilters.h"
#include "zypp/sat/SATResolver.h"
#include "zypp/sat/Pool.h"
+#include "zypp/sat/WhatProvides.h"
#include "zypp/solver/detail/ProblemSolutionCombi.h"
extern "C" {
@@ -69,6 +70,35 @@
return VendorAttr::instance().equivalent(id2str(pool, solvable1->vendor), id2str(pool, solvable2->vendor)) ? 0:1;
}
+
+string
+itemToString (PoolItem item, bool shortVersion)
+{
+ ostringstream os;
+ if (!item) return "";
+
+ if (item->kind() != ResTraitszypp::Package::kind)
+ os << item->kind() << ':';
+ os << item->name();
+ if (!shortVersion) {
+ os << '-' << item->edition();
+ if (item->arch() != "") {
+ os << '.' << item->arch();
+ }
+ Repository s = item->repository();
+ if (s) {
+ string alias = s.info().alias();
+ if (!alias.empty()
+ && alias != "@system")
+ {
+ os << '[' << s.info().alias() << ']';
+ }
+ }
+ }
+ return os.str();
+}
+
+
//---------------------------------------------------------------------------
std::ostream &
@@ -409,6 +439,14 @@
_solv = solver_create( _SATPool, sat::Pool::instance().systemRepo().get() );
_solv->vendorCheckCb = &vendorCheck;
+ _solv->fixsystem = _fixsystem;
+ _solv->updatesystem = _updatesystem;
+ _solv->allowdowngrade = _allowdowngrade;
+ _solv->allowuninstall = _allowuninstall;
+ _solv->allowarchchange = _allowarchchange;
+ _solv->dosplitprovides = _dosplitprovides;
+ _solv->noupdateprovide = _noupdateprovide;
+
sat::Pool::instance().prepare();
// Solve !
@@ -506,7 +544,7 @@
};
-std::string SATResolver::SATprobleminfoString(Id problem)
+string SATResolver::SATprobleminfoString(Id problem, string &detail)
{
string ret;
Pool *pool = _solv->pool;
@@ -552,7 +590,55 @@
break;
case SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE:
s = pool_id2solvable(pool, source);
- ret = str::form (_("%s requires %s, but none of the providers can be installed"), solvable2str(pool, s), dep2str(pool, dep));
+ Capability cap(dep);
+ sat::WhatProvides possibleProviders(cap);
+
+ // check, if a provider will be deleted
+ typedef list<PoolItem> ProviderList;
+ ProviderList providerlistInstalled, providerlistUninstalled;
+ for_( iter1, possibleProviders.begin(), possibleProviders.end() ) {
+ PoolItem provider1 = ResPool::instance().find( *iter1 );
+ // find pair of an installed/uninstalled item with the same NVR
+ bool found = false;
+ for_( iter2, possibleProviders.begin(), possibleProviders.end() ) {
+ PoolItem provider2 = ResPool::instance().find( *iter2 );
+ if (compareByNVR (provider1.resolvable(),provider2.resolvable()) == 0
+ && (provider1.status().isInstalled() && provider2.status().isUninstalled()
+ || provider2.status().isInstalled() && provider1.status().isUninstalled())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ if (provider1.status().isInstalled())
+ providerlistInstalled.push_back(provider1);
+ else
+ providerlistUninstalled.push_back(provider1);
+ }
+ }
+
+ ret = str::form (_("%s requires %s, but this requirement cannot be provided"), solvable2str(pool, s), dep2str(pool, dep));
+ if (providerlistInstalled.size() > 0) {
+ detail += _("deleted providers: ");
+ for (ProviderList::const_iterator iter = providerlistInstalled.begin(); iter != providerlistInstalled.end(); iter++) {
+ if (iter == providerlistInstalled.begin())
+ detail += itemToString (*iter, false);
+ else
+ detail += "\n " + itemToString (*iter, false);
+ }
+ }
+ if (providerlistUninstalled.size() > 0) {
+ if (detail.size() > 0)
+ detail += _("\nuninstallable providers: ");
+ else
+ detail = _("uninstallable providers: ");
+ for (ProviderList::const_iterator iter = providerlistUninstalled.begin(); iter != providerlistUninstalled.end(); iter++) {
+ if (iter == providerlistUninstalled.begin())
+ detail += itemToString (*iter, false);
+ else
+ detail += "\n " + itemToString (*iter, false);
+ }
+ }
break;
}
@@ -576,10 +662,11 @@
while ((problem = solver_next_problem(_solv, problem)) != 0) {
MIL << "Problem " << pcnt++ << ":" << endl;
MIL << "====================================" << endl;
- string whatString = SATprobleminfoString(problem);
+ string detail;
+ string whatString = SATprobleminfoString (problem,detail);
MIL << whatString << endl;
MIL << "------------------------------------" << endl;
- ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, "");
+ ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail);
solution = 0;
while ((solution = solver_next_solution(_solv, problem, solution)) != 0) {
element = 0;
@@ -743,8 +830,9 @@
}
if (!_solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && policy_illegal_vendorchange(_solv, s, sd))
{
- string description = str::form (_("vendor change of [%s]%s to [%s]%s") , id2str(pool, s->vendor) , solvable2str(pool, s),
- string(sd->vendor ? id2str(pool, sd->vendor) : " (no vendor) ").c_str(), solvable2str(pool, sd));
+ string description = str::form (_("install %s (with vendor change)\n %s\n-->\n %s") ,
+ solvable2str(pool, sd) , id2str(pool, s->vendor),
+ string(sd->vendor ? id2str(pool, sd->vendor) : " (no vendor) ").c_str() );
MIL << description << endl;
problemSolution->addDescription (description);
gotone = 1;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/sat/SATResolver.h new/libzypp-4.3.2/zypp/sat/SATResolver.h
--- old/libzypp-4.3.1/zypp/sat/SATResolver.h 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/sat/SATResolver.h 2008-03-07 10:56:48.000000000 +0100
@@ -80,7 +80,7 @@
bool _dosplitprovides; /* true: consider legacy split provides */
// ---------------------------------- methods
- std::string SATprobleminfoString (Id problem);
+ std::string SATprobleminfoString (Id problem, std::string &detail);
public:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/sat/Solvable.cc new/libzypp-4.3.2/zypp/sat/Solvable.cc
--- old/libzypp-4.3.1/zypp/sat/Solvable.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/sat/Solvable.cc 2008-03-07 10:56:48.000000000 +0100
@@ -103,7 +103,7 @@
LocCallback *lc = (LocCallback *)vcbdata;
switch (key->type)
{
- case TYPE_ID:
+ case REPOKEY_TYPE_ID:
if (key->name == SolvAttr::mediadir.idStr().id())
{
if (data->localpool)
@@ -112,15 +112,15 @@
lc->mediadir = id2str(data->repo->pool, kv->id);
}
break;
- case TYPE_STR:
+ case REPOKEY_TYPE_STR:
if (key->name == SolvAttr::mediafile.idStr().id())
lc->mediafile = kv->str;
break;
- case TYPE_VOID:
+ case REPOKEY_TYPE_VOID:
if (key->name == SolvAttr::mediafile.idStr().id())
lc->trivial = 1;
break;
- case TYPE_CONSTANT:
+ case REPOKEY_TYPE_CONSTANT:
if (key->name == SolvAttr::medianr.idStr().id())
lc->medianr = kv->num;
break;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/solver/detail/ResolverUpgrade.cc new/libzypp-4.3.2/zypp/solver/detail/ResolverUpgrade.cc
--- old/libzypp-4.3.1/zypp/solver/detail/ResolverUpgrade.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/solver/detail/ResolverUpgrade.cc 2008-03-07 10:56:48.000000000 +0100
@@ -440,7 +440,13 @@
} else if ( provider.status().isToBeUninstalled() ) {
MIL << " IGNORE relation match (package is tagged to delete): " << provider << endl;
} else if ( provider.status().isInstalled() ) {
- MIL << " IGNORE relation match (package is installed): " << provider << endl;
+ if (installed->name() == provider->name()) {
+ MIL << " IGNORE relation match (package is installed): " << provider << endl;
+ } else {
+ MIL << " Take installed package ONLY: " << provider << endl;
+ providersMap.clear();
+ break; // exit for
+ }
}
else {
FindMap::iterator it = providersMap.find( provider->name() );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/target/RequestedLocalesFile.cc new/libzypp-4.3.2/zypp/target/RequestedLocalesFile.cc
--- old/libzypp-4.3.1/zypp/target/RequestedLocalesFile.cc 1970-01-01 01:00:00.000000000 +0100
+++ new/libzypp-4.3.2/zypp/target/RequestedLocalesFile.cc 2008-03-07 10:56:48.000000000 +0100
@@ -0,0 +1,92 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/target/RequestedLocalesFile.cc
+ *
+*/
+#include <iostream>
+#include <fstream>
+
+#include "zypp/base/LogTools.h"
+#include "zypp/base/IOStream.h"
+#include "zypp/base/String.h"
+
+#include "zypp/PathInfo.h"
+#include "zypp/TmpPath.h"
+#include "zypp/Date.h"
+
+#include "zypp/target/RequestedLocalesFile.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace target
+ { /////////////////////////////////////////////////////////////////
+
+ void RequestedLocalesFile::load( const Pathname & file_r, LocaleSet & locales_r )
+ {
+ PathInfo pi( file_r );
+ if ( ! pi.isFile() )
+ {
+ WAR << "Can't read " << pi << endl;
+ return;
+ }
+ std::ifstream infile( file_r.c_str() );
+ for( iostr::EachLine in( infile ); in; in.next() )
+ {
+ std::string l( str::trim(*in) );
+ if ( ! l.empty() && l[0] != '#' )
+ {
+ locales_r.insert( Locale(l) );
+ }
+ }
+ }
+
+ void RequestedLocalesFile::store( const Pathname & file_r, const LocaleSet & locales_r )
+ {
+ filesystem::TmpFile tmp( filesystem::TmpFile::makeSibling( file_r ) );
+
+ std::ofstream outs( tmp.path().c_str() );
+ outs << "# zypp::RequestedLocales generated " << Date::now() << endl;
+ dumpRange( outs, locales_r.begin(), locales_r.end(), "#", "\n", "\n", "\n", "#\n" );
+ outs.close();
+
+ if ( outs.good() )
+ {
+ filesystem::rename( tmp.path(), file_r );
+ }
+ else
+ {
+ ERR << "Can't write " << PathInfo(tmp.path()) << endl;
+ }
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const RequestedLocalesFile & obj )
+ {
+ str << obj.file() << ' ';
+ if ( obj._localesPtr )
+ str << obj.locales();
+ else
+ str << "(unloaded)";
+ return str;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace target
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/target/RequestedLocalesFile.h new/libzypp-4.3.2/zypp/target/RequestedLocalesFile.h
--- old/libzypp-4.3.1/zypp/target/RequestedLocalesFile.h 1970-01-01 01:00:00.000000000 +0100
+++ new/libzypp-4.3.2/zypp/target/RequestedLocalesFile.h 2008-03-07 10:56:48.000000000 +0100
@@ -0,0 +1,110 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/target/RequestedLocalesFile.h
+ *
+*/
+#ifndef ZYPP_TARGET_REQUESTEDLOCALESFILE_H
+#define ZYPP_TARGET_REQUESTEDLOCALESFILE_H
+
+#include <iosfwd>
+
+#include "zypp/base/PtrTypes.h"
+
+#include "zypp/Pathname.h"
+#include "zypp/Locale.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace target
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : RequestedLocalesFile
+ //
+ /** Save and restore locale set from file.
+ */
+ class RequestedLocalesFile
+ {
+ friend std::ostream & operator<<( std::ostream & str, const RequestedLocalesFile & obj );
+
+ public:
+ /** Ctor taking the file to read/write. */
+ RequestedLocalesFile( const Pathname & file_r )
+ : _file( file_r )
+ {}
+
+ /** Return the file path. */
+ const Pathname & file() const
+ { return _file; }
+
+ /** Return the loacale set.
+ * The file is read once on demand. returns an empty set if
+ * the file does not exist or is not readable.
+ */
+ const LocaleSet & locales() const
+ {
+ if ( !_localesPtr )
+ {
+ _localesPtr.reset( new LocaleSet );
+ LocaleSet & ls( *_localesPtr );
+ load( _file, ls );
+ }
+ return *_localesPtr;
+ }
+
+ /** Store a new locale set.
+ * Write the new localeset to file, unless we know it
+ * did not change. The directory containing file must exist.
+ */
+ void setLocales( const LocaleSet & locales_r )
+ {
+ if ( !_localesPtr || differs( *_localesPtr, locales_r ) )
+ {
+ store( _file, locales_r );
+ *_localesPtr = locales_r;
+ }
+ }
+
+ private:
+ /** Helper testing whether two \ref LocaleSet differ. */
+ bool differs( const LocaleSet & lhs, const LocaleSet & rhs ) const
+ {
+ if ( lhs.size() != rhs.size() )
+ return true;
+ for_( it, lhs.begin(), lhs.end() )
+ {
+ if ( rhs.find( *it ) == rhs.end() )
+ return true;
+ }
+ return false;
+ }
+ /** Read \ref LocaleSet from \c file_r. */
+ static void load( const Pathname & file_r, LocaleSet & locales_r );
+ /** Write \ref LocaleSet to \c file_r. */
+ static void store( const Pathname & file_r, const LocaleSet & locales_r );
+
+ private:
+ Pathname _file;
+ mutable scoped_ptr<LocaleSet> _localesPtr;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates RequestedLocalesFile Stream output */
+ std::ostream & operator<<( std::ostream & str, const RequestedLocalesFile & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace target
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_TARGET_REQUESTEDLOCALESFILE_H
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/target/TargetImpl.cc new/libzypp-4.3.2/zypp/target/TargetImpl.cc
--- old/libzypp-4.3.1/zypp/target/TargetImpl.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/target/TargetImpl.cc 2008-03-07 10:56:48.000000000 +0100
@@ -113,20 +113,13 @@
}
int exitCode = prog.close();
- /* FIXME
if ( exitCode != 0 )
{
- storage_r.setObjectFlag( script_r, "SCRIPT_EXEC_FAILED" );
std::ostringstream err;
err << "Script failed with exit code " << exitCode;
report->problem( err.str() );
ZYPP_THROW(Exception(err.str()));
}
- else if ( storage_r.doesObjectHasFlag( script_r, "SCRIPT_EXEC_FAILED" ) )
- {
- storage_r.removeObjectFlag( script_r, "SCRIPT_EXEC_FAILED" );
- }
- */
report->finish();
return;
}
@@ -276,6 +269,7 @@
//
TargetImpl::TargetImpl(const Pathname & root_r)
: _root(root_r)
+ , _requestedLocalesFile( home() / "RequestedLocales" )
{
_rpm.initDatabase(root_r);
MIL << "Initialized target on " << _root << endl;
@@ -292,6 +286,13 @@
MIL << "Targets closed" << endl;
}
+ void TargetImpl::clearCache()
+ {
+ Pathname base = Pathname::assertprefix( _root,
+ ZConfig::instance().repoCachePath() / sat::Pool::instance().systemRepoName() );
+ filesystem::unlink( base.extend(".solv") );
+ filesystem::unlink( base.extend(".cookie") );
+ }
void TargetImpl::buildCache()
{
@@ -379,27 +380,41 @@
void TargetImpl::load()
{
- Pathname base = Pathname::assertprefix( _root, ZConfig::instance().repoCachePath() + sat::Pool::instance().systemRepoName() );
- Pathname rpmsolv = base.extend(".solv");
-
buildCache();
- //now add the repos to the pool
- MIL << "adding " << rpmsolv << " to pool(" << sat::Pool::instance().systemRepoName() << ")";
- Repository system = sat::Pool::instance().systemRepo();
- system.addSolv(rpmsolv);
+ // now add the repos to the pool
+ sat::Pool satpool( sat::Pool::instance() );
+ Repository system( satpool.systemRepo() );
+ Pathname rpmsolv( Pathname::assertprefix( _root, ZConfig::instance().repoCachePath() + system.name() ).extend(".solv") );
+ MIL << "adding " << rpmsolv << " to pool(" << system.name() << ")" << endl;
+#warning PROBABLY CLEAR NONEMTY SYSTEM REPO
- MIL << "Target loaded: " << system.solvablesSize() << " resolvables" << endl;
- }
+ try
+ {
+ system.addSolv( rpmsolv );
+ }
+ catch ( const Exception & exp )
+ {
+ ZYPP_CAUGHT( exp );
+ MIL << "Try to handle exception by rebuilding the solv-file" << endl;
+ clearCache();
+ buildCache();
- Pathname TargetImpl::root() const
- {
- return _root;
- }
+ system.addSolv( rpmsolv );
+ }
- void TargetImpl::reset()
- {
- // FIXME remove
+ // (Re)Load the requested locales.
+ // If the requested locales are empty, we leave the pool untouched
+ // to avoid undoing changes the application applied. We expect this
+ // to happen on a bare metal installation only. An already existing
+ // target should be loaded before its settings are changed.
+ const LocaleSet & requestedLocales( _requestedLocalesFile.locales() );
+ if ( ! requestedLocales.empty() )
+ {
+ satpool.setRequestedLocales( requestedLocales );
+ }
+
+ MIL << "Target loaded: " << system.solvablesSize() << " resolvables" << endl;
}
ZYppCommitResult TargetImpl::commit( ResPool pool_r, const ZYppCommitPolicy & policy_rX )
@@ -413,6 +428,12 @@
// ----------------------------------------------------------------- //
MIL << "TargetImpl::commit(<pool>, " << policy_r << ")" << endl;
+
+ // Store non-package data:
+ filesystem::assert_dir( home() );
+ _requestedLocalesFile.setLocales( pool_r.getRequestedLocales() );
+
+ // Process packages:
ZYppCommitResult result;
TargetImpl::PoolItemList to_uninstall;
@@ -486,6 +507,8 @@
result._srcremaining.insert(result._srcremaining.end(), bad.begin(), bad.end());
}
+ // Try to rebuild solv file while rpm database is still in cache.
+ buildCache();
result._result = (to_install.size() - result._remaining.size());
MIL << "TargetImpl::commit(<pool>, " << policy_r << ") returns: " << result << endl;
@@ -715,8 +738,6 @@
if ( abort )
ZYPP_THROW( TargetAbortedException( N_("Installation has been aborted as directed.") ) );
- buildCache();
-
return remaining;
}
@@ -739,33 +760,7 @@
Date TargetImpl::timestamp() const
{
- Date ts_rpm;
- Date ts_store;
-
- ts_rpm = _rpm.timestamp();
-
- PathInfo store_info = PathInfo( _root + Pathname(ZYPP_DB) + "_store.solv" );
- if (store_info.isExist() )
- ts_store = Date(store_info.mtime());
- else
- ts_store = Date::now();
-
- if ( ts_rpm > ts_store )
- {
- return ts_rpm;
- }
- else if (ts_rpm < ts_store)
- {
- return ts_store;
- }
- else
- {
- // they are the same
- if ( ts_rpm != 0 )
- return ts_rpm;
- else
- return Date::now();
- }
+ return _rpm.timestamp();
}
void TargetImpl::installSrcPackage( const SrcPackage_constPtr & srcPackage_r )
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/target/TargetImpl.h new/libzypp-4.3.2/zypp/target/TargetImpl.h
--- old/libzypp-4.3.1/zypp/target/TargetImpl.h 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/target/TargetImpl.h 2008-03-07 10:56:48.000000000 +0100
@@ -28,6 +28,7 @@
#include "zypp/Target.h"
#include "zypp/target/rpm/RpmDb.h"
#include "zypp/target/TargetException.h"
+#include "zypp/target/RequestedLocalesFile.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -69,12 +70,19 @@
void load();
+ void clearCache();
+
void buildCache();
-
+
public:
/** The root set for this target */
- Pathname root() const;
+ Pathname root() const
+ { return _root; }
+
+ /** The directory to store things. */
+ Pathname home() const
+ { return _root / "/var/lib/zypp"; }
/** Commit changes in the pool */
ZYppCommitResult commit( ResPool pool_r, const ZYppCommitPolicy & policy_r );
@@ -127,20 +135,13 @@
/** return the last modification date of the target */
Date timestamp() const;
- /**
- * reload the target in future calls if
- * needed.
- * note the loading can actually be delayed, but
- * the next call to resolvables must reflect the
- * status of the system.
- */
- void reset();
-
protected:
/** Path to the target */
Pathname _root;
/** RPM database */
rpm::RpmDb _rpm;
+ /** Requested Locales database */
+ RequestedLocalesFile _requestedLocalesFile;
private:
/** Null implementation */
static TargetImpl_Ptr _nullimpl;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/Target.cc new/libzypp-4.3.2/zypp/Target.cc
--- old/libzypp-4.3.1/zypp/Target.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/Target.cc 2008-03-07 10:56:48.000000000 +0100
@@ -91,9 +91,6 @@
Date Target::timestamp() const
{ return _pimpl->timestamp(); }
- void Target::reset()
- { return _pimpl->reset(); }
-
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/Target.h new/libzypp-4.3.2/zypp/Target.h
--- old/libzypp-4.3.1/zypp/Target.h 2008-03-02 18:13:25.000000000 +0100
+++ new/libzypp-4.3.2/zypp/Target.h 2008-03-07 10:56:48.000000000 +0100
@@ -64,14 +64,9 @@
*/
void load();
- /**
- * reload the target in future calls if
- * needed.
- * note the loading can actually be delayed, but
- * the next call to resolvables must reflect the
- * status of the system.
+ /** \deprecated NOOP
*/
- void reset();
+ ZYPP_DEPRECATED void reset() {}
/** Null implementation */
static Target_Ptr nullimpl();
@@ -96,6 +91,7 @@
/** return the last modification date of the target */
Date timestamp() const;
+
public:
/** Ctor */
explicit
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/ZConfig.cc new/libzypp-4.3.2/zypp/ZConfig.cc
--- old/libzypp-4.3.1/zypp/ZConfig.cc 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/ZConfig.cc 2008-03-07 10:56:48.000000000 +0100
@@ -141,7 +141,7 @@
class ZConfig::Impl
{
public:
- Impl()
+ Impl( const Pathname & override_r = Pathname() )
: cfg_arch ( defaultSystemArchitecture() )
, cfg_textLocale ( defaultTextLocale() )
, repo_add_probe ( false )
@@ -152,9 +152,21 @@
{
MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
- // ZYPP_CONF might override /etc/zypp/zypp.conf
- const char *env_confpath = getenv( "ZYPP_CONF" );
- Pathname confpath( env_confpath ? env_confpath : "/etc/zypp/zypp.conf" );
+ // override_r has higest prio
+ // ZYPP_CONF might override /etc/zypp/zypp.conf
+ Pathname confpath( override_r );
+ if ( confpath.empty() )
+ {
+ const char *env_confpath = getenv( "ZYPP_CONF" );
+ confpath = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
+ }
+ else
+ {
+ // Inject this into ZConfig. Be shure this is
+ // allocated via new. See: reconfigureZConfig
+ INT << "Reconfigure to " << confpath << endl;
+ ZConfig::instance()._pimpl.reset( this );
+ }
if ( PathInfo(confpath).isExist() )
{
parser::IniDict dict( confpath );
@@ -268,6 +280,14 @@
};
///////////////////////////////////////////////////////////////////
+ // Backdoor to redirect ZConfig from within the running
+ // TEST-application. HANDLE WITH CARE!
+ void reconfigureZConfig( const Pathname & override_r )
+ {
+ // ctor puts itself unter smart pointer control.
+ new ZConfig::Impl( override_r );
+ }
+
///////////////////////////////////////////////////////////////////
//
// METHOD NAME : ZConfig::instance
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-4.3.1/zypp/ZConfig.h new/libzypp-4.3.2/zypp/ZConfig.h
--- old/libzypp-4.3.1/zypp/ZConfig.h 2008-03-02 18:13:24.000000000 +0100
+++ new/libzypp-4.3.2/zypp/ZConfig.h 2008-03-07 10:56:48.000000000 +0100
@@ -147,6 +147,7 @@
/** Dtor */
~ZConfig();
private:
+ friend class Impl;
/** Default ctor. */
ZConfig();
/** Pointer to implementation */
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org