Commit d4427618 by Rafael Monnerat

obs: Introduce package build for Re6stnet

1 parent d81d51ee
obs/slapos/home:VIFIBnexedi*
obs/*/home:VIFIBnexedi*
obs/slapos/slapos-node_*
obs/slapos/slapos-recipe-version
obs/slapos/slapos-version
obs/slapos/templates/debian.tar.gz
obs/re6st/re6st-node_*
obs/*/templates/debian.tar.gz
obs/slapos/templates/debian/cron.d
obs/slapos/templates/debian/slapos-node.logrotate
debian-preseed/*.iso
......
preparing the package
---------------------
First make sure all files are ready and you have all necessary packages installed.
You need in particular an OBS directory (for example, the vifib test directory)::
$ cd <directory_to_contain_prepare_script>
$ osc checkout home:VIFIBnexedi:branches:home:VIFIBnexedi/Re6stnet
$ cd home:VIFIBnexedi:branches:home:VIFIBnexedi/Re6stnet
$ osc up
#!/bin/sh -e
# Edit for release
VERSION=0.426
# Edit for release
RECIPE_VERSION=0.265
# Edit for release
RELEASE=2
GITHASH=1ddbb2be20b224e7618bd7904bf846fd947b8b16
CURRENT_DIRECTORY="$(pwd)"
# Define URL to compile
BUILDOUT_URL=http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-$RECIPE_VERSION:/component/re6stnet/buildout.cfg
OBS_DIRECTORY=$CURRENT_DIRECTORY/home:VIFIBnexedi/Re6stnet
# Development Section [Uncomment for use]
OBS_DIRECTORY=$CURRENT_DIRECTORY/home:VIFIBnexedi:branches:home:VIFIBnexedi/Re6stnet
BUILDOUT_URL=http://git.erp5.org/gitweb/slapos.git/blob_plain/$GITHASH:/component/re6stnet/buildout.cfg
VERSION_REGEX="s!\%BUILDOUT_URL\%!$BUILDOUT_URL!g;s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s/\%VERSION\%/$VERSION/g;s/\%RELEASE\%/$RELEASE/g"
TEMPLATES_DIRECTORY=$CURRENT_DIRECTORY/templates
RE6ST_ORGINAL_DIRECTORY=re6st-node
RE6ST_DIRECTORY=re6st-node_$VERSION+$RECIPE_VERSION+$RELEASE
function prepare_template_files
{
# Prepare directory for new version if needed
mkdir -p $CURRENT_DIRECTORY/$RE6ST_DIRECTORY
cp -rf $CURRENT_DIRECTORY/$RE6ST_ORGINAL_DIRECTORY/* $CURRENT_DIRECTORY/$RE6ST_DIRECTORY
sed $VERSION_REGEX $TEMPLATES_DIRECTORY/Makefile.in > $CURRENT_DIRECTORY/$RE6ST_DIRECTORY/re6stnet/Makefile
sed $VERSION_REGEX $TEMPLATES_DIRECTORY/offline.sh.in > $CURRENT_DIRECTORY/$RE6ST_DIRECTORY/re6stnet/offline.sh
}
function prepare_download_cache
{
cd $CURRENT_DIRECTORY/$RE6ST_DIRECTORY/re6stnet/
rm -rf build/
bash offline.sh || (echo "Impossible to build Re6stnet, exiting." && exit 1)
# Go back to starting point
cd $CURRENT_DIRECTORY
}
function prepare_tarball
{
tar -czf $RE6ST_DIRECTORY.tar.gz $RE6ST_DIRECTORY
}
function prepare_deb_packaging
{
# Add entry to changelog
cd $TEMPLATES_DIRECTORY/debian
#dch -pm -v $VERSION+$RECIPE_VERSION+$RELEASE --check-dirname-level=0 "New version of re6st ($VERSION+$RECIPE_VERSION+$RELEASE)"
# Add cron and logrotate files
cd $TEMPLATES_DIRECTORY
tar -czf debian.tar.gz debian
cd $OBS_DIRECTORY
cp $TEMPLATES_DIRECTORY/debian.tar.gz .
}
function obs_upload
{
cd $OBS_DIRECTORY
# Update directory
osc up
# Remove former configuration
osc rm -f $RE6ST_ORGINAL_DIRECTORY*.tar.gz
osc rm -f re6stnet.spec
# Prepare new tarball
cp $CURRENT_DIRECTORY/$RE6ST_DIRECTORY.tar.gz .
osc add $RE6ST_DIRECTORY.tar.gz
# Prepare new specfile
sed $VERSION_REGEX $TEMPLATES_DIRECTORY/re6stnet.spec.in > re6stnet.spec
osc add re6stnet.spec
# Prepare new .dsc file
osc rm -f re6st*.dsc
sed $VERSION_REGEX $TEMPLATES_DIRECTORY/re6stnet.dsc.in > $RE6ST_DIRECTORY.dsc
osc add $RE6ST_DIRECTORY.dsc
osc rm -f PKGBUILD
SOURCEMD5=`md5sum $RE6ST_DIRECTORY.tar.gz | cut -d\ -f1`
sed "$VERSION_REGEX;s/\%SOURCEMD5\%/$SOURCEMD5/g" $TEMPLATES_DIRECTORY/PKGBUILD.in > PKGBUILD
cp $TEMPLATES_DIRECTORY/re6stnet.install .
osc add PKGBUILD re6stnet.install
## Upload new Package
osc commit -m "New Re6stnet Recipe $RECIPE_VERSION"
}
prepare_template_files
prepare_download_cache
prepare_tarball
prepare_deb_packaging
obs_upload
#!/usr/bin/make -f
# -*- makefile -*-
build:
cd re6stnet; make build
all: build
install: all
cd re6stnet; make install
mkdir -p $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/sbin/
cp $(DESTDIR)/opt/re6st/bin/re6st* $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/var/lib/re6stnet
mkdir -p $(DESTDIR)/var/log/re6stnet
mkdir -p $(DESTDIR)/etc/re6stnet
install -Dpm 0644 daemon/README.conf $(DESTDIR)/etc/re6stnet/README
install -Dp daemon/network-manager $(DESTDIR)/etc/NetworkManager/dispatcher.d/50re6stnet
clean:
# cd slapos; make clean
re6stnet configuration files
re6stnet is started automatically if /etc/re6stnet contains a 're6stnet.conf'
file with all parameters to pass to the daemon.
Same for the registry: all parameters must be specified in 're6st-registry.conf'
So for a normal node, you should have the following files:
re6stnet.conf ca.crt cert.crt cert.key dh2048.pem
And if you also host the registry:
re6st-registry.conf ca.key
/var/log/re6stnet/babeld.log {
compress
delaycompress
missingok
notifempty
postrotate
[ -r /var/run/re6st-babeld.pid ] && kill -USR2 $(cat /var/run/re6st-babeld.pid)
endscript
}
#!/usr/bin/python -S
import errno, glob, os, signal, socket, subprocess, sys, time
DAEMON = "re6stnet"
CONFDIR = "/etc/re6stnet"
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
iface = sys.argv[1]
action = sys.argv[2]
lock_name = DAEMON + ':' + iface
if action in ("up", "vpn-up"):
os.chdir(CONFDIR)
if os.path.exists("re6stnet.conf") and not subprocess.call(
(DAEMON, "@re6stnet.conf", "--test", "main_interface != %r" % iface)):
s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
try:
s.bind('\0' + lock_name)
except socket.error, e:
if e[0] != errno.EADDRINUSE:
raise
sys.stderr.write("daemon already started\n")
sys.exit()
if not os.fork():
os.setsid()
os.execlp(DAEMON, DAEMON, "@re6stnet.conf")
elif action in ("down", "vpn-down"):
pattern = " @%s\n" % lock_name
with open("/proc/net/unix") as f:
for line in f:
if line.endswith(pattern):
sock_path = "socket:[%s]" % line.split()[-2]
break
else:
sys.exit()
pattern = "(%s)" % DAEMON
for path in glob.glob("/proc/*/stat"):
try:
pid = int(path[6:-5])
with open(path) as f:
stat = f.read().split()
if stat[1] == pattern and sock_path in (os.readlink(path)
for path in glob.glob(path[:-4] + "fd/*")):
break
except (EnvironmentError, ValueError):
pass
else:
sys.exit()
try:
os.kill(pid, signal.SIGTERM)
sleep = .1
while sleep < 5:
time.sleep(sleep)
os.kill(pid, 0)
sleep *= 1.5
# we waited for about 11 seconds
os.kill(-int(stat[4]), signal.SIGKILL)
except OSError, e:
if e.errno != errno.ESRCH:
raise
[Unit]
Description=Server application for re6snet
ConditionPathExists=/etc/re6stnet/re6st-registry.conf
[Service]
WorkingDirectory=/etc/re6stnet
ExecStart=/usr/bin/env re6st-registry @re6st-registry.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
[Unit]
Description=Resilient, Scalable, IPv6 Network application
ConditionPathExists=/etc/re6stnet/re6stnet.conf
[Service]
WorkingDirectory=/etc/re6stnet
# systemd plans to "introduce ExecCondition= in services" (cf its TODO file)
ExecStart=/bin/sh -c 'set re6stnet @re6stnet.conf; "$@" --test main_interface==\"lo\" || exec "$@"'
Restart=on-failure
StandardOutput=null
[Install]
WantedBy=multi-user.target
[buildout]
extends =
%BUILDOUT_URL%
# Don't load extensions
extensions =
extends-cache = extends-cache
download-cache = download-cache
develop =
parts =
babeld
re6stnet
# Uguu, upstream buildout.cfg must be patched as it works the other way
# around from a packager point of view at least, thus at the end static
# path, such as Python HOME directory, are wrong...
#
# Currently:
# ./configure --prefix=BUILD_DIRECTORY && make install
# Instead of:
# ./configure --prefix=INSTALL_DIRECTORY && make install DESTDIR=BUILD_DIRECTORY
[python2.7]
configure-options +=
--prefix=%TARGET_DIRECTORY%/parts/${:_buildout_section_name_}
environment +=
DESTDIR=%BUILD_ROOT_DIRECTORY%
[gettext]
# Add gettext library path to RPATH as its binaries are used to build
# glib for example
environment =
PATH=${perl:location}/bin:${lunzip:location}/bin:%(PATH)s
CPPFLAGS=-I${libxml2:location}/include -I${zlib:location}/include -I${ncurses:location}/include
LDFLAGS=-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=%BUILD_DIRECTORY%/parts/${:_buildout_section_name_}/lib
[bison]
configure-options +=
--prefix=%TARGET_DIRECTORY%/parts/${:_buildout_section_name_}
make-options +=
DESTDIR=%BUILD_ROOT_DIRECTORY%
[python-cryptography-prep]
recipe = zc.recipe.egg
eggs =
${python-cffi:egg}
enum34
pycparser
six
pyasn1
[re6stnet]
entry-points =
re6stnet=re6st.re6stnet:main
re6st-conf=re6st.re6stconf:main
re6st-registry=re6st.re6stregistry:main
[versions]
re6stnet = 0.426
#!/usr/bin/make -f
# -*- makefile -*-
VERSION = %VERSION%
RECIPE_VERSION = %RECIPE_VERSION%
PY = $(PYTHON)
INSTALL_DIRECTORY = $(DESTDIR)/opt/re6st
TARGET_DIRECTORY = /opt/re6st
BUILD_ROOT_DIRECTORY := $(shell pwd)/build
BUILD_DIRECTORY := $(BUILD_ROOT_DIRECTORY)$(TARGET_DIRECTORY)
PATCHES_DIRECTORY := $(shell pwd)/patches
#Use to get path of buildout correct
ORIGINAL_DIRECTORY := $(shell cat ./original_directory)
BOOTSTRAP_URL := 'http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py?rev=127518'
build: build-stamp
build-stamp:
@echo "Fixing buildout path to $(BUILD_ROOT_DIRECTORY) rather than $(ORIGINAL_DIRECTORY) for buildout"
grep -rIl '$(ORIGINAL_DIRECTORY)' $(BUILD_ROOT_DIRECTORY) 2> /dev/null | \
xargs sed -i 's#$(ORIGINAL_DIRECTORY)#$(BUILD_ROOT_DIRECTORY)#g' || \
echo "No path to fix."
@echo 'Preparing source tarball (recipe version: $(RECIPE_VERSION))'
cd $(BUILD_DIRECTORY) && \
$(PY) ./bin/buildout -v
@touch build-stamp
cleanup-build: cleanup-build-stamp
cleanup-build-stamp: build
@echo "Deleting unecessary files to reduce source tarball size"
# TODO: Figure out why there is no write permission even for
# the owner
chmod -R u+w $(BUILD_DIRECTORY)
# Buildout files
rm -rfv $(BUILD_DIRECTORY)/downloads
rm -fv $(BUILD_DIRECTORY)/bootstrap.py $(BUILD_DIRECTORY)/buildout.cfg \
$(BUILD_DIRECTORY)/bin/buildout $(BUILD_DIRECTORY)/.installed.cfg \
$(BUILD_DIRECTORY)/environment.*
rm -rfv $(BUILD_DIRECTORY)/parts/*-patch-download/ \
$(BUILD_DIRECTORY)/parts/*-hooks-download/
rm -rfv $(BUILD_DIRECTORY)/extends-cache/ \
$(BUILD_DIRECTORY)/download-cache/
# Removing locales, terminfo and base_completion.d directories
find $(BUILD_DIRECTORY) -type d \
\( -name locale -o -name terminfo -o -name bash_completion.d \) \
-prune -exec rm -rfv '{}' ';'
rm -rf $(BUILD_DIRECTORY)/parts/glib/share/glib-2.0/gdb/ \
$(BUILD_DIRECTORY)/parts/glib/share/gdb
rm -rf $(BUILD_DIRECTORY)/parts/ncurses/lib/terminfo
# Removing gettext archive tarball containing all versions
rm -fv $(BUILD_DIRECTORY)/parts/gettext/share/gettext/archive.dir.tar.gz
# Removing documentations
find $(BUILD_DIRECTORY)/parts -regextype posix-extended -type d \
-iregex '.*/(gtk-)?(doc[s]?|man|info|test[s]?)$$' \
-prune -exec rm -rfv '{}' ';'
find $(BUILD_DIRECTORY) -regextype posix-extended -type f \
-iregex '.*(COPYING|LICENSE).*' -exec rm -f '{}' ';'
# Removing include directories
find $(BUILD_DIRECTORY) -type d \( -name include -o -name pkgconfig \) | \
grep -v python | xargs rm -rfv
find $(BUILD_DIRECTORY) -type f -executable -name '*-config' | \
grep -v python | xargs rm -fv
# Removing Python byte-compiled files (as it will be done upon
# package installation) and static libraries
find $(BUILD_DIRECTORY) -regextype posix-extended -type f \
-iregex '.*/*\.(py[co]|[l]?a|exe|bat)$$' -exec rm -fv '{}' ';'
# Removing empty directories
find $(BUILD_DIRECTORY) -type d -empty -prune -exec rmdir '{}' ';'
@touch cleanup-build-stamp
strip-binaries: strip-binaries-stamp
strip-binaries-stamp: build
set -e; \
for f in `find $(BUILD_DIRECTORY) -type f -executable ! -name '*.so*'`; do \
if file $$f | grep -Eq '.*ELF.*(executable|shared).*'; then \
echo "Stripping executable $$f"; \
strip --remove-section=.comment --remove-section=.note $$f; \
fi; \
done
set -e; \
for f in `find $(BUILD_DIRECTORY) -type f -name '*.so*'`; do \
if file $$f | grep -Eq '.*ELF.*shared.*'; then \
echo "Stripping shared library $$f"; \
strip --remove-section=.comment --strip-unneeded \
--remove-section=.note $$f; \
fi; \
done
@touch strip-binaries-stamp
all: all-stamp
all-stamp: build cleanup-build strip-binaries
@touch all-stamp
install: all
mkdir -p $(INSTALL_DIRECTORY)
cp -r $(BUILD_DIRECTORY)/* $(INSTALL_DIRECTORY)
set -e; \
for l in `find $(INSTALL_DIRECTORY) -type l -lname '$(BUILD_DIRECTORY)/*'`; do \
echo "Fixing symlink $$l"; \
base_directory=`echo $$l|sed 's#^$(INSTALL_DIRECTORY)/\(.*/\).*#\1#'|sed -r 's#[^/]+#..#g'`; \
cd `dirname $$l` && \
ln -sf `readlink $$l | sed "s#$(BUILD_DIRECTORY)#$$base_directory#"` \
`basename $$l`; \
done
@echo "Removing shebang from Python files not in bin/"
for f in `grep --exclude-dir='bin' --include='*.py' -rIl '^#!' $(INSTALL_DIRECTORY) 2> /dev/null`; do \
chmod -x $$f && sed -i '1d' $$f; \
done
@echo "Fixing path to $(TARGET_DIRECTORY) rather than $(BUILD_DIRECTORY)"
grep -rIl '$(BUILD_DIRECTORY)' $(INSTALL_DIRECTORY) 2> /dev/null | \
xargs sed -i 's#$(BUILD_DIRECTORY)#$(TARGET_DIRECTORY)#g' || \
echo "No path to fix."
set -e; \
for f in `find $(INSTALL_DIRECTORY) \( -type f -o -type l \) \( -executable -o -name "*.so" \)`; do \
if file -L $$f | grep -Eq '.*ELF.*(executable|shared).*'; then \
OLD_RPATH="`chrpath $$f|awk -F'RPATH=' '{print $$2}'|sed 's#$(BUILD_DIRECTORY)#$(TARGET_DIRECTORY)#g' 2> /dev/null`"; \
if [ -n "$$OLD_RPATH" ]; then \
chrpath -r "$$OLD_RPATH" $$f; \
fi; \
fi; \
done
clean:
rm -rf $(BUILD_ROOT_DIRECTORY)
rm -f *-stamp
.PHONY: build cleanup-build strip-binaries all install clean
# Maintainer: Rafael Monnerat <rafael@nexedi.com>
pkgname=re6st-node
pkgver=%VERSION%+%RECIPE_VERSION%+%RELEASE%
pkgdesc="re6stnet"
pkgrel=1
arch=('x86_64' 'i686')
url="http://www.re6st.net"
license=('GPL')
depends=('gcc' 'make' 'patch' 'wget' 'python2' 'python2-distribute' 'bridge-utils')
makedepends=('gcc' 'make' 'patch' 'wget' 'python2' 'python2-distribute' 'chrpath' 'inetutils')
install='re6stnet.install'
source=(${pkgname}_${pkgver}.tar.gz)
md5sums=(%SOURCEMD5)
build() {
cd "${srcdir}/${pkgname}_${pkgver}"
make PYTHON=python2
}
package() {
cd "${srcdir}/${pkgname}_${pkgver}"
make DESTDIR="$pkgdir/" install
}
re6st-node (0.399+0.260+0) unstable; urgency=low
* Initial release.
-- Rafael Monnerat <rafael@nexedi.com> Thu, 9 Apr 2015 11:32:17 +0300
Source: re6st-node
Maintainer: Julien Muchembled <jm@nexedi.com>
Section: net
Priority: optional
Build-Depends: python-setuptools, python, debhelper (>= 7.4.3)
Standards-Version: 3.9.1
Package: re6st-node
Architecture: any
Depends: ${misc:Depends}, python, python-argparse, iproute2 | iproute, openssl
Recommends: ${python:Recommends}, logrotate
Suggests: ndisc6
Description: resilient, scalable, IPv6 network application
Format: http://dep.debian.net/deps/dep5
Files: *
Copyright: 2012 Nexedi SA and Contributors
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
#!/bin/sh -e
[ "$DPKG_MAINTSCRIPT_PACKAGE" ]
[ "$1" = purge ] && for d in lib log; do
d=/var/$d/$DPKG_MAINTSCRIPT_PACKAGE
[ ! -d "$d" ] || rm -r "$d" || :
done
#DEBHELPER#
#!/bin/sh
### BEGIN INIT INFO
# Provides: re6stnet
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/re6st/bin
NAME=re6stnet
DESC="Resilient, Scalable, IPv6 Network application"
DAEMON=/opt/re6st/bin/$NAME
CONFDIR=/etc/re6stnet
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed or not configured
[ -x $DAEMON -a -r $CONFDIR/$NAME.conf ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
set start-stop-daemon --quiet --pidfile $PIDFILE
"$@" --stop --test --name $NAME && return 1
"$@" --start --make-pidfile --background --chdir $CONFDIR --exec $DAEMON -- @$NAME.conf || return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
set start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5
"$@" --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
rm -f $PIDFILE
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
"$@" --oknodo --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
return "$RETVAL"
}
cd $CONFDIR; $DAEMON @$NAME.conf --test "main_interface != 'lo'" ||
case "$1" in start) exit 0;; restart|force-reload) set stop;; esac
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
export DH_COMPAT=4
CFLAGS = -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
make
# --- end custom part for compiling
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process
# --- end custom part for cleaning up
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package
# The DESTDIR Has To Be Exactly /usr/src/packages/BUILD/debian/<nameOfPackage>
dh_auto_install --TARGET_DIRECTORY=/opt/re6st
# --- end custom part for installing
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs
dh_installexamples
dh_installmenu
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
dh_installinit
dh_installcron
dh_installlogrotate
dh_installman
dh_installinfo
# dh_undocumented
dh_installchangelogs
dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs -n
dh_installdeb
# dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb -- -Zlzma -z9
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
#!/bin/bash
VERSION=%VERSION%
RECIPE_VERSION=%RECIPE_VERSION%
BUILDOUT_URL=%BUILDOUT_URL%
TARGET_DIRECTORY=/opt/re6st
BUILD_ROOT_DIRECTORY="$(pwd)/build"
BUILD_DIRECTORY=$BUILD_ROOT_DIRECTORY$TARGET_DIRECTORY
BOOTSTRAP_URL='https://raw.githubusercontent.com/buildout/buildout/1/bootstrap/bootstrap.py'
echo "Preparing source tarball (recipe version: $RECIPE_VERSION)"
echo " Build Directory: $BUILD_DIRECTORY "
echo " Buildroot Directory: $BUILD_ROOT_DIRECTORY "
mkdir -p $BUILD_DIRECTORY
mkdir $BUILD_DIRECTORY/extends-cache
mkdir $BUILD_DIRECTORY/download-cache
set -e
echo "$BUILD_ROOT_DIRECTORY" > ./original_directory
sed "s!\%BUILDOUT_URL\%!$BUILDOUT_URL!g;s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s|\%PATCHES_DIRECTORY\%|$PATCHES_DIRECTORY|g;s|\%TARGET_DIRECTORY\%|$TARGET_DIRECTORY|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_ROOT_DIRECTORY|g;s|\%BUILD_DIRECTORY\%|$BUILD_DIRECTORY|g" buildout.cfg.in > $BUILD_DIRECTORY/buildout.cfg
# Build first time to get download-cache and extends-cache ready
cd $BUILD_DIRECTORY
wget $BOOTSTRAP_URL --no-check-certificate -O bootstrap.py
(python -S bootstrap.py && \
./bin/buildout) || (echo "Failed to run buildout, exiting." && exit 1)
cd $BUILD_ROOT_DIRECTORY/..
# remove all files from build keeping only caches
echo "Deleting unecessary files to reduce source tarball size"
# TODO: Figure out why there is no write permission even for
# the owner
chmod -R u+w $BUILD_DIRECTORY
# Buildout files
rm -rfv $BUILD_DIRECTORY/downloads
rm -fv $BUILD_DIRECTORY/bootstrap.py $BUILD_DIRECTORY/buildout.cfg \
$BUILD_DIRECTORY/.installed.cfg \
$BUILD_DIRECTORY/environment.*
rm -rfv $BUILD_DIRECTORY/parts/
rm -rfv $BUILD_DIRECTORY/eggs/
rm -rfv $BUILD_DIRECTORY/develop-eggs/
rm -rfv $BUILD_DIRECTORY/bin
# Removing empty directories
find $BUILD_DIRECTORY -type d -empty -prune -exec rmdir '{}' ';'
# Prepare buildout
sed "s!\%BUILDOUT_URL\%!$BUILDOUT_URL!g;s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s|\%PATCHES_DIRECTORY\%|$PATCHES_DIRECTORY|g;s|\%TARGET_DIRECTORY\%|$TARGET_DIRECTORY|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_ROOT_DIRECTORY|g;s|\%BUILD_DIRECTORY\%|$BUILD_DIRECTORY|g" $BUILD_ROOT_DIRECTORY/../buildout.cfg.in > $BUILD_DIRECTORY/buildout.cfg
cd $BUILD_DIRECTORY && \
wget $BOOTSTRAP_URL --no-check-certificate -O bootstrap.py && \
python -S bootstrap.py
# Removing Python byte-compiled files (as it will be done upon
# package installation) and static libraries
find $BUILD_DIRECTORY -regextype posix-extended -type f \
-iregex '.*/*\.(py[co]|[l]?a|exe|bat)$$' -exec rm -fv '{}' ';'
Format: 1.0
Source: re6st-node
Binary: re6st-node
Architecture: any
Version: %VERSION%+%RECIPE_VERSION%+%RELEASE%-1
Maintainer: Rafael Monnerat <rafael@nexedi.com>
Homepage: http://www.slapos.org
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python, python-dev, python-setuptools
Files:
1c2803e4693c74042985d753c9c3ba53 73736102 re6st-node_%VERSION%+%RECIPE_VERSION%+%RELEASE%.orig.tar.gz
1c2803e4693c74042985d753c9c3ba53 6102 re6st-node_%VERSION%+%RECIPE_VERSION%+%RELEASE%-1.diff.tar.gz
# This is a default template for a post-install scriptlet.
# Uncomment only required functions and remove any functions
# you don't need (and this header).
## arg 1: the new package version
#pre_install() {
# do something here
#}
## arg 1: the new package version
#post_install() {
# do something here
#}
## arg 1: the new package version
## arg 2: the old package version
#pre_upgrade() {
# do something here
#}
## arg 1: the new package version
## arg 2: the old package version
#post_upgrade() {
# do something here
#}