summaryrefslogtreecommitdiffstats
path: root/RPM4/src
diff options
context:
space:
mode:
authortv <tv@971eb68f-4bfb-0310-8326-d2484c010a4c>2012-06-12 17:37:21 +0000
committertv <tv@971eb68f-4bfb-0310-8326-d2484c010a4c>2012-06-12 17:37:21 +0000
commit23005b8929e92d379b12fc074c3c378b1efbecf4 (patch)
tree2374b81b0ea609526aaff22b148b01ace4f3090a /RPM4/src
parent3996eade3a09875516f527f5fdc5fdf62e8b5ddb (diff)
downloadperl-RPM4-23005b8929e92d379b12fc074c3c378b1efbecf4.tar
perl-RPM4-23005b8929e92d379b12fc074c3c378b1efbecf4.tar.gz
perl-RPM4-23005b8929e92d379b12fc074c3c378b1efbecf4.tar.bz2
perl-RPM4-23005b8929e92d379b12fc074c3c378b1efbecf4.tar.xz
perl-RPM4-23005b8929e92d379b12fc074c3c378b1efbecf4.zip
(get_name, get_arch) introduce a couple helper from URPM (needed for next commits)
git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@187 971eb68f-4bfb-0310-8326-d2484c010a4c
Diffstat (limited to 'RPM4/src')
-rw-r--r--RPM4/src/RPM4.xs24
1 files changed, 24 insertions, 0 deletions
diff --git a/RPM4/src/RPM4.xs b/RPM4/src/RPM4.xs
index 2a17ad0..ac6c556 100644
--- a/RPM4/src/RPM4.xs
+++ b/RPM4/src/RPM4.xs
@@ -181,6 +181,30 @@ static rpmTag sv2dbquerytag(SV * sv_tag) {
#define sv2tagtype(sv) sv2constant((sv), "rpmtagtype")
+/*
+ * From URPM.xs:
+ */
+
+static char *
+get_name(Header header, int32_t tag) {
+ struct rpmtd_s val;
+
+ headerGet(header, tag, &val, HEADERGET_MINMEM);
+ char *name = (char *) rpmtdGetString(&val);
+ rpmtdFreeData(&val);
+ return name ? name : "";
+}
+
+static char*
+get_arch(Header header) {
+ return headerIsEntry(header, RPMTAG_SOURCERPM) ? get_name(header, RPMTAG_ARCH) : "src";
+}
+
+/*
+ * End of URPM import
+ * */
+
+
/* This function replace the standard rpmShowProgress callback
* during transaction to allow perl callback */