From a9bca2663378694660dfa4579cf33d580fc8d51a Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 3 Sep 2018 09:45:32 +0200 Subject: [PATCH] main/linux-postmarketos-*-dev: fix kernel-scripts When cross compiling, the kernel scripts would be in the native arch again. That was already fixed in !1234, however the mime type of the binaries has changed, so we couldn't detect them properly anymore (#1659). This commit fixes it again, and also adds a checks so this won't silently fail in the future. [skip ci] because this would not run through anyway (building these packages takes too long). Fixes #1659. --- main/linux-postmarketos-mainline/APKBUILD | 11 +++++++++-- main/linux-postmarketos-qcom/APKBUILD | 13 ++++++++++--- main/linux-postmarketos-stable/APKBUILD | 11 +++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/main/linux-postmarketos-mainline/APKBUILD b/main/linux-postmarketos-mainline/APKBUILD index b36bea3ba..0533b4463 100644 --- a/main/linux-postmarketos-mainline/APKBUILD +++ b/main/linux-postmarketos-mainline/APKBUILD @@ -9,7 +9,7 @@ _kernver=${pkgver%_rc*} _mainver=${_kernver%.*} _patchlevel=${_kernver/$_mainver./} _basever=${_mainver}.$((_patchlevel-1)) -pkgrel=0 +pkgrel=1 arch="x86_64 armhf aarch64" pkgdesc="Linux for pmOS supported chipsets (mainline, more bleeding-edge than stable)" @@ -165,14 +165,21 @@ dev() { if [ -n "$CROSS_COMPILE" ]; then msg "Symlinking binary scripts..." depends="$depends kernel-scripts" + local found="false" cd "$dir/scripts" local i for i in $(find . -type f); do local type="$(file -b --mime-type "$i")" - [ "$type" != "application/x-sharedlib" ] && continue + [ "$type" != "application/x-pie-executable" ] && continue local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)" ln -svf "$native" "$i" + found="true" done + if [ "$found" = "false" ]; then + error "Failed to symlink binary scripts!" + error "Did the mime-type change (see #1659)?" + return 1 + fi fi } sha512sums="4d9de340a26155a89ea8773131c76220cc2057f2b5d031b467b60e8b14c1842518e2d60a863d8c695f0f7640f3f18d43826201984a238dade857b6cef79837db linux-4.17.tar.xz diff --git a/main/linux-postmarketos-qcom/APKBUILD b/main/linux-postmarketos-qcom/APKBUILD index 22e453522..c03a52929 100644 --- a/main/linux-postmarketos-qcom/APKBUILD +++ b/main/linux-postmarketos-qcom/APKBUILD @@ -4,7 +4,7 @@ _config="config-${_flavor}.${CARCH}" pkgname=linux-${_flavor} pkgver=4.17_rc3 -pkgrel=4 +pkgrel=5 arch="armhf" pkgdesc="Kernel close to mainline with extra patches for Qualcomm devices" @@ -38,7 +38,7 @@ builddir="$srcdir/linux-postmarketos-${_commit}" prepare() { local _patch_failed= - ls "$srcdir" + ls "$srcdir" cd "$builddir" # first apply patches in specified order for i in $source; do @@ -164,14 +164,21 @@ dev() { if [ -n "$CROSS_COMPILE" ]; then msg "Symlinking binary scripts..." depends="$depends kernel-scripts" + local found="false" cd "$dir/scripts" local i for i in $(find . -type f); do local type="$(file -b --mime-type "$i")" - [ "$type" != "application/x-sharedlib" ] && continue + [ "$type" != "application/x-pie-executable" ] && continue local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)" ln -svf "$native" "$i" + found="true" done + if [ "$found" = "false" ]; then + error "Failed to symlink binary scripts!" + error "Did the mime-type change (see #1659)?" + return 1 + fi fi } sha512sums="02fd136d24914e30decd207c3b2e0168cc9d6e4a0fc981abf8d537cd95c70583f5239d0dc7f2ae94a2ddd2ba82d822933159167801a035731a24aa1300c5ceec linux-09efb4857f1a4119eced855912043817bd96e064.tar.gz diff --git a/main/linux-postmarketos-stable/APKBUILD b/main/linux-postmarketos-stable/APKBUILD index 6745781de..8ccbdcc9e 100644 --- a/main/linux-postmarketos-stable/APKBUILD +++ b/main/linux-postmarketos-stable/APKBUILD @@ -9,7 +9,7 @@ case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac -pkgrel=0 +pkgrel=1 arch="x86_64 armhf aarch64" pkgdesc="Linux for pmOS supported chipsets (stable)" @@ -172,14 +172,21 @@ dev() { if [ -n "$CROSS_COMPILE" ]; then msg "Symlinking binary scripts..." depends="$depends kernel-scripts" + local found="false" cd "$dir/scripts" local i for i in $(find . -type f); do local type="$(file -b --mime-type "$i")" - [ "$type" != "application/x-sharedlib" ] && continue + [ "$type" != "application/x-pie-executable" ] && continue local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)" ln -svf "$native" "$i" + found="true" done + if [ "$found" = "false" ]; then + error "Failed to symlink binary scripts!" + error "Did the mime-type change (see #1659)?" + return 1 + fi fi }