From e6f29e0d0e3244ffe24da4bfd29156ad993ff877 Mon Sep 17 00:00:00 2001 From: Carl Allendorph Date: Tue, 19 Dec 2023 11:24:08 -0800 Subject: [PATCH 1/2] [Bugfix] Fix the conan build to have consistent repo hash id. The problem was that we were pushing the built binary through the `export_sources` step. This was getting hashed and causing the repo hashs for windows, linux and mac to all be different. This caused problems in distribution through artifactory because I would never get the appropriate binary. --- README.md | 5 ++--- build_conan.ps1 | 2 ++ build_conan.sh | 16 ++++++++++++++++ conanfile.py | 13 ++++++++++--- 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 build_conan.ps1 create mode 100755 build_conan.sh diff --git a/README.md b/README.md index c525dcf..3a801de 100644 --- a/README.md +++ b/README.md @@ -114,9 +114,8 @@ To build the Conan2 package for binary distribution of `slm`: 2. Confirm: `conan profile show -pr default` 1. This will show the default configuration. 3. Run the conan build: - 1. `conan create . -s os="Macos" -s arch="x86_64"` - 2. You can replace os with `Windows` or `Linux` - 3. No Promises on `Windows` build working yet. + 1. Mac/Linux: `build_conan.sh` + 2. Windows: `build_conan.ps1` 4. Publish the package: 1. `conan remote add ` 1. You should only have to do this once. diff --git a/build_conan.ps1 b/build_conan.ps1 new file mode 100644 index 0000000..6d5a093 --- /dev/null +++ b/build_conan.ps1 @@ -0,0 +1,2 @@ +$env:SLM_ROOT_DIR = Get-Location +conan create . \ No newline at end of file diff --git a/build_conan.sh b/build_conan.sh new file mode 100755 index 0000000..d8e70bd --- /dev/null +++ b/build_conan.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Script to run the conan build and generate the required packages +# +# Current usage of Conan is kind of a hack. We're not having conan +# to run the `stanza build`. This means I have to get the binary +# to the package some how and Conan makes this more difficult than +# just copying it to a file. I don't get access to the `recipe_folder` +# after the `export_sources` function. But I can't copy the binary in +# `export_sources_folder` because anything in that directory gets hashed +# as part of the repository id. +# +# I must pass this directory as an environment variable +# so that each run of `conanfile.py` gets the same directory. +export SLM_ROOT_DIR=$(pwd) +conan create . \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 229c18e..81ab5af 100644 --- a/conanfile.py +++ b/conanfile.py @@ -12,6 +12,8 @@ from conan.tools.files import copy import tomllib +SLM_FOLDER = None + def get_slm_config(fp = "./slm.toml"): with open(fp, "rb") as f: data = tomllib.load(f) @@ -73,11 +75,16 @@ def copy_dist_files(self, src_dir, dst_dir): if len(success) != len(self.dist_files()): raise RuntimeError("Export: Failed to Copy Distribution Files") - def export_sources(self): - self.copy_dist_files(self.recipe_folder, self.export_sources_folder) + # def export_sources(self): + # # Anything copied to the export sources folder will + # # get hashed to create the repository id. We want this + # # to be consistent from OS to OS. + # TODO - When we get the `stanza build` running through conan + # We would copy sources here and then run the build. def build(self): - self.copy_dist_files(self.export_sources_folder, self.build_folder) + SLM_FOLDER = os.environ["SLM_ROOT_DIR"] + self.copy_dist_files(SLM_FOLDER, self.build_folder) def package(self): # Slight deviation here - I want the binary in the `bin` From 3d3e7fcb4faad8d7437f66dc3b908ce450658cd0 Mon Sep 17 00:00:00 2001 From: Carl Allendorph Date: Tue, 19 Dec 2023 11:29:33 -0800 Subject: [PATCH 2/2] [Bump] Increment the slm version --- slm.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slm.toml b/slm.toml index a7ccdd3..e46823f 100644 --- a/slm.toml +++ b/slm.toml @@ -1,5 +1,5 @@ name = "slm" -version = "0.4.0" +version = "0.4.1" [dependencies] stanza-toml = { git = "StanzaOrg/stanza-toml", version = "0.3.4" }