Fix build error: Ignore rewrite "%package debuginfo" section in spec file 74/290174/5 submit/tizen_base/20230321.143030
authorbiao716.wang <biao716.wang@samsung.com>
Tue, 21 Mar 2023 06:08:48 +0000 (15:08 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Tue, 21 Mar 2023 06:26:47 +0000 (15:26 +0900)
Change-Id: I4ecc81988f64c395aef10b4f7c089fba1cc9e614
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
build/parsePreamble.c

index 96bf9c0..70c528a 100644 (file)
@@ -702,8 +702,9 @@ int addLangTag(rpmSpec spec, Header h, rpmTagVal tag,
 
     if (haveLangTag(h, tag, lang)) {
        /* Turn this into an error eventually */
-       rpmlog(RPMLOG_WARNING, _("line %d: second %s\n"),
+       rpmlog(RPMLOG_WARNING, _("line %d: second %s, please remove it\n"),
                spec->lineNum, rpmTagGetName(tag));
+       return 0;
     }
 
     if (!*lang) {
@@ -1126,6 +1127,30 @@ int parsePreamble(rpmSpec spec, int initialPackage)
        //    goto exit;
        
        if (!lookupPackage(spec, name, flag, NULL)) {
+               //exist %package debuginfo, need to ignore it, because there has been
+               //debuginfo package created by %debug_package macro.
+               if (0 == strncmp(name, "debuginfo", 9))
+               {
+                       rpmlog(RPMLOG_WARNING, _("debuginfo package has been in spec file, Don't write again this %s"), spec->line);
+                       if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
+                               nextPart = PART_NONE;
+                       } else if (rc < 0) {
+                               free(name);
+                               goto exit;
+                       } else {
+                               while (! (nextPart = isPart(spec->line))) {
+                                       if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
+                                               nextPart = PART_NONE;
+                                               break;
+                                       }
+                                       if (rc) {
+                                               free(name);
+                                               goto exit;
+                                       }
+                               }
+                       }
+                       res = nextPart;
+               }
            free(name);
            goto exit;
        }