Reproducible `.zip` files (#14623)

* Create `.zip` files deterministically

Our build system now creates `.zip` archives deterministically.
Previously the `.zip` file would differ between builds even when the
files being archived were identical. This was because the order the
files were passed in was non-deterministic, and the `mtime` for each
file was different between builds.

The files are now sorted before being zipped, and the `mtime` for each
file has been set to the unix epoch.

* Update lavamoat build policy
feature/default_network_editable
Mark Stacey 3 years ago
parent 7199d9c567
commit 3693de7947
  1. 5
      development/build/etc.js
  2. 28
      lavamoat/build-system/policy.json
  3. 3
      package.json
  4. 82
      yarn.lock

@ -1,5 +1,6 @@
const { promises: fs } = require('fs');
const gulp = require('gulp');
const sort = require('gulp-sort');
const gulpZip = require('gulp-zip');
const del = require('del');
const pify = require('pify');
@ -45,7 +46,9 @@ function createZipTask(platform, buildType, version) {
: `metamask-${buildType}-${platform}-${version}`;
await pump(
gulp.src(`dist/${platform}/**`),
gulpZip(`${path}.zip`),
// sort files and set `mtime` to epoch to ensure zip build is deterministic
sort(),
gulpZip(`${path}.zip`, { modifiedTime: new Date(0) }),
gulp.dest('builds'),
);
};

@ -1087,21 +1087,11 @@
"ansi-wrap": true
}
},
"ansi-cyan": {
"packages": {
"ansi-wrap": true
}
},
"ansi-gray": {
"packages": {
"ansi-wrap": true
}
},
"ansi-red": {
"packages": {
"ansi-wrap": true
}
},
"ansi-styles": {
"packages": {
"color-convert": true
@ -1130,8 +1120,7 @@
},
"arr-diff": {
"packages": {
"arr-flatten": true,
"array-slice": true
"arr-flatten": true
}
},
"arr-filter": {
@ -2273,8 +2262,7 @@
"extend-shallow": {
"packages": {
"assign-symbols": true,
"is-extendable": true,
"kind-of": true
"is-extendable": true
}
},
"extglob": {
@ -2540,10 +2528,14 @@
},
"get-stream": {
"builtin": {
"buffer.constants.MAX_LENGTH": true,
"stream.PassThrough": true
},
"globals": {
"Buffer.concat": true
},
"packages": {
"pump": true
}
},
"glob": {
@ -2796,6 +2788,11 @@
"vinyl-sourcemaps-apply": true
}
},
"gulp-sort": {
"packages": {
"through2": true
}
},
"gulp-sourcemaps": {
"builtin": {
"path.dirname": true,
@ -2874,6 +2871,7 @@
},
"gulp-zip": {
"builtin": {
"buffer.constants.MAX_LENGTH": true,
"path.join": true
},
"packages": {
@ -3864,8 +3862,6 @@
},
"packages": {
"ansi-colors": true,
"ansi-cyan": true,
"ansi-red": true,
"arr-diff": true,
"arr-union": true,
"extend-shallow": true

@ -319,10 +319,11 @@
"gulp-livereload": "4.0.0",
"gulp-rename": "^2.0.0",
"gulp-rtlcss": "^1.4.0",
"gulp-sort": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-stylelint": "^13.0.0",
"gulp-watch": "^5.0.1",
"gulp-zip": "^4.0.0",
"gulp-zip": "^5.1.0",
"history": "^5.0.0",
"improved-yarn-audit": "^3.0.0",
"jest": "^26.6.3",

@ -5621,13 +5621,6 @@ ansi-colors@^4.1.1:
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==
ansi-cyan@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873"
integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=
dependencies:
ansi-wrap "0.1.0"
ansi-escapes@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
@ -5657,13 +5650,6 @@ ansi-html@0.0.7, ansi-html@^0.0.7:
resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e"
integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4=
ansi-red@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c"
integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=
dependencies:
ansi-wrap "0.1.0"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@ -5827,14 +5813,6 @@ arity-n@^1.0.4:
resolved "https://registry.yarnpkg.com/arity-n/-/arity-n-1.0.4.tgz#d9e76b11733e08569c0847ae7b39b2860b30b745"
integrity sha1-2edrEXM+CFacCEeuezmyhgswt0U=
arr-diff@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a"
integrity sha1-aHwydYFjWI/vfeezb6vklesaOZo=
dependencies:
arr-flatten "^1.0.1"
array-slice "^0.2.3"
arr-diff@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
@ -5866,11 +5844,6 @@ arr-map@^2.0.0, arr-map@^2.0.2:
dependencies:
make-iterator "^1.0.0"
arr-union@^2.0.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d"
integrity sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=
arr-union@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
@ -5932,11 +5905,6 @@ array-last@^1.1.1:
dependencies:
is-number "^4.0.0"
array-slice@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5"
integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU=
array-slice@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-1.1.0.tgz#e368ea15f89bc7069f7ffb89aec3a6c7d4ac22d4"
@ -12053,13 +12021,6 @@ express@^4.14.0, express@^4.17.1:
utils-merge "1.0.1"
vary "~1.1.2"
extend-shallow@^1.1.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071"
integrity sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=
dependencies:
kind-of "^1.1.0"
extend-shallow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@ -13167,7 +13128,7 @@ get-stream@^4.0.0, get-stream@^4.1.0:
dependencies:
pump "^3.0.0"
get-stream@^5.0.0, get-stream@^5.1.0:
get-stream@^5.0.0, get-stream@^5.1.0, get-stream@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==
@ -13748,6 +13709,13 @@ gulp-rtlcss@^1.4.0:
through2 "^2.0.5"
vinyl-sourcemaps-apply "^0.2.1"
gulp-sort@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/gulp-sort/-/gulp-sort-2.0.0.tgz#c6762a2f1f0de0a3fc595a21599d3fac8dba1aca"
integrity sha1-xnYqLx8N4KP8WVohWZ0/rI26Gso=
dependencies:
through2 "^2.0.1"
gulp-sourcemaps@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-3.0.0.tgz#2e154e1a2efed033c0e48013969e6f30337b2743"
@ -13795,16 +13763,16 @@ gulp-watch@^5.0.1:
vinyl "^2.1.0"
vinyl-file "^2.0.0"
gulp-zip@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/gulp-zip/-/gulp-zip-4.1.0.tgz#dab178bd99afa190923f1eb78abaf0db47817704"
integrity sha1-2rF4vZmvoZCSPx63irrw20eBdwQ=
gulp-zip@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/gulp-zip/-/gulp-zip-5.1.0.tgz#38cc1d4c61bc2ab06b452ce463cbe2adc52b935e"
integrity sha512-XZr/y91IliK/SpR74g3TkZejGkGEmK7CSDjSghT1jXshgO+dFvpLIz9w9fpuwkew6i7k4F+G24TubNgq1ISzEw==
dependencies:
get-stream "^3.0.0"
plugin-error "^0.1.2"
through2 "^2.0.1"
get-stream "^5.2.0"
plugin-error "^1.0.1"
through2 "^3.0.1"
vinyl "^2.1.0"
yazl "^2.1.0"
yazl "^2.5.1"
gulp@^4.0.2:
version "4.0.2"
@ -17102,11 +17070,6 @@ keyv@^3.0.0:
dependencies:
json-buffer "3.0.0"
kind-of@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44"
integrity sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=
kind-of@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-2.0.1.tgz#018ec7a4ce7e3a86cb9141be519d24c8faa981b5"
@ -21562,17 +21525,6 @@ plugin-error@1.0.1, plugin-error@^1.0.1:
arr-union "^3.1.0"
extend-shallow "^3.0.2"
plugin-error@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace"
integrity sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=
dependencies:
ansi-cyan "^0.1.1"
ansi-red "^0.1.1"
arr-diff "^1.0.1"
arr-union "^2.0.1"
extend-shallow "^1.1.2"
pluralize@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45"
@ -28463,7 +28415,7 @@ yauzl@2.10.0, yauzl@^2.10.0:
buffer-crc32 "~0.2.3"
fd-slicer "~1.1.0"
yazl@^2.1.0:
yazl@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35"
integrity sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==

Loading…
Cancel
Save