Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sonic Zhang <sonic.adi@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] buildroot:download: Add option to download SVN or GIT repository with version control information.
Date: Thu, 16 Dec 2010 17:46:02 +0800	[thread overview]
Message-ID: <1292492763-15692-1-git-send-email-sonic.adi@gmail.com> (raw)

Current DOWNLOAD_SVN and DOWNLOAD_GIT scripts only retrieve source code of a
given version from the repository. It is more complicated to generate patches
against the source after fixing bugs and developing in buildroot directly.
This patch adds an option BR2_CHECKOUT_SOURCE_FOR_DEVELOPMENT to checkout the
source with version control information. This option is disabled by default.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 Config.in                   |    7 +++++++
 package/Makefile.package.in |   20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/Config.in b/Config.in
index c90de77..7fa2aba 100644
--- a/Config.in
+++ b/Config.in
@@ -154,6 +154,13 @@ config BR2_DEBUG_MUDFLAP
 	  Your GCC must be new enough to support this option.
 endif
 
+config BR2_CHECKOUT_SOURCE_FOR_DEVELOPMENT
+	bool "check out source with git or svn revision information"
+	default n
+	help
+	  If y, check out the source from git or svn repository with
+	  revision information and store in the source tar ball.
+
 choice
 	prompt "strip"
 	default BR2_STRIP_strip
diff --git a/package/Makefile.package.in b/package/Makefile.package.in
index 9f876b9..78b2cda 100644
--- a/package/Makefile.package.in
+++ b/package/Makefile.package.in
@@ -100,15 +100,22 @@ endif
 # source repositories, producing a list of all the "external dependencies" of
 # a given build configuration.
 ################################################################################
-
 define DOWNLOAD_GIT
+	if [ "$(BR2_CHECKOUT_SOURCE_FOR_DEVELOPMENT)" = "y" ] ; then \
+		GITCMD="$(GIT) checkout -b $($(PKG)_BRANCH) $($(PKG)_DL_VERSION)" ; \
+		TARCMD="$(TAR) czf $($(PKG)_SOURCE) $($(PKG)_BASE_NAME)/" ; \
+	else \
+		GITCMD="$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \
+			gzip -c > $(DL_DIR)/$($(PKG)_SOURCE)" ; \
+		TARCMD=test ; \
+	fi ; \
 	test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
 	(pushd $(DL_DIR) > /dev/null && \
 	$(GIT) clone $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \
 	pushd $($(PKG)_BASE_NAME) > /dev/null && \
-	$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \
-		gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \
+	eval $$GITCMD && \
 	popd > /dev/null && \
+	eval $$TARCMD && \
 	rm -rf $($(PKG)_DL_DIR) && \
 	popd > /dev/null)
 endef
@@ -125,9 +132,14 @@ endef
 
 
 define DOWNLOAD_SVN
+	if [ "$(BR2_CHECKOUT_SOURCE_FOR_DEVELOPMENT)" = "y" ] ; then \
+		SVNCMD=checkout ; \
+	else \
+		SVNCMD=export ; \
+	fi ; \
 	test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
 	(pushd $(DL_DIR) > /dev/null && \
-	$(SVN) export -r $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_DL_DIR) && \
+	$(SVN) $$SVNCMD -r $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_DL_DIR) && \
 	$(TAR) czf $($(PKG)_SOURCE) $($(PKG)_BASE_NAME)/ && \
 	rm -rf $($(PKG)_DL_DIR) && \
 	popd > /dev/null)
-- 
1.6.0

             reply	other threads:[~2010-12-16  9:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16  9:46 Sonic Zhang [this message]
2010-12-16  9:46 ` [Buildroot] [PATCH] buildroot:linux: Add options to checkout Linux kernel source from SVN or GIT repository Sonic Zhang
  -- strict thread matches above, loose matches on Subject: below --
2010-12-14  5:29 [Buildroot] [PATCH] buildroot:download: Add option to download SVN or GIT repository with version control information Sonic Zhang
2010-12-14  9:09 ` Sonic Zhang

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=1292492763-15692-1-git-send-email-sonic.adi@gmail.com \
    --to=sonic.adi@gmail.com \
    --cc=buildroot@busybox.net \
    /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