[MacPorts] #59672: Set SOURCE_DATE_EPOCH

MacPorts noreply at macports.org
Sat Nov 7 06:28:39 UTC 2020


#59672: Set SOURCE_DATE_EPOCH
--------------------------+--------------------
  Reporter:  ryandesign   |      Owner:  (none)
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  base         |    Version:
Resolution:               |   Keywords:
      Port:               |
--------------------------+--------------------

Comment (by ryandesign):

 In the wordgrinder port I have implemented it this way:

 {{{
 post-extract {
     set latest 0
     fs-traverse i [list ${worksrcpath}] {
         if {[file isfile ${i}]} {
             set t [file mtime ${i}]
             if {${t} > ${latest}} {
                 set latest ${t}
             }
         }
     }
     set fp [open $env(TMPDIR)/SOURCE_DATE_EPOCH w]
     puts ${fp} ${latest}
     close ${fp}
 }
 }}}
 {{{
 pre-build {
     set fp [open $env(TMPDIR)/SOURCE_DATE_EPOCH r]
     set latest [read ${fp}]
     close ${fp}
     build.env-append \
                     SOURCE_DATE_EPOCH=${latest}
 }
 }}}

 The value needs to be determined right after extraction so that it is not
 affected by any changes made in the patch or configure phases and it needs
 to be saved to disk between phases in case the user is running the phases
 independently.

 Maybe something similar can be done in base. The base version should
 include error-checking code that skips setting the environment variable if
 the file doesn't exist. (Users might have existing work directories that
 don't have the file.)

-- 
Ticket URL: <https://trac.macports.org/ticket/59672#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list