From 72c24395762c985e404f65f7ec1064efed1d44b5 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Sun, 20 Mar 2005 09:22:03 +0000 Subject: Added support for .lastupdate files (from pacman 2.9.1) --- lib/libalpm/alpm.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/alpm.c') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 94c8d2dc..93ac2fad 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -205,17 +205,31 @@ int alpm_db_unregister(PM_DB *db) return(0); } -int alpm_db_update(char *treename, char *archive) +int alpm_db_getlastupdate(PM_DB *db, char *ts) { /* Sanity checks */ - ASSERT(handle != NULL, return(-1)); - ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + + return(db_getlastupdate(db, handle->root, handle->dbpath, ts)); +} + +int alpm_db_update(PM_DB *db, char *archive, char *ts) +{ + /* Sanity checks */ + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + + /* ORE + Does it make sense to update the 'local' database, or should we prevent it? */ + + /* ORE + check if the database is registered: if not, return an error */ /* ORE - Does it make sense to update the 'local' database, or should we prevent it? - stat(archive); */ + stat() the archive to check it exists */ - return(db_update(handle->root, handle->dbpath, treename, archive)); + return(db_update(db, handle->root, handle->dbpath, archive, ts)); } PM_PKG *alpm_db_readpkg(PM_DB *db, char *name) -- cgit v1.2.3