Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-11-16 16:54:30 +1000
committerDan McGee <dan@archlinux.org>2010-12-12 20:30:05 -0600
commite22aa23c8f5adb0fd4b7ccbee480a4906ede0346 (patch)
treef55fd3e631e186c914b358930e3e30b29cdb69cb /lib
parent3f0d98c124db1547d6595762bd2d125b4350b861 (diff)
Add configuration option to control disk space checking
Disk space checking is likely to be an unnecessary bottleneck to people with reasonable partition sizes so add a configuration option to allow it to be disabled/enabled as wanted. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.h3
-rw-r--r--lib/libalpm/handle.c14
-rw-r--r--lib/libalpm/handle.h1
-rw-r--r--lib/libalpm/sync.c10
4 files changed, 24 insertions, 4 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 4d0ca501..2879f560 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -155,6 +155,9 @@ void alpm_option_set_arch(const char *arch);
int alpm_option_get_usedelta();
void alpm_option_set_usedelta(int usedelta);
+int alpm_option_get_checkspace();
+void alpm_option_set_checkspace(int checkspace);
+
pmdb_t *alpm_option_get_localdb();
alpm_list_t *alpm_option_get_syncdbs();
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index aa34cf45..ffa5dd67 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -232,6 +232,15 @@ int SYMEXPORT alpm_option_get_usedelta()
return handle->usedelta;
}
+int SYMEXPORT alpm_option_get_checkspace()
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return -1;
+ }
+ return handle->checkspace;
+}
+
pmdb_t SYMEXPORT *alpm_option_get_localdb()
{
if (handle == NULL) {
@@ -550,4 +559,9 @@ void SYMEXPORT alpm_option_set_usedelta(int usedelta)
handle->usedelta = usedelta;
}
+void SYMEXPORT alpm_option_set_checkspace(int checkspace)
+{
+ handle->checkspace = checkspace;
+}
+
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index 1834994e..46414b95 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -60,6 +60,7 @@ typedef struct _pmhandle_t {
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
char *arch; /* Architecture of packages we should allow */
int usedelta; /* Download deltas if possible */
+ int checkspace; /* Check disk space before installing */
} pmhandle_t;
/* global handle variable */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 23476b8d..14f14621 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -998,10 +998,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
}
/* check available disk space */
- _alpm_log(PM_LOG_DEBUG, "checking available disk space\n");
- if(_alpm_check_diskspace(trans, handle->db_local) == -1) {
- _alpm_log(PM_LOG_ERROR, _("not enough free disk space\n"));
- goto error;
+ if(handle->checkspace) {
+ _alpm_log(PM_LOG_DEBUG, "checking available disk space\n");
+ if(_alpm_check_diskspace(trans, handle->db_local) == -1) {
+ _alpm_log(PM_LOG_ERROR, _("not enough free disk space\n"));
+ goto error;
+ }
}
/* remove conflicting and to-be-replaced packages */