Skip to content

Commit 285a291

Browse files
committed
fix: failure finding SDK artifacts
.NET 10 introduced a chanage where the SDK built artifacts tarball is placed. There no longer exists a symlink at: `artifacts/assets/Release/dotnet-sdk-*.tar.gz` For reference, this is an error caused by this change: ```text Traceback (most recent call last): File "/<<PKGBUILDDIR>>/./debian/tests/build-time-tests/tests.py", line 549, in <module> testContext.RunTests() ~~~~~~~~~~~~~~~~~~~~^^ File "/<<PKGBUILDDIR>>/./debian/tests/build-time-tests/tests.py", line 257, in RunTests self.__ExtractSdk() ~~~~~~~~~~~~~~~~~^^ File "/<<PKGBUILDDIR>>/./debian/tests/build-time-tests/tests.py", line 325, in __ExtractSdk tarPath=GetSourceBuiltArtifactsTarball( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ basePath=self.DotnetBuiltArtifactsBasePath, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sdkVersion=self.DotnetSdkVersion, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type="SDK"), ^^^^^^^^^^^ File "/<<PKGBUILDDIR>>/debian/eng/source_build_artifact_path.py", line 31, in GetSourceBuiltArtifactsTarball raise ValueError(f"Source built artifacts tarball not found " f"(glob pattern: '{globPattern}').") ValueError: Source built artifacts tarball not found (glob pattern: '/<<PKGBUILDDIR>>/artifacts/assets/Release/dotnet-sdk-10.0.100-preview.5*-*.tar.gz'). ``` Signed-off-by: Dominik Viererbe <[email protected]>
1 parent 843b195 commit 285a291

File tree

3 files changed

+38
-11
lines changed

3 files changed

+38
-11
lines changed

src/eng/source_build_artifact_path.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import os
44
import sys
5-
from glob import glob
5+
import glob
6+
import argparse
67

78
sys.path.append("debian/eng")
89
from versionlib.dotnet import SourcePackageVersion, RuntimeIdentifier
@@ -11,21 +12,25 @@
1112
def GetSourceBuiltArtifactsTarball(
1213
basePath: str,
1314
sdkVersion: str,
14-
type: str = "Packages") -> str:
15+
type: str = "packages") -> str:
1516

1617
globPattern = ""
1718

18-
if type == "Packages":
19+
if type.lower() == "packages":
1920
# e.g. Private.SourceBuilt.Artifacts.9.0.100-preview.7.24407.1.ubuntu.24.10-x64.tar.gz
2021
globPattern = (f"{basePath}/Private.SourceBuilt.Artifacts."
2122
f"{sdkVersion}*.*.tar.gz")
22-
elif type == "SDK":
23+
elif type.lower() == "sdk":
24+
sdkArtifactsPath = os.path.join(basePath, "Sdk")
25+
if os.path.exists(sdkArtifactsPath):
26+
basePath = sdkArtifactsPath
27+
2328
# e.g. dotnet-sdk-9.0.100-preview.7.24407.1-ubuntu.24.10-x64.tar.gz
24-
globPattern = (f"{basePath}/dotnet-sdk-{sdkVersion}*-*.tar.gz")
29+
globPattern = (f"{basePath}/**/dotnet-sdk-{sdkVersion}*-*.tar.gz")
2530
else:
2631
raise ValueError(f"Unknown source built artifacts tarball type '{type}'.")
2732

28-
files = glob(globPattern)
33+
files = glob.glob(globPattern, recursive=True)
2934

3035
if len(files) == 0:
3136
raise ValueError(f"Source built artifacts tarball not found "
@@ -38,9 +43,27 @@ def GetSourceBuiltArtifactsTarball(
3843

3944

4045
if __name__ == "__main__":
46+
parser = argparse.ArgumentParser()
47+
parser.add_argument("--type",
48+
type=str,
49+
dest="Type",
50+
choices=["packages","sdk"],
51+
required=True,
52+
metavar="TYPE",
53+
help = "artifact type")
54+
parser.add_argument("--base-path",
55+
type=str,
56+
dest="BasePath",
57+
required=True,
58+
metavar="PATH",
59+
help="base path where the artifacts tarball is "
60+
"located")
61+
args = parser.parse_args()
62+
4163
version = SourcePackageVersion.ParseFromChangelog(
4264
os.path.join("debian", "changelog"))
4365

4466
print(GetSourceBuiltArtifactsTarball(
45-
basePath="/usr/lib/dotnet/source-built-artifacts",
46-
sdkVersion=str(version.SdkVersion)))
67+
basePath=args.BasePath,
68+
sdkVersion=str(version.SdkVersion),
69+
type=args.Type))

src/rules

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@ override_dh_auto_test:
175175
override_dh_install:
176176
install --mode=0755 --directory "$(DEST_DIR)$(DOTNET_ROOT_DIR)"
177177
install --mode=0755 --directory "$(DEST_DIR)$(DOTNET_SYSCONF_DIR)"
178-
ls "$(DOTNET_RELEASE_ARTIFACTS_DIR)"
178+
ls -l "$(DOTNET_RELEASE_ARTIFACTS_DIR)"
179179

180180
tar --extract \
181-
--file "$(DOTNET_RELEASE_ARTIFACTS_DIR)"/dotnet-sdk-*-$(DOTNET_RUNTIME_ID).tar.gz \
181+
--file "$$("$(CURDIR)"/debian/eng/source_build_artifact_path.py \
182+
--type sdk \
183+
--base-path "$(DOTNET_RELEASE_ARTIFACTS_DIR)")" \
182184
--directory "$(DEST_DIR)$(DOTNET_ROOT_DIR)"
183185

184186
ifeq ($(DOTNET_80_OR_GREATER), true)

src/tests/run-regular-tests

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ echo "INFO: extract source build artifacts"
3030
mkdir -p "${AUTOPKGTEST_TMP}/packages"
3131
tar --extract --gzip \
3232
--directory "${AUTOPKGTEST_TMP}/packages" \
33-
--file "$(debian/eng/source_build_artifact_path.py)"
33+
--file "$(debian/eng/source_build_artifact_path.py \
34+
--type packages \
35+
--base-path /usr/lib/dotnet/source-built-artifacts)"
3436

3537
echo "INFO: add source build artifacts to global NuGet config"
3638
mkdir -p ~/.nuget/NuGet/

0 commit comments

Comments
 (0)