From cce4cff55310cddb2e2ec61d19b758e52a4e2c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 9 Nov 2015 12:47:23 +0200 Subject: 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) --- src/fetch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/fetch.c') 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); -- cgit v1.2.3