-
Notifications
You must be signed in to change notification settings - Fork 15
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
PQ code package update script #323
Closed
+114
−0
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
994d816
PQ code package update script
jschneider-bensch ba86fed
Merge branch 'dev' into jonas/pqcp-update-script
jschneider-bensch db5f99c
Include feature flags
jschneider-bensch ac48735
Merge branch 'dev' into jonas/pqcp-update-script
franziskuskiefer 8a3e39b
Include libcrux rev in PQCA commit message
jschneider-bensch 7136678
Merge branch 'main' into jonas/pqcp-update-script
jschneider-bensch 4f6d0e9
add git submodule and start readme
franziskuskiefer a3187a3
updated script and pqcp repo
franziskuskiefer b31719b
re-add pqcp udpate script
franziskuskiefer 6fc41d8
Merge branch 'jonas/pqcp-update-script' of github.com:cryspen/libcrux…
jschneider-bensch 594d374
Clean up update script
jschneider-bensch 610ed84
Delete static `Cargo.toml`
jschneider-bensch f28ddd7
Include python script for generating `Cargo.toml`
jschneider-bensch fc88801
Merge branch 'main' into jonas/pqcp-update-script
jschneider-bensch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "libcrux-ml-kem/pqcp/repo"] | ||
path = libcrux-ml-kem/pqcp/repo | ||
url = [email protected]:pq-code-package/mlkem-rust-libcrux.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# (TODO customize .gitignore for project) | ||
|
||
.vscode | ||
.idea | ||
/target | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# PQCP | ||
|
||
## Submodule | ||
|
||
## Updating | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build.rs | ||
examples | ||
src | ||
tests | ||
benches | ||
pqcp/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import tomlkit | ||
import os | ||
import sys | ||
|
||
libcrux_root = sys.argv[1] | ||
workspace_toml_path = os.path.join(libcrux_root, 'Cargo.toml') | ||
crate_toml_path = os.path.join(libcrux_root, 'libcrux-ml-kem/Cargo.toml') | ||
package_toml_path = os.path.join(libcrux_root, 'libcrux-ml-kem/pqcp/repo/Cargo.toml') | ||
|
||
with open(workspace_toml_path, 'r') as workspace_toml_f: | ||
with open(crate_toml_path, 'r') as crate_toml_f: | ||
workspace_toml = tomlkit.parse(workspace_toml_f.read()) | ||
crate_toml = tomlkit.parse(crate_toml_f.read()) | ||
|
||
package_toml = tomlkit.document() | ||
|
||
package = tomlkit.table() | ||
package["name"] = crate_toml["package"]["name"] | ||
package["description"] = crate_toml["package"]["description"] | ||
package["readme"] = crate_toml["package"]["readme"] | ||
package["version"] = workspace_toml["workspace"]["package"]["version"] | ||
package["authors"] = workspace_toml["workspace"]["package"]["authors"] | ||
package["license"] = workspace_toml["workspace"]["package"]["license"] | ||
package["edition"] = workspace_toml["workspace"]["package"]["edition"] | ||
package["repository"] = workspace_toml["workspace"]["package"]["repository"] | ||
package_toml["package"] = package | ||
|
||
|
||
package_toml["workspace"] = tomlkit.table() | ||
package_toml["workspace"]["members"] = ["."] | ||
|
||
|
||
deps = tomlkit.table() | ||
for dep in crate_toml["dependencies"]: | ||
deps[dep] = {"version": crate_toml["dependencies"][dep]["version"]} | ||
package_toml["dependencies"] = deps | ||
package_toml["features"] = crate_toml["features"] | ||
package_toml["dev-dependencies"] = crate_toml["dev-dependencies"] | ||
|
||
package_toml["profile"] = tomlkit.table() | ||
package_toml["profile"]["release"] = workspace_toml["profile"]["release"] | ||
|
||
with open(package_toml_path, 'w') as package_toml_f: | ||
package_toml_f.write(tomlkit.dumps(package_toml)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script copies files to be included in the `mlkem-rust-libcrux` | ||
# crate for the PQ code package. Files and directories to be copied | ||
# are listed, one per line, in a file at `ALLOWLIST` and copied to the | ||
# PQCP submodule. The copied files include a custom .gitignore file | ||
# for mlkem-rust-libcrux. On successful completion of `cargo test`, a | ||
# signed-off commit is created in the target repository. | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
if [ -z "$(which pip)" ] | ||
then | ||
echo "Error: Python (>= 3.7) required to run this script." | ||
fi | ||
|
||
if [ -z "$(pip list | grep tomlkit)" ] | ||
then | ||
echo "Error: Pythong package tomlkit required to run this script." | ||
echo "To install it using pip, run" | ||
echo "" | ||
echo " pip install tomlkit" | ||
echo "" | ||
exit 1 | ||
fi | ||
|
||
libcrux_root="$(git rev-parse --show-toplevel)" | ||
libcrux_ml_kem_crate="$libcrux_root/libcrux-ml-kem" | ||
allowlist="$libcrux_ml_kem_crate/pqcp/allowlist.txt" | ||
pqcp_repo="$libcrux_ml_kem_crate/pqcp/repo" | ||
|
||
cd "$libcrux_ml_kem_crate" | ||
while read -r item; do | ||
cp -r "$item" "$pqcp_repo" | ||
done < "$allowlist" | ||
|
||
python "$libcrux_ml_kem_crate/pqcp/cargo.py" "$libcrux_root" | ||
|
||
cd "$pqcp_repo" | ||
cargo test | ||
cargo clean | ||
|
||
message="$(printf "mlkem-rust-libcrux PQ code packages update\n\n$(date): libcrux revision $(git -C $libcrux_root rev-parse HEAD)")" | ||
git switch -c "libcrux-ml-kem-$(git -C $libcrux_root rev-parse HEAD)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This moved the libcrux repo over to this revision. Something doesn't seem quite right here. |
||
git add . | ||
git commit -sm "$message" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python
doesn't exist on many systems. You probably wantpython3
.