Repository: incubator-singa
Updated Branches:
  refs/heads/master e8e466068 -> 97781d046


SINGA-274 Create Debian packages


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

Branch: refs/heads/master
Commit: cde701abd3ae295505600820708d79d2e471438a
Parents: 9b2d161
Author: Moaz Reyad <[email protected]>
Authored: Wed Feb 15 13:14:20 2017 +0800
Committer: Moaz Reyad <[email protected]>
Committed: Tue Feb 21 18:16:28 2017 +0800

----------------------------------------------------------------------
 CMakeLists.txt                           |  50 +++++++++
 tool/debian/build.sh                     | 153 --------------------------
 tool/debian/postinst                     |  20 ++++
 tool/debian/postrm                       |  20 ++++
 tool/debian/python-singa/DEBIAN/control  |  14 ---
 tool/debian/python-singa/DEBIAN/postinst |  20 ----
 tool/debian/python-singa/DEBIAN/postrm   |  20 ----
 tool/debian/singa/DEBIAN/control         |  12 --
 8 files changed, 90 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61c708d..8ee2824 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,3 +163,53 @@ INSTALL(FILES 
${CMAKE_BINARY_DIR}/include/singa/singa_config.h DESTINATION
 INSTALL (DIRECTORY ${CMAKE_BINARY_DIR}/lib DESTINATION
     ${CMAKE_INSTALL_PREFIX}
     PATTERN "*libgtest.a" EXCLUDE )
+
+IF (USE_PYTHON)
+INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/python 
+       DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/singa)  
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/python/setup.py 
+       DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/singa/python)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/python/singa/singa_wrap.py
+       DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/singa/python/singa)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/python/singa/_singa_wrap.so
+       DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/singa/python/singa)
+INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/python/singa/proto
+       DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/singa/python/singa)     
+ENDIF()
+
+# CPack
+IF (USE_MODULES)
+       SET(CORE_DEPENDENCIES "libgoogle-glog-dev, libstdc++6, libc6")
+ELSE()
+       SET(CORE_DEPENDENCIES "libgoogle-glog-dev, libprotobuf-dev, 
libopenblas-dev, libstdc++6, libc6")
+ENDIF()
+
+SET(PYTHON_DEPENDENCIES "${CORE_DEPENDENCIES}, python-dev, libpython2.7, 
python-pip, python-numpy, python-pillow")
+
+SET(CPACK_GENERATOR "DEB")
+SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Apache Incubator 
<[email protected]>")
+SET(CPACK_DEBIAN_PACKAGE_VERSION ${PACKAGE_VERSION})
+SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
+SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
+SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://singa.apache.org";)
+SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Singa is an Apache Incubating project 
for developing an open source deep learning library.
+ The Singa project was initiated by the DB System Group at National University 
of Singapore in 2014. It focused on distributed deep learning by partitioning 
the model and data onto nodes in a cluster and parallelize the training. The 
prototype was accepted by Apache Incubator in March 2015.")
+IF (USE_PYTHON)
+       SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${PYTHON_DEPENDENCIES})
+        SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA 
"${PROJECT_SOURCE_DIR}/tool/debian/postinst;${PROJECT_SOURCE_DIR}/tool/debian/postrm"
 )
