aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-14 17:35:22 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-14 17:35:22 +0000
commite6aa09ecdf02242c5e050f6df9e522a20632f2f2 (patch)
tree57518e658626c8948ba343088c17e0a700a4cde1
parent8e67a40eca1bf1d3f72704e99b74c20dcfb77d38 (diff)
downloadperl-URPM-e6aa09ecdf02242c5e050f6df9e522a20632f2f2.tar
perl-URPM-e6aa09ecdf02242c5e050f6df9e522a20632f2f2.tar.gz
perl-URPM-e6aa09ecdf02242c5e050f6df9e522a20632f2f2.tar.bz2
perl-URPM-e6aa09ecdf02242c5e050f6df9e522a20632f2f2.tar.xz
perl-URPM-e6aa09ecdf02242c5e050f6df9e522a20632f2f2.zip
- $trans->run can now return both the translated errors, and some parsable
errors (useful for example to detect diskspace issues)
-rw-r--r--NEWS3
-rw-r--r--URPM.xs13
2 files changed, 11 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 92df7ef..8839ee5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- $trans->run can now return both the translated errors, and some parsable
+ errors (useful for example to detect diskspace issues)
+
Version 3.19 - 7 October 2008, by Pascal "Pixel" Rigaux
- handle flag "replacefiles"
diff --git a/URPM.xs b/URPM.xs
index 08cfca1..e750570 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -724,7 +724,7 @@ return_files(Header header, int filter_mode) {
}
void
-return_problems(rpmps ps, int translate_message) {
+return_problems(rpmps ps, int translate_message, int raw_message) {
dSP;
if (ps && rpmpsNumProblems(ps) > 0) {
#ifdef RPM_ORG
@@ -746,7 +746,8 @@ return_problems(rpmps ps, int translate_message) {
if (rpm_codeset_is_utf8) SvUTF8_on(sv);
XPUSHs(sv_2mortal(sv));
_free(buf);
- } else {
+ }
+ if (raw_message) {
const char *pkgNEVR = rpmProblemGetPkgNEVR(p) ? rpmProblemGetPkgNEVR(p) : "";
const char *altNEVR = rpmProblemGetAltNEVR(p) ? rpmProblemGetAltNEVR(p) : "";
const char *s = rpmProblemGetStr(p) ? rpmProblemGetStr(p) : "";
@@ -3168,7 +3169,7 @@ Trans_check(trans, ...)
} else if (gimme == G_ARRAY) {
/* now translation is handled by rpmlib, but only for version 4.2 and above */
PUTBACK;
- return_problems(ps, 1);
+ return_problems(ps, 1, 0);
SPAGAIN;
}
} else if (gimme == G_SCALAR) {
@@ -3251,7 +3252,7 @@ Trans_run(trans, data, ...)
struct s_TransactionData td = { NULL, NULL, NULL, NULL, NULL, 100000, data };
rpmtransFlags transFlags = RPMTRANS_FLAG_NONE;
int probFilter = 0;
- int translate_message = 0;
+ int translate_message = 0, raw_message = 0;
int i;
PPCODE:
for (i = 2 ; i < items - 1 ; i += 2) {
@@ -3282,6 +3283,8 @@ Trans_run(trans, data, ...)
if (SvIV(ST(i+1))) probFilter |= RPMPROB_FILTER_OLDPACKAGE;
} else if (len == 11 && !memcmp(s, "replacepkgs", 11)) {
if (SvIV(ST(i+1))) probFilter |= RPMPROB_FILTER_REPLACEPKG;
+ } else if (len == 11 && !memcmp(s, "raw_message", 11)) {
+ raw_message = 1;
} else if (len == 12 && !memcmp(s, "replacefiles", 12)) {
if (SvIV(ST(i+1))) probFilter |= RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES;
} else if (len == 9 && !memcmp(s, "repackage", 9)) {
@@ -3319,7 +3322,7 @@ Trans_run(trans, data, ...)
if (rpmtsRun(trans->ts, NULL, probFilter) > 0) {
rpmps ps = rpmtsProblems(trans->ts);
PUTBACK;
- return_problems(ps, translate_message);
+ return_problems(ps, translate_message, raw_message || !translate_message);
SPAGAIN;
ps = rpmpsFree(ps);
}