RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Eliminating --initdb

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 29 Jul 2007 - 23:00:47 CEST
Message-Id: <C7178786-F3A5-46A3-A6BD-588EB84B4624@mac.com>
Can we attempt run-time rather than compile time?

Truly, 3 ways in the API to open an rpmdb, none of which
take a path to the rpmdb, is rather odd.

73 de Jeff

On Jul 29, 2007, at 4:51 PM, Ralf S. Engelschall wrote:

> On Sun, Jul 29, 2007, Jeff Johnson wrote:
>
>> The option has been unnecessary in all but an obscure --root corner
>> case since Berkeley DB has been used.
>>
>> Shall we finally eliminate the option?
>
> I personally would vote "no".
>
> In OpenPKG we even go the other direction: we use two small patch- 
> hunks
> (see below) to ensure that on --initdb and --rebuilddb all(!) database
> files are present and not just spring into existence on-demand later.
> The reason is mainly consistency as we want to fixate their  
> ownerships,
> permissions, etc. just once and for this we use an explicit --initdb
> call. But as OpenPKG is not a represenative RPM use case do not  
> mind too
> much about --initdb, we can also provide it in the OpenPKG patch set
> only...
>
>                                        Ralf S. Engelschall
>                                        rse@engelschall.com
>                                        www.engelschall.com
>
> Index: rpmdb/rpmdb.c
> --- rpmdb/rpmdb.c	23 Jul 2007 08:45:08 -0000	1.141
> +++ rpmdb/rpmdb.c	29 Jul 2007 20:45:47 -0000
> @@ -1273,8 +1273,16 @@
>      int rc;
>
>  /*@-boundswrite@*/
> +#if defined(OPENPKG)
> +    /* do not pass RPMDB_FLAG_JUSTCHECK as it would close the  
> database and so
> +       "db" would be always NULL and this way the code below  
> (which ensures
> +       that all database files are created) would be effectively  
> dead */
> +    rc = rpmdbOpenDatabase(prefix, NULL, _dbapi, &db, (O_CREAT |  
> O_RDWR),
> +		perms, 0);
> +#else
>      rc = rpmdbOpenDatabase(prefix, NULL, _dbapi, &db, (O_CREAT |  
> O_RDWR),
>  		perms, RPMDB_FLAG_JUSTCHECK);
> +#endif
>  /*@=boundswrite@*/
>      if (db != NULL) {
>  	int xx;
> @@ -3960,6 +3994,12 @@
>      }
>  /*@=boundswrite@*/
>
> +#if defined(OPENPKG)
> +    /* in OpenPKG for consistency reasons we want that all  
> database files are present at any time
> +       and not just spring into existence on-demand, so enforce  
> this here for new database. */
> +    (void)rpmdbOpenAll(newdb);
> +#endif
> +
>      _rebuildinprogress = 0;
>
>      _dbapi_rebuild = newdb->db_api;
>
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> Developer Communication List                        rpm-devel@rpm5.org
Received on Sun Jul 29 23:00:58 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.