From 4bfb947efdca734c8951f6b8e4aa069328b83111 Mon Sep 17 00:00:00 2001 From: Jan Houben Date: Sat, 25 Aug 2018 13:50:34 +0200 Subject: [PATCH] Refactor PKGBUILD generation This will allow aur users to easily change the PKGBUILDS to work with newer versions --- lib.sh | 91 +++-------------------------------- repo.sh | 12 ++++- src/kernels/archiso.sh | 7 ++- src/kernels/common-git.sh | 4 +- src/kernels/common.sh | 8 +-- src/kernels/dkms.sh | 17 ++++--- src/kernels/linux-hardened.sh | 55 +++++++++++---------- src/kernels/linux-lts.sh | 53 ++++++++++---------- src/kernels/linux-vfio.sh | 59 +++++++++++------------ src/kernels/linux-zen.sh | 59 +++++++++++------------ src/kernels/linux.sh | 56 +++++++++++---------- src/spl/PKGBUILD.sh | 13 +++-- src/zfs-dkms/PKGBUILD.sh | 1 + src/zfs-utils/PKGBUILD.sh | 3 +- src/zfs/PKGBUILD.sh | 16 ++++-- 15 files changed, 197 insertions(+), 257 deletions(-) diff --git a/lib.sh b/lib.sh index 10864d2..466ab60 100644 --- a/lib.sh +++ b/lib.sh @@ -425,6 +425,7 @@ source_safe() { linux_headers_depends="" spl_replaces="" zfs_replaces="" + zfs_set_commit="" export script_dir mode kernel_name shopt -u extglob @@ -510,76 +511,6 @@ check_result() { fi } - -get_linux_vfio_kernel_version() { - # - # Get linux-vfio kernel version (this will change when the linux-vfio is updated) - # - msg "Checking linux-vfio download page for the latest linux kernel version..." - if ! get_webpage "https://aur.archlinux.org/packages/linux-vfio" "(?<=linux-vfio )[\d\w\.-]+"; then - exit 1 - fi - latest_kernel_version=${webpage_output} -} - -get_archiso_kernel_version() { - # - # Get archiso kernel version (this will change when the archiso is updated) - # - msg "Checking archiso download page for the latest linux kernel version..." - if ! get_webpage "https://www.archlinux.org/download/" "(?<=Included Kernel: )[\d\.]+"; then - exit 1 - fi - latest_kernel_version=${webpage_output} -} - -get_linux_hardened_kernel_version() { - # - # Get x86_64 linux-hardened kernel version - # - msg "Checking the online package database for the latest x86_64 linux-hardened kernel version..." - if ! get_webpage "https://www.archlinux.org/packages/extra/x86_64/linux-hardened/" "(?<=

linux-hardened )[\d\w\.-]+(?=

)"; then - exit 1 - fi - latest_kernel_version=${webpage_output} -} - -get_linux_zen_kernel_version() { - # - # Check x86_64 linux-hardened kernel version - # - msg "Checking the online package database for the latest x86_64 linux-zen kernel version..." - if ! get_webpage "https://www.archlinux.org/packages/extra/x86_64/linux-zen/" "(?<=

linux-zen )[\d\w\.-]+(?=

)"; then - exit 1 - fi - latest_kernel_version=${webpage_output} -} - - -get_linux_kernel_version() { - # - # Check x86_64 linux kernel version - # - msg "Checking the online package database for the latest x86_64 linux kernel version..." - if ! get_webpage "https://www.archlinux.org/packages/core/x86_64/linux/" "(?<=

linux )[\d\w\.-]+(?=

)"; then - exit 1 - fi - latest_kernel_version=${webpage_output} -} - - -get_linux_lts_kernel_version() { - # - # Check x86_64 linux-lts kernel version - # - msg "Checking the online package database for the latest x86_64 linux-lts kernel version..." - if ! get_webpage "https://www.archlinux.org/packages/core/x86_64/linux-lts/" "(?<=

