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

Bug#890734: texlive-metapost: mpost does not honour SOURCE_DATE_EPOCH



Am 31.07.2019 um 20:39 teilte Norbert Preining mit:

Hi Norbert,

> But hard-coded rewriting of the actual creating time is wrong. We
> need to do something similar to what pdftex/luatex/xetex/... does. If
> the variable is set it provides a datetime that should be used
> instead of the actual time.
> 
> You can look into the first patch by looking at the texlive-bin
> repository with
> 	git show c832647f4d1fe579fd4eb46ff8b505030b5124db
> 
OK, next offer attached. The SOURCE_DATE_EPOCH is now regarded and
verbatim copied into the "%%CreationDate:", when it is set.

1. I don't check content of SOURCE_DATE_EPOCH
2. Not sure if "%%CreationDate: 1265974891" is valid Postscript

If we need to convert that into human readable string anybody has to
implement it. Sorry, I'm not a C programmer.

H.
-- 
sigfault
#206401 http://counter.li.org
Index: texlive-bin/texk/web2c/mplibdir/psout.w
===================================================================
--- texlive-bin.orig/texk/web2c/mplibdir/psout.w	2019-07-31 23:59:05.712816442 +0200
+++ texlive-bin/texk/web2c/mplibdir/psout.w	2019-08-01 00:00:43.476816442 +0200
@@ -5035,6 +5035,7 @@
 void mp_print_initial_comment(MP mp,mp_edge_object *hh, int prologues) {
   int t; /* scaled */
   char *s;   
+  char *source_date_epoch;
   mp_ps_print(mp, "%!PS");
   if ( prologues>0 ) 
     mp_ps_print(mp, "-Adobe-3.0 EPSF-3.0");
@@ -5055,10 +5056,15 @@
     mp_ps_pair_out(mp, hh->minx,hh->miny);
     mp_ps_pair_out(mp, hh->maxx,hh->maxy);
   }
+  source_date_epoch = getenv("SOURCE_DATE_EPOCH");
   mp_ps_print_nl(mp, "%%Creator: MetaPost ");
   s = mp_metapost_version();
   mp_ps_print(mp, s);
   mp_xfree(s);
+  if(source_date_epoch) {
+  mp_ps_print_nl(mp, "%%CreationDate: ");
+  mp_ps_do_print(mp, source_date_epoch, strlen(source_date_epoch));
+  } else {
   mp_ps_print_nl(mp, "%%CreationDate: ");
   mp_ps_print_int(mp, round_unscaled(internal_value(mp_year))); 
   mp_ps_print_char(mp, '.');
@@ -5069,6 +5075,7 @@
   t = round_unscaled(internal_value(mp_time));
   mp_ps_print_dd(mp, t / 60); 
   mp_ps_print_dd(mp, t % 60);
+  }
   mp_ps_print_nl(mp, "%%Pages: 1");
 }
 

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: