Help with an error in my program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am trying to write a small utility to copy all the RPMs listed in a comps file to a directory from a rpm repository, to automate that part while building a custom distro. Here I am facing a problem in /usr/lib/anaconda/comps.py, The exact error message and my program is listed below.

I am using fully RH 7.3, The comps file is a the std file with the 7.3 CD. I made a small attempt at debugging the problem and added a print juet before the offending line (561), in comps.py to print l.

The Error message is :

[root@agni scripts]# python copy.py
/opt/rh7-updates/cdrom-tmp/i386/RedHat/RPMS
l is: MAKEDEV
Traceback (innermost last):
  File "copy.py", line 33, in ?
    comps = ComponentSet(basepath + '/RedHat/base/comps', hl)
  File "/usr/lib/anaconda/comps.py", line 799, in __init__
    self.readCompsFile(file, self.packages)
  File "/usr/lib/anaconda/comps.py", line 561, in readCompsFile
    self.expressions[packages[l]] = None
TypeError: sequence index must be integer

As you can see l is MAKEDEV but program is expecting a numeric. The copy.py follows below.


import sys
sys.path.append('/usr/lib/anaconda')
import os
from comps import ComponentSet, HeaderList
import os
import rpm

FILENAME = 1000000
fnames = {}

#path = sys.argv[1]
basepath = "/opt/rh7-updates/cdrom-tmp/i386"

# Reading the headers...
hl = []
path = basepath + "/RedHat/RPMS"
print path
for n in os.listdir(path):
    fd = os.open(path + "/" + n, 0)
    ##print n
    try:
        (h, isSource) = rpm.headerFromPackage(fd)
	if (h and not isSource):
	    fnames[h] = path + "/" + n
	    hl.append(h)
    except OSError, msg:
        print "error " + msg
	pass
    os.close(fd)
    ##print h[rpm.RPMTAG_NAME]
##print fnames
# Read the comps file
comps = ComponentSet(basepath + '/RedHat/base/comps', hl)


Any help in solving this will be much appreciated..

raj





[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux