Skip to content

Commit

Permalink
List all available platform builds for the latest version of a recipe
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
martin-g committed Nov 29, 2024
1 parent f854a6f commit 4ecbd31
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 23 deletions.
30 changes: 17 additions & 13 deletions source/_ext/bioconda_sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,20 +404,11 @@ def generate(self, docnames: Optional[List[str]] = None):

recipe_details = recipes_details.get(name, {})

platforms = []
noarch = recipe_details.get('noarch')
if noarch:
platforms.append("noarch (%s)" % noarch)

additional_platforms = recipe_details.get('additional-platforms', [])
if len(additional_platforms) > 0:
platforms.extend(additional_platforms)

# TODO: Add meaningful info for extra/qualifier/description
# fields, e.g., latest package version.
content.append({
"name": name,
"additional_platforms": ', '.join(platforms),
"platforms": ', '.join(recipe_details.get('platforms', [])),
"latest_version": recipe_details.get('latest_version')
})

Expand Down Expand Up @@ -586,8 +577,6 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
return []

recipe_details = recipes_details.get(recipe.name, {})

recipe_details['noarch'] = recipe.meta["build"].get("noarch", '')

# Format the README
packages = []
Expand All @@ -609,7 +598,22 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
]

if recipe.name == package:
recipe_details['latest_version'] = sorted_versions[0][0]
latest_version = sorted_versions[0][0]
platforms = set(repodata.get_package_data('platform', channels='bioconda', name=package, version=latest_version))
if "noarch" in platforms:
platforms = ["noarch"] # no need to list linux or osx
else:
def mapper(platform):
if "linux" == platform:
return "linux-64"
elif "osx" == platform:
return "osx-64"
else:
return platform
platforms = map(mapper, platforms)
recipe_details['platforms'] = list(platforms)

recipe_details['latest_version'] = latest_version
# recipe_details['build_number'] = sorted_versions[0][1]
else:
depends = []
Expand Down
42 changes: 32 additions & 10 deletions source/templates/domainindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ <h1>{{ indextitle }}</h1>
<td id="noarch-count" style="text-align: center;"></td>
<td><span id="noarch-ratio"></span>%</td>
</tr>
<tr>
<td>linux-64</td>
<td id="linux-64-count" style="text-align: center;"></td>
<td><span id="linux-64-ratio"></span>%</td>
</tr>
<tr>
<td>linux-aarch64</td>
<td id="linux-aarch64-count" style="text-align: center;"></td>
<td><span id="linux-aarch64-ratio"></span>%</td>
</tr>
<tr>
<td>osx-64:</td>
<td id="osx-64-count" style="text-align: center;"></td>
<td><span id="osx-64-ratio"></span>%</td>
</tr>
<tr>
<td>osx-arm64:</td>
<td id="osx-arm64-count" style="text-align: center;"></td>
Expand All @@ -59,20 +69,28 @@ <h1>{{ indextitle }}</h1>

let dataset = [
{%- for (entry) in content %}
["{{ entry.name }}", "{{ entry.latest_version }}", "{{ entry.additional_platforms }}"]{%- if not loop.last -%}{{ "," }}{%- endif -%}
["{{ entry.name }}", "{{ entry.latest_version }}", "{{ entry.platforms }}"]{%- if not loop.last -%}{{ "," }}{%- endif -%}
{%- endfor %}
];

let aarch64Count = 0;
let arm64Count = 0;
let linux64Count = 0;
let linuxAarch64Count = 0;
let osx64Count = 0;
let osxArm64Count = 0;
let noarchCount = 0;
for (let i=0; i<dataset.length; i++) {
let entry = dataset[i];
if (entry[2].includes("linux-64")) {
linux64Count += 1;
}
if (entry[2].includes("linux-aarch64")) {
aarch64Count += 1;
linuxAarch64Count += 1;
}
if (entry[2].includes("osx-64")) {
osx64Count += 1;
}
if (entry[2].includes("osx-arm64")) {
arm64Count += 1;
osxArm64Count += 1;
}
if (entry[2].includes("noarch")) {
noarchCount += 1;
Expand All @@ -81,10 +99,14 @@ <h1>{{ indextitle }}</h1>
let totalCount = dataset.length;
document.getElementById("noarch-count").textContent = noarchCount;
document.getElementById("noarch-ratio").textContent = (noarchCount / totalCount * 100).toFixed(2);
document.getElementById("linux-aarch64-count").textContent = aarch64Count;
document.getElementById("linux-aarch64-ratio").textContent = (aarch64Count / totalCount * 100).toFixed(2);
document.getElementById("osx-arm64-count").textContent = arm64Count;
document.getElementById("osx-arm64-ratio").textContent = (arm64Count / totalCount * 100).toFixed(2);
document.getElementById("linux-64-count").textContent = linux64Count;
document.getElementById("linux-64-ratio").textContent = (linux64Count / totalCount * 100).toFixed(2);
document.getElementById("linux-aarch64-count").textContent = linuxAarch64Count;
document.getElementById("linux-aarch64-ratio").textContent = (linuxAarch64Count / totalCount * 100).toFixed(2);
document.getElementById("osx-64-count").textContent = osx64Count;
document.getElementById("osx-64-ratio").textContent = (osx64Count / totalCount * 100).toFixed(2);
document.getElementById("osx-arm64-count").textContent = osxArm64Count;
document.getElementById("osx-arm64-ratio").textContent = (osxArm64Count / totalCount * 100).toFixed(2);
document.getElementById("total-count").textContent = totalCount;

let table = new DataTable('#recipes-table', {
Expand All @@ -96,7 +118,7 @@ <h1>{{ indextitle }}</h1>
orderable: false
},
{
title: "Additional platforms",
title: "Platforms",
orderable: false
},
],
Expand Down

0 comments on commit 4ecbd31

Please sign in to comment.