|
|
|
@ -6,50 +6,13 @@ source "$(dirname "${BASH_SOURCE[0]}")/common.sh" |
|
|
|
|
|
|
|
find . -name '*.src.rpm' -delete |
|
|
|
|
|
|
|
function install_all_srpm () { |
|
|
|
local dist=$1 |
|
|
|
echo "Importing source RPMs of $dist..." |
|
|
|
rpm -ivh "--define=_topdir $PWD/$dist" "$dist/SRPMS/"*.src.rpm |
|
|
|
} |
|
|
|
|
|
|
|
function apply_patches () { |
|
|
|
local dist=$1 |
|
|
|
for patch in "$dist/PATCHES"/*.patch; do |
|
|
|
echo "Applying patch $(basename "$patch")..." |
|
|
|
patch -d "$dist"* -p1 < "$patch" |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
function download_sources_fedora () { |
|
|
|
local dist=$1 |
|
|
|
local v="${dist#*-}" |
|
|
|
echo "Downloading libvirt source for Fedora $v..." |
|
|
|
dnf download --repofrompath=$dist,https://dl.fedoraproject.org/pub/fedora/linux/releases/$v/Everything/source/tree/ --repofrompath=$dist-updates,https://dl.fedoraproject.org/pub/fedora/linux/updates/$v/Everything/source/tree/ --repo="$dist" --repo="$dist-updates" --source libvirt --destdir $dist/SRPMS/ |
|
|
|
echo "Downloading zfs source for Fedora $v..." |
|
|
|
if ! dnf download --repofrompath=zfs-$dist,http://download.zfsonlinux.org/fedora/$v/SRPMS/ --repo=zfs-$dist --source zfs zfs-dkms --destdir $dist/SRPMS/; then |
|
|
|
echo "ZFS source RPM not found for Fedora $v, skipping..." |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
function download_sources_centos_stream () { |
|
|
|
local dist=$1 |
|
|
|
local v="${dist#*-}" |
|
|
|
echo "Downloading libvirt source for CentOS Stream $v..." |
|
|
|
dnf download --repofrompath=$dist,https://mirror.stream.centos.org/$v-stream/AppStream/source/tree/ --repo="$dist" --source libvirt --destdir $dist/SRPMS/ |
|
|
|
echo "Downloading zfs source for CentOS Stream $v..." |
|
|
|
if ! dnf download --repofrompath=zfs-$dist,http://download.zfsonlinux.org/epel/$v/SRPMS/ --repo=zfs-$dist --source zfs zfs-dkms --destdir $dist/SRPMS/; then |
|
|
|
echo "ZFS source RPM not found for CentOS Stream $v, skipping..." |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
dists=(centos-9 centos-10) |
|
|
|
for v in $(get_fedora_versions); do |
|
|
|
dists+=("fedora-$v") |
|
|
|
done |
|
|
|
echo "Computing a list of currently maintained versions of Fedora and CentOS Stream..." |
|
|
|
dists=( $(get_all_remote_dists) ) |
|
|
|
|
|
|
|
for dist in "${dists[@]}"; do |
|
|
|
mkdir -p "$dist/SRPMS" |
|
|
|
rm -rf "$PWD/$dist/SOURCES" |
|
|
|
find "$dist/SRPMS" -name '*.src.rpm' -delete |
|
|
|
rm -rf "$dist/SOURCES" |
|
|
|
if [[ "$dist" == fedora-* ]]; then |
|
|
|
download_sources_fedora "$dist" |
|
|
|
elif [[ "$dist" == centos-* ]]; then |
|
|
|
@ -58,6 +21,15 @@ for dist in "${dists[@]}"; do |
|
|
|
echo "Unknown distribution: $dist" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
mapfile -t srpms < <(find "$dist/SRPMS" -name '*.src.rpm') |
|
|
|
if [ ${#srpms[@]} -ne 3 ]; then |
|
|
|
echo "Expecting 3 source RPMs for $dist, got only ${#srpms[@]}, skipping..." |
|
|
|
continue |
|
|
|
fi |
|
|
|
echo "Found 3 source RPMs for $dist:" |
|
|
|
for srpm in "${srpms[@]}"; do |
|
|
|
echo " - $(basename "$srpm")" |
|
|
|
done |
|
|
|
install_all_srpm "$dist" |
|
|
|
apply_patches "$dist" |
|
|
|
done |
|
|
|
|