Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-08 08:39:23 -0500
committerDan McGee <dan@archlinux.org>2010-10-13 23:29:26 -0500
commitfeb9889f22639c214606dcb387af6d0a51ea5e85 (patch)
treec9bcf8b4316b587caab12b4acb68f45a559fe273 /lib/libalpm/be_local.c
parentef32aa0219146866b7f7e55c95afc327819dd6cf (diff)
Add epoch support to pacman/libalpm
This will allow for better control of what was previously the 'force' option in a PKGBUILD and transferred into the built package. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 76a14df3..22127520 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -157,10 +157,10 @@ alpm_list_t *_cache_get_groups(pmpkg_t *pkg)
return pkg->groups;
}
-int _cache_has_force(pmpkg_t *pkg)
+int _cache_get_epoch(pmpkg_t *pkg)
{
LAZY_LOAD(INFRQ_DESC, -1);
- return pkg->force;
+ return pkg->epoch;
}
alpm_list_t *_cache_get_depends(pmpkg_t *pkg)
@@ -301,7 +301,7 @@ static struct pkg_operations local_pkg_ops = {
.get_size = _cache_get_size,
.get_isize = _cache_get_isize,
.get_reason = _cache_get_reason,
- .has_force = _cache_has_force,
+ .get_epoch = _cache_get_epoch,
.get_licenses = _cache_get_licenses,
.get_groups = _cache_get_groups,
.get_depends = _cache_get_depends,
@@ -603,8 +603,17 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->replaces = alpm_list_add(info->replaces, linedup);
}
+ } else if(strcmp(line, "%EPOCH%") == 0) {
+ if(fgets(line, sizeof(line), fp) == NULL) {
+ goto error;
+ }
+ info->epoch = atoi(_alpm_strtrim(line));
} else if(strcmp(line, "%FORCE%") == 0) {
- info->force = 1;
+ /* For backward compatibility, treat force as a non-zero epoch
+ * but only if we didn't already have a known epoch value. */
+ if(!info->epoch) {
+ info->epoch = 1;
+ }
}
}
fclose(fp);
@@ -779,8 +788,9 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
}
fprintf(fp, "\n");
}
- if(info->force) {
- fprintf(fp, "%%FORCE%%\n\n");
+ if(info->epoch) {
+ fprintf(fp, "%%EPOCH%%\n"
+ "%d\n\n", info->epoch);
}
if(info->url) {
fprintf(fp, "%%URL%%\n"