]> www.vanbest.org Git - tweet-django-debian/commitdiff
Initial Debianisation
authorJan-Pascal van Best <janpascal@vanbest.org>
Thu, 11 Feb 2016 19:25:43 +0000 (20:25 +0100)
committerJan-Pascal van Best <janpascal@vanbest.org>
Thu, 11 Feb 2016 19:25:43 +0000 (20:25 +0100)
21 files changed:
.gitignore
debian/README.source [new file with mode: 0644]
debian/apache.conf [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/config [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dbsettings.py.template [new file with mode: 0644]
debian/gbp.conf [new file with mode: 0644]
debian/patches/patch-settings [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
debian/prerm [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/settings.ini.example [new file with mode: 0644]
debian/settings.py.template [new file with mode: 0644]
debian/source/format [new file with mode: 0644]
debian/tweet-django.dirs [new file with mode: 0644]
debian/tweet-django.links [new file with mode: 0644]

index 8cf8bb1cec417b7dcd5e07f18358eb091301cd9a..7a179ba025f8d1b9ab8002bdc7b3c47b41aa9541 100644 (file)
@@ -5,3 +5,6 @@
 __pycache__
 *.pyc
 *.log
+tweet_django/local.ini
+tweet_django/prod.ini
+.pc
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..582e526
--- /dev/null
@@ -0,0 +1 @@
+This package uses quilt as a patch management system, see /usr/share/doc/quilt/README.source.
diff --git a/debian/apache.conf b/debian/apache.conf
new file mode 100644 (file)
index 0000000..0fb16ba
--- /dev/null
@@ -0,0 +1,8 @@
+WSGIScriptAlias / /usr/share/tweet-django/tweet_django
+WSGIPythonPath /usr/share/tweet-django
+
+<Directory /usr/share/tweet-django/tweet_django/>
+<Files wsgi.py>
+Require all granted
+</Files>
+</Directory>
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..4379157
--- /dev/null
@@ -0,0 +1,5 @@
+tweet-django (1.0-1) unstable; urgency=medium
+
+  * Initial release. (Closes: #XXXXXX)
+
+ -- Jan-Pascal van Best <janpascal@vanbest.org>  Thu, 11 Feb 2016 21:39:09 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..ec63514
--- /dev/null
@@ -0,0 +1 @@
+9
diff --git a/debian/config b/debian/config
new file mode 100644 (file)
index 0000000..8247d89
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+#set -x
+
+. /usr/share/debconf/confmodule
+if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
+       . /usr/share/dbconfig-common/dpkg/config.mysql 
+       dbc_go tweet-django $@
+fi
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..17d6473
--- /dev/null
@@ -0,0 +1,18 @@
+Source: tweet-django
+Section: net
+Priority: optional
+Maintainer: Jan-Pascal van Best <janpascal@vanbest.org>
+Build-Depends: debhelper (>= 9), python3, dh-python, dh-systemd (>= 1.3), quilt
+Standards-Version: 3.9.6
+Vcs-Git: git://anonscm.debian.org/collab-maint/tweet-django.git
+Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/tweet-django.git
+Homepage: https://github.com/tweet-django/tweet-django
+
+Package: tweet-django
+Architecture: all
+Depends: lsb-base (>= 3.1-13), ${python3:Depends}, ${misc:Depends},
+ libapache2-mod-wsgi-py3, dbconfig-common, ucf (>=0.28)
+Recommends: mysql-client
+Suggests: mysql-server
+Description: Utility to help sys admins thwart SSH crackers
+ tweet-django is a program that blah blah blah
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..1800360
--- /dev/null
@@ -0,0 +1,35 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: tweet-django
+Upstream-Contact: Jan-Pascal van Best <janpascal@vanbest.org>
+Source: http://www.vanbest.org/gitweb/tweet_django
+
+Files: *
+Copyright: 2016, Jan-Pascal van Best <janpascal@vanbest.org>
+License: GPL-3+
+
+Files: debian/*
+Copyright: 2016, Jan-Pascal van Best <janpascal@vanbest.org>
+License: GPL-3+
+
+License: GPL-3+
+ 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 3 of the License, or (at your option) any later
+ version.
+ .
+ This program 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 package; if not, see 
+ <http://www.gnu.org/licenses/> or write to the Free 
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, 
+ Boston, MA  02110-1301 USA
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 3 can be found in the file
+ `/usr/share/common-licenses/GPL-3'.
diff --git a/debian/dbsettings.py.template b/debian/dbsettings.py.template
new file mode 100644 (file)
index 0000000..8ee0e4a
--- /dev/null
@@ -0,0 +1,13 @@
+# Database configuration
+# Managed by dbconfig-common
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends._DBC_DBTYPE_',
+        'HOST': '_DBC_DBSERVER_',
+        'NAME': '_DBC_DBNAME_',
+        'USER': '_DBC_DBUSER_',
+        'PASSWORD': '_DBC_DBPASS_',
+        'OPTIONS': {'charset': 'utf8mb4'},
+    }
+}
+
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644 (file)
index 0000000..164cf43
--- /dev/null
@@ -0,0 +1,4 @@
+[DEFAULT]
+debian-branch=master
+upstream-branch=upstream
+upstream-tag=v%(version)s
diff --git a/debian/patches/patch-settings b/debian/patches/patch-settings
new file mode 100644 (file)
index 0000000..23045d2
--- /dev/null
@@ -0,0 +1,79 @@
+--- a/tweet_django/settings.py
++++ b/tweet_django/settings.py
+@@ -20,11 +20,8 @@
+ # Quick-start development settings - unsuitable for production
+ # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
+-# SECURITY WARNING: keep the secret key used in production secret!
+-SECRET_KEY = 'gho@vr!guh#ylqdi4(voavn+*lzyvm&91xnz9c-x6yol5ye%s='
+-
+ # SECURITY WARNING: don't run with debug turned on in production!
+-DEBUG = True
++DEBUG = False
+ ALLOWED_HOSTS = []
+@@ -57,7 +54,7 @@
+ TEMPLATES = [
+     {
+         'BACKEND': 'django.template.backends.django.DjangoTemplates',
+-        'DIRS': [],
++        'DIRS': ['/usr/share/tweet-django/templates'],
+         'APP_DIRS': True,
+         'OPTIONS': {
+             'context_processors': [
+@@ -111,34 +108,6 @@
+ STATIC_URL = '/static/'
+-# Application specific settings
+-
+-TWEET_BASEPATH = 'results'
+-
+-
+-config = ConfigParser()
+-config.read(os.path.join(BASE_DIR, 'tweet_django', 'local.ini'))
+-
+-DATABASES = {
+-    'default': {
+-        'ENGINE': config.get('database', 'ENGINE'),
+-        'NAME': config.get('database', 'NAME'),
+-        'USER': config.get('database', 'USER'),
+-        'PASSWORD': config.get('database', 'PASSWORD'),
+-        'HOST': config.get('database', 'HOST'),
+-        'OPTIONS': {'charset': 'utf8mb4'},
+-    }
+-}
+-
+-TWEET_BASEPATH = config.get('paths', 'TWEET_BASEPATH')
+-
+-TWEET_OAUTH_CONSUMER_KEY = config.get('twitter', 'TWEET_OAUTH_CONSUMER_KEY')
+-TWEET_OAUTH_CONSUMER_SECRET = config.get('twitter', 'TWEET_OAUTH_CONSUMER_SECRET')
+-TWEET_OAUTH_ACCESS_TOKEN = config.get('twitter', 'TWEET_OAUTH_ACCESS_TOKEN')
+-TWEET_OAUTH_ACCESS_TOKEN_SECRET = config.get('twitter', 'TWEET_OAUTH_ACCESS_TOKEN_SECRET')
+-
+-TWEET_MAPQUEST_API_KEY = config.get('geo', 'TWEET_MAPQUEST_API_KEY')
+-
+ # Logging
+ LOGGING = {
+@@ -151,7 +120,7 @@
+         'file': {
+             'level': 'DEBUG',
+             'class': 'logging.FileHandler',
+-            'filename': 'django_debug.log',
++            'filename': '/var/log/tweet-django/debug.log',
+         },
+     },
+     'loggers': {
+@@ -167,3 +136,10 @@
+         },
+     },
+ }
++
++# Database settings, provided by dbconfig_common
++if os.path.exists("/etc/tweet-django/dbsettings.py"):
++    exec(open("/etc/tweet-django/dbsettings.py").read())
++
++if os.path.exists("/etc/tweet-django/settings.py"):
++    exec(open("/etc/tweet-django/settings.py").read())
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..4722455
--- /dev/null
@@ -0,0 +1 @@
+patch-settings
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..91d537c
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+#set -x
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst.mysql 
+dbc_sql_substitutions=1
+dbc_generate_include=template:/etc/tweet-django/dbsettings.py
+dbc_generate_include_args=-otemplate_infile=/usr/share/tweet-django/debian/dbsettings.py.template
+dbc_generate_include_owner=root:www-data
+dbc_generate_include_perms=0640
+dbc_go tweet-django $@
+
+if [ "$1" = configure ] ; then
+    random_key=$( env LANG=C LC_ALL=C tr -dc "[:alnum:]" < /dev/urandom | dd bs=1 count=63 2> /dev/null )
+    tempfile=`tempfile`
+    sed -e "s/__SECRET_KEY__/$random_key/" < /usr/share/tweet-django/debian/settings.py.template > $tempfile
+    chown root:www-data $tempfile
+    chmod 0640 $tempfile
+    ucf --debconf-ok $tempfile /etc/tweet-django/settings.py
+    ucfr tweet-django /etc/tweet-django/settings.py 
+    rm -f $tempfile
+
+    if ! dpkg-statoverride --list /var/log/tweet-django >/dev/null; then
+        chown -R www-data:www-data /var/log/tweet-django
+    fi
+    if ! dpkg-statoverride --list /var/lib/tweet-django >/dev/null; then
+        chown -R www-data:www-data /var/lib/tweet-django
+    fi
+
+    /usr/share/tweet-django/manage.py migrate
+
+fi
+
+#DEBHELPER#
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..20814eb
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+#set -x
+
+if [ -f /usr/share/debconf/confmodule ]; then
+    . /usr/share/debconf/confmodule
+fi
+if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
+    . /usr/share/dbconfig-common/dpkg/postrm.mysql
+    dbc_go tweet-django $@
+fi
+
+
+if [ "$1" = "purge" ]; then
+    for conffile in dbsettings.py settings.py; do
+       rm -f /etc/tweet-django/$conffile
+       if which ucf >/dev/null 2>&1; then
+               ucf --debconf-ok --purge /etc/tweet-django/$conffile
+               ucfr --purge tweet-django /etc/tweet-django/$conffile
+       fi
+    done
+fi
+
+#DEBHELPER#
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..8e6eb08
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+#set -x
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/prerm.mysql 
+dbc_go tweet-django $@
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..d5a87a1
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+DESTDIR := debian/tweet-django
+
+%:
+       dh $@ --with python3,systemd
+
+override_dh_auto_install:
+       install -m 0755 -D manage.py --target-directory=$(DESTDIR)/usr/share/tweet-django/
+       install -m 0755 -D runstream.py --target-directory=$(DESTDIR)/usr/share/tweet-django/
+       install -m 0640 -D tweet/*.py --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet/
+       install -m 0640 -D tweet/migrations/*.py  --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet/migrations
+       install -m 0640 -D tweet/templates/tweet/*  --target-directory=$(DESTDIR)/usr/share/tweet-django/templates/tweet/
+       install -m 0640 -D tweet/static/tweet/favicon.ico  --target-directory=$(DESTDIR)/usr/share/tweet-django/static/tweet/
+       #install -m 0640 -D tweet/static/tweet/javascript/*  --target-directory=$(DESTDIR)/usr/share/tweet-django/static/tweet/javascript/
+       cp -r tweet/static/tweet/stylesheets  --target-directory=$(DESTDIR)/usr/share/tweet-django/static/tweet/
+       install -m 0640 -D tweet_django/*.py  --target-directory=$(DESTDIR)/usr/share/tweet-django/tweet_django/
+       install -m 0640 -D debian/dbsettings.py.template --target-directory=$(DESTDIR)/usr/share/tweet-django/debian/
+       install -m 0640 -D debian/settings.py.template --target-directory=$(DESTDIR)/usr/share/tweet-django/debian/
+       #install -m 0640 -o root -g www-data debian/settings.ini.example $(DESTDIR)/etc/tweet-django/settings.ini
+       install -m 0755 -d $(DESTDIR)/var/lib/tweet-django
+       install -m 0755 -d $(DESTDIR)/var/log/tweet-django
+
diff --git a/debian/settings.ini.example b/debian/settings.ini.example
new file mode 100644 (file)
index 0000000..c16e3f7
--- /dev/null
@@ -0,0 +1,17 @@
+# Database
+[misc]
+SECRET_KEY = 
+
+[paths]
+TWEET_BASEPATH = /var/lib/tweet-django
+STATIC_ROOT = /usr/share/tweet-django/static
+STATIC_URL = /static/
+
+[twitter]
+TWEET_OAUTH_CONSUMER_KEY = 
+TWEET_OAUTH_CONSUMER_SECRET = 
+TWEET_OAUTH_ACCESS_TOKEN = 
+TWEET_OAUTH_ACCESS_TOKEN_SECRET = 
+
+[geo]
+TWEET_MAPQUEST_API_KEY = 
diff --git a/debian/settings.py.template b/debian/settings.py.template
new file mode 100644 (file)
index 0000000..b514a7b
--- /dev/null
@@ -0,0 +1,32 @@
+DEBUG = False
+
+# Fill in the host names your web server uses
+ALLOWED_HOSTS = ["127.0.0.1"]
+
+# Internationalization
+# https://docs.djangoproject.com/en/1.9/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+TIME_ZONE = 'Europe/Amsterdam'
+USE_I18N = True
+USE_L10N = True
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.9/howto/static-files/
+
+STATIC_URL = '/static/'
+
+SECRET_KEY = '__SECRET_KEY__'
+
+TWEET_BASEPATH = '/var/lib/tweet-django'
+STATIC_ROOT = '/usr/share/tweet-django/static'
+STATIC_URL = '/static/'
+
+TWEET_OAUTH_CONSUMER_KEY = ''
+TWEET_OAUTH_CONSUMER_SECRET = ''
+TWEET_OAUTH_ACCESS_TOKEN = ''
+TWEET_OAUTH_ACCESS_TOKEN_SECRET = ''
+
+TWEET_MAPQUEST_API_KEY = ''
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/tweet-django.dirs b/debian/tweet-django.dirs
new file mode 100644 (file)
index 0000000..40af13d
--- /dev/null
@@ -0,0 +1,3 @@
+usr/share/tweet-django/static/tweet/javascript
+usr/share/tweet-django/static/tweet/stylesheets
+/etc/tweet-django
diff --git a/debian/tweet-django.links b/debian/tweet-django.links
new file mode 100644 (file)
index 0000000..905ecc0
--- /dev/null
@@ -0,0 +1,3 @@
+usr/share/javascript/bootstrap/js/bootstrap.min.js usr/share/tweet-django/static/tweet/javascript/bootstrap.min.js
+usr/share/javascript/jquery/jquery.min.js usr/share/tweet-django/static/tweet/javascript/jquery.min.js
+usr/share/javascript/jquery-ui/jquery-ui.min.js usr/share/tweet-django/static/tweet/javascript/jquery-ui.min.js