Revert spec tag-macro concatenation changes
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 28 Jan 2010 13:15:12 +0000 (15:15 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Feb 2010 11:39:42 +0000 (13:39 +0200)
- Concatenating to global, non-namespaced tag macros is fundamentally
  broken for specs with sub-packages, RhBug:555926 is not fixable with
  tag macros tweaks.
  Revert back to the old behavior where tag macros are simply "the last line
  seen wins." This might not be what one expects in many cases but it
  is at least consistent, and changing the behavior in any
  way (such as not adding the macros for multiline-items like requires)
  breaks existing packages without a good reason.
- Correctly handling the expected %{obsoletes} etc behavior in RhBug:555926
  would require a new mechanism, such as permitting spec to access the
  (sub-)package headers. Probably doable, unlikely to be worth the
  effort as the issue can be easily avoided by writing the spec differently.
- This reverts commits 3be37d9c78fd13424880fa1fe48f341103a51194 and
  e811ef56aa88588e16e0a80d48381a62631f8fc4

build/parsePreamble.c

index 8ff8a05..e31af74 100644 (file)
@@ -688,31 +688,8 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
        return RPMRC_FAIL;
     }
 
-    if (macro) {
-       if ( !strcasecmp(macro, "requires") ||
-            !strcasecmp(macro, "obsoletes") ||
-            !strcasecmp(macro, "conflicts") ||
-            !strcasecmp(macro, "provides")
-         ) {
-           char *macro_expanded = NULL,
-               *macro_token = NULL,
-               *field_set = NULL;
-
-           rasprintf(&macro_token, "%%%s", macro);
-           macro_expanded = rpmExpand(macro_token);
-           if (!strcmp(macro_expanded, macro_token)) {
-               field_set = xstrdup(field);
-           } else {
-               rasprintf(&field_set, "%s %s", macro_expanded, field);
-           }
-           addMacro(spec->macros, macro, NULL, field_set, RMIL_SPEC);
-           free(macro_expanded);
-           free(macro_token);
-           free(field_set);
-       } else {
-           addMacro(spec->macros, macro, NULL, field, RMIL_SPEC);
-       }
-    }
+    if (macro)
+       addMacro(spec->macros, macro, NULL, field, RMIL_SPEC);
     
     return RPMRC_OK;
 }