Skip to content

Setting Up Host Environment for Cross Architecture Target Image Composition#349

Closed
srmungar wants to merge 11 commits intomainfrom
srmungar_cross_arch_hostenv
Closed

Setting Up Host Environment for Cross Architecture Target Image Composition#349
srmungar wants to merge 11 commits intomainfrom
srmungar_cross_arch_hostenv

Conversation

@srmungar
Copy link
Copy Markdown
Contributor

Merge Checklist

All boxes should be checked before merging the PR

  • [] The changes in the PR have been built and tested
  • [] Ready to merge

Description

Any Newly Introduced Dependencies

How Has This Been Tested?

Copilot AI review requested due to automatic review settings January 15, 2026 23:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds cross-architecture build support by setting up the host environment to handle different target architectures. The implementation detects the host OS distribution, installs necessary emulation tools (qemu-user-static), and configures binfmt_misc for cross-architecture execution.

Changes:

  • Added OS distribution detection functionality with support for multiple Linux distributions and package managers
  • Implemented qemu-user-static installation logic for cross-architecture emulation
  • Created comprehensive host environment setup for various architecture combinations (x86_64, aarch64, armv7, riscv64, ppc64le, s390x, mips64)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/utils/system/system.go Added OS distribution detection types and functions, qemu-user-static installation, and commented-out initial SetupHostEnv implementation
internal/utils/system/hostenv.go New file implementing cross-architecture host environment setup with architecture-specific handlers and emulation configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +345 to +351
func contains(s, substr string) bool {
return len(s) > 0 && len(substr) > 0 &&
(s == substr || len(s) > len(substr) &&
(s[0:len(substr)] == substr ||
s[len(s)-len(substr):] == substr ||
findSubstring(s, substr)))
}
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The contains function reimplements string matching logic that is already available in Go's standard library. Use strings.Contains(s, substr) instead, which is more efficient, readable, and well-tested. This would also eliminate the need for the findSubstring helper function.

Copilot uses AI. Check for mistakes.
Comment on lines +354 to +361
func findSubstring(s, substr string) bool {
for i := 0; i <= len(s)-len(substr); i++ {
if s[i:i+len(substr)] == substr {
return true
}
}
return false
}
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

This helper function is unnecessary and can be removed if contains is replaced with strings.Contains from the standard library. The current implementation duplicates functionality that is already optimized in the standard library.

Copilot uses AI. Check for mistakes.
Comment thread internal/utils/system/system.go Outdated
@srmungar srmungar closed this Jan 30, 2026
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.

2 participants