- do not statfs all filesystems until there is something to report
- cherry pick default clean section patch from upstream - add make_install macro definition OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=25
This commit is contained in:
parent
a3e525c3c8
commit
b81765cc36
18
defclean.diff
Normal file
18
defclean.diff
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Index: build/parseSpec.c
|
||||||
|
===================================================================
|
||||||
|
--- build/parseSpec.c.orig
|
||||||
|
+++ build/parseSpec.c
|
||||||
|
@@ -569,6 +569,13 @@ int parseSpec(rpmts ts, const char *spec
|
||||||
|
}
|
||||||
|
/* LCL: parsePart is modified @*/
|
||||||
|
|
||||||
|
+ if (spec->clean == NULL) {
|
||||||
|
+ char *body = rpmExpand("%{?buildroot: %{__rm} -rf %{buildroot}}", NULL);
|
||||||
|
+ spec->clean = newStringBuf();
|
||||||
|
+ appendLineStringBuf(spec->clean, body);
|
||||||
|
+ free(body);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Check for description in each package and add arch and os */
|
||||||
|
{
|
||||||
|
char *platform = rpmExpand("%{_target_platform}", NULL);
|
286
lazystatfs.diff
Normal file
286
lazystatfs.diff
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
Index: lib/rpmts.c
|
||||||
|
===================================================================
|
||||||
|
--- lib/rpmts.c.orig
|
||||||
|
+++ lib/rpmts.c
|
||||||
|
@@ -779,83 +779,102 @@ rpmdb rpmtsGetRdb(rpmts ts)
|
||||||
|
|
||||||
|
int rpmtsInitDSI(const rpmts ts)
|
||||||
|
{
|
||||||
|
- rpmDiskSpaceInfo dsi;
|
||||||
|
- struct stat sb;
|
||||||
|
- int rc;
|
||||||
|
- int i;
|
||||||
|
-
|
||||||
|
if (rpmtsFilterFlags(ts) & RPMPROB_FILTER_DISKSPACE)
|
||||||
|
return 0;
|
||||||
|
-
|
||||||
|
- rpmlog(RPMLOG_DEBUG, "mounted filesystems:\n");
|
||||||
|
- rpmlog(RPMLOG_DEBUG,
|
||||||
|
- " i dev bsize bavail iavail mount point\n");
|
||||||
|
-
|
||||||
|
- rc = rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount);
|
||||||
|
- if (rc || ts->filesystems == NULL || ts->filesystemCount <= 0)
|
||||||
|
- return rc;
|
||||||
|
-
|
||||||
|
- /* Get available space on mounted file systems. */
|
||||||
|
-
|
||||||
|
ts->dsi = _free(ts->dsi);
|
||||||
|
- ts->dsi = xcalloc((ts->filesystemCount + 1), sizeof(*ts->dsi));
|
||||||
|
+ ts->dsi = xcalloc(1, sizeof(*ts->dsi));
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
|
||||||
|
- dsi = ts->dsi;
|
||||||
|
+static rpmDiskSpaceInfo rpmtsCreateDSI(const rpmts ts, dev_t dev, const char *dirName, int count)
|
||||||
|
+{
|
||||||
|
+ rpmDiskSpaceInfo dsi;
|
||||||
|
+ struct stat sb;
|
||||||
|
+ int rc;
|
||||||
|
|
||||||
|
- if (dsi != NULL)
|
||||||
|
- for (i = 0; (i < ts->filesystemCount) && dsi; i++, dsi++) {
|
||||||
|
#if STATFS_IN_SYS_STATVFS
|
||||||
|
- struct statvfs sfb;
|
||||||
|
- memset(&sfb, 0, sizeof(sfb));
|
||||||
|
- rc = statvfs(ts->filesystems[i], &sfb);
|
||||||
|
+ struct statvfs sfb;
|
||||||
|
+ memset(&sfb, 0, sizeof(sfb));
|
||||||
|
+ rc = statvfs(dirName, &sfb);
|
||||||
|
#else
|
||||||
|
- struct statfs sfb;
|
||||||
|
- memset(&sfb, 0, sizeof(sfb));
|
||||||
|
+ struct statfs sfb;
|
||||||
|
+ memset(&sfb, 0, sizeof(sfb));
|
||||||
|
# if STAT_STATFS4
|
||||||
|
/* This platform has the 4-argument version of the statfs call. The last two
|
||||||
|
* should be the size of struct statfs and 0, respectively. The 0 is the
|
||||||
|
* filesystem type, and is always 0 when statfs is called on a mounted
|
||||||
|
* filesystem, as we're doing.
|
||||||
|
*/
|
||||||
|
- rc = statfs(ts->filesystems[i], &sfb, sizeof(sfb), 0);
|
||||||
|
+ rc = statfs(dirName, &sfb, sizeof(sfb), 0);
|
||||||
|
# else
|
||||||
|
- rc = statfs(ts->filesystems[i], &sfb);
|
||||||
|
+ rc = statfs(dirName, &sfb);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
- if (rc)
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
- rc = stat(ts->filesystems[i], &sb);
|
||||||
|
- if (rc)
|
||||||
|
- break;
|
||||||
|
- dsi->dev = sb.st_dev;
|
||||||
|
+ if (rc)
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
- dsi->bsize = sfb.f_bsize;
|
||||||
|
- dsi->bneeded = 0;
|
||||||
|
- dsi->ineeded = 0;
|
||||||
|
+ rc = stat(dirName, &sb);
|
||||||
|
+ if (rc)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (sb.st_dev != dev)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ ts->dsi = xrealloc(ts->dsi, (count + 2) * sizeof(*ts->dsi));
|
||||||
|
+ dsi = ts->dsi + count;
|
||||||
|
+ memset(dsi, 0, 2 * sizeof(*dsi));
|
||||||
|
+ dsi->dev = dev;
|
||||||
|
+ dsi->bsize = sfb.f_bsize;
|
||||||
|
+ if (!dsi->bsize)
|
||||||
|
+ dsi->bsize = 512; /* we need a bsize */
|
||||||
|
+ dsi->bneeded = 0;
|
||||||
|
+ dsi->ineeded = 0;
|
||||||
|
#ifdef STATFS_HAS_F_BAVAIL
|
||||||
|
- dsi->bavail = sfb.f_bavail;
|
||||||
|
+ dsi->bavail = sfb.f_bavail;
|
||||||
|
#else
|
||||||
|
/* FIXME: the statfs struct doesn't have a member to tell how many blocks are
|
||||||
|
* available for non-superusers. f_blocks - f_bfree is probably too big, but
|
||||||
|
* it's about all we can do.
|
||||||
|
*/
|
||||||
|
- dsi->bavail = sfb.f_blocks - sfb.f_bfree;
|
||||||
|
+ dsi->bavail = sfb.f_blocks - sfb.f_bfree;
|
||||||
|
#endif
|
||||||
|
- /* XXX Avoid FAT and other file systems that have not inodes. */
|
||||||
|
- /* XXX assigning negative value to unsigned type */
|
||||||
|
- dsi->iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
|
||||||
|
- ? sfb.f_ffree : -1;
|
||||||
|
- rpmlog(RPMLOG_DEBUG,
|
||||||
|
- "%5d 0x%08x %8" PRId64 " %12" PRId64 " %12" PRId64" %s\n",
|
||||||
|
- i, (unsigned) dsi->dev, dsi->bsize,
|
||||||
|
- dsi->bavail, dsi->iavail,
|
||||||
|
- ts->filesystems[i]);
|
||||||
|
+ /* XXX Avoid FAT and other file systems that have not inodes. */
|
||||||
|
+ /* XXX assigning negative value to unsigned type */
|
||||||
|
+ dsi->iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
|
||||||
|
+ ? sfb.f_ffree : -1;
|
||||||
|
+
|
||||||
|
+ return dsi;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void rpmtsFindDSIMount(const rpmts ts, rpmDiskSpaceInfo dsi)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+ struct stat sb;
|
||||||
|
+
|
||||||
|
+ /* must leave chroot for this */
|
||||||
|
+ if (rpmtsChrootDone(ts)) {
|
||||||
|
+ chroot(".");
|
||||||
|
+ }
|
||||||
|
+ if (!ts->filesystemCount)
|
||||||
|
+ rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount);
|
||||||
|
+ for (i = 0; i < ts->filesystemCount; i++) {
|
||||||
|
+ if (stat(ts->filesystems[i], &sb))
|
||||||
|
+ continue;
|
||||||
|
+ if (sb.st_dev == dsi->dev) {
|
||||||
|
+ dsi->mntPoint = ts->filesystems[i];
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (i == ts->filesystemCount) {
|
||||||
|
+ /* file system not found, create something to display */
|
||||||
|
+ dsi->mntPoint = xmalloc(20);
|
||||||
|
+ sprintf(dsi->mntPoint, "dev 0x%08x", (unsigned)dsi->dev);
|
||||||
|
+ }
|
||||||
|
+ if (rpmtsChrootDone(ts)) {
|
||||||
|
+ chroot(ts->rootDir);
|
||||||
|
}
|
||||||
|
- return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
-void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
|
||||||
|
+void rpmtsUpdateDSI(const rpmts ts, dev_t dev, const char *dirName,
|
||||||
|
rpm_loff_t fileSize, rpm_loff_t prevSize, rpm_loff_t fixupSize,
|
||||||
|
rpmFileAction action)
|
||||||
|
{
|
||||||
|
@@ -866,8 +885,10 @@ void rpmtsUpdateDSI(const rpmts ts, dev_
|
||||||
|
if (dsi) {
|
||||||
|
while (dsi->bsize && dsi->dev != dev)
|
||||||
|
dsi++;
|
||||||
|
- if (dsi->bsize == 0)
|
||||||
|
- dsi = NULL;
|
||||||
|
+ if (dsi->bsize == 0) {
|
||||||
|
+ /* create new entry */
|
||||||
|
+ dsi = rpmtsCreateDSI(ts, dev, dirName, dsi - ts->dsi);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
if (dsi == NULL)
|
||||||
|
return;
|
||||||
|
@@ -910,32 +931,32 @@ void rpmtsCheckDSIProblems(const rpmts t
|
||||||
|
rpmDiskSpaceInfo dsi;
|
||||||
|
rpmps ps;
|
||||||
|
int fc;
|
||||||
|
- int i;
|
||||||
|
-
|
||||||
|
- if (ts->filesystems == NULL || ts->filesystemCount <= 0)
|
||||||
|
- return;
|
||||||
|
|
||||||
|
dsi = ts->dsi;
|
||||||
|
- if (dsi == NULL)
|
||||||
|
+ if (dsi == NULL || !dsi->bsize)
|
||||||
|
return;
|
||||||
|
fc = rpmfiFC(rpmteFI(te));
|
||||||
|
if (fc <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ps = rpmtsProblems(ts);
|
||||||
|
- for (i = 0; i < ts->filesystemCount; i++, dsi++) {
|
||||||
|
+ for (; dsi->bsize; dsi++) {
|
||||||
|
|
||||||
|
if (dsi->bavail >= 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
|
||||||
|
+ if (!dsi->mntPoint)
|
||||||
|
+ rpmtsFindDSIMount(ts, dsi);
|
||||||
|
rpmpsAppend(ps, RPMPROB_DISKSPACE,
|
||||||
|
rpmteNEVRA(te), rpmteKey(te),
|
||||||
|
- ts->filesystems[i], NULL, NULL,
|
||||||
|
+ dsi->mntPoint, NULL, NULL,
|
||||||
|
(adj_fs_blocks(dsi->bneeded)) * dsi->bsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dsi->iavail >= 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
|
||||||
|
+ if (!dsi->mntPoint)
|
||||||
|
+ rpmtsFindDSIMount(ts, dsi);
|
||||||
|
rpmpsAppend(ps, RPMPROB_DISKNODES,
|
||||||
|
rpmteNEVRA(te), rpmteKey(te),
|
||||||
|
- ts->filesystems[i], NULL, NULL,
|
||||||
|
+ dsi->mntPoint, NULL, NULL,
|
||||||
|
(adj_fs_blocks(dsi->ineeded)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Index: lib/rpmts.h
|
||||||
|
===================================================================
|
||||||
|
--- lib/rpmts.h.orig
|
||||||
|
+++ lib/rpmts.h
|
||||||
|
@@ -485,7 +485,7 @@ int rpmtsSuspendResumeDBLock(rpmts ts, i
|
||||||
|
* @param fixupSize long size difference
|
||||||
|
* @param action file disposition
|
||||||
|
*/
|
||||||
|
-void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
|
||||||
|
+void rpmtsUpdateDSI(const rpmts ts, dev_t dev, const char *dirName,
|
||||||
|
rpm_loff_t fileSize, rpm_loff_t prevSize, rpm_loff_t fixupSize,
|
||||||
|
rpmFileAction action);
|
||||||
|
|
||||||
|
Index: lib/rpmts_internal.h
|
||||||
|
===================================================================
|
||||||
|
--- lib/rpmts_internal.h.orig
|
||||||
|
+++ lib/rpmts_internal.h
|
||||||
|
@@ -14,6 +14,7 @@ typedef struct diskspaceInfo_s * rpmDisk
|
||||||
|
/** \ingroup rpmts
|
||||||
|
*/
|
||||||
|
struct diskspaceInfo_s {
|
||||||
|
+ const char *mntPoint; /*!< File system mount point */
|
||||||
|
dev_t dev; /*!< File system device number. */
|
||||||
|
int64_t bneeded; /*!< No. of blocks needed. */
|
||||||
|
int64_t ineeded; /*!< No. of inodes needed. */
|
||||||
|
Index: lib/transaction.c
|
||||||
|
===================================================================
|
||||||
|
--- lib/transaction.c.orig
|
||||||
|
+++ lib/transaction.c
|
||||||
|
@@ -343,7 +343,7 @@ assert(otherFi != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update disk space info for a file. */
|
||||||
|
- rpmtsUpdateDSI(ts, fiFps->entry->dev, rpmfiFSize(fi),
|
||||||
|
+ rpmtsUpdateDSI(ts, fiFps->entry->dev, fiFps->entry->dirName, rpmfiFSize(fi),
|
||||||
|
rpmfiFReplacedSize(fi), fixupSize, rpmfsGetAction(fs, i));
|
||||||
|
|
||||||
|
}
|
||||||
|
Index: configure.ac
|
||||||
|
===================================================================
|
||||||
|
--- configure.ac.orig
|
||||||
|
+++ configure.ac
|
||||||
|
@@ -511,25 +511,25 @@ dnl
|
||||||
|
found_struct_statfs=no
|
||||||
|
|
||||||
|
if test X$found_struct_statfs = Xno ; then
|
||||||
|
-dnl Solaris 2.6+ wants to use statvfs
|
||||||
|
+dnl first try including sys/vfs.h
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
-#include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
|
||||||
|
- AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
|
||||||
|
- [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
|
||||||
|
+#include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
|
||||||
|
+ AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
|
||||||
|
found_struct_statfs=yes],[])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test X$found_struct_statfs = Xno ; then
|
||||||
|
-dnl first try including sys/vfs.h
|
||||||
|
+dnl Solaris 2.6+ wants to use statvfs
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
-#include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
|
||||||
|
- AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
|
||||||
|
+#include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
|
||||||
|
+ AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
|
||||||
|
+ [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
|
||||||
|
found_struct_statfs=yes],[])
|
||||||
|
fi
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Sep 4 11:32:33 CEST 2009 - mls@suse.de
|
||||||
|
|
||||||
|
- do not statfs all filesystems until there is something
|
||||||
|
to report
|
||||||
|
- cherry pick default clean section patch from upstream
|
||||||
|
- add make_install macro definition
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Sep 2 17:16:37 CEST 2009 - mls@suse.de
|
Wed Sep 2 17:16:37 CEST 2009 - mls@suse.de
|
||||||
|
|
||||||
|
4
rpm.spec
4
rpm.spec
@ -99,6 +99,8 @@ Patch63: debuginfo-mono.patch
|
|||||||
Patch64: allowufdio.diff
|
Patch64: allowufdio.diff
|
||||||
Patch65: fixabsfilelists.diff
|
Patch65: fixabsfilelists.diff
|
||||||
Patch66: fixqueryreturn.diff
|
Patch66: fixqueryreturn.diff
|
||||||
|
Patch67: lazystatfs.diff
|
||||||
|
Patch68: defclean.diff
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
#
|
#
|
||||||
# avoid bootstrapping problem
|
# avoid bootstrapping problem
|
||||||
@ -158,7 +160,7 @@ rm -f rpmdb/db.h
|
|||||||
%patch -P 30 -P 31 -P 32 -P 33 -P 34 -P 35 -P 36 -P 37 -P 38 -P 39
|
%patch -P 30 -P 31 -P 32 -P 33 -P 34 -P 35 -P 36 -P 37 -P 38 -P 39
|
||||||
%patch -P 40 -P 41 -P 42 -P 43 -P 44 -P 45 -P 46 -P 47 -P 48 -P 49
|
%patch -P 40 -P 41 -P 42 -P 43 -P 44 -P 45 -P 46 -P 47 -P 48 -P 49
|
||||||
%patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59
|
%patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59
|
||||||
%patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66
|
%patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68
|
||||||
#chmod 755 scripts/find-supplements{,.ksyms}
|
#chmod 755 scripts/find-supplements{,.ksyms}
|
||||||
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
|
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
|
||||||
#chmod 755 scripts/firmware.prov
|
#chmod 755 scripts/firmware.prov
|
||||||
|
Loading…
Reference in New Issue
Block a user