Page MenuHomePhabricator

Support installing packages from non-upstream repo and/or build pack for C/C++code
Open, MediumPublicFeature

Description

Feature summary (what you would like to be able to do and where):

https://wikitech.wikimedia.org/wiki/Help:Toolforge/Building_container_images has limited language support which does not include C/C++.

https://wikitech.wikimedia.org/wiki/Help:Toolforge/Building_container_images#Installing_Apt_packages only supports upstream reports.

Enabling deploying from a PPA or compiling C/C++ code would allow more tools to run in a supported manner.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

https://github.com/cluebotng/core/ is currently deployed by copying the pre-build binaries onto the NFS share and then executing them in a container.

This is somewhat fragile as OS upgrades can break the dependencies (even though it is statically compiled).

It has been build as a package under https://launchpad.net/~damianzaremba/+archive/ubuntu/cluebotng-core, however this is not usable in toolforge.

Upstream docs imply that something along the lines of

cat project.toml
[_]
schema-version = "0.2"

[com.heroku.buildpacks.deb-packages]
install = [
  "cluebotng-core",
]

[[com.heroku.buildpacks.deb-packages.sources]]
uri = "https://ppa.launchpadcontent.net/damianzaremba/cluebotng-core/ubuntu"
suites = ['noble']
components = ['main']
arch = ['amd64']
signed_by = """-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Hostname:
Version: Hockeypuck 2.2

xsFNBGiNg+8BEAC0AFIqKNTH8POpgDavyvd+gi1QU1pbph3LHblViGl4/s1/PEUl
Jb8Ofc96H6HgMOY7D6NpZXWGrF+AyY/c+coRKVZF+O4tjh3UsxkYIc+FTamkQgRS
cRVeczQVT0j+RuVP68cT+AeH8fSu1QPV8uYN5fss1vqRBm/UOOO6pSqjyaHDu+LS
ZgAPj3EWfLJuhy0y7T5vD/Gv/cjuJNo+vLaO+ibCAZQoYYxxERSVTPapvnsaP35s
vijVc6nnaFc37k9xQtbAI3oLvyUt/QGs5fHc+HgdRMeJMxhh6ORv2NApkDVyM52b
N2nieiI3WIkHppH/CHmiasnwyeun7kDio8k77vTrhZXsPQD/zkT3lXAVACzl9jzG
BSggasI9eP/kR7L6P74NYwiA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GVtDt6aKUB26+YOkL/BG+vx9zdY5HLl92yXaWWySkKrcSusOv7m
yL94
=mlmS
-----END PGP PUBLIC KEY BLOCK-----"""

Would allow this, but it doesn't work currently.

Benefits (why should this be implemented?):

Enable "supported" execution of tools that have existed for > 12 years.

Allowing package building and/or ppa would provide a lot of flexibility to users.

Event Timeline

Restricted Application added subscribers: Sadads, Aklapper. · View Herald Transcript

C/C++ support in the buildpack world is quite overlooked yep, I fear that if we want to have support for it we will have to build our own buildpack for it, it might have to be quite limited though, relying on the apt buildpack (or the succession of it) to install the dependencies and setup the environment of sorts.

I did experiment with that sort of concept using a "Python" setup with poetry running a custom "setup.py" which dealt with the compiling; the primary blocker was in getting the Apt dependencies installed (paths are a bit of a mess which makes the linker unhappen) and it was messy due to Poetry requiring at least 1 python dependency and checking that the Python package is created post setup, but conceptually would work.

Supporting debian packages (either built within toolforge or from ppa) would cover my use case.

Actually the code does not use autoconf or cmake, which I suspect a build pack might impose... that could be added if needed, in the case a custom build pack was created.

I wasn't really planning on doing this today... but after some playing around https://github.com/InfraBits/cmake-buildpack successfully compiles a C++ application (relying on https://gitlab.wikimedia.org/repos/cloud/toolforge/buildpacks/apt-buildpack for the build dependencies).

A minimal application:
Source: https://github.com/InfraBits/hello-world-cmake
Build: https://github.com/InfraBits/cmake-buildpack/actions/runs/16729809127/job/47354891470
Result: ghcr.io/infrabits/cmake-buildpack/hello-world-app:2b1be32a45c7a397c215062a1e6ef561596d71c1

Is that (or similar) something you would consider adding to the supported builds (even if on an "opt-in" basis).

