@@ -1026,6 +1026,20 @@ int alpm_db_set_usage(alpm_db_t *db, int usage);
*/
int alpm_db_get_usage(alpm_db_t *db, int *usage);
+
+/** Sets the expiry time of a database.
+ * @param db pointer to the package database to set the status for
+ * @param expiry number of days old a database can be before expiry
+ * @return 0 on success, or -1 on error
+ */
+int alpm_db_set_expiry(alpm_db_t *db, int expiry);
+
+/** Gets the expiry time of a database.
+ * @param db pointer to the package database to get the status of
+ * @return expiry time
+ */
+int alpm_db_get_expiry(alpm_db_t *db);
+
/** @} */
/** @addtogroup alpm_api_packages Package Functions
@@ -325,6 +325,20 @@ int SYMEXPORT alpm_db_get_usage(alpm_db_t *db, int *usage)
return 0;
}
+/** Sets the expiry time for a repo */
+int SYMEXPORT alpm_db_set_expiry(alpm_db_t *db, int expiry)
+{
+ ASSERT(db != NULL, return -1);
+ db->expiry = expiry;
+ return 0;
+}
+
+/** Gets the expiry time for a repo */
+int SYMEXPORT alpm_db_get_expiry(alpm_db_t *db)
+{
+ ASSERT(db != NULL, return -1);
+ return db->expiry;
+}
/** @} */
@@ -79,6 +79,8 @@ struct __alpm_db_t {
int siglevel;
/* alpm_db_usage_t */
int usage;
+
+ int expiry;
};
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/alpm.h | 14 ++++++++++++++ lib/libalpm/db.c | 14 ++++++++++++++ lib/libalpm/db.h | 2 ++ 3 files changed, 30 insertions(+)