Copy from anaconda/rpmmodules.

CVS patchset: 3161
CVS date: 1999/07/14 18:15:09
This commit is contained in:
jbj 1999-07-14 18:15:09 +00:00
parent 4352ef4a98
commit 99c487c9ef
3 changed files with 895 additions and 1031 deletions

16
python/Makefile Normal file
View File

@ -0,0 +1,16 @@
DESTDIR = $(TOPDIR)/RedHat/instimage/usr/lib/python1.5/site-packages
CFLAGS += -I/usr/include/rpm -I/usr/include/python1.5 -g
TARGET = rpmmodule.so
all: $(TARGET)
rpmmodule.so: rpmmodule.o
gcc -shared -o $@ rpmmodule.o -lrpm -lz -ldb1
clean:
rm -f *.o $(TARGET)
install: all
cp $(TARGET) $(DESTDIR)

File diff suppressed because it is too large Load Diff

29
python/testit Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/python
import rpm
import os
def cb(what, amount, total, key, data):
if (what == rpm.RPMCALLBACK_INST_OPEN_FILE):
d = os.open(key, os.O_RDONLY)
return d
fd = os.open('foo', os.O_RDONLY);
(h, isSource) = rpm.headerFromPackage(fd)
print "from foo:", h[rpm.RPMTAG_NAME]
os.close(fd)
#list = rpm.readHeaderList('hdlist')
#print "got", len(list), "items"
d = rpm.opendb(0)
ts = rpm.TransactionSet("/", d)
ts.add(h, "foo")
rc = ts.depcheck()
print rc
ts.order()
print "run", ts.run(rpm.RPMTRANS_FLAG_TEST, 0, cb, "arg")