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

dotnet-sdk_3: 3.1.19 -> 3.1.21 + dotnet-sdk_5: 5.0.10 -> 5.0.12 #142468

Merged
merged 12 commits into from
Nov 16, 2021

Conversation

prusnak
Copy link
Member

@prusnak prusnak commented Oct 21, 2021

Motivation for this change
  • added print-hashes script which makes further updates very easy (not totally automatic though)
  • sdk_3 and sdk_5 version updates
  • 5.0.11 contains security fixes, so that commit needs to be backported to stable too
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@prusnak prusnak added 9.needs: port to stable A PR needs a backport to the stable release. 1.severity: security Issues which raise a security issue, or PRs that fix one labels Oct 21, 2021
Copy link
Member

@felschr felschr left a comment

Choose a reason for hiding this comment

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

10 packages failed to build:
discordchatexporter-cli eventstore github-runner msbuild omnisharp-roslyn osu-lazer python-language-server roslyn ryujinx wasabibackend

17 packages built:
azure-functions-core-tools btcpayserver depotdownloader dotnet-aspnetcore dotnet-runtime dotnet-sdk dotnet-sdk_3 dotnetCorePackages.aspnetcore_3_1 dotnetCorePackages.runtime_3_1 jellyfin jetbrains.rider nbxplorer
opentabletdriver prowlarr radarr vscode-extensions.ms-vsliveshare.vsliveshare wasabiwallet

As far as I can see all the errors, like the one below, are the same kind of dependency errors:

       > /build/source/Ryujinx/Ryujinx.csproj : error NU1102: Unable to find package Microsoft.AspNetCore.App.Runtime.osx-x64 with version (= 5.0.11) [/build/source/Ryujinx.sln]
       > /build/source/Ryujinx/Ryujinx.csproj : error NU1102:   - Found 1 version(s) in nixos [ Nearest version: 5.0.10 ] [/build/source/Ryujinx.sln]

You need to update the dependencies for those packages like in previous updates:
#138296

Also, the commits should follow this naming instead:
dotnetCorePackages.*_5*: 5.0.10 -> 5.0.11

@jonringer
Copy link
Contributor

yea, that's the painful part of dotnet+nix, is that some dependent packages need to be manually re-generated. :(

@avdv
Copy link
Member

avdv commented Nov 2, 2021

Result of nixpkgs-review pr 142468 run on x86_64-linux 1

10 packages failed to build:
  • discordchatexporter-cli
  • eventstore
  • github-runner
  • msbuild
  • omnisharp-roslyn
  • osu-lazer
  • python-language-server
  • roslyn
  • ryujinx
  • wasabibackend
17 packages built:
  • azure-functions-core-tools
  • btcpayserver
  • depotdownloader
  • dotnet-aspnetcore (dotnetCorePackages.aspnetcore_5_0)
  • dotnet-runtime (dotnetCorePackages.runtime_5_0)
  • dotnet-sdk (dotnet-sdk_5 ,dotnetCorePackages.sdk_5_0)
  • dotnet-sdk_3 (dotnetCorePackages.sdk_3_1)
  • dotnetCorePackages.aspnetcore_3_1
  • dotnetCorePackages.runtime_3_1
  • jellyfin
  • jetbrains.rider
  • nbxplorer
  • opentabletdriver
  • prowlarr
  • radarr
  • vscode-extensions.ms-vsliveshare.vsliveshare
  • wasabiwallet

@prusnak prusnak changed the title dotnet-sdk_3: 3.1.19 -> 3.1.20 + dotnet-sdk_5: 5.0.10 -> 5.0.11 dotnet-sdk_3: 3.1.19 -> 3.1.21 + dotnet-sdk_5: 5.0.10 -> 5.0.12 Nov 9, 2021
@avdv
Copy link
Member

avdv commented Nov 9, 2021

@prusnak I see that you updated this PR to upgrade to later versions. Are you working on updating the hashes of dependent packages or do you need a helping hand?

@prusnak
Copy link
Member Author

prusnak commented Nov 9, 2021

Are you working on updating the hashes of dependent packages or do you need a helping hand?

Helping hand would be great! I don't have access to my x86_64 machine at the moment, so it would be very problematic for me to update these.

@avdv
Copy link
Member

avdv commented Nov 10, 2021

Helping hand would be great! I don't have access to my x86_64 machine at the moment, so it would be very problematic for me to update these.

@prusnak I have started to update dependent packages. Got stuck on msbuild where I still need to figure out how the update script should be called.

See prusnak/nixpkgs@dotnet-update...avdv:dotnet-update

