Signed-off-by: Sascha Hauer <[email protected]>
---
 bin/ptxdist                       |  8 ++++++++
 scripts/lib/ptxd_lib_local_src.sh | 41 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 scripts/lib/ptxd_lib_local_src.sh

diff --git a/bin/ptxdist b/bin/ptxdist
index b2c2e7a..0a86ad9 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -899,6 +899,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
@@ -1812,6 +1814,12 @@ EOF
                                do echo $i
                        done ) | sort
                        ;;
+               local-src)
+                       check_config || return
+                       check_deps
+                       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 0000000..11decda
--- /dev/null
+++ b/scripts/lib/ptxd_lib_local_src.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 Sascha Hauer <[email protected]>
+#
+# 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
+
+       pkgname="${1}"
+       target="${2}"
+
+       mkdir -p ${PTXDIST_WORKSPACE}/local_src
+
+       
link="${PTXDIST_WORKSPACE}/local_src/${pkgname}${PTXDIST_PLATFORMSUFFIX}";
+
+       if [ -e ${link} ]; then
+               if [ -n "${PTX_FORCE}" ]; then
+                       rm "${link}" || exit 1
+               else
+                       echo "${link} already exists. Use -f to overwrite"
+                       exit 1
+               fi
+       fi
+
+       if [ ! -d "${target}" ]; then
+               echo "${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
-- 
1.8.5.3


-- 
ptxdist mailing list
[email protected]

Reply via email to