deploy.sh 2.8 KB
Newer Older
1
2
3
4
5
#!/bin/bash

#############################
# CONFIGURATION
#############################
6
7
# Debug option for py2app, if needed
export DISTUTILS_DEBUG=0
8

9
10
11
#############################
# PREPARATION
#############################
eric pellegrini's avatar
eric pellegrini committed
12
13
14
15
16

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

DEBIAN_ROOT_DIR=${CI_TEMP_DIR}/dist

17
rm -rf ${DEBIAN_ROOT_DIR}
18
mkdir -p ${DEBIAN_ROOT_DIR}
19

20
21
22
23
#############################
# PACKAGING
#############################
echo -e "${BLUE}""Build debian tree""${NORMAL}"
24
25

# Copy all the debian files (e.g. control, copyright, md5sum ...) into DEBIAN directory
26
cp -r ${SCRIPT_DIR}/Resources/DEBIAN ${DEBIAN_ROOT_DIR}/
27
28
# Set automatically the good version number for the Debian control file
sed -i "s/Version:.*/Version: ${VERSION_NAME}/g" ${DEBIAN_ROOT_DIR}/DEBIAN/control
29
30
31
32
33
chmod -R 755 ${DEBIAN_ROOT_DIR}/DEBIAN

# Build the /usr/share/applications directory inside the debian root directory and copy the mdanse desktop file inside
DEBIAN_APP_DIR=${DEBIAN_ROOT_DIR}/usr/share/applications
mkdir -p ${DEBIAN_APP_DIR}
34
cp ${SCRIPT_DIR}/Resources/MDANSE.desktop ${DEBIAN_APP_DIR}/
35
36
37
38

# Build the /usr/share/pixmaps directory inside the debian root directory and copy the mdanse icon file inside
DEBIAN_PIXMAPS_DIR=${DEBIAN_ROOT_DIR}/usr/share/pixmaps
mkdir -p ${DEBIAN_PIXMAPS_DIR}
eric pellegrini's avatar
eric pellegrini committed
39
cp ${CI_PROJECT_DIR}/MDANSE/GUI/Icons/mdanse.png ${DEBIAN_PIXMAPS_DIR}/
40
41
42
43

# Build the /usr/local/bin directory inside the debian root directory and copy the mdanse scripts inside
DEBIAN_BIN_DIR=${DEBIAN_ROOT_DIR}/usr/local/bin
mkdir -p ${DEBIAN_BIN_DIR}
eric pellegrini's avatar
eric pellegrini committed
44
cp ${CI_PROJECT_DIR}/Scripts/* ${DEBIAN_BIN_DIR}/
45
46
47
48
49
dos2unix ${DEBIAN_BIN_DIR}/mdanse_*

# Build the usr/local/lib/python2.7/dist-packages directory inside the debian root directory and copy the MDANSE package inside
DEBIAN_DIST_DIR=${DEBIAN_ROOT_DIR}/usr/local/lib/python2.7/dist-packages
mkdir -p ${DEBIAN_DIST_DIR}
50

eric pellegrini's avatar
eric pellegrini committed
51
52
cd ${CI_PROJECT_DIR}

Remi Perenon's avatar
Remi Perenon committed
53
# Build API
54
${PYTHONEXE} setup.py build_api build_help install --prefix=${CI_TEMP_INSTALL_DIR}
55
56
57

status=$?
if [ $status -ne 0 ]; then
58
	echo -e "${RED}" "Failed to build MDANSE Documentation""${NORMAL}"
59
60
61
	exit $status
fi

62
# Copy the localy installed ScientificPython, MMTK and MDANSE
eric pellegrini's avatar
eric pellegrini committed
63
64
65
cp -r ${CI_TEMP_INSTALL_DIR}/lib/python2.7/site-packages/Scientific ${DEBIAN_DIST_DIR}
cp -r ${CI_TEMP_INSTALL_DIR}/lib/python2.7/site-packages/MMTK ${DEBIAN_DIST_DIR}
cp -r ${CI_TEMP_INSTALL_DIR}/lib/python2.7/site-packages/MDANSE ${DEBIAN_DIST_DIR}
66
67
68
69
70
71

# Compute the Installed-Size field for the debian package
instSize=$(du ${DEBIAN_ROOT_DIR} -b -s | cut -f1)
sed -i "s/Installed-Size:.*/Installed-Size: $((1+(instSize/1024)))/g" ${DEBIAN_ROOT_DIR}/DEBIAN/control

export TMPDIR=.
eric pellegrini's avatar
eric pellegrini committed
72
fakeroot dpkg-deb -b ${DEBIAN_ROOT_DIR} ${CI_PROJECT_DIR}/MDANSE-${VERSION_NAME}-${DISTRO}-${ARCH}.deb
73
74
75
76
77
status=$?
if [ $status -ne 0 ]; then
	echo -e "${RED}" "Cannot build app.""${NORMAL}"
	exit $status
fi
Remi Perenon's avatar
Remi Perenon committed
78