diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-09-19 00:21:56 -0500 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-09-28 00:25:57 -0500 |
commit | 47622eef4dd8fd86a0aa0e3ebdb7b33f7c9d6804 (patch) | |
tree | 4fb65c38ad6a8c8fb4577977d78b07b891be3a2f /lib/libalpm/package.c | |
parent | 219808714f94788a66a430786c552f60e95b1a01 (diff) | |
download | pacman-47622eef4dd8fd86a0aa0e3ebdb7b33f7c9d6804.tar.xz |
Support for localized times in metadata
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.
In the case of removal of text time support, this code will fail gracefully,
returning the start of the epoch for broken packages.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r-- | lib/libalpm/package.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 96c264ac..26157edd 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -236,13 +236,13 @@ const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg) return pkg->url; } -const char SYMEXPORT *alpm_pkg_get_builddate(pmpkg_t *pkg) +time_t SYMEXPORT alpm_pkg_get_builddate(pmpkg_t *pkg) { ALPM_LOG_FUNC; /* Sanity checks */ - ASSERT(handle != NULL, return(NULL)); - ASSERT(pkg != NULL, return(NULL)); + ASSERT(handle != NULL, return(0)); + ASSERT(pkg != NULL, return(0)); if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) { _alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC); @@ -250,13 +250,13 @@ const char SYMEXPORT *alpm_pkg_get_builddate(pmpkg_t *pkg) return pkg->builddate; } -const char SYMEXPORT *alpm_pkg_get_installdate(pmpkg_t *pkg) +time_t SYMEXPORT alpm_pkg_get_installdate(pmpkg_t *pkg) { ALPM_LOG_FUNC; /* Sanity checks */ - ASSERT(handle != NULL, return(NULL)); - ASSERT(pkg != NULL, return(NULL)); + ASSERT(handle != NULL, return(0)); + ASSERT(pkg != NULL, return(0)); if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) { _alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC); @@ -840,7 +840,9 @@ static int parse_descfile(const char *descfile, pmpkg_t *info) } else if(!strcmp(key, "license")) { info->licenses = alpm_list_add(info->licenses, strdup(ptr)); } else if(!strcmp(key, "builddate")) { - strncpy(info->builddate, ptr, sizeof(info->builddate)); + info->builddate = atol(ptr); + } else if(!strcmp(key, "installdate")) { + info->installdate = atol(ptr); } else if(!strcmp(key, "packager")) { strncpy(info->packager, ptr, sizeof(info->packager)); } else if(!strcmp(key, "arch")) { |