Skip to content

Commit 42d2c11

Browse files
committed
feat: copy verified patch assets into bundles
1 parent 456d72f commit 42d2c11

15 files changed

Lines changed: 301 additions & 8 deletions

‎Cargo.lock‎

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ serde_yaml = "0.9"
3939
toml = "0.9"
4040
cyclonedx-bom = "0.8"
4141
fs2 = "0.4"
42+
sha2 = "0.11"
4243

4344
[dev-dependencies]
4445
tempfile = "3"

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ general_packages = ["ASPHERE", "KSPACE", "MOLECULE"]
138138
[[build.patches]]
139139
filename = "Orbit-2.0-portability.patch"
140140
sha256 = "4f43b42fdcf84d0cf634d993dd944f252c8243dc612a919fe2825d56f937c8eb"
141+
source = "patches/Orbit-2.0-portability.patch"
141142

142143
[[dependencies.requirements]]
143144
name = "VTK"
@@ -147,7 +148,8 @@ roles = ["run"]
147148
Easyconfig parameters are typed data, not Python fragments. Requirements
148149
enter the canonical manifest and CycloneDX SBOM before Resolvo selects a
149150
version. Package planning requires every source and patch SHA-256; emitted
150-
checksums remain positional with sources first and patches second.
151+
checksums remain positional with sources first and patches second. Verified
152+
patch assets are copied beside every emitted recipe.
151153

152154
```sh
153155
eb-stack package plan \

‎docs/orgmode/howto/new-package.org‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ patches:
140140
[[build.patches]]
141141
filename = "Orbit-2.0-portability.patch"
142142
sha256 = "4f43b42fdcf84d0cf634d993dd944f252c8243dc612a919fe2825d56f937c8eb"
143+
source = "patches/Orbit-2.0-portability.patch"
143144
#+end_src
144145

145146
~package inspect~ records a blocking ~patch:missing-sha256~ residual for an
146147
unchecked patch. ~package plan~ refuses to emit a buildable bundle until every
147-
source and patch checksum is present.
148+
source and patch checksum is present. Relative patch sources resolve against
149+
the package TOML file, and ~package plan~ copies verified patch bytes beside
150+
the emitted easyconfig.
148151

149152
A QMCPACK profile set commonly contains a default MPI+OpenMP build and a
150153
separate ~-complex~ recipe:

‎examples/packages/lammps.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ moduleclass = "chem"
2020
[[build.patches]]
2121
filename = "LAMMPS-22Jul2025_install_lammps_python_package_in_eb_software_module.patch"
2222
sha256 = "0cab0fa4dc8b2c68b45cd9df4398b9c2c37d69dcd1dc054aacb44f78698a2c84"
23+
source = "patches/lammps/LAMMPS-22Jul2025_install_lammps_python_package_in_eb_software_module.patch"
2324

2425
[[build.patches]]
2526
filename = "LAMMPS-2Aug2023_python_venv.patch"
2627
sha256 = "87fd13b0c66f0886877885412ff13dfd092782e2237ba1fae157f803437828d6"
28+
source = "patches/lammps/LAMMPS-2Aug2023_python_venv.patch"
2729

2830
[[build.patches]]
2931
filename = "LAMMPS-22Jul2025_update4_DihedralStyle.patch"
3032
sha256 = "c265db38195f8830a36d5cde409d2ded1f8e9c47275eb29f0458e113d66f90f7"
33+
source = "patches/lammps/LAMMPS-22Jul2025_update4_DihedralStyle.patch"
3134

3235
# Inputs implemented by the selected EasyBuild easyblock are typed data, not
3336
# Python snippets. Profile layers can override individual parameters.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Add option in install.py to install lammps python packages in a configurable location
2+
diff --git a/python/install.py b/python/install.py
3+
index 352225e49d..ee9f2be068 100644
4+
--- a/python/install.py
5+
+++ b/python/install.py
6+
@@ -29,6 +29,8 @@ parser.add_argument("-v", "--versionfile", required=True,
7+
help="path to the LAMMPS version.h source file")
8+
parser.add_argument("-f", "--force", action="store_true", required=False, default=False,
9+
help="force installation of LAMMPS Python package")
10+
+parser.add_argument("-i", "--installdir", required=True,
11+
+ help= "path to site-packages in lammps module")
12+
13+
args = parser.parse_args()
14+
15+
@@ -72,6 +74,14 @@ if args.versionfile:
16+
else:
17+
args.versionfile = os.path.abspath(args.versionfile)
18+
19+
+if args.installdir:
20+
+ if not os.path.exists(args.installdir):
21+
+ print("\nERROR: LAMMPS site-packages file at %s does not exist\n" % args.installdir)
22+
+ parser.print_help()
23+
+ sys.exit(1)
24+
+ else:
25+
+ args.installdir = os.path.abspath(args.installdir)
26+
+
27+
olddir = os.path.abspath('.')
28+
pythondir = os.path.abspath(os.path.join(args.package,'..'))
29+
os.putenv('LAMMPS_VERSION_FILE',os.path.abspath(args.versionfile))
30+
@@ -146,6 +156,12 @@ else:
31+
print("Installing wheel into system site-packages folder")
32+
py_exe = sys.executable
33+
34+
+try:
35+
+ txt = subprocess.check_output([py_exe, '-m', 'pip', 'install', '--force-reinstall', wheel, '--target', args.installdir], stderr=subprocess.STDOUT, shell=False)
36+
+ print(txt)
37+
+ sys.exit(0)
38+
+except subprocess.CalledProcessError as err:
39+
+ sys.exit(err.output.decode('UTF-8'))
40+
try:
41+
if args.force:
42+
txt = subprocess.check_output([py_exe, '-m', 'pip', 'install', '--force-reinstall', '--break-system-packages', wheel], stderr=subprocess.STDOUT, shell=False)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Patch to relax the original epsilon of 1.0e-13 to 1.3e-13 to get the test jobs working
2+
See: https://docs.lammps.org/Build_development.html#unit-tests-for-force-styles
3+
Author: J. Saßmannshausen (Imperial College London/UK)
4+
diff --git a/lammps-stable_22Jul2025_update4.orig/unittest/force-styles/tests/dihedral-table_spline.yaml b/lammps-stable_22Jul2025_update4/unittest/force-styles/tests/dihedral-table_spline.yaml
5+
index 10e56e4..43dabec 100644
6+
--- a/lammps-stable_22Jul2025_update4.orig/unittest/force-styles/tests/dihedral-table_spline.yaml
7+
+++ b/lammps-stable_22Jul2025_update4/unittest/force-styles/tests/dihedral-table_spline.yaml
8+
@@ -1,7 +1,7 @@
9+
---
10+
lammps_version: 22 Dec 2022
11+
date_generated: Mon Dec 26 16:49:37 2022
12+
-epsilon: 1.0e-13
13+
+epsilon: 1.3e-13
14+
skip_tests:
15+
prerequisites: ! |
16+
atom full
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Patch Python installation to ensure system packages are used and not updated.
2+
diff --git a/python/install.py b/python/install.py
3+
index fd9f95f1bf..42f404224a 100644
4+
--- a/python/install.py
5+
+++ b/python/install.py
6+
@@ -97,7 +97,7 @@ shutil.copy(args.lib,'lammps')
7+
# create a virtual environment for building the wheel
8+
shutil.rmtree('buildwheel', True)
9+
try:
10+
- txt = subprocess.check_output([sys.executable, '-m', 'venv', 'buildwheel'], stderr=subprocess.STDOUT, shell=False)
11+
+ txt = subprocess.check_output([sys.executable, '-m', 'venv', '--system-site-packages', 'buildwheel'], stderr=subprocess.STDOUT, shell=False)
12+
print(txt.decode('UTF-8'))
13+
except subprocess.CalledProcessError as err:
14+
sys.exit("Failed to create a virtual environment: {0}".format(err.output.decode('UTF-8')))
15+
diff --git a/python/makewheel.py b/python/makewheel.py
16+
index f13ad110ce..014756ddbd 100644
17+
--- a/python/makewheel.py
18+
+++ b/python/makewheel.py
19+
@@ -23,8 +23,8 @@ sys.real_prefix = sys.prefix
20+
sys.prefix = base
21+
22+
# update pip and install all requirements to build the wheel
23+
-os.system('python -m pip install --upgrade pip')
24+
-os.system('python -m pip install --upgrade -r wheel_requirements.txt')
25+
+os.system('python -m pip install pip')
26+
+os.system('python -m pip install -r wheel_requirements.txt')
27+
28+
print("Building new binary wheel")
29+
os.system('python -m build -n --wheel -o .')

‎skills/new-package/SKILL.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ Declare patches as checked artifacts:
6161
[[build.patches]]
6262
filename = "Package-1.0-portability.patch"
6363
sha256 = "4f43b42fdcf84d0cf634d993dd944f252c8243dc612a919fe2825d56f937c8eb"
64+
source = "patches/Package-1.0-portability.patch"
6465
```
6566

6667
`package plan` rejects missing or malformed patch checksums. Checksum order in
6768
the emitted easyconfig is all source artifacts followed by all patch artifacts.
69+
Relative sources resolve against the package TOML, and verified patch bytes are
70+
copied beside the emitted easyconfig.
6871

6972
Create one product profile per independently installable variant. Each profile emits one `.eb` file.
7073

‎src/manifest.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ pub fn package_plan_from_foreign(recipe: &ForeignRecipe, toolchain: &Toolchain)
158158
.map(|filename| PatchArtifact {
159159
filename: filename.clone(),
160160
sha256: None,
161+
source: None,
162+
resolved_source: None,
161163
})
162164
.collect(),
163165
easyconfig_parameters: BTreeMap::new(),

0 commit comments

Comments
 (0)