Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Debian distro support for vscode extension use package searching #2050

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
276 changes: 276 additions & 0 deletions vscode-dotnet-runtime-library/distro-data/distro-support.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,5 +457,281 @@
"version": "9.0"
}
]
},
"Debian": {
"installCommand": [
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"update"
]
},
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"install",
"-y",
"{packageName}"
]
}
],
"uninstallCommand": [
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"remove",
"-y",
"{packageName}"
]
}
],
"updateCommand": [
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"update",
"-y"
]
},
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"upgrade",
"-y",
"{packageName}"
]
}
],
"searchCommand": [
{
"runUnderSudo": false,
"commandRoot": "apt-cache",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"search",
"--names-only",
"^{packageName}$"
]
}
],
"isInstalledCommand": [
{
"runUnderSudo": true,
"commandRoot": "apt",
"commandParts": [
"list",
"--installed",
"{packageName}"
]
}
],
"packageLookupCommand": [
{
"runUnderSudo": false,
"commandRoot": "dpkg",
"commandParts": [
"-l",
"{packageName}"
]
}
],
"readSymLinkCommand": [
{
"runUnderSudo": false,
"commandRoot": "readlink",
"commandParts": [
"-f",
"{path}"
]
}
],
"expectedDistroFeedInstallDirectory": "/usr/lib/dotnet",
"expectedMicrosoftFeedInstallDirectory": "/usr/share/dotnet",
"installedSDKVersionsCommand": [
{
"runUnderSudo": false,
"commandRoot": "dotnet",
"commandParts": [
"--list-sdks"
]
}
],
"installedRuntimeVersionsCommand": [
{
"runUnderSudo": false,
"commandRoot": "dotnet",
"commandParts": [
"--list-runtimes"
]
}
],
"currentInstallationVersionCommand": [
{
"runUnderSudo": false,
"commandRoot": "dotnet",
"commandParts": [
"--version"
]
}
],
"currentInstallPathCommand": [
{
"runUnderSudo": false,
"commandRoot": "which",
"commandParts": [
"dotnet"
]
}
],
"packages": [
{
"version": "6.0",
"sdk": [
"dotnet-sdk-6.0"
],
"runtime": [
"dotnet-runtime-6.0"
],
"aspnetcore": [
"aspnetcore-runtime-6.0"
]
},
{
"version": "7.0",
"sdk": [
"dotnet-sdk-7.0"
],
"runtime": [
"dotnet-runtime-7.0"
],
"aspnetcore": [
"aspnetcore-runtime-7.0"
]
},
{
"version": "8.0",
"sdk": [
"dotnet-sdk-8.0"
],
"runtime": [
"dotnet-runtime-8.0"
],
"aspnetcore": [
"aspnetcore-runtime-8.0"
]
},
{
"version": "9.0",
"sdk": [
"dotnet-sdk-9.0"
],
"runtime": [
"dotnet-runtime-9.0"
],
"aspnetcore": [
"aspnetcore-runtime-9.0"
]
}
],
"versions": [
{
"version": "10",
"preInstallCommands": [
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"install",
"-y",
"wget"
]
},
{
"runUnderSudo": true,
"commandRoot": "wget",
"commandParts": [
"https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb",
"-O",
"packages-microsoft-prod.deb"
]
},
{
"runUnderSudo": true,
"commandRoot": "dpkg",
"commandParts": [
"-i",
"packages-microsoft-prod.deb"
]
},
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"update"
]
}
]
},
{
"version": "11",
"preInstallCommands": [
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"-o",
"DPkg::Lock::Timeout=180",
"update"
]
},
{
"runUnderSudo": true,
"commandRoot": "apt-get",
"commandParts": [
"install",
"-y",
"wget"
]
},
{
"runUnderSudo": true,
"commandRoot": "wget",
"commandParts": [
"https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb",
"-O",
"packages-microsoft-prod.deb"
]
},
{
"runUnderSudo": true,
"commandRoot": "dpkg",
"commandParts": [
"-i",
"packages-microsoft-prod.deb"
]
}
]
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* --------------------------------------------------------------------------------------------
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { ICommandExecutor } from '../Utils/ICommandExecutor';
import { IUtilityContext } from '../Utils/IUtilityContext';
import { GenericDistroSDKProvider } from './GenericDistroSDKProvider';
import { IAcquisitionWorkerContext } from './IAcquisitionWorkerContext';
import { DistroVersionPair } from './LinuxVersionResolver';

export class DebianDistroSDKProvider extends GenericDistroSDKProvider
{
constructor(distroVersion : DistroVersionPair, context : IAcquisitionWorkerContext, utilContext : IUtilityContext, executor : ICommandExecutor | null = null)
{
super(distroVersion, context, utilContext, executor);
}

protected myVersionDetails() : any
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const distroVersions = this.distroJson[this.distroVersion.distro][this.distroVersionsKey];
const targetVersion = Math.floor(parseFloat(this.distroVersion.version[0])).toFixed(1);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const versionData = distroVersions.filter((x: { [x: string]: string; }) => x[this.versionKey] === String(targetVersion));
return versionData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { IDotnetAcquireContext } from '../IDotnetAcquireContext'
import { getInstallFromContext } from '../Utils/InstallIdUtilities';
import { DotnetInstallMode } from './DotnetInstallMode';
import { version } from 'os';
import { DebianDistroSDKProvider } from './DebianDistroSDKProvider';

/**
* An enumeration type representing all distros with their versions that we recognize.
Expand Down Expand Up @@ -214,6 +215,8 @@ Or, install Red Hat Enterprise Linux 8.0 or Red Hat Enterprise Linux 9.0 from ht
throw unsupportedRhelErr.error;
}
return new RedHatDistroSDKProvider(distroAndVersion, this.workerContext, this.utilityContext);
case 'Debian':
return new DebianDistroSDKProvider(distroAndVersion, this.workerContext, this.utilityContext);
default:
return new GenericDistroSDKProvider(distroAndVersion, this.workerContext, this.utilityContext);
}
Expand Down
Loading
Loading