added files
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m19s

This commit is contained in:
robojerk 2025-07-21 03:08:18 +00:00
parent 141193e345
commit 46de31a373
4 changed files with 515 additions and 0 deletions

View file

@ -0,0 +1,134 @@
name: Build libostree Backport
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
env:
UBUNTU_VERSION: "24.04"
OSTREE_VERSION: "2025.2"
BACKPORT_SUFFIX: "~noble1"
jobs:
build-libostree-backport:
name: Build libostree Backport
runs-on: ubuntu-latest
container:
image: ubuntu:latest
steps:
- name: Setup build environment
run: |
apt update -y
apt install -y devscripts build-essential wget git
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev
cp -r /tmp/libostree-dev/* .
cp -r /tmp/libostree-dev/.* . 2>/dev/null || true
- name: Add source repositories
run: |
echo "deb-src http://us.archive.ubuntu.com/ubuntu/ noble main universe" | tee /etc/apt/sources.list.d/noble-sources.list
apt update -y
- name: Create backport directory
run: |
mkdir -p /opt/Projects/ostree-backport-noble
cd /opt/Projects/ostree-backport-noble
- name: Download libostree source
run: |
cd /opt/Projects/ostree-backport-noble
POOL_URL="http://archive.ubuntu.com/ubuntu/pool/universe/o/ostree/"
wget "${POOL_URL}ostree_${OSTREE_VERSION}-1.dsc"
wget "${POOL_URL}ostree_${OSTREE_VERSION}.orig.tar.xz"
wget "${POOL_URL}ostree_${OSTREE_VERSION}-1.debian.tar.xz"
- name: Extract and modify source
run: |
cd /opt/Projects/ostree-backport-noble
dpkg-source -x "ostree_${OSTREE_VERSION}-1.dsc"
cd "ostree-${OSTREE_VERSION}"
dch --newversion "${OSTREE_VERSION}-1${BACKPORT_SUFFIX}" \
--distribution "noble-backports" \
-b \
"Backport libostree ${OSTREE_VERSION}-1 from Ubuntu questing for bootc compatibility."
- name: Install build dependencies
run: |
cd /opt/Projects/ostree-backport-noble/ostree-${OSTREE_VERSION}
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
apt-get update
apt-get build-dep -y --no-install-recommends ./
- name: Build libostree backport
run: |
cd /opt/Projects/ostree-backport-noble/ostree-${OSTREE_VERSION}
dpkg-buildpackage -us -uc -b
- name: List built packages
run: |
echo "Built libostree packages:"
ls -la /opt/Projects/ostree-backport-noble/*.deb
- name: Create release assets
run: |
mkdir -p release-assets
cp /opt/Projects/ostree-backport-noble/*.deb release-assets/
# Create a summary file
echo "libostree Backport Build Summary" > release-assets/BUILD_SUMMARY.txt
echo "===============================" >> release-assets/BUILD_SUMMARY.txt
echo "Build Date: $(date)" >> release-assets/BUILD_SUMMARY.txt
echo "Ubuntu Version: ${UBUNTU_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "Ostree Version: ${OSTREE_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "Backport Suffix: ${BACKPORT_SUFFIX}" >> release-assets/BUILD_SUMMARY.txt
echo "" >> release-assets/BUILD_SUMMARY.txt
echo "Built Packages:" >> release-assets/BUILD_SUMMARY.txt
ls -la release-assets/*.deb 2>/dev/null || echo "No packages found" >> release-assets/BUILD_SUMMARY.txt
# Create package list for download links
echo "Package List:" > release-assets/PACKAGES.txt
ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' >> release-assets/PACKAGES.txt
echo "Release assets created:"
ls -la release-assets/
- name: Create download instructions
run: |
cat > release-assets/INSTALL.md << EOF
# libostree 2025.2-1 Backport Installation
## Quick Install
\`\`\`bash
# Download and install the main package
wget https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.run_id }}/artifacts
sudo dpkg -i libostree-dev_2025.2-1~noble1_amd64.deb
sudo apt-get install -f
\`\`\`
## Verification
\`\`\`bash
# Check if libostree 2025.2-1 is installed
pkg-config --modversion ostree-1
# Should output: 2025.2
\`\`\`
## Packages Included
EOF
ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' | while read package; do
echo "- \`$package\`" >> release-assets/INSTALL.md
done
echo "" >> release-assets/INSTALL.md
echo "Build completed on: $(date)" >> release-assets/INSTALL.md

View file

@ -0,0 +1,120 @@
name: Update README with Download Links
on:
workflow_run:
workflows: ["Build libostree Backport"]
types: [completed]
branches: [ main, master ]
jobs:
update-readme:
name: Update README with Download Links
runs-on: ubuntu-latest
container:
image: ubuntu:latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Setup environment
run: |
apt update -y
apt install -y git curl
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev
cp -r /tmp/libostree-dev/* .
cp -r /tmp/libostree-dev/.* . 2>/dev/null || true
- name: Get workflow run artifacts
run: |
# Get the workflow run ID from the triggering workflow
WORKFLOW_RUN_ID=${{ github.event.workflow_run.id }}
REPO_OWNER="robojerk"
REPO_NAME="libostree-dev"
echo "Workflow Run ID: $WORKFLOW_RUN_ID"
echo "Repository: $REPO_OWNER/$REPO_NAME"
# Create artifacts directory
mkdir -p artifacts
# Download artifacts from the workflow run
# Note: This is a placeholder - actual artifact download would depend on Forgejo API
echo "Downloading artifacts from workflow run $WORKFLOW_RUN_ID..."
# For now, we'll create a placeholder that shows the expected structure
echo "libostree-dev_2025.2-1~noble1_amd64.deb" > artifacts/package-list.txt
echo "libostree-dev-dbgsym_2025.2-1~noble1_amd64.ddeb" >> artifacts/package-list.txt
- name: Update README with download links
run: |
# Get current date
BUILD_DATE=$(date '+%Y-%m-%d %H:%M:%S UTC')
# Create download section
cat > download-section.md << EOF
## 📦 Download Latest Build
**Last Built**: $BUILD_DATE
**Version**: 2025.2-1~noble1
**Target**: Ubuntu Noble (24.04 LTS)
### Download Links
EOF
# Add download links for each package
if [ -f "artifacts/package-list.txt" ]; then
while IFS= read -r package; do
if [[ $package == *.deb ]]; then
echo "- **$package** - [Download](https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.event.workflow_run.id }}/artifacts)" >> download-section.md
fi
done < artifacts/package-list.txt
else
echo "- **libostree-dev_2025.2-1~noble1_amd64.deb** - [Download](https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.event.workflow_run.id }}/artifacts)" >> download-section.md
fi
cat >> download-section.md << EOF
### Installation
\`\`\`bash
# Download and install the package
wget https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.event.workflow_run.id }}/artifacts
sudo dpkg -i libostree-dev_2025.2-1~noble1_amd64.deb
sudo apt-get install -f # Install any missing dependencies
\`\`\`
### Verification
\`\`\`bash
# Check if libostree 2025.2-1 is installed
pkg-config --modversion ostree-1
# Should output: 2025.2
\`\`\`
---
EOF
# Update the README
# Find the line after the main description and insert the download section
awk '/## Usage/{print; system("cat download-section.md"); next} 1' README.md > README.md.tmp
mv README.md.tmp README.md
echo "README updated with download links"
- name: Commit and push changes
run: |
# Configure git
git config --global user.email "ci@raines.xyz"
git config --global user.name "CI Bot"
# Add and commit changes
git add README.md
git commit -m "Update README with download links from workflow run ${{ github.event.workflow_run.id }}"
# Push changes
git push origin main

View file

@ -0,0 +1,57 @@
# libostree-dev Backport
Compiles a backport of libostree-dev for Ubuntu Noble.
## Source and Target
- **Source**: Ubuntu "Questing Quokka" (questing) - libostree 2025.2-1
- **Target**: Ubuntu "Noble Numbat" (noble) - Ubuntu 24.04 LTS
## For Debian
- **Source**: Debian sid
- **Target**: Debian trixie
## Usage
This repository contains the CI/CD workflow and scripts to build a backport of libostree 2025.2-1 for Ubuntu Noble, which is required for bootc compatibility.
## 📦 Download Latest Build
**Last Built**: Not yet built
**Version**: 2025.2-1~noble1
**Target**: Ubuntu Noble (24.04 LTS)
### Download Links
- **libostree-dev_2025.2-1~noble1_amd64.deb** - [Download](https://git.raines.xyz/robojerk/libostree-dev/actions) (will be available after first successful build)
### Installation
```bash
# Download and install the package
wget https://git.raines.xyz/robojerk/libostree-dev/actions/runs/[RUN_ID]/artifacts
sudo dpkg -i libostree-dev_2025.2-1~noble1_amd64.deb
sudo apt-get install -f # Install any missing dependencies
```
### Verification
```bash
# Check if libostree 2025.2-1 is installed
pkg-config --modversion ostree-1
# Should output: 2025.2
```
---
## Build Process
1. Downloads libostree source from Ubuntu questing
2. Modifies version and distribution for noble backports
3. Builds the package with all dependencies
4. Creates .deb artifacts for installation
## CI/CD
The workflow automatically builds the backport on every push to main/master branch.

View file

@ -0,0 +1,204 @@
#!/bin/bash
# This script automates the backporting of libostree 2025.2-1 to Ubuntu Noble (24.04 LTS).
# It assumes that all build dependencies for libostree 2025.2-1 are available in
# Ubuntu Noble's default repositories.
#
# ⚠️ WARNING: This script modifies system libraries. Use with caution!
# - Test in a VM first
# - Have a system backup
# - Be prepared for potential side effects with Flatpak and other libostree-dependent software
# Exit immediately if a command exits with a non-zero status.
set -e
# --- Configuration ---
BACKPORT_DIR="/opt/Projects/ostree-backport-noble"
OSTREE_VERSION="2025.2"
OSTREE_DEBIAN_REVISION="1" # Corresponds to -1 in 2025.2-1
UBUNTU_SOURCE_RELEASE="questing" # The Ubuntu release where 2025.2-1 originated
TARGET_UBUNTU_RELEASE="noble" # Your target Ubuntu LTS release
BACKPORT_SUFFIX="~${TARGET_UBUNTU_RELEASE}1" # e.g., ~noble1
# --- Functions ---
log_info() {
echo -e "\n\e[1;34m[INFO]\e[0m $1"
}
log_success() {
echo -e "\n\e[1;32m[SUCCESS]\e[0m $1"
}
log_warning() {
echo -e "\n\e[1;33m[WARNING]\e[0m $1"
}
log_error() {
echo -e "\n\e[1;31m[ERROR]\e[0m $1" >&2
exit 1
}
cleanup() {
log_info "Cleaning up temporary files..."
# Remove the added source list file
sudo rm -f /etc/apt/sources.list.d/${TARGET_UBUNTU_RELEASE}-sources.list
# Remove the entire backport working directory
sudo rm -rf "${BACKPORT_DIR}"
sudo apt update >/dev/null 2>&1 || true
log_success "Cleanup completed."
}
# Safety check function
safety_check() {
log_info "Performing safety checks..."
# Check if we're running as root (shouldn't be)
if [ "$EUID" -eq 0 ]; then
log_error "This script should not be run as root. Please run as a regular user with sudo privileges."
fi
# Check if we're in a VM (recommended)
if ! grep -q "VMware\|VirtualBox\|QEMU\|KVM" /sys/class/dmi/id/product_name 2>/dev/null; then
log_warning "This doesn't appear to be running in a VM. Consider testing in a VM first."
read -p "Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
log_info "Aborted by user."
exit 0
fi
fi
# Check if we have enough disk space (rough estimate: 500MB)
AVAILABLE_SPACE=$(df /opt | awk 'NR==2 {print $4}')
if [ "$AVAILABLE_SPACE" -lt 500000 ]; then
log_error "Insufficient disk space. Need at least 500MB available in /opt"
fi
log_success "Safety checks passed."
}
# Set trap to ensure cleanup runs on exit
# Commented out for debugging - uncomment when script is working
# trap cleanup EXIT
# --- Main Script ---
log_info "Starting libostree backport process for Ubuntu ${TARGET_UBUNTU_RELEASE}..."
# Safety checks
safety_check
# Step 0: Clean up any existing backport directory
log_info "Step 0: Cleaning up any existing backport directory..."
if [ -d "${BACKPORT_DIR}" ]; then
log_info "Removing existing backport directory: ${BACKPORT_DIR}"
sudo rm -rf "${BACKPORT_DIR}"
fi
log_success "Cleanup completed."
# Step 1: Install Required Tools
log_info "Step 1: Installing essential build tools (devscripts, build-essential)..."
sudo apt update || log_error "Failed to update apt cache."
sudo apt install -y devscripts build-essential || log_error "Failed to install build tools."
log_success "Build tools installed."
# Step 1.5: Add Source Repositories
log_info "Step 1.5: Adding source repositories for build dependencies..."
echo "deb-src http://us.archive.ubuntu.com/ubuntu/ ${TARGET_UBUNTU_RELEASE} main universe" | sudo tee /etc/apt/sources.list.d/${TARGET_UBUNTU_RELEASE}-sources.list
sudo apt update || log_error "Failed to update apt cache with source repositories."
log_success "Source repositories added."
# Step 2: Create Backport Directory Structure
log_info "Step 2: Creating backport directory structure at ${BACKPORT_DIR}..."
mkdir -p "${BACKPORT_DIR}" || log_error "Failed to create directory ${BACKPORT_DIR}."
cd "${BACKPORT_DIR}" || log_error "Failed to change directory to ${BACKPORT_DIR}."
log_success "Directory structure created."
# Step 3: Download Source from Questing
log_info "Step 3: Downloading libostree ${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION} source from Ubuntu ${UBUNTU_SOURCE_RELEASE}..."
# Construct the base URL for the pool (ostree is in universe)
POOL_URL="http://archive.ubuntu.com/ubuntu/pool/universe/o/ostree/"
# Construct the full filenames
DSC_FILE="ostree_${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}.dsc"
ORIG_TAR_XZ_FILE="ostree_${OSTREE_VERSION}.orig.tar.xz"
DEBIAN_TAR_XZ_FILE="ostree_${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}.debian.tar.xz"
# Check if files already exist to avoid re-downloading
for file in "${DSC_FILE}" "${ORIG_TAR_XZ_FILE}" "${DEBIAN_TAR_XZ_FILE}"; do
if [ ! -f "$file" ]; then
wget "${POOL_URL}${file}" || log_error "Failed to download ${file}."
else
log_info "File ${file} already exists, skipping download."
fi
done
log_success "Source files downloaded."
# Step 4: Extract and Modify Source
log_info "Step 4: Extracting source and modifying debian/changelog..."
dpkg-source -x "${DSC_FILE}" || log_error "Failed to extract source package."
cd "ostree-${OSTREE_VERSION}" || log_error "Failed to change directory to ostree-${OSTREE_VERSION}."
# Create backport version entry in changelog
# For backports, we need to manually set the version and distribution
# Use -b to force the version change since backport versions are "less than" original
if ! dch --newversion "${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}${BACKPORT_SUFFIX}" \
--distribution "${TARGET_UBUNTU_RELEASE}-backports" \
-b \
"Backport libostree ${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION} from Ubuntu ${UBUNTU_SOURCE_RELEASE} for bootc compatibility."; then
log_info "dch failed, attempting manual changelog update..."
log_error "Manual changelog update not implemented. Please check debian/changelog format."
fi
log_success "Source extracted and changelog updated."
# Step 5: Install Build Dependencies
log_info "Step 5: Installing build dependencies for libostree (assuming Noble has them)..."
# This command relies on the debian/control file in the extracted source
sudo apt build-dep ./ || log_error "Failed to install build dependencies. Check debian/control or your Noble repositories."
log_success "Build dependencies installed (assumed to be available in Noble)."
# Step 6: Build the Backport
log_info "Step 6: Building the libostree backport for Noble..."
dpkg-buildpackage -us -uc -b || log_error "Failed to build the Debian package."
log_success "libostree backport built successfully."
# Step 7: Install the Backport
log_info "Step 7: Installing the built libostree packages..."
cd .. # Go back to the directory where the .deb files are
# Find all .deb files from the current build (more flexible)
OSTREE_DEBS=$(find . -maxdepth 1 -name "*ostree*${BACKPORT_SUFFIX}*.deb" -o -name "*libostree*${BACKPORT_SUFFIX}*.deb")
if [ -z "$OSTREE_DEBS" ]; then
log_error "No .deb packages found to install. Build might have failed or naming is unexpected."
log_info "Available .deb files:"
ls -la *.deb 2>/dev/null || echo "No .deb files found"
exit 1
fi
log_info "Found packages to install: $OSTREE_DEBS"
sudo dpkg -i ${OSTREE_DEBS} || log_error "Failed to install the backported .deb packages."
log_success "Backported libostree packages installed."
# Run apt --fix-broken install to handle any missed dependencies if dpkg -i failed to resolve them
log_info "Running apt --fix-broken install to resolve any lingering dependencies..."
sudo apt --fix-broken install -y || log_error "apt --fix-broken install failed."
log_success "Dependency resolution attempted."
# Step 8: Verify Installation
log_info "Step 8: Verifying installation..."
if dpkg -l | grep -q "libostree.*${BACKPORT_SUFFIX}"; then
log_success "libostree backport successfully installed."
else
log_warning "libostree backport installation verification failed, but continuing..."
fi
# Step 9: Test with bootc
log_info "Step 9: Now you can try building bootc with the newly installed libostree."
log_info "Example: (assuming bootc source is in /opt/Projects/bootc-deb/bootc)"
echo "cd /opt/Projects/bootc-deb/bootc"
echo "cargo build --release"
log_info "Remember to monitor for AppArmor denials during bootc operation if issues arise."
log_success "libostree backport process completed for Ubuntu ${TARGET_UBUNTU_RELEASE}."
log_warning "⚠️ IMPORTANT: Please reboot your system if you experience any issues with applications that use libostree (e.g., Flatpak)."
log_info "If you encounter problems, you can revert by reinstalling the original libostree packages from the Noble repositories." j