summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-02-28 19:59:36 +0000
committerMatt Wilson <msw@redhat.com>2000-02-28 19:59:36 +0000
commit292e3832d4b4e93a0ee374145ad79fe06b2ba6c6 (patch)
tree2ed92b5f2fb8429ad345768015aa465e24c25bb2
parente756cd675018db997161054cffa9639c47a1b6c8 (diff)
downloadanaconda-292e3832d4b4e93a0ee374145ad79fe06b2ba6c6.tar.gz
anaconda-292e3832d4b4e93a0ee374145ad79fe06b2ba6c6.tar.xz
anaconda-292e3832d4b4e93a0ee374145ad79fe06b2ba6c6.zip
updated for i18nation
-rw-r--r--rpmmodule/rpmmodule.c24
-rwxr-xr-xrpmmodule/testhdr21
2 files changed, 38 insertions, 7 deletions
diff --git a/rpmmodule/rpmmodule.c b/rpmmodule/rpmmodule.c
index c0104516e..1d79f219f 100644
--- a/rpmmodule/rpmmodule.c
+++ b/rpmmodule/rpmmodule.c
@@ -228,6 +228,8 @@ void initrpm(void) {
const struct headerSprintfExtension * extensions = rpmHeaderFormats;
struct headerSprintfExtension * ext;
+/* i18ndomains = "redhat-dist"; */
+
/* _rpmio_debug = -1; */
rpmReadConfigFiles(NULL, NULL);
@@ -914,7 +916,7 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) {
PyObject * o, * metao;
char ** stringArray;
int forceArray = 0;
- int freeData;
+ int freeData = 0;
char * str;
struct headerSprintfExtension * ext = NULL;
const struct headerSprintfExtension * extensions = rpmHeaderFormats;
@@ -942,15 +944,14 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) {
}
if (ext) {
- ext->u.tagFunction(s->h, &type, &data, &count, &freeData);
- forceArray = 1;
+ ext->u.tagFunction(s->h, &type, (const void **) &data, &count, &freeData);
} else {
if (tag == -1) {
PyErr_SetString(PyExc_KeyError, "unknown header tag");
return NULL;
}
- if (!headerGetEntry(s->h, tag, &type, &data, &count)) {
+ if (!rpmHeaderGetEntry(s->h, tag, &type, &data, &count)) {
Py_INCREF(Py_None);
return Py_None;
}
@@ -972,6 +973,14 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) {
case RPMTAG_FILEUSERNAME:
case RPMTAG_FILEGROUPNAME:
forceArray = 1;
+ break;
+ case RPMTAG_SUMMARY:
+ case RPMTAG_GROUP:
+ case RPMTAG_DESCRIPTION:
+ freeData = 1;
+ break;
+ default:
+ break;
}
switch (type) {
@@ -1045,8 +1054,11 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) {
Py_DECREF(o);
}
o = metao;
- } else
- o = PyString_FromString(data);
+ } else {
+ o = PyString_FromString(data);
+ if (freeData)
+ free (data);
+ }
break;
default:
diff --git a/rpmmodule/testhdr b/rpmmodule/testhdr
index f1b8150b5..bffa20448 100755
--- a/rpmmodule/testhdr
+++ b/rpmmodule/testhdr
@@ -1,6 +1,10 @@
#!/usr/bin/python
import rpm
+import sys
+
+import time
+#time.sleep(10)
def printlist(h, tag):
print "####### %s tag contains:" % tag
@@ -17,8 +21,23 @@ def printlist(h, tag):
db = rpm.opendb(0)
-rc = db.findbyname('redhat-release')
+rc = db.findbyname('glibc')
h = db[rc[0]]
+
+rpm.addMacro("_i18ndomains", "redhat-dist");
+
+print h['summary']
+print h['description']
+print h['group']
+#print h['filenames']
+
+print h[rpm.RPMTAG_SUMMARY]
+print h[rpm.RPMTAG_DESCRIPTION]
+print h[rpm.RPMTAG_GROUP]
+#print h[rpm.RPMTAG_FILENAMES]
+
+sys.exit(0)
+
printlist (h, 'filenames')
printlist (h, 'oldfilenames')