Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11773 - in /trunk/libzypp: tests/repo/ tests/repo/yum/data/extensions/repodata/ zypp/
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Fri, 21 Nov 2008 15:33:27 -0000
  • Message-id: <20081121153327.685DBFB73F@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Fri Nov 21 16:33:26 2008
New Revision: 11773

URL: http://svn.opensuse.org/viewcvs/zypp?rev=11773&view=rev
Log:
- everything now in place with product repo matching
- add testcase
- it is not used right now, but API has to be in place

Added:
trunk/libzypp/tests/repo/ExtendedMetadata_test.cc
Removed:
trunk/libzypp/tests/repo/OutdatedMetadata_test.cc
Modified:
trunk/libzypp/tests/repo/CMakeLists.txt
trunk/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml
trunk/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz
trunk/libzypp/zypp/Repository.cc
trunk/libzypp/zypp/Repository.h

Modified: trunk/libzypp/tests/repo/CMakeLists.txt
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/CMakeLists.txt?rev=11773&r1=11772&r2=11773&view=diff
==============================================================================
--- trunk/libzypp/tests/repo/CMakeLists.txt (original)
+++ trunk/libzypp/tests/repo/CMakeLists.txt Fri Nov 21 16:33:26 2008
@@ -4,4 +4,4 @@
# to find the KeyRingTest receiver
INCLUDE_DIRECTORIES( ${LIBZYPP_SOURCE_DIR}/tests/zypp )

-ADD_TESTS(RepoVariables OutdatedMetadata)
+ADD_TESTS(RepoVariables ExtendedMetadata)

Added: trunk/libzypp/tests/repo/ExtendedMetadata_test.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/ExtendedMetadata_test.cc?rev=11773&view=auto
==============================================================================
--- trunk/libzypp/tests/repo/ExtendedMetadata_test.cc (added)
+++ trunk/libzypp/tests/repo/ExtendedMetadata_test.cc Fri Nov 21 16:33:26 2008
@@ -0,0 +1,94 @@
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <list>
+#include <string>
+
+#include <boost/test/auto_unit_test.hpp>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/PathInfo.h"
+#include "zypp/TmpPath.h"
+#include "zypp/RepoManager.h"
+#include "zypp/sat/Pool.h"
+#include "KeyRingTestReceiver.h"
+
+#include "TestSetup.h"
+
+using boost::unit_test::test_case;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::repo;
+using namespace zypp::filesystem;
+
+#define TEST_DIR TESTS_SRC_DIR "/repo/yum/data/extensions"
+
+BOOST_AUTO_TEST_CASE(extended_metadata)
+{
+ KeyRingTestReceiver rec;
+ //rec.answerAcceptUnknownKey(true);
+ rec.answerAcceptUnsignedFile(true);
+
+
+// rec.answerImportKey(true);
+ Pathname repodir(TEST_DIR );
+
+ sat::Pool pool(sat::Pool::instance());
+
+ TestSetup test( Arch_x86_64 );
+ test.loadRepo(Url(string("dir:") + repodir.absolutename().asString()),
"updates");
+
+ Repository repo = pool.reposFind("updates");
+
+ BOOST_CHECK_EQUAL( repo.generatedTimestamp(), Date(1227279057) );
+ BOOST_CHECK_EQUAL( repo.suggestedExpirationTimestamp(), Date(1227279057 +
3600) );
+
+ // check that the attributes of product compatibility are ok
+ int count = 0;
+ vector<string> cpeids;
+ vector<string> labels;
+
+ for_( it,
+ repo.compatibleWithProductBegin(),
+ repo.compatibleWithProductEnd() )
+ {
+ cpeids.push_back(it.cpeId());
+ labels.push_back(it.label());
+ count++;
+ }
+
+ // there were 2 compatible products
+ BOOST_CHECK_EQUAL( count, 2 );
+ BOOST_CHECK_EQUAL( cpeids[0], "cpe://o:opensuse" );
+ BOOST_CHECK_EQUAL( cpeids[1], "cpe://o:sle" );
+
+ BOOST_CHECK_EQUAL( labels[0], "openSUSE 11.0" );
+ BOOST_CHECK_EQUAL( labels[1], "SLE 11.0" );
+
+ cpeids.clear();
+ labels.clear();
+ count = 0;
+
+ for_( it,
+ repo.updatesProductBegin(),
+ repo.updatesProductEnd() )
+ {
+ cpeids.push_back(it.cpeId());
+ labels.push_back(it.label());
+ count++;
+ }
+
+ // the repo updates one product
+ BOOST_CHECK_EQUAL( count, 1 );
+ BOOST_CHECK_EQUAL( cpeids[0], "cpe://o:sle" );
+ BOOST_CHECK_EQUAL( labels[0], "SLE 11.0" );
+
+ // because this product updates something, it _is_ an update repo
+ BOOST_CHECK( repo.isUpdateRepo() );
+
+ BOOST_CHECK( repo.providesUpdatesFor("cpe://o:sle") );
+ BOOST_CHECK( ! repo.providesUpdatesFor("cpe://o:windows") );
+
+}

