On Sun, 23 Jan 2000, Matt Wilson wrote:
> On Sat, Jan 22, 2000 at 11:36:28PM -0600, Troy Benjegerdes wrote:
> > I've got a little python hack which checks an RPM directory for new RPMS,
> > and upgrades any new ones that it finds that are installed. I intend to
> > make this eventually handle dependencies automatically and all that
> > eventually.
> >
> > However, I'm having problems with python segfaulting, and I don't know
> > where to start debugging. Any suggestions, or any pointers to
> > documentation on rpmmodule?
>
> Well, posting your current code could help. Generally, the easiest
> way to debug rpmmodule is to run "gdb python" then at the "(gdb) "
> prompt do "run myscript.py". The segfault will be caught in the
> debugger and you can get a traceback.
Hrrm, it seems that having the 'root' set to "" was causing the problem.
Chaning root="" to root="/" makes everything work.
Here's the relavant python code:
root=""
print "reading RPMS in " + rpm_dir
hdList = readHeaders(rpm_dir)
list = hdList.keys()
print "found %d unique packages" % len(list)
db = rpm.opendb(1, root)
ts = rpm.TransactionSet(root, db)
When I finally did the 'ts.run' later, everything worked *except* for
removeing a previously installed RPM. Here's a backtrace from GDB:
#0 0xfea700c in strcpy () at soinit.c:59
#1 0xfde904c in removeBinaryPackage () at uninstall.c:67
#2 0xfde8778 in rpmRunTransactions () at transaction.c:1164
#3 0xfe225dc in rpmtransRun (s=0x10a9afe8, args=0x10082b28)
at rpmmodule.c:1412
#4 0x1000d360 in PyEval_CallObjectWithKeywords ()
#5 0x1000d1f8 in PyEval_CallObjectWithKeywords ()
#6 0x1000ba54 in PyEval_EvalCode ()
#7 0x100097ac in PyEval_EvalCode ()
#8 0x1001f2fc in PyRun_File ()
#9 0x1001f298 in PyRun_File ()
#10 0x1001f254 in PyRun_File ()
#11 0x1001e6c4 in PyRun_SimpleFile ()
#12 0x1001e228 in PyRun_AnyFile ()
#13 0x10007898 in Py_Main ()
#14 0x1000730c in main ()
--------------------------------------------------------------------------
| Troy Benjegerdes | [EMAIL PROTECTED] | [EMAIL PROTECTED] |
| Unix is user friendly... You just have to be friendly to it first. |
| This message composed with 100% free software. http://www.gnu.org |
--------------------------------------------------------------------------
--
To unsubscribe:
mail -s unsubscribe [EMAIL PROTECTED] < /dev/null