Skip to content

Automate Ubuntu dependency baseline generation#824

Open
Aayushman-nvm wants to merge 14 commits intoprecice:masterfrom
Aayushman-nvm:issue617
Open

Automate Ubuntu dependency baseline generation#824
Aayushman-nvm wants to merge 14 commits intoprecice:masterfrom
Aayushman-nvm:issue617

Conversation

@Aayushman-nvm
Copy link
Copy Markdown
Contributor

@Aayushman-nvm Aayushman-nvm commented Feb 28, 2026

Automate Ubuntu dependency baseline generation

addresses #617

Approach

Repology's API is rate-limited and the dumps are too large (noted in the issue), so this uses Docker + apt-cache policy to query package versions directly from Ubuntu's apt repositories instead.

What's included

  • scripts/dependencies.yml — package list (required/optional), derived from the Ubuntu system guide
  • scripts/generate_ubuntu_baseline.py — queries each package version via Docker and writes _data/ubuntu-baseline.yml. Run manually at release time with python3 scripts/generate_ubuntu_baseline.py --lts 22.04 24.04. A --mock flag is available to test without Docker.
  • _data/ubuntu-baseline.yml — generated output, committed so Jekyll can reference it at build time
  • .github/workflows/generate-baseline.ymlworkflow_dispatch-only workflow for auto regenerating and adding ubuntu-baseline.yml list locally

How I tested

  • Ran debug.yml (a temporary workflow, not included in this PR) on the issue617 branch to verify all packages in dependencies.yml are actually available and resolvable on both Ubuntu 22.04 and 24.04 via apt.
  • Ran the generation script locally with Docker to produce the committed ubuntu-baseline.yml and confirmed the versions match what apt-cache policy reports inside the containers.

Notes

  • The package list in dependencies.yml can be updated independently of the script — easy to add or remove packages without touching any logic.
  • Page integration content/docs/installation/building-from-source/installation-source-dependencies is intentionally left untouched for now. Happy to wire the data file into the dependencies page however you'd prefer.

Screenshots:
Core:
image

Autogenerated:
image

@MakisH MakisH added technical Technical issues on the website GSoC Contributed in the context of the Google Summer of Code labels Mar 2, 2026
@MakisH MakisH changed the title Automate Ubuntu dependency baseline generation (closes #617) Automate Ubuntu dependency baseline generation Mar 14, 2026
@precice-bot
Copy link
Copy Markdown
Contributor

This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:

https://precice.discourse.group/t/introduction-website-modernization/2852/1

Copy link
Copy Markdown
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

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

Thank you for contributing! We are still discussing in #617, but this PR already does something useful in the respective direction, and I think we can merge it independently of the conclusion.

This PR addresses #617 by automatically generating a list of relevant packages provided in an Ubuntu release with a Python script. A manually-triggered CI workflow executes that script and checks the respective YAML file into this repository.

The Python script executes an apt-cache policy for each package in a Docker container, which might be a bit overkill, but works. Inputs are specified in dependency.yml, the output is saved into _data/ubuntu-baseline.yml. This PR already adds such a file, which could in principle then be rendered on the website.

See some suggestions, which should all be easy to implement.

Comment on lines +3 to +7
import subprocess
import yaml
import argparse
from pathlib import Path
from datetime import datetime, UTC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This Python script would still need a requirements.txt defining PyYAML as a dependency (probably PyYAML==6). And then change the CI to replace pip install PyYAML with pip install -r requirements.txt.

Comment on lines +64 to +65
def get_version_mock(package):
return "0.0.0-mock"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the use case for this one? It just assigns 0.0.0-mock to every dependency.

f"ubuntu:{ubuntu_version}",
"bash",
"-c",
f"apt-get update -qq && apt-cache policy {package} | grep Candidate | awk '{{print $2}}'",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While this will give the package name, which includes the respective upstream version, it also includes other elements, such as the Debian package revision. For example, 1.83.0.1ubuntu2 or 2.9.14+dfsg.

I am not sure if these would be useful for the user on the website, or rather confusing. In principle, the first three digits should work (all these packages use semantic versioning).

Comment on lines +24 to +25
git config user.name github-actions
git config user.email github-actions@github.com
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In other workflows (update-submodules.yml and update-discourse-data.yml), we use:

Suggested change
git config user.name github-actions
git config user.email github-actions@github.com
git config --local user.name "precice-bot"
git config --local user.email "info@precice.org"

Comment on lines +19 to +20
python3 scripts/generate_ubuntu_baseline.py \
--lts 22.04 24.04
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since precice/precice#2564, the baseline has shifted to 24.04, and we have added 26.04. For the current version (3.4.x), we still need to keep 22.04 listed.

Let's make this:

Suggested change
python3 scripts/generate_ubuntu_baseline.py \
--lts 22.04 24.04
python3 scripts/generate_ubuntu_baseline.py \
--lts 22.04 24.04 26.04


jobs:
generate:
if: github.actor != 'github-actions[bot]'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this line?

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is already a v6:

Suggested change
- uses: actions/checkout@v4
- uses: actions/checkout@v6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ideally, I would put this script (everything you currently have into scripts/) into a directory specific to this script (scripts/baseline/).

Comment on lines +109 to +114
parser.add_argument(
"--lts",
nargs="+",
required=True,
help="Ubuntu LTS versions to query (e.g. 22.04 24.04)",
)
Copy link
Copy Markdown
Member

@MakisH MakisH May 5, 2026

Choose a reason for hiding this comment

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

Why restrict that to LTS releases? I would rather name the option --release. For example, --lts 25.10 also works, even though that is not an LTS release.

"-c",
f"apt-get update -qq && apt-cache policy {package} | grep Candidate | awk '{{print $2}}'",
]
raw = run_command(cmd)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Before running this command, I would expect some output with the command to run, especially since this might take a while. This would also be useful for debugging and for understanding what this script does.

Copy link
Copy Markdown
Member

@fsimonis fsimonis left a comment

Choose a reason for hiding this comment

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

As described in the issue, we have an API key for pkgs.org.
There is no reason to probe a Docker container to get the package versions.

Also, the distinction between optional and required packages is unnecessary. It is handled where we display the information.

Furthermore, we are interested in the version of the packaged software, not the package. Meaning that we want 1.83.0, not 1.83.0.1ubuntu2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants