Compare commits

...

11 Commits

  1. 41
      .github/workflows/backport.yaml
  2. 40
      .github/workflows/copr-build.yaml
  3. 2
      .gitignore
  4. 40
      README.md
  5. 17
      build.sh

41
.github/workflows/backport.yaml

@ -0,0 +1,41 @@
name: Backport Packages (Daily)
# Everyday at 02:00 UTC
on:
schedule:
- cron: '0 2 * * *'
# Enables manual triggering of the workflow
workflow_dispatch:
jobs:
update-packages:
runs-on: ubuntu-latest
# Defines the Fedora container for this job
container:
image: fedora:latest
steps:
# 1. Install pre-requisites
- name: Install pre-requisites
run: dnf install -y patch git git-lfs
# 2. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
lfs: true
# We cannot use the default GITHUB_TOKEN as it is restricted and cannot
# trigger another workflow run, which is needed here to trigger the COPR build
token: ${{ secrets.COMMIT_TOKEN }}
# 3. Run the update script in the container
- name: Run update script
run: ./update.sh
# 4. Push changes (if any)
- uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Backport packages from upstream
commit_author: Nicolas Massé <nicolas.masse@itix.fr>

40
.github/workflows/copr-build.yaml

@ -0,0 +1,40 @@
name: Trigger COPR Build
on:
# Trigger on push, but only for SPECS and SOURCES changes
push:
paths:
- fedora-*/SPECS/*.spec
- fedora-*/SOURCES/**
- centos-*/SPECS/*.spec
- centos-*/SOURCES/**
# Enables manual triggering of the workflow
workflow_dispatch:
jobs:
build-copr:
runs-on: ubuntu-latest
# Defines the Fedora container for this job
container:
image: fedora:latest
steps:
# 1. Install pre-requisites
- name: Install copr-cli
run: dnf install -y copr-cli git git-lfs
# 2. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
lfs: true
# 3. Run the build script
- name: Run COPR build script
run: ./build.sh
# Inject secrets into the container as environment variables
env:
COPR_CONFIG: ${{ secrets.COPR_CONFIG }}

2
.gitignore

@ -2,3 +2,5 @@ SRPMS
RPMS RPMS
BUILD BUILD
BUILDROOT BUILDROOT
*.orig
*.rej

40
README.md

@ -8,6 +8,7 @@ This repository provides ZFS and libvirt RPM packages compiled specifically for
- **Libvirt with ZFS Storage**: Patches libvirt to enable ZFS storage pool support on aarch64 architecture, allowing virtualization environments to leverage ZFS storage backends - **Libvirt with ZFS Storage**: Patches libvirt to enable ZFS storage pool support on aarch64 architecture, allowing virtualization environments to leverage ZFS storage backends
- **Multi-distribution Support**: Builds packages for multiple Linux distributions (Fedora 41-43, CentOS Stream 9-10) to ensure broad compatibility - **Multi-distribution Support**: Builds packages for multiple Linux distributions (Fedora 41-43, CentOS Stream 9-10) to ensure broad compatibility
- **Automated Building**: Uses COPR (Cool Other Package Repo) infrastructure for automated building and distribution - **Automated Building**: Uses COPR (Cool Other Package Repo) infrastructure for automated building and distribution
- **Upstream Integration**: Keeps packages in sync with upstream ZFS and libvirt releases, applying necessary patches for ARM64 compatibility
The repository automatically downloads upstream source RPMs, applies necessary patches (especially the `20-enable-zfs.patch` for libvirt), and builds optimized packages for ARM64 systems. The repository automatically downloads upstream source RPMs, applies necessary patches (especially the `20-enable-zfs.patch` for libvirt), and builds optimized packages for ARM64 systems.
@ -19,7 +20,14 @@ The packages are built and hosted on COPR. To use them on your aarch64 system:
1. **Enable the COPR repository:** 1. **Enable the COPR repository:**
```bash ```bash
# Enable the COPR repository
sudo dnf copr enable nmasse-itix/zfs-aarch64 sudo dnf copr enable nmasse-itix/zfs-aarch64
# Optionally, limit the packages to only ZFS-related ones
sudo dnf config-manager setopt 'copr:copr.fedorainfracloud.org:nmasse-itix:zfs-aarch64.includepkgs=*zfs* libnvpair* libuutil* libzpool*'
# Verify the repository is enabled and packages are available
sudo dnf --repo=copr:copr.fedorainfracloud.org:nmasse-itix:zfs-aarch64 search zfs
``` ```
2. **Install ZFS packages:** 2. **Install ZFS packages:**
@ -28,7 +36,7 @@ The packages are built and hosted on COPR. To use them on your aarch64 system:
sudo dnf install zfs zfs-dkms sudo dnf install zfs zfs-dkms
# Install libvirt with ZFS support # Install libvirt with ZFS support
sudo dnf install libvirt sudo dnf install libvirt libvirt-daemon-kvm libvirt-daemon-driver-storage-zfs
``` ```
And then follow the [Getting Started](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html) documentation. And then follow the [Getting Started](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html) documentation.
@ -66,6 +74,36 @@ And then send the build to COPR.
./build.sh ./build.sh
``` ```
## Local compilation
```sh
# Install dependencies
dnf install -y git git-lfs mock rpm-build
# Clone the repository
git clone https://github.com/nmasse-itix/zfs-aarch64.git
cd zfs-aarch64
git lfs install
git lfs pull
# Function to compile a spec file
function build_spec() {
mock_chroot="$1"
spec="$2"
spec_name="$(basename $spec .spec)"
rootdir="$(dirname $spec)/../"
rootdir="$(realpath $rootdir)"
outdir="$rootdir/RPMS/$spec_name-$mock_chroot-$(date -Iseconds)/"
mkdir -p "$outdir" "$rootdir/SRPMS"
rm -f "$rootdir/SRPMS/$spec_name"-*.src.rpm
rpmbuild --define "_topdir $rootdir" -bs "$spec"
mock -r "$mock_chroot" --resultdir="$outdir" "$rootdir/SRPMS/$spec_name"-*.src.rpm
}
# For example, to build libvirt for Fedora 42 aarch64
build_spec "fedora-42-aarch64" "fedora-42/SPECS/libvirt.spec"
```
## License ## License
The source code of ZFS, Libvirt and the Fedora RPM spec files remain licensed under their original license. The source code of ZFS, Libvirt and the Fedora RPM spec files remain licensed under their original license.

17
build.sh

@ -2,6 +2,13 @@
set -Eeuo pipefail set -Eeuo pipefail
if [ ! -f "$HOME/.config/copr" ] && [ -n "$COPR_CONFIG" ]; then
echo "Copr configuration file not found. Injecting from environment variable..."
mkdir -p "$HOME/.config"
echo "$COPR_CONFIG" > "$HOME/.config/copr"
chmod 0600 "$HOME/.config/copr"
fi
GIT_REPOSITORY="https://github.com/nmasse-itix/zfs-aarch64.git" GIT_REPOSITORY="https://github.com/nmasse-itix/zfs-aarch64.git"
COPR_PROJECT="zfs-aarch64" COPR_PROJECT="zfs-aarch64"
COPR_USERNAME="$(copr-cli whoami)" COPR_USERNAME="$(copr-cli whoami)"
@ -11,7 +18,17 @@ for dist in centos-* fedora-*; do
echo "Building packages for $dist using $chroot..." echo "Building packages for $dist using $chroot..."
for spec in $dist/SPECS/*.spec; do for spec in $dist/SPECS/*.spec; do
spec="${spec#$dist/}" spec="${spec#$dist/}"
package_name="$(basename "$spec" .spec)"
dist_version="${dist#*-}"
dist_name="${dist%%-*}"
copr-cli buildscm --clone-url "$GIT_REPOSITORY" --method make_srpm --subdir "$dist" --spec "$spec" --chroot "$chroot" --background --nowait "$COPR_PROJECT" copr-cli buildscm --clone-url "$GIT_REPOSITORY" --method make_srpm --subdir "$dist" --spec "$spec" --chroot "$chroot" --background --nowait "$COPR_PROJECT"
# Special case for libvirt on Fedora 43. Since the ZFS driver of libvirt is disabled since Fedora 43, we also build it for x86_64.
if [[ "$package_name" == "libvirt" && "$dist_name" == "fedora" && "$dist_version" -ge "43" ]]; then
echo "Also submitting libvirt build for Fedora 43 using x86_64 chroot..."
copr-cli buildscm --clone-url "$GIT_REPOSITORY" --method make_srpm --subdir "$dist" --spec "$spec" --chroot "$dist-x86_64" --background --nowait "$COPR_PROJECT"
fi
done done
done done

Loading…
Cancel
Save