TODO:

  • alttpr-opentracker
  • eventstore
  • github-runner
  • msbuild
  • omnisharp-roslyn
  • python-language-server
  • roslyn
  • wasabibackend

22 packages built:
ArchiSteamFarm azure-functions-core-tools btcpayserver depotdownloader discordchatexporter-cli dotnet-aspnetcore dotnet-netcore dotnet-sdk dotnet-sdk_3 dotnetCorePackages.aspnetcore_3_1 dotnetCorePackages.runtime_3_1 jellyfin jetbrains.rider nbxplorer netcoredbg opentabletdriver osu-lazer prowlarr radarr ryujinx vscode-extensions.ms-vsliveshare.vsliveshare wasabiwallet

@avdv
Copy link
Member

avdv commented Nov 11, 2021

Result of nixpkgs-review run on x86_64-linux 1 (:information_source: from this branch https://github.com/avdv/nixpkgs/commits/dotnet-update)

30 packages built:
  • ArchiSteamFarm
  • alttpr-opentracker
  • azure-functions-core-tools
  • btcpayserver
  • depotdownloader
  • discordchatexporter-cli
  • dotnet-aspnetcore
  • dotnet-netcore (dotnet-runtime)
  • dotnet-sdk
  • dotnet-sdk_3
  • dotnetCorePackages.aspnetcore_3_1
  • dotnetCorePackages.runtime_3_1
  • eventstore
  • github-runner
  • jellyfin
  • jetbrains.rider
  • msbuild
  • nbxplorer
  • netcoredbg
  • omnisharp-roslyn
  • opentabletdriver
  • osu-lazer
  • prowlarr
  • python-language-server
  • radarr
  • roslyn
  • ryujinx
  • vscode-extensions.ms-vsliveshare.vsliveshare
  • wasabibackend
  • wasabiwallet
@prusnak I have updated my branch, please have a look and feel free to push these changes to your branch.

@prusnak
Copy link
Member Author

prusnak commented Nov 11, 2021

@avdv Thank you very much for your work! Pulled in changes from your branch into this PR.

@prusnak
Copy link
Member Author

prusnak commented Nov 11, 2021

I updated commit c72bbcd3f5f62ad4eefe259435e1efbbea3ed8b2 to enable linux-arm64 build of github-runner

@corngood
Copy link
Contributor

@avdv I'm sorry it's such a pain to update the dependencies for msbuild. You basically need to unpack, patch and build, but without the local nuget sources, then run create-deps.sh.

I threw together something quick that should work as an example:

corngood@msbuild-deps

nix-shell -A msbuild --run createDeps

should create ./deps.nix

So much of the build process is required that I'm not sure how best to split this between the derivation and the shell script. Any ideas?

@avdv
Copy link
Member

avdv commented Nov 11, 2021

I'm sorry it's such a pain to update the dependencies for msbuild. You basically need to unpack, patch and build, but without the local nuget sources, then run create-deps.sh.

Thank you @corngood! I think this is what I ended up doing somehow, but the deps.nix created were identical to the existing deps.nix... and then re-trying to build msbuild simply succeeded. 🤷

I threw together something quick that should work as an example:

corngood@msbuild

nix-shell -A msbuild --run createDeps

should create ./deps.nix

Thanks, I'll give this a spin...

and do not add nuget.build.tasks.pack

```
/build/source/src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj : error NU1100: Unable to resolve nuget.build.tasks.pack (>= 5.10.0-preview.2.7169)' for '.NETCoreApp,Version=v3.1'.
/build/source/src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj : error NU1100: Unable to resolve 'nuget.build.tasks.pack (>= 5.10.0-preview.2.7169)' for '.NETFramework,Version=v4.7.2'.
```
The old version of the script tried to parse the output of the dotnet tool, but
apparently, that output changed and thus the list of dependencies was empty.
@prusnak prusnak merged commit 1663708 into NixOS:master Nov 16, 2021
@prusnak
Copy link
Member Author

prusnak commented Nov 16, 2021

Thanks @avdv !

Going to merge this as msbuild builds just fine.

@prusnak prusnak deleted the dotnet-update branch November 16, 2021 15:27
@avdv
Copy link
Member

avdv commented Nov 17, 2021

Thank you @prusnak !

@corngood I ran the nix-shell -A msbuild --run createDeps incorporating your changes into the current branch and the dependencies were again identical. The only thing I noticed is that sometimes the server returned an HTTP error code and the createDeps process stopped, and I had to re-try it a couple of times...

@corngood
Copy link
Contributor

corngood commented Nov 17, 2021

Could you tell what URL it was fetching, and what the error code was? If we're using unreliable sources that's going to be a problem for builds as well down the road. It would be nice to have a proper mirror list, but I've found that in practice the different mirrors don't have identical content for the packages.

At some point I'd like to do some work to unify all the nuget dependency gathering logic for all these packages.

#133588 might be interesting

@avdv
Copy link
Member

avdv commented Nov 18, 2021

Could you tell what URL it was fetching, and what the error code was?

The only diagnostic output from the script was:

couldn't find microsoft.netframework.referenceassemblies.net45 1.0.0

and

couldn't find nuget.librarymodel 5.9.1-rc.8

Looking these up in the deps.nix file yields:

https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netframework.referenceassemblies.net45/1.0.0/microsoft.netframework.referenceassemblies.net45.1.0.0.nupkg

https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/d1622942-d16f-48e5-bc83-96f4539e7601/nuget/v3/flat2/nuget.librarymodel/5.9.1-rc.8/nuget.librarymodel.5.9.1-rc.8.nupkg

To avoid fetching the artifacts twice in the create-deps script I modified it thusly:

diff --git a/pkgs/development/tools/build-managers/msbuild/create-deps.sh b/pkgs/development/tools/build-managers/msbuild/create-deps.sh
index c9bd4ba7eb6..15b997b2af5 100755
--- a/pkgs/development/tools/build-managers/msbuild/create-deps.sh
+++ b/pkgs/development/tools/build-managers/msbuild/create-deps.sh
@@ -15,9 +15,21 @@ mapfile -t repos < <(
         done
     )
 
-find .packages fake-home/.nuget/packages -name \*.nupkg -printf '%P\n' | sort -u |
-    while IFS= read file
-    do
+
+find .packages fake-home/.nuget/packages -name \*.nupkg -printf '%p\n' |
+    (
+     declare -A nupkg
+
+     while IFS= read file
+     do
+        ponly="${file#*?packages/}"
+        nupkg["$ponly"]="$file"
+     done
+
+     declare -a sorted
+     IFS=$'\n' sorted=( $(sort -u <<<"${!nupkg[*]}") )
+
+     for file in "${sorted[@]}"; do
         packagedir=$(dirname $file)
         version=$(basename $packagedir)
         package=$(dirname $packagedir)
@@ -38,8 +50,8 @@ find .packages fake-home/.nuget/packages -name \*.nupkg -printf '%P\n' | sort -u
             echo "couldn't find $package $version" >&2
             exit 1
         fi
+        sha256="$(nix-hash --type sha256 --flat --base32 "${nupkg["$file"]}")"
 
-        sha256=$(nix-prefetch-url "$url" 2>/dev/null)
         cat << EOL
   {
     name = "$package";
@@ -50,7 +62,8 @@ find .packages fake-home/.nuget/packages -name \*.nupkg -printf '%P\n' | sort -u
     };
   }
 EOL
-    done
+     done
+  )
 
 cat << EOL
 ]

