Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefetch-npm-deps: fix reproducibility #214454

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ npmConfigHook() {
exit 1
fi

export CACHE_MAP_PATH="$TMP/MEOW"
@prefetchNpmDeps@ --map-cache

@prefetchNpmDeps@ --fixup-lockfile "$srcLockfile"

local cachePath
Expand Down Expand Up @@ -109,6 +112,9 @@ npmConfigHook() {

patchShebangs node_modules

rm "$CACHE_MAP_PATH"
unset CACHE_MAP_PATH

echo "Finished npmConfigHook"
}

Expand Down
30 changes: 30 additions & 0 deletions pkgs/build-support/node/fetch-npm-deps/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkgs/build-support/node/fetch-npm-deps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ sha2 = "0.10.6"
tempfile = "3.3.0"
ureq = { version = "2.5.0" }
url = { version = "2.3.1", features = ["serde"] }
walkdir = "2.3.2"
30 changes: 15 additions & 15 deletions pkgs/build-support/node/fetch-npm-deps/src/cacache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use digest::{Digest, Update};
use serde::Serialize;
use serde::{Deserialize, Serialize};
use sha1::Sha1;
use sha2::{Sha256, Sha512};
use std::{
Expand All @@ -9,24 +9,24 @@ use std::{
};
use url::Url;

#[derive(Serialize)]
struct Key {
key: String,
integrity: String,
time: u8,
size: usize,
metadata: Metadata,
#[derive(Serialize, Deserialize)]
pub(super) struct Key {
pub(super) key: String,
pub(super) integrity: String,
pub(super) time: u8,
pub(super) size: usize,
pub(super) metadata: Metadata,
}

#[derive(Serialize)]
struct Metadata {
url: Url,
options: Options,
#[derive(Serialize, Deserialize)]
pub(super) struct Metadata {
pub(super) url: Url,
pub(super) options: Options,
}

#[derive(Serialize)]
struct Options {
compress: bool,
#[derive(Serialize, Deserialize)]
pub(super) struct Options {
pub(super) compress: bool,
}

pub struct Cache(PathBuf);
Expand Down
Loading