Skip to content

feat: prototype additional hash #3140

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -301,7 +301,7 @@ jobs:

build-binary-windows-aarch64:
needs: determine_changes
if: ${{ needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main' }}
if: ${{ needs.determine_changes.outputs.code == 'true' && github.ref == 'refs/heads/main' }} # Only run on the main branch
runs-on: 16core_windows_latest_runner
name: "build binary | windows aarch64"
steps:
Original file line number Diff line number Diff line change
@@ -107,6 +107,7 @@ impl Protocol {
})
.collect::<miette::Result<_>>()?,
input_globs: None,
additional_hash: None,
};

Ok(metadata)
6 changes: 6 additions & 0 deletions crates/pixi_build_types/src/procedures/conda_metadata.rs
Original file line number Diff line number Diff line change
@@ -52,4 +52,10 @@ pub struct CondaMetadataResult {
/// If this field is not present, the input manifest will be used.
#[serde(default)]
pub input_globs: Option<Vec<String>>,

/// Additional information that will be added to the hash of the lock-file.
/// This can be extra information (like a JSON string), or an arbitrary hash
/// that the backend produces in order to break the cache when needed.
#[serde(default)]
pub additional_hash: Option<String>,
}
4 changes: 4 additions & 0 deletions crates/pixi_record/src/source_record.rs
Original file line number Diff line number Diff line change
@@ -34,6 +34,8 @@ pub struct InputHash {
)]
pub hash: Sha256Hash,
pub globs: Vec<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<String>
}

impl From<SourceRecord> for CondaPackageData {
@@ -59,6 +61,8 @@ impl TryFrom<CondaSourceData> for SourceRecord {
input_hash: value.input.map(|hash| InputHash {
hash: hash.hash,
globs: hash.globs,
// TODO?
extra_data: None,
}),
})
}
11 changes: 11 additions & 0 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
@@ -687,9 +687,20 @@ impl BuildContext {
globs: input_globs.clone(),
})
.await?;

// Add in extra data to the glob hash
if let Some(extra_data) = &metadata.additional_hash {
// let mut hasher = Xxh3::with_seed(0);
// input_hash.hash(&mut hasher);
// extra_data.hash(&mut hasher);
print!("extra_data: {}", extra_data);
// input_hash = hasher.finish();
};

Some(InputHash {
hash: input_hash.hash,
globs: input_globs,
extra_data: metadata.additional_hash,
})
};