From a79a4f5797b5da8770fa41045b58f2176c2adfbe Mon Sep 17 00:00:00 2001 From: robojerk Date: Sat, 6 Sep 2025 08:39:28 -0700 Subject: [PATCH] first commit --- .forgejo/workflows/ci.yml | 219 ++++++++++++++++++++++++++++++++++++++ Dockerfile | 26 +++++ README.md | 88 +++++++++++++++ 3 files changed, 333 insertions(+) create mode 100644 .forgejo/workflows/ci.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..bc20c5f --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,219 @@ +--- +name: Build ostree packages from sid to trixie + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + MESON_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + run: | + echo "Cloning repository..." + git clone https://git.raines.xyz/particle-os/ostree.git /tmp/ostree + cd /tmp/ostree + git fetch --all + git checkout ${{ github.sha || gitea.sha || 'main' }} + + - name: Setup apt-cacher-ng + run: | + echo "Setting up apt-cacher-ng for faster builds..." + + # Try apt-cacher-ng first, fallback to standard mirrors + echo "Checking for apt-cacher-ng availability..." + + # Quick check with timeout to avoid hanging + if timeout 10 curl -s --connect-timeout 5 \ + http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then + echo "✅ apt-cacher-ng is available, configuring Docker proxy..." + + # Create Docker daemon configuration for apt-cacher-ng + sudo mkdir -p /etc/docker + echo '{ + "proxies": { + "default": { + "httpProxy": "http://192.168.1.101:3142", + "httpsProxy": "http://192.168.1.101:3142", + "noProxy": "localhost,127.0.0.1" + } + } + }' | sudo tee /etc/docker/daemon.json + + echo "Docker proxy configuration created" + else + echo "⚠️ apt-cacher-ng not available, using standard mirrors..." + echo "Using standard Debian mirrors for Docker builds" + fi + + - name: Build Docker image + run: | + cd /tmp/ostree + docker build --build-arg release_name=unstable -f Dockerfile \ + -t ostree-build:latest . + + - name: Build ostree packages inside container + run: | + cd /tmp/ostree + echo "Current directory before Docker run: $(pwd)" + echo "Files in current directory before Docker run:" + ls -la + + # Run Docker container and capture container ID + CONTAINER_ID=$(docker run -d -v $(pwd):/workspace ostree-build:latest bash -c " + # Setup apt-cacher-ng inside container if available + if timeout 5 curl -s --connect-timeout 3 \ + http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then + echo '✅ Using apt-cacher-ng for package downloads...' + echo 'deb http://192.168.1.101:3142/ftp.us.debian.org/debian unstable main' > /etc/apt/sources.list + echo 'deb-src http://192.168.1.101:3142/ftp.us.debian.org/debian unstable main' >> /etc/apt/sources.list + else + echo '⚠️ Using standard Debian mirrors...' + echo 'deb http://deb.debian.org/debian unstable main' > /etc/apt/sources.list + echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list + fi + + # Update package lists + apt update -y + + # Install build dependencies + apt install -y build-essential devscripts debhelper pkg-config \ + libglib2.0-dev libgpgme11-dev libfuse3-dev libsoup2.4-dev \ + libarchive-dev libcurl4-openssl-dev libsystemd-dev \ + libcap-dev libselinux1-dev libavahi-client-dev \ + libavahi-glib-dev libgirepository1.0-dev gtk-doc-tools \ + gobject-introspection libgjs-dev valac + + # Clone ostree from sid + echo 'Cloning ostree from Debian sid...' + cd /tmp + apt source ostree + cd ostree-* + + # Update changelog for trixie + echo 'Updating changelog for trixie...' + dch --local '+trixie' --distribution trixie 'Backport from sid to trixie' + + # Build packages + echo 'Building ostree packages...' + dpkg-buildpackage -us -uc -b + + # Copy built packages to workspace + echo 'Copying built packages to workspace...' + cp /tmp/*.deb /workspace/ 2>/dev/null || true + cp /tmp/*.dsc /workspace/ 2>/dev/null || true + cp /tmp/*.tar.xz /workspace/ 2>/dev/null || true + + echo 'Built packages:' + ls -la /workspace/*.deb 2>/dev/null || echo 'No .deb files found' + ") + + # Wait for container to complete + echo "Waiting for container to complete..." + docker wait $CONTAINER_ID + + # Copy .deb files from container to host + echo "Copying .deb files from container to host..." + docker cp $CONTAINER_ID:/workspace/ . + + # Clean up container + docker rm $CONTAINER_ID + + echo "Current directory after Docker run: $(pwd)" + echo "Files in current directory after Docker run:" + ls -la + + - name: Upload to Forgejo Debian Registry + run: | + cd /tmp/ostree + echo "Uploading to Forgejo Debian Registry..." + + # Debug: List files in current directory + echo "Files in current directory:" + ls -la + echo "Looking for .deb files:" + ls -la *.deb 2>/dev/null || echo "No .deb files found" + + # Set Forgejo configuration + FORGEJO_OWNER="particle-os" + FORGEJO_DISTRIBUTION="trixie" + FORGEJO_COMPONENT="main" + + # Upload each .deb file + for DEB_FILE in *.deb; do + if [ -f "$DEB_FILE" ]; then + echo "📦 Uploading package: $DEB_FILE" + + # Extract package info + PKG_NAME=$(dpkg-deb -f "$DEB_FILE" Package 2>/dev/null || echo "unknown") + PKG_VERSION=$(dpkg-deb -f "$DEB_FILE" Version 2>/dev/null || echo "unknown") + PKG_ARCH=$(dpkg-deb -f "$DEB_FILE" Architecture 2>/dev/null || echo "amd64") + + echo " Package: $PKG_NAME" + echo " Version: $PKG_VERSION" + echo " Architecture: $PKG_ARCH" + + # Forgejo Debian Registry upload URL + UPLOAD_URL="https://git.raines.xyz/api/packages/${FORGEJO_OWNER}/debian/pool/${FORGEJO_DISTRIBUTION}/${FORGEJO_COMPONENT}/upload" + + echo " Upload URL: $UPLOAD_URL" + + # Upload to Forgejo Debian Registry + if [ -n "${{ secrets.ACCESS_TOKEN }}" ]; then + echo " 🔐 Using authentication token..." + UPLOAD_RESULT=$(curl -s -w "%{http_code}" \ + --user "${FORGEJO_OWNER}:${{ secrets.ACCESS_TOKEN }}" \ + --upload-file "$DEB_FILE" \ + "$UPLOAD_URL" 2>/dev/null) + + # Extract HTTP status code (last 3 characters) + HTTP_CODE=$(echo "$UPLOAD_RESULT" | tail -c 4) + # Extract response body (everything except last 3 characters) + RESPONSE_BODY=$(echo "$UPLOAD_RESULT" | head -c -4) + + case $HTTP_CODE in + 201) + echo " ✅ Successfully published $PKG_NAME to Forgejo Debian Registry!" + ;; + 409) + echo " ⚠️ Package $PKG_NAME already exists (version conflict)" + ;; + 400) + echo " ❌ Bad request - package $PKG_NAME validation failed" + ;; + *) + echo " ❌ Upload failed for $PKG_NAME with HTTP $HTTP_CODE" + echo " Response: $RESPONSE_BODY" + ;; + esac + else + echo " ⚠️ No ACCESS_TOKEN secret available - skipping upload for $PKG_NAME" + fi + fi + done + + echo "" + echo "🎯 Debian package publishing complete!" + echo "📦 Packages are now available in Forgejo Debian Registry" + echo "🔧 To install: apt install ostree libostree-1-1" + + - name: Upload artifacts + run: | + cd /tmp/ostree + echo "Creating artifact directory..." + mkdir -p /tmp/artifacts + cp *.deb /tmp/artifacts/ 2>/dev/null || true + cp *.dsc /tmp/artifacts/ 2>/dev/null || true + cp *.tar.xz /tmp/artifacts/ 2>/dev/null || true + echo "Artifacts created in /tmp/artifacts/" + ls -la /tmp/artifacts/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cc54e88 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM debian:unstable-slim + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 + +# Install basic build tools +RUN apt update && \ + apt install -y \ + build-essential \ + devscripts \ + debhelper \ + pkg-config \ + git \ + curl \ + wget \ + && \ + apt clean && \ + rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /workspace + +# Default command +CMD ["bash"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..05a2b6b --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +# OSTree Backport from Sid to Trixie + +This repository contains the backport of OSTree packages from Debian Sid to Trixie to fix the library version issue with bootc. + +## Problem + +The `bootc` command fails with: +```bash +[INFO] Installing bootc image to disk... +bootc: /lib/x86_64-linux-gnu/libostree-1.so.1: version `LIBOSTREE_2025.3' not found (required by bootc) +``` + +This happens because: +- `bootc` requires `libostree-1.so.1` version `LIBOSTREE_2025.3` +- Trixie only has version `2025.2` +- Sid has version `2025.5` which includes `LIBOSTREE_2025.3` + +## Solution + +Backport the following packages from Sid to Trixie: + +### Core OSTree Packages +- **ostree** (2025.5-1) - Main OSTree package +- **libostree-1-1** (2025.5-1) - OSTree shared library +- **libostree-dev** (2025.5-1) - Development headers +- **libostree-doc** (2025.5-1) - Documentation +- **ostree-boot** (2025.5-1) - Boot integration +- **gir1.2-ostree-1.0** (2025.5-1) - GObject introspection + +### Optional Packages +- **ostree-push** (1.2.0-1) - Push functionality +- **ostree-tests** (2025.5-1) - Test suite + +### Go Bindings (if needed) +- **golang-github-ostreedev-ostree-go-dev** (0.0+git20210805.719684c64e4f-2) +- **golang-github-sjoerdsimons-ostree-go-dev** (0.0~git20201014.8fae757-2) + +## Building + +The CI workflow automatically: +1. Clones ostree source from Debian Sid +2. Builds all packages with proper dependencies +3. Uploads to Forgejo Debian Registry +4. Makes packages available for `apt install` + +## Usage + +After the packages are built and uploaded: + +```bash +# Add the repository (if not already added) +echo "deb [signed-by=/etc/apt/keyrings/forgejo-particle-os.asc] https://git.raines.xyz/api/packages/particle-os/debian trixie main" | sudo tee -a /etc/apt/sources.list.d/forgejo.list + +# Update package lists +sudo apt update + +# Install the updated ostree packages +sudo apt install ostree libostree-1-1 + +# Verify the version +ldd /usr/bin/bootc | grep libostree +``` + +## CI Workflow + +The `.forgejo/workflows/ci.yml` file: +- Uses Docker to build packages in a clean environment +- Downloads source from Debian Sid +- Builds all OSTree packages +- Uploads to Forgejo Debian Registry +- Creates artifacts for manual installation + +## Manual Build + +If you need to build manually: + +```bash +# Clone this repository +git clone https://git.raines.xyz/particle-os/ostree.git +cd ostree + +# Build with Docker +docker build -t ostree-build . +docker run -v $(pwd):/workspace ostree-build + +# Install the built packages +sudo dpkg -i *.deb +``` \ No newline at end of file