summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_sync.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_sync.c
parentef32aa0219146866b7f7e55c95afc327819dd6cf (diff)
downloadpacman-feb9889f22639c214606dcb387af6d0a51ea5e85.tar.xz
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_sync.c')
-rw-r--r--lib/libalpm/be_sync.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 414a9f37..e1c76638 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -345,8 +345,17 @@ int _alpm_sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entry
STRDUP(linedup, _alpm_strtrim(line), goto error);
pkg->replaces = alpm_list_add(pkg->replaces, linedup);
}
+ } else if(strcmp(line, "%EPOCH%") == 0) {
+ if(_alpm_archive_fgets(line, sizeof(line), archive) == NULL) {
+ goto error;
+ }
+ pkg->epoch = atoi(_alpm_strtrim(line));
} else if(strcmp(line, "%FORCE%") == 0) {
- pkg->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(!pkg->epoch) {
+ pkg->epoch = 1;
+ }
}
}
} else if(strcmp(filename, "depends") == 0) {