which uses the already downloaded files instead of fetching it again.

It would be nice to have a proper mirror list, but I've found that in practice the different mirrors don't have identical content for the packages.

At least, that explains why my modified script turned up a different hash for a single dependency, probably because it was downloaded from a different mirror before:

--- deps.nix	2021-11-11 16:22:53.500281686 +0100
+++ /tmp/newdeps	2021-11-12 09:37:45.439595602 +0100
@@ -364,7 +364,7 @@
     version = "16.6.1";
     src = fetchurl {
       url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.net.test.sdk/16.6.1/microsoft.net.test.sdk.16.6.1.nupkg";
-      sha256 = "0jjdg468jc6pv2z764f3xc19lcr772nzjm9cjfqq3bqw8vkpzmhv";
+      sha256 = "188dd2imzd6iwhfxz5b8hfis3i0xgwjkpf3hd08vcvxy095ixb2b";
     };
   }
   {

@avdv
Copy link
Member

avdv commented Nov 18, 2021

At some point I'd like to do some work to unify all the nuget dependency gathering logic for all these packages.

Also on my TODO list 😄

#133588 might be interesting

Yes, but it does not support different sources, AFIACS.

@legendofmiracles
Copy link
Contributor

It would be great if you could also update the dependencies for ArchiSteamFarm in the future when updating dotnet, which was recently converted to not build from release binaries. #145542

@avdv
Copy link
Member

avdv commented Nov 21, 2021

It would be great if you could also update the dependencies for ArchiSteamFarm in the future when updating dotnet, which was recently converted to not build from release binaries. #145542

Of course. This will be the case in the future, since all dependent packages will be rebuild with nixpkgs-review. It just broke on Hydra because both modifications were done in parallel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.severity: security Issues which raise a security issue, or PRs that fix one 9.needs: port to stable A PR needs a backport to the stable release. 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants