diff options
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | 0001-scripts-template_dir-don-t-let-y-override-no-rc.patch | 28 | ||||
-rw-r--r-- | 0002-scripts-template_dir-don-t-prompt-for-cmake-when-y-s.patch | 33 | ||||
-rw-r--r-- | 0003-scripts-template_dir-re-use-common-prompting-code.patch | 108 | ||||
-rw-r--r-- | 0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch | 92 | ||||
-rw-r--r-- | PKGBUILD | 35 | ||||
-rw-r--r-- | setup-unattended.patch | 44 |
7 files changed, 294 insertions, 58 deletions
@@ -1,7 +1,7 @@ pkgbase = zephyr-sdk pkgdesc = SDK for Zephyr real-time operating system pkgver = 0.11.4 - pkgrel = 1 + pkgrel = 2 url = https://www.zephyrproject.org/ install = zephyr-sdk.install arch = x86_64 @@ -49,10 +49,16 @@ pkgbase = zephyr-sdk options = !strip source = https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.11.4/zephyr-sdk-0.11.4-setup.run source = zephyrrc - source = setup-unattended.patch + source = 0001-scripts-template_dir-don-t-let-y-override-no-rc.patch + source = 0002-scripts-template_dir-don-t-prompt-for-cmake-when-y-s.patch + source = 0003-scripts-template_dir-re-use-common-prompting-code.patch + source = 0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch sha256sums = f61041a7cd7beec9c8f826e7aa1215a4c34c309c56a3dc0967b8b3401633d1b4 sha256sums = 7a1257272c64bdec281283d391e3149cece065935c9e8394d6bece32d0f6fc05 - sha256sums = cc57a1304ae53bf155f32d41a5b527fb207716f027e4997ccb7b14c09064c7dc + sha256sums = 5a5e1f8cd28f15da3cb9c4c50bf7ccb81fdb15499c02625dc76ed27c98ffad4f + sha256sums = a1a64dd3152871056b6d79bf3fd31cb1e081a8b9354fae929a263e7f74044050 + sha256sums = f22ade1773ed8302a11b1ded4cef28ad9630119354d20db334fdb5df6db6f820 + sha256sums = 4c1f7e68ba1400786f116c2305ec32fa1e00b09367d583770a21bf3056fada46 pkgname = zephyr-sdk diff --git a/0001-scripts-template_dir-don-t-let-y-override-no-rc.patch b/0001-scripts-template_dir-don-t-let-y-override-no-rc.patch new file mode 100644 index 000000000000..aed4ac006242 --- /dev/null +++ b/0001-scripts-template_dir-don-t-let-y-override-no-rc.patch @@ -0,0 +1,28 @@ +From b8d47d156f3e89237a80b349eb2ec48160046b05 Mon Sep 17 00:00:00 2001 +From: Alexei Colin <ac@alexeicolin.com> +Date: Sat, 18 Jul 2020 12:06:52 -0400 +Subject: [PATCH 1/4] scripts/template_dir: don't let -y override -[no]rc + +Overlooked in 6dd3e26c271bbf139f6d30523bc55fc7673b52f5 +--- + scripts/template_dir | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/scripts/template_dir b/scripts/template_dir +index 1ae2794..ab3394c 100644 +--- a/scripts/template_dir ++++ b/scripts/template_dir +@@ -66,7 +66,9 @@ while [ "$1" != "" ]; do + ;; + -y ) + confirm="y"; +- rc_confirm="y"; ++ if [ -z "$rc_confirm" ]; then ++ rc_confirm="y" ++ fi + ;; + -rc ) + rc_confirm="y"; +-- +2.27.0 + diff --git a/0002-scripts-template_dir-don-t-prompt-for-cmake-when-y-s.patch b/0002-scripts-template_dir-don-t-prompt-for-cmake-when-y-s.patch new file mode 100644 index 000000000000..a7afbb9acb60 --- /dev/null +++ b/0002-scripts-template_dir-don-t-prompt-for-cmake-when-y-s.patch @@ -0,0 +1,33 @@ +From e2e27bb5c5c044203c6085279a99514416799c51 Mon Sep 17 00:00:00 2001 +From: Alexei Colin <ac@alexeicolin.com> +Date: Sat, 18 Jul 2020 12:04:52 -0400 +Subject: [PATCH 2/4] scripts/template_dir: don't prompt for cmake when -y set + +--- + scripts/template_dir | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/scripts/template_dir b/scripts/template_dir +index ab3394c..b03d4b5 100644 +--- a/scripts/template_dir ++++ b/scripts/template_dir +@@ -163,15 +163,7 @@ do_cmake_package() + return + fi + +- echo "Do you want to register the Zephyr-sdk at location: $target_sdk_dir" +- echo " in the CMake package registry (y/n)?" +- +- while read confirm; do +- [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \ +- -o "$confirm" = "N" ] && break +- echo "Invalid input \"$confirm\", please input 'y' or 'n': " +- done +- ++ read_confirm "registering Zephyr-sdk CMake module with path $target_sdk_dir " + if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then + if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then + mkdir -p $ZEPHYR_SDK_REGISTRY_DIR +-- +2.27.0 + diff --git a/0003-scripts-template_dir-re-use-common-prompting-code.patch b/0003-scripts-template_dir-re-use-common-prompting-code.patch new file mode 100644 index 000000000000..7b9cdef2b55a --- /dev/null +++ b/0003-scripts-template_dir-re-use-common-prompting-code.patch @@ -0,0 +1,108 @@ +From 03933375277558f939a12990cae3ee372511d87e Mon Sep 17 00:00:00 2001 +From: Alexei Colin <ac@alexeicolin.com> +Date: Sat, 18 Jul 2020 12:14:07 -0400 +Subject: [PATCH 3/4] scripts/template_dir: re-use common prompting code + +--- + scripts/template_dir | 56 ++++++++++++++++++++++++-------------------- + 1 file changed, 31 insertions(+), 25 deletions(-) + +diff --git a/scripts/template_dir b/scripts/template_dir +index b03d4b5..0a0d69e 100644 +--- a/scripts/template_dir ++++ b/scripts/template_dir +@@ -131,15 +131,10 @@ do_zephyrrc() + echo " export ZEPHYR_SDK_INSTALL_DIR=$target_sdk_dir" + echo + if [ -z "$rc_confirm" ]; then +- echo "Update/Create $HOME/.zephyrrc with environment variables setup for you (y/n)? " +- while read rc_confirm; do +- [ "$rc_confirm" = "Y" -o "$rc_confirm" = "y" \ +- -o "$rc_confirm" = "n" \ +- -o "$rc_confirm" = "N" ] && break +- echo "Invalid input \"$rc_confirm\", please input 'y' or 'n': " +- done ++ prompt "creating/updating $HOME/.zephyrrc with environment variables setup for you " ++ rc_confirm=$answer + fi +- if [ "$rc_confirm" = "y" -o "$rc_confirm" = "Y" ]; then ++ if [ "$rc_confirm" = "y" ]; then + if [ -f $HOME/.zephyrrc ]; then + sed -i "s#ZEPHYR_SDK_INSTALL_DIR=.*#ZEPHYR_SDK_INSTALL_DIR=${target_sdk_dir}#" $HOME/.zephyrrc + sed -i "s#ZEPHYR_TOOLCHAIN_VARIANT=.*#ZEPHYR_TOOLCHAIN_VARIANT=zephyr#" $HOME/.zephyrrc +@@ -163,8 +158,8 @@ do_cmake_package() + return + fi + +- read_confirm "registering Zephyr-sdk CMake module with path $target_sdk_dir " +- if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then ++ query "registering Zephyr-sdk CMake module with path $target_sdk_dir " ++ if [ "$answer" = "y" ]; then + if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then + mkdir -p $ZEPHYR_SDK_REGISTRY_DIR + fi +@@ -176,17 +171,28 @@ do_cmake_package() + + # Read the input "y" + # $1 is optional, but allows the caller to provide additional text. +-read_confirm () { +- if [ "$confirm" != "y" ]; then +- echo "Do you want to continue $1(y/n)? " +- while read confirm; do +- [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \ +- -o "$confirm" = "N" ] && break +- echo "Invalid input \"$confirm\", please input 'y' or 'n': " +- done +- else +- echo +- fi ++prompt () { ++ echo "Do you want to continue $1(y/n)? " ++ while read answer; do ++ if [ "$answer" = "Y" -o "$answer" = "y" ]; then ++ answer="y" ++ break ++ elif [ "$answer" = "N" -o "$answer" = "n" ]; then ++ answer="n" ++ break ++ else ++ echo "Invalid input \"$answer\", please input 'y' or 'n': " ++ fi ++ done ++} ++# Like prompt, but only if prompts were not pre-answered by -y argument ++query () { ++ if [ "$confirm" != "y" ]; then ++ prompt "$1" ++ else ++ answer="y" ++ echo ++ fi + } + + verify_os +@@ -261,8 +267,8 @@ if [ "$sdk_dirname" != "/opt" \ + echo Note: The version number \'-$SDK_VERSION\' can be omitted. + echo + +- read_confirm "installing to ${target_sdk_dir} " +- if [ "$confirm" = "n" -o "$confirm" = "N" ]; then ++ query "installing to ${target_sdk_dir} " ++ if [ "$answer" = "n" ]; then + # Abort the installation + echo "SDK installation aborted!" + exit 1 +@@ -282,8 +288,8 @@ if [ -d $target_sdk_dir ]; then + # wipe the directory first + if [ -d $target_sdk_dir/sysroots ]; then + echo "The directory $target_sdk_dir/sysroots will be removed! " +- read_confirm +- if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then ++ query ++ if [ "$answer" = "y" ]; then + rm -rf $target_sdk_dir/sysroots/ + rm -rf $target_sdk_dir/info-zephyr-sdk*/ + rm -fr $target_sdk_dir/sdk_version +-- +2.27.0 + diff --git a/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch b/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch new file mode 100644 index 000000000000..f87f4b18d436 --- /dev/null +++ b/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch @@ -0,0 +1,92 @@ +From 706b10cddfd781e3c7f1006a64ad23e09601e77c Mon Sep 17 00:00:00 2001 +From: Alexei Colin <ac@alexeicolin.com> +Date: Sat, 18 Jul 2020 12:18:20 -0400 +Subject: [PATCH 4/4] scripts/template_dir: -[no]cmake flag for CMake module + installation + +There are two issues with CMake module installation that are +problematic for distro packages: +1. the cmake module is installed under $HOME and this path is not overridable +2. the path to SDK recorded in the cmake file is the same as the +target directory, which might be prefixed by the staging path of the +package build (e.g. ~/mypackages/zerphyr-sdk/destdir/opt/zerphyr-sdk), +not the final installation directory in the system (/opt/zephyr-sdk). + +1 is fixable by making the variable overridable from the environment: + : ${ZEPHYR_SDK_REGISTRY_DIR:=$HOME/.cmake/packages/Zephyr-sdk} +(but this may be a bashism). But, 1 is not useful unless 2 is also +addressed. + +2 might be fixable by introducing a prefix argument -p (default "") in +addition to the target_dir (-d), and composing the destination directory +for copying files as $prefix/$target_dir while using only $target_dir +wherever installation paths are written, such as in the CMake module. + +Until 1 or 2 are addressed, add -[no]cmake arg so that the package +scripts can install the CMake module themselves. +--- + scripts/template_dir | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/scripts/template_dir b/scripts/template_dir +index 0a0d69e..fccf6f0 100644 +--- a/scripts/template_dir ++++ b/scripts/template_dir +@@ -3,6 +3,7 @@ target_sdk_dir="" + post_install_cleanup=1 + confirm=0 + rc_confirm="" ++cmake_confirm="" + + usage () { + cat << EOF +@@ -22,6 +23,9 @@ Options: + -[no]rc + Whether to create/update the ~/.zerphyrc file (prompt if not given) + ++ -[no]cmake ++ Whether to install Zephyr-sdk CMake module (prompt if not given) ++ + EOF + } + +@@ -69,6 +73,9 @@ while [ "$1" != "" ]; do + if [ -z "$rc_confirm" ]; then + rc_confirm="y" + fi ++ if [ -z "$cmake_confirm" ]; then ++ cmake_confirm="y" ++ fi + ;; + -rc ) + rc_confirm="y"; +@@ -76,6 +83,12 @@ while [ "$1" != "" ]; do + -norc ) + rc_confirm="n"; + ;; ++ -cmake ) ++ cmake_confirm="y" ++ ;; ++ -nocmake ) ++ cmake_confirm="n" ++ ;; + * ) + echo "Error: Invalid argument \"$1\"" + usage +@@ -158,8 +171,11 @@ do_cmake_package() + return + fi + +- query "registering Zephyr-sdk CMake module with path $target_sdk_dir " +- if [ "$answer" = "y" ]; then ++ if [ -z "$cmake_confirm" ]; then ++ prompt "registering Zephyr-sdk CMake module with path $target_sdk_dir " ++ cmake_confirm=$answer ++ fi ++ if [ "$cmake_confirm" = "y" ]; then + if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then + mkdir -p $ZEPHYR_SDK_REGISTRY_DIR + fi +-- +2.27.0 + @@ -2,7 +2,7 @@ pkgname=zephyr-sdk pkgver=0.11.4 -pkgrel=1 +pkgrel=2 pkgdesc="SDK for Zephyr real-time operating system" arch=('x86_64') url="https://www.zephyrproject.org/" @@ -29,7 +29,12 @@ optdepends=('pyocd: programming and debugging ARM MCUs') makedepends=('patchelf') source=("https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${pkgver}/zephyr-sdk-${pkgver}-setup.run" "zephyrrc" - "setup-unattended.patch") + # PR 252 + 0001-scripts-template_dir-don-t-let-y-override-no-rc.patch + 0002-scripts-template_dir-don-t-prompt-for-cmake-when-y-s.patch + 0003-scripts-template_dir-re-use-common-prompting-code.patch + 0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch +) options=(!strip) install=$pkgname.install @@ -110,16 +115,21 @@ package () ######### NOTE: we are in $_installdir after this point - patch ./$_setupsh $srcdir/setup-unattended.patch + for p in $srcdir/0*.patch + do + patch ./$_setupsh $p + done - export ZEPHYR_SDK_REGISTRY_DIR=$pkgdir/usr/lib/cmake/Zephyr-sdk - ./$_setupsh -d $pkgdir/$_installdir -norc -y + ./$_setupsh -d $pkgdir/$_installdir -norc -nocmake -y - # Fixup the path written to cmake file to point to final installation directory - # Ideally, upstream script would support destination dir and installation dir - rm ${ZEPHYR_SDK_REGISTRY_DIR}/* - local cmake_fname=$(echo -n /$_installdir | md5sum | cut -d' ' -f1) - echo "/$_installdir" > ${ZEPHYR_SDK_REGISTRY_DIR}/${cmake_fname} + # Manually install the CMake module, because upstream paths are no good: + # file installed into $HOME and path is the package build path. Upstream + # needs to support overridable path for the module and a -prefix argumnent + # to distinguish destination copy dir from final system install path. + local _cmake_fname=$(echo -n /$_installdir | md5sum | cut -d' ' -f1) + local _cmake_module_path="$pkgdir/usr/lib/cmake/Zephyr-sdk" + mkdir -p "$_cmake_module_path" + echo "/$_installdir" > "$_cmake_module_path/${_cmake_fname}" echo ">>>" echo ">>> Ignore the environment variable values printed above, instead do this:" @@ -174,4 +184,7 @@ package () sha256sums=('f61041a7cd7beec9c8f826e7aa1215a4c34c309c56a3dc0967b8b3401633d1b4' '7a1257272c64bdec281283d391e3149cece065935c9e8394d6bece32d0f6fc05' - 'cc57a1304ae53bf155f32d41a5b527fb207716f027e4997ccb7b14c09064c7dc') + '5a5e1f8cd28f15da3cb9c4c50bf7ccb81fdb15499c02625dc76ed27c98ffad4f' + 'a1a64dd3152871056b6d79bf3fd31cb1e081a8b9354fae929a263e7f74044050' + 'f22ade1773ed8302a11b1ded4cef28ad9630119354d20db334fdb5df6db6f820' + '4c1f7e68ba1400786f116c2305ec32fa1e00b09367d583770a21bf3056fada46') diff --git a/setup-unattended.patch b/setup-unattended.patch deleted file mode 100644 index 527cd8b42d20..000000000000 --- a/setup-unattended.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- setup.sh 2020-07-18 10:13:04.994912357 -0400 -+++ setup.sh 2020-07-18 10:16:38.985654960 -0400 -@@ -166,15 +166,7 @@ - return - fi - -- echo "Do you want to register the Zephyr-sdk at location: $target_sdk_dir" -- echo " in the CMake package registry (y/n)?" -- -- while read confirm; do -- [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \ -- -o "$confirm" = "N" ] && break -- echo "Invalid input \"$confirm\", please input 'y' or 'n': " -- done -- -+ read_confirm "registering Zephyr-sdk CMake module (at $target_sdk_dir)" - if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then - if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then - mkdir -p $ZEPHYR_SDK_REGISTRY_DIR ---- pkg/zephyr-sdk/opt/zephyr-sdk/setup.sh.orig 2020-07-18 10:27:09.440996750 -0400 -+++ pkg/zephyr-sdk/opt/zephyr-sdk/setup.sh 2020-07-18 10:28:11.268841053 -0400 -@@ -71,7 +71,10 @@ - ;; - -y ) - confirm="y"; -- rc_confirm="y"; -+ if [ -z "$rc_confirm" ] -+ then -+ rc_confirm="y" -+ fi - ;; - -rc ) - rc_confirm="y"; ---- pkg/zephyr-sdk/opt/zephyr-sdk/setup.sh.orig 2020-07-18 11:12:04.328724883 -0400 -+++ pkg/zephyr-sdk/opt/zephyr-sdk/setup.sh 2020-07-18 11:12:40.741607822 -0400 -@@ -158,7 +158,7 @@ - - do_cmake_package() - { -- ZEPHYR_SDK_REGISTRY_DIR=$HOME/.cmake/packages/Zephyr-sdk -+ : ${ZEPHYR_SDK_REGISTRY_DIR:=$HOME/.cmake/packages/Zephyr-sdk} - - type md5sum - if [ $? -eq 0 ]; then |