And building what I actually need to build;
Source: https://github.com/cluebotng/core/tree/feature/support-running-in-pack
Build: https://github.com/InfraBits/cmake-buildpack/actions/runs/16730957326/job/47358655955
Result: ghcr.io/infrabits/cmake-buildpack/cluebotng-core:99ded27030627d438faab46746b62d595d2b7383

T363033: [builds-builder] Support using custom buildpacks would be one way to work out what is needed to build cluebotng-core.

This would be an option, though I'd favour generic language support and then I can deal with my bits within the build framework; I read the above ticket more as maintaining long term tool specific logic.

T363033: [builds-builder] Support using custom buildpacks would be one way to work out what is needed to build cluebotng-core.

This would be an option, though I'd favour generic language support and then I can deal with my bits within the build framework; I read the above ticket more as maintaining long term tool specific logic.

I mostly wanted https://github.com/kr/heroku-buildpack-inline or similar so that any repo could implement its own custom builder logic.

Upstream docs imply that something along the lines of

We still have heroku/deb-packages 0.1.3 when using --use-latest-versions. The custom repo support was added to heroku/deb-packages 0.2.0.

T363027: [builds-builder] Support adding repositories for Apt buildpack is a similar request to be able to install apt packages from arbitrary apt repos.

T363033: [builds-builder] Support using custom buildpacks would be one way to work out what is needed to build cluebotng-core.

Ah, I'm not too familiar with that, I will take a deeper look
This would be an option, though I'd favour generic language support and then I can deal with my bits within the build framework; I read the above ticket more as maintaining long term tool specific logic.

I mostly wanted https://github.com/kr/heroku-buildpack-inline or similar so that any repo could implement its own custom builder logic.

T363033: [builds-builder] Support using custom buildpacks would be one way to work out what is needed to build cluebotng-core.

This would be an option, though I'd favour generic language support and then I can deal with my bits within the build framework; I read the above ticket more as maintaining long term tool specific logic.

I mostly wanted https://github.com/kr/heroku-buildpack-inline or similar so that any repo could implement its own custom builder logic.

Ah, I'm not too familiar with that, I will take a deeper look

Upstream docs imply that something along the lines of

We still have heroku/deb-packages 0.1.3 when using --use-latest-versions. The custom repo support was added to heroku/deb-packages 0.2.0.

T363027: [builds-builder] Support adding repositories for Apt buildpack is a similar request to be able to install apt packages from arbitrary apt repos.

👍🏽 👍🏽 that explains some things.

Honestly I would rather deal with a pack (or indeed a Docker build as it is today), debian packaging (at least out of repo) is a bit painful (or maybe I just like rpm even after many years)

I wasn't really planning on doing this today... but after some playing around https://github.com/InfraBits/cmake-buildpack successfully compiles a C++ application (relying on https://gitlab.wikimedia.org/repos/cloud/toolforge/buildpacks/apt-buildpack for the build dependencies).

A minimal application:
Source: https://github.com/InfraBits/hello-world-cmake
Build: https://github.com/InfraBits/cmake-buildpack/actions/runs/16729809127/job/47354891470
Result: ghcr.io/infrabits/cmake-buildpack/hello-world-app:2b1be32a45c7a397c215062a1e6ef561596d71c1

Is that (or similar) something you would consider adding to the supported builds (even if on an "opt-in" basis).

That would be something quite acceptable yes :), I have imported it to our buildpacks repo, I have not yet given it a look though, I'll add a task to test/review/add it to the buildpacks we use:
https://gitlab.wikimedia.org/repos/cloud/toolforge/buildpacks/cmake-buildpack

Feel free to send MRs to it and such, if you change the github one let me know and I'll pull again.

As a workaround to get this running in a pack/container until we have a proper build pack, I'm pretending to be a Python project and extracting the .deb contents.

This is ugly, but slightly less so than downloading the binary (directly, but 1 layer of .deb indirection doesn't really matter) to NFS then running it from disk.

Noting here in case it's useful to others:

Note: neither of those require deps so is quite simple, though the same concept could be extended to handle apt based deps (similar to what the apt build pack is doing). The main clunge is needing to generate an empty python package to satisfy the build tooling, otherwise it 'just works'.

dcaro triaged this task as Medium priority.Aug 20 2025, 2:49 PM