linux-lts )[\d\w\.-]+(?=

)"; then - exit 1 - fi - latest_kernel_version=${webpage_output} -} - - check_zol_version() { # # Check ZFSonLinux.org @@ -941,22 +872,12 @@ git_calc_pkgver() { if [[ ${repo} =~ ^spl ]]; then spl_git_ver=${run_cmd_output} - # append kernel version if set - if [ ! -z "${kernvers}" ]; then - spl_pkgver=${spl_git_ver}.${kernvers}; - else - spl_pkgver=${spl_git_ver}; - fi + spl_pkgver=${spl_git_ver} debug "spl_pkgver: ${spl_pkgver}" elif [[ ${repo} =~ ^zfs ]]; then - zfs_git_ver=${run_cmd_output} - # append kernel version if set - if [ ! -z "${kernvers}" ]; then - zfs_pkgver=${zfs_git_ver}.${kernvers}; - else + zfs_git_ver=${run_cmd_output} zfs_pkgver=${zfs_git_ver}; - fi - debug "zfs_pkgver: ${zfs_pkgver}" + debug "zfs_pkgver: ${zfs_pkgver}" fi # get latest commit sha @@ -964,9 +885,9 @@ git_calc_pkgver() { cmd+="git rev-parse HEAD" run_cmd_no_output_no_dry_run "${cmd}" if [[ ${repo} =~ ^zfs ]]; then - latest_zfs_git_commit=${run_cmd_output} + latest_zfs_git_commit=${run_cmd_output} else - latest_spl_git_commit=${run_cmd_output} + latest_spl_git_commit=${run_cmd_output} fi # Cleanup diff --git a/repo.sh b/repo.sh index e6cb7cc..c93aa4e 100755 --- a/repo.sh +++ b/repo.sh @@ -190,12 +190,20 @@ repo_package_list() { # Version match check: arch: x86_64 name: spl-utils-linux-git vers: 0.7.0_rc1_r0_g4fd75d3_4.7.2_1-4 vers_match: 0.6.5.8.*4.7.2_1-4 debug "spl_pkgver: ${spl_pkgver}" debug "zfs_pkgver: ${zfs_pkgver}" + debug "kernel_version_full_pkgver: ${kernel_version_full_pkgver}" + + kernvers="" + # append kernel version if set + if [ ! -z "${kernel_version_full_pkgver}" ]; then + kernvers="_${kernel_version_full_pkgver}"; + fi if [[ ${pkg} =~ .*spl-.* ]]; then - match="${spl_pkgver}-${spl_pkgrel}" + match="${spl_pkgver}${kernvers}-${spl_pkgrel}" elif [[ ${pkg} =~ .*zfs-.* ]]; then - match="${zfs_pkgver}-${zfs_pkgrel}" + match="${zfs_pkgver}${kernvers}-${zfs_pkgrel}" fi + debug "Version match check: arch: ${arch} name: ${name} vers: ${vers} vers_match: ${match}" if ! [[ ${vers} =~ ^${match} ]] ; then diff --git a/src/kernels/archiso.sh b/src/kernels/archiso.sh index adf6d7d..2598714 100644 --- a/src/kernels/archiso.sh +++ b/src/kernels/archiso.sh @@ -26,8 +26,11 @@ header="\ #" update_archiso_linux_pkgbuilds() { - get_archiso_kernel_version - kernel_version=${latest_kernel_version} + msg "Checking archiso download page for the latest linux kernel version..." + if ! get_webpage "https://www.archlinux.org/download/" "(?<=Included Kernel: )[\d\.]+"; then + exit 1 + fi + kernel_version=${webpage_output} pkg_list=("spl-archiso-linux" "zfs-archiso-linux") kernel_version_full=$(kernel_version_full ${kernel_version}) diff --git a/src/kernels/common-git.sh b/src/kernels/common-git.sh index ac28512..9dece33 100644 --- a/src/kernels/common-git.sh +++ b/src/kernels/common-git.sh @@ -27,7 +27,6 @@ update_common_git_pkgbuilds() { zfs_utils_pkgname="zfs-utils-common-git" spl_utils_pkgbuild_path="packages/${kernel_name}/${spl_utils_pkgname}" zfs_utils_pkgbuild_path="packages/${kernel_name}/${zfs_utils_pkgname}" - zfs_src_target="git+${zfs_git_url}" zfs_src_hash="SKIP" zfs_makedepends="\"git\"" zfs_workdir="\${srcdir}/zfs" @@ -38,5 +37,6 @@ update_common_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/kernels/common.sh b/src/kernels/common.sh index 4f91feb..107d150 100644 --- a/src/kernels/common.sh +++ b/src/kernels/common.sh @@ -28,10 +28,10 @@ update_common_pkgbuilds() { # Paths are relative to build.sh spl_utils_pkgbuild_path="packages/${kernel_name}/${spl_utils_pkgname}" zfs_utils_pkgbuild_path="packages/${kernel_name}/${zfs_utils_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${pkgver}/spl-\${pkgver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${pkgver}/zfs-\${pkgver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${pkgver}" + zfs_workdir="\${srcdir}/zfs-\${pkgver}" spl_utils_replaces='replaces=("spl-utils-linux", "spl-utils-linux-lts")' zfs_utils_replaces='replaces=("zfs-utils-linux", "zfs-utils-linux-lts")' } diff --git a/src/kernels/dkms.sh b/src/kernels/dkms.sh index 340db6e..6e39f71 100644 --- a/src/kernels/dkms.sh +++ b/src/kernels/dkms.sh @@ -34,15 +34,15 @@ update_dkms_pkgbuilds() { zfs_conflicts="'zfs-dkms-git'" spl_pkgname="spl-dkms" zfs_pkgname="zfs-dkms" - spl_utils_pkgname="spl-utils-common=${zol_version}" - zfs_utils_pkgname="zfs-utils-common=${zol_version}" + spl_utils_pkgname="spl-utils-common=\${pkgver}" + zfs_utils_pkgname="zfs-utils-common=\${pkgver}" # Paths are relative to build.sh spl_dkms_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" zfs_dkms_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${pkgver}/spl-\${pkgver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${pkgver}/zfs-\${pkgver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${pkgver}" + zfs_workdir="\${srcdir}/zfs-\${pkgver}" } update_dkms_git_pkgbuilds() { @@ -64,7 +64,8 @@ update_dkms_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_utils_pkgname="zfs-utils-common-git=${zfs_git_ver}" + zfs_utils_pkgname="zfs-utils-common-git=\${pkgver}" zfs_mod_ver="git" - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/kernels/linux-hardened.sh b/src/kernels/linux-hardened.sh index 937ae32..eade960 100644 --- a/src/kernels/linux-hardened.sh +++ b/src/kernels/linux-hardened.sh @@ -32,57 +32,55 @@ header="\ # archzfs github page. #" -update_linux_hardened_pkgbuilds() { - get_linux_hardened_kernel_version - kernel_version=${latest_kernel_version} - - pkg_list=("spl-linux-hardened" "zfs-linux-hardened") +get_kernel_options() { + msg "Checking the online package database for the latest x86_64 linux-hardened kernel version..." + if ! get_webpage "https://www.archlinux.org/packages/extra/x86_64/linux-hardened/" "(?<=

