From 09df5d69b09d2f13dd4c791a33df5b932f5ba553 Mon Sep 17 00:00:00 2001 From: Dan Ziemba Date: Sat, 18 Jul 2015 00:58:24 -0400 Subject: [PATCH] Fixes separate runs of packaging single packages See Move-common-vars-outside-package.patch attached to https://bugs.archlinux.org/task/43885#comment137004 --- PKGBUILD | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 62dff94..ff82876 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -118,6 +118,17 @@ build() { make ${MAKEFLAGS} LOCALVERSION= bzImage modules } +_common_package() { + cd "${srcdir}/${_srcname}" + + KARCH=x86 + + # get kernel version + _kernver="$(make LOCALVERSION= kernelrelease)" + _basekernel=${_kernver%%-*} + _basekernel=${_basekernel%.*} +} + _package() { pkgdesc="The Linux kernel and modules with patches to enable GPU passthrough with KVM" [ "${pkgbase}" = "linux" ] && groups=('base') @@ -129,15 +140,6 @@ _package() { backup=("etc/mkinitcpio.d/${pkgbase}.preset") install=linux.install - cd "${srcdir}/${_srcname}" - - KARCH=x86 - - # get kernel version - _kernver="$(make LOCALVERSION= kernelrelease)" - _basekernel=${_kernver%%-*} - _basekernel=${_basekernel%.*} - mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot} make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" @@ -321,6 +323,7 @@ pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs") for _p in ${pkgname[@]}; do eval "package_${_p}() { $(declare -f "_package${_p#${pkgbase}}") + _common_package _package${_p#${pkgbase}} }" done