Hi Alain. I would just like to tell you what i have done till now. I got the patch you send me, I patched the file....I run the script...it did not give me any error but after some time it gave me an error. I am attaching the script and the error so that you can test the script and let me know if i am doing something wrong. --------------------------syncRpms.py--------------------------------- import rpm import sys, os, glob if len(sys.argv) != 3: sys.stderr.write("Usage\n") sys.stderr.write("%s <tgt dir> <pkg list>\n" % (sys.argv[0],)) sys.exit(1) tgtdir = sys.argv[1] pkglist = sys.argv[2] # # get pkg name to file name mapping # name2file = {} ts = rpm.TransactionSet("", rpm._RPMVSF_NOSIGNATURES) for fname in glob.glob(tgtdir + '/*.rpm'): fd = os.open(fname, os.O_RDONLY) hdr = ts.hdrFromFdno(fd) name2file[hdr[rpm.RPMTAG_NAME]] = fname os.close(fd) # # Read in packages from package list # fd = open(pkglist, "r") pkgs = {} for l in fd.readlines(): if l[-1]=='\n': l = l[:-1] pkgs[l] = 1 fd.close() # # Remove unwanted packages # for n, f in name2file.items(): if not pkgs.has_key(n): os.remove(f) print n # # Check to see if there are pkgs not in tgt dir # for p in pkgs.keys(): if not name2file.has_key(p): print "Package not in tgt dir: ", p ----------------Error Message -------------------------- error: rpmts_HdrFromFdno: MD5 digest: BAD Expected(d032691d5dd4eed8bc3304b8cb0ba962) != (34ee1ffd96d41da80a88e9dafb9b0a06) Traceback (most recent call last): File "/bin/syncRpms.py", line 46, in ? hdr = ts.hdrFromFdno(fd) rpm.error: error reading package header Alain and Brett please help me solve this problem... Thanks in advance. Regards, Gautam Pagedar ----- Original Message ----- From: "Alain TAUCH" <anaconda@xxxxxxxxxxxxxxxxxxx> To: <kickstart-list@xxxxxxxxxx> Sent: Friday, October 31, 2003 9:13 PM Subject: Re: syncRpms.py error...need help > On Fri, 31 Oct 2003 07:25:33 -0800 (PST) > Brett Schwarz [Brett] wrote: > > Brett> thanks for the patch Alain. Unfortunately, my test > Brett> server is packed away in storage so I can't > Brett> verify...but I trust you :). > > thanks :-) > > one more thing: the script doesn't work if using it > like this: > ./syncRpms.py /folder list > instead of: > ./syncRpms.py /folder/ list > > so here is the updated patch ;-) > > --------8<------ cut here ------------------8<--------- > --- syncRpms.py 2003-10-31 14:00:40.000000000 +0100 > +++ syncRpms.py.rh9 2003-10-31 16:40:02.000000000 +0100 > @@ -27,7 +27,7 @@ > # 02111-1307 USA > # > > -import rpm404 as rpm > +import rpm > import sys, os, glob > > if len(sys.argv) != 3: > @@ -42,10 +42,11 @@ > # get pkg name to file name mapping > # > name2file = {} > -for fname in glob.glob(tgtdir + '*.rpm'): > +ts = rpm.TransactionSet("", rpm._RPMVSF_NOSIGNATURES) > +for fname in glob.glob(tgtdir + '/*.rpm'): > fd = os.open(fname, os.O_RDONLY) > - (header, isSource) = rpm.headerFromPackage(fd) > - name2file[header[rpm.RPMTAG_NAME]] = fname > + hdr = ts.hdrFromFdno(fd) > + name2file[hdr[rpm.RPMTAG_NAME]] = fname > os.close(fd) > > # > --------8<------ cut here ------------------8<--------- > > -- > Alain > > > _______________________________________________ > Kickstart-list mailing list > Kickstart-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/kickstart-list