Mailinglist Archive: zypp-commit (500 mails)

< Previous Next >
[zypp-commit] r5988 - in /branches/REFACTORING-10_3/libzypp: tests/cache/CacheStore_test.cc zypp/cache/CacheAttributes.h zypp/cache/CacheStore.cc zypp/cache/CacheStore.h zypp/repo/cached/PackageImpl.cc
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Thu, 12 Jul 2007 11:29:50 -0000
  • Message-id: <20070712112951.204BAB2418@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Thu Jul 12 13:29:50 2007
New Revision: 5988

URL: http://svn.opensuse.org/viewcvs/zypp?rev=5988&view=rev
Log:

- fix package group
- save shared data id in resolvable
- testcases


Modified:
    branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc
    branches/REFACTORING-10_3/libzypp/zypp/cache/CacheAttributes.h
    branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc
    branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.h
    branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.cc

Modified: branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc?rev=5988&r1=5987&r2=5988&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc (original)
+++ branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc Thu Jul 12 13:29:50 2007
@@ -72,6 +72,28 @@
   }
 }
 
+void check_glabels_package( Package::Ptr p )
+{
+//<checksum type="sha" pkgid="YES">34adf06a0c4873b9d53b4634beb8bee458b45767</checksum>
+//       <time file="1165536261" build="1165501960"/>
+//       <size package="983124" installed="2257356" archive="2271256"/>
+//       <location href="rpm/i586/glabels-2.0.4-30.2.i586.rpm"/>
+  
+  MIL << "package group: " << p->group()<< endl;
+  
+  BOOST_CHECK_EQUAL( p->name(), "glabels");
+  BOOST_CHECK_EQUAL( p->edition(), Edition("2.0.4", "30.2", "0") );
+  BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+  BOOST_CHECK_EQUAL( p->summary(), "A Label Editing and Printing Tool" );
+  BOOST_CHECK_EQUAL( p->description().substr(0, 20), "Labels is a powerful");
+  BOOST_CHECK_EQUAL( p->packager(), "http://bugs.opensuse.org";);
+  BOOST_CHECK_EQUAL( p->url(), "http://glabels.sourceforge.net/";);
+  
+  BOOST_CHECK_MESSAGE( !p->group().empty(), "Package group not empty");
+  MIL << "package location: " << p->location()<< endl;
+  BOOST_CHECK_MESSAGE( !p->location().filename().empty(), "Package group not empty");
+}
+
 void cache_write_test2(const string &dir)
 {
   data::RecordId repository_id;
@@ -99,6 +121,7 @@
         
     MIL << dbres.size() << " resolvables" << endl;
     
+    bool found_glabels_i586 = false;
     for ( ResStore::const_iterator it = dbres.begin();
           it != dbres.end();
           ++it )
@@ -106,12 +129,14 @@
       if ( isKind<Package>(*it) )
       {
         Package::Ptr p = asKind<Package>(*it);
-        MIL << "package group: " << p->group()<< endl;
-        BOOST_CHECK_MESSAGE( !p->group().empty(), "Package group not empty");
-        MIL << "package location: " << p->location()<< endl;
-        BOOST_CHECK_MESSAGE( !p->location().filename().empty(), "Package group not empty");
+        if ( (p->name() == "glabels") && p->arch() == Arch("i586") )
+        {
+          found_glabels_i586 = true;
+          check_glabels_package(p);
+        }
       }
     }
+    BOOST_CHECK_MESSAGE( found_glabels_i586, "Package glabels i586 should be in cache");
   }
   
   // now clean the repo and check everything is clean
@@ -137,7 +162,8 @@
             (tablename == "types" ) ||
             (tablename == "names" ) ||
             (tablename == "file_names" ) ||
-            (tablename == "dir_names" )
+            (tablename == "dir_names" ) ||
+            (tablename == "files" )
       )
         continue;
 

Modified: branches/REFACTORING-10_3/libzypp/zypp/cache/CacheAttributes.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/cache/CacheAttributes.h?rev=5988&r1=5987&r2=5988&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/cache/CacheAttributes.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/cache/CacheAttributes.h Thu Jul 12 13:29:50 2007
@@ -34,6 +34,7 @@
     inline const Attribute & attrPackageChecksumType()         { static Attribute a("Package","checksumType"); return a; }
     inline const Attribute & attrPackageDistribution()         { static Attribute a("Package","distribution"); return a; }
     inline const Attribute & attrPackageGroup()                { static Attribute a("Package","group"); return a; }
+    inline const Attribute & attrPackagePackager()                { static Attribute a("Package","packager"); return a; }
     inline const Attribute & attrPackageKeywords()             { static Attribute a("Package","keywords"); return a; }
     inline const Attribute & attrPackageLicense()              { static Attribute a("Package","license"); return a; }
     inline const Attribute & attrPackageOperatingSystem()      { static Attribute a("Package","operatingSystem"); return a; }
@@ -70,6 +71,7 @@
     inline const Attribute & attrProductShortName()            { static Attribute a("Product","shortName"); return a; }
     inline const Attribute & attrProductUpdateUrls()           { static Attribute a("Product","updateUrls"); return a; }
     ///////////////////////////////////////////////////////////////////
+
     inline const Attribute & attrResObjectArchiveSize()        { static Attribute a("ResObject","archiveSize"); return a; }
     inline const Attribute & attrResObjectBuildTime()          { static Attribute a("ResObject","buildTime"); return a; }
     inline const Attribute & attrResObjectDelnotify()          { static Attribute a("ResObject","delnotify"); return a; }

Modified: branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc?rev=5988&r1=5987&r2=5988&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc Thu Jul 12 13:29:50 2007
@@ -91,7 +91,7 @@
 
     append_other_dependency_cmd.reset( new sqlite3_command( con, "insert into other_capabilities ( resolvable_id, dependency_type, refers_kind, value ) values ( :resolvable_id, :dependency_type, :refers_kind, :value );" ));
 
-    append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :repository_id );" ));
+    append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, shared_id, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :shared_id, :repository_id );" ));
 
     count_shared_cmd.reset( new sqlite3_command( con, "select count(id) from resolvables where shared_id=:rid;" ));
 
@@ -220,7 +220,8 @@
   appendStringAttribute( pkgid, attrPackageBuildhost(), package->buildhost );
   appendStringAttribute( pkgid, attrPackageDistribution(), package->distribution );
   appendStringAttribute( pkgid, attrPackageLicense(), package->license );
-  appendStringAttribute( pkgid, attrPackageGroup(), package->packager );
+  appendStringAttribute( pkgid, attrPackageGroup(), package->group );
+  appendStringAttribute( pkgid, attrPackagePackager(), package->packager );
   appendStringAttribute( pkgid, attrPackageUrl(), package->url );
   appendStringAttribute( pkgid, attrPackageOperatingSystem(), package->operatingSystem );
   appendStringAttribute( pkgid, attrPackagePrein(), package->prein );
@@ -431,6 +432,20 @@
                                        const NVRA &nvra,
                                        const data::Dependencies &deps )
 {
+  return appendResolvable( repository_id,
+                           kind,
+                           nvra,
+                           deps,
+                           data::noRecordId );
+}
+
+data::RecordId
+    CacheStore::appendResolvable( const data::RecordId &repository_id,
+                                  const Resolvable::Kind &kind,
+                                  const NVRA &nvra,
+                                  const data::Dependencies &deps,
+                                  const data::RecordId &shared_id )
+{
   _pimpl->append_resolvable_cmd->bind( ":name", nvra.name );
   _pimpl->append_resolvable_cmd->bind( ":version", nvra.edition.version() );
   _pimpl->append_resolvable_cmd->bind( ":release", nvra.edition.release() );
@@ -438,6 +453,11 @@
   _pimpl->append_resolvable_cmd->bind( ":arch", lookupOrAppendType("arch", nvra.arch.asString()) );
   _pimpl->append_resolvable_cmd->bind( ":kind", lookupOrAppendType("kind", kind.asString()) );
   _pimpl->append_resolvable_cmd->bind( ":repository_id", repository_id );
+  
+  if ( shared_id == data::noRecordId )
+    _pimpl->append_resolvable_cmd->bind(":shared_id");
+  else
+    _pimpl->append_resolvable_cmd->bind( ":shared_id", shared_id );
 
   _pimpl->append_resolvable_cmd->executenonquery();
 

Modified: branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.h?rev=5988&r1=5987&r2=5988&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.h Thu Jul 12 13:29:50 2007
@@ -228,6 +228,21 @@
                                        const data::Dependencies &deps );
 
       /**
+       * \short Appends a resolvable, and sets shared data with another one
+       *
+       * \see appendResolvable
+       * \param shared_id Resolvable that provides data in case
+       * this one does not provide an attribute
+       *
+       * \note Not all attributes can be shared. \ref shared_id is just
+       * a hint for the queries.
+       */
+      data::RecordId appendResolvable( const data::RecordId &repository_id,
+                                       const Resolvable::Kind &kind,
+                                       const NVRA &nvra,
+                                       const data::Dependencies &deps,
+                                       const data::RecordId &shared_id );
+      /**
        * Adds dependencies to the store
        *
        * A map of dependency lists has to be specified. The map contains

Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.cc?rev=5988&r1=5987&r2=5988&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.cc Thu Jul 12 13:29:50 2007
@@ -115,9 +115,7 @@
 
 std::string PackageImpl::packager() const
 {
-#warning DUBIOUS ATTRIBUTE
-  return "";
-  //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePackager() );
+  return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePackager() );
 }
 
 PackageGroup PackageImpl::group() 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