Skip to content

Commit

Permalink
Pull request #100: Handle caching from remote repositories
Browse files Browse the repository at this point in the history
Merge in DEV/voyager from bugfix/HandleRemoteRepositoriesPart2 to master

* commit '2fa2c9b0b2c2e8cdc86891f5e5e6c6288849a19d':
  Update all version numbers to 1.17.2
  Fix identation.
  Simplify for loop.
  Remove unnecessary function. Send only one aql.
  Remove empty line.
  Remove unnecessary for loop.
  Fetch per arch.
  Only fetch cache if artifact doesnt exist.
  Cache the remote artifacts.
  • Loading branch information
Mohamed Kallouchi committed Dec 4, 2024
2 parents 8f8f832 + 2fa2c9b commit 2fc8e2a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deploy/Installer.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ###########################
#define Release "1.17.1"
#define Release "1.17.2"
// ###########################

#define AppName "voyager"
Expand Down
3 changes: 3 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release notes

### [1.17.2]
- Fix the caching issue for remote repositories

### [1.17.1]
- Fix version number in installer

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "voyager"
version = "1.17.1"
version = "1.17.2"
description = "Package manager for C/C++ software"
readme = "Readme.md"
requires-python = "==3.10.*"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 35 additions & 8 deletions voyager/artifactdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,37 @@ def _find_download_extract_package(self, repo, library, version, output_dir, ove
found = False
path = None
package_dir = ""
for arch in archs:
package_dir = f"{repo}/{library}/{version}/{arch}"
url = f"{self.config.artifactory_url}/{package_dir}/voyager_package.tgz"
path = ArtifactoryPath(url, session=self.artifactory_session)
available_arch = []

path = ArtifactoryPath(self.config.artifactory_url, session=self.artifactory_session)

if path.exists():
click.echo(click.style(f'{arch} @ {version} ', fg='bright_blue'), nl=False)
args = [
"items.find",
{
"$and": [
{"repo": {"$eq": repo}},
{"path": {"$match": f"{library}/{version}/*"}},
]
},
".transitive()"
]
artifacts_list = path.aql(*args)
artifacts_list = [entry for entry in artifacts_list if not entry['repo'].endswith('-cache')]

for i in artifacts_list:
available_arch.append(i['path'].split('/')[-1])

for arch in archs:
if arch in available_arch:
package_dir = f"{repo}/{library}/{version}/{arch}"
url = f"{self.config.artifactory_url}/{package_dir}/voyager_package.tgz"
path = ArtifactoryPath(url, session=self.artifactory_session)
if path.exists():
click.echo(click.style(f'{arch} @ {version} ', fg='bright_blue'), nl=False)
else:
click.echo(click.style(f'Artifact not found in cache, fetching: {repo}/{library}/{version}/{arch}', fg='yellow'))
if not path.open():
ValueError(f"Failed to cache at : {repo}/{library}/{version}/{arch}.")
found = True
break

Expand Down Expand Up @@ -307,7 +331,10 @@ def _get_active_archs(self):
archs = self.config.build_platform
else:
archs = self.config.host_platform
archs.append("Header")
archs.append("Source")

if "Header" not in archs:
archs.append("Header")
if "Source" not in archs:
archs.append("Source")

return archs
2 changes: 1 addition & 1 deletion voyager/voyager.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import voyager.doc as doc_server
import voyager.package_update as package_updater

VERSION = "1.17.1"
VERSION = "1.17.2"
SEARCH_RESULTS_FILE_NAME = Path("search_results.json")

@click.group()
Expand Down

0 comments on commit 2fc8e2a

Please sign in to comment.