+       IF (USE_CUDA)
+               SET(CPACK_DEBIAN_PACKAGE_NAME "python-singa-cuda")
+               SET(CPACK_PACKAGE_FILE_NAME 
"python-singa-cuda-${PACKAGE_VERSION}")
+               SET(CPACK_DEBIAN_PACKAGE_PREDEPENDS "ca-certificates, 
cuda-cudart-8-0, cuda-curand-8-0")
+       ELSE()
+               SET(CPACK_DEBIAN_PACKAGE_NAME "python-singa")
+               SET(CPACK_PACKAGE_FILE_NAME "python-singa-${PACKAGE_VERSION}")
+               SET(CPACK_DEBIAN_PACKAGE_PREDEPENDS "ca-certificates")
+       ENDIF()
+ELSE()
+       SET(CPACK_DEBIAN_PACKAGE_NAME "singa")
+       SET(CPACK_PACKAGE_FILE_NAME "singa-${PACKAGE_VERSION}")
+        SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${CORE_DEPENDENCIES})
+ENDIF()
+INCLUDE(CPack)

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/build.sh
----------------------------------------------------------------------
diff --git a/tool/debian/build.sh b/tool/debian/build.sh
deleted file mode 100755
index b0ea10f..0000000
--- a/tool/debian/build.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-# execute this script at SINGA_ROOT
-BUILD="OFF"
-CUDA="OFF"
-CUDNN="OFF"
-MODULES="OFF"
-PYTHON="OFF"
-
-echo "OS version: " $OS_VERSION
-COMMIT=`git rev-parse --short HEAD`
-echo "Commit ID: " $COMMIT
-
-while [[ $# -gt 0 ]]
-do
-key="$1"
-case $key in
-  -b|--build)
-  BUILD="ON"
-  shift
-  ;;
-  -m|--modules)
-  MODULES="ON"
-  shift
-  ;;
-  -c|--cuda|--CUDA)
-  # CUDA="ON"
-  # CUDNN="ON"
-  shift
-  ;;
-  -p|--python)
-  PYTHON="ON"
-  shift
-  ;;
-  -h|--help)
-  echo "Usage (execute at SINGA_ROOT folder): build.sh -b|--build -m|--modules 
-c|--cuda -p|--python"
-  echo "      build: compile SINGA; if not set, we assume SINGA is compiled in 
ROOT/build/"
-  echo "      modules: if set, protobuf and openblas are linked statically, 
hence they are removed from 'depends' in control file"
-  echo "      cuda: if set, SINGA is compiled with CUDA and CUDNN"
-  echo "      python: if set, package pysinga together"
-  exit 0
-  ;;
-  *)
-  echo "WRONG argument:" $key
-# for jenkins
-  shift
-  ;;
-esac
-done
-
-# get singa version
-SINGA_VERSION=`grep "PACKAGE_VERSION" CMakeLists.txt |sed 
's/SET(PACKAGE_VERSION\s*\"\([0-9]\.[0-9]\.[0-9]\)\"\s*)/\1/'`
-echo "SINGA version: " $SINGA_VERSION
-
-
-# compile singa
-if [ $BUILD = "ON" ]; then
-  rm -rf build
-  mkdir build
-  cd build
-  cmake -DUSE_MODULES=$MODULES -DUSE_CUDA=$CUDA -DUSE_CUDNN=$CUDNN 
-DUSE_PYTHON=$PYTHON ..
-  make
-  cd ..
-fi
-
-# create the folder for the package
-FOLDER_PREFIX="singa"
-if [ -n "$BUILD_ID" ]; then
-  FOLDER_PREFIX=$BUILD_ID/$COMMIT/$OS_VERSION
-fi
-
-FOLDER=$FOLDER_PREFIX-cpp
-if [ $CUDA = "ON" ]; then
-  FOLDER=$FOLDER_PREFIX-cuda$CUDA_VERSION-cudnn$CUDNN_VERSION
-fi
-
-if [ $PYTHON = "ON" ]
-then
-  FOLDER=$FOLDER/python-singa
-else
-  FOLDER=$FOLDER/singa
-fi
-
-echo "Path: " build/debian/$FOLDER
-mkdir -p build/debian/$FOLDER
-
-if [ $PYTHON = "ON" ]
-then
-  cp -r tool/debian/python-singa/* build/debian/$FOLDER/
-else
-  cp -r tool/debian/singa/* build/debian/$FOLDER/
-fi
-
-# remove unnecessary dependencies
-if [ $MODULES = "ON" ]; then
-  sed -i 's/libopenblas-dev,//' build/debian/$FOLDER/DEBIAN/control
-  sed -i 's/libprotobuf-dev,//' build/debian/$FOLDER/DEBIAN/control
-  sed -i 's/protobuf-compiler,//' build/debian/$FOLDER/DEBIAN/control
-fi
-
-# copy cpp and cuda files
-ICL_FOLDER=build/debian/$FOLDER/usr/local/include
-mkdir -p ${ICL_FOLDER}
-cp -r include/singa ${ICL_FOLDER}/
-cp -r build/include/singa/proto ${ICL_FOLDER}/singa
-cp build/include/singa/singa_config.h ${ICL_FOLDER}/singa
-
-LIB_FOLDER=build/debian/$FOLDER/usr/local/lib
-mkdir -p ${LIB_FOLDER}
-cp build/lib/libsinga.so ${LIB_FOLDER}
-
-mkdir -p build/debian/$FOLDER/usr/share/doc/singa
-cp LICENSE build/debian/$FOLDER/usr/share/doc/singa
-
-# copy pysinga files
-if [ $PYTHON = "ON" ]; then
-  PY_FOLDER=build/debian/$FOLDER/usr/local/lib/singa
-  mkdir -p $PY_FOLDER
-  cp -r python/singa $PY_FOLDER/
-  cp -r python/rafiki $PY_FOLDER/
-
-  cp    build/python/setup.py $PY_FOLDER/
-  cp    build/python/singa/singa_wrap.py $PY_FOLDER/singa/
-  cp    build/python/singa/_singa_wrap.so $PY_FOLDER/singa/
-  cp -r build/python/singa/proto $PY_FOLDER/singa/
-fi
-# change SINGA version in the control file
-sed -i "s/\(Version: [0-9]\.[0-9]\.[0-9]\)/Version: $SINGA_VERSION/" 
build/debian/$FOLDER/DEBIAN/control
-SIZE=`du -s build/debian/$FOLDER|cut -f 1`
-# change the Size
-sed -i "s/\(Installed-Size: [1-9][0-9]*\)/Installed-Size: $SIZE/" 
build/debian/$FOLDER/DEBIAN/control
-
-dpkg -b build/debian/$FOLDER/
-
-cd build/debian
-tar czf $BUILD_ID.tar.gz $FOLDER.deb
-exit 0

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/postinst
----------------------------------------------------------------------
diff --git a/tool/debian/postinst b/tool/debian/postinst
new file mode 100755
index 0000000..d88ab0e
--- /dev/null
+++ b/tool/debian/postinst
@@ -0,0 +1,20 @@
+#!/bin/bash
+# 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.
+#
+
+cd /usr/local/lib/singa/python
+pip install .

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/postrm
----------------------------------------------------------------------
diff --git a/tool/debian/postrm b/tool/debian/postrm
new file mode 100755
index 0000000..80f7328
--- /dev/null
+++ b/tool/debian/postrm
@@ -0,0 +1,20 @@
+#!/bin/bash
+# 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.
+#
+
+cd /usr/local/lib/singa/python
+rm -r build dist singa.egg-info

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/python-singa/DEBIAN/control
----------------------------------------------------------------------
diff --git a/tool/debian/python-singa/DEBIAN/control 
b/tool/debian/python-singa/DEBIAN/control
deleted file mode 100644
index 59eee57..0000000
--- a/tool/debian/python-singa/DEBIAN/control
+++ /dev/null
@@ -1,14 +0,0 @@
-Package: singa-python
-Version: 1.0.1
-Installed-Size: 30488
-Maintainer: Moaz Reyad <[email protected]>
-Section: devel
-Source: https://github.com/apache/incubator-singa
-Homepage: http://singa.apache.org
-Architecture: amd64
-Priority: optional
-Pre-Depends: ca-certificates
-Depends: libc6, libstdc++6, libprotobuf-dev, libopenblas-dev, 
libgoogle-glog-dev, python, libpython2.7, python-setuptools, python-numpy
-Description: Singa is an Apache Incubating project for developing an open 
source deep learning library.
- The Singa project was initiated by the DB System Group at National University 
of Singapore in 2014. It focused on distributed deep learning by partitioning 
the model and data onto nodes in a cluster and parallelize the training. The 
prototype was accepted by Apache Incubator in March 2015. 
-

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/python-singa/DEBIAN/postinst
----------------------------------------------------------------------
diff --git a/tool/debian/python-singa/DEBIAN/postinst 
b/tool/debian/python-singa/DEBIAN/postinst
deleted file mode 100755
index 269d79c..0000000
--- a/tool/debian/python-singa/DEBIAN/postinst
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# 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.
-#
-
-cd /usr/local/lib/singa
-python setup.py install

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/python-singa/DEBIAN/postrm
----------------------------------------------------------------------
diff --git a/tool/debian/python-singa/DEBIAN/postrm 
b/tool/debian/python-singa/DEBIAN/postrm
deleted file mode 100755
index 6959a45..0000000
--- a/tool/debian/python-singa/DEBIAN/postrm
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# 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.
-#
-
-cd /usr/local/lib/singa
-rm -r build dist singa.egg-info

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/cde701ab/tool/debian/singa/DEBIAN/control
----------------------------------------------------------------------
diff --git a/tool/debian/singa/DEBIAN/control b/tool/debian/singa/DEBIAN/control
deleted file mode 100644
index 8605427..0000000
--- a/tool/debian/singa/DEBIAN/control
+++ /dev/null
@@ -1,12 +0,0 @@
-Package: Singa
-Version: 1.0.1
-Architecture: amd64
-Maintainer: Moaz Reyad <[email protected]>
-Depends: libgoogle-glog-dev, libprotobuf-dev, libopenblas-dev, libstdc++6, 
libc6
-Installed-Size: 24820
-Section: devel
-Priority: optional
-Source: https://github.com/apache/incubator-singa
-Homepage: http://singa.apache.org
-Description: Singa is an Apache Incubating project for developing an open 
source deep learning library.
- The Singa project was initiated by the DB System Group at National University 
of Singapore in 2014. It focused on distributed deep learning by partitioning 
the model and data onto nodes in a cluster and parallelize the training. The 
prototype was accepted by Apache Incubator in March 2015.

Reply via email to