Copy from anaconda/rpmmodules.
CVS patchset: 3161 CVS date: 1999/07/14 18:15:09
This commit is contained in:
parent
4352ef4a98
commit
99c487c9ef
|
@ -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)
|
1875
python/rpmmodule.c
1875
python/rpmmodule.c
File diff suppressed because it is too large
Load Diff
|
@ -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")
|
||||
|
Loading…
Reference in New Issue