Skip to content
Snippets Groups Projects
Commit 7a36ccf1 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[mirror] Add support for osx-arm64 architecture (mac m1)

parent 216d9381
No related branches found
No related tags found
No related merge requests found
Pipeline #51306 passed
...@@ -80,7 +80,7 @@ def get_json(channel, platform, name): ...@@ -80,7 +80,7 @@ def get_json(channel, platform, name):
---------- ----------
channel : str channel : str
Complete channel URL Complete channel URL
platform : {'linux-64', 'osx-64', 'noarch'} platform : {'linux-64', 'osx-64', 'osx-arm64', 'noarch'}
The platform of interest The platform of interest
name : str name : str
The name of the file to retrieve. If the name ends in '.bz2', then it The name of the file to retrieve. If the name ends in '.bz2', then it
...@@ -90,11 +90,18 @@ def get_json(channel, platform, name): ...@@ -90,11 +90,18 @@ def get_json(channel, platform, name):
------- -------
repodata : dict repodata : dict
contents of repodata.json contents of repodata.json
Raises
------
RuntimeError :
If the URL cannot be reached
""" """
url = channel + "/" + platform + "/" + name url = channel + "/" + platform + "/" + name
logger.debug("[checking] %s...", url) logger.debug("[checking] %s...", url)
r = requests.get(url, allow_redirects=True, stream=True) r = requests.get(url, allow_redirects=True, stream=True)
if r.status_code == 404:
raise RuntimeError("URL '%s' does not exist" % url)
size = r.headers.get("Content-length", "??") size = r.headers.get("Content-length", "??")
logger.info("[download] %s (%s bytes)...", url, size) logger.info("[download] %s (%s bytes)...", url, size)
...@@ -374,7 +381,8 @@ def checksum_packages(repodata, dest_dir, arch, packages): ...@@ -374,7 +381,8 @@ def checksum_packages(repodata, dest_dir, arch, packages):
dest_dir : str dest_dir : str
Path leading to local mirror Path leading to local mirror
arch : str arch : str
Current architecture being considered (e.g. noarch, linux-64 or osx-64) Current architecture being considered (e.g. noarch, linux-64, osx-64,
osx-arm64)
packages : list packages : list
List of packages that are available locally, by name List of packages that are available locally, by name
......
...@@ -169,7 +169,7 @@ def mirror( ...@@ -169,7 +169,7 @@ def mirror(
logger.warn("!!!! DRY RUN MODE !!!!") logger.warn("!!!! DRY RUN MODE !!!!")
logger.warn("Nothing will be really mirrored") logger.warn("Nothing will be really mirrored")
DEFAULT_SUBDIRS = ["noarch", "linux-64", "osx-64"] DEFAULT_SUBDIRS = ["noarch", "linux-64", "osx-64", "osx-arm64"]
noarch = os.path.join(dest_dir, "noarch") noarch = os.path.join(dest_dir, "noarch")
if not os.path.exists(noarch): # first time if not os.path.exists(noarch): # first time
...@@ -188,7 +188,18 @@ def mirror( ...@@ -188,7 +188,18 @@ def mirror(
for arch in DEFAULT_SUBDIRS: for arch in DEFAULT_SUBDIRS:
remote_repodata = get_json(channel_url, arch, "repodata_from_packages.json.bz2") try:
remote_repodata = get_json(
channel_url, arch, "repodata_from_packages.json.bz2"
)
except RuntimeError:
# the architecture does not exist?
logger.warning(
"Architecture %s does not seem to exist at channel %s - ignoring...",
arch,
channel_url,
)
continue
# merge all available packages into one single dictionary # merge all available packages into one single dictionary
remote_package_info = {} remote_package_info = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment