Re: Include non-RPM content in buildroot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 21, 2020 at 3:58 PM Martin Sehnoutka <msehnout@xxxxxxxxxx> wrote:
>
> Hi,

Hi!

I think several of your assumptions are not necessarily correct, which
might lead to wrong conclusions.
My responses are inline below.

> before I write the proposal itself I just want to stress the fact that
> it isn’t my intention to change the current packaging workflow and
> definitely not the user experience. Also if you have C or Python
> packages it would not affect your work at all (I’m not familiar with all
> interpreted languages in Fedora, but I guess it is similar to Python and
> therefore it is not affected by the problems I am going to describe).

(snip)

> First of all, let me describe the problem I see in our Fedora ecosystem
> with relation to Go and Rust language ecosystems. More specifically in
> the relation between RPM buildroot and packages in these ecosystems.
> Both of these languages follow the idea that packages should be small
> and only have a limited set of features. Developers then use a lot of
> these packages to write the final executable that is meant for end-users
> [1]. Also both of these languages use static linking of the final
> binaries meaning that Fedora users don’t install RPM packages of these
> libraries as they are already baked inside of the binary [2].

One big difference between Go and Rust is that Go only namespaces
libraries by their import path (with some exceptions, like gopkg.in),
whereas Rust/cargo namespaces everything by name *and* version, which
makes some things a lot easier. Then there's also the fact that a lot
of Go libraries don't even *have* versions, and most only reference
dependencies by "this git repository". There's some effort to make
this better, but Go modules are not ready yet.

> The 1st problem is that if we want to build RPMs of the final
> executables the way we do now, we need to package all these small
> libraries into RPM even though they are just build dependencies and
> users never install RPMs of these libraries. Many of these RPMs are
> automatically generated from the upstream packages meaning that we don’t
> do anything except for unpacking the upstream package (e.g. plain
> tarball in case of crates.io)  and then we package the same into RPM.
> This process is unfortunately not fully automated and therefore requires
> a certain amount of human effort.
>
>
> To sum up the previous paragraph, I don’t think it is necessary to
> repackage upstream tarball into a downstream RPM.

Of course this requires a certain amount of human effort - because
that's where the packager does their work. This includes:

- verifying that the specified license is correct and suitable for
(re)distribution in fedora
- verify that the package builds and doesn't do crazy things
- fix upstream and integration issues with patches

And none of these three things is 100% automatable.

> The 2nd problem is present only in the Rust ecosystem (as far as my
> knowledge goes). Cargo, the official package manager for Rust, can
> handle the scenario where an executable depends on a single library in
> two different versions [3]. Dnf, on the other hand, will not install two
> versions of the same RPM package. What we do now is, that we patch the
> affected executables and libraries to only use the newest versions
> everywhere. This is again an additional maintenance cost and we create
> differences from upstream, because these patches are not necessarily
> merged. See this as an example:
> https://src.fedoraproject.org/rpms/rust-bstr/blob/master/f/rust-bstr.spec#_17
> https://github.com/BurntSushi/bstr/pull/23
>
>
> To sum up the 2nd problem: we are using dnf instead of the upstream
> package manager to install dependencies. These two approaches can be
> incompatible (and they are in case of Rust).

That's not true. Due to the name-version namespacing that Cargo uses,
it's pretty easy to create "compat" packages for different versions of
a library.
This approach is in use in fedora *today*, and it's pretty easy to do
- I've done it myself.
Using "compat" packages also maps upstream versions to RPM versions
exactly, so I don't understand why you call rpm/dnf and Cargo
incompatible here.

> The 3rd problem I see is that issues like this are not going away, they
> are only going to get worse as other ecosystems emerge. e.g. if the
> Swift language became popular (for Linux development) it would again
> have it’s own package manager and probably its own set of issues in
> relation to our build system. (I mention Swift specifically because it
> is a compiled language that have stable ABI only for std, other
> libraries are statically linked)

Of course, not every language ecosystem is equally well-suited for
distribution packaging.
In my experience, C, C++, Python, and Rust libraries all map to RPM
packages pretty well due to the upstream's design of "package
management" (or lack thereof, in the case of C / C++). The only thing
we can really do about this, is work with upstream projects to improve
suitability with distribution packaging.

> Now, I’d like to point out that Go and Rust packaging works well in
> Fedora due to the enormous effort of certain people and I very much
> admire the work they do. But on the other hand I’m afraid where the
> ecosystem would go without them. This is where we get to the situation
> in the enterprise derivatives, specifically RHEL and CentOS. Their
> solution to this problem is not to package all libraries separately but
> to bundle all libraries directly into source RPMs of each executable. So
> the bundling is not present only on the binary file level, but also on
> the source RPM level. Go went even further in this case and it is common
> to bundle all the dependencies as a source code directly in the upstream
> repository. See this repo as an example:
> https://github.com/containers/libpod/tree/master/vendor

I agree that in some cases, using vendored dependencies is the only
workable solution. I ship one such package myself (syncthing), but
only because upstream frequently bumps or adds new dependencies, and I
could not keep up with packaging everything separately (or some
packages were not maintained by me and were outdated).