linux-hardened )[\d\w\.-]+(?=

)"; then + exit 1 + fi + kernel_version=${webpage_output} kernel_version_full=$(kernel_version_full ${kernel_version}) kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) kernel_version_major=${kernel_version%-*} kernel_mod_path="${kernel_version_full}-hardened" + linux_depends="\"linux-hardened=\${_kernelver}\"" + linux_headers_depends="\"linux-hardened-headers=\${_kernelver}\"" +} + +update_linux_hardened_pkgbuilds() { + get_kernel_options + pkg_list=("spl-linux-hardened" "zfs-linux-hardened") archzfs_package_group="archzfs-linux-hardened" - spl_pkgver=${zol_version}_${kernel_version_full_pkgver} - zfs_pkgver=${zol_version}_${kernel_version_full_pkgver} + spl_pkgver=${zol_version} + zfs_pkgver=${zol_version} spl_pkgrel=${pkgrel} zfs_pkgrel=${pkgrel} spl_conflicts="'spl-linux-hardened-git'" zfs_conflicts="'zfs-linux-hardened-git'" - spl_utils_pkgname="spl-utils-common=${zol_version}" spl_pkgname="spl-linux-hardened" - zfs_utils_pkgname="zfs-utils-common=${zol_version}" + spl_utils_pkgname="spl-utils-common=\${_splver}" zfs_pkgname="zfs-linux-hardened" + zfs_utils_pkgname="zfs-utils-common=\${_zfsver}" + # Paths are relative to build.sh spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" - linux_depends="\"linux-hardened=${kernel_version}\"" - linux_headers_depends="\"linux-hardened-headers=${kernel_version}\"" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_splver}/spl-\${_splver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_zfsver}/zfs-\${_zfsver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${_splver}" + zfs_workdir="\${srcdir}/zfs-\${_zfsver}" zfs_makedepends="\"${spl_pkgname}-headers\"" } update_linux_hardened_git_pkgbuilds() { - get_linux_hardened_kernel_version - kernel_version=${latest_kernel_version} - + get_kernel_options pkg_list=("zfs-linux-hardened-git") - kernel_version_full=$(kernel_version_full ${kernel_version}) - kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) - kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version_full}-hardened" archzfs_package_group="archzfs-linux-hardened-git" zfs_pkgver="" # Set later by call to git_calc_pkgver zfs_pkgrel=${pkgrel_git} - zfs_conflicts="'zfs-linux-hardened' 'spl-linux-hardened-git'" + zfs_conflicts="'zfs-linux-hardened' 'spl-linux-hardened-git' 'spl-linux-hardened'" spl_pkgname="" zfs_pkgname="zfs-linux-hardened-git" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - linux_depends="\"linux-hardened=${kernel_version}\"" - linux_headers_depends="\"linux-hardened-headers=${kernel_version}\"" zfs_replaces='replaces=("spl-linux-hardened-git")' - zfs_src_target="git+${zfs_git_url}" zfs_src_hash="SKIP" zfs_makedepends="\"git\"" zfs_workdir="\${srcdir}/zfs" @@ -90,6 +88,7 @@ update_linux_hardened_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_utils_pkgname="zfs-utils-common-git=${zfs_git_ver}" - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_utils_pkgname="zfs-utils-common-git=\${_zfsver}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/kernels/linux-lts.sh b/src/kernels/linux-lts.sh index 95dce0e..5bffa6d 100644 --- a/src/kernels/linux-lts.sh +++ b/src/kernels/linux-lts.sh @@ -32,56 +32,54 @@ header="\ # archzfs github page. #" -update_linux_lts_pkgbuilds() { - get_linux_lts_kernel_version - kernel_version=${latest_kernel_version} - - pkg_list=("spl-linux-lts" "zfs-linux-lts") +get_kernel_options() { + msg "Checking the online package database for the latest x86_64 linux-lts kernel version..." + if ! get_webpage "https://www.archlinux.org/packages/core/x86_64/linux-lts/" "(?<=

linux-lts )[\d\w\.-]+(?=

)"; then + exit 1 + fi + kernel_version=${webpage_output} kernel_version_full=$(kernel_version_full ${kernel_version}) kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) kernel_version_major=${kernel_version%-*} kernel_mod_path="${kernel_version_full}-lts" + linux_depends="\"linux-lts=\${_kernelver}\"" + linux_headers_depends="\"linux-lts-headers=\${_kernelver}\"" +} + +update_linux_lts_pkgbuilds() { + get_kernel_options + pkg_list=("spl-linux-lts" "zfs-linux-lts") archzfs_package_group="archzfs-linux-lts" - spl_pkgver=${zol_version}.${kernel_version_full_pkgver} - zfs_pkgver=${zol_version}.${kernel_version_full_pkgver} + spl_pkgver=${zol_version} + zfs_pkgver=${zol_version} spl_pkgrel=${pkgrel} zfs_pkgrel=${pkgrel} spl_conflicts="'spl-linux-lts-git'" zfs_conflicts="'zfs-linux-lts-git'" spl_pkgname="spl-linux-lts" - spl_utils_pkgname="spl-utils-common=${zol_version}" + spl_utils_pkgname="spl-utils-common=\${_splver}" zfs_pkgname="zfs-linux-lts" - zfs_utils_pkgname="zfs-utils-common=${zol_version}" + zfs_utils_pkgname="zfs-utils-common=\${_zfsver}" # Paths are relative to build.sh spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" - linux_depends="\"linux-lts=${kernel_version}\"" - linux_headers_depends="\"linux-lts-headers=${kernel_version}\"" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_splver}/spl-\${_splver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_zfsver}/zfs-\${_zfsver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${_splver}" + zfs_workdir="\${srcdir}/zfs-\${_zfsver}" zfs_makedepends="\"${spl_pkgname}-headers\"" } update_linux_lts_git_pkgbuilds() { - get_linux_lts_kernel_version - kernel_version=${latest_kernel_version} - + get_kernel_options pkg_list=("zfs-linux-lts-git") - kernel_version_full=$(kernel_version_full ${kernel_version}) - kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) - kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version_full}-lts" archzfs_package_group="archzfs-linux-lts-git" zfs_pkgver="" # Set later by call to git_calc_pkgver zfs_pkgrel=${pkgrel_git} - zfs_conflicts="'zfs-linux-lts' 'spl-linux-lts-git'" + zfs_conflicts="'zfs-linux-lts' 'spl-linux-lts-git' 'spl-linux-lts'" spl_pkgname="" zfs_pkgname="zfs-linux-lts-git" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - linux_depends="\"linux-lts=${kernel_version}\"" - linux_headers_depends="\"linux-lts-headers=${kernel_version}\"" zfs_replaces='replaces=("spl-linux-lts-git")' zfs_src_hash="SKIP" zfs_makedepends="\"git\"" @@ -90,6 +88,7 @@ update_linux_lts_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_utils_pkgname="zfs-utils-common-git=${zfs_git_ver}" - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_utils_pkgname="zfs-utils-common-git=\${_zfsver}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/kernels/linux-vfio.sh b/src/kernels/linux-vfio.sh index 6aeebb3..5a17d2b 100644 --- a/src/kernels/linux-vfio.sh +++ b/src/kernels/linux-vfio.sh @@ -7,7 +7,7 @@ mode_desc="Select and use the packages for the linux-vfio kernel" pkgrel="1" # pkgrel for GIT packages -pkgrel_git="${pkgrel}" +pkgrel_git="1" zfs_git_commit="" spl_git_commit="" zfs_git_url="https://github.com/zfsonlinux/zfs.git" @@ -32,56 +32,54 @@ header="\ # archzfs github page. #" -update_linux_pkgbuilds() { - get_linux_vfio_kernel_version - kernel_version=${latest_kernel_version} - - pkg_list=("spl-linux-vfio" "zfs-linux-vfio") +get_kernel_options() { + msg "Checking linux-vfio download page for the latest linux kernel version..." + if ! get_webpage "https://aur.archlinux.org/packages/linux-vfio" "(?<=linux-vfio )[\d\w\.-]+"; then + exit 1 + fi + kernel_version=${webpage_output} kernel_version_full=$(kernel_version_full ${kernel_version}) kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version/.arch/-arch}-vfio" + kernel_mod_path="\${_kernelver/.arch/-arch}-vfio" + linux_depends="\"linux-vfio=\${_kernelver}\"" + linux_headers_depends="\"linux-vfio-headers=\${_kernelver}\"" +} + +update_linux_vfio_pkgbuilds() { + get_kernel_options + pkg_list=("spl-linux-vfio" "zfs-linux-vfio") archzfs_package_group="archzfs-linux-vfio" - spl_pkgver=${zol_version}.${kernel_version_full_pkgver} - zfs_pkgver=${zol_version}.${kernel_version_full_pkgver} + spl_pkgver=${zol_version} + zfs_pkgver=${zol_version} spl_pkgrel=${pkgrel} zfs_pkgrel=${pkgrel} spl_conflicts="'spl-linux-vfio-git'" zfs_conflicts="'zfs-linux-vfio-git'" - spl_utils_pkgname="spl-utils-common=${zol_version}" spl_pkgname="spl-linux-vfio" - zfs_utils_pkgname="zfs-utils-common=${zol_version}" + spl_utils_pkgname="spl-utils-common=\${_splver}" zfs_pkgname="zfs-linux-vfio" + zfs_utils_pkgname="zfs-utils-common=\${_zfsver}" # Paths are relative to build.sh spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" - linux_depends="\"linux-vfio=${kernel_version}\"" - linux_headers_depends="\"linux-vfio-headers=${kernel_version}\"" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_splver}/spl-\${_splver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_zfsver}/zfs-\${_zfsver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${_splver}" + zfs_workdir="\${srcdir}/zfs-\${_zfsver}" zfs_makedepends="\"${spl_pkgname}-headers\"" } -update_linux_git_pkgbuilds() { - get_linux_vfio_kernel_version - kernel_version=${latest_kernel_version} - +update_linux_vfio_git_pkgbuilds() { + get_kernel_options pkg_list=("zfs-linux-vfio-git") - kernel_version_full=$(kernel_version_full ${kernel_version}) - kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) - kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version/.arch/-arch}-vfio" archzfs_package_group="archzfs-linux-vfio-git" zfs_pkgver="" # Set later by call to git_calc_pkgver zfs_pkgrel=${pkgrel_git} - zfs_conflicts="'zfs-linux-vfio' 'spl-linux-vfio-git'" + zfs_conflicts="'zfs-linux-vfio' 'spl-linux-vfio-git' 'spl-linux-vfio'" spl_pkgname="" zfs_pkgname="zfs-linux-vfio-git" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - linux_depends="\"linux-vfio=${kernel_version}\"" - linux_headers_depends="\"linux-vfio-headers=${kernel_version}\"" zfs_replaces='replaces=("spl-linux-vfio-git")' zfs_src_hash="SKIP" zfs_makedepends="\"git\"" @@ -90,6 +88,7 @@ update_linux_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_utils_pkgname="zfs-utils-common-git=${zfs_git_ver}" - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_utils_pkgname="zfs-utils-common-git=\${_zfsver}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/kernels/linux-zen.sh b/src/kernels/linux-zen.sh index 9b1df1e..c3c4eab 100644 --- a/src/kernels/linux-zen.sh +++ b/src/kernels/linux-zen.sh @@ -7,7 +7,7 @@ mode_desc="Select and use the packages for the linux-zen kernel" pkgrel="1" # pkgrel for GIT packages -pkgrel_git="${pkgrel}" +pkgrel_git="1" zfs_git_commit="" spl_git_commit="" zfs_git_url="https://github.com/zfsonlinux/zfs.git" @@ -32,56 +32,54 @@ header="\ # archzfs github page. #" -update_linux_pkgbuilds() { - get_linux_zen_kernel_version - kernel_version=${latest_kernel_version} - - pkg_list=("spl-linux-zen" "zfs-linux-zen") +get_kernel_options() { + msg "Checking the online package database for the latest x86_64 linux-zen kernel version..." + if ! get_webpage "https://www.archlinux.org/packages/extra/x86_64/linux-zen/" "(?<=

linux-zen )[\d\w\.-]+(?=

)"; then + exit 1 + fi + kernel_version=${webpage_output} kernel_version_full=$(kernel_version_full ${kernel_version}) kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version/.zen/-zen}-zen" + kernel_mod_path="\${_kernelver/.zen/-zen}-zen" + linux_depends="\"linux-zen=\${_kernelver}\"" + linux_headers_depends="\"linux-zen-headers=\${_kernelver}\"" +} + +update_linux_zen_pkgbuilds() { + get_kernel_options + pkg_list=("spl-linux-zen" "zfs-linux-zen") archzfs_package_group="archzfs-linux-zen" - spl_pkgver=${zol_version}.${kernel_version_full_pkgver} - zfs_pkgver=${zol_version}.${kernel_version_full_pkgver} + spl_pkgver=${zol_version} + zfs_pkgver=${zol_version} spl_pkgrel=${pkgrel} zfs_pkgrel=${pkgrel} spl_conflicts="'spl-linux-zen-git'" zfs_conflicts="'zfs-linux-zen-git'" - spl_utils_pkgname="spl-utils-common=${zol_version}" spl_pkgname="spl-linux-zen" - zfs_utils_pkgname="zfs-utils-common=${zol_version}" + spl_utils_pkgname="spl-utils-common=\${_splver}" zfs_pkgname="zfs-linux-zen" + zfs_utils_pkgname="zfs-utils-common=\${_zfsver}" # Paths are relative to build.sh spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" - linux_depends="\"linux-zen=${kernel_version}\"" - linux_headers_depends="\"linux-zen-headers=${kernel_version}\"" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_splver}/spl-\${_splver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_zfsver}/zfs-\${_zfsver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${_splver}" + zfs_workdir="\${srcdir}/zfs-\${_zfsver}" zfs_makedepends="\"${spl_pkgname}-headers\"" } -update_linux_git_pkgbuilds() { - get_linux_zen_kernel_version - kernel_version=${latest_kernel_version} - +update_linux_zen_git_pkgbuilds() { + get_kernel_options pkg_list=("zfs-linux-zen-git") - kernel_version_full=$(kernel_version_full ${kernel_version}) - kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) - kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version/.zen/-zen}-zen" archzfs_package_group="archzfs-linux-zen-git" zfs_pkgver="" # Set later by call to git_calc_pkgver zfs_pkgrel=${pkgrel_git} - zfs_conflicts="'zfs-linux-zen' 'spl-linux-zen-git'" + zfs_conflicts="'zfs-linux-zen' 'spl-linux-zen-git' 'spl-linux-zen'" spl_pkgname="" zfs_pkgname="zfs-linux-zen-git" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - linux_depends="\"linux-zen=${kernel_version}\"" - linux_headers_depends="\"linux-zen-headers=${kernel_version}\"" zfs_replaces='replaces=("spl-linux-zen-git")' zfs_src_hash="SKIP" zfs_makedepends="\"git\"" @@ -90,6 +88,7 @@ update_linux_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_utils_pkgname="zfs-utils-common-git=${zfs_git_ver}" - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_utils_pkgname="zfs-utils-common-git=\${_zfsver}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/kernels/linux.sh b/src/kernels/linux.sh index d0d67a3..408a21f 100644 --- a/src/kernels/linux.sh +++ b/src/kernels/linux.sh @@ -30,61 +30,58 @@ header="\ # If you have a custom kernel, you will need to change things in the PKGBUILDS. If you would like to have AUR or archzfs repo # packages for your favorite kernel package built using the archzfs build tools, submit a request in the Issue tracker on the # archzfs github page. -# #" -update_linux_pkgbuilds() { - get_linux_kernel_version - kernel_version=${latest_kernel_version} - - pkg_list=("spl-linux" "zfs-linux") +get_kernel_options() { + msg "Checking the online package database for the latest x86_64 linux kernel version..." + if ! get_webpage "https://www.archlinux.org/packages/core/x86_64/linux/" "(?<=

linux )[\d\w\.-]+(?=

)"; then + exit 1 + fi + kernel_version=${webpage_output} kernel_version_full=$(kernel_version_full ${kernel_version}) kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version/.arch/-arch}-ARCH" + kernel_mod_path="\${_kernelver/.arch/-arch}-ARCH" + linux_depends="\"linux=\${_kernelver}\"" + linux_headers_depends="\"linux-headers=\${_kernelver}\"" +} + +update_linux_pkgbuilds() { + get_kernel_options + pkg_list=("spl-linux" "zfs-linux") archzfs_package_group="archzfs-linux" - spl_pkgver=${zol_version}.${kernel_version_full_pkgver} - zfs_pkgver=${zol_version}.${kernel_version_full_pkgver} + spl_pkgver=${zol_version} + zfs_pkgver=${zol_version} spl_pkgrel=${pkgrel} zfs_pkgrel=${pkgrel} spl_conflicts="'spl-linux-git'" zfs_conflicts="'zfs-linux-git'" spl_pkgname="spl-linux" - spl_utils_pkgname="spl-utils-common=${zol_version}" + spl_utils_pkgname="spl-utils-common=\${_splver}" zfs_pkgname="zfs-linux" - zfs_utils_pkgname="zfs-utils-common=${zol_version}" + zfs_utils_pkgname="zfs-utils-common=\${_zfsver}" # Paths are relative to build.sh spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" - zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" - spl_workdir="\${srcdir}/spl-${zol_version}" - zfs_workdir="\${srcdir}/zfs-${zol_version}" - linux_depends="\"linux=${kernel_version}\"" - linux_headers_depends="\"linux-headers=${kernel_version}\"" + spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_splver}/spl-\${_splver}.tar.gz" + zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_zfsver}/zfs-\${_zfsver}.tar.gz" + spl_workdir="\${srcdir}/spl-\${_splver}" + zfs_workdir="\${srcdir}/zfs-\${_zfsver}" spl_replaces='replaces=("spl-git")' zfs_replaces='replaces=("zfs-git")' zfs_makedepends="\"${spl_pkgname}-headers\"" } update_linux_git_pkgbuilds() { - get_linux_kernel_version - kernel_version=${latest_kernel_version} - + get_kernel_options pkg_list=("zfs-linux-git") - kernel_version_full=$(kernel_version_full ${kernel_version}) - kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) - kernel_version_major=${kernel_version%-*} - kernel_mod_path="${kernel_version/.arch/-arch}-ARCH" archzfs_package_group="archzfs-linux-git" zfs_pkgver="" # Set later by call to git_calc_pkgver zfs_pkgrel=${pkgrel_git} - zfs_conflicts="'zfs-linux' 'spl-linux-git'" + zfs_conflicts="'zfs-linux' 'spl-linux-git' 'spl-linux'" spl_pkgname="" zfs_pkgname="zfs-linux-git" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" - linux_depends="\"linux=${kernel_version}\"" - linux_headers_depends="\"linux-headers=${kernel_version}\"" zfs_replaces='replaces=("spl-linux-git")' zfs_src_hash="SKIP" zfs_makedepends="\"git\"" @@ -93,6 +90,7 @@ update_linux_git_pkgbuilds() { git_check_repo git_calc_pkgver fi - zfs_utils_pkgname="zfs-utils-common-git=${zfs_git_ver}" - zfs_src_target="git+${zfs_git_url}#commit=${latest_zfs_git_commit}" + zfs_utils_pkgname="zfs-utils-common-git=\${_zfsver}" + zfs_set_commit="_commit='${latest_zfs_git_commit}'" + zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" } diff --git a/src/spl/PKGBUILD.sh b/src/spl/PKGBUILD.sh index d2c8c13..78df3de 100755 --- a/src/spl/PKGBUILD.sh +++ b/src/spl/PKGBUILD.sh @@ -4,7 +4,12 @@ cat << EOF > ${spl_pkgbuild_path}/PKGBUILD ${header} pkgbase="${spl_pkgname}" pkgname=("${spl_pkgname}" "${spl_pkgname}-headers") -pkgver=${spl_pkgver} + +_splver="${spl_pkgver}" +_kernelver="${kernel_version}" +_extramodules="${kernel_mod_path}" + +pkgver="\${_splver}_\$(echo \${_kernelver} | sed s/-/./g)" pkgrel=${spl_pkgrel} makedepends=(${linux_headers_depends} ${spl_makedepends}) arch=("x86_64") @@ -25,8 +30,8 @@ build() { cd "${spl_workdir}" ./autogen.sh ./configure --prefix=/usr --libdir=/usr/lib --sbindir=/usr/bin \\ - --with-linux=/usr/lib/modules/${kernel_mod_path}/build \\ - --with-linux-obj=/usr/lib/modules/${kernel_mod_path}/build \\ + --with-linux=/usr/lib/modules/\${_extramodules}/build \\ + --with-linux-obj=/usr/lib/modules/\${_extramodules}/build \\ --with-config=kernel make } @@ -55,7 +60,7 @@ package_${spl_pkgname}-headers() { rm -r "\${pkgdir}/lib" # Remove reference to \${srcdir} - sed -i "s+\${srcdir}++" \${pkgdir}/usr/src/spl-*/${kernel_mod_path}/Module.symvers + sed -i "s+\${srcdir}++" \${pkgdir}/usr/src/spl-*/\${_extramodules}/Module.symvers } EOF diff --git a/src/zfs-dkms/PKGBUILD.sh b/src/zfs-dkms/PKGBUILD.sh index f74fe52..4cb81b1 100755 --- a/src/zfs-dkms/PKGBUILD.sh +++ b/src/zfs-dkms/PKGBUILD.sh @@ -9,6 +9,7 @@ fi cat << EOF > ${zfs_dkms_pkgbuild_path}/PKGBUILD ${header} pkgname="${zfs_pkgname}" +${zfs_set_commit} pkgdesc="Kernel modules for the Zettabyte File System." pkgver=${zfs_pkgver} pkgrel=${zfs_pkgrel} diff --git a/src/zfs-utils/PKGBUILD.sh b/src/zfs-utils/PKGBUILD.sh index ba720b4..1ef5c4f 100755 --- a/src/zfs-utils/PKGBUILD.sh +++ b/src/zfs-utils/PKGBUILD.sh @@ -9,6 +9,7 @@ fi cat << EOF > ${zfs_utils_pkgbuild_path}/PKGBUILD ${header} pkgname="${zfs_utils_pkgname}" +${zfs_set_commit} pkgver=${zfs_pkgver} pkgrel=${zfs_pkgrel} pkgdesc="Kernel module support files for the Zettabyte File System." @@ -39,7 +40,7 @@ build() { ./autogen.sh ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --with-mounthelperdir=/usr/bin \\ --libdir=/usr/lib --datadir=/usr/share --includedir=/usr/include \\ - --with-udevdir=/lib/udev --libexecdir=/usr/lib/zfs-${zol_version} \\ + --with-udevdir=/lib/udev --libexecdir=/usr/lib/zfs-\${pkgver} \\ --with-config=user --enable-systemd make } diff --git a/src/zfs/PKGBUILD.sh b/src/zfs/PKGBUILD.sh index 6751a5a..ca4814c 100755 --- a/src/zfs/PKGBUILD.sh +++ b/src/zfs/PKGBUILD.sh @@ -10,7 +10,13 @@ cat << EOF > ${zfs_pkgbuild_path}/PKGBUILD ${header} pkgbase="${zfs_pkgname}" pkgname=("${zfs_pkgname}" "${zfs_pkgname}-headers") -pkgver=${zfs_pkgver} + +${zfs_set_commit} +_zfsver="${zfs_pkgver}" +_kernelver="${kernel_version}" +_extramodules="${kernel_mod_path}" + +pkgver="\${_zfsver}_\$(echo \${_kernelver} | sed s/-/./g)" pkgrel=${zfs_pkgrel} makedepends=(${linux_headers_depends} ${zfs_makedepends}) arch=("x86_64") @@ -31,9 +37,9 @@ build() { ./autogen.sh ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \\ --datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \\ - --libexecdir=/usr/lib/zfs-${zol_version} --with-config=kernel \\ - --with-linux=/usr/lib/modules/${kernel_mod_path}/build \\ - --with-linux-obj=/usr/lib/modules/${kernel_mod_path}/build + --libexecdir=/usr/lib/zfs-\${zfsver} --with-config=kernel \\ + --with-linux=/usr/lib/modules/\${_extramodules}/build \\ + --with-linux-obj=/usr/lib/modules/\${_extramodules}/build make } @@ -63,7 +69,7 @@ package_${zfs_pkgname}-headers() { rm -r "\${pkgdir}/lib" # Remove reference to \${srcdir} - sed -i "s+\${srcdir}++" \${pkgdir}/usr/src/zfs-*/${kernel_mod_path}/Module.symvers + sed -i "s+\${srcdir}++" \${pkgdir}/usr/src/zfs-*/\${_extramodules}/Module.symvers } EOF