Adapt code to CpeId api
authorMichael Andres <ma@suse.de>
Wed, 2 Apr 2014 16:01:48 +0000 (18:01 +0200)
committerMichael Andres <ma@suse.de>
Wed, 2 Apr 2014 16:01:48 +0000 (18:01 +0200)
tests/repo/ExtendedMetadata_test.cc
tests/repo/yum/data/extensions/repodata/repomd.xml
zypp/Repository.cc

index 0a423fd..64d4de1 100644 (file)
@@ -48,8 +48,7 @@ BOOST_AUTO_TEST_CASE(extended_metadata)
 
   // check that the attributes of product compatibility are ok
   int count = 0;
-#if 0
-  vector<string> cpeids;
+  vector<CpeId> cpeids;
   vector<string> labels;
 
   for_( it,
@@ -63,8 +62,8 @@ BOOST_AUTO_TEST_CASE(extended_metadata)
 
   // 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( 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" );
@@ -84,15 +83,14 @@ BOOST_AUTO_TEST_CASE(extended_metadata)
 
   // the repo updates one product
   BOOST_CHECK_EQUAL( count, 1 );
-  BOOST_CHECK_EQUAL( cpeids[0], "cpe://o:sle" );
+  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") );
-#endif
+  BOOST_CHECK( repo.providesUpdatesFor(CpeId("cpe:/o:sle")) );
+  BOOST_CHECK( ! repo.providesUpdatesFor(CpeId("cpe:/o:windows")) );
   // reuse to count solvables
   count = 0;
 
index 03af328..eee1c85 100644 (file)
@@ -1,6 +1,15 @@
 <?xml version="1.0" ?>
 <repomd xmlns="http://linux.duke.edu/metadata/repo">
-  <data type="other">
+  <tags>
+    <repo>obsrepository://build.suse.de/SUSE:openSUSE:11:standard</repo>
+    <content>opensuse</content>
+    <content>i386</content>
+    <content>other string</content>
+    <distro cpeid="cpe:/o:opensuse">openSUSE 11.0</distro>
+    <distro cpeid="cpe:/o:sle">SLE 11.0</distro>
+    <updates cpeid="cpe:/o:sle">SLE 11.0</updates>
+  </tags>
+   <data type="other">
     <location href="repodata/other.xml.gz"/>
     <checksum type="sha">603807e12e7418911fa9f158ef66b9c20f1df567</checksum>
     <timestamp>1215823452</timestamp>
     <timestamp>1215823454</timestamp>
     <open-checksum type="sha">c6bd3c6099de74d97ed045163235be10ffa8a85f</open-checksum>
   </data>
-  
+
   <data type="susedata">
     <location href="repodata/susedata.xml.gz"/>
     <checksum type="sha">359396be40992603aecf6e2832839111e09eb080</checksum>
     <timestamp>1227279057.0</timestamp>
     <open-checksum type="sha">b17c055bef95bca397faffdf028cfa91dd1b24bc</open-checksum>
   </data>
-  
+
   <data type="suseinfo">
     <location href="repodata/suseinfo.xml.gz"/>
     <checksum type="sha">e0b9149c1b7f48c952e9b3ea996669d8d0d9e1e8</checksum>
index 809a072..94ef610 100644 (file)
@@ -147,7 +147,7 @@ namespace zypp
       NO_REPOSITORY_RETURN( false );
       for_( it, updatesProductBegin(), updatesProductEnd() )
       {
-       if ( cpeid_r.match( it.cpeId() ) == CpeId::Match::subset )
+       if ( compare( cpeid_r, it.cpeId(), SetRelation::subset ) )
          return true;
       }
       return false;