Modified: trunk/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml?rev=11773&r1=11772&r2=11773&view=diff
==============================================================================
--- trunk/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml (original)
+++ trunk/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml Fri Nov 21
16:33:26 2008
@@ -18,10 +18,12 @@
<timestamp>1215823454</timestamp>
<open-checksum
type="sha">c6bd3c6099de74d97ed045163235be10ffa8a85f</open-checksum>
</data>
+
+
<data type="suseinfo">
<location href="repodata/suseinfo.xml.gz"/>
- <checksum type="sha">a9cf8892e8bb47ed09f05f40e42c390a943e61f5</checksum>
- <timestamp>1222083131</timestamp>
- <open-checksum
type="sha">a3011438085ac55f06c68053201ea3ded17ee85c</open-checksum>
+ <checksum type="sha">e0b9149c1b7f48c952e9b3ea996669d8d0d9e1e8</checksum>
+ <timestamp>1227279057.0</timestamp>
+ <open-checksum
type="sha">b17c055bef95bca397faffdf028cfa91dd1b24bc</open-checksum>
</data>
</repomd>

Modified: trunk/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz?rev=11773&r1=11772&r2=11773&view=diff
==============================================================================
Files trunk/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz
(original) and
trunk/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz Fri Nov
21 16:33:26 2008 differ

Modified: trunk/libzypp/zypp/Repository.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.cc?rev=11773&r1=11772&r2=11773&view=diff
==============================================================================
--- trunk/libzypp/zypp/Repository.cc (original)
+++ trunk/libzypp/zypp/Repository.cc Fri Nov 21 16:33:26 2008
@@ -106,13 +106,24 @@
bool Repository::providesUpdatesFor( const std::string &key ) const
{
NO_REPOSITORY_RETURN( false );
+
+ for_( it,
+ updatesProductBegin(),
+ updatesProductEnd() )
+ {
+ // FIXME implement real CPE matching here
+ // someday
+ if ( key == it.cpeId() )
+ return true;
+ }
+
return false;
}

bool Repository::isUpdateRepo() const
{
NO_REPOSITORY_RETURN( false );
- return false;
+ return ( updatesProductBegin() != updatesProductEnd() );
}

bool Repository::solvablesEmpty() const

Modified: trunk/libzypp/zypp/Repository.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.h?rev=11773&r1=11772&r2=11773&view=diff
==============================================================================
--- trunk/libzypp/zypp/Repository.h (original)
+++ trunk/libzypp/zypp/Repository.h Fri Nov 21 16:33:26 2008
@@ -125,6 +125,9 @@
* The suggested expiration date of this repository
* already passed
*
+ * rpm-md repositories can provide this tag using the
+ * expire extension tag:
+ * \see
http://en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29.2C_extensions_to_repomd.xml
*/
bool maybeOutdated() const;

@@ -132,18 +135,22 @@
* if the repository claims to update something then
* it is an update repository
*
- * This is implemented by looking at an "update" keyword
- * on the repository tags
+ * This is implemented by looking at the repository updates
+ * tag.
+ * \see
http://en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29.2C_extensions_to_repomd.xml
*/
bool isUpdateRepo() const;

/**
* wether the repository claims to update something \ref prod
- * with key \ref cpename
+ * with key \ref cpeid
*
- * See http://cpe.mitre.org/ for more information on CPE
+ * \see zypp::Product::cpeId()
+ *
+ * See http://cpe.mitre.org/ for more information on the
+ * Common Platform Enumearation.
*/
- bool providesUpdatesFor( const std::string &cpename ) const;
+ bool providesUpdatesFor( const std::string &cpeid ) const;

/** Whether \ref Repository contains solvables. */
bool solvablesEmpty() const;
@@ -165,6 +172,8 @@
/**
* Get an iterator to the beginning of the repository
* compatible distros.
+ * \note This is only a hint. There is no guarantee that
+ * the repository is built for that product.
* \see Repository::ProductInfoIterator
*/
ProductInfoIterator compatibleWithProductBegin() const;

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages