core: Set mtime of content objects to 0
This is necessary to satisfy tools such as guile and python, which compare mtimes to determine whether or not source files need to be compiled. https://bugzilla.gnome.org/show_bug.cgi?id=720363
This commit is contained in:
parent
38a286f157
commit
fe5ed36461
|
|
@ -100,6 +100,7 @@ commit_loose_object_trusted (OstreeRepo *self,
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int res;
|
int res;
|
||||||
|
struct timespec times[2];
|
||||||
|
|
||||||
g_assert (temp_out != NULL);
|
g_assert (temp_out != NULL);
|
||||||
|
|
||||||
|
|
@ -134,6 +135,23 @@ commit_loose_object_trusted (OstreeRepo *self,
|
||||||
if (!gs_fd_set_all_xattrs (fd, xattrs, cancellable, error))
|
if (!gs_fd_set_all_xattrs (fd, xattrs, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* To satisfy tools such as guile which compare mtimes
|
||||||
|
* to determine whether or not source files need to be compiled,
|
||||||
|
* set the modification time to 0.
|
||||||
|
*/
|
||||||
|
times[0].tv_sec = 0; /* atime */
|
||||||
|
times[0].tv_nsec = UTIME_OMIT;
|
||||||
|
times[1].tv_sec = 0; /* mtime */
|
||||||
|
times[1].tv_nsec = 0;
|
||||||
|
do
|
||||||
|
res = futimens (fd, times);
|
||||||
|
while (G_UNLIKELY (res == -1 && errno == EINTR));
|
||||||
|
if (G_UNLIKELY (res == -1))
|
||||||
|
{
|
||||||
|
ot_util_set_error_from_errno (error, errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that in case of a power cut, these files have the data we
|
/* Ensure that in case of a power cut, these files have the data we
|
||||||
|
|
|
||||||
|
|
@ -310,3 +310,10 @@ ${CMD_PREFIX} ostree --repo=repo remote show-url aremote > aremote-url.txt
|
||||||
assert_file_has_content aremote-url.txt 'http.*remote\.example\.com/repo'
|
assert_file_has_content aremote-url.txt 'http.*remote\.example\.com/repo'
|
||||||
echo "ok remote show-url"
|
echo "ok remote show-url"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
rm -rf test2-checkout
|
||||||
|
$OSTREE checkout test2 test2-checkout
|
||||||
|
stat '--format=%Y' test2-checkout/baz/cow > cow-mtime
|
||||||
|
assert_file_has_content cow-mtime 0
|
||||||
|
echo "ok content mtime"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue