Warn but don't fail the build on missing excluded files (RhBug:745629)
authorPanu Matilainen <pmatilai@redhat.com>
Sun, 23 Oct 2011 10:59:46 +0000 (13:59 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Sun, 23 Oct 2011 11:02:56 +0000 (14:02 +0300)
- If a file/directory is not to be packaged, there's not a whole lot
  point making the build fail if its missing. In case exclude is
  used to leave certain files to sub-packages, the sub-package file
  lists will catch out missing files that are really missing as a
  result of actual build failure or such (except perhaps for some
  glob cases but missing files can go unnoticed in those cases anyway)

build/files.c

index 2243e0b..aeceed8 100644 (file)
@@ -1373,10 +1373,15 @@ static rpmRC addFile(FileList fl, const char * diskPath,
                    statp->st_mtime = now;
                    statp->st_ctime = now;
                } else {
+                   int lvl = RPMLOG_ERR;
                    const char *msg = fl->isDir ?
                                            _("Directory not found: %s\n") :
                                            _("File not found: %s\n");
-                   rpmlog(RPMLOG_ERR, msg, diskPath);
+                   if (fl->currentFlags & RPMFILE_EXCLUDE) {
+                       lvl = RPMLOG_WARNING;
+                       rc = RPMRC_OK;
+                   }
+                   rpmlog(lvl, msg, diskPath);
                    goto exit;
                }
            }
@@ -1670,11 +1675,15 @@ static rpmRC processBinaryFile(Package pkg, FileList fl, const char * fileName)
            }
            argvFree(argv);
        } else {
+           int lvl = RPMLOG_WARNING;
            const char *msg = (fl->isDir) ?
                                _("Directory not found by glob: %s\n") :
                                _("File not found by glob: %s\n");
-           rpmlog(RPMLOG_ERR, msg, diskPath);
-           rc = RPMRC_FAIL;
+           if (!(fl->currentFlags & RPMFILE_EXCLUDE)) {
+               lvl = RPMLOG_ERR;
+               rc = RPMRC_FAIL;
+           }
+           rpmlog(lvl, msg, diskPath);
            goto exit;
        }
     } else {