From 5902824fec0b0e3814994517ebb20411dd4615a6 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 26 Feb 2014 15:13:16 +0100 Subject: ptxdist: Add local-src command Signed-off-by: Sascha Hauer Signed-off-by: Michael Olbrich --- bin/ptxdist | 7 +++++++ scripts/lib/ptxd_lib_local_src.sh | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 scripts/lib/ptxd_lib_local_src.sh diff --git a/bin/ptxdist b/bin/ptxdist index 176af2dbf..893c6382b 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -907,6 +907,8 @@ Misc: print 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 overwrite a package source with a locally provided + directory containing the sourcecode. bash enter a ptxdist environment bash shell bash [args...] execute in ptxdist environment export_src 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 +# +# 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 " + 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 -- cgit v1.2.3