Repository: bigtop
Updated Branches:
  refs/heads/BIGTOP-2698 [created] e5bd8ddc8


BIGTOP-2698: Build/install protobuf from source for all platforms


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

Branch: refs/heads/BIGTOP-2698
Commit: e5bd8ddc85c4e2fa6464c81b27de05f4bd3d4e40
Parents: 093d386
Author: sahil aggarwal <[email protected]>
Authored: Tue Mar 14 17:38:57 2017 +0530
Committer: Olaf Flebbe <[email protected]>
Committed: Sun Dec 17 15:20:45 2017 +0100

----------------------------------------------------------------------
 bigtop_toolchain/manifests/protobuf.pp | 88 +++++++----------------------
 1 file changed, 21 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/e5bd8ddc/bigtop_toolchain/manifests/protobuf.pp
----------------------------------------------------------------------
diff --git a/bigtop_toolchain/manifests/protobuf.pp 
b/bigtop_toolchain/manifests/protobuf.pp
index 3364f79..2ff8333 100644
--- a/bigtop_toolchain/manifests/protobuf.pp
+++ b/bigtop_toolchain/manifests/protobuf.pp
@@ -15,74 +15,28 @@
 
 class bigtop_toolchain::protobuf {
 
-  case $operatingsystem{
-    /Ubuntu|Debian/: {
-      case $architecture {
-        'amd64' : { $url = 
"https://launchpad.net/ubuntu/+source/protobuf/2.5.0-9ubuntu1/+build/5585371/+files/";
-                    $arch= "amd64" }
-        'ppc64le' : { $url = 
"https://launchpad.net/ubuntu/+source/protobuf/2.5.0-9ubuntu1/+build/5604345/+files";
-                    $arch= "ppc64el" }
-        'aarch64' : { $url = 
"https://launchpad.net/ubuntu/+source/protobuf/2.5.0-9ubuntu1/+build/5585372/+files";
-                    $arch= "arm64" }
-      }
-    }
+  include bigtop_toolchain::packages
+
+  $url = "https://github.com/google/protobuf/releases/download/v2.5.0/";
+
+  $protobuf8 = "protobuf-2.5.0.tar.gz"
+  $protobuf8dir = "protobuf-2.5.0"
+
+  file { "/usr/src/0001-Add-generic-GCC-support-for-atomic-operations.patch":
+    source => 
"puppet:///modules/bigtop_toolchain/0001-Add-generic-GCC-support-for-atomic-operations.patch"
+  }
+
+  exec { "download protobuf":
+     cwd  => "/usr/src",
+     command => "/usr/bin/wget $url/$protobuf8 && mkdir -p $protobuf8dir && 
/bin/tar -xvzf $protobuf8 -C $protobuf8dir --strip-components=1 && cd 
$protobuf8dir && /usr/bin/patch -p1 
</usr/src/0001-Add-generic-GCC-support-for-atomic-operations.patch",
+     creates => "/usr/src/$protobuf8dir",
+     require => 
File["/usr/src/0001-Add-generic-GCC-support-for-atomic-operations.patch"]
   }
- 
-  case $operatingsystem{
-    /Ubuntu|Debian/: {
-      $libprotobuf8 = "libprotobuf8_2.5.0-9ubuntu1_$arch.deb"
-      $libprotoc8 = "libprotoc8_2.5.0-9ubuntu1_$arch.deb"
-      $protobuf_compiler = "protobuf-compiler_2.5.0-9ubuntu1_$arch.deb"
 
-      exec { "download protobuf":
-        cwd     => "/usr/src",
-        command => "/usr/bin/curl -L $url/$libprotobuf8 -o $libprotobuf8; 
/usr/bin/curl -L $url/$libprotoc8 -o $libprotoc8; /usr/bin/curl -L 
$url/$protobuf_compiler -o $protobuf_compiler",
-        creates  => [ "/usr/src/$libprotobuf8", "/usr/src/$libprotoc8", 
"/usr/src/$protobuf_compiler" ]
-      }
-      exec { "install protobuf":
-        cwd     => "/usr/src",
-        command => "/usr/bin/dpkg -i $libprotobuf8 $libprotoc8 
$protobuf_compiler",
-        require => EXEC["download protobuf"],
-      }
-    }
-    default: {
-      case $operatingsystem {
-         /(?i:(centos|fedora|amazon))/: {
-          case $architecture {
-           'ppc64le' : { 
-            exec { 'install_mrdocs_repo':
-              command => "/usr/bin/rpm -ivh 
https://archives.fedoraproject.org/pub/archive/fedora-secondary/releases/22/Everything/ppc64le/os/Packages/p/protobuf-2.5.0-11.fc22.ppc64le.rpm;/usr/bin/rpm
 -ivh 
https://archives.fedoraproject.org/pub/archive/fedora-secondary/releases/22/Everything/ppc64le/os/Packages/p/protobuf-compiler-2.5.0-11.fc22.ppc64le.rpm;/usr/bin/rpm
 -ivh 
https://archives.fedoraproject.org/pub/archive/fedora-secondary/releases/22/Everything/ppc64le/os/Packages/p/protobuf-devel-2.5.0-11.fc22.ppc64le.rpm";,
-            }
-            $package_name = 'protobuf-devel'
-           }
-             
-           default: { yumrepo { "protobuf":
-             baseurl => 
"http://download.opensuse.org/repositories/home:/mrdocs:/protobuf-rpm/CentOS_CentOS-6/";,
-             descr => "Bigtop protobuf repo",
-             enabled => 1,
-             priority => 1,
-             gpgcheck => 0
-           }
-           exec { 'install_mrdocs_repo':
-             command => '/bin/true',
-             require => Yumrepo['protobuf'],
-           }
-           $package_name = 'protobuf-devel'
-           }
-          }
-         }
-         /(?i:(SLES|opensuse))/:{
-           exec { 'install_mrdocs_repo':
-              command => '/usr/bin/zypper ar --no-gpgcheck 
http://download.opensuse.org/repositories/home:/mrdocs:/protobuf-rpm/openSUSE_Leap_42.1/
 protobuf',
-              unless => "/usr/bin/zypper lr | grep -q protobuf",
-           }
-           $package_name = 'protobuf-devel-2.5.0-6.1'
-         }
-      }
-      package { $package_name:
-        ensure => present,
-        require => Exec['install_mrdocs_repo'],
-      }
-    }
+  exec { "install protobuf":
+     cwd => "/usr/src/$protobuf8dir",
+     command => "/usr/src/$protobuf8dir/configure --prefix=/usr/local 
--disable-shared && /usr/bin/make install",
+     creates => "/usr/local/bin/protoc",
+     require => EXEC["download protobuf"]
   }
 }

Reply via email to