Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix utime in the new repo.
Vsevolod Stakhov committed 13 years ago
commit f932e38facf91cd51765c67de8b04faa23daaac9
parent 674018d
1 file changed +22 -0
modified libpkg/pkg_repo.c
@@ -532,6 +532,7 @@ pkg_finish_repo(char *path, pem_password_cb *password_cb, char *rsa_key_path)
{
	char repo_path[MAXPATHLEN + 1];
	char repo_archive[MAXPATHLEN + 1];
+
	struct stat st;
	
	if (!is_dir(path)) {
	    pkg_emit_error("%s is not a directory", path);
@@ -562,5 +563,26 @@ pkg_finish_repo(char *path, pem_password_cb *password_cb, char *rsa_key_path)
			rsa_key_path, password_cb) != EPKG_OK)
		return (EPKG_FATAL);

+
	/* Now we need to set the equal mtime for all archives in the repo */
+
	snprintf(repo_archive, sizeof(repo_archive), "%s/%s.txz", path, repo_db_archive);
+
	if (stat(repo_archive, &st) == 0) {
+
		struct timeval ftimes[2] = {
+
			{
+
			.tv_sec = st.st_mtime,
+
			.tv_usec = 0
+
			},
+
			{
+
			.tv_sec = st.st_mtime,
+
			.tv_usec = 0
+
			}
+
		};
+
		snprintf(repo_archive, sizeof(repo_archive), "%s/%s.txz", path, repo_packagesite_archive);
+
		utimes(repo_archive, ftimes);
+
		snprintf(repo_archive, sizeof(repo_archive), "%s/%s.txz", path, repo_digests_archive);
+
		utimes(repo_archive, ftimes);
+
		snprintf(repo_archive, sizeof(repo_archive), "%s/%s.txz", path, repo_filesite_archive);
+
		utimes(repo_archive, ftimes);
+
	}
+

	return (EPKG_OK);
}