summaryrefslogtreecommitdiff
path: root/src/fetch.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-11-09 12:47:23 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-11-09 12:51:01 +0200
commitcce4cff55310cddb2e2ec61d19b758e52a4e2c97 (patch)
treede2735305369fc75caee961485a6d44bc2782ce5 /src/fetch.c
parent7501f6012fc06ebfa8c6d8f928f38318267abe72 (diff)
downloadapk-tools-cce4cff55310cddb2e2ec61d19b758e52a4e2c97.tar.gz
apk-tools-cce4cff55310cddb2e2ec61d19b758e52a4e2c97.tar.bz2
apk-tools-cce4cff55310cddb2e2ec61d19b758e52a4e2c97.tar.xz
apk-tools-cce4cff55310cddb2e2ec61d19b758e52a4e2c97.zip
io, database: preserve [am]time for cached and fetched files
preserve [am]time for all packages and indexes. this fixes the caching error that 'apk update' is after new index is generated, but before the used mirror is synchronized. this caused local apkindex timestamp to be newer than file in mirror, when in fact it was outdated index. this also fixes fetched files to have build timestamp so that files going to .iso or custom images have proper timestamps (rsync with appropriate --modify-window now works)
Diffstat (limited to 'src/fetch.c')
-rw-r--r--src/fetch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 43e4dbf..3bb7934 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -175,9 +175,13 @@ static int fetch_package(apk_hash_item item, void *pctx)
}
r = apk_istream_splice(is, fd, pkg->size, progress_cb, ctx);
- is->close(is);
- if (fd != STDOUT_FILENO)
+ if (fd != STDOUT_FILENO) {
+ struct apk_file_meta meta;
+ is->get_meta(is, &meta);
+ apk_file_meta_to_fd(fd, &meta);
close(fd);
+ }
+ is->close(is);
if (r != pkg->size) {
unlinkat(ctx->outdir_fd, filename, 0);