summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-02 13:17:26 -0400
committerDan McGee <dan@archlinux.org>2007-06-02 13:17:26 -0400
commited13ac2cc8dd15d8a19d769cc77941ad18ac1a7c (patch)
treeb20ca34955ce27277638b26a99c6284d8729b004 /lib/libalpm
parentfe2c58fc9211dfc1d50c145397b947325abd1bdc (diff)
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>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c7
-rw-r--r--lib/libalpm/sync.c11
-rw-r--r--lib/libalpm/trans.c79
-rw-r--r--lib/libalpm/trans.h3
4 files changed, 0 insertions, 100 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ecc1142c..efcfedd4 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -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);
}
-#ifndef __sun__
- if(_alpm_check_freespace(trans, data) == -1) {
- /* pm_errno is set by check_freespace */
- return(-1);
- }
-#endif
-
return(0);
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 5b573b72..2178d1bd 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -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);*/
}
-#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:
alpm_list_free(list);
alpm_list_free(trail);
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 2637197c..3c6a0c3d 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -540,85 +540,6 @@ cleanup:
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()
{
/* Sanity checks */
diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h
index eb152a04..f3575895 100644
--- a/lib/libalpm/trans.h
+++ b/lib/libalpm/trans.h
@@ -82,9 +82,6 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg);
int _alpm_runscriptlet(const char *root, const char *installfn,
const char *script, const char *ver,
const char *oldver, pmtrans_t *trans);
-#ifndef __sun__
-int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data);
-#endif
#endif /* _ALPM_TRANS_H */