Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jul 2010 19:55:36 GMT
From:      Ivan Voras <ivoras@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 180561 for review
Message-ID:  <201007061955.o66Jtall055366@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180561?ac=10

Change 180561 by ivoras@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);
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007061955.o66Jtall055366>