From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A5384138335 for ; Fri, 29 Mar 2019 04:13:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CD369E0895; Fri, 29 Mar 2019 04:13:55 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A02BFE0895 for ; Fri, 29 Mar 2019 04:13:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A0378335CD7 for ; Fri, 29 Mar 2019 04:13:53 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A2E71326 for ; Fri, 29 Mar 2019 04:13:51 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1553827882.a42e9e779795d1a4eff1a48ba14e70f03a64b98e.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_funcs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: a42e9e779795d1a4eff1a48ba14e70f03a64b98e X-VCS-Branch: master Date: Fri, 29 Mar 2019 04:13:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 22d0f282-6f6e-4a3c-afaf-2f4f162f5663 X-Archives-Hash: 66583938b582547c43ba5e41cee4f8f3 commit: a42e9e779795d1a4eff1a48ba14e70f03a64b98e Author: Thomas Deutschmann gentoo org> AuthorDate: Fri Mar 29 02:47:43 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Fri Mar 29 02:51:22 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a42e9e77 Add new function expand_file() to allow file path expansion Relies on Python os.path.expanduser and realpath from coreutils. Bug: https://bugs.gentoo.org/412321 Signed-off-by: Thomas Deutschmann gentoo.org> gen_funcs.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gen_funcs.sh b/gen_funcs.sh index 95c8f30..ba45b02 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -538,6 +538,25 @@ check_distfiles() { done } +expand_file() { + [[ "$#" -lt '1' ]] && + echo '' + + local file="${1}" + local expanded_file= + + expanded_file=$(python -c "import os; print(os.path.expanduser('${file}'))" 2>/dev/null) + if [ -z "${expanded_file}" ] + then + # if Python failed for some reason, just reset + expanded_file=${file} + fi + + expanded_file=$(realpath -q "${expanded_file}" 2>/dev/null) + + echo "${expanded_file}" +} + find_kernel_binary() { local kernel_binary=$* local curdir=$(pwd)