Replies: 6 comments 22 replies
-
The closest thing we have for this today is https://github.com/dotnet/designs/blob/main/accepted/2020/reproducible-builds.md . The basic idea is that the PDB of the binary in nuget package contains list of sources and compiler command line used to build the package that should be enough to allow re-creating the binary.
How is this done for Java or Python? We should be able to follow the same plan. |
Beta Was this translation helpful? Give feedback.
-
I like this general idea. It's a question of how to achieve it. While the reproducible builds are a good suggestion, it's definitely not productized and unlikely to be successful w/o cooperation from the library owner. I propose some complementary ideas:
I'll be the first to admit that this is hand-wavy. Also, for such a system to work, there needs to be circular influence/feedback. This has the potential to be a big lift. Folks would need to really want this for it to work, including distros, app authors, and library authors. Certainly, it could work. |
Beta Was this translation helpful? Give feedback.
-
@omajid what is the difference is with that issue? Can we keep a single issue? |
Beta Was this translation helpful? Give feedback.
-
Has best practice evolved on this? I packaged powershell for Alpine Linux a year ago, and the newer versions now include more dependencies that are not trivial to build from source. An issue was opened with the upstream team: PowerShell/PowerShell#20143 but indeed I'm not sure how to proceed. |
Beta Was this translation helpful? Give feedback.
-
We're also running into this with trying to bring Jellyfin into Fedora (rhbz#2238840). It'd be great to see some progress on this front. cc: @mooninite |
Beta Was this translation helpful? Give feedback.
-
I mentioned in the last .NET security partners meeting that I am investigating how to solve this issue for Ubuntu. @omajid wrote me an email if I can share ideas or strategies. I thought to answer here in case someone else is interested/want's to provide feedback. I do not yet have a final solution for this problem. There are still open questions. I tried to organize my random collection of notes and thoughts here: OverviewMy broad idea/plan is to:
Note To avoid false expectations. There is no official commitment from Canonical that we actually do that! Rudimentary NuGet packages we already builtIn Ubuntu we have the package Currently, the Ubuntu package contains a tarball, which contains the NuGet packages and is installed at For example, here is the content of the latest .NET 9 tarball (
Some of these NuGet packages could be packaged into deb packages. It would also probably make sense to bundle a few of these NuGet packages into Where to place the NuGet packageWhere do we place the According to this documentation In this config file we can specify where we want to install the packages to.
Some of these locations could be used by future .NET versions, so we should An example config file could look like this: <?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="System Packages" value="/usr/lib/dotnet/system-packages" />
</packageSources>
</configuration> See this documentation Patching solution scoped NuGet config filesThere are many projects that have a NuGet config files at the .NET solution file <packageSources>
<clear />
<!-- approved sources by the project -->
</packageSources> This aims to solve the "It works on my machine" problem where the developers of Solution I can see here is
Limited functionalityA local package source limits the functionality of the NuGet client compared to For example, the following command will fail, because the NuGet client can not
We have to add the available local version:
Maybe we could write a daemon that provides the v3 nuget protocol as a local nuget server via HTTP. Providing runtime dependenciesLet's assume we have solved all the issues how to build the .NET app. This opens up a new question: What do we do with these dependencies? 1. Embed them in the deb packageEmbedding the dependencies in the deb package is probably the easiest option. BUT it is not really optimal. Every time there is an update to one of the 2. Setup symbolic linksWe could put the dlls in a known location and simply create symbolics of them 3. Use the runtime package storeThere exists a feature in the .NET SDK/runtime that is pretty mush what we want. It allows us to store the dll files in a single place and tell the runtime to The documentation suggest placing this store at Additionally we can specify a manifest when publishing a .NET app and the SDK A minimal example workflow to use this would be:
We do not need to use the dotnet store command. We can simply put the dll's in the correct location. Here is an example of a store folder structure:
Where do we get the dll's from?Note This section is purely about the dll's of the .NET source built artifacts. Getting the NuGet packages was easy, but getting the dll's is a little bit more
Self-contained apps
I would not recommend to build self-contained .NET apps when packaging them for a distro.
Challenges with packaging runtime NuGet packagesNote This section is a bit deb packaging specific, but you may have similar issues I spent a bit of time looking into how to package the runtime NuGet packages, e.g.
They need to be built on a specific architecture and os, but could be used on There is no way that we can get the binaries from e.g. 22.04. There simply does Can we get the runtime packages of another architecture. There are 2 options: package the runtime packages as architecture independent packages (
|
Beta Was this translation helpful? Give feedback.
-
A number of Linux distributions (and other OSs) are now using and packaging .NET (via source-build) into their distributions. With .NET available in the distro, users are looking to build on top of it. For example, someone was recently looking for guidance on how to package https://github.com/GitCredentialManager/git-credential-manager into Fedora. That led to some conversation in a Fedora context that I think is general enough that it would apply to most other distros as well.
You can see the original discussion here: https://pagure.io/packaging-committee/issue/1193.
I talked about this with @crummel who suggested starting a discussion here.
Before digging into specific, is this - packaging software built on top of .NET into distros - something we want to encourage and support?
If so, there's quite a few challenges that we need to solve. The challenges are similar to what we encounter in source-build: we need to build everything from source without access to the internet. Here's what I see as the big ones:
Newtonsoft.Json
would be used by a huge percentage of .NET applications, it seems like it would fit in best with the distro policies if we packaged it up once and then applications or higher-level libraries could use that without having to maintain or build this code.Newtonsoft.Json
, we would need to find a way to rebuild everything that consumesNewtonsoft.Json
. Is there a way for an application to use a dynamic-linking ordlopen
-style orLoadLibrary
-style approach to load the packaged copy ofNewtonsoft.Json.dll
?.nupkg
,.dll
files that are meant to be used by other applications? Where should standalone applications live? (This can only be a very rough recommendation, because every distro has its own policies on paths and install locations).This is also related to dotnet/core#7443
cc @dotnet/distro-maintainers @leecow @richlander @tmds
Beta Was this translation helpful? Give feedback.
All reactions