diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2023-10-22 00:52:11 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2023-10-26 19:05:56 -0400 |
commit | 18e23e2cc3d1557fc3622d52efac30d168aaa416 (patch) | |
tree | 930ec8866431d81e8eedb4dd47bc73b290913f4f /scripts/package-all-acpi_call-tp_smapi | |
parent | 720999f1f6cd213db20e33eddfb8f2dd91776c99 (diff) |
[scripts/package-all-acpi_call-tp_smapi]: modify PKGBUILDs - commit to VCS - skip unsupported arches
Diffstat (limited to 'scripts/package-all-acpi_call-tp_smapi')
-rwxr-xr-x | scripts/package-all-acpi_call-tp_smapi | 77 |
1 files changed, 51 insertions, 26 deletions
diff --git a/scripts/package-all-acpi_call-tp_smapi b/scripts/package-all-acpi_call-tp_smapi index 6575fdb1d..8ff5f8a7a 100755 --- a/scripts/package-all-acpi_call-tp_smapi +++ b/scripts/package-all-acpi_call-tp_smapi @@ -1,45 +1,70 @@ #!/bin/bash -# TODO: inject the appropriate values of '_basekernel' into the PKGBUILDs, -# and commit to VCS -# $ _commit_msg='[acpi_call][acpi_call-dkms][acpi_call-lts][tp_smapi][tp_smapi-lts]: rebuild against latest kernels' -# $ git commit -m "${_commit_msg}" "${PKGBUILDS[@]}" - -readonly KERNEL_VER=6.1.5 +readonly KERNEL_VER=6.5.8 readonly KERNEL_LTS_VER=5.15.88 -readonly CHROOT_NAME_x86_64=x86_64 -readonly CHROOT_NAME_i686=i686 -readonly CHROOT_NAME_armv7h=armv7h -readonly CHROOT_NAMES=( $CHROOT_NAME_x86_64 $CHROOT_NAME_i686 $CHROOT_NAME_armv7h ) -readonly ABS_ROOT=/var/lib/archbuild/packages/abslibre -readonly PKG_DIRS=( $ABS_ROOT/libre/acpi_call{-dkms,,-lts} # NOTE: -dkms first - $ABS_ROOT/libre/tp_smapi{,-lts} ) # no trailing slashes +readonly CHROOT_NAMES=( armv7h i686 x86_64 ) +readonly ABS_ROOT=/var/lib/archbuild/abslibre # no spaces +readonly PKG_DIRS=( ${ABS_ROOT}/libre/acpi_call{-dkms,,-lts} # -dkms first + ${ABS_ROOT}/libre/tp_smapi{,-lts} ) # no trailing slashes +readonly PKGBUILDS=( ${PKG_DIRS[*]/%/\/PKGBUILD} ) Main() { - local arch pkg_dir kver + local chroot pkg_dir kver pkgname pkgver pkgrel arches chroot_dir arch + local pkgs=() + local all_pkgs=() + local commit_msg='' - for arch in ${CHROOT_NAMES[*]} - do sudo librechroot -n $arch update || exit 1 + for chroot in ${CHROOT_NAMES[*]} + do sudo librechroot -n ${chroot} update || exit 1 done for pkg_dir in ${PKG_DIRS[*]} - do kver=$( [[ $pkg_dir =~ -lts$ ]] && echo ${KERNEL_LTS_VER} || echo ${KERNEL_VER} ) + do kver=$( [[ "${pkg_dir}" =~ -lts$ ]] && echo ${KERNEL_LTS_VER} || echo ${KERNEL_VER} ) + pkgs=() + + [[ -d "${pkg_dir}" && -f "${pkg_dir}"/PKGBUILD ]] || + ! echo "${pkg_dir} - no such PKGBUILD" || continue + + cd ${pkg_dir}/ ; git checkout HEAD PKGBUILD &> /dev/null ; + + pkgname=$(source PKGBUILD ; echo ${pkgname} ;) + pkgver=$( source PKGBUILD ; echo ${pkgver} ;) + pkgrel=$( source PKGBUILD ; echo ${pkgrel} ;) + arches="$(source PKGBUILD ; echo ${arch[*]} ;)" + ! [[ "${pkgrel}" =~ \.basekernel${kver}$ ]] || + ! echo "${pkg_dir} - skipping PKGBUILD" || continue - cd $pkg_dir/ + sed -i "s|^_basekernel=.*|_basekernel=${kver}|" PKGBUILD + pkgrel=$( source PKGBUILD ; echo ${pkgrel} ;) + [[ "${pkgrel}" =~ \.basekernel${kver}$ ]] || + ! echo "ERROR: ${pkg_dir} - PKGBUILD not modified" || continue - sed -i "s|_basekernel=.*|_basekernel=${kver}|" PKGBUILD + for chroot in ${CHROOT_NAMES[*]} + do chroot_dir=$(librechroot -n ${chroot} |& grep -E 'copydir +: ' | cut -d: -f2) + arch=$(source ${chroot_dir}/etc/os-release ; sed 's|-.*||' <<<${VARIANT_ID}) + [[ -n "${arch}" && " ${arches} " =~ " ${arch} " ]] || continue - for arch in ${CHROOT_NAMES[*]} - do sed "s|/$|| ; s|.*/\(.*\)|\1 ($arch)|" <<<$pkg_dir + echo "building pkgname: ${pkgname} in chroot: ${chroot}" + sudo libremakepkg -n ${chroot} - sudo libremakepkg -n $arch || break + pkgs+=( $(ls ${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.zst 2> /dev/null) ) done + + if (( ${#pkgs[*]} )) + then all_pkgs+=( ${pkgs[*]} ) + commit_msg+="[$(basename ${pkg_dir})]" + else echo "ERROR: ${pkg_dir} - no packages generated" + fi done - echo DONE ; printf "%s/*.pkg.tar.* " "${PKG_DIRS[@]}" ; - ls $ABS_ROOT/libre/acpi_call{-dkms,,-lts}/*.pkg.tar.* \ - $ABS_ROOT/libre/tp_smapi{,-lts}/*.pkg.tar.* -} ; Main ; + if (( ${#all_pkgs[*]} )) + then git commit -m "${commit_msg}: rebuild against latest kernels" ${PKGBUILDS[*]} + fi + echo "(${#all_pkgs[*]}) packages generated" ; printf "%s\n" ${all_pkgs[*]} ; +} + + +Main |