Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl2/groff/dist/src/roff Add --timestamp for reprod...



details:   https://anonhg.NetBSD.org/src/rev/cd9f15c48beb
branches:  trunk
changeset: 973023:cd9f15c48beb
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 16 00:47:21 2020 +0000

description:
Add --timestamp for reproducible builds.

diffstat:

 external/gpl2/groff/dist/src/roff/groff/groff.cpp |   8 ++++++--
 external/gpl2/groff/dist/src/roff/troff/input.cpp |  18 +++++++++++++++---
 2 files changed, 21 insertions(+), 5 deletions(-)

diffs (93 lines):

diff -r 413dd9b4d940 -r cd9f15c48beb external/gpl2/groff/dist/src/roff/groff/groff.cpp
--- a/external/gpl2/groff/dist/src/roff/groff/groff.cpp Tue Jun 16 00:45:56 2020 +0000
+++ b/external/gpl2/groff/dist/src/roff/groff/groff.cpp Tue Jun 16 00:47:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: groff.cpp,v 1.1.1.1 2016/01/13 18:41:48 christos Exp $ */
+/*     $NetBSD: groff.cpp,v 1.2 2020/06/16 00:47:21 christos Exp $     */
 
 // -*- C++ -*-
 /* Copyright (C) 1989-2000, 2001, 2002, 2003, 2004
@@ -126,11 +126,12 @@
   commands[TROFF_INDEX].set_name(command_prefix, "troff");
   static const struct option long_options[] = {
     { "help", no_argument, 0, 'h' },
+    { "timestamp", required_argument, 0, 'Y' },
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
   while ((opt = getopt_long(argc, argv,
-                           "abcCd:eEf:F:gGhiI:lL:m:M:n:No:pP:r:RsStT:UvVw:W:XzZ",
+                           "abcCd:eEf:F:gGhiI:lL:m:M:n:No:pP:r:RsStT:UvVw:W:XY:zZ",
                            long_options, NULL))
         != EOF) {
     char buf[3];
@@ -281,6 +282,9 @@
       usage(stderr);
       exit(1);
       break;
+    case 'Y':
+      commands[TROFF_INDEX].append_arg(buf, optarg);
+      break;
     default:
       assert(0);
       break;
diff -r 413dd9b4d940 -r cd9f15c48beb external/gpl2/groff/dist/src/roff/troff/input.cpp
--- a/external/gpl2/groff/dist/src/roff/troff/input.cpp Tue Jun 16 00:45:56 2020 +0000
+++ b/external/gpl2/groff/dist/src/roff/troff/input.cpp Tue Jun 16 00:47:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: input.cpp,v 1.4 2016/10/08 23:40:52 joerg Exp $        */
+/*     $NetBSD: input.cpp,v 1.5 2020/06/16 00:47:21 christos Exp $     */
 
 // -*- C++ -*-
 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005
@@ -7242,6 +7242,14 @@
 "       -rcn -Tname -Fdir -Idir -Mdir [files...]\n",
          prog);
 }
+ 
+static
+#ifdef LONG_FOR_TIME_T
+long
+#else /* not LONG_FOR_TIME_T */
+time_t
+#endif /* not LONG_FOR_TIME_T */
+timestamp;
 
 int main(int argc, char **argv)
 {
@@ -7273,6 +7281,7 @@
   }
   static const struct option long_options[] = {
     { "help", no_argument, 0, CHAR_MAX + 1 },
+    { "timestamp", required_argument, 0, 'Y' },
     { "version", no_argument, 0, 'v' },
     { 0, 0, 0, 0 }
   };
@@ -7280,7 +7289,7 @@
 #define DEBUG_OPTION "D"
 #endif
   while ((c = getopt_long(argc, argv,
-                         "abciI:vw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RU"
+                         "abciI:vw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RUY:"
                          DEBUG_OPTION, long_options, 0))
         != EOF)
     switch(c) {
@@ -7383,6 +7392,9 @@
       usage(stdout, argv[0]);
       exit(0);
       break;
+    case 'Y': // --timestamp
+      timestamp = strtoul(optarg, NULL, 0);
+      break;
     case '?':
       usage(stderr, argv[0]);
       exit(1);
@@ -7485,7 +7497,7 @@
 #else /* not LONG_FOR_TIME_T */
   time_t
 #endif /* not LONG_FOR_TIME_T */
-    t = time(0);
+    t = timestamp ? timestamp : time(0);
   // Use struct here to work around misfeature in old versions of g++.
   struct tm *tt = localtime(&t);
   set_number_reg("seconds", int(tt->tm_sec));



Home | Main Index | Thread Index | Old Index