A distributed binary package building and management system for Gentoo Linux with advanced configuration transfer capabilities. The system automatically provisions cloud infrastructure or Docker containers to build packages with custom USE flags and configurations when they're not available in the binary package server.
- Configuration Transfer: Transfer complete Portage configurations (USE flags, keywords, masks, etc.) to build instances
- Flexible Build Environments: Support for Docker containers and cloud infrastructure (Aliyun, GCP, AWS)
- Package Customization: Build packages with specific USE flag combinations
- Automated Infrastructure: On-demand provisioning of build resources
- RESTful API: Complete API for integration with existing tools
- Web Dashboard: Real-time monitoring and management interface
The Portage Engine consists of five main components:
Central server that handles package queries, build requests, and coordinates infrastructure provisioning.
Features:
- Package availability queries
- Build request management with configuration bundles
- Multi-cloud infrastructure provisioning (Aliyun, GCP, AWS)
- Docker-based local builds
- Binary package synchronization
- RESTful API
Advanced system for collecting, packaging, and applying Portage configurations.
Features:
- Read system configuration: Direct import from
/etc/portagedirectory - Collect user's Portage configuration (package.use, make.conf, etc.)
- Package configuration into portable bundles
- Transfer and apply configuration to build instances
- Support for package-specific USE flags and environment variables
- Repository configuration management
- Ensure USE flag consistency between systems
📚 See detailed documentation: Using System Portage Configuration
Automated cloud infrastructure provisioning system that creates build machines on-demand.
Supported Providers:
- Aliyun (Alibaba Cloud)
- Google Cloud Platform (GCP)
- Amazon Web Services (AWS)
- Docker containers (local builds)
Command-line client for submitting build requests with custom configurations.
Features:
- Submit builds with configuration files
- Generate configuration bundles
- Monitor build status
- Support for batch operations
Web-based monitoring and management interface for the build cluster.
Features:
- Real-time cluster status monitoring
- Build job tracking
- Instance management
- Authentication support (with anonymous access option)
- Go 1.21 or later
- Docker (optional, for local container builds)
- Gentoo Linux (for client)
- Cloud provider credentials (Aliyun/GCP/AWS) (optional)
# Clone the repository
git clone https://github.com/slchris/portage-engine.git
cd portage-engine
# Download dependencies
go mod download
# Build all components
make build
# Binaries will be in bin/:
# - portage-server
# - portage-dashboard
# - portage-builder
# - portage-client# 1. Start the server (Docker mode for local testing)
export USE_DOCKER=true
export DOCKER_IMAGE=gentoo/stage3:latest
./bin/portage-server -config configs/server.yaml
# 2. In another terminal, submit a build
./bin/portage-client \
-server=http://localhost:8080 \
-package=dev-lang/python \
-version=3.11 \
-use=ssl,threads,sqlite
# 3. Monitor via Dashboard (optional)
./bin/portage-dashboard -config configs/dashboard.yaml
# Visit http://localhost:8081# Build Python 3.11 with specific USE flags
./bin/portage-client \
-package=dev-lang/python \
-version=3.11 \
-use=ssl,threads,sqlite,readlineNew Feature: Use your system's /etc/portage configuration directly!
# Build with your exact system configuration
./bin/portage-client \
-portage-dir=/etc/portage \
-package=dev-lang/python:3.11
# This will:
# ✓ Read all your package.use settings
# ✓ Include package.accept_keywords
# ✓ Apply your make.conf settings
# ✓ Use your repository configurations
# ✓ Ensure USE flag consistency
# Generate a configuration bundle from your system
./bin/portage-client \
-portage-dir=/etc/portage \
-package=dev-lang/python:3.11 \
-output=python-system-config.tar.gzBenefits:
- ✅ Guarantees USE flag consistency with your system
- ✅ No manual configuration needed
- ✅ Includes all package-specific settings
- ✅ Respects keywords and masks
See System Configuration Usage Guide for details.
- Create a configuration file
my-config.json:
{
"package_use": {
"dev-lang/python:3.11": ["ssl", "threads", "sqlite"],
"sys-devel/gcc": ["openmp", "fortran"]
},
"make_conf": {
"MAKEOPTS": "-j8",
"FEATURES": "buildpkg parallel-install"
}
}- Submit the build:
./bin/portage-client \
-config=my-config.json \
-package=dev-lang/python \
-version=3.11# Create a configuration bundle without building
./bin/portage-client \
-config=my-config.json \
-package=dev-lang/python \
-output=python-build.tar.gz
# Inspect the bundle
tar -tzf python-build.tar.gzFor more examples, see docs/EXAMPLES.md
Edit configs/server.yaml:
port: 8080
binpkg_path: /var/cache/binpkgs
max_workers: 5
cloud_config:
default_provider: gcpEdit configs/dashboard.yaml:
port: 8081
server_url: http://localhost:8080
auth_enabled: true
allow_anonymous: trueEdit configs/client.conf:
PORTAGE_ENGINE_URL=http://your-server:8080
CLOUD_PROVIDER=gcp./bin/portage-server -config configs/server.yaml./bin/portage-dashboard -config configs/dashboard.yaml# Configure portage integration
sudo ./scripts/portage-client.sh configure
# Install a package (query/build/install automatically)
sudo ./scripts/portage-client.sh install gcc 13.2.0
# Query package availability
./scripts/portage-client.sh query gcc 13.2.0
# Request a build
./scripts/portage-client.sh build gcc 13.2.0
# Check build status
./scripts/portage-client.sh status <job-id>Endpoint: POST /api/v1/packages/query
Request:
{
"name": "gcc",
"version": "13.2.0",
"arch": "x86_64",
"use_flags": ["openmp", "nls"]
}Response:
{
"found": true,
"package": {
"name": "gcc",
"version": "13.2.0",
"arch": "x86_64",
"use_flags": ["openmp", "nls"],
"path": "/binpkgs/x86_64/gcc-13.2.0.tbz2",
"checksum": "sha256:..."
}
}Endpoint: POST /api/v1/packages/request-build
Request:
{
"package_name": "gcc",
"version": "13.2.0",
"arch": "x86_64",
"use_flags": ["openmp", "nls"],
"cloud_provider": "gcp",
"machine_spec": {
"region": "us-central1",
"zone": "us-central1-a"
}
}Response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued"
}Endpoint: GET /api/v1/packages/status?job_id=<job_id>
Response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "building",
"package_name": "gcc",
"version": "13.2.0",
"arch": "x86_64",
"created_at": "2025-12-11T10:00:00Z",
"updated_at": "2025-12-11T10:05:00Z",
"instance_id": "gcp-12345678"
}portage-engine/
├── cmd/
│ ├── server/ # Server entry point
│ └── dashboard/ # Dashboard entry point
├── internal/
│ ├── server/ # Server implementation
│ ├── binpkg/ # Binary package management
│ ├── builder/ # Build management
│ ├── iac/ # Infrastructure provisioning
│ └── dashboard/ # Dashboard implementation
├── pkg/
│ └── config/ # Configuration management
├── scripts/
│ └── portage-client.sh # Client script
├── configs/ # Configuration files
├── go.mod
├── go.sum
├── Makefile
└── README.md
go test ./...This project follows Google's Go code style guide:
- Use
gofmtfor formatting - Follow effective Go guidelines
- Write clear, concise comments
- Use meaningful variable names
# Build Docker images
docker build -t portage-engine-server -f Dockerfile.server .
docker build -t portage-engine-dashboard -f Dockerfile.dashboard .
# Run with Docker Compose
docker-compose up -dkubectl apply -f deployments/kubernetes/MIT License
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes following the code style
- Write tests for new functionality
- Submit a pull request
For issues and questions:
- GitHub Issues: https://github.com/slchris/portage-engine/issues
- Documentation: https://github.com/slchris/portage-engine/wiki
- Gentoo Linux community
- Google Go style guide
- Cloud providers (Aliyun, GCP, AWS)