diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-02-26 15:13:16 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2014-03-06 09:19:09 +0100 |
commit | 5902824fec0b0e3814994517ebb20411dd4615a6 (patch) | |
tree | c465e2e0e39f5d84f33a4b46aa4b9cf7102fc045 | |
parent | 57bbd590d6c1f854dc09900ecfbf90d7c414b91e (diff) | |
download | ptxdist-5902824fec0b0e3814994517ebb20411dd4615a6.tar.gz ptxdist-5902824fec0b0e3814994517ebb20411dd4615a6.tar.xz |
ptxdist: Add local-src command
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-x | bin/ptxdist | 7 | ||||
-rw-r--r-- | scripts/lib/ptxd_lib_local_src.sh | 40 |
2 files changed, 47 insertions, 0 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index 176af2dbf..893c6382b 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -907,6 +907,8 @@ Misc: print <var> print the contents of a variable, in the way it is known by "make" list-packages print a list of all selected packages + local-src <pkg> <directory> overwrite a package source with a locally provided + directory containing the sourcecode. bash enter a ptxdist environment bash shell bash <cmd> [args...] execute <cmd> in ptxdist environment export_src <target dir> export all source archives needed for this @@ -1819,6 +1821,11 @@ EOF echo $i done | sort ;; + local-src) + check_config && + ptxd_lib_local_src "${@}" + exit + ;; make) check_premake_compiler && ptxd_make_log "${@}" diff --git a/scripts/lib/ptxd_lib_local_src.sh b/scripts/lib/ptxd_lib_local_src.sh new file mode 100644 index 000000000..e44d8ec10 --- /dev/null +++ b/scripts/lib/ptxd_lib_local_src.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2014 Sascha Hauer <s.hauer@pengutronix.de> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# +ptxd_lib_local_src() { + if [ $# != 2 ]; then + echo "Usage: local_src <package> <directory>" + exit 1 + fi + + local pkgname="${1}" + local target="${2}" + + mkdir -p "${PTXDIST_WORKSPACE}/local_src" + + local link="${PTXDIST_WORKSPACE}/local_src/${pkgname}${PTXDIST_PLATFORMSUFFIX}" + + if [ -e "${link}" -o -L "${link}" ]; then + if [ -n "${PTX_FORCE}" ]; then + rm "${link}" || exit 1 + else + ptxd_bailout "'${link}' already exists. Use -f to overwrite" + fi + fi + + if [ ! -d "${target}" ]; then + ptxd_bailout "'${target}' does not exist or is not a directory" + exit 1 + fi + + echo "Creating local_src link for '${pkgname}'. Package '${pkgname}' will be built from '${target}'" + + ln -s "${target}" "${link}" +} +export -f ptxd_lib_local_src |