PERFORCE change 180561 for review
Ivan Voras
ivoras at FreeBSD.org
Tue Jul 6 19:55:36 UTC 2010
http://p4web.freebsd.org/@@180561?ac=10
Change 180561 by ivoras at betelgeuse on 2010/07/06 19:55:12
Record patch creation timestamps to the PKGPATCHINDEX
Affected files ...
.. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#22 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#12 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#12 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#21 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#21 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/main.c#22 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#20 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#20 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#5 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#4 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#20 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/support.c#19 edit
Differences ...
==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#22 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#12 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#12 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#21 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#21 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#22 (text+ko) ====
@@ -54,7 +54,7 @@
printf("usage:\n");
printf("\t%s -c [-b] package_file_1 package_file_2 patch_file\n", argv[0]);
printf("\t%s -a patch_file\n", argv[0]);
- printf("\t%s -m package_dir_1 package_dir_2 patch_dir\n", argv[0]);
+ printf("\t%s -m [-b] package_dir_1 package_dir_2 patch_dir\n", argv[0]);
}
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#20 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#20 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#5 (text+ko) ====
@@ -97,8 +97,8 @@
if (Verbose > 2)
printf("\t(%s -> %s via %s)\n", pold, pnew, ppatch);
perform_mkpatch(pold, pnew, ppatch);
- fprintf(fpl, "@havepatch %s-%s %s-%s %s\n", basename, version1,
- basename, version2, pname);
+ fprintf(fpl, "@havepatch %s-%s %s-%s %s %s\n", basename,
+ version1, basename, version2, pname, time_to_iso8601(-1));
}
fclose(fpl);
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#4 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#20 (text+ko) ====
@@ -138,5 +138,7 @@
int replicate_dirtree(char *from, char *to);
void read_pkgpatch_file(char *filename, struct pkg_patch *pp);
unsigned int pplist_count(struct pplist_head *ppl);
+char *time_to_iso8601(time_t t);
+time_t iso8601_to_time(char *t);
#endif
==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#19 (text+ko) ====
@@ -568,3 +568,36 @@
}
+/*
+ * Converts "zulu time" time_t value to iso8601 datetime. Not thread-safe.
+ * Accepts -1 for time, to mean "current" time.
+ */
+char *
+time_to_iso8601(time_t t)
+{
+ static char stm[25];
+ struct tm *tptr;
+
+ if (t == -1) {
+ struct timeval tp;
+
+ gettimeofday(&tp, NULL);
+ t = tp.tv_sec;
+ }
+
+ tptr = gmtime(&t);
+ strftime(stm, 25, "%FT%TZ", tptr);
+ return stm;
+}
+
+
+/* Converts given iso8601 datetime string to time_t. */
+time_t
+iso8601_to_time(char *t)
+{
+ struct tm tms;
+
+ if (strptime(t, "%FT%T%Z", &tms) != NULL)
+ return (0);
+ return timegm(&tms);
+}
More information about the p4-projects
mailing list