You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by rv...@apache.org on 2014/12/14 05:37:00 UTC

bigtop git commit: BIGTOP-1569. provide alias targets for building packages native to the OS

Repository: bigtop
Updated Branches:
  refs/heads/master 8025d01d3 -> 383993a44


BIGTOP-1569. provide alias targets for building packages native to the OS


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/383993a4
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/383993a4
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/383993a4

Branch: refs/heads/master
Commit: 383993a449b7f677329f3fb4de989c5a13d56de6
Parents: 8025d01
Author: Roman Shaposhnik <rv...@apache.org>
Authored: Thu Dec 11 23:56:41 2014 -0800
Committer: Roman Shaposhnik <rv...@apache.org>
Committed: Sat Dec 13 20:23:50 2014 -0800

----------------------------------------------------------------------
 .../org/apache/bigtop/NullOutputStream.groovy   | 27 ++++++++++++++++++
 .../apache/bigtop/TestNullOutputStream.groovy   | 29 ++++++++++++++++++++
 packages.gradle                                 | 27 +++++++++++++++++-
 3 files changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/383993a4/buildSrc/src/main/groovy/org/apache/bigtop/NullOutputStream.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/bigtop/NullOutputStream.groovy b/buildSrc/src/main/groovy/org/apache/bigtop/NullOutputStream.groovy
new file mode 100644
index 0000000..0d673bb
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/bigtop/NullOutputStream.groovy
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop
+
+import java.io.OutputStream
+import java.io.IOException
+
+public class NullOutputStream extends OutputStream {
+  @Override
+  public void write(int b) throws IOException {
+  }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/383993a4/buildSrc/src/test/groovy/org/apache/bigtop/TestNullOutputStream.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/test/groovy/org/apache/bigtop/TestNullOutputStream.groovy b/buildSrc/src/test/groovy/org/apache/bigtop/TestNullOutputStream.groovy
new file mode 100644
index 0000000..1e90d5f
--- /dev/null
+++ b/buildSrc/src/test/groovy/org/apache/bigtop/TestNullOutputStream.groovy
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop
+
+import org.junit.Assert
+import org.junit.Test
+
+class TestNullOutputStream {
+
+  @Test
+  void testDevNull () {
+    new Properties().store(new NullOutputStream(), "stuff");
+  }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/383993a4/packages.gradle
----------------------------------------------------------------------
diff --git a/packages.gradle b/packages.gradle
index 95dc375..c9dc7ea 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -76,6 +76,21 @@ def getDate() {
   new Date().format('E, dd MMM yyyy HH:mm:ss Z')
 }
 
+def nativePackaging = {
+  def devNull = new org.apache.bigtop.NullOutputStream()
+  def result = exec {
+    commandLine "/bin/bash", "-c",
+    """dpkg-query -S /bin/sh && exit 1
+       rpm -qf /bin/sh && exit 2
+       exit 0
+    """
+    ignoreExitValue true
+    errorOutput devNull
+    standardOutput devNull
+  }
+  [false, "deb", "rpm"][result.getExitValue()]
+}.call()
+
 task "packages-help" (description: "All package build related tasks information", group: PACKAGES_GROUP) << {
   targets.each { target ->
     println (target + "\n\t[" + tasks.findAll { alltask -> alltask.name.startsWith(target)}*.name.join(", ") + "]")
@@ -429,6 +444,16 @@ def genTasks = { target, variable ->
     }
     touchTargetFile(BOM_map[variable + '_TARGET_SRPM'])
   }
+  if (nativePackaging) {
+    task "$target-pkg" (dependsOn: "$target-$nativePackaging",
+        description: "Invoking a native binary packaging target $nativePackaging",
+        group: PACKAGES_GROUP) << {
+    }
+    task "$target-spkg" (dependsOn: "$target-s$nativePackaging",
+        description: "Invoking a native binary packaging target s$nativePackaging",
+        group: PACKAGES_GROUP) << {
+    }
+  }
   task "$target-yum" (dependsOn: "$target-rpm",
       description: "Creating YUM repository for $target packages",
       group: PACKAGES_GROUP) << {
@@ -595,4 +620,4 @@ project.afterEvaluate {
       group: PACKAGES_GROUP) << {
     delete (DL_DIR)
   }
-}
\ No newline at end of file
+}