JuliaPackaging / BinaryBuilderBase.jl

https://juliapackaging.github.io/BinaryBuilderBase.jl/stable
MIT License
11 stars 31 forks source link

APT package source #341

Open stemann opened 10 months ago

stemann commented 10 months ago

The purpose of this issue is to discuss the possibility of adding support for an APT package source to BinaryBuilder(Base).

An APT package source would allow piggy-backing on APT distributions of packages - to get files from one or more APT-packages, in addition to the dependencies of said packages.

A proof-of-concept was parked at https://github.com/IHPSystems/Yggdrasil/blob/stemann/cuda_10.2_aarch64-linux-gnu_with_apt_pkg_source, in the commit https://github.com/IHPSystems/Yggdrasil/commit/19e4f4dd41529504e5ad93943400a200facc3f22.

An APT package source in https://github.com/IHPSystems/Yggdrasil/blob/stemann/cuda_10.2_aarch64-linux-gnu_with_apt_pkg_source/C/CUDA/CUDA_full%4010.2/build_tarballs.jl#L23-L36 is defined as follows:

    AptPkgSource(
        [
            AptSource("https://repo.download.nvidia.com/jetson/common", "r32.6", ["main"])
        ],
        [
            AptKey("http://repo.download.nvidia.com/jetson/jetson-ota-public.asc", "3C6D1FF3100C8C3ABB0869C0E6543461A9996195"),
        ],
        [
            AptPkgSpec("cuda-toolkit-10-2", v"10.2.460-1", "4c047e83b805ce9d76cbc5a2de2177548d8a63cd025e03f944705bf653e82828")
        ],
        "aarch64-linux-gnu";
        selections = [
            AptPkgSpec("build-essential")
        ]
    )

where the positional arguments:

  1. AptSource is a source for APT.
  2. AptKey is a public key for APT.
  3. AptPkgSpec is an APT package spec. that defines the APT package name, the APT package version, and a hash for the (top-level) dpkg-file.
  4. Is the platform target for which packages are retrieved... (the definition of this is a bit vague at this point in time...)

and selections is a list of APT packages assumed to already be provided (installed).

I.e., the AptPkgSource should include all packages defined by the list of AptPkgSpec (the 3rd arg.) and their dependencies, excluding the list of packages defined by selections (and their dependencies).

As mentioned in https://github.com/JuliaPackaging/Yggdrasil/pull/4349#discussion_r820449821, a proper implementation would likely require separate Apt.jl package and AptPkgSources.jl packages:

Separate Apt.jl package, with a companion AptPkgSources.jl package to bridge Apt.jl to BinaryBuilder(Base) (at some point adding AptPkgSources to Yggdrasil build env.)

where Apt.jl could start out as a simple, pure-Julia version (i.e. an adapted form of the POC), but would likely at some point need to instead use and wrap libapt to get the dependency resolution properly done.