Author: schubi2
Date: Thu Jan 31 14:36:14 2008
New Revision: 8423
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8423&view=rev
Log:
-testcase for vendors added
-bugfix in zypp.config and vendor definition
Added:
branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor1.cc
branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/
branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/
branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp1.conf
Modified:
branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt
branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.cc
branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.h
branches/tmp/ma/jump_sat/libzypp/zypp/ZConfig.cc
Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt (original)
+++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt Thu Jan 31 14:36:14 2008
@@ -65,6 +65,9 @@
ADD_EXECUTABLE( ProgressData ProgressData_test.cc )
TARGET_LINK_LIBRARIES( ProgressData zypp boost_unit_test_framework )
+ADD_EXECUTABLE(Vendor1 Vendor1.cc)
+TARGET_LINK_LIBRARIES(Vendor1 zypp boost_unit_test_framework )
+
ADD_TEST(ArchTest ${CMAKE_CURRENT_BINARY_DIR}/Arch)
ADD_TEST(UrlTest ${CMAKE_CURRENT_BINARY_DIR}/Url)
ADD_TEST(Edition ${CMAKE_CURRENT_BINARY_DIR}/Edition)
@@ -83,3 +86,4 @@
ADD_TEST(RepoInfoTest ${CMAKE_CURRENT_BINARY_DIR}/RepoInfo ${CMAKE_CURRENT_SOURCE_DIR}/data/RepoInfo)
ADD_TEST(FetcherTest ${CMAKE_CURRENT_BINARY_DIR}/Fetcher)
ADD_TEST(ProgressData_test ${CMAKE_CURRENT_BINARY_DIR}/ProgressData)
+ADD_TEST(Vendor1Test ${CMAKE_CURRENT_BINARY_DIR}/Vendor1)
Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor1.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor1.cc?rev=8423&view=auto
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor1.cc (added)
+++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor1.cc Thu Jan 31 14:36:14 2008
@@ -0,0 +1,49 @@
+
+#include <iostream>
+#include <list>
+#include <string>
+
+// Boost.Test
+#include
+#include
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
+using boost::test_tools::close_at_tolerance;
+
+// parameterized test
+// http://www.boost.org/libs/test/example/unit_test_example4.cpp
+
+#include "zypp/base/LogControl.h"
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/ZYpp.h"
+#include "zypp/VendorAttr.h"
+
+using namespace std;
+using namespace zypp;
+
+
+// most frequently you implement test cases as a free functions
+void vendor_test()
+{
+ // 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") );
+}
+
+test_suite*
+init_unit_test_suite( int, char* [] )
+{
+ setenv("ZYPP_CONF", "./../../tests/zypp/data/Vendor/zypp1.conf", 1 );
+ zypp::base::LogControl::instance().logfile( "-" );
+ test_suite* test= BOOST_TEST_SUITE( "VendorTest" );
+ test->add( BOOST_TEST_CASE( &vendor_test ), 5 /* expected zero error */ , 0);
+ return test;
+}
+
Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp1.conf
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp1.conf?rev=8423&view=auto
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp1.conf (added)
+++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp1.conf Thu Jan 31 14:36:14 2008
@@ -0,0 +1,126 @@
+## Configuration file for software management
+## /etc/zypp/zypp.conf
+##
+## Boolean values are 0 1 yes no on off true false
+
+
+[main]
+
+
+##
+## Override the detected architecture
+##
+## Valid values: i586, i686, x86_64, ppc, ppc64, ia64, s390, s390x, ..
+## Default value: Autodetected
+##
+## ** CAUTION: Only set if you know what you're doing !
+## ** Changing this needs a full refresh (incl. download)
+## ** of all repository data.
+##
+# arch = s390
+
+
+##
+## Path where the repo metadata is downloaded and kept.
+##
+## Valid values: A directory
+## Default value: /var/cache/zypp/raw
+##
+## Changing this needs a full refresh (incl. download) of all repository data
+##
+# metadatadir = /var/cache/zypp/raw
+
+
+##
+## Path where the known repositories .repo files are kept
+##
+## Valid values: A directory
+## Default value: /etc/zypp/repos.d
+##
+## Changing this invalidates all known repositories
+##
+# reposdir = /etc/zypp/repos.d
+
+
+##
+## Path where the processed cache is kept (this is where zypp.db is located)
+##
+## Valid values: A directory
+## Default value: /var/cache/zypp
+##
+## Changing this needs a full refresh (except download) of all repository data
+##
+# cachedir = /var/cache/zypp
+
+
+##
+## Whether repository urls should be probed when added
+##
+## Valid values: boolean
+## Default value: false
+##
+## If true, accessability of repositories is checked immediately (when added)
+## (e.g. 'zypper ar' will check immediately)
+## If false, accessability of repositories is checked when refreshed
+## (e.g. 'zypper ar' will delay the check until the next refresh)
+##
+# repo.add.probe = false
+
+
+##
+## Amount of time in minutes that must pass before another refresh.
+##
+## Valid values: Integer
+## Default value: 10
+##
+## If you have autorefresh enabled for a repository, it is checked for
+## up-to-date metadata not more often than every
+## minutes. If an automatic request for refresh comes before
+## minutes passed since the last check, the request is ignored.
+##
+## A value of 0 means the repository will always be checked. To get the oposite
+## effect, disable autorefresh for your repositories.
+##
+## This option has no effect for repositories with autorefresh disabled, nor for
+## user-requested refresh.
+##
+# repo.refresh.delay = 10
+
+
+##
+## Whether to consider using a .patch.rpm when downloading a package
+##
+## Valid values: boolean
+## Default value: true
+##
+## Using a patch rpm will decrease the download size for package updates
+## since it does not contain all files of the package but only the changed
+## ones. The .patch.rpm is ready to be installed immediately after download.
+## There is no further processing needed, as it is for a .delta.rpm.
+##
+# download.use_patchrpm = true
+
+
+##
+## Whether to consider using a .delta.rpm when downloading a package
+##
+## Valid values: boolean
+## Default value: true
+##
+## Using a delta rpm will decrease the download size for package updates
+## since it does not contain all files of the package but only the binary
+## diff of changed ones. Recreating the rpm package on the local machine
+## is an expensive operation (memory,CPU). If your network connection is
+## not too slow, you benefit from disabling .delta.rpm.
+##
+# download.use_deltarpm = true
+
+
+##
+## Defining directory for equivalent vendors
+##
+## Valid values: A directory
+## Default value: /etc/zypp/vondors.d
+##
+vendordir = data/Vendor/notExist
+
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.cc?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.cc Thu Jan 31 14:36:14 2008
@@ -107,7 +107,7 @@
VendorAttr::VendorAttr ()
{
vendorGroupCounter = 1;
-
+ Pathname xxx = ZConfig::instance().repoCachePath();
Pathname vendorPath (ZConfig::instance().vendorPath());
try
{
@@ -126,18 +126,24 @@
//checking if suse,opensuse has been defined. If not create entries
if (_vendorMap.find("suse") != _vendorMap.end()) {
if (_vendorMap.find("opensuse") == _vendorMap.end()) {
- _vendorMap["opensuse"] = ++vendorGroupCounter;
+ _vendorMap["opensuse"] = vendorGroupCounter;
}
} else {
if (_vendorMap.find("opensuse") == _vendorMap.end()) {
// both are not available. Create one group with suse,opensuse
- _vendorMap["opensuse"] = ++vendorGroupCounter;
+ _vendorMap["opensuse"] = vendorGroupCounter;
_vendorMap["suse"] = vendorGroupCounter;
} else {
- _vendorMap["suse"] = ++vendorGroupCounter;
+ _vendorMap["suse"] = vendorGroupCounter;
}
}
-
+
+ MIL << "Equivalent vendors:" << endl;
+ for (VendorMap::iterator it = _vendorMap.begin();
+ it != _vendorMap.end();
+ it ++) {
+ MIL << " " << it->first << " (group " << it->second << ")" << endl;
+ }
}
bool VendorAttr::addVendorFile( const Pathname & filename ) const
@@ -179,13 +185,6 @@
}
}
}
-
- MIL << "Equivalent vendors:" << endl;
- for (VendorMap::iterator it = _vendorMap.begin();
- it != _vendorMap.end();
- it ++) {
- MIL << " " << it->first << "(group " << it->second << ")" << endl;
- }
return true;
}
@@ -218,13 +217,15 @@
}
- bool VendorAttr::equivalent( const Vendor & lhs, const Vendor & rhs ) const
+ bool VendorAttr::equivalent( const Vendor & lVendor, const Vendor & rVendor ) const
{
- if ( lhs == rhs )
- return true;
-
unsigned int lhsID = 0;
unsigned int rhsID = 0;
+ Vendor lhs = str::toLower (lVendor);
+ Vendor rhs = str::toLower (rVendor);
+
+ if ( lhs == rhs )
+ return true;
if (_matchMap.find(lhs) != _matchMap.end()) {
lhsID = _matchMap[lhs];
@@ -255,8 +256,8 @@
}
}
}
-
- return( lhsID == lhsID );
+
+ return( lhsID && rhsID && lhsID == lhsID );
}
/////////////////////////////////////////////////////////////////
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.h?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/VendorAttr.h Thu Jan 31 14:36:14 2008
@@ -44,7 +44,7 @@
* equivalent vendor when updating. Replacing a package with one of a
* different vendor usually must be confirmed by the user.
*/
- bool equivalent( const Vendor & lhs, const Vendor & rhs ) const;
+ bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const;
private:
VendorAttr();
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/ZConfig.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/ZConfig.cc?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/ZConfig.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/ZConfig.cc Thu Jan 31 14:36:14 2008
@@ -51,6 +51,7 @@
// 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" );
if ( PathInfo(confpath).isExist())
{
@@ -106,19 +107,17 @@
{
download_use_patchrpm = str::strToBool( value, download_use_patchrpm );
}
- else if ( entry == "download.use_deltarpm" )
- {
+ else if ( entry == "download.use_deltarpm" )
+ {
download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
- }
- }
- else if ( section == "vendordir" )
- {
- cfg_vendor_path = Pathname(value);
+ }
+ else if ( entry == "vendordir" )
+ {
+ cfg_vendor_path = Pathname(value);
+ }
}
-
}
}
-
}
~Impl()
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org