repo: use OSTREE_TIMESTAMP (=1) for checked-out files

1 is a better choice than 0 because some programs use 0
as a special value; for example, GNU Tar warns of an
"implausibly old timestamp" with 0.

Closes: #330
Approved by: cgwalters
This commit is contained in:
Mathnerd314 authored and Atomic Bot committed 2016-06-09 18:04:55 +00:00
1 parent f94b191ae5
commit 0e9a875393
7 files changed
+35 -13

No files matched your search

+2 -2
View File
@@ -752,12 +752,12 @@ checkout_tree_at (OstreeRepo *self,
}
}
/* Set directory mtime to 0, so that it is constant for all checkouts.
/* Set directory mtime to OSTREE_TIMESTAMP, so that it is constant for all checkouts.
* Must be done after setting permissions and creating all children.
*/
if (!did_exist)
{
const struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, } };
const struct timespec times[2] = { { OSTREE_TIMESTAMP, UTIME_OMIT }, { OSTREE_TIMESTAMP, 0} };
do
res = futimens (destination_dfd, times);
while (G_UNLIKELY (res == -1 && errno == EINTR));
+2 -6
View File
@@ -210,7 +210,6 @@ commit_loose_object_trusted (OstreeRepo *self,
else
{
int res;
struct timespec times[2];
if (objtype == OSTREE_OBJECT_TYPE_FILE && self->mode == OSTREE_REPO_MODE_BARE)
{
@@ -266,12 +265,9 @@ commit_loose_object_trusted (OstreeRepo *self,
{
/* 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.
* set the modification time to OSTREE_TIMESTAMP.
*/
times[0].tv_sec = 0; /* atime */
times[0].tv_nsec = UTIME_OMIT;
times[1].tv_sec = 0; /* mtime */
times[1].tv_nsec = 0;
const struct timespec times[2] = { { OSTREE_TIMESTAMP, UTIME_OMIT }, { OSTREE_TIMESTAMP, 0} };
do
res = futimens (fd, times);
while (G_UNLIKELY (res == -1 && errno == EINTR));
+3 -3
View File
@@ -982,9 +982,9 @@ file_to_archive_entry_common (GFile *root,
}
archive_entry_update_pathname_utf8 (entry, pathstr);
archive_entry_set_ctime (entry, ts, 0);
archive_entry_set_mtime (entry, ts, 0);
archive_entry_set_atime (entry, ts, 0);
archive_entry_set_ctime (entry, ts, OSTREE_TIMESTAMP);
archive_entry_set_mtime (entry, ts, OSTREE_TIMESTAMP);
archive_entry_set_atime (entry, ts, OSTREE_TIMESTAMP);
archive_entry_set_uid (entry, g_file_info_get_attribute_uint32 (file_info, "unix::uid"));
archive_entry_set_gid (entry, g_file_info_get_attribute_uint32 (file_info, "unix::gid"));
archive_entry_set_mode (entry, g_file_info_get_attribute_uint32 (file_info, "unix::mode"));
+2
View File
@@ -36,6 +36,8 @@ G_BEGIN_DECLS
#define _OSTREE_SUMMARY_CACHE_DIR "summaries"
#define _OSTREE_CACHE_DIR "cache"
#define OSTREE_TIMESTAMP (1)
typedef enum {
OSTREE_REPO_TEST_ERROR_PRE_COMMIT = (1 << 0)
} OstreeRepoTestErrorFlags;
+8
View File
@@ -942,6 +942,14 @@ ostree_repo_is_writable (OstreeRepo *self,
return self->writable;
}
/**
* _ostree_repo_update_mtime:
* @self: Repo
* @error: a #GError
*
* Bump the mtime of the repository so that programs
* can detect that the refs have updated.
*/
gboolean
_ostree_repo_update_mtime (OstreeRepo *self,
GError **error)