Blob Blame History Raw
commit 2222e81e1cf74bbf78acb9969592ab06e2289929
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Oct 27 10:57:35 2009 +0200

    Make disk space problem reporting slightly saner (RhBug:517418)
    - Only report disk space/inode issues for packages that are affected
      instead of piling up all the problems in all filesystems on all remaining
      packages
    - The messages are still ambiguous at best, need to figure out something
      better one of these days...

diff --git a/lib/rpmts.c b/lib/rpmts.c
index 38fedc8..6e28b82 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -910,17 +910,23 @@ void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
     for (i = 0; i < ts->filesystemCount; i++, dsi++) {
 
 	if (dsi->bavail >= 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
-	    rpmpsAppend(ps, RPMPROB_DISKSPACE,
+	    if (dsi->bneeded != dsi->obneeded) {
+		rpmpsAppend(ps, RPMPROB_DISKSPACE,
 			rpmteNEVRA(te), rpmteKey(te),
 			ts->filesystems[i], NULL, NULL,
- 	   (adj_fs_blocks(dsi->bneeded) - dsi->bavail) * dsi->bsize);
+		   (adj_fs_blocks(dsi->bneeded) - dsi->bavail) * dsi->bsize);
+		dsi->obneeded = dsi->bneeded;
+	    }
 	}
 
 	if (dsi->iavail >= 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
-	    rpmpsAppend(ps, RPMPROB_DISKNODES,
+	    if (dsi->ineeded != dsi->oineeded) {
+		rpmpsAppend(ps, RPMPROB_DISKNODES,
 			rpmteNEVRA(te), rpmteKey(te),
 			ts->filesystems[i], NULL, NULL,
- 	    (adj_fs_blocks(dsi->ineeded) - dsi->iavail));
+			(adj_fs_blocks(dsi->ineeded) - dsi->iavail));
+		dsi->oineeded = dsi->ineeded;
+	    }
 	}
     }
     ps = rpmpsFree(ps);
diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h
index 6189fc1..1b0f847 100644
--- a/lib/rpmts_internal.h
+++ b/lib/rpmts_internal.h
@@ -20,6 +20,8 @@ struct diskspaceInfo_s {
     int64_t bsize;	/*!< File system block size. */
     int64_t bavail;	/*!< No. of blocks available. */
     int64_t iavail;	/*!< No. of inodes available. */
+    int64_t obneeded;	/*!< Bookkeeping to avoid duplicate reports */
+    int64_t oineeded;	/*!< Bookkeeping to avoid duplicate reports */
 };
 
 /** \ingroup rpmts