You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by co...@apache.org on 2014/12/01 20:44:04 UTC
bigtop git commit: BIGTOP-1527. Allow to fetch package's source code
from Git
Repository: bigtop
Updated Branches:
refs/heads/master 10193c89f -> b165d0c7f
BIGTOP-1527. Allow to fetch package's source code from Git
Signed-off-by: Konstantin Boudnik <co...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/b165d0c7
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/b165d0c7
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/b165d0c7
Branch: refs/heads/master
Commit: b165d0c7f039f7797bb9941aebbb2094aef3be26
Parents: 10193c8
Author: Ivan Orlov <iv...@amazon.com>
Authored: Tue Nov 25 12:39:23 2014 -0800
Committer: Konstantin Boudnik <co...@apache.org>
Committed: Mon Dec 1 11:43:24 2014 -0800
----------------------------------------------------------------------
README.md | 23 +++++++++++++++++++++++
packages.gradle | 41 ++++++++++++++++++++++++++++++++++++++---
2 files changed, 61 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bigtop/blob/b165d0c7/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 2c088cc..17b7a4a 100644
--- a/README.md
+++ b/README.md
@@ -149,6 +149,29 @@ project. The main page can be accessed from "project_root/target/site/index.htm
The source for the website is located in "project_root/src/site/".
+For Developers: Building a component from Git repository
+--------------------------------------------------------
+
+To fetch source from a Git repository you need to modify `bigtop.mk` and add the
+following fields to your package:
+
+* `_GIT_REPO` - SSH, HTTP or local path to Git repo.
+* `_GIT_REF` - branch, tag or commit hash to check out.
+
+Some packages have different names for source directory and source tarball
+(`hbase-0.98.5-src.tar.gz` contains `hbase-0.98.5` directory).
+By default source will be fetched in a directory named `_TARBALL_SRC`
+without `.t*` extension.
+To explicitly set directory name use the `_GIT_DIR` option.
+
+Example for HBase:
+
+
+```make
+HBASE_GIT_REPO=https://github.com/apache/hbase.git
+HBASE_GIT_REF=$(HBASE_PKG_VERSION)
+HBASE_GIT_DIR=hbase-$(HBASE_PKG_VERSION)
+```
Contact us
http://git-wip-us.apache.org/repos/asf/bigtop/blob/b165d0c7/packages.gradle
----------------------------------------------------------------------
diff --git a/packages.gradle b/packages.gradle
index 2abbb5d..a178b0b 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -15,6 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import org.ajoberstar.grgit.*
+
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'org.ajoberstar:grgit:0.2.2'
+ }
+}
+
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'download-task'
@@ -77,6 +88,10 @@ def genTasks = { target, variable ->
def final DOWNLOAD_DST = BOM_map[variable + '_DOWNLOAD_DST']
def final DOWNLOAD_URL = BOM_map[variable + '_DOWNLOAD_URL']
+ def final GIT_REPO = BOM_map[variable + '_GIT_REPO']
+ def final GIT_REF = BOM_map[variable + '_GIT_REF']
+ def final GIT_DIR = BOM_map[variable + '_GIT_DIR']
+
if (!DOWNLOAD_DST)
return
@@ -85,9 +100,29 @@ def genTasks = { target, variable ->
println "\tFile $DOWNLOAD_DST appears to be already downloaded. Exiting..."
return
}
- download {
- src DOWNLOAD_URL
- dest DOWNLOAD_DST
+ if (GIT_REPO && GIT_REF) {
+ def dir = GIT_DIR
+ if (dir == null || dir.isEmpty()) {
+ dir = TARBALL_SRC.substring(0, TARBALL_SRC.lastIndexOf(".t"))
+ }
+ delete("${DL_DIR}/${dir}")
+ Grgit.clone(
+ uri: GIT_REPO,
+ refToCheckout: GIT_REF,
+ dir: new File("${DL_DIR}/${dir}")
+ )
+ delete("${DL_DIR}/${dir}/.git")
+ exec {
+ workingDir DL_DIR
+ commandLine "tar -czf ${TARBALL_SRC} ${dir}".split()
+ }
+ delete("${DL_DIR}/${dir}")
+ }
+ else {
+ download {
+ src DOWNLOAD_URL
+ dest DOWNLOAD_DST
+ }
}
touchTargetFile(BOM_map[variable + '_TARGET_DL'])
}