teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.9.x-exclude-warn.patch

Panu Matilainen d06308
commit cce686b2129e4e8dc27f1a640f7c4746f9ffb032
Panu Matilainen d06308
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen d06308
Date:   Sun Oct 23 13:59:46 2011 +0300
Panu Matilainen d06308
Panu Matilainen d06308
    Warn but don't fail the build on missing excluded files (RhBug:745629)
Panu Matilainen d06308
    
Panu Matilainen d06308
    - If a file/directory is not to be packaged, there's not a whole lot
Panu Matilainen d06308
      point making the build fail if its missing. In case exclude is
Panu Matilainen d06308
      used to leave certain files to sub-packages, the sub-package file
Panu Matilainen d06308
      lists will catch out missing files that are really missing as a
Panu Matilainen d06308
      result of actual build failure or such (except perhaps for some
Panu Matilainen d06308
      glob cases but missing files can go unnoticed in those cases anyway)
Panu Matilainen d06308
    - backported from commit 084a00bf51a941ec85c094a436bda401fccf7d3a
Panu Matilainen d06308
Panu Matilainen d06308
diff --git a/build/files.c b/build/files.c
Panu Matilainen d06308
index e0747f8..a520410 100644
Panu Matilainen d06308
--- a/build/files.c
Panu Matilainen d06308
+++ b/build/files.c
Panu Matilainen d06308
@@ -1393,12 +1393,17 @@ static rpmRC addFile(FileList fl, const char * diskPath,
Panu Matilainen d06308
 		    statp->st_mtime = now;
Panu Matilainen d06308
 		    statp->st_ctime = now;
Panu Matilainen d06308
 		} else {
Panu Matilainen d06308
+		    int rc = RPMRC_FAIL;
Panu Matilainen d06308
+		    int lvl = RPMLOG_ERR;
Panu Matilainen d06308
 		    const char *msg = fl->isDir ?
Panu Matilainen d06308
 					    _("Directory not found: %s\n") :
Panu Matilainen d06308
 					    _("File not found: %s\n");
Panu Matilainen d06308
-		    rpmlog(RPMLOG_ERR, msg, diskPath);
Panu Matilainen d06308
-		    fl->processingFailed = 1;
Panu Matilainen d06308
-		    return RPMRC_FAIL;
Panu Matilainen d06308
+		    if (fl->currentFlags & RPMFILE_EXCLUDE) {
Panu Matilainen d06308
+			lvl = RPMLOG_WARNING;
Panu Matilainen d06308
+			rc = RPMRC_OK;
Panu Matilainen d06308
+		    }
Panu Matilainen d06308
+		    rpmlog(lvl, msg, diskPath);
Panu Matilainen d06308
+		    return rc;
Panu Matilainen d06308
 		}
Panu Matilainen d06308
 	    }
Panu Matilainen d06308
 	}
Panu Matilainen d06308
@@ -1702,11 +1707,15 @@ static rpmRC processBinaryFile(Package pkg, FileList fl, const char * fileName)
Panu Matilainen d06308
 	    }
Panu Matilainen d06308
 	    argvFree(argv);
Panu Matilainen d06308
 	} else {
Panu Matilainen d06308
+	    int lvl = RPMLOG_WARNING;
Panu Matilainen d06308
 	    const char *msg = (fl->isDir) ?
Panu Matilainen d06308
 				_("Directory not found by glob: %s\n") :
Panu Matilainen d06308
 				_("File not found by glob: %s\n");
Panu Matilainen d06308
-	    rpmlog(RPMLOG_ERR, msg, diskPath);
Panu Matilainen d06308
-	    rc = RPMRC_FAIL;
Panu Matilainen d06308
+	    if (!(fl->currentFlags & RPMFILE_EXCLUDE)) {
Panu Matilainen d06308
+		lvl = RPMLOG_ERR;
Panu Matilainen d06308
+		rc = RPMRC_FAIL;
Panu Matilainen d06308
+	    }
Panu Matilainen d06308
+	    rpmlog(lvl, msg, diskPath);
Panu Matilainen d06308
 	    goto exit;
Panu Matilainen d06308
 	}
Panu Matilainen d06308
     } else {