Remove freespace checking code
This code depends on /etc/mtab existance, which is not very reliable in all cases, especially in a chroot or non-Linux environment. Dump it for now until we can find a better way. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
fe2c58fc92
commit
ed13ac2cc8
4 changed files with 0 additions and 100 deletions
|
@ -274,13 +274,6 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||||
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __sun__
|
|
||||||
if(_alpm_check_freespace(trans, data) == -1) {
|
|
||||||
/* pm_errno is set by check_freespace */
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -753,17 +753,6 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
/*EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);*/
|
/*EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __sun__
|
|
||||||
/* check for free space only in case the packages will be extracted */
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_NOCONFLICTS)) {
|
|
||||||
if(_alpm_check_freespace(trans, data) == -1) {
|
|
||||||
/* pm_errno is set by check_freespace */
|
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
alpm_list_free(list);
|
alpm_list_free(list);
|
||||||
alpm_list_free(trail);
|
alpm_list_free(trail);
|
||||||
|
|
|
@ -540,85 +540,6 @@ cleanup:
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __sun__
|
|
||||||
static long long get_freespace()
|
|
||||||
{
|
|
||||||
struct mntent *mnt;
|
|
||||||
const char *table = MOUNTED;
|
|
||||||
FILE *fp;
|
|
||||||
long long ret=0;
|
|
||||||
|
|
||||||
if((fp = setmntent(table, "r")) == NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("cannot read disk space information from %s: %s"),
|
|
||||||
table, strerror(errno));
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((mnt = getmntent(fp)))
|
|
||||||
{
|
|
||||||
struct statvfs64 buf;
|
|
||||||
|
|
||||||
statvfs64(mnt->mnt_dir, &buf);
|
|
||||||
ret += buf.f_bavail * buf.f_bsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
endmntent(fp);
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data)
|
|
||||||
{
|
|
||||||
alpm_list_t *i;
|
|
||||||
long long pkgsize=0, freespace;
|
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
for(i = trans->packages; i; i = i->next) {
|
|
||||||
if(trans->type == PM_TRANS_TYPE_SYNC)
|
|
||||||
{
|
|
||||||
pmsyncpkg_t *sync = i->data;
|
|
||||||
if(sync->type != PM_SYNC_TYPE_REPLACE) {
|
|
||||||
pmpkg_t *pkg = sync->pkg;
|
|
||||||
pkgsize += alpm_pkg_get_isize(pkg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pmpkg_t *pkg = i->data;
|
|
||||||
pkgsize += alpm_pkg_get_size(pkg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
freespace = get_freespace();
|
|
||||||
_alpm_log(PM_LOG_DEBUG, _("check_freespace: total pkg size: %lld, disk space: %lld"), pkgsize, freespace);
|
|
||||||
if(pkgsize > freespace) {
|
|
||||||
if(data) {
|
|
||||||
long long *ptr;
|
|
||||||
if((ptr = malloc(sizeof(long long)))==NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
|
|
||||||
pm_errno = PM_ERR_MEMORY;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
*ptr = pkgsize;
|
|
||||||
*data = alpm_list_add(*data, ptr);
|
|
||||||
if((ptr = malloc(sizeof(long long)))==NULL) {
|
|
||||||
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
|
|
||||||
FREELIST(*data);
|
|
||||||
pm_errno = PM_ERR_MEMORY;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
*ptr = freespace;
|
|
||||||
*data = alpm_list_add(*data, ptr);
|
|
||||||
}
|
|
||||||
pm_errno = PM_ERR_DISK_FULL;
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pmtranstype_t SYMEXPORT alpm_trans_get_type()
|
pmtranstype_t SYMEXPORT alpm_trans_get_type()
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
|
|
|
@ -82,9 +82,6 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg);
|
||||||
int _alpm_runscriptlet(const char *root, const char *installfn,
|
int _alpm_runscriptlet(const char *root, const char *installfn,
|
||||||
const char *script, const char *ver,
|
const char *script, const char *ver,
|
||||||
const char *oldver, pmtrans_t *trans);
|
const char *oldver, pmtrans_t *trans);
|
||||||
#ifndef __sun__
|
|
||||||
int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _ALPM_TRANS_H */
|
#endif /* _ALPM_TRANS_H */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue