RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES macros.in rpm/rpmdb/ hdrfmt.c rpmdb.c

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 12 Oct 2008 - 10:47:59 CEST
Message-id: <C25A951E-D4DF-4233-89F5-E37484B43930@mac.com>
You'ld think that saving unix file paths in an rpmdb would be rather  
straightforward.

Well its not. I'm almost annoyed enough at the mess to attempt a  
cleanup, but
I got other things to do atm.

Originally there was a tag & index called RPMTAG_FILENAMES and life  
was gud.

But then for ancient hysterical reasons, the representation was  
changed to
the triple RPMTAG_{DIRNAMES,DIRINDEXES,BASENAMES}. Well that
wasn't __TOO__ bad. But note the following quirkiness:

-> DIRNAMES contains directory paths that aren't "owned" by a  
package, and
always end with a trailing '/'.

-> BASENAMES contains both files and directories that are "owned",  
but the directories
do __NOT__ have a trailing '/', likely should.

Next, along came alternatives, with
	Provides: /path/to/file
mixed in with other dependencies as some sort of weird feature, like % 
ghost marked paths.

And RPMTAG_FILENAMES isn't a tag at all any more, its a header  
extension, now using
an arbitrary tag assignment. Go figger, a package format that doesn't  
have absolute file paths.

So RPMTAG_FILEPATHS was created, a proper tag, and is now an index,  
just like the original
RPMTAG_FILENAMES was, so that globs can be applied to a single  
primary key in a table.
Round & round & round we go ...

Dunno what the final solution will be to straighten out the mess, but  
its likely gonna have
to be attempted soon. Perhaps I'll add versions to file paths in  
Provides: populated from
some VCS like CVS and/or git to force the necessary composting ...

Oh well, back to hacking.

73 de Jeff

On Oct 12, 2008, at 4:27 AM, Jeff Johnson wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Jeff Johnson
>   Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
>   Module: rpm                              Date:   12-Oct-2008  
> 10:27:46
>   Branch: HEAD                             Handle: 2008101208274501
>
>   Modified files:
>     rpm                     CHANGES macros.in
>     rpm/rpmdb               hdrfmt.c rpmdb.c
>
>   Log:
>     - jbj: create absoluabsolute file paths index in rpmdb.
>     - jbj: fix: he->tag was returning RPMTAG_BASENAMES, not  
> RPMTAG_FILEPATHS.
>
>   Summary:
>     Revision    Changes     Path
>     1.2598      +2  -0      rpm/CHANGES
>     1.255       +6  -3      rpm/macros.in
>     1.122       +19 -9      rpm/rpmdb/hdrfmt.c
>     1.275       +1  -1      rpm/rpmdb/rpmdb.c
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/CHANGES
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.2597 -r1.2598 CHANGES
>   --- rpm/CHANGES	11 Oct 2008 23:57:59 -0000	1.2597
>   +++ rpm/CHANGES	12 Oct 2008 08:27:45 -0000	1.2598
>   @@ -1,5 +1,7 @@
>
>    5.1.0 -> 5.2a0:
>   +    - jbj: create absoluabsolute file paths index in rpmdb.
>   +    - jbj: fix: he->tag was returning RPMTAG_BASENAMES, not  
> RPMTAG_FILEPATHS.
>        - proyvind: install rpmbuild.h & rpmspec.h on system again  
> (needed by urpmi).
>        - jbj: avoid mtab info leakage problems (#457940).
>        - proyvind: perl: add back installsrpm() function from old  
> RPM4 bindings.
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/macros.in
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.254 -r1.255 macros.in
>   --- rpm/macros.in	4 Oct 2008 19:35:33 -0000	1.254
>   +++ rpm/macros.in	12 Oct 2008 08:27:45 -0000	1.255
>   @@ -1,7 +1,7 @@
>    #/*! \page config_macros Default configuration: @USRLIBRPM@/macros
>    # \verbatim
>    #
>   -# $Id: macros.in,v 1.254 2008/10/04 19:35:33 jbj Exp $
>   +# $Id: macros.in,v 1.255 2008/10/12 08:27:45 jbj Exp $
>    #
>    # This is a global RPM configuration file. All changes made here  
> will
>    # be lost when the rpm package is upgraded. Any per-system  
> configuration
>   @@ -686,8 +686,8 @@
>
>    # database tag configuration
>    %_dbi_tags                      %{expand:%%{_dbi_tags_% 
> {_dbapi_used}}}
>   -%_dbi_tags_3                     
> Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Tri 
> ggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1 
> header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid
>   -%_dbi_tags_4                     
> Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Tri 
> ggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1 
> header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid
>   +%_dbi_tags_3                     
> Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Tri 
> ggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1 
> header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid:Filepaths
>   +%_dbi_tags_4                     
> Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Tri 
> ggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1 
> header:Filedigests:Pubkeys:Packagecolor:Nvra:Sourcepkgid:Filepaths
>
>    # database configuration: Berkeley-DB [dbapi 3 hooks]
>    %_dbi_config_3                  %{_dbi_btconfig}
>   @@ -712,6 +712,7 @@
>    %_dbi_config_3_Depends          %{_dbi_btconfig} temporary private
>    %_dbi_config_3_Nvra             %{_dbi_btconfig} noload
>    %_dbi_config_3_Sourcepkgid      %{_dbi_btconfig}
>   +%_dbi_config_3_Filepaths	%{_dbi_btconfig}
>
>    # database configuration: SQLite [dbapi 4 hooks]
>    %_dbi_config_4                  %{_dbi_sqlconfig}
>   @@ -736,6 +737,7 @@
>    %_dbi_config_4_Depends          %{_dbi_sqlconfig} temporary private
>    %_dbi_config_4_Nvra             %{_dbi_sqlconfig} noload
>    %_dbi_config_4_Sourcepkgid      %{_dbi_sqlconfig}
>   +%_dbi_config_4_Filepaths	%{_dbi_sqlconfig}
>
>    # database configuration [code entry hooks]
>    %_dbi_config                    %{expand:%%{_dbi_config_% 
> {_dbapi_used}}}
>   @@ -760,6 +762,7 @@
>    %_dbi_config_Depends            %{expand:%%{_dbi_config_% 
> {_dbapi_used}_Depends}}
>    %_dbi_config_Nvra               %{expand:%%{_dbi_config_% 
> {_dbapi_used}_Nvra}}
>    %_dbi_config_Sourcepkgid        %{expand:%%{_dbi_config_% 
> {_dbapi_used}_Sourcepkgid}}
>   +%_dbi_config_Filepaths		%{expand:%%{_dbi_config_%{_dbapi_used} 
> _Filepaths}}
>
>    # Database API configuration:
>    #
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmdb/hdrfmt.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.121 -r1.122 hdrfmt.c
>   --- rpm/rpmdb/hdrfmt.c	22 Sep 2008 16:22:19 -0000	1.121
>   +++ rpm/rpmdb/hdrfmt.c	12 Oct 2008 08:27:46 -0000	1.122
>   @@ -2327,32 +2327,42 @@
>     * Retrieve file paths.
>     * @param h		header
>     * @retval *he		tag container
>   + * @param tag		RPMTAG_BASENAMES or RPMTAG_ORIGBASENAMES
>     * @return		0 on success
>     */
>   -static int _fnTag(Header h, HE_t he)
>   +static int _fnTag(Header h, HE_t he, rpmTag tag)
>    	/*@globals internalState @*/
>    	/*@modifies he, internalState @*/
>    {
>        he->t = RPM_STRING_ARRAY_TYPE;
>   -    rpmfiBuildFNames(h, he->tag, &he->p.argv, &he->c);
>   +    rpmfiBuildFNames(h, tag, &he->p.argv, &he->c);
>   +fprintf(stderr, "*** %s(%d) %p[%u]\n", tagName(he->tag), he->t,  
> he->p.ptr, he->c);
>        he->freeData = 1;
>        return 0;
>    }
>
>   +static int filenamesTag(Header h, HE_t he)
>   +	/*@globals internalState @*/
>   +	/*@modifies he, internalState @*/
>   +{
>   +    he->tag = tagValue("Filenames");
>   +    return _fnTag(h, he, RPMTAG_BASENAMES);
>   +}
>   +
>    static int filepathsTag(Header h, HE_t he)
>    	/*@globals internalState @*/
>    	/*@modifies he, internalState @*/
>    {
>   -    he->tag = RPMTAG_BASENAMES;
>   -    return _fnTag(h, he);
>   +    he->tag = RPMTAG_FILEPATHS;
>   +    return _fnTag(h, he, RPMTAG_BASENAMES);
>    }
>
>    static int origpathsTag(Header h, HE_t he)
>    	/*@globals internalState @*/
>    	/*@modifies he, internalState @*/
>    {
>   -    he->tag = RPMTAG_ORIGBASENAMES;
>   -    return _fnTag(h, he);
>   +    he->tag = RPMTAG_ORIGPATHS;
>   +    return _fnTag(h, he, RPMTAG_ORIGBASENAMES);
>    }
>
>    /**
>   @@ -2576,8 +2586,8 @@
>        /* st_ctime */
>        int rc;
>
>   -    he->tag = RPMTAG_BASENAMES;
>   -    if ((rc = _fnTag(h, he)) != 0 || he->c == 0)
>   +    he->tag = RPMTAG_FILEPATHS;
>   +    if ((rc = _fnTag(h, he, RPMTAG_BASENAMES)) != 0 || he->c == 0)
>    	goto exit;
>
>    exit:
>   @@ -4408,7 +4418,7 @@
>        { HEADER_EXT_TAG, "RPMTAG_NVRA",
>    	{ .tagFunction = nvraTag } },
>        { HEADER_EXT_TAG, "RPMTAG_FILENAMES",
>   -	{ .tagFunction = filepathsTag } },
>   +	{ .tagFunction = filenamesTag } },
>        { HEADER_EXT_TAG, "RPMTAG_FILEPATHS",
>    	{ .tagFunction = filepathsTag } },
>        { HEADER_EXT_TAG, "RPMTAG_ORIGPATHS",
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmdb/rpmdb.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.274 -r1.275 rpmdb.c
>   --- rpm/rpmdb/rpmdb.c	24 Sep 2008 21:11:15 -0000	1.274
>   +++ rpm/rpmdb/rpmdb.c	12 Oct 2008 08:27:46 -0000	1.275
>   @@ -352,7 +352,7 @@
>
>    /*@-modfilesys@*/
>    if (_rpmdb_debug)
>   -fprintf(stderr, "==> dbiOpen(%p, %u, 0x%x)\n", db, tag, flags);
>   +fprintf(stderr, "==> dbiOpen(%p, %s(%u), 0x%x)\n", db, tagName 
> (tag), tag, flags);
>    /*@=modfilesys@*/
>
>        if (db == NULL)
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Sun Oct 12 10:48:16 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.