aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-05-05 15:57:53 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-05-05 15:57:53 +0000
commit21f9e8412b6adbf77c86211eda46854eef149d31 (patch)
tree69b113bdcbfb2a25cbeebf93d84f29200d591899
parent3911d484250b9b84edeaced67141cbb2672ae4e2 (diff)
downloadperl-URPM-21f9e8412b6adbf77c86211eda46854eef149d31.tar
perl-URPM-21f9e8412b6adbf77c86211eda46854eef149d31.tar.gz
perl-URPM-21f9e8412b6adbf77c86211eda46854eef149d31.tar.bz2
perl-URPM-21f9e8412b6adbf77c86211eda46854eef149d31.tar.xz
perl-URPM-21f9e8412b6adbf77c86211eda46854eef149d31.zip
revert attempt at refactorizing Trans_run() which turned out to give code harder to read and introduced bugs of options not being parsed (#63205)
-rw-r--r--NEWS4
-rw-r--r--URPM.xs102
2 files changed, 55 insertions, 51 deletions
diff --git a/NEWS b/NEWS
index ab70f8c..c33cfb1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
-Version 4.28 - May 2011, by Per Øyvind Karlsen
+Version 4.28 - 5 May 2011, by Per Øyvind Karlsen
+- revert attempt at refactorizing Trans_run() which turned out to give code
+ harder to read and introduced bugs of options not being parsed (#63205)
- fix an invalid free() that would've happened if package summary were to be
missing and the "" string constant were attempted to be freed
- fix odd problems caused by attempt at translating correct tag names for
diff --git a/URPM.xs b/URPM.xs
index 789e950..a292f02 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3811,59 +3811,61 @@ Trans_run(trans, data, ...)
STRLEN len;
char *s = SvPV(ST(i), len);
- if (SvIV(ST(i+1))) {
- if (len == 4 && !memcmp(s, "test", 4))
- transFlags |= RPMTRANS_FLAG_TEST;
- else if (len == 11 && !memcmp(s, "excludedocs", 11))
- transFlags |= RPMTRANS_FLAG_NODOCS;
- else if (len == 5) {
- if (!memcmp(s, "force", 5))
- probFilter |= (RPMPROB_FILTER_REPLACEPKG |
- RPMPROB_FILTER_REPLACEOLDFILES |
- RPMPROB_FILTER_REPLACENEWFILES |
- RPMPROB_FILTER_OLDPACKAGE);
- else if (!memcmp(s, "delta", 5))
- td.min_delta = SvIV(ST(i+1));
- }
- else if (len == 6 && !memcmp(s, "nosize", 6))
- probFilter |= (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES);
- else if (len == 9 && !memcmp(s, "noscripts", 9))
- transFlags |= (RPMTRANS_FLAG_NOSCRIPTS|_noTransScripts);
- else if (len == 10) {
- if (!memcmp(s, "notriggers", 10))
- transFlags |= (RPMTRANS_FLAG_NOTRIGGERS|_noTransTriggers);
- else if (!memcmp(s, "nofdigests", 10))
- transFlags |= RPMTRANS_FLAG_NOFDIGESTS;
- else if (!memcmp(s, "oldpackage", 10))
- probFilter |= RPMPROB_FILTER_OLDPACKAGE;
- }
- else if (len == 11 && !memcmp(s, "replacepkgs", 11))
- probFilter |= RPMPROB_FILTER_REPLACEPKG;
- else if (len == 12 && !memcmp(s, "replacefiles", 12))
- probFilter |= RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES;
- else if (len == 9 && !memcmp(s, "repackage", 9))
- transFlags |= RPMTRANS_FLAG_REPACKAGE;
- else if (len == 6 && !memcmp(s, "justdb", 6))
- transFlags |= RPMTRANS_FLAG_JUSTDB;
- else if (len == 10 && !memcmp(s, "ignorearch", 10))
- probFilter |= RPMPROB_FILTER_IGNOREARCH;
- else if (len >= 9 && !memcmp(s, "callback_", 9)) {
- if (len == 9+4 && !memcmp(s+9, "open", 4))
- td.callback_open = ST(i+1);
- else if (len == 9+5 && !memcmp(s+9, "close", 5))
- td.callback_close = ST(i+1);
- else if (len == 9+5 && !memcmp(s+9, "trans", 5))
- td.callback_trans = ST(i+1);
- else if (len == 9+6 && !memcmp(s+9, "uninst", 6))
- td.callback_uninst = ST(i+1);
- else if (len == 9+4 && !memcmp(s+9, "inst", 4))
- td.callback_inst = ST(i+1);
- }
- } else if (len == 11 && !memcmp(s, "raw_message", 11))
+ if (len == 4 && !memcmp(s, "test", 4)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_TEST;
+ } else if (len == 11 && !memcmp(s, "excludedocs", 11)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_NODOCS;
+ } else if (len == 5) {
+ if (!memcmp(s, "force", 5)) {
+ if (SvIV(ST(i+1))) probFilter |= (RPMPROB_FILTER_REPLACEPKG |
+ RPMPROB_FILTER_REPLACEOLDFILES |
+ RPMPROB_FILTER_REPLACENEWFILES |
+ RPMPROB_FILTER_OLDPACKAGE);
+ } else if (!memcmp(s, "delta", 5))
+ td.min_delta = SvIV(ST(i+1));
+ } else if (len == 6 && !memcmp(s, "nosize", 6)) {
+ if (SvIV(ST(i+1))) probFilter |= (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES);
+ } else if (len == 9 && !memcmp(s, "noscripts", 9)) {
+ if (SvIV(ST(i+1))) transFlags |= (RPMTRANS_FLAG_NOSCRIPTS |
+ RPMTRANS_FLAG_NOPRE |
+ RPMTRANS_FLAG_NOPREUN |
+ RPMTRANS_FLAG_NOPOST |
+ RPMTRANS_FLAG_NOPOSTUN );
+
+ } else if (len == 10 && !memcmp(s, "notriggers", 10)) {
+ if (SvIV(ST(i+1))) transFlags |= (RPMTRANS_FLAG_NOTRIGGERS|_noTransTriggers);
+ } else if (len == 10 && !memcmp(s, "nofdigests", 10)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_NOFDIGESTS;
+ } else if (len == 10 && !memcmp(s, "oldpackage", 10)) {
+ 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 == 17 && !memcmp(s, "translate_message", 17))
+ } 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)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_REPACKAGE;
+ } else if (len == 6 && !memcmp(s, "justdb", 6)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_JUSTDB;
+ } else if (len == 10 && !memcmp(s, "ignorearch", 10)) {
+ if (SvIV(ST(i+1))) probFilter |= RPMPROB_FILTER_IGNOREARCH;
+ } else if (len == 17 && !memcmp(s, "translate_message", 17))
translate_message = 1;
+ else if (len >= 9 && !memcmp(s, "callback_", 9)) {
+ if (len == 9+4 && !memcmp(s+9, "open", 4)) {
+ if (SvROK(ST(i+1))) td.callback_open = ST(i+1);
+ } else if (len == 9+5 && !memcmp(s+9, "close", 5)) {
+ if (SvROK(ST(i+1))) td.callback_close = ST(i+1);
+ } else if (len == 9+5 && !memcmp(s+9, "trans", 5)) {
+ if (SvROK(ST(i+1))) td.callback_trans = ST(i+1);
+ } else if (len == 9+6 && !memcmp(s+9, "uninst", 6)) {
+ if (SvROK(ST(i+1))) td.callback_uninst = ST(i+1);
+ } else if (len == 9+4 && !memcmp(s+9, "inst", 4)) {
+ if (SvROK(ST(i+1))) td.callback_inst = ST(i+1);
+ }
}
+ }
/* check macros */
{
char *repa = rpmExpand("%_repackage_all_erasures", NULL);