[repo-coord] Repo information inside rpm?

Morten Kjeldgaard mok at imsb.au.dk
Fri Aug 13 17:59:14 CEST 2004


OK, I've played around with this idea a bit; it is extremely easy to 
implement. Please note: this is not carved in stone, I am merely playing 
around. I hope to get input from all the repo-maintainers!

o  I decided to follow Dag's advice and use the keyworded version.

o  I decided to use the Distribution tag, for the reason discussed
    earlier: that is does not show up in the rpm -qi listing. I tried using
    the Vendor tag, and frankly, it screws up the nice display, since the
    line tends to be long and wrap around.

I am sure this would suit most everyone. I did a bit of checking on the 
RPMs installed on my machine, and in most cases, the Distribution and 
Vendor tags are almost identical: d=Red Hat Linux v=Red Hat Inc. for 
example.

- Dag's packages use the two inconsistently; some packages don't have the
   Dist tag, some use almost the same string in both.

- ATrpms never seems to use the Dist tag.

- Freshrpms uses "Yarrow" or "Fedora" in the Dist tag, and "Freshrpms.net"
   in the Vendor tag.

... so I conclude that probably noone will have really strong feelings
about this ;-)

So why not try it out?

(1) put this in your .rpmmacros file (one line):

%distribution *url=%{repo} dist=%{dist} rel=%{rel} lang=%{?lang} arch=%{arch} comp=%{comp}*

(2) in the beginning of each .spec file, put something like the following:

#----------------------------------
%define repo http://blablabla
%define dist fedora
%define rel 1
%define arch i386
%define comp testing
#----------------------------------

Note: the values must reflect the unix path in the repo! (OBS! %dist has 
nothing to do with the %disttag sometimes discussed on the list!!)

>From this example, we would get a string in the Distribution tag:

    *url=http://blablabla dist=fedora rel=1 lang= arch=i386 comp=testing*

Using the attached python snippet, this will parse into:

    rpm http://blablabla fedora/1//i386 testing

which works as a sources.list file. Hehehe ;-)

Cheers,
Morten

-- 
Morten Kjeldgaard, Asc. professor, Ph.D.
Department of Molecular Biology, Aarhus University
Gustav Wieds Vej 10 C, DK-8000 Aarhus C, Denmark
Lab +45 89425026 * Mobile +45 89428063 * Fax +45 86123178
Home +45 86188180 * ICQ 27224900 * http://imsb.au.dk/~mok
-------------- next part --------------

def proc_line(line):
    D = {}
    line = line.split('*')[1]
    for tok in line.split(' '):
        pair=tok.split('=')
        D[pair[0]] = pair[1]
    #;
    return D
#;

if __name__ == "__main__":
    import fileinput
    for li in fileinput.input():
        D = proc_line(li)
    #;

    sl = '/'
    print "rpm",D['url'],sl.join([D['dist'],D['rel'],D['lang'],D['arch']]),D['comp']
#;


More information about the repo-coord mailing list