Skip to content
2 changes: 1 addition & 1 deletion build/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"downloadUrl": "https://github.com/cli/cli"
},
"yarn": {
"versionCommand": "yarn --version",
"versionCommand": "yarn --version 2>/dev/null | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'",
"downloadUrl": "https://yarnpkg.com/"
},
"Maven": {
Expand Down
19 changes: 17 additions & 2 deletions build/src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ function getTagsForVersion(definitionId, version, registry, registryPath, varian
}
}

const seen = new Set();
return tags.reduce((list, tag) => {
// One of the tags that needs to be supported is one where there is no version, but there
// are other attributes. For example, python:3 in addition to python:0.35.0-3. So, a version
Expand All @@ -224,7 +225,11 @@ function getTagsForVersion(definitionId, version, registry, registryPath, varian
.replace(/\$\{?VARIANT\}?/, variant || 'NOVARIANT')
.replace('-NOVARIANT', '');
if (baseTag.charAt(baseTag.length - 1) !== ':') {
list.push(`${registry}/${registryPath}/${baseTag}`);
const fullTag = `${registry}/${registryPath}/${baseTag}`;
if (!seen.has(fullTag)) {
seen.add(fullTag);
list.push(fullTag);
}
}
return list;
}, []);
Expand Down Expand Up @@ -305,13 +310,23 @@ function getTagList(definitionId, release, versionPartHandling, registry, regist
// If this variant should also be used for the the latest tag, add it. The "latest" value could be
// true, false, or a specific variant. "true" assumes the first variant is the latest.
const definitionLatestProperty = config.definitionBuildSettings[definitionId].latest;
return tagList.concat((updateLatest
const allTags = tagList.concat((updateLatest
&& definitionLatestProperty
&& (!allVariants
|| variant === definitionLatestProperty
|| (definitionLatestProperty === true && variant === firstVariant)))
? getLatestTag(definitionId, registry, registryPath)
: []);

// Deduplicate tags while preserving order
const seen = new Set();
return allTags.filter((tag) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: incorrect indent

if (seen.has(tag)) {
return false;
}
seen.add(tag);
return true;
});
}

const getDefinitionObject = (id, variant) => {
Expand Down
34 changes: 28 additions & 6 deletions build/src/utils/image-content-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,34 @@ async function getPipPackageInfo(imageTagOrContainerName, packageList, usePipx,
console.log('(*) Gathering information about pip packages...');
const versionLookup = usePipx ? await getPipxVersionLookup(imageTagOrContainerName) : await getPipVersionLookup(imageTagOrContainerName, imageId);

return packageList.map((package) => {
return {
name: package,
version: versionLookup[package]
};
});
// Build a fallback lookup keyed by PEP 503 normalized names so packages that
// differ only by casing/normalization (e.g. "pyOpenssl" vs "pyOpenSSL") still resolve.
const normalizedVersionLookup = Object.keys(versionLookup).reduce((prev, name) => {
prev[normalizePipPackageName(name)] = versionLookup[name];
return prev;
}, {});

return packageList.reduce((list, package) => {
const version = versionLookup[package] || normalizedVersionLookup[normalizePipPackageName(package)];
// Skip packages that aren't actually installed in the inspected environment.
// Emitting an entry without a version produces blank markdown rows and
// conflicting/duplicate cgmanifest.json (SBOM) registrations.
if (version) {
list.push({
name: package,
version: version
});
} else {
console.log(`(!) Warning: Could not determine version for pip package "${package}" - skipping.`);
}
return list;
}, []);
Comment thread
Kaniska244 marked this conversation as resolved.
}

// Normalize a Python package name per PEP 503 (lowercase, runs of "-_." collapsed to "-")
// so lookups are tolerant of casing/separator differences between manifests and pip output.
function normalizePipPackageName(name) {
return name.replace(/[-_.]+/g, '-').toLowerCase();
}

function getUserName(imageId) {
Expand Down
4 changes: 2 additions & 2 deletions src/dotnet/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.1.2",
"version": "2.1.3",
"variants": [
"11.0-preview-resolute",
"10.0-noble",
Expand Down Expand Up @@ -80,7 +80,7 @@
"languages": {
".NET": {
"cgIgnore": true,
"versionCommand": "dotnet --version | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+' | tr -d '\\n' && echo \\\" (\\$(dotnet --info | grep -ozP 'Host.*:\\s*Version:\\s*\\K[0-9]\\.[0-9]\\.[0-9]' | tr '\\0' '\\n'))\\\"",
"versionCommand": "dotnet --version | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+' | tr -d '\\n' && echo \\\" (\\$(dotnet --info | grep -ozP 'Host.*:\\s*Version:\\s*\\K[0-9]+\\.[0-9]+\\.[0-9]+' | tr '\\0' '\\n'))\\\"",
"path": "/usr",
"downloadUrl": "https://dotnet.microsoft.com/"
}
Expand Down
4 changes: 2 additions & 2 deletions src/java-8/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.10",
"version": "3.1.0",
"variants": [
"trixie",
"bookworm"
Expand Down Expand Up @@ -56,7 +56,7 @@
"languages": {
"Java": {
"cgIgnore": true,
"versionCommand": "/usr/local/sdkman/candidates/java/current/bin/java -version 2>&1 | grep -ozP '^openjdk\\sversion\\s\\\"\\K[^\\\"]+' | tr '\\0' '\\n' && /usr/local/openjdk-*/bin/java --version | grep -ozP 'openjdk\\s+\\K[0-9]+\\.[0-9]+\\.[0-9]+' | tr '\\0' '\\n'",
"versionCommand": "/usr/local/sdkman/candidates/java/current/bin/java -version 2>&1 | grep -ozP '^openjdk\\sversion\\s\\\"\\K[^\\\"]+' | tr '\\0' '\\n'",
"path": "/usr/local/sdkman/candidates/java/current<br />/usr/local"
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/universal/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "6.0.6",
"version": "6.0.7",
"build": {
"latest": true,
"rootDistro": "debian",
Expand Down Expand Up @@ -119,8 +119,7 @@
"plotly",
"jupyterlab_git",
"certifi",
"setuptools",
"wheel"
"setuptools"
],
"other": {
"git": {},
Expand Down
Loading