Skip to content

Commit 45c292c

Browse files
Publish refs from spack-packages. clone_spack handle split repo
1 parent 5bead8b commit 45c292c

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

images/protected-publish/pkg/common.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616

1717
SPACK_REPO = "https://github.com/spack/spack"
18+
PACKAGES_REPO = "https://github.com/spack/spack-packages"
1819

1920
TIMESTAMP_AND_SIZE = r"^[\d]{4}-[\d]{2}-[\d]{2}\s[\d]{2}:[\d]{2}:[\d]{2}\s+\d+\s+"
2021
TIMESTAMP_PATTERN = "%Y-%m-%d %H:%M:%S"
@@ -188,12 +189,16 @@ def extract_json_from_clearsig(file_path):
188189
# clone the matching version of spack.
189190
#
190191
# Clones the version of spack specified by ref to the root of the file system
191-
def clone_spack(ref: str = "develop", repo: str = SPACK_REPO, clone_dir: str = "/"):
192+
def clone_spack(spack_ref: str = "develop", packages_ref: str = "develop", spack_repo: str = SPACK_REPO, packages_repo: str = PACKAGES_REPO, clone_dir: str = "/"):
192193
spack_path = f"{clone_dir}/spack"
194+
packages_path = f"{clone_dir}/spack-packages"
193195

194196
if os.path.isdir(spack_path):
195197
shutil.rmtree(spack_path)
196198

199+
if os.path.isdir(packages_path):
200+
shutil.rmtree(packages_path)
201+
197202
owd = os.getcwd()
198203

199204
try:
@@ -206,8 +211,35 @@ def clone_spack(ref: str = "develop", repo: str = SPACK_REPO, clone_dir: str = "
206211
"1",
207212
"--single-branch",
208213
"--branch",
209-
f"{ref}",
210-
f"{repo}",
214+
f"{spack_ref}",
215+
f"{spack_repo}",
216+
spack_path,
217+
],
218+
check=True,
219+
)
220+
subprocess.run(
221+
[
222+
"git",
223+
"clone",
224+
"--depth",
225+
"1",
226+
"--single-branch",
227+
"--branch",
228+
f"{packages_ref}",
229+
f"{packages_repo}",
230+
packages_path,
231+
],
232+
check=True,
233+
)
234+
# Configure the repo destination
235+
subprocess.run(
236+
[
237+
"spack/bin/spack",
238+
"repo",
239+
"set",
240+
"builtin",
241+
"--destination",
242+
packages_path,
211243
],
212244
check=True,
213245
)

images/protected-publish/pkg/publish.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,14 @@ def publish(
280280
print("Publishing complete")
281281

282282
# Clone spack version appropriate to what we're publishing
283-
clone_spack(ref, clone_dir=workdir)
283+
clone_spack(packages_ref=ref, clone_dir=workdir)
284284
spack_exe = f"{workdir}/spack/bin/spack"
285285

286286
# Can be useful for testing to clone a custom spack to somewhere other than "/"
287287
# clone_spack(
288-
# ref="content-addressable-tarballs-2",
289-
# repo="https://github.com/scottwittenburg/spack.git",
288+
# packages_ref=ref,
289+
# spack_ref="content-addressable-tarballs-2",
290+
# spack_repo="https://github.com/scottwittenburg/spack.git",
290291
# clone_dir=workdir,
291292
# )
292293
# spack_exe = f"{workdir}/spack/bin/spack"

0 commit comments

Comments
 (0)