mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: mol@pengutronix.de, mkl@pengutronix.de
Subject: [ptxdist] [PATCH 2/7] ptxdist: Add local-src command
Date: Wed, 26 Feb 2014 15:13:16 +0100	[thread overview]
Message-ID: <1393424001-26060-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1393424001-26060-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 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 <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
+
+	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
ptxdist@pengutronix.de

  reply	other threads:[~2014-02-26 14:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 14:13 [ptxdist] [PATCH 1/7] ptxdist: Add list-packages command Sascha Hauer
2014-02-26 14:13 ` Sascha Hauer [this message]
2014-02-28 13:48   ` [ptxdist] [PATCH 2/7] ptxdist: Add local-src command Alexander Dahl
2014-02-28 14:01     ` Sascha Hauer
2014-02-28 14:47       ` Uwe Kleine-König
2014-02-28 14:58       ` Juergen Beisert
2014-02-28 15:54       ` Alexander Dahl
2014-02-26 14:13 ` [ptxdist] [PATCH 3/7] barebox: Add optional dependency to host-libusb Sascha Hauer
2014-02-26 14:13 ` [ptxdist] [PATCH 4/7] barebox: Only install defaultenv file if it exists Sascha Hauer
2014-02-26 14:13 ` [ptxdist] [PATCH 5/7] add ptxsudo alias to ptxdist bash Sascha Hauer
2014-02-26 14:13 ` [ptxdist] [PATCH 6/7] Add dfu-util rules for host Sascha Hauer
2014-02-26 14:13 ` [ptxdist] [PATCH 7/7] dfu-util: version bump to 0.7 Sascha Hauer
2014-02-26 16:30 ` [ptxdist] [PATCH 1/7] ptxdist: Add list-packages command Alexander Dahl
2014-02-27  8:48   ` Sascha Hauer
2014-03-06 17:52 ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393424001-26060-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=mkl@pengutronix.de \
    --cc=mol@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox