summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-02-15 22:51:28 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-02-15 22:51:28 +0000
commit6e76fd8af3113a28280077ba3da016c01a760ba2 (patch)
tree5c818cd1736168a7e4ace2d50d8180a3584bae6f /lib/libalpm/alpm.c
parent2e128d3a41602b2e5c2f793b685175decce1bac0 (diff)
downloadpacman-6e76fd8af3113a28280077ba3da016c01a760ba2.tar.xz
- merged db_open and db_create into one single function
- moved the .lastupdate support to the frontend
Diffstat (limited to 'lib/libalpm/alpm.c')
-rw-r--r--lib/libalpm/alpm.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 788e504c..5a071c32 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -187,17 +187,9 @@ pmdb_t *alpm_db_register(char *treename)
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
}
- db = db_open(handle->root, handle->dbpath, treename);
+ db = db_open(handle->root, handle->dbpath, treename, DB_O_CREATE);
if(db == NULL) {
- /* couldn't open the db directory - try creating it */
- if(db_create(handle->root, handle->dbpath, treename) == -1) {
- RET_ERR(PM_ERR_DB_CREATE, NULL);
- }
- db = db_open(handle->root, handle->dbpath, treename);
- if(db == NULL) {
- /* couldn't open the db directory */
- RET_ERR(PM_ERR_DB_OPEN, NULL);
- }
+ RET_ERR(PM_ERR_DB_OPEN, NULL);
}
if(strcmp(treename, "local") == 0) {
@@ -270,7 +262,6 @@ void *alpm_db_getinfo(PM_DB *db, unsigned char parm)
switch(parm) {
case PM_DB_TREENAME: data = db->treename; break;
- case PM_DB_LASTUPDATE: data = db->lastupdate; break;
default:
data = NULL;
}
@@ -284,7 +275,7 @@ void *alpm_db_getinfo(PM_DB *db, unsigned char parm)
* @param ts timestamp of the last modification time of the tarball
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_db_update(PM_DB *db, char *archive, char *ts)
+int alpm_db_update(PM_DB *db, char *archive)
{
PMList *lp;
@@ -298,12 +289,6 @@ int alpm_db_update(PM_DB *db, char *archive, char *ts)
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
- if(ts && strlen(ts) != 0) {
- if(strcmp(ts, db->lastupdate) == 0) {
- RET_ERR(PM_ERR_DB_UPTODATE, -1);
- }
- }
-
/* remove the old dir */
_alpm_log(PM_LOG_FLOW2, "flushing database %s/%s", handle->dbpath, db->treename);
for(lp = db_get_pkgcache(db); lp; lp = lp->next) {
@@ -328,12 +313,6 @@ int alpm_db_update(PM_DB *db, char *archive, char *ts)
RET_ERR(PM_ERR_SYSTEM, -1);
}
- if(ts && strlen(ts) != 0) {
- if(db_setlastupdate(db, ts) == -1) {
- RET_ERR(PM_ERR_SYSTEM, -1);
- }
- }
-
return(0);
}