[Yum-devel] RFD - Change sqlite schema to preserve requires pre attribute

seth vidal skvidal at linux.duke.edu
Thu Jul 6 19:53:16 UTC 2006


On Thu, 2006-07-06 at 15:21 -0400, Paul Nasrat wrote:
> On Wed, 2006-06-28 at 11:24 -0400, Paul Nasrat wrote:
> > We have pre= on some requires but don't capture that within the sqlite
> > cache.  I'd like to suggest a schema change to requires table of primary
> > to add this:
> > 
> > CREATE TABLE requires (
> >               name TEXT,
> >               flags TEXT,
> >               epoch TEXT,
> >               version TEXT,
> >               release TEXT,
> >               pkgKey TEXT , 
> >               pre BOOL DEFAULT FALSE);
> > 
> > Obviously both the python and the C metadata parsers would need to be
> > adjusted to work with this.  A patch to make the python cache code do
> > this follows.  Does this seem reasonable?
> 
> yum-metadata-parser patch for above schema.  If everyone is ok I'll
> commit to both for dbversion 9.
> 
> Index: db.c
> ===================================================================
> RCS file: /home/groups/yum/cvs/yum-metadata-parser/db.c,v
> retrieving revision 1.5
> diff -u -u -r1.5 db.c
> --- db.c	14 Jun 2006 20:03:55 -0000	1.5
> +++ db.c	6 Jul 2006 19:19:25 -0000
> @@ -388,13 +388,19 @@
>          "  epoch TEXT,"
>          "  version TEXT,"
>          "  release TEXT,"
> -        "  pkgKey TEXT)";
> +        "  pkgKey TEXT %s)";
>  
>      const char *deps[] = { "requires", "provides", "conflicts", "obsoletes", NULL };
>      int i;
>  
>      for (i = 0; deps[i]; i++) {
> -        char *query = g_strdup_printf (sql, deps[i]);
> +        const char *prereq;
> +        if (!strcmp(deps[i], "requires")) {
> +            prereq = ", pre BOOLEAN DEFAULT FALSE";
> +        } else
> +            prereq = "";
> +
> +        char *query = g_strdup_printf (sql, deps[i], prereq);
>          rc = sqlite3_exec (db, query, NULL, NULL, NULL);
>          g_free (query);
>  
> Index: db.h
> ===================================================================
> RCS file: /home/groups/yum/cvs/yum-metadata-parser/db.h,v
> retrieving revision 1.2
> diff -u -u -r1.2 db.h
> --- db.h	24 May 2006 12:49:16 -0000	1.2
> +++ db.h	6 Jul 2006 19:19:25 -0000
> @@ -22,7 +22,7 @@
>  #include <sqlite3.h>
>  #include "package.h"
>  
> -#define YUM_SQLITE_CACHE_DBVERSION 8
> +#define YUM_SQLITE_CACHE_DBVERSION 9
>  
>  #define YUM_DB_ERROR yum_db_error_quark()
>  GQuark yum_db_error_quark (void);
> 
> 

go forth and multiply.
or patch

or whatever.

-sv




More information about the Yum-devel mailing list