diff options
author | Oliver Poignant <oliver@poignant.se> | 2016-03-25 00:59:17 +0100 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2016-03-25 00:59:17 +0100 |
commit | 2411f0384c48a0ac3957229248d85e9e8a7a85ee (patch) | |
tree | 147cb07f4be264d44b6af6b4db902749769dc0b0 | |
parent | 5bd0865d21d7963301ad7d10c0bb8375ac4796e4 (diff) | |
download | Git-Auto-Deploy-2411f0384c48a0ac3957229248d85e9e8a7a85ee.zip Git-Auto-Deploy-2411f0384c48a0ac3957229248d85e9e8a7a85ee.tar.gz Git-Auto-Deploy-2411f0384c48a0ac3957229248d85e9e8a7a85ee.tar.bz2 |
Preparations for debian package
-rw-r--r-- | Makefile | 95 | ||||
-rw-r--r-- | docs/Install as a debian package.md | 35 | ||||
-rw-r--r-- | docs/Useful commands.md | 3 | ||||
-rw-r--r-- | platforms/debian/stdeb.cfg | 1 | ||||
-rw-r--r-- | platforms/debian/stdeb/control | 2 | ||||
-rwxr-xr-x | platforms/debian/stdeb/git-auto-deploy.postinst | 6 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | setup.py | 2 |
8 files changed, 107 insertions, 38 deletions
@@ -2,31 +2,84 @@ prefix = /opt/Git-Auto-Deploy/ -init_version := $(shell /sbin/init --version 2>&1) -test_upstart := $(shell printf $(init_version) | grep -q upstart || grep -q upstart /proc/net/unix ; echo $$?) -test_systemd := $(shell printf $(init_version) | grep -q systemd || grep -q systemd /proc/1/comm || grep -q systemd /proc/net/unix ; echo $$?) +#init_version := $(shell /sbin/init --version 2>&1) +#test_upstart := $(shell printf $(init_version) | grep -q upstart || grep -q upstart /proc/net/unix ; echo $$?) +#test_systemd := $(shell printf $(init_version) | grep -q systemd || grep -q systemd /proc/1/comm || grep -q systemd /proc/net/unix ; echo $$?) + +PYTHON ?= python2 + +# Default debian dist (override using make <target> DIST=<debian dist>) +DIST=trusty + +# Package name and version +PACKAGE_NAME=$(shell python setup.py --name) +PACKAGE_VERSION=$(shell python setup.py --version) + +define version = + echo "hello" + exit 1 +endef all: -clean: +clean: clean-pypi clean-deb + rm -rf *.tar.gz + +clean-pypi: + rm -rf *.egg-info + rm -rf dist/pypi + if [ -d "dist" ]; then rmdir --ignore-fail-on-non-empty dist; fi + +pypi: + $(PYTHON) setup.py sdist --dist-dir dist/pypi + +upload-pypi: + $(PYTHON) setup.py sdist --dist-dir dist/pypi register upload -r pypi + +clean-deb: + rm -rf dist/deb + rm -f dist/*.tar.gz + if [ -d "dist" ]; then rmdir --ignore-fail-on-non-empty dist; fi + +# Usage: make deb-source [DIST=<debian dist>] +deb-source: clean-deb + # Make a debian source package using stdeb + python setup.py --command-packages=stdeb.command sdist_dsc -x platforms/debian/stdeb.cfg --dist-dir dist/deb --debian-version $(DIST) --suite $(DIST) + # Copy debian package config files + cp -vr platforms/debian/stdeb/* dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian/ + +deb: clean-deb deb-source + # Build .deb package (without signing) + cd dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION); \ + dpkg-buildpackage -rfakeroot -uc -us + +signed-deb: clean-deb deb-source + # Build .deb package (signed) + cd dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION); \ + debuild -S -sa -initsystem: -ifeq ($(test_upstart),0) - @echo "Upstart detected!" -else ifeq ($(test_systemd),0) - @echo "Systemd detected!" -else - @echo "InitV supposed" -endif - @echo "Init script not installed - not yet implemented" +upload-deb: clean-deb signed-deb + # Upload signed debian package to ppa + #cd dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION); \ + dput ppa:olipo186/$(PACKAGE_NAME) dist/deb/$(PACKAGE_NAME)_$(PACKAGE_VERSION)-$(DIST)_source.changes -install: clean all - @echo "Installing deploy script in $(prefix) ..." - @echo "Installing deploy script in $(init_version) ..." - @sudo mkdir $(prefix) &> /dev/null || true - @sudo cp config.json.sample $(prefix)config.json - @sudo cp -r gitautodeploy $(prefix)/ - @echo "Installing run-on-startup scripts according to your init system ..." - @make initsystem +#initsystem: +#ifeq ($(test_upstart),0) +# @echo "Upstart detected!" +#else ifeq ($(test_systemd),0) +# @echo "Systemd detected!" +#else +# @echo "InitV supposed" +#endif +# @echo "Init script not installed - not yet implemented" +#install: clean all +# @echo "Installing deploy script in $(prefix) ..." +# @echo "Installing deploy script in $(init_version) ..." +# @sudo mkdir $(prefix) &> /dev/null || true +# @sudo cp config.json.sample $(prefix)config.json +# @sudo cp -r gitautodeploy $(prefix)/ +# +# @echo "Installing run-on-startup scripts according to your init system ..." +# @make initsystem diff --git a/docs/Install as a debian package.md b/docs/Install as a debian package.md index 7cce207..d77683e 100644 --- a/docs/Install as a debian package.md +++ b/docs/Install as a debian package.md @@ -1,4 +1,24 @@ -# Install as a debian package (experimental) +# Install as debian package from PPA (experimental) + +Add our PPA + + add-apt-repository ppa:olipo186/git-auto-deploy + apt-get update + +Install the package + + apt-get install git-auto-deploy + +Make your changes to the configuration file + + nano /etc/git-auto-deploy.conf.json + +Run the application + + service git-auto-deploy start + service git-auto-deploy status + +# Install from .deb file (experimental) Below is instructions on how to create a debian (.deb) package using stdeb. You can follow the instructions below to build the .deb package, or use the prepared script (platforms/debian/scripts/create-debian-package.sh) that will do the same. Once the package is created, you can install it using ```dpkg -i```. A sample configuration file as well as a init.d start up script will be installed as part of the package. @@ -12,22 +32,13 @@ Install stdeb and other dependencies git clone https://github.com/olipo186/Git-Auto-Deploy.git cd Git-Auto-Deploy - - # Generate a Debian source package - python setup.py --command-packages=stdeb.command sdist_dsc -x platforms/debian/stdeb.cfg - - # Copy configuration files - cp -vr ./platforms/debian/stdeb/* ./deb_dist/git-auto-deploy-<version>/debian/ - - # Copile a Debian binary package - cd ./deb_dist/git-auto-deploy-<version> - dpkg-buildpackage -rfakeroot -uc -us + make deb ### Install When installing the package, a sample configuration file and a init.d start up script will be created. - dpkg -i git-auto-deploy-<version>.deb + dpkg -i dist/deb/git-auto-deploy-<version>.deb ### Configuration diff --git a/docs/Useful commands.md b/docs/Useful commands.md index fb25613..41e0da4 100644 --- a/docs/Useful commands.md +++ b/docs/Useful commands.md @@ -9,3 +9,6 @@ python setup.py --command-packages=stdeb.command sdist_dsc bdist_deb # Debianize python setup.py --command-packages=stdeb.command debianize + +# deb source +add-apt-repository ppa:olipo186/git-auto-deploy diff --git a/platforms/debian/stdeb.cfg b/platforms/debian/stdeb.cfg index 10ce100..f94940b 100644 --- a/platforms/debian/stdeb.cfg +++ b/platforms/debian/stdeb.cfg @@ -1,2 +1,3 @@ [DEFAULT] Package: git-auto-deploy + diff --git a/platforms/debian/stdeb/control b/platforms/debian/stdeb/control index e436648..f3113de 100644 --- a/platforms/debian/stdeb/control +++ b/platforms/debian/stdeb/control @@ -2,7 +2,7 @@ Source: git-auto-deploy Maintainer: Oliver Poignant <oliver@poignant.se> Section: python Priority: optional -Build-Depends: python-all (>= 2.6.6-3), debhelper (>= 7) +Build-Depends: python-all (>= 2.6.6-3), debhelper (>= 7), python-setuptools (>= 3) Standards-Version: 3.9.1 diff --git a/platforms/debian/stdeb/git-auto-deploy.postinst b/platforms/debian/stdeb/git-auto-deploy.postinst index c5a2af0..bfd54a2 100755 --- a/platforms/debian/stdeb/git-auto-deploy.postinst +++ b/platforms/debian/stdeb/git-auto-deploy.postinst @@ -14,9 +14,9 @@ addgroup --system $GAD_GID adduser $GAD_UID $GAD_GID # Create config dir -mkdir -p $CONF_DIR -chown -R $GAD_UID:$GAD_GID $CONF_DIR -chmod 750 $CONF_DIR +#mkdir -p $CONF_DIR +#chown -R $GAD_UID:$GAD_GID $CONF_DIR +#chmod 750 $CONF_DIR # Create log file touch /var/log/$NAME.log diff --git a/requirements.txt b/requirements.txt index e69de29..5a11dbe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +setuptools>=20.3.1 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='git-auto-deploy', - version='0.2.1', + version='0.2.1.2', url='https://github.com/olipo186/Git-Auto-Deploy', author='Oliver Poignant', author_email='oliver@poignant.se', |