Skip to content

Replace Portage-Stable with Gentoo - #4294

Draft
t-lo wants to merge 46 commits into
mainfrom
t-lo/portage-stable-to-gentoo
Draft

t-lo wants to merge 46 commits into
mainfrom
t-lo/portage-stable-to-gentoo

Conversation

@t-lo

@t-lo t-lo commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

NOTE: When merging this please make sure to use a SQUASH MERGE.

This project aims to replace portage-stable with pure Gentoo.

Gentoo is imported as a git submodule from our self-rebasing tracking fork here: https://github.com/flatcar-hub/gentoo/

Auto-generated package masks are used to force use of coreos-overlay packages over Gentoo ones, even if newer versions are available in Gentoo. We're planning to integrate this feature into Portage directly, but that's out of scope for this PR,

What works:

  • bootstrap_sdk will build a Gentoo based SDK
  • build_packages, build_image, and image_to_vm.sh will build a qemu OS image (other vendors not tested but expected to work)
  • The OS image packages have only minor differences to the latest Alpha release - basically what's expected from updated packages in the Gentoo tree
  • The OS image files have only minor differences to the latest Alpha, in accordance with the updated packages from the Gentoo tree

How to use

  • Clone the repo, check out t-lo/portage-stable-gentoo
  • Run git submodule init; git submodule update
  • bootstrap a new SDK tarball
  • build an SDK container from the tarball
  • use that SDK container with run_sdk_container (use the -C ... command line option) to build OS images

Testing done

Built SDK container and OS images. No Kola runs yet.

t-lo and others added 30 commits September 18, 2026 16:41
This change is the first commit in a long (and potentially futile)
journey to move from portage-stable to plain Gentoo.

It introduces a Gentoo git submodule and respective .gitmodule config.
A cursory search+replace of portage-stable => gentoo was started in the
scripts root and build library (but not completed).

What works:
- Start SDK container
- run ./update_chroot --toolchain_boards="amd64-usr arm64-usr"

What doesn't:
- everything else
- update_chroot removes cross compiler toolchains
- setup_board is broken because it cannot find or build cross compiler toolchains

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
It used to just pick the first overlay.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This change adds a workaround required to build a gentoo-based SDK
container from a protage-stable based one using update_sdk_container.

Current state of this branch:
- Gentoo based SDK can be built from existing SDK using update_sdk_container
- OS packages and image can be built using the new SDK container

TODO:
- Build a full SDK from scratch, see if that works
- Integrate devcontainer initialisation with gentoo changes
  (ship a full snapshot of Gentoo ebuild contents maybe?)
This matches what Gentoo does. There is no reason to be different here.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This change switches from upstream Gentoo to our fork at
https://github.com/flatcar-hub/gentoo.

If you're using the previous submodule, after pulling this change, run
* rm -rf .git/modules/sdk_container
* rm -rf sdk_container/src/third_party/gentoo
* git submodule sync
* git submodule update --depth=1

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
This ensures that we don't get caught out by Gentoo adding new packages
that we already have in our overlays.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
The revbump did not involve a rebuild. If we need to rebuild, we can use
_p rather than -r.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This was redundant even before we started moving away from
portage-stable.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
We cannot update the GLSA metadata ahead of the rest of the Gentoo repo
now that it is a submodule.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This change removes the crossdev initialisation workaround from
sdk_lib/Dockerfile.sdk-update as it is not needed anymore. We also add a
new command line option to update_sdk_container_image to skip building
arch container images, which speeds up the build.
These haven't been relevant since portage-stable and coreos-overlay were
submodules. show-changes no longer uses them.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
How did I miss this!?

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This change has Dockerfile.sdk-update regenerate chroot, crossdev, and
board configurations before trying anything else, to allow for more
thorough changes.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
We stopped committing the md5-cache to the repo many years ago. We may
still want to generate it, but it should never be committed.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
I doubt anyone uses this script now, but it still works.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
I can't find any reference to this anywhere, and it hasn't changed since
2019. The commit message style it uses is not present in the scripts
repo at all.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This hasn't worked since portage-stable and coreos-overlay were
submodules. We now have gentoo as a submodule, but it generally won't
have our own tags and branches.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
The dev container only includes the repository profiles and metadata
rather than actual ebuilds, so increased size from switching to the
upstream gentoo repo is not a concern.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
To update your local system:
- git submodule init # not needed if already on gentoo submodule
- git submodule update --depth=1
- ./run_sdk_container -t # to pull new nightly SKD; exit the container after pull
- ./update_sdk_container_image 4824.0.0-nightly-20260915-2100-gentoo

You can now run the new Gentoo SDK container with
./run_sdk_container -t -C ghcr.io/flatcar/flatcar-sdk-all:4824.0.0-nightly-20260915-2100-gentoo

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This repoints the gentoo submodule to the latest without actually
cloning it. The latest is determined with `git ls-remote`.

A PR is still created, but an existing open PR is reused to prevent
these from accumulating now that the job is run every weekday.

A Jenkins build is automatically triggered by the PR.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
The dev container has always included the Portage profiles and metadata,
but this no longer appears necessary. This can be fetched later by
emerge-gitclone, along with the ebuilds.

Putting everything (including scripts) under /var/lib/portage is also
weird. Use the default Portage locations, except for the package
repositories, which now reference the repositories within
/home/core/scripts.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
We want to optionally be able to use Gentoo stage3 tarballs for seeds,
and we should verify the digests when fetching them. They no longer use
MD5 or SHA1 like we currently do, and these are no longer worth a damn.

Also take the opportunity to just clean this code up. It's not used
anywhere else, and the make_digests function is not used at all.

We won't be able to use an existing Flatcar SDK tarball to build a new
SDK due to the mismatching digests, but we'll probably need to use a
Gentoo stage3 to migrate away from portage-stable anyway.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
When a URL is given, the digests are still fetched and verified. Gentoo
publishes them in the same way that we do.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>
Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Repository-name migration gaps leave package-update and prefix workflows unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 4 High severity

Open (4)

Comment thread .gitmodules
This change removes prefix-overlay and updates PREFIX.md to call out
that porting is needed. It explicitly does not remove `setup_prefix` and
`build_library/prefix_util.sh` because this code is still of value,
though in need of porting.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Copilot AI review requested due to automatic review settings September 23, 2026 13:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 5 High severity

Open (5)

Comment thread sdk_container/src/third_party/coreos-overlay/metadata/layout.conf
A local tarball is always used for stage 4, so this was broken in the
mainline case.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Copilot AI review requested due to automatic review settings September 23, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Critical repository-consumer breakages and the missing Gentoo gitlink must be resolved.

Review effort: Lite
Findings: 4 High severity

Open (4)
Resolved since last review (1)

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Copilot AI review requested due to automatic review settings September 24, 2026 06:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The changes require final human review because they are too complex or risky for automated approval.

Review effort: Lite
Findings: None

Resolved since last review (4)

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Copilot AI review requested due to automatic review settings September 24, 2026 07:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The changes require final human review because they are too complex or risky for automated approval.

Review effort: Lite
Findings: None

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Copilot AI review requested due to automatic review settings September 25, 2026 12:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The changes require final human review because they are too complex or risky for automated approval.

Review effort: Lite
Findings: None

A typo turned this from an array into a string.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Copilot AI review requested due to automatic review settings September 25, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

One or more issues must be addressed before approval.

Review effort: Lite
Findings: None

This branch is waiting to be deployed

1 waiting (outdated) deployment
development — 153b4ff2 Waiting Sep 24, 2026 by t-lo via Wait for approval #5939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants