On Dec 4, 2010, at 9:11 PM, Per Øyvind Karlsen wrote:

> 2010/12/5 Jeff Johnson <[email protected]>:
>> Do you have a hdlist that I can use? If you can give ma a pointer,
>> I can rapidly write up specific usage details, and suggest what
>> might be done through URPM.xs.
> ftp://ftp.free.fr/.mirrors9/ftp.mandriva.com/MandrivaLinux/devel/cooker/x86_64/media/main/testing/media_info/hdlist.cz
> 

OK, here's what I see.

First of all the *.cz is goofy because
        [...@localhost tmp]$ file hdlist.cz 
        hdlist.cz: gzip compressed data, from Unix, last modified: Sat Dec  4 
01:42:23 2010, max compression

        [...@localhost tmp]$ gunzip hdlist.gz 

        gzip: hdlist.gz: decompression OK, trailing garbage ignored

I have no idea what you pointed me at ...

The path to the hdlist file is here
        [...@localhost tmp]$ rpm --showrc | grep hdlist
        -14: _query_hdlist_path %{_datadir}/comps/%{_arch}/hdlist
        [...@localhost tmp]$ sudo mkdir -p /usr/share/comps/x86_64
        [...@localhost tmp]$ sudo cp hdlist /usr/share/comps/x86_64/

Once the hdlists file and the macro agree, I see this

        [...@localhost tmp]$ rpm -qH
        error: rpmpkgRead: Header: Header V3 DSA signature: UNKNOWN, key ID 
26752624
        [...@localhost tmp]$ sudo rpm --import 0x26752624
        [...@localhost tmp]$ rpm -qH
        error: rpmpkgRead: Header: Header V3 DSA signature: UNKNOWN, key ID 
26752624

That should NOT be happening.

Meanwhile

[...@localhost tmp]$ rpm -qH -vv --nosignature
D: pool fd:     created size 384 limit -1 flags 0
D: pool lua:    created size 56 limit -1 flags 0
D: pool ts:     created size 1192 limit -1 flags 0
D: pool gi:     created size 160 limit -1 flags 0
D: pool dig:    created size 400 limit -1 flags 0
D: pool ctx:    created size 104 limit -1 flags 0
D: pool h:      created size 352 limit -1 flags 0
lib64rpm1-4.8.1-1mnb2.x86_64
x11-driver-video-ati-6.13.99-0.20101119.1mdv2011.0.x86_64
rpmstats-0.7-1mdv2011.0.x86_64
lib64rpm-static-devel-5.3.6-0.20101129.2mdv2011.0.x86_64
python-rpm-5.3.6-0.20101129.2mdv2011.0.x86_64
rpm-5.3.6-0.20101129.2mdv2011.0.x86_64
lib64rpm5.3-5.3.6-0.20101129.2mdv2011.0.x86_64
perl-RPM-5.3.6-0.20101129.2mdv2011.0.x86_64
rpm-build-5.3.6-0.20101129.2mdv2011.0.x86_64
lib64rpm-devel-5.3.6-0.20101129.2mdv2011.0.x86_64
perl-URPM-4.2-1mdv2011.0.x86_64
gdb-7.1-3mdv2011.0.x86_64
error: rpmpkgRead: Header: (null)
D: pool tsi:    created size 40 limit -1 flags 0
D: pool gi:     reused 0, alloc'd 1, free'd 1 items.
D: pool tsi:    reused 3, alloc'd 1, free'd 1 items.
D: pool ts:     reused 0, alloc'd 1, free'd 1 items.
D: pool h:      reused 11, alloc'd 1, free'd 1 items.
D: pool lua:    reused 0, alloc'd 1, free'd 1 items.
D: pool ctx:    reused 11, alloc'd 13, free'd 2 items.
warning: pool ctx: FIXME: made 13, count 2
Note: This is a harmless memory leak discovered while exiting, relax ...
D: pool dig:    reused 0, alloc'd 1, free'd 1 items.
D: pool fd:     reused 13, alloc'd 2, free'd 2 items.

is the basics. There's a ref count missing somewhere in rpmdb/pkgio,
likely because I added --nosignature (an odd code path). I can dig
that out pretty easily as soon as I can get a hdlists in a "known good"
state (I can/will go back to RHEL4 or RHEL3 or Fedorable-before-yum
to find an hdlists file that is "known good")

But there's something goofy about the hdlists.cz, like extra padding
between records, "rpm -qH" should have just read headers seqentially
from the uncompressed hdlists until EOF.

BTW, there's "rpm -qTH" that should do rpmtsCheck/rpmtsOrder before
displaying the default query format.

Which brings me back to the code sample you wished ...

In lib/query.c, look for RPMQV_HDLIST.

    case RPMQV_HDLIST:
        qva->qva_gi = rpmgiNew(ts, RPMDBI_HDLIST, NULL, 0);
        qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, rpmioFtsOpts, giFlags);

        if (rpmgiGetFlags(qva->qva_gi) & RPMGI_TSADD)   /* Load the ts with 
headers. */
        while ((rpmrc = rpmgiNext(qva->qva_gi)) == RPMRC_OK)
            {};
        if (rpmrc != RPMRC_NOTFOUND)
            return 1;   /* XXX should be no. of failures. */

        /*...@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */
        ec = rpmQueryVerify(qva, ts, NULL);
        /*...@=nullpass@*/
        rpmtsEmpty(ts);
        break;

The rpmgi (just like rpmmi) iterator is here
    case RPMQV_HDLIST:
        res = rpmgiShowMatches(qva, ts);
        break;

which is just a loop over a sequence of headers read from the FD_t
of the hdlists file.

hth

73 de Jeff______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        [email protected]

Reply via email to