diff options
author | Timo Teräs <timo.teras@iki.fi> | 2015-11-09 12:47:23 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2015-11-09 12:51:01 +0200 |
commit | cce4cff55310cddb2e2ec61d19b758e52a4e2c97 (patch) | |
tree | de2735305369fc75caee961485a6d44bc2782ce5 /src/archive.c | |
parent | 7501f6012fc06ebfa8c6d8f928f38318267abe72 (diff) | |
download | apk-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/archive.c')
-rw-r--r-- | src/archive.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/archive.c b/src/archive.c index e58f6d5..ecb276a 100644 --- a/src/archive.c +++ b/src/archive.c @@ -84,8 +84,19 @@ struct apk_tar_entry_istream { size_t bytes_left; EVP_MD_CTX mdctx; struct apk_checksum *csum; + time_t mtime; }; +static void tar_entry_get_meta(void *stream, struct apk_file_meta *meta) +{ + struct apk_tar_entry_istream *teis = + container_of(stream, struct apk_tar_entry_istream, is); + *meta = (struct apk_file_meta) { + .atime = teis->mtime, + .mtime = teis->mtime, + }; +} + static ssize_t tar_entry_read(void *stream, void *ptr, size_t size) { struct apk_tar_entry_istream *teis = @@ -175,6 +186,7 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser, { struct apk_file_info entry; struct apk_tar_entry_istream teis = { + .is.get_meta = tar_entry_get_meta, .is.read = tar_entry_read, .is.close = tar_entry_close, .tar_is = is, @@ -213,6 +225,7 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser, buf.mode[0] = 0; /* to nul terminate 100-byte buf.name */ buf.magic[0] = 0; /* to nul terminate 100-byte buf.linkname */ teis.csum = NULL; + teis.mtime = entry.mtime; apk_xattr_array_resize(&entry.xattrs, 0); if (paxlen) { |