Compare commits

..

No commits in common. "c6b590f77ac58241c08215cbb6312bacdd2227e3" and "8c4036aa50b731cfd8aed1cf4f958289cb4e6b8d" have entirely different histories.

2 changed files with 73 additions and 85 deletions

View File

@ -1,4 +1,4 @@
name: Solaris Multi-Package Build name: Solaris Multi-Build
on: on:
push: push:
@ -18,47 +18,94 @@ jobs:
# - host: 172.16.11.21 # Solaris 2.6 sparc # - host: 172.16.11.21 # Solaris 2.6 sparc
# osver: "2.6" # osver: "2.6"
# arch: "sparc" # arch: "sparc"
# Add more hosts/archs as needed # - host: 172.16.11.22 # Solaris 7 i386
# osver: "7"
# arch: "i386"
# - host: 172.16.11.23 # Solaris 7 sparc
# osver: "7"
# arch: "sparc"
# Add more hosts for each Solaris version / architecture
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
# --- Build binutils --- - name: Build binutils on Solaris ${{ matrix.osver }} ${{ matrix.arch }}
- name: Build binutils
uses: appleboy/ssh-action@master uses: appleboy/ssh-action@master
with: with:
host: ${{ matrix.host }} host: ${{ matrix.host }}
username: root username: root
key: ${{ secrets.BUILD_SSH_KEY }} key: ${{ secrets.BUILD_SSH_KEY }}
timeout: 7200 # 2 hours
script: | script: |
set -e set -e
# --- Set environment variables --- # --- Solaris-compatible host-level lock ---
LOCKDIR="/tmp/build-host.lock"
while ! mkdir "$LOCKDIR" 2>/dev/null; do
echo "Another build is running on this host. Waiting..."
sleep 10
done
echo "Acquired host lock, starting build..."
# Ensure lock is removed on exit
trap "rmdir '$LOCKDIR'" EXIT
echo "=== Updating sources on Solaris ${{ matrix.osver }} ==="
cd /usr/src/buildpkg && git pull
cd /usr/src/dbpware-for-solaris && git pull
export BUILDPKG_SCRIPTS=/usr/src/buildpkg/ export BUILDPKG_SCRIPTS=/usr/src/buildpkg/
export BUILDPKG_BASE=/usr/src/dbpware-for-solaris/ export BUILDPKG_BASE=/usr/src/dbpware-for-solaris/
# --- Update sources --- # Define build order (other packages commented out)
cd $BUILDPKG_SCRIPTS && git pull BUILD_ORDER=(
cd $BUILDPKG_BASE && git pull binutils
# gcc
# gmake
# coreutils
# add more packages in build order
)
# --- Call host-side build script --- for pkg in "${BUILD_ORDER[@]}"; do
$BUILDPKG_BASE/build-package.sh binutils echo "=== Checking $pkg ==="
cd "$BUILDPKG_BASE/$pkg"
# --- Build gcc (future) --- # Parse basic fields from build.sh using GNU grep
#- name: Build gcc topdir=$(ggrep -E '^topdir=' build.sh | cut -d= -f2)
# uses: appleboy/ssh-action@master version=$(ggrep -E '^version=' build.sh | cut -d= -f2)
# with: pkgver=$(ggrep -E '^pkgver=' build.sh | cut -d= -f2)
# host: ${{ matrix.host }} secname="$topdir"
# username: root
# key: ${{ secrets.BUILD_SSH_KEY }}
# timeout: 10800 # 3 hours
# script: |
# export BUILDPKG_SCRIPTS=/usr/src/buildpkg/
# export BUILDPKG_BASE=/usr/src/dbpware-for-solaris/
# cd $BUILDPKG_SCRIPTS && git pull
# cd $BUILDPKG_BASE && git pull
# $BUILDPKG_BASE/build-package.sh gcc
# Add more packages similarly, each in its own SSH step # Skip build if package already exists
PKGFILE=$(ls -1 ${secname}-${version}-${pkgver}.dbp*.gz 2>/dev/null | head -n1 || true)
if [ -n "$PKGFILE" ]; then
echo "Package already built: $PKGFILE. Skipping."
continue
fi
echo "=== Building $pkg on Solaris ${{ matrix.osver }} ${{ matrix.arch }} ==="
LOGFILE=$(bash build.sh all 2>&1 | tee /tmp/build-$pkg.log | ggrep -oE '[^ ]+\.log' | gtail -n1)
if [ -n "$LOGFILE" ] && [ -f "$LOGFILE" ]; then
echo "Tailing logfile: $LOGFILE"
gtail -f "$LOGFILE" &
TAIL_PID=$!
else
echo "ERROR: No logfile detected for $pkg"
exit 1
fi
wait -n
EXIT_CODE=$?
kill $TAIL_PID || true
if [ $EXIT_CODE -eq 0 ]; then
echo "Build succeeded for $pkg, deleting logfile."
rm -f "$LOGFILE" || true
else
echo "Build FAILED for $pkg, keeping logfile: $LOGFILE"
exit $EXIT_CODE
fi
echo "=== Finished $pkg ==="
done

View File

@ -1,59 +0,0 @@
#!/usr/dbpware/bin/bash
# Usage: ./build-package.sh <package-name>
set -e
PKG="$1"
if [ -z "$PKG" ]; then
echo "Usage: $0 <package-name>"
exit 1
fi
# --- Host-level lock ---
LOCKDIR="/tmp/build-host.lock"
while ! mkdir "$LOCKDIR" 2>/dev/null; do
echo "Another build is running on this host. Waiting..."
sleep 10
done
trap "rmdir '$LOCKDIR'" EXIT
echo "Acquired host lock, starting build of $PKG"
# --- Navigate to package directory ---
cd "$BUILDPKG_BASE/$PKG"
# --- Read package metadata from build.sh ---
topdir=$(ggrep -E '^topdir=' build.sh | cut -d= -f2)
version=$(ggrep -E '^version=' build.sh | cut -d= -f2)
pkgver=$(ggrep -E '^pkgver=' build.sh | cut -d= -f2)
secname="$topdir"
# --- Check if package already exists ---
PKGFILE=$(ls -1 ${secname}-${version}-${pkgver}.dbp*.gz 2>/dev/null | head -n1 || true)
if [ -n "$PKGFILE" ]; then
echo "Package already built: $PKGFILE. Skipping."
exit 0
fi
# --- Run the build ---
LOGFILE=$(bash build.sh all 2>&1 | tee /tmp/build-$secname.log | ggrep -oE '[^ ]+\.log' | gtail -n1)
if [ -n "$LOGFILE" ] && [ -f "$LOGFILE" ]; then
echo "Tailing logfile: $LOGFILE"
gtail -f "$LOGFILE" &
TAIL_PID=$!
else
echo "ERROR: No logfile detected for $PKG"
exit 1
fi
wait -n
EXIT_CODE=$?
kill $TAIL_PID || true
if [ $EXIT_CODE -eq 0 ]; then
echo "Build succeeded for $PKG, deleting logfile."
rm -f "$LOGFILE" || true
else
echo "Build FAILED for $PKG, keeping logfile: $LOGFILE"
exit $EXIT_CODE
fi
echo "=== Finished build of $PKG ==="