However, Go packaging is now in a pretty good state in fedora compared
to 1-2 years ago, with pretty good tooling in place to make packaging
easier.
Rust packaging is a bit special here, since Igor decided to only
package things for rawhide, not do compat packages, and submit stable
builds via koji hackery. I've talked with him about this situation,
but we disagree about the approach to take for packaging rust for
stable releases (where I wouldn't mind keeping compat packages around
and, in general, do things like other language ecosystems do them,
e.g. only introduce big version bumps of libraries in rawhide).

> It is fair to say, that my first motivation was the current state of
> packaging in RHEL but I’d prefer to discuss this in Fedora first.
>
>
> The proposal itself is fairly simple: Let’s stop packaging all Go and
> Rust libraries into RPM and install them to the buildroot in the
> upstream format instead.

As I said (and others have pointed out as well), this is not possible
right now, primarily because automation cannot verify licensing and
write and apply necessary patches without human intervention. And when
you start curating your own Cargo registry, you might as well just
package them as RPMs ... and the whole "use upstream format instead"
probably won't work for Go unless you want to spin up fake github.com
/ bitbucket.com / gitlab.com servers for Go to download sources from.

> The specific implementation is up for a discussion but I think it is
> logical to start by asking what features do we want from the build
> system? My answers are:
>
>
>   * We want to know what exactly was used to build the RPM to ensure
> integrity. This is possible with upstream tarballs as well as with RPMs.
> Just store a hash of the tarball.
>   * There should be no maintenance cost. If we would avoid modifying the
> upstream package it would be the ideal case.
>   * It should be possible to patch the library in case of severe issues
> like CVEs. This is a contradiction to the previous point, but it could
> be solved by unpacking the upstream package into a git repository and
> creating a new, modified package in upstream format from it.

I'd argue that effectively maintaining a downstream fork is a bigger
maintenance burden than building a normal RPM package with a patch
file.

>   * It should be possible to run the build locally in exactly the same
> way Koji does it. This is just about exposing our “registry” of packages
> to the public Internet.

That won't work for Go, as explained above (since go downloads sources
based on import path, which is just a git repository somewhere).

> Finally, the implementation could be something like this:
> A service like release-monitoring could monitor the upstream projects
> for new releases (e.g. NPM has a RSS feed). Every time there is a new
> release it would automatically synchronize our own Fedora-specific
> registry, which would in turn be accessible in buildroot. Then the RPM
> macros like “cargo_build” could be modified to use this registry.
> If we wanted to have the possibility to patch these libraries we could
> synchronize the upstream release into our git repository and generate
> packages in upstream format from it.
>
>
> What do you think about the way we build RPM packages for Go and Rust?
> Do you see other solutions or is it ok the way it is? (Please do not
> suggest to “fix” the upstream communities)

First, why not?
Additionally, the Go project has for years been working on a module
system that would make these things easier, and Rust/cargo already
maps quite nicely onto RPM packaging ...

> Thanks for your opinions!
> Martin
>
>
> FAQ:
>   * Does it mean you want to get rid of -devel subpackages for C libraries?
>
> No. First of all C language does not have a single package manager and
> it is still common to install dependencies using the distro specific
> package manager. But packaging into RPM also comes with the advantage of
> having shared libraries so in this case it has a positive effect on the
> end-user experience. Rust and Go libraries on the other hand are mostly
> useless for end-users.

They might be useless for end users, but they still provide benefit
for the distribution and packagers.
Primarily, it provides a single "source of truth" for package dependencies.
Secondarily, it provides a consistent way to run test suites for *all*
libraries. When using "bundled" or "upstream" dependencies, the test
suites for the *libraries* are never run. When you package them
separately, the test suites are run for everything. This ensures
quality, and lets packagers spot regressions and breakage sooner.

>   * I prefer to install development libraries using the distro package
> manager instead of the upstream package manager. Why do you want to
> change it?
>
> This is the case for C development, but it is different in most of the
> modern languages. For example we ship Python packages, but we discourage
> people from using them for their own development. Python developers are
> instead encouraged to use pip to create a virtual environment and use
> upstream packages. In the case of Rust, using the system libraries would
> be much harder than using the upstream package manager.

I don't know how others do this, but I exclusively develop and run my
projects against the distro's python3 packages. That's where I expect
my projects to run, so that's what I'm developing them against. I've
never used pip or virtualenv to get dependencies.

Fabio

>   * Does it mean you want to get rid of Rust packages like ripgrep.
>
> No. The end user experience stays unchanged. Packages that we ship to
> Fedora users must be in RPM format, it is only the buildroot that changes.
>
> Notes:
> [1] Please don’t discuss if it is a good idea or not. This is a
> discussion for upstream of those languages.
> [2] Again, please don’t discuss static vs. dynamic linking here.
> [3] https://stephencoakley.com/2019/04/24/how-rust-solved-dependency-hell
> _______________________________________________
> devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux