Switch back to mtime==0 for ostree checkouts

OSTree upstream changed back from mtime 1
tingping/wmclass
Alexander Larsson 2016-09-09 09:22:56 +02:00
parent cd3cccf136
commit 6689c5c7f1
3 changed files with 17 additions and 17 deletions

View File

@ -305,7 +305,7 @@ builder_cache_checkout (BuilderCache *self, const char *commit, GError **error)
return FALSE;
/* There is a bug in ostree (https://github.com/ostreedev/ostree/issues/326) that
causes it to not reset mtime to 1 in this case (mismatching modes). So
causes it to not reset mtime to 0 in this case (mismatching modes). So
we do that manually */
if (!flatpak_zero_mtime (AT_FDCWD, flatpak_file_get_path_cached (self->app_dir),
NULL, error))
@ -418,7 +418,7 @@ builder_cache_commit (BuilderCache *self,
g_print ("Committing stage %s to cache\n", self->stage);
/* We set all mtimes to 1 during a commit, to simulate what would happen when
/* We set all mtimes to 0 during a commit, to simulate what would happen when
running via flatpak deploy (and also if we checked out from the cache). */
if (!flatpak_zero_mtime (AT_FDCWD, flatpak_file_get_path_cached (self->app_dir),
NULL, NULL))

View File

@ -1065,29 +1065,29 @@ fixup_python_timestamp (int dfd,
* There are several possible cases wrt their mtimes:
*
* py not existing: pyc is stale, remove it
* pyc mtime == 1: (.pyc is from an old commited module)
* py mtime == 1: Do nothing, already correct
* py mtime != 1: The py changed in this module, remove pyc
* pyc mtime != 1: (.pyc changed this module, or was never rewritten in base layer)
* py == 1: Shouldn't happen in flatpak-builder, but could be an un-rewritten ctime lower layer, assume it matches and update timestamp
* pyc mtime == 0: (.pyc is from an old commited module)
* py mtime == 0: Do nothing, already correct
* py mtime != 0: The py changed in this module, remove pyc
* pyc mtime != 0: (.pyc changed this module, or was never rewritten in base layer)
* py == 0: Shouldn't happen in flatpak-builder, but could be an un-rewritten ctime lower layer, assume it matches and update timestamp
* py mtime != pyc mtime: new pyc doesn't match last py written in this module, remove it
* py mtime == pyc mtime: These match, but the py will be set to mtime 1 by ostree, so update timestamp in pyc.
* py mtime == pyc mtime: These match, but the py will be set to mtime 0 by ostree, so update timestamp in pyc.
*/
if (fstatat (dfd_iter.fd, py_path, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
{
remove_pyc = TRUE;
}
else if (pyc_mtime == 1)
else if (pyc_mtime == OSTREE_TIMESTAMP)
{
if (stbuf.st_mtime == 1)
if (stbuf.st_mtime == OSTREE_TIMESTAMP)
continue; /* Previously handled pyc */
remove_pyc = TRUE;
}
else /* pyc_mtime != 1 */
else /* pyc_mtime != 0 */
{
if (pyc_mtime != stbuf.st_mtime && stbuf.st_mtime != 1)
if (pyc_mtime != stbuf.st_mtime && stbuf.st_mtime != OSTREE_TIMESTAMP)
remove_pyc = TRUE;
/* else change mtime */
}
@ -1101,8 +1101,8 @@ fixup_python_timestamp (int dfd,
continue;
}
/* Change to mtime 1 which is what ostree uses for checkouts */
buffer[4] = 1;
/* Change to mtime 0 which is what ostree uses for checkouts */
buffer[4] = OSTREE_TIMESTAMP;
buffer[5] = buffer[6] = buffer[7] = 0;
res = pwrite (fd, buffer, 8, 0);

View File

@ -1729,10 +1729,10 @@ flatpak_zero_mtime (int parent_dfd,
}
}
/* OSTree checks out to mtime 1, so we do the same */
if (stbuf.st_mtime != 1)
/* OSTree checks out to mtime 0, so we do the same */
if (stbuf.st_mtime != OSTREE_TIMESTAMP)
{
const struct timespec times[2] = { { 0, UTIME_OMIT }, { 1, } };
const struct timespec times[2] = { { 0, UTIME_OMIT }, { OSTREE_TIMESTAMP, } };
if (TEMP_FAILURE_RETRY (utimensat (parent_dfd, rel_path, times, AT_SYMLINK_NOFOLLOW)) != 0)
{