File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
build/scripts/phar-set-timestamps Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change 1010
1111if (is_string (getenv ('SOURCE_DATE_EPOCH ' ))) {
1212 $ epoch = (int ) getenv ('SOURCE_DATE_EPOCH ' );
13+
14+ printf (
15+ 'Setting timestamp of files in PHAR to %d (based on environment variable SOURCE_DATE_EPOCH) ' . PHP_EOL ,
16+ $ epoch
17+ );
1318} else {
14- $ epoch = (int ) trim (shell_exec ('git log -1 --format=%at ' . trim (shell_exec ('git describe --abbrev=0 ' ))));
19+ $ tag = shell_exec ('git describe --abbrev=0 ' );
20+
21+ if (is_string ($ tag ) && strpos ($ tag , 'fatal ' ) === false ) {
22+ $ tmp = shell_exec ('git log -1 --format=%at ' . trim ($ tag ));
23+
24+ if (is_string ($ tag ) && is_numeric (trim ($ tmp ))) {
25+ $ epoch = (int ) trim ($ tmp );
26+
27+ printf (
28+ 'Setting timestamp of files in PHAR to %d (based on when tag %s was created) ' . PHP_EOL ,
29+ $ epoch ,
30+ trim ($ tag )
31+ );
32+ }
33+
34+ unset($ tmp );
35+ }
36+
37+ unset($ tag );
38+ }
39+
40+ if (!isset ($ epoch )) {
41+ $ epoch = time ();
42+
43+ printf (
44+ 'Setting timestamp of files in PHAR to %d (based on current time) ' . PHP_EOL ,
45+ $ epoch
46+ );
1547}
1648
1749$ timestamp = new DateTime ;
You can’t perform that action at this time.
0 commit comments