Skip to content

emerge-gitclone: Rework to simply clone scripts + submodules into ~core - #25

Merged
chewi merged 3 commits into
flatcar-masterfrom
chewi/gentoo-repo
Sep 18, 2026
Merged

chewi merged 3 commits into
flatcar-masterfrom
chewi/gentoo-repo

Conversation

@chewi

@chewi chewi commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

The portage-stable and coreos-overlay repositories got absorbed into scripts a long time ago. Now portage-stable is being replaced by a gentoo repo submodule. This script now simply does a shallow single branch clone of scripts and any submodules. This will succeed, even if there are no submodules.

Storing scripts under /var/lib/portage was weird, so it is now cloned under ~core instead, with the Portage configuration pointing at the repositories within this location. It is now expected that this script is called as the core user rather than root.

This also adds an option to override the git revision, which is useful for testing.

@chewi chewi self-assigned this Sep 17, 2026
@chewi
chewi requested a review from a team as a code owner September 17, 2026 14:00
Copilot AI lite review requested due to automatic review settings September 17, 2026 14:00

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.

🔵 Needs a closer look

Shallow cloning does not reliably resolve abbreviated dev-build revisions.

Pull request overview

Reworks emerge-gitclone to shallow-clone scripts and submodules into /home/core/scripts, with optional revision overrides.

Changes:

  • Replaces separate repository handling with one scripts clone.
  • Adds recursive shallow submodule initialization.
  • Adds --revision support.
File summaries
File Summary
emerge-gitclone Implements the new clone location, submodule handling, cleanup, and revision override.

Review finding: abbreviated dev-build revisions may fail with shallow git clone --revision; full commit IDs or a fallback checkout path are needed.

Review details

Suppressed comments (1)

emerge-gitclone:51

  • The dev-build path still reduces release to the abbreviated -g<checksum> value (the example in the comment is only 8 hex digits), but this now passes that abbreviation directly to git clone --revision. Unlike the old full clone followed by local checkout, a revision-only clone has no local object database from which to resolve an arbitrary short SHA, so non-tagged dev builds can fail with an unknown revision/unadvertised object. Resolve and pass a full commit ID (or retain a fetch/checkout path for abbreviated dev-build revisions) before using this shallow clone mode.
        "--revision", ref,
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The portage-stable and coreos-overlay repositories got absorbed into
scripts a long time ago. Now portage-stable is being replaced by a
gentoo repo submodule. This script now simply does a shallow single
branch clone of scripts and any submodules. This will succeed, even if
there are no submodules.

Storing scripts under /var/lib/portage was weird, so it is now cloned
under ~core instead, with the Portage configuration pointing at the
repositories within this location. It is now expected that this script
is called as the core user rather than root.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This is useful for testing.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
git clone --revision requires a full SHA, so if a Flatcar dev build has
a -g suffix, we need to resolve the SHA using the GitHub API first.

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

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.

🟢 Approval recommended

No unresolved review issues were identified.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@t-lo t-lo left a comment

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.

LGTM, thank you for the fast turnaround!

@chewi
chewi merged commit 9a4c586 into flatcar-master Sep 18, 2026
2 checks passed
@chewi
chewi deleted the chewi/gentoo-repo branch September 18, 2026 13:27
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.

3 participants