Skip to content

Commit

Permalink
Merge branch 'master' into update/docker-client-8.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 authored Jul 30, 2024
2 parents 829e156 + 1d369b4 commit 4b54db9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package universal

import java.net.URI
import java.nio.file.{FileSystem, FileSystems, Files, StandardCopyOption}
import java.nio.file.attribute.FileTime
import java.util.zip.Deflater

import org.apache.commons.compress.archivers.zip._
Expand Down Expand Up @@ -122,9 +123,14 @@ object ZipHelper {
IO createDirectory outputDir
withZipOutput(outputFile) { output =>
for (FileMapping(file, name, mode) <- sources) {
val entry = new ZipArchiveEntry(file, normalizePath(name))
val entryName = {
val n = normalizePath(name)
if (file.isDirectory && !n.endsWith("/")) n + "/" else n
}
val entry = new ZipArchiveEntry(entryName)
sys.env.get("SOURCE_DATE_EPOCH") foreach { epoch =>
entry.setTime(epoch.toLong * 1000)
val millis = epoch.toLong * 1000
entry.setLastModifiedTime(FileTime.fromMillis(millis))
}
// Now check to see if we have permissions for this sucker.
mode foreach (entry.setUnixMode)
Expand Down

0 comments on commit 4b54db9

Please sign in to comment.