Re: createrep question
"Kidwell,jr, Jack" <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <997BC128AE961E4A8B880CD7442D94801349DE1D@NJCHLEXCMB01.cable.comcast.com> |
I am advised to "lawyer up", so I cannot send the raw header dump you requested. (Pesky non-disclosure agreement.) I am sending an ascii header dump of the COTS RPM tags and their respective value data type. A few generic tag values are exposed. Also attached is the script that dumps these headers. >From these tags observe that there is no 'sourcerpm' or 'sourcepackage' tag. I apologize for being obtuse. Thanks for your help! Jack -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Seth Vidal Sent: Thursday, February 25, 2010 4:30 PM To: Yellowdog Updater, Modified Subject: Re: [Yum] createrep question On Thu, 25 Feb 2010, Kidwell,jr, Jack wrote: > The master himself! Thanks for the quick reply. > > Since it's COTS, I cannot provide the RPM. The vendor appears to offer an RPM as an afterthought; their principal market is Windows. > > I've patched our createrepo to relax this behavior with a command line option. Would this be useful to others? > I suspect 'relaxing' that behavior will result in other 'interesting' results/behavior. If you cannot provide the actual rpm - how about providing the header of the rpm? run this script against the rpm, it'll output a pkgname.hdr file - send me that file. thanks, -sv _______________________________________________ Yum mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum
cots_rpm_headers.txt
(text/plain, 1.5 KB)
'RPMTAG_ARCH': 'i386', 'RPMTAG_ARCHIVESIZE': integer, 'RPMTAG_BASENAMES': array of strings, 'RPMTAG_BUILDHOST': string, 'RPMTAG_BUILDTIME': integer, 'RPMTAG_DIRINDEXES': array of integers, 'RPMTAG_DIRNAMES': array of strings, 'RPMTAG_FILEDEVICES': array of integers, 'RPMTAG_FILEFLAGS': array of integers, 'RPMTAG_FILEGROUPNAME': array of strings, 'RPMTAG_FILEINODES': array of integers, 'RPMTAG_FILELANGS': array of strings, 'RPMTAG_FILELINKTOS': array of strings, 'RPMTAG_FILEMD5S': array of strings, 'RPMTAG_FILEMODES': array of integers, 'RPMTAG_FILEMTIMES': array of integers, 'RPMTAG_FILERDEVS': array of integers, 'RPMTAG_FILESIZES': array of integers, 'RPMTAG_FILEUSERNAME': array of strings, 'RPMTAG_FILEVERIFYFLAGS': array of integers, 'RPMTAG_NAME': string, 'RPMTAG_OS': 'linux', 'RPMTAG_PACKAGER': string, 'RPMTAG_PAYLOADCOMPRESSOR': string, 'RPMTAG_PAYLOADFLAGS': string, 'RPMTAG_PAYLOADFORMAT': string, 'RPMTAG_PLATFORM': 'i386-linux', 'RPMTAG_PREUN': string, 'RPMTAG_PROVIDEFLAGS': array of integers, 'RPMTAG_PROVIDES': array of strings, 'RPMTAG_PROVIDEVERSION': array of strings, 'RPMTAG_RELEASE': string, 'RPMTAG_REQUIREFLAGS': array of integers, 'RPMTAG_REQUIRES': array of strings, 'RPMTAG_RHNPLATFORM': 'i386', 'RPMTAG_RPMVERSION': '4.4.2', 'RPMTAG_SERIAL': integer, 'RPMTAG_SHA1HEADER': string, 'RPMTAG_SIGMD5': string, 'RPMTAG_SIGSIZE': integer, 'RPMTAG_SIZE': integer, 'RPMTAG_URL': string, 'RPMTAG_VENDOR': string, 'RPMTAG_VERSION': string, 'RPMVSF_NODSAHEADER': string,
dumphdrs.py
(application/octet-stream, 1.4 KB)
#!/usr/bin/env python
import sys
import os
import rpm
import pprint
def is_a_key(string):
for character in string:
ordinal = ord(character)
if ordinal is not 95 and ( ordinal < 65 or ordinal > 90 ):
return False
return True
def returnHdr(ts, package):
"""hand back the rpm header or raise an Error if the pkg is fubar"""
try:
fdno = os.open(package, os.O_RDONLY)
except OSError, e:
print "Error opening file"
ts.setVSFlags(~(rpm.RPMVSF_NOMD5|rpm.RPMVSF_NEEDPAYLOAD))
try:
hdr = ts.hdrFromFdno(fdno)
except rpm.error, e:
print "Error opening package"
if type(hdr) != rpm.hdr:
print "Error opening package"
ts.setVSFlags(0)
os.close(fdno)
return hdr
# Map RPM key names to numbers
numbers_to_names = {}
for attribute_name in dir(rpm):
if not is_a_key(attribute_name):
continue
if not isinstance(rpm.__dict__[attribute_name], int):
continue
numbers_to_names[rpm.__dict__[attribute_name]] = attribute_name
header_keys = []
ts = rpm.TransactionSet()
hdr = returnHdr(ts, sys.argv[1])
header_metadata = {}
for key in hdr.keys():
try:
header_metadata[numbers_to_names[key]] = hdr[key]
except:
continue
pprint.pprint(header_metadata)