Mailinglist Archive: zypp-commit (325 mails)

< Previous Next >
[zypp-commit] r7116 - in /trunk/libzypp: tests/cache/CacheStore_test.cc tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en zypp/cache/CacheStore.cc zypp/cache/ResolvableQuery.cc
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Thu, 06 Sep 2007 00:23:59 -0000
  • Message-id: <20070906002359.99AC025138@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Thu Sep  6 02:23:59 2007
New Revision: 7116

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7116&view=rev
Log:
- Fix for bug #307163 - empty package descriptions
  a.k.a shared tag not 100% implemented

Note: calling the same query in recursive manner is tricky.
All the tips to get my testcase to pass, where here:
http://www.sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence

Modified:
    trunk/libzypp/tests/cache/CacheStore_test.cc
    trunk/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en
    trunk/libzypp/zypp/cache/CacheStore.cc
    trunk/libzypp/zypp/cache/ResolvableQuery.cc

Modified: trunk/libzypp/tests/cache/CacheStore_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheStore_test.cc?rev=7116&r1=7115&r2=7116&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CacheStore_test.cc (original)
+++ trunk/libzypp/tests/cache/CacheStore_test.cc Thu Sep  6 02:23:59 2007
@@ -415,7 +415,11 @@
       Package::Ptr p = asKind<Package>(*it);
       if ( (p->name() == "foo") && p->arch() == Arch("x86_64") )
       {
-        BOOST_CHECK_EQUAL( p->description(), "foo bar");
+        BOOST_CHECK_EQUAL( p->description(), "This is the description");
+      }
+      if ( (p->name() == "foo") && p->arch() == Arch("i586") )
+      {
+        BOOST_CHECK_EQUAL( p->description(), "This is the description");
       }
     }
   }

Modified: trunk/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en?rev=7116&r1=7115&r2=7116&view=diff
==============================================================================
--- trunk/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en (original)
+++ trunk/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en Thu Sep  6 02:23:59 2007
@@ -2,7 +2,6 @@
 =Pkg: foo 1.0 1 i586
 =Sum: Foo program
 +Des:
-<!-- DT:Rich -->
-<p>This package contains foo</p>
+This is the description
 -Des:
 ##----------------------------------------

Modified: trunk/libzypp/zypp/cache/CacheStore.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheStore.cc?rev=7116&r1=7115&r2=7116&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheStore.cc (original)
+++ trunk/libzypp/zypp/cache/CacheStore.cc Thu Sep  6 02:23:59 2007
@@ -275,7 +275,7 @@
                                     const data::Package_Ptr & package )
 {
   RecordId id = appendResolvable( repository_id, ResTraits<Package>::kind,
-      NVRA( package->name, package->edition, package->arch ), package->deps );
+      NVRA( package->name, package->edition, package->arch ), package->deps, package->shareDataWith );
   appendResObjectAttributes( id, package );
   appendPackageBaseAttributes( id, package );
 
@@ -292,7 +292,7 @@
                                        const data::SrcPackage_Ptr & package )
 {
   RecordId id = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
-      NVRA( package->name, package->edition, package->arch ), package->deps );
+      NVRA( package->name, package->edition, package->arch ), package->deps, package->shareDataWith );
   appendResObjectAttributes( id, package );
 
   appendOnMediaLocation( id, attrSrcPackageLocation, package->repositoryLocation );

Modified: trunk/libzypp/zypp/cache/ResolvableQuery.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/ResolvableQuery.cc?rev=7116&r1=7115&r2=7116&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/ResolvableQuery.cc (original)
+++ trunk/libzypp/zypp/cache/ResolvableQuery.cc Thu Sep  6 02:23:59 2007
@@ -25,6 +25,7 @@
   sqlite3_command_ptr _cmd_attr_tstr;
   sqlite3_command_ptr _cmd_attr_num;
   sqlite3_command_ptr _cmd_disk_usage;
+  sqlite3_command_ptr _cmd_shared_id;
 
   Impl( const Pathname &dbdir)
   : _dbdir(dbdir)
@@ -33,6 +34,8 @@
     _con.open((dbdir + "zypp.db").asString().c_str());
     _con.executenonquery("PRAGMA cache_size=8000;");
 
+    _cmd_shared_id.reset( new sqlite3_command( _con, "select shared_id from resolvables where id=:rid;") );
+
     _cmd_attr_tstr.reset( new sqlite3_command( _con, "select a.text, l.name from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and t.class=:tclass and t.name=:tname;") );
 
 
@@ -322,6 +325,18 @@
     sqlite3_reader reader = _cmd_attr_num->executereader();
     if ( reader.read() )
       return reader.getint(0);
+    else
+    {
+      reader.close();
+      sqlite3_reader idreader = _cmd_shared_id->executereader();
+      if ( idreader.read() )
+      {
+        _cmd_shared_id->bind(":rid", record_id);
+        data::RecordId sid = idreader.getint(0);
+        idreader.close();
+        return queryNumericAttributeInternal(con, sid, klass, name, default_value);
+      }
+    }
 
     return default_value;
   }
@@ -353,7 +368,19 @@
 
     if ( c>0 )
       return result;
-    
+    else
+    {
+      reader.close();
+      _cmd_shared_id->bind(":rid", record_id);
+      sqlite3_reader idreader = _cmd_shared_id->executereader();
+      if ( idreader.read() )
+      {
+        data::RecordId sid = idreader.getint(0);
+        idreader.close();
+        return queryTranslatedStringAttributeInternal(con, sid, klass, name, default_value);
+      }
+    }
+
     return default_value;
   }
 
@@ -388,7 +415,19 @@
     
     if ( reader.read() )
       return reader.getstring(0);
-    
+    else
+    {
+      reader.close();
+      _cmd_shared_id->bind(":rid", record_id);
+      sqlite3_reader idreader = _cmd_shared_id->executereader();
+      if ( idreader.read() )
+      {
+        data::RecordId sid = idreader.getint(0);
+        idreader.close();
+        return queryStringAttributeTranslationInternal( con, sid, locale, klass, name, default_value );
+      }
+    }
+
     return default_value;
   }
 };

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

< Previous Next >
This Thread
  • No further messages