From 6858a974b3bd1773b973247e083e7eb889351039 Mon Sep 17 00:00:00 2001 From: fpellet Date: Sat, 22 Nov 2025 21:16:20 +0100 Subject: [PATCH 1/4] Add paket tool --- src/cli/install-tool/index.ts | 2 ++ src/cli/tools/dotnet/paket.ts | 11 +++++++++++ src/cli/tools/index.ts | 1 + src/usr/local/containerbase/tools/v2/paket.sh | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 src/cli/tools/dotnet/paket.ts create mode 100644 src/usr/local/containerbase/tools/v2/paket.sh diff --git a/src/cli/install-tool/index.ts b/src/cli/install-tool/index.ts index 6619a1fc58..33fdf31d90 100644 --- a/src/cli/install-tool/index.ts +++ b/src/cli/install-tool/index.ts @@ -17,6 +17,7 @@ import { DockerInstallService } from '../tools/docker'; import { BuildxInstallService } from '../tools/docker/buildx'; import { DockerComposeInstallService } from '../tools/docker/compose'; import { DotnetInstallService } from '../tools/dotnet'; +import { PaketInstallService } from '../tools/dotnet/paket'; import { ErlangInstallService } from '../tools/erlang'; import { ElixirInstallService } from '../tools/erlang/elixir'; import { FlutterInstallService } from '../tools/flutter'; @@ -143,6 +144,7 @@ async function prepareInstallContainer(): Promise { container.bind(INSTALL_TOOL_TOKEN).to(MavenInstallService); container.bind(INSTALL_TOOL_TOKEN).to(NixInstallService); container.bind(INSTALL_TOOL_TOKEN).to(NodeInstallService); + container.bind(INSTALL_TOOL_TOKEN).to(PaketInstallService); container.bind(INSTALL_TOOL_TOKEN).to(PhpInstallService); container.bind(INSTALL_TOOL_TOKEN).to(PixiInstallService); container.bind(INSTALL_TOOL_TOKEN).to(PowershellInstallService); diff --git a/src/cli/tools/dotnet/paket.ts b/src/cli/tools/dotnet/paket.ts new file mode 100644 index 0000000000..a57e9b471a --- /dev/null +++ b/src/cli/tools/dotnet/paket.ts @@ -0,0 +1,11 @@ +import { injectFromHierarchy, injectable } from 'inversify'; +import { V2ToolInstallService } from '../../install-tool/install-legacy-tool.service'; +import { v2Tool } from '../../utils/v2-tool'; + +@injectable() +@injectFromHierarchy() +@v2Tool('paket') +export class PaketInstallService extends V2ToolInstallService { + override readonly name = 'paket'; + override readonly parent = 'dotnet'; +} diff --git a/src/cli/tools/index.ts b/src/cli/tools/index.ts index 7f901ebff8..e8a1752a22 100644 --- a/src/cli/tools/index.ts +++ b/src/cli/tools/index.ts @@ -29,6 +29,7 @@ export const NoPrepareTools = [ 'maven', 'nix', 'npm', + 'paket', 'pdm', 'pip-tools', 'pipenv', diff --git a/src/usr/local/containerbase/tools/v2/paket.sh b/src/usr/local/containerbase/tools/v2/paket.sh new file mode 100644 index 0000000000..f555209bff --- /dev/null +++ b/src/usr/local/containerbase/tools/v2/paket.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +function check_tool_requirements () { + check_command dotnet + check_semver "$TOOL_VERSION" "all" +} + +function install_tool () { + dotnet tool install -g paket --version "${TOOL_VERSION}" +} + +function link_tool () { + shell_wrapper paket "/root/.dotnet/tools" +} + +function test_tool () { + paket --version +} From b891e155e07122ae3230395c7787fa8574d4bac2 Mon Sep 17 00:00:00 2001 From: fpellet Date: Sat, 22 Nov 2025 21:18:47 +0100 Subject: [PATCH 2/4] Add test --- src/usr/local/containerbase/tools/v2/paket.sh | 2 +- test/dotnet/Dockerfile | 14 ++++++++++++++ test/dotnet/Dockerfile.arm64 | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/usr/local/containerbase/tools/v2/paket.sh b/src/usr/local/containerbase/tools/v2/paket.sh index f555209bff..adf98420f8 100644 --- a/src/usr/local/containerbase/tools/v2/paket.sh +++ b/src/usr/local/containerbase/tools/v2/paket.sh @@ -14,5 +14,5 @@ function link_tool () { } function test_tool () { - paket --version + DOTNET_ROOT=/opt/containerbase/tools/dotnet paket --version } diff --git a/test/dotnet/Dockerfile b/test/dotnet/Dockerfile index a75c534bc1..f9d1a06a9e 100644 --- a/test/dotnet/Dockerfile +++ b/test/dotnet/Dockerfile @@ -129,6 +129,19 @@ RUN set -ex; \ dotnet add package Newtonsoft.Json --version 12.0.3; \ dotnet restore --force-evaluate +#-------------------------------------- +# test: paket +#-------------------------------------- +FROM build AS test-others + +# renovate: datasource=nuget packageName=Paket +RUN install-tool paket 9.0.2 + +WORKDIR /test +RUN set -ex; \ + ls -la; env; \ + paket init + #-------------------------------------- # final #-------------------------------------- @@ -138,3 +151,4 @@ COPY --from=testa /.dummy /.dummy COPY --from=testb /.dummy /.dummy COPY --from=testc /.dummy /.dummy COPY --from=testd /.dummy /.dummy +COPY --from=test-others /.dummy /.dummy diff --git a/test/dotnet/Dockerfile.arm64 b/test/dotnet/Dockerfile.arm64 index b7113c12b7..4eb8229bbd 100644 --- a/test/dotnet/Dockerfile.arm64 +++ b/test/dotnet/Dockerfile.arm64 @@ -40,9 +40,26 @@ FROM base AS test-dotnet # renovate: datasource=dotnet packageName=dotnet-sdk RUN install-tool dotnet 10.0.100 +#-------------------------------------- +# test: paket +#-------------------------------------- +FROM base AS test-others + +# renovate: datasource=dotnet packageName=dotnet-sdk +RUN install-tool dotnet 10.0.100 + +# renovate: datasource=nuget packageName=Paket +RUN install-tool paket 9.0.2 + +WORKDIR /test +RUN set -ex; \ + ls -la; env; \ + paket init + #-------------------------------------- # Image: final #-------------------------------------- FROM base COPY --from=test-dotnet /.dummy /.dummy +COPY --from=test-others /.dummy /.dummy From 345ed9785e5b23f9fa8ab70f12099138f08e5a6d Mon Sep 17 00:00:00 2001 From: fpellet Date: Tue, 25 Nov 2025 19:31:03 +0100 Subject: [PATCH 3/4] Migrate from v2 --- src/cli/tools/dotnet/paket.ts | 41 ++++++++++++++++--- src/usr/local/containerbase/tools/v2/paket.sh | 18 -------- 2 files changed, 35 insertions(+), 24 deletions(-) delete mode 100644 src/usr/local/containerbase/tools/v2/paket.sh diff --git a/src/cli/tools/dotnet/paket.ts b/src/cli/tools/dotnet/paket.ts index a57e9b471a..78c2b15188 100644 --- a/src/cli/tools/dotnet/paket.ts +++ b/src/cli/tools/dotnet/paket.ts @@ -1,11 +1,40 @@ +import { join } from 'node:path'; +import { execa } from 'execa'; import { injectFromHierarchy, injectable } from 'inversify'; -import { V2ToolInstallService } from '../../install-tool/install-legacy-tool.service'; -import { v2Tool } from '../../utils/v2-tool'; +import { BaseInstallService } from '../../install-tool/base-install.service'; @injectable() @injectFromHierarchy() -@v2Tool('paket') -export class PaketInstallService extends V2ToolInstallService { - override readonly name = 'paket'; - override readonly parent = 'dotnet'; +export class PaketInstallService extends BaseInstallService { + readonly name = 'paket'; + + override async install(version: string): Promise { + const toolPath = this.pathSvc.toolPath(this.name); + + const dotnet = join(this.pathSvc.toolPath('dotnet'), 'dotnet'); + await execa(dotnet, [ + 'tool', + 'install', + '--tool-path', + toolPath, + 'paket', + '--version', + version, + ]); + } + + override async link(_version: string): Promise { + const src = this.pathSvc.toolPath(this.name); + await this.shellwrapper({ srcDir: src }); + } + + override async test(_version: string): Promise { + const paket = join(this.pathSvc.toolPath('paket'), 'paket'); + await execa(paket, ['--version'], { + stdio: ['inherit', 'inherit', 1], + env: { + DOTNET_ROOT: this.pathSvc.toolPath('dotnet'), + }, + }); + } } diff --git a/src/usr/local/containerbase/tools/v2/paket.sh b/src/usr/local/containerbase/tools/v2/paket.sh deleted file mode 100644 index adf98420f8..0000000000 --- a/src/usr/local/containerbase/tools/v2/paket.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -function check_tool_requirements () { - check_command dotnet - check_semver "$TOOL_VERSION" "all" -} - -function install_tool () { - dotnet tool install -g paket --version "${TOOL_VERSION}" -} - -function link_tool () { - shell_wrapper paket "/root/.dotnet/tools" -} - -function test_tool () { - DOTNET_ROOT=/opt/containerbase/tools/dotnet paket --version -} From 9fccc6caee0407800ce405e5629d60fee3687f35 Mon Sep 17 00:00:00 2001 From: fpellet Date: Tue, 25 Nov 2025 20:08:31 +0100 Subject: [PATCH 4/4] Fix DOTNET ROOT --- src/cli/tools/dotnet/paket.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cli/tools/dotnet/paket.ts b/src/cli/tools/dotnet/paket.ts index 78c2b15188..e66bdc93a7 100644 --- a/src/cli/tools/dotnet/paket.ts +++ b/src/cli/tools/dotnet/paket.ts @@ -17,7 +17,7 @@ export class PaketInstallService extends BaseInstallService { 'install', '--tool-path', toolPath, - 'paket', + this.name, '--version', version, ]); @@ -25,16 +25,10 @@ export class PaketInstallService extends BaseInstallService { override async link(_version: string): Promise { const src = this.pathSvc.toolPath(this.name); - await this.shellwrapper({ srcDir: src }); + await this.shellwrapper({ srcDir: src, extraToolEnvs: ['dotnet'] }); } override async test(_version: string): Promise { - const paket = join(this.pathSvc.toolPath('paket'), 'paket'); - await execa(paket, ['--version'], { - stdio: ['inherit', 'inherit', 1], - env: { - DOTNET_ROOT: this.pathSvc.toolPath('dotnet'), - }, - }); + await execa(this.name, ['--version'], { stdio: ['inherit', 'inherit', 1] }); } }