source: soft/build_system/build_system/upload/robot/trunk/rpmheader @ 1

Last change on this file since 1 was 1, checked in by fasma, 13 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 1.0 KB
Line 
1#!/usr/bin/env python
2#---------------------------------------------------------------
3# Project         : Linux-Mandrake
4# Module          : rpm-rebuilder
5# File            : rpmheader
6# Version         : $Id: rpmheader 867 2004-07-21 08:16:07Z mandrake $
7# Author          : Frederic Lepied
8# Created On      : Wed Feb  2 20:47:45 2000
9#---------------------------------------------------------------
10
11import rpm
12import sys
13import os
14
15def printTag(tag):
16    try:
17        r=header[tag]
18    except KeyError:
19        r=header[int(tag)]
20
21    t=type(r)
22    if t == type(1) or t == type('aa'):
23        print r
24    elif r:
25        for elt in r:
26            print elt
27    return r
28
29if len(sys.argv) != 3:
30    print "usage: rpmheader <pkg> <tag>"
31    sys.exit(1)
32   
33fd=os.open(sys.argv[1], os.O_RDONLY)
34(header, is_source)=rpm.headerFromPackage(fd)
35os.close(fd)
36
37if sys.argv[2] == 'all':
38    for loop in range(1000, 1122):
39        print loop
40        printTag(loop)
41else:
42    printTag(sys.argv[2])
43
44# Local variables:
45# mode: python
46# End:
47#
48# rpmheader ends here
Note: See TracBrowser for help on